Adding Admin Tools
Cschoenfeld (Talk | contribs) m (mentioned macro resolution source code) |
Max Ferstl (Talk | contribs) (Removed link to opencms-forum.de) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Extending OpenCms]] | ||
== Admin Tool parameters == | == Admin Tool parameters == | ||
Tools can be given parameters which are automatically appended to the generated tool buttons. Parameters are set using the property ''admintoolhandler-args'' and may have the following syntax. | Tools can be given parameters which are automatically appended to the generated tool buttons. Parameters are set using the property ''admintoolhandler-args'' and may have the following syntax. | ||
− | HandlerArgs: | + | HandlerArgs: "params:" ParamDef ("&" ParamDef)* "|" "path:" Path |
− | Path: | + | Path: VFS or other path |
− | ParamDef: | + | ParamDef: Identifier "=" (MacroDef|Value) |
− | Identifier: | + | Identifier: String value |
− | Value: | + | Value: String value |
− | MacroDef: | + | MacroDef: "${" (FixedMacro | (MacroPrefix "." MacroName) | AdditionalMacro) "}" |
− | MacroPrefix: | + | MacroPrefix: "key" | "param" | "pageContext" |
− | + | | "property" | "elementProperty" | |
− | MacroName: | + | MacroName: String value |
− | FixedMacro: | + | FixedMacro: "currentuser.name" | "currentuser.firstname" | "currentuser.lastname" |
− | + | | "currentuser.fullname" | "currentuser.email" | "currentuser.street" | |
− | + | | "currentuser.zip" | "currentuser.city" | "currentuser.country" | |
− | + | | "request.uri" | "request.folder" | "request.encoding" | "request.locale" | |
− | + | | "currenttime" | |
− | + | | "opencms.uri" | "opencms.filename" | "opencms.folder" | "opencms.default.encoding" | |
+ | AdditionalMacro: Any macro not matching one of MacroPrefix or FixedMacro values | ||
+ | added via CmsMacroResolver.addMacro(String, String) | ||
− | See the method ''CmsMacroResolver.getMacroValue(String)'' for details. It is used indirectly by ''CmsTool.buttonHtml()'' which generates the HTML code for a tool button. The call is nested within ''I_CmsToolHandler.getParameters(CmsWorkplace)'' | + | See the method ''CmsMacroResolver.getMacroValue(String)'' for details. It is used indirectly by ''CmsTool.buttonHtml()'' which generates the HTML code for a tool button. The call is nested within ''I_CmsToolHandler.getParameters(CmsWorkplace)''. |
+ | |||
+ | Another source of macro values is the additional macros list maintained by each ''CmsMacroResolver''. The ''CmsWorkplace'' has an instance of this class with public access via ''getMacroResolver()''. New macro values can be added with ''CmsMacroResolver.addMacro(String,String)'' where the first argument is the full macro name and the second is its value. | ||
=== Explanation of the MacroPrefix values === | === Explanation of the MacroPrefix values === | ||
Line 30: | Line 35: | ||
''elementProperty'' a VFS property of the currently requested element which might be an included resource, not necessarily the resource requested by the user. | ''elementProperty'' a VFS property of the currently requested element which might be an included resource, not necessarily the resource requested by the user. | ||
− | |||
− | |||
− |
Latest revision as of 12:53, 24 April 2014
Admin Tool parameters
Tools can be given parameters which are automatically appended to the generated tool buttons. Parameters are set using the property admintoolhandler-args and may have the following syntax.
HandlerArgs: "params:" ParamDef ("&" ParamDef)* "|" "path:" Path Path: VFS or other path ParamDef: Identifier "=" (MacroDef|Value) Identifier: String value Value: String value MacroDef: "${" (FixedMacro | (MacroPrefix "." MacroName) | AdditionalMacro) "}" MacroPrefix: "key" | "param" | "pageContext" | "property" | "elementProperty" MacroName: String value FixedMacro: "currentuser.name" | "currentuser.firstname" | "currentuser.lastname" | "currentuser.fullname" | "currentuser.email" | "currentuser.street" | "currentuser.zip" | "currentuser.city" | "currentuser.country" | "request.uri" | "request.folder" | "request.encoding" | "request.locale" | "currenttime" | "opencms.uri" | "opencms.filename" | "opencms.folder" | "opencms.default.encoding" AdditionalMacro: Any macro not matching one of MacroPrefix or FixedMacro values added via CmsMacroResolver.addMacro(String, String)
See the method CmsMacroResolver.getMacroValue(String) for details. It is used indirectly by CmsTool.buttonHtml() which generates the HTML code for a tool button. The call is nested within I_CmsToolHandler.getParameters(CmsWorkplace).
Another source of macro values is the additional macros list maintained by each CmsMacroResolver. The CmsWorkplace has an instance of this class with public access via getMacroResolver(). New macro values can be added with CmsMacroResolver.addMacro(String,String) where the first argument is the full macro name and the second is its value.
Explanation of the MacroPrefix values
key is a message bundle key.
param is a HTTP request parameter
pageContext is a JSP page context attribute
property is a VFS property of the requested tool's CMS resource
elementProperty a VFS property of the currently requested element which might be an included resource, not necessarily the resource requested by the user.