Home > Class Reference > ENSLIB namespace > %CSP.Portal.SourceControl.Base


abstract class %CSP.Portal.SourceControl.Base extends %CSP.Portal.SourceControl.Util

This class is for internal InterSystems use only. The class is subject to change and should not be used by user applications.

Template for portal pages which need to be able to interact with Source Control hooks. This class implements various interfaces and behaviours into the standard Studio patterns used for %Studio.SourceControl.Base. Note that the browser environment is inherently stateless, so the object implementing the source control hooks needs to be created from scratch every time the browser makes a request back to the server. Source control hooks written for the Studio environment will need to adjust for this situation. To assist in this migration, the hooks can should override the OnPortalCreate() callback that is inherited from %Studio.SourceControl.Base to ensure that the Source Control object is correctly initialised whenever it is created.

Users should also modify the behaviour of any Studio templates invoked from their source control hooks.

It is critical that pages which extend this class implement a number of callbacks. The following methods MUST be overridden:

The following methods may also need to be overridden depending on the page: Furthermore, the user MUST ensure that the following methods are called from the subclass: It is also assumed that a Zen jsonProvider instance is used to represent the data model in the page. The object used for the model MUST extend %CSP.Portal.AbstractPortalModel OR include a Timestamp property and a ReadOnly property as per the interface defined in %CSP.Portal.AbstractPortalModel if custom JSON is sent from the server to the client. These two properties are used to ensure that the client and server versions of the document model are synchronised. Furthermore, the OnSubmitContent callback implemented in the page MUST perform a number of actions.

First, it must support two save modes. The first such mode is a standard save mode. The value of the command string for this mode should be specified in the getSaveAction()() callback. When this standard save mode is specified, the server method must check whether the timestamp of the model on disk matches the Timestamp property of the submitted model. If they don't match, the error property of the supplied jsonProvider instance should be set to the string "timestamp". When the page sees this error, the user will be prompted to decide if they want to overwrite the data on the server. If the user does choose to overwrite the data, then getSaveAction()() will be invoked to get the force save action. In this case, the OnSubmitContent callback should NOT perform any timestamp checks -- the model should be saved to disk.

If the timestamps match, or the force command is supplied, and the model is saved to disk, the method should then ensure that an updated model is sent back to the client in the output object argument of the callback. The updated model should include both the new Timestamp fo