Wiki source code of Content

Last modified by Martin Výlet on 19.03.2025 21:26

Show last authors
1 {{velocity}}
2 #if ($type == 'edit')
3 #set ($className = $object.getxWikiClass().name)
4 #if ($doc.fullName == $className)
5 ## We are editing the class so the content must be read from / written to the template document.
6 #set ($name = 'templateContent')
7 #set ($editedDocument = $xwiki.getDocument("$stringtool.removeEnd($className, 'Class')Template"))
8 #else
9 ## We are editing an application entry so the content must be read from / written to the current document.
10 #set ($name = 'content')
11 #set ($editedDocument = $tdoc)
12 #end
13 ## Use the preferred content editor.
14 #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg')
15 {{html clean="false"}}
16 ## The "content" id is expected by some JavaScript and CSS code.
17 #set ($id = 'content')
18 #if (!$useWysiwygEditor)
19 <div id="xwikieditcontentinner">
20 ## The tool bar may have an entry to insert an HTML macro. Make sure it doesn't break the HTML macro we are currently in.
21 #set ($toolBar = "#template('simpleedittoolbar.vm')")
22 $!toolBar.replace('{{', '&#123;&#123;')
23 ## Display a simple textarea.
24 <textarea id="$id" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea>
25 #end
26 #if ($useWysiwygEditor)
27 $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, {
28 'id': "$id",
29 'name': "$name",
30 'rows': 25,
31 'cols': 80,
32 'full': true,
33 'restricted': $editedDocument.isRestricted()
34 })
35 #else
36 </div>
37 #end
38 {{/html}}
39 #elseif ("$!type" != '')
40 ## Display the content of the current document without using any sheet. We can't use the include macro here (with the
41 ## author parameter) because the content may have unsaved changes (e.g. on preview action). We make sure that the HTML
42 ## macro is not closed unintentionally, even though the XHTML printer protects us against this, just to be extra safe.
43 {{html}}$services.display.content($tdoc, {
44 'displayerHint': 'default'
45 }).replace('{{/html}}', '&amp;#123;&amp;#123;/html&amp;#125;&amp;#125;'){{/html}}
46 #else
47 The display mode is not specified!
48 #end
49 {{/velocity}}