Wiki source code of TemplateProviderSheet
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{include reference="XWiki.TemplateProviderMacros" /}} | ||
| 2 | |||
| 3 | {{velocity output="false"}} | ||
| 4 | #macro (initializeTemplateProvider) | ||
| 5 | #if ($doc.documentReference.name.endsWith('Provider')) | ||
| 6 | #set ($discard = $doc.set('template', $stringtool.removeEnd($doc.fullName, 'Provider').trim())) | ||
| 7 | #set ($templateName = $stringtool.removeEnd($doc.documentReference.name, 'Provider').trim()) | ||
| 8 | #set ($templateName = $stringtool.join($stringtool.splitByCharacterTypeCamelCase($templateName), ' ')) | ||
| 9 | #set ($templateName = $templateName.replaceAll('\s+', ' ')) | ||
| 10 | #set ($discard = $doc.set('name', $templateName)) | ||
| 11 | #end | ||
| 12 | #end | ||
| 13 | {{/velocity}} | ||
| 14 | |||
| 15 | {{velocity}} | ||
| 16 | {{html clean="false"}} | ||
| 17 | #set ($discard = $xwiki.ssx.use('XWiki.TemplateProviderMacros')) | ||
| 18 | #set ($discard = $xwiki.jsx.use('XWiki.TemplateProviderMacros')) | ||
| 19 | #set ($discard = $doc.use('XWiki.TemplateProviderClass')) | ||
| 20 | #if ($doc.isNew()) | ||
| 21 | #initializeTemplateProvider | ||
| 22 | #end | ||
| 23 | <div class="xform row templateProviderSheet"> | ||
| 24 | ## | ||
| 25 | ## Left side | ||
| 26 | ## | ||
| 27 | <div class="col-xs-12 col-md-6"> | ||
| 28 | <dl> | ||
| 29 | ## | ||
| 30 | ## Template Provider Title | ||
| 31 | ## | ||
| 32 | #if ($isEditing) | ||
| 33 | <dt> | ||
| 34 | <label for="title"> | ||
| 35 | $escapetool.xml($services.localization.render('xe.templateprovider.name')) | ||
| 36 | </label> | ||
| 37 | </dt> | ||
| 38 | <dd> | ||
| 39 | <input type="text" value="$!escapetool.xml($doc.title)" name="title" id="title" /> | ||
| 40 | </dd> | ||
| 41 | #end | ||
| 42 | ## | ||
| 43 | ## Template Name | ||
| 44 | ## | ||
| 45 | <dt> | ||
| 46 | <label#if ($isEditing) for="XWiki.TemplateProviderClass_0_name"#end> | ||
| 47 | $escapetool.xml($services.localization.render('xe.templateprovider.templatename')) | ||
| 48 | </label> | ||
| 49 | #if ($isEditing) | ||
| 50 | <span class="xHint"> | ||
| 51 | $escapetool.xml($services.localization.render('xe.templateprovider.templatename.info')) | ||
| 52 | </span> | ||
| 53 | #end | ||
| 54 | </dt> | ||
| 55 | <dd> | ||
| 56 | #if ($isEditing) | ||
| 57 | #displayPropertyValue('name') | ||
| 58 | #else | ||
| 59 | $!escapetool.xml($services.localization.render($doc.getValue('name'))) | ||
| 60 | #end | ||
| 61 | </dd> | ||
| 62 | ## | ||
| 63 | ## Template Description | ||
| 64 | ## | ||
| 65 | <dt> | ||
| 66 | <label#if ($isEditing) for="XWiki.TemplateProviderClass_0_description"#end> | ||
| 67 | $escapetool.xml($services.localization.render('administration.templateProvider.description')) | ||
| 68 | </label> | ||
| 69 | #if ($isEditing) | ||
| 70 | <span class="xHint"> | ||
| 71 | $services.localization.render('administration.templateProvider.description.hint') | ||
| 72 | </span> | ||
| 73 | #end | ||
| 74 | </dt> | ||
| 75 | <dd> | ||
| 76 | #if ($isEditing) | ||
| 77 | #displayPropertyValue('description') | ||
| 78 | #else | ||
| 79 | $!escapetool.xml($services.localization.render($doc.getValue('description'))) | ||
| 80 | #end | ||
| 81 | </dd> | ||
| 82 | ## | ||
| 83 | ## Template Icon | ||
| 84 | ## | ||
| 85 | <dt> | ||
| 86 | <label#if($isEditing) for="XWiki.TemplateProviderClass_0_icon"#end> | ||
| 87 | $escapetool.xml($services.localization.render('administration.templateProvider.icon')) | ||
| 88 | </label> | ||
| 89 | #if ($isEditing) | ||
| 90 | <span class="xHint"> | ||
| 91 | $services.localization.render('administration.templateProvider.icon.hint', ['', '']) | ||
| 92 | </span> | ||
| 93 | #end | ||
| 94 | </dt> | ||
| 95 | <dd> | ||
| 96 | #if ($isEditing) | ||
| 97 | #displayPropertyValue('icon') | ||
| 98 | #else | ||
| 99 | $!services.icon.renderHTML($doc.getValue('icon')) | ||
| 100 | #end | ||
| 101 | </dd> | ||
| 102 | ## | ||
| 103 | ## Visibility Restrictions | ||
| 104 | ## | ||
| 105 | <dt> | ||
| 106 | <label>$escapetool.xml($services.localization.render('xe.templateprovider.spaces'))</label> | ||
| 107 | #if ($isEditing) | ||
| 108 | <span class="xHint"> | ||
| 109 | $escapetool.xml($services.localization.render('xe.templateprovider.spaces.info')) | ||
| 110 | </span> | ||
| 111 | #end | ||
| 112 | </dt> | ||
| 113 | <dd> | ||
| 114 | #set ($visibilityRestrictions = $doc.getValue('visibilityRestrictions')) | ||
| 115 | #if ($isEditing || ($visibilityRestrictions && $visibilityRestrictions.size() > 0)) | ||
| 116 | #displayPathsPropertyValue('visibilityRestrictions') | ||
| 117 | #else | ||
| 118 | $escapetool.xml($services.localization.render('xe.templateprovider.spaces.all')) | ||
| 119 | #end | ||
| 120 | </dd> | ||
| 121 | </dl> | ||
| 122 | </div> | ||
| 123 | ## | ||
| 124 | ## Right side | ||
| 125 | ## | ||
| 126 | <div class="col-xs-12 col-md-6"> | ||
| 127 | <dl> | ||
| 128 | ## | ||
| 129 | ## Template Reference | ||
| 130 | ## | ||
| 131 | <dt> | ||
| 132 | <label#if ($isEditing) for="XWiki.TemplateProviderClass_0_template"#end> | ||
| 133 | $escapetool.xml($services.localization.render('xe.templateprovider.template')) | ||
| 134 | </label> | ||
| 135 | </dt> | ||
| 136 | <dd> | ||
| 137 | #set ($template = $doc.getValue('template')) | ||
| 138 | #if ($isEditing) | ||
| 139 | #set ($pagePickerParams = { | ||
| 140 | 'id': "XWiki.TemplateProviderClass_0_template", | ||
| 141 | 'name': "XWiki.TemplateProviderClass_0_template", | ||
| 142 | 'value': "$!escapetool.xml($template)" | ||
| 143 | }) | ||
| 144 | #pagePicker($pagePickerParams) | ||
| 145 | #elseif ("$!template" != '') | ||
| 146 | #set ($templateReference = $services.model.resolveDocument($template)) | ||
| 147 | #hierarchy($templateReference { | ||
| 148 | 'local': true, | ||
| 149 | 'selfIsActive': false | ||
| 150 | }) | ||
| 151 | #end | ||
| 152 | </dd> | ||
| 153 | ## | ||
| 154 | ## Creation Restrictions | ||
| 155 | ## | ||
| 156 | <dt> | ||
| 157 | <label> | ||
| 158 | $escapetool.xml($services.localization.render('administration.templateProvider.creationRestrictions')) | ||
| 159 | </label> | ||
| 160 | #if ($isEditing) | ||
| 161 | <span class="xHint"> | ||
| 162 | $services.localization.render('administration.templateProvider.creationRestrictions.hint') | ||
| 163 | </span> | ||
| 164 | #end | ||
| 165 | </dt> | ||
| 166 | <dd> | ||
| 167 | #set ($creationRestrictions = $doc.getValue('creationRestrictions')) | ||
| 168 | #if ($isEditing || ($creationRestrictions && $creationRestrictions.size() > 0)) | ||
| 169 | #displayPathsPropertyValue('creationRestrictions') | ||
| 170 | #else | ||
| 171 | $escapetool.xml($services.localization.render('administration.templateProvider.creationRestrictions.none')) | ||
| 172 | #end | ||
| 173 | </dd> | ||
| 174 | ## | ||
| 175 | ## Creation Restrictions As Suggestions | ||
| 176 | ## | ||
| 177 | <dt> | ||
| 178 | <label> | ||
| 179 | #if ($isEditing) | ||
| 180 | #displayPropertyValue('creationRestrictionsAreSuggestions') | ||
| 181 | #end | ||
| 182 | $escapetool.xml($services.localization.render('administration.templateProvider.creationRestrictionsAreSuggestions')) | ||
| 183 | </label> | ||
| 184 | #if ($isEditing) | ||
| 185 | <span class="xHint"> | ||
| 186 | $services.localization.render('administration.templateProvider.creationRestrictionsAreSuggestions.hint') | ||
| 187 | </span> | ||
| 188 | #end | ||
| 189 | </dt> | ||
| 190 | <dd> | ||
| 191 | #if (!$isEditing) | ||
| 192 | #displayPropertyValue('creationRestrictionsAreSuggestions') | ||
| 193 | #end | ||
| 194 | </dd> | ||
| 195 | ## | ||
| 196 | ## Terminal page creation - Advanced user (both view and edit mode) | ||
| 197 | ## | ||
| 198 | #if ($isAdvancedUser || $isSuperAdmin) | ||
| 199 | <dt> | ||
| 200 | <label#if ($isEditing) for="XWiki.TemplateProviderClass_0_terminal"#end> | ||
| 201 | $escapetool.xml($services.localization.render('xe.templateprovider.terminal')) | ||
| 202 | </label> | ||
| 203 | #if ($isEditing) | ||
| 204 | <span class="xHint"> | ||
| 205 | $escapetool.xml($services.localization.render('xe.templateprovider.terminal.hint')) | ||
| 206 | </span> | ||
| 207 | #end | ||
| 208 | </dt> | ||
| 209 | <dd>#displayPropertyValue('terminal')</dd> | ||
| 210 | #else | ||
| 211 | <dd>#displayPropertyValue('terminal' 'hidden')</dd> | ||
| 212 | #end | ||
| 213 | ## | ||
| 214 | ## Action | ||
| 215 | ## | ||
| 216 | <dt> | ||
| 217 | <label#if ($isEditing) for="XWiki.TemplateProviderClass_0_action"#end> | ||
| 218 | $escapetool.xml($services.localization.render('xe.templateprovider.action')) | ||
| 219 | </label> | ||
| 220 | #if ($isEditing) | ||
| 221 | <span class="xHint"> | ||
| 222 | $escapetool.xml($services.localization.render('xe.templateprovider.action.info')) | ||
| 223 | </span> | ||
| 224 | #end | ||
| 225 | </dt> | ||
| 226 | <dd>#displayPropertyValue('action')</dd> | ||
| 227 | </dl> | ||
| 228 | </div> | ||
| 229 | #locationPickerModal | ||
| 230 | </div> | ||
| 231 | {{/html}} | ||
| 232 | |||
| 233 | {{iconPicker id="XWiki.TemplateProviderClass_0_icon" prefix="" /}} | ||
| 234 | |||
| 235 | ## | ||
| 236 | ## Go back to the administration | ||
| 237 | ## | ||
| 238 | #if (!$isEditing) | ||
| 239 | (% class="buttonwrapper" %) | ||
| 240 | [[{{translation key="xe.templateprovider.backtoadmin"/}}>>path:$xwiki.getURL($services.model.createDocumentReference('', 'XWiki', 'XWikiPreferences'), 'admin', 'section=Templates')]] | ||
| 241 | #end | ||
| 242 | {{/velocity}} |