abstract class %ZEN.Template.studioTemplate
extends %ZEN.Component.page
Base class for Zen-based Studio Templates.
Zen-based Studio Templates extend this class.
This is a Zen Page class.
parameter AUTOLOGOUT = 0;
Do not use AutoLogout logic for template pages.
parameter AUTONS = 1;
If auto-switch namespace to whatever $NAMESPACE is passed in
parameter CHARSET = "UTF-8";
Prevent IE issues with non-UTF8 char-sets.
parameter GLOBALTEMPLATE = 1;
If this is true then even if this template is tied to a specific namespace it
will be available in any namespace and it will be up to the template to make sure
it looks for any specific data in the target namespace.
parameter HELPID;
DOCBOOK Topic Id that offers help for this template.
parameter TEMPLATEACCELERATOR;
Accelerator key for this template in Studio, 0-9.
User will press Ctrl+Alt+key to activate.
parameter TEMPLATEDESCRIPTION;
Short description of the template to show in Studio.
If DOMAIN is defined this will be localized.
parameter TEMPLATEGROUP;
If this is a TEMPLATEMODE="new" then this is the name of the tab
in Studio this template is dispayed on. If none specified then
it displays on 'Custom' tab.
parameter TEMPLATEMODE = "template";
Specifies what type of template this is: 'template', 'new', or 'addin'.
'template' is the default and this
creates code that is inserted into the current document,
'new' is a template that appears on the dialog when you
click the new button, 'addin' is a template that appears
on the addin menu which does not generate any output.
parameter TEMPLATENAME;
Name of the template to show in Studio.
If DOMAIN is defined this will be localized.
parameter TEMPLATENOOUTPUT = 0;
Set this true (1) if this template does not generate any
output, only applies to 'template' types but it prevents
Studio from needing to make the current file writable.
parameter TEMPLATETITLE;
Title of the template to show in the template window.
parameter TEMPLATETYPE = "*";
Comma separated list of 'CSP', 'CSR', 'MAC', 'INT', 'INC',
'BAS', 'CLS' to say what type of code this template
generates; CSP, CSR, Routine, or Class code.
You can also specify '*' for all types.
parameter VALIDATEXML = 0;
Validate user pages
property DocumentName
as %ZEN.Datatype.string(ZENURL="Name");
Name of current document within Studio.
property DocumentNamespace
as %ZEN.Datatype.string(ZENURL="DocumentNamespace");
Namespace of current document within Studio.
property Language
as %ZEN.Datatype.string(ZENURL="Language");
Current language within Studio (e.g., "cache").
property Namespace
as %ZEN.Datatype.string(ZENURL="Namespace");
Current namespace within Studio.
property Project
as %ZEN.Datatype.string(ZENURL="Project");
Current project within Studio.
property SelectedText
as %ZEN.Datatype.string(ZENURL="SelectedText");
Current selected text within Studio.
property User
as %ZEN.Datatype.string(ZENURL="User");
Current user within Studio.
property helpId
as %ZEN.Datatype.string [ InitialExpression = ..#HELPID ];
DocBook topic id used to show help for this template.
classmethod %AddToProject(Name As %String)
as %Status
Add this named item to the current project in Studio. If you have multiple items
then call this method multiple times. The Name must contain the type of
the item e.g. 'User.Test.cls' is a class, and 'TEST.mac' is a MAC routine.
classmethod %AddToSourceControl(Name As %String)
as %Status
Add this item to source control. If you have multiple items then call this method
multiple times. The Name must contain the type of the item to add e.g.
'User.Test.cls'.
method %DrawTitle(pSeed As %String)
as %Status
Provide HTML for standard template html title box.
method %OnDrawHTMLMeta()
as %Status
Force IE to run in its newest version.
classmethod %OnSubmit(pSubmit As %ZEN.Submit)
as %Status
This callback is called when a form on this page is submitted.
pSubmit is a %ZEN.Submit object
containing details of the form submit.
Subclasses override this method.
method %OnTemplateAction()
as %Status
This method is called when the template is complete. Any
output to the principal device is returned to the Studio.
This is implemented by subclasses.
classmethod %SetClassName(Name As %String)
as %Status
If you are making a new class template then Studio needs to be told the
name of this class. This is done by calling this method in the final
page passing the name of the class.
classmethod %TemplateHeader()
Internal method to output the start of the XML data section
classmethod IsEnabled()
as %Boolean
Return false from this method to disable this template (for example based on the server platform)
method IsValidClassName(pCls As %String)
as %String
[ ZenMethod ]
Validate that the given class name is valid.
Returns an error message if invalid.
classmethod LocalizeName(id As %String, ByRef name As %String, ByRef description As %String)
as %Status
Localize the name and description for this template.
classmethod OnHTTPHeader(ByRef OutputBody As %Boolean)
as %Status
Make sure template generates correct format output.
classmethod OnPage()
as %Status
Render the contents of this ZEN page.
classmethod OnPostHTTP()
For final page, make sure we send the correct info to the Studio.
classmethod OnPreHTTP()
as %Boolean
Make sure template runs in correct namespace.
method adjustSize()
[ Language = javascript ]
Adjust size and position of components on this page.
method canFinish()
[ Language = javascript ]
Return true if this template can Finish (i.e., enable
the Finish button).
This is implemented by subclasses.
method canGoBack()
[ Language = javascript ]
Return true if this template can go to the previous page (i.e., enable
the Back button).
This is implemented by subclasses.
method canGoNext()
[ Language = javascript ]
Return true if this template can go to the next page (i.e., enable
the Next button).
This is implemented by subclasses.
method cancelTemplate()
[ Language = javascript ]
Close the template window.
method finishTemplate()
[ Language = javascript ]
Finish the template: fire the template action code
method formValidationHandler()
[ Language = javascript ]
Validation handler for form built-into template.
method hasMultiplePages()
[ Language = javascript ]
Return true if this template has more than one "page".
This will display Back and Next buttons.
This is implemented by subclasses.
method nextPage()
[ Language = javascript ]
Go to the next page of the template (if there is one).
This is implemented by subclasses.
method onfinishHandler()
[ Language = javascript ]
This is called when the template is finished;
method onkeydownHandler(evt)
[ Language = javascript ]
This client event, if present, is fired when a keydown event occurs on the page.
method onlayoutHandler(load)
[ Language = javascript ]
This client event, if present, is fired when the page
is first loaded or whenever it is resized.
If this is called at load time, then load will
be true.
method onloadHandler()
[ Language = javascript ]
This client event, if present, is fired when the page is loaded.
method onstartHandler()
[ Language = javascript ]
This is called when the template is first displayed;
This provides a chance to set focus etc.
method previousPage()
[ Language = javascript ]
Go to the previous page of the template (if there is one).
This is implemented by subclasses.
method showDocumentation(topic)
[ Language = javascript ]
Open a browser window to show documentation.
method showHelp()
[ Language = javascript ]
Show the help message for this template.
This opens a browser and goes to the DocBook application
using the value given by helpId.
method updateState()
[ Language = javascript ]
Update the state of the template buttons.
Subclasses should call this method when they need to
update the state of the footer buttons.