Class Reference
%CSP.Portal.SourceControl.Base
|
|
![]() |
|||
Private Storage |
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
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: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
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 for the document as well as a valid ReadOnly value. In this case, a valid ReadOnly value should be determined as follows:
Method SubmitModel( pCommand As %String, pProvider As %ZEN.Auxiliary.jsonProvider, pSubmitObject As %RegisteredObject, ByRef pResponseObject As %RegisteredObject) As %Status { Set tSC = $$$OK Try { Set tReadOnly = 0 If (pCommand '= "forcesave") && ##class(%Dictionary.ClassDefinition).%ExistsId(..modelClassName) { // Note that 1 is passed in for the pExclusiveOnly argument as we need an exclusive lock Set tSC = ..LoadClassDefinition(..modelClassName,.tModelDef,.tReadOnly,1) If $$$ISERR(tSC) Quit If $zdatetime(tModelDef.TimeChanged,3,,6) '= pSubmitObject.Timestamp { Set pProvider.error = "timestamp" Quit } } Set tSC = pSubmitObject.SaveToClass() If $$$ISERR(tSC) Quit // send up-to-date model back to client, this should include updated timestamp Set pResponseObject = pSubmitObject // correct the ReadOnly flag on the response object If ..IsSourceControlReadOnly(..GetInternalName()) { Set pResponseObject.ReadOnly = 2 } Else { Set pResponseObject.ReadOnly = tReadOnly } } Catch(ex) { Set tSC = ex.AsStatus() } Quit tSC }
|
|
Subclasses | ||
---|---|---|
%DeepSee.UI.Architect | %DeepSee.UI.ArchitectSA | %DeepSee.UI.QualityMeasures |
%DeepSee.UserPortal.Application | %DeepSee.UserPortal.DashboardViewer | EnsPortal.Template.devPage |
|
Resource for subclasses to indicate whether further resources are needed to perform actions on pages.
Page to use for managing popups requested by the source control framework.
Page to use for displaying output from the server.
|
Flag to indicate whether the user is permitted to make any changes on a given page.
The current namespace.
The name of the currently active/selected project.
The current user's username
Flag to indicate whether source control output is present in the current session.
Message to inform the user they may not perform a given action.
Flag to indicate whether a project is needed for the current source control hooks.
If true, user cannot modify the current document.
Indicator for why a document was marked as readOnly. WhenreadOnly is true, theupdateDocumentState () is responsible for ensuring that the property should either have a value of "sourcecontrol" or "lock".
Flag to indicate whether the document has been renamed via "Save As".
Flag to indicate whether source control hooks are enabled for the current namespace.
Name of the manager page to use for managing popups requested by the source control class.
Flag to control what newline format should be used for reporting data from the server. The default output is HTML.
Name of the output dialog to use.
Flag to indicate whether the source control output is currently visible.
|
This is a helper method to render the default HTML for the source control options in the ribbon, and should be called from the OnDrawRibbon() callback. This content should be wrapped within a td element.
The subclass should invoke this method from its own %OnDrawHTMLHead() method.
Ensure that zenMenus.js and zenCSLM.js are included in the page.
Render the CSS needed for the source control icons.
Server-side wrapper around the AfterUserAction callback.
Add output to the session data on the server.
Clear the output for the session.
Create a new Studio project on the server.
Implement the correct callbacks around loading a document.
Implement the correct callbacks around saving a document.
Return the internal name of the current document, including the three letter extension in upper-case. For example, MyPackage.MyClass.CLS would be the internal name for the class MyPackage.MyClass. Subclasses MUST override this method.
Determine which source control commands should be drawn for the current context.
Get the timestamp for the current document.
Indicate whether there is Source Control output for the session.
Load the named project in pProject using the source control object supplied in pSourceControl. The pRedirect flag controls whether a local redirect should be created.
Update the _sourceControlMenu Javascript object representing the contents of the source control menus.
Server-side wrapper around the UserAction callback.
Render the server output from source control commands on the client.
Helper method to indicate whether the user is allowed to make changes to the current document. It should check whether the user is allowed to make changes in general (which should be indicated bycanEdit ), as well as whether the current document has been opened in read only mode (which should be indicated bycanEdit ). noAlert is a flag to indicate that the check should not raise an alert.
Helper method for event sequencing: the onmousedown event for the menu buttons and shapes in the SVG diagram may be executed before the onchange event for controls in the editor pane. This helper function will call the onchange event for any controls which have had their value changed. (There should only be one such control in most cases as the onchange event would be triggered when shifting focus to a second control.)
Handle a source control menu selection.
The user has selected on of the projects listed in the dropdown.
Clear the source control output on the server and update the content star.
Helper method to create an item in the source control menu.
Create a new project on the server.
Helper method to create a submenu in the source control menu.
Get the jsonProvider object on the client. Subclasses MUST override this method to return the jsonProvider.
Return the extension used by Studio for the class/object. This is ".CLS" by default, but subclasses should override this method if a different extension is in use.
Return the current name of the class/object being modified. Subclasses MUST override this method to return the correct name.
Get the title string to add to the locator row. This should be implemented in a subclass.
Callback to get the text of the reason for the current document being loaded as readonly.
Return the string used as the command when sending JSON content to the server. The OnSubmitContent handler for the jsonProvider MUST support two action types.
Function to initialize the source control hooks for a page. The function should be called from the subclass'sonloadHandler () method.
Initialize the text monitor for the page.
Client-side coordinator of calls to the AfterUserAction callback in the core source control class.
Client-side coordinator of calls to the UserAction callback in the core source control class.
Method to load document from the client and invoke the correct source control hooks.
Callback invoked when a document is being loaded.
Callback method invoked after we have successfully loaded the current document.
Callback invoked when a document is being saved.
Callback method invoked after we successfully save the current document.
Add check to ensure that we correctly load documents on the client when source control hooks are in use.
Reload the current document. Returns a boolean to indicate whether a full page reload has been triggered.
Save the current document using the correct source control hooks.
SetreadOnly to the value of readOnly. Subclasses MUST implement this method to update the controls on the page so that the page's behaviour actually matches the value of the readOnly flag.
Notify the server that a specific project has been chosen.
Display the source control menu based on the contents of the _sourceControlMenu data created byUpdateSCMenu ().
Open a popup to display the current source control output.
Key handler to record the value of text fields before the keyboard event is processed. Works in conjunction withtextControlKeyUp () to determine whether any text fields are modified.
Key handler to work out whether user keys entered in controls have changed the content of the text field. This is to deal with situations where the onchange event for a text control is only triggered after the onmousedown event for another shape has already occurred.
Helper method to ensure that thereadOnly andreadOnlyReason properties are up to date on the client, and that the user knows about any change that has rendered the document read only.
Toggle the display of the star which indicates whether new source control output is available.