Исходный код вики Administration
Скрыть последних авторов
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{velocity}} |
| |
3.1 | 2 | #if($hasAdmin) |
| |
1.1 | 3 | #set ($allConfigClasses = ['SUZ.Code.SUZConfigurationClass', 'SUZ.Code.CatalogConfigurationClass', 'SUZ.Code.MetadataConfigurationClass']) |
| 4 | #if (!$xwiki.exists('SUZ.Code.SUZConfiguration')) | ||
| 5 | #set ($rdoc = $xwiki.getDocument('SUZ.Code.SUZConfiguration')) | ||
| 6 | #set ($conObj = $rdoc.newObject('SUZ.Code.SUZConfigurationClass')) | ||
| 7 | #set($discard = $conObj.set('name','Общие параметры')) | ||
| 8 | #set ($discard = $rdoc.save()) | ||
| 9 | #set ($configDoc = $xwiki.getDocument('SUZ.Code.SUZConfiguration')) | ||
| 10 | #else | ||
| 11 | #set ($configDoc = $xwiki.getDocument('SUZ.Code.SUZConfiguration')) | ||
| 12 | #set ($confObject = $configDoc.getObject('SUZ.Code.SUZConfigurationClass')) | ||
| 13 | #if (!$confObject) | ||
| 14 | #set($conObj = $configDoc.newObject('SUZ.Code.SUZConfigurationClass')) | ||
| 15 | #set($discard = $conObj.set('name','Общие параметры')) | ||
| 16 | #set($discard = $configDoc.save()) | ||
| 17 | #set ($configDoc = $xwiki.getDocument('SUZ.Code.SUZConfiguration')) | ||
| 18 | #end | ||
| 19 | #end | ||
| 20 | #set ($requestURL = $xwiki.getRequestURL()) | ||
| 21 | {{html wiki="true" clean="false"}} | ||
| 22 | #set ($discard = $xwiki.ssx.use("SUZ.Code.Administration.WebHome")) | ||
| 23 | #foreach ($currentConfigClass in $allConfigClasses) | ||
| 24 | #set ($configClass = $xwiki.getDocument($currentConfigClass).xWikiClass) | ||
| 25 | #set ($configObjects = $configDoc.getObjects($configClass.name)) | ||
| 26 | #foreach ($configObject in $configObjects) | ||
| 27 | ##TODO: Добавить вкладки или сворачивание каждой формы | ||
| 28 | <form method="post" action="${xwiki.getURL('SUZ.Code.SUZConfiguration', 'save')}" class='xform'> | ||
| 29 | <div class="hidden"> | ||
| 30 | <input type='hidden' name='form_token' value="$!{services.csrf.getToken()}" /> | ||
| 31 | <input type='hidden' name='xredirect' value="{{/html}}{{html wiki="false" clean="false"}}$requestURL{{/html}}{{html wiki="true" clean="false"}}" /> ##TODO: Может быть более пправильное решение | ||
| 32 | </div> | ||
| 33 | #foreach ($property in $configClass.properties) | ||
| 34 | #if ($property.name == 'name') ##name нередактируемое свойство, используется для заголовка формы/ | ||
| 35 | ##TODO: Добавить вкладки или сворачивание каждой формы | ||
| 36 | <a data-toggle="collapse" href="#${currentConfigClass.replace('SUZ.Code.','')}_${configObject.number}" aria-expanded="false" aria-controls="${currentConfigClass.replace('SUZ.Code.','')}_${configObject.number}" style="text-decoration: none;" class="hideButton d-inline-block"> | ||
| 37 | <h3 id="${configClass.name}_${configObject.number}" class="wikigeneratedid wikigeneratedheader d-inline-block" style="color:black;"><span>$configDoc.display($property.name, 'view', $configObject)</span></h3> | ||
| 38 | </a> | ||
| 39 | <div id="${currentConfigClass.replace('SUZ.Code.','')}_${configObject.number}" class="collapse"> | ||
| 40 | <dl> | ||
| 41 | #else | ||
| 42 | <dt> | ||
| 43 | ## This must match the id generated by the $doc.display() method below. | ||
| 44 | #set ($propertyId = "${configClass.name}_${configObject.number}_$property.name") | ||
| 45 | <label for="$escapetool.xml($propertyId)"> | ||
| 46 | $escapetool.xml($property.translatedPrettyName) | ||
| 47 | </label> | ||
| 48 | ## Support for specifying a translation key as hint in the property definition. | ||
| 49 | <span class="xHint">$!escapetool.xml($services.localization.render($property.hint))</span> | ||
| 50 | </dt> | ||
| 51 | <dd>$configDoc.display($property.name, 'edit', $configObject)</dd> | ||
| 52 | #end | ||
| 53 | #end | ||
| 54 | </dl> | ||
| 55 | <div class='buttonwrapper'> | ||
| 56 | <input value="$services.localization.render('admin.save')" class='button' type='submit'> | ||
| 57 | </div> | ||
| 58 | </div> | ||
| 59 | </form> | ||
| 60 | #end | ||
| 61 | #end | ||
| 62 | {{/html}} | ||
| |
3.1 | 63 | #end |
| |
1.1 | 64 | {{/velocity}} |
| 65 |