Wiki source code of Content
Last modified by superadmin on 2023/09/01 15:45
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 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 | ## Don't load the WYSIWYG editor when editing the class, because it's too heavy. | ||
9 | #set ($useWysiwygEditor = false) | ||
10 | #else | ||
11 | ## We are editing an application entry so the content must be read from / written to the current document. | ||
12 | #set ($name = 'content') | ||
13 | #set ($editedDocument = $tdoc) | ||
14 | ## Use the preferred content editor. | ||
15 | #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') | ||
16 | #end | ||
17 | {{html clean="false"}} | ||
18 | ## The "content" id is expected by some JavaScript and CSS code. | ||
19 | #set ($id = 'content') | ||
20 | #if (!$useWysiwygEditor) | ||
21 | <div id="xwikieditcontentinner"> | ||
22 | ## 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. | ||
23 | #set ($toolBar = "#template('simpleedittoolbar.vm')") | ||
24 | $!toolBar.replace('{{', '{{') | ||
25 | ## Display a simple textarea. | ||
26 | <textarea id="$id" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> | ||
27 | #end | ||
28 | #if ($useWysiwygEditor) | ||
29 | $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { | ||
30 | 'id': "$id", | ||
31 | 'name': "$name", | ||
32 | 'rows': 25, | ||
33 | 'cols': 80, | ||
34 | 'full': true | ||
35 | }) | ||
36 | #else | ||
37 | </div> | ||
38 | #end | ||
39 | {{/html}} | ||
40 | #elseif ("$!type" != '') | ||
41 | ## Include the content of the current document. | ||
42 | ## Escape {{ in the rendered content to be sure that the HTML macro is not closed unintentionally. | ||
43 | {{html}}$tdoc.getRenderedContent($tdoc.content, $tdoc.syntax.toIdString()).replace('{{', '&#123;&#123;'){{/html}} | ||
44 | #else | ||
45 | The display mode is not specified! | ||
46 | #end | ||
47 | {{/velocity}} |