Wiki source code of Content
Last modified by superadmin on 2025/09/10 13:22
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{velocity}} |
| 2 | #if ($type == 'edit') | ||
| 3 | #set ($className = $object.getxWikiClass().name) | ||
| |
4.1 | 4 | #set ($id = "${prefix}${name}") |
| |
1.1 | 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 | ||
| |
4.1 | 14 | ## Use the preferred content editor. |
| 15 | #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') | ||
| |
1.1 | 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('{{', '{{') | ||
| 22 | ## Display a simple textarea. | ||
| |
4.1 | 23 | <textarea id="$escapetool.xml($id)" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> |
| |
1.1 | 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, | ||
| |
3.1 | 31 | 'full': true, |
| 32 | 'restricted': $editedDocument.isRestricted() | ||
| |
1.1 | 33 | }) |
| 34 | #else | ||
| 35 | </div> | ||
| 36 | #end | ||
| 37 | {{/html}} | ||
| 38 | #elseif ("$!type" != '') | ||
| |
2.1 | 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}}', '&#123;&#123;/html&#125;&#125;'){{/html}} | ||
| |
1.1 | 45 | #else |
| 46 | The display mode is not specified! | ||
| 47 | #end | ||
| 48 | {{/velocity}} |