Classes

Class FolderAPI


Extends ContentObjectAPI, TagContainerAPI.

Defined in: folder.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
FolderAPI(id, success, error, settings)
Field Summary
Field Attributes Field Name and Description
<static>  
FolderAPI.WRITEABLE_PROPS
Writable properties for the folder object.
Method Summary
Method Attributes Method Name and Description
<static>  
FolderAPI.createFolder(name, settings, success, error)
Create a sub folder within this folder, with the option of also automatically creating a startpage for this folder.
<static>  
FolderAPI.createPage(templateId, options, success, error)
Creates a new page inside this folder.
<static>  
FolderAPI.files(success, error)
Retreive a list of all files in this folder.
<static>  
FolderAPI.folders(success, error)
Retreive a list of all sub folders of this folder.
<static>  
FolderAPI.images(success, error)
Retreive a list of all images in this folder.
<static>  
FolderAPI.multipartUploadURL(applyContentWrapperFilter, filterContentType)
Get the upload URL that is capable of dealing with multipart form data.
<static>  
FolderAPI.node(success, error)
Get this content object's node.
<static>  
FolderAPI.page(id, success, error)
Returns page of the given id which resides in this folder.
<static>  
FolderAPI.pages(success, error)
Retreive a list of all pages this folder.
<static>  
FolderAPI.parent(success, error)
Gets this folder's parent folder.
<static>  
FolderAPI.perm(optional)
Check if a given permission is available for a folder.
<static>  
FolderAPI.remove(success, error)
Removes the folder and all its children
<static>  
FolderAPI.save(success, error)
Persist changes made to the object in Gentics Content.Node .
<static>  
FolderAPI.uploadURL()
Get a URL for uploading files into this folder.

Class Detail

FolderAPI(id, success, error, settings)

Parameters:
{number|string} id
of the file to be loaded
{function(ContentObjectAPI))=} success
Optional success callback that will receive this object as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
{object} settings
currently there are no additional settings to be used

Field Detail

FolderAPI.WRITEABLE_PROPS

Writable properties for the folder object. Currently description, motherId, name and publishDir are writeable.

Method Detail

FolderAPI.createFolder(name, settings, success, error)

Create a sub folder within this folder, with the option of also automatically creating a startpage for this folder.
Parameters:
{string} name
the folder name
{object} settings
pass in an optional settings object possible options are:
    {
       // optional description for the folder
       description: 'this is my folder',
       // set a publish directory for the folder
       publishDir: '/this/is/my/folder/',
       // adding a template id will automatically create a new
       // startpage for the folder
       templateId: 5,
       // provide a language code for the start page. optional.
       language: 'en',
       // when true creating the folder will fail if a folder with
       // that name exists. otherwise conflicting names will be
       // postfixed with an increasing number. defaults to false.
       failOnDuplicate: false
    }
    
{function(FolderAPI)=} success
Optional callback that will receive a FolderAPI object as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
Throws:
UNKNOWN_ARGUMENT Thrown when unexpected arguments are provided.

{PageAPI} FolderAPI.createPage(templateId, options, success, error)

Creates a new page inside this folder.
Parameters:
{number} templateId
The id of the template to be used for the page.
{object} options
Set all the options to create a page the following options are allowed:
GCN.folder(4711).createPage(13, {
    // set a language code for the new page like 'en', 'de', ...
    // if you don't supply a language code the page will have
    // no language assigned
    language: 'en',
    // id of the page this page should be a variant of
    variantId: 42
  });
{function(PageAPI)=} success
Optional callback that will receive a PageAPI object as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
Returns:
{PageAPI} The newly created page.

FolderAPI.files(success, error)

Retreive a list of all files in this folder.
Parameters:
{function(Array.FileAPI)=} success
Optional callback that will receive an array of FileAPI objects as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.

FolderAPI.folders(success, error)

Retreive a list of all sub folders of this folder.
Parameters:
{function(Array.FolderAPI)=} success
Optional callback that will receive an array of FolderAPI objects as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.

FolderAPI.images(success, error)

Retreive a list of all images in this folder.
Parameters:
{function(Array.ImageAPI)=} success
Optional callback that will receive an array of ImageAPI objects as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.

{string} FolderAPI.multipartUploadURL(applyContentWrapperFilter, filterContentType)

Get the upload URL that is capable of dealing with multipart form data.
Parameters:
{boolean} applyContentWrapperFilter
When true the reponse will be wrapped so that it can be interpreted by various upload implementations.
{string} filterContentType
Define a custom content type that should be used for the server side implementation. The defined content type will modify the response 'Content-Type' header value.
Returns:
{string} Rest API url for multipart file upload.

{NodeAPI} FolderAPI.node(success, error)

Get this content object's node.
Parameters:
{funtion(NodeAPI)=} success
Optional callback to receive a NodeAPI object as the only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
Returns:
{NodeAPI} This object's node.

{PageAPI} FolderAPI.page(id, success, error)

Returns page of the given id which resides in this folder.
Parameters:
{number} id
{function(PageAPI)=} success
Optional callback that will receive a PageAPI object as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
Returns:
{PageAPI}

FolderAPI.pages(success, error)

Retreive a list of all pages this folder.
Parameters:
{function(Array.PageAPI)=} success
Optional callback that will receive an array of PageAPI objects as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.

{FolderAPI} FolderAPI.parent(success, error)

Gets this folder's parent folder. If this folder does not have a parent, then the returned object will be an API to an object that does not exists. Only when attempting to perform read/write operations on this object on the server will a `NOTFOUND' error be encountered. We recognize that this is relatively late for the use to find out that this folder has no parent; if the use need to guarantee that a parent folder exists before further operations, they are simply to pass a callback into this function.
Parameters:
{function(FolderAPI)=} success
Optional callback that will receive this object as its only argument.
{function(GCNError):boolean=} error
Optional custom error handler.
Returns:
{FolderAPI} The parent folder

{boolean|Array.} FolderAPI.perm(optional)

Check if a given permission is available for a folder. If no name is provided an array of available permissions is returned.
Parameters:
{name} optional
Privilege name to be checked. possible values are: "viewfolder" "createfolder" "updatefolder" "deletefolder" "viewpage" "createpage" "updatepage" "deletepage" "publishpage" "viewtemplate" "createtemplate" "linktemplate" "updatetemplate" "deletetemplate"
Returns:
{boolean|Array.} Permission value for the given name or an array of permissions

FolderAPI.remove(success, error)

Removes the folder and all its children
Parameters:
{function(FolderAPI)=} success
Optional callback that will receive this object as its only argument.
{function(GCNError):boolean} error
Optional custom error handler.

FolderAPI.save(success, error)

Persist changes made to the object in Gentics Content.Node .
Parameters:
{function(FolderAPI)=} success
Optional callback that will receive this object as its only argument.
{function(GCNError):boolean} error
Optional custom error handler.

{string} FolderAPI.uploadURL()

Get a URL for uploading files into this folder.
Returns:
{string} Rest API url for file uploading.

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Nov 06 2024 15:03:20 GMT-0000 (UTC)