Wiki-Quellcode von AdminSection
Zuletzt geändert von admin am 2025/02/23 19:33
Zeige letzte Bearbeiter
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{include reference="CKEditor.VelocityMacros" /}} | ||
| 2 | |||
| 3 | {{velocity output="false"}} | ||
| 4 | #macro (copyObject $sourceDoc $targetDoc $className) | ||
| 5 | #set ($sourceObj = $sourceDoc.getObject($className)) | ||
| 6 | #set ($targetObj = $targetDoc.getObject($className, true)) | ||
| 7 | #foreach ($propName in $sourceObj.propertyNames) | ||
| 8 | #set ($discard = $targetObj.set($propName, $sourceObj.getValue($propName))) | ||
| 9 | #end | ||
| 10 | #end | ||
| 11 | {{/velocity}} | ||
| 12 | |||
| 13 | {{velocity}} | ||
| 14 | {{html clean="false"}} | ||
| 15 | #set ($discard = $xwiki.ssx.use('CKEditor.AdminSection')) | ||
| 16 | #set ($configDoc = $xwiki.getDocument('CKEditor.Config')) | ||
| 17 | <form id="ckeditorConfig" method="post" action="$configDoc.getURL('save')" class="xform" | ||
| 18 | data-editorId="ckeditor" data-label="CKEditor"> | ||
| 19 | <fieldset> | ||
| 20 | #if ($configDoc.isNew()) | ||
| 21 | ## Copy the configuration object from the template. | ||
| 22 | #set ($templateDoc = $xwiki.getDocument('CKEditor.ConfigTemplate')) | ||
| 23 | #copyObject($templateDoc $configDoc 'CKEditor.ConfigClass') | ||
| 24 | ## We still need to specify the template when we save because otherwise the configuration object is not added (the | ||
| 25 | ## save action only updates existing objects). | ||
| 26 | <input type="hidden" name="template" value="$templateDoc.fullName" /> | ||
| 27 | ## Make sure the configuration page is created as hidden. | ||
| 28 | <input type="hidden" name="xhidden" value="1" /> | ||
| 29 | #end | ||
| 30 | <input type="hidden" name="form_token" value="$!services.csrf.token" /> | ||
| 31 | <input value="$escapetool.xml($services.localization.render('ckeditor.admin.saveComment'))" | ||
| 32 | type="hidden" name="comment" /> | ||
| 33 | </fieldset> | ||
| 34 | #displayCKEditorConfig($configDoc 'edit') | ||
| 35 | <div class="bottombuttons"> | ||
| 36 | <p class="admin-buttons"> | ||
| 37 | <input class="btn btn-primary" type="submit" name="action_saveandcontinue" | ||
| 38 | value="$escapetool.xml($services.localization.render('admin.save'))" /> | ||
| 39 | #set ($resetURL = $configDoc.getURL('delete', $escapetool.url({ | ||
| 40 | 'confirm': 1, | ||
| 41 | 'form_token': $services.csrf.token, | ||
| 42 | 'xredirect': "$request.requestURI?$!request.queryString" | ||
| 43 | }))) | ||
| 44 | <a class="btn btn-default" href="$resetURL" | ||
| 45 | title="$escapetool.xml($services.localization.render('ckeditor.admin.reset.hint'))" | ||
| 46 | data-confirmation="$escapetool.xml($services.localization.render('ckeditor.admin.reset.confirmation'))"> | ||
| 47 | $escapetool.xml($services.localization.render('ckeditor.admin.reset')) | ||
| 48 | </a> | ||
| 49 | </p> | ||
| 50 | </div> | ||
| 51 | </form> | ||
| 52 | {{/html}} | ||
| 53 | {{/velocity}} |