Namespace: Document

Appearition.Site.Document

Use the functions under this module to create, change and remove Site Documents on the Appearition platform

Methods

Appearition.Site.Document.CreateSiteDocument (request, requestOptions)Appearition.Site.Document.SiteDocItemViewModel static

Will create a new record in the database to hold the site document information. Once this returns successfully, you can invoke the UploadSiteDocument method to push the new file up to the server. You will need to pick up the new SiteDocumentId from the return object and pass it to the UploadSiteDocument. Will return an Appearition.Site.Document.SiteDocItemViewModel object

Name Type Description
request Appearition.Site.Document.SiteDocItemViewModel

Contains the details of the site document

requestOptions Appearition.RequestOptions

Contains the various callback methods for this request

Returns:
Type Description
Appearition.Site.Document.SiteDocItemViewModel This is returned as part of the success callback function in the requestOptions param

Appearition.Site.Document.DeleteSiteDocument (request, requestOptions) static

Will delete an existing site document. Nothing will be returned unless an error occurs.

Name Type Description
request Appearition.Site.Document.SiteDocItemViewModel

Contains the details of the site

requestOptions Appearition.RequestOptions

Contains the various callback methods for this request

Appearition.Site.Document.SiteDocuments (siteId, requestOptions)Appearition.Site.Document.SiteDocViewModel static

This method will return all documents linked to the specified site record. It will return a collection of Appearition.Site.Document.SiteDocViewModel

Name Type Description
siteId number

uniquely identifies the site for which the documents are being returned

requestOptions Appearition.RequestOptions

configure callbacks

Returns:
Type Description
Appearition.Site.Document.SiteDocViewModel This is returned as part of the success callback function in the requestOptions param

Appearition.Site.Document.UpdateSiteDocument (request, requestOptions)Appearition.Site.Document.SiteDocItemViewModel static

Will setup a new version of the site document. Once this returns successfully, you can invoke the UploadSiteDocument method to push the new file up to the server. You will need to pick up the new SiteDocumentId from the return object and pass it to the UploadSiteDocument. Will return an Appearition.Site.Document.SiteDocItemViewModel object

Name Type Description
request Appearition.Site.Document.SiteDocItemViewModel

Contains the details of the site

requestOptions Appearition.RequestOptions

Contains the various callback methods for this request

Returns:
Type Description
Appearition.Site.Document.SiteDocItemViewModel This is returned as part of the success callback function in the requestOptions param

Appearition.Site.Document.UploadSiteDocument (siteDocumentId, fileName, fileContent, requestOptions) static

Once the CreateSiteDocument or UpdateSiteDocument methods succeed, invoke this method to upload the file to the server. This will not return anything unless a failure occurs.

Name Type Description
siteDocumentId number

The unique identifier of the Site Document which returned by the CreateSiteDocument or UpdateSiteDocument methods

fileName number

The name of the file being uploaded

fileContent string

The file contents that need to be submitted to the server

requestOptions Appearition.RequestOptions

Contains the various callback methods for this request

Type Definitions

Appearition.Site.Document.SiteDocItemViewModel

This data structure holds the details of a specific site document

Properties:
Name Type Description
SiteDocumentId number

The unique identifier of the Site Document. This is a system generated value

SiteId number

The unique identifier of the Site this document is linked to

FormId number

The unique identifier of the Form this document is linked to (can be empty)

FormName string

The name of the form if one is linked

DocumentTitle string

The title of the document. This will differ to FileName

Description string

The description of the document

FileName string

The description of the document

DocumentVersion number

The version of the document. You upload a new file to an existing SiteDocument and the version number will increment

ModifiedUtcDateDisplay string

The date/time the document was changed. (Format "d/MM/yy HH:mm"). Note, whilst the field name suggest UTC, the server will attempt to convert it to your local timezone if its known. If not the UTC date is simply returned

Appearition.Site.Document.SiteDocViewModel

This data structure holds the details of a specific site and a collection of all its documents

Properties:
Name Type Description
Site Appearition.Site.Manage.SiteViewModel

The details of the specific site

Docs Array.<Appearition.Site.Document.SiteDocItemViewModel>

The collection of documents linked to the site

Doc Appearition.Site.Document.SiteDocItemViewModel

Is an empty data structure that can be used to setup a new doc for saving to the server

ProjectFormList Array.<Appearition.SelectListItem>

A list of forms available. A site document may be allocated to a specific form in a site