Wiki source code of AnnotationConfigSheet
Last modified by superadmin on 2025/09/10 13:22
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{velocity}} |
| 2 | #set ($annotationsConfigClassName = 'AnnotationCode.AnnotationConfig') | ||
| 3 | #set ($annotationsConfigDoc = $xwiki.getDocument($annotationsConfigClassName)) | ||
| 4 | #set ($configObject = $annotationsConfigDoc.getObject($annotationsConfigClassName)) | ||
| 5 | ## FIXME: The class is currently stored in the same document as the configuration. | ||
| 6 | #set ($annotationsConfigClass = $annotationsConfigDoc.xWikiClass) | ||
| 7 | #set ($discard = $xwiki.jsx.use('AnnotationCode.AnnotationConfigSheet')) | ||
| 8 | {{html clean='false'}} | ||
| 9 | ## Keep the xform div separate from the form since in inline edit mode (when editing the config doc manually), the form is removed. | ||
| 10 | <div class="xform"> | ||
| 11 | <form method="post" action="$annotationsConfigDoc.getURL('save')"> | ||
| 12 | |||
| 13 | <div class="hidden"> | ||
| 14 | <input type='hidden' name='form_token' value="$!{services.csrf.getToken()}" /> | ||
| 15 | <input type='hidden' name='xredirect' value="$escapetool.xml($xwiki.relativeRequestURL)" /> | ||
| 16 | </div> | ||
| 17 | |||
| 18 | <h2>$escapetool.xml($services.localization.render('annotations.config.activate.title'))</h2> | ||
| 19 | |||
| 20 | <p class="noitems">$escapetool.xml($services.localization.render('annotations.config.activate.explanation'))</p> | ||
| 21 | |||
| 22 | <dl> | ||
| 23 | |||
| 24 | <dt> | ||
| 25 | <label for="AnnotationCode.AnnotationConfig_0_activated"> | ||
| 26 | {{/html}} | ||
| 27 | |||
| 28 | $annotationsConfigDoc.display('activated', 'edit') | ||
| 29 | |||
| 30 | {{html clean="false"}} | ||
| 31 | $escapetool.xml($annotationsConfigClass.get('activated').prettyName) | ||
| 32 | </label> | ||
| 33 | <span class="xHint"> | ||
| 34 | $escapetool.xml($services.localization.render('AnnotationCode.AnnotationConfig_activated.hint')) | ||
| 35 | </span> | ||
| 36 | </dt> | ||
| 37 | <dd></dd> | ||
| 38 | |||
| 39 | ## We can`t just join the list values in the hidden DOM element without escaping the separator from each value first. | ||
| 40 | #set ($spacesEscapedValues = []) | ||
| 41 | #foreach ($spacesValue in $configObject.getValue('exceptionSpaces')) | ||
| 42 | #set ($discard = $spacesEscapedValues.add($spacesValue.replace(',', '\,'))) | ||
| 43 | #end | ||
| 44 | <dt> | ||
| 45 | <label>$escapetool.xml($annotationsConfigClass.get("exceptionSpaces").prettyName)</label> | ||
| 46 | <span class="xHint"> | ||
| 47 | $escapetool.xml($services.localization.render('AnnotationCode.AnnotationConfig_exceptionSpaces.hint')) | ||
| 48 | </span> | ||
| 49 | </dt> | ||
| 50 | <dd> | ||
| 51 | <input id="AnnotationCode.AnnotationConfig_0_exceptionSpaces" name="AnnotationCode.AnnotationConfig_0_exceptionSpaces" | ||
| 52 | value="$!escapetool.xml($stringtool.join($spacesEscapedValues, ','))" type="hidden"> | ||
| 53 | {{/html}} | ||
| 54 | |||
| 55 | {{documentTree showTerminalDocuments='false' checkboxes='true' links='false' showTranslations='false' showAttachments='false' /}} | ||
| 56 | |||
| 57 | {{html clean='false'}} | ||
| 58 | </dd> | ||
| 59 | |||
| 60 | </dl> | ||
| 61 | |||
| 62 | <h2>$escapetool.xml($services.localization.render('annotations.config.display.title'))</h2> | ||
| 63 | |||
| 64 | <dl> | ||
| 65 | |||
| 66 | <dt> | ||
| 67 | <label for="AnnotationCode.AnnotationConfig_0_displayed"> | ||
| 68 | {{/html}} | ||
| 69 | |||
| 70 | $annotationsConfigDoc.display('displayed', 'edit') | ||
| 71 | |||
| 72 | {{html clean='false'}} | ||
| 73 | $escapetool.xml($annotationsConfigClass.get('displayed').prettyName) | ||
| 74 | </label> | ||
| 75 | <span class="xHint"> | ||
| 76 | $escapetool.xml($services.localization.render('AnnotationCode.AnnotationConfig_displayed.hint')) | ||
| 77 | </span> | ||
| 78 | </dt> | ||
| 79 | <dd></dd> | ||
| 80 | |||
| 81 | <dt> | ||
| 82 | <label for="AnnotationCode.AnnotationConfig_0_displayHighlight"> | ||
| 83 | {{/html}} | ||
| 84 | |||
| 85 | $annotationsConfigDoc.display('displayHighlight', 'edit') | ||
| 86 | |||
| 87 | {{html clean='false'}} | ||
| 88 | $escapetool.xml($annotationsConfigClass.get("displayHighlight").prettyName) | ||
| 89 | </label> | ||
| 90 | <span class="xHint"> | ||
| 91 | $escapetool.xml($services.localization.render('AnnotationCode.AnnotationConfig_displayHighlight.hint')) | ||
| 92 | </span> | ||
| 93 | </dt> | ||
| 94 | <dd></dd> | ||
| 95 | |||
| 96 | </dl> | ||
| 97 | |||
| 98 | <h2>$escapetool.xml($services.localization.render('annotations.config.type.title'))</h2> | ||
| 99 | |||
| 100 | <p class="noitems">$escapetool.xml($services.localization.render('annotations.config.type.explanation'))</p> | ||
| 101 | |||
| 102 | <dl> | ||
| 103 | <dt> | ||
| 104 | <label for="AnnotationCode.AnnotationConfig_0_annotationClass"> | ||
| 105 | $escapetool.xml($annotationsConfigClass.get('annotationClass').prettyName) | ||
| 106 | </label> | ||
| 107 | </dt> | ||
| 108 | <dd> | ||
| 109 | {{/html}} | ||
| 110 | |||
| 111 | $annotationsConfigDoc.display('annotationClass', 'edit') | ||
| 112 | |||
| 113 | {{html clean="false"}} | ||
| 114 | </dd> | ||
| 115 | </dl> | ||
| 116 | |||
| 117 | ## Add a "Save" button for when displayed in an Administration section or even in view mode. | ||
| 118 | #if ($xcontext.action != 'edit' && $xcontext.action != 'inline') | ||
| 119 | <span class="buttonwrapper"> | ||
| 120 | <input type="submit" value="${services.localization.render('save')}" class="button" /> | ||
| 121 | </span> | ||
| 122 | #end | ||
| 123 | </form> | ||
| 124 | </div> | ||
| 125 | {{/html}} | ||
| 126 | {{/velocity}} |