From oWiki
Contents
- 1 Preference Dialog
- 2 Attributes
- 3 Methods
- 3.1 rename(n)
- 3.2 clone()
- 3.3 attach(droplet)
- 3.4 detach()
- 3.5 deleteMod()
- 3.6 serialize()
- 3.7 askUserForData(out string file_name, out string file_type, in string callback)
- 3.8 retrieveFormRecords(in DOMWindow win, in string uri, in long start, in long count, in string callback)
- 3.9 getDataFromFile( in string uri, out string file_type, out string error )
- 3.10 modifyACL( in string uri, in string action, in string name, out string error )
- 3.11 setState( in string key, in string value )
- 3.12 getState( in string key )
- 3.13 query( in object q, in object callback)
|
Preference Dialog
None.
Attributes
type
string ( r )
Type of this molecule, 'ccrx'.
Methods
rename(n)
n: string
clone()
Return: a molecule
| Create a clone of this molecule.
|
attach(droplet)
droplet: a droplet object (e.g. app.box.droplet)
| Attach this molecule to a droplet.
|
detach()
| Remove this molecule from its droplet.
|
deleteMod()
serialize()
Return: string
| Serialize this molecule into its JSON representation.
|
askUserForData(out string file_name, out string file_type, in string callback)
Open the Vault Explorer dialog (see below) and ask the current user to select a file from his/her vault. The file name and file type are returned immediately while the file content is returned in a javascript callback function. The callback function must have the following form:
callback( params )
param.data: the file content.
param.error: the error message if any.
|
retrieveFormRecords(in DOMWindow win, in string uri, in long start, in long count, in string callback)
This function queries oTakhi server for any form data collected for the given form at ccrx uri. 'start' is the starting index of the form data entry. 'count' is the number of entries to fetch. The returned form data is in the format of XML (see below) and is sent to the javascript callback function. This function must be a document-level function and It would fail if the caller is not the owner of the form. The callback function must have the following form:
callback( params )
params.records: the XML file containing the records.
params.count: the number of records in this file.
params.error: the error message, if any.
Form Records in XML Format
|
getDataFromFile( in string uri, out string file_type, out string error )
| This function retrieves file content from a file at 'ccrx uri'. The caller must have read access for this function to succeed. If successful, the file content is in the function's return value, file type in 'file_type' and error message, if any, in 'error'.
|
modifyACL( in string uri, in string action, in string name, out string error )
This function modifies the Access Control Lists associated with a file at 'uri'. The caller must be the owner of the file for it to succeed. Possible 'action' are:
| Value |
Description |
| delete_read_acl |
delete the member whose nickname given in 'name' from the file's read access control list. |
| add_read_acl |
add the member whose nickname given in 'name' to the file's read access control list. |
| delete_write_acl |
delete the member whose nickname given in 'name' from the file's write access control list. |
| add_write_acl |
add the member whose nickname given in 'name' to the file's write access control list. |
|
setState( in string key, in string value )
| This function stores a key-value pair in the user's local storage.
|
getState( in string key )
This function returns value for a given key from the current user's local storage.
There are 2 reserved keys:
current_user: the nickname of the member that is currently running this method.
current_document: the URL of the document that is currently calling this method.
|
query( in object q, in object callback)
| This function queries the repository for previously published objects (application, formations, droplets, blueprints) using the given filter object q and passes back the result to the callback function given either as a script molecule or a document-level function.
|
Possible filter properties are:
| Value |
Description |
| name |
Name of the published object. |
| publisher |
Nickname of the publisher. |
| desc |
partial description text. |
| comm |
partial comment text. |
| category |
The category of the object. |
| tag |
Search by tag. |
| implements |
The blueprint IDs that the object implements. |
| attrb |
Search by attribute. |
| filter |
Search by type (application, formation, droplet, or blueprint). |
| guid |
Search by the unique ID of an object. |
| start |
Returns the object starting from the given index. Default 0. |
| count |
The number of objects to return. |
| orderby |
Order of the result using one of the values above. Default is the latest first. |
|
| The callback function is passed the query result in an input object params and params.result contains the returned records as an array of object. (e.g. var record = params.result[2]; ).
|
Each record has the following properties:
| Value |
Description |
| name |
Name of the published object. |
| time |
Unix time this object was published. |
| quid |
Object's unique ID. |
| nickname |
Nickname of the publisher. |
| owner |
Owner of the object. |
| category |
The category of the object. |
| type |
Object type (application, formation, droplet, or blueprint). |
| implements |
The blueprint IDs that the object implements. |
| description |
Full description of the object. |
| comments |
Full comments of the object. |
| unitid |
The unique ID of the parent object that this object belongs to. |
| cost |
The cost of this object. |
| tags |
The tags associated with this object. |
| embedURL |
The URL that this object in raw JSON string is located and can be embedded into another project. |
|