Wiki source code of Content

Last modified by superadmin on 2025/09/10 13:22

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