CCRX Molecule

From oWiki

Jump to: navigation, search

Contents


Preference Dialog

None.

Attributes

type

string  ( r )
Type of this molecule, 'ccrx'.


Methods

rename(n)

n: string

Rename this molecule.

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()

Delete this molecule.

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. 

File:Vault explorer.png

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.
Personal tools