Hello,
Following ours discussion here is my purpose proposal of implementation
For the title page:
{code} #elseif ("$!type" == 'hidden') #set ($className = $object.getxWikiClass().name) #if ($doc.fullName == $className) ## We are editing the class so the title must be read from / written to the template document. #set ($name = 'templateTitle') #set ($value = $xwiki.getDocument("$stringtool.removeEnd($className, 'Class')Template").title) #else ## We are editing an application entry so the title must be read from / written to the current document. #set ($name = 'title') #set ($value = $tdoc.title) #if ("$!value" == '') #set ($value = $tdoc.documentReference.name) #end #end {{html clean="false"}} <input type="hidden" name="$name" value="$!escapetool.xml($value)"/> {{/html}} {code}
And for the content page: {code} #elseif ($type == 'hidden') #set ($className = $object.getxWikiClass().name) #if ($doc.fullName == $className) ## We are editing the class so the content must be read from / written to the template document. #set ($name = 'templateContent') #set ($editedDocument = $xwiki.getDocument("$stringtool.removeEnd($className, 'Class')Template")) ## Don't load the WYSIWYG editor when editing the class, because it's too heavy. #set ($useWysiwygEditor = false) #else ## We are editing an application entry so the content must be read from / written to the current document. #set ($name = 'content') #set ($editedDocument = $tdoc) ## Use the preferred content editor. #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') #end {{html clean="false"}} <input type="hidden" id="$id" name="$name" value="$!escapetool.xml($editedDocument.content)"/> {{/html}} {code}
Note that we can probably factorise a part of this code with the 'edit' type (and rename some variable to make more sens). |
|