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:
- initializeSourceControl()() must be called from the subclass's onloadHandler()() method.
- %DrawSourceControlHead()() must be called from the subclass's %OnDrawHTMLHead()() method.
- %DrawSourceControlCommands()() must be called from the subclass's OnDrawRibbon()() method.
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