Overview
In order for applications to duplicate properly, database IDs, column IDs, node IDs and token must be stored in a serialized format. Applications need to serialize their IDs via the SK.Util.serialize* functions and/or the SK.DB.Setup.Serialized class. When duplicating a site, the Back-end will replace all serialized IDs with the newly duplicated ones.
The application must indicate in its ad.json that it can be duplicated. If the app stores some IDs/tokens it should indicate weather they are stored in app's properties and/or the app configuration
Functions
Serialization and Deserialization functionality provided by:
function SK.Util.serializeDBId ( id ) |
In ad.json:
"duplication": true, // default false |
Example serialization code:
// create a db and return its info in serialized format |
Example deserialization code:
SK__SomeApplication = new Class({ |
Object oriented interface
var serializer = new SK.Util.Serializer(); |
Property Sheets
To (de)serialize properties, application need to extend SK.UI.Object.Properties and overwrite parents methods getObjectEnv getProperties as shown in the example below. Each property which should be (de)serialized must have an html attribute serialized="...". Available types of serialized attributes are "db_id" "col_id" "node" "token" "multi".
html code:
class="field-text w6u" id="field.Database" serializable="db_id" name="property__Database" |
javascript code:
SK.MembersLogin.Properties = new Class({ |
If required, application may not use this functionality. Instead apps could hook on property sheet events (see Property Sheets) and do their (de)serialization manually.