%PDF- %PDF-
| Direktori : /home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/ |
| Current File : //home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/editclass.vm |
#if($xcontext.getAction() != 'edit')
$response.sendRedirect($doc.getURL('edit', 'editor=class'))
#end
$xwiki.jsfx.use('js/scriptaculous/dragdrop.js')##
$xwiki.ssfx.use('js/xwiki/editors/dataeditors.css', true)##
$xwiki.jsfx.use('js/xwiki/editors/dataeditors.js', true)##
##
##
## The edited XClass
#set($class = $doc.getxWikiClass())
## These meta-properties are not fully implemented, or almost never used
#set($hiddenProperties = ['tooltip', 'unmodifiable', 'disabled'])
##
##
##
#**
* Display the class switcher
*#
#macro(classSwitcher)
<div id="switch-xclass">
#set ($classPickerParameters = {
'id': 'classname',
'name': 'xredirect',
'placeholder': $services.localization.render('core.editors.class.switchClass'),
'data-xwiki-selectize': {
'dropdownAlignment': 'right',
'dropdownParent': $NULL,
'takeInputWidth': true
}
})
#classPicker($classPickerParameters)
</div>
#end
##
##
##
##
##
#**
* Display a class property
*#
#macro (displayProperty $field)
<div id="xproperty_${field.name}" class="xproperty #if($field.disabled)disabled#end">
<div id="xproperty_${field.name}_title" class="xproperty-title ${field.type}">
<h2>
$!escapetool.xml($doc.displayView($field.xWikiClass.get('prettyName'), "${field.name}_" , $field))
($doc.displayView($field.xWikiClass.get('name'), "${field.name}_" , $field):
$xwiki.metaclass.get($field.classType).prettyName)
</h2>
<div class="tools propertyTools">
#set ($deletePropURL = $doc.getURL('propdelete', $escapetool.url({
'propname': $field.name,
'form_token': $services.csrf.token
})))
<a class="tool delete" href="$deletePropURL" title="$services.localization.render(
'core.editors.class.deleteProperty.tooltip', [$field.name])">$services.localization.render(
'core.editors.class.deleteProperty.text')</a>
</div>
</div>
<div id="xproperty_${field.name}_content" class="xproperty-content">
<dl>
#set ($propDef = $field.xWikiClass.get('disabled'))
#set ($output = "#displayMetaProperty($field 'disabled' $propDef)")
$output.trim().replace('boolean-property', 'boolean-property disabletool')
#foreach ($classprop in $field.xWikiClass.propertyNames)
#set ($propDef = $field.xWikiClass.get($classprop))
#if ($hiddenProperties.indexOf($propDef.name) == -1)
#displayMetaProperty($field $classprop $propDef)
#end
#end
</dl>
</div>
</div>
#end
##
##
#**
* Display a class meta property
*#
#macro (displayMetaProperty $field $classprop $propDef)
#if ($propDef.type.indexOf('Boolean') != -1)
<dt class="boolean-property">
<label for="${field.name}_$classprop">
$doc.displayEdit($propDef, "${field.name}_", $field)
$escapetool.xml($propDef.prettyName)
</label>
<span class="xHint">$!escapetool.xml($propDef.hint)</span>
</dt>
## The empty DD is needed in order to have valid HTML.
<dd></dd>
#else
<dt>
<label for="${field.name}_$classprop">
$escapetool.xml($propDef.translatedPrettyName)
</label>
<span class="xHint">$!escapetool.xml($propDef.hint)</span>
</dt>
<dd>$doc.displayEdit($propDef, "${field.name}_" , $field)</dd>
#end
#end
##
##
#**
* Inline form for adding a new property to the class.
*#
#macro(addPropertyForm)
<div id="add_xproperty">
<label for="propname" class="property-name-label">$services.localization.render('core.editors.class.addProperty.name.label')</label>
<input type="text" id="propname" name="propname" value="name" size="20" class='withTip'/>
<label for="proptype" class="property-type-label">$services.localization.render('core.editors.class.addProperty.type.label'):</label>
<select id="proptype" name="proptype" size="1">
#foreach($prop in $xwiki.metaclass.properties)
<option value="${prop.name}">${escapetool.xml($prop.prettyName)}</option>
#end
</select>
<span class="buttonwrapper">
<input type="submit" class="button" value="$services.localization.render('core.editors.class.addProperty.submit')" name="action_propadd"/>
</span>
</div>
#end
##
##---------------------------------
## Done with macro definitions, now the actual content
##
##
#if("$!{request.xaction}" == 'displayProperty')
## AJAX request for displaying the HTML code for a property
#displayProperty($class.get($request.getParameter('propName').replace(' ', '')))
#elseif("$!request.xpage" == 'editclass')
## Old (pre 1.0) way of using this template
$response.sendRedirect($doc.getURL('edit', 'editor=class'))
#else
## The actual class editor
#set($formname = 'propupdate')
#set($saveaction = 'propupdate')
#set($redirect = $xwiki.relativeRequestURL)
##
##
#classSwitcher()
##
##
<form id="$formname" method="post" action="$doc.getURL('preview')" class="withLock xform">
<div id="xwikieditcontent" class="clear">
##
##
<div class="hidden">
## CSRF prevention
<input type="hidden" id="form_token" name="form_token" value="$!{services.csrf.getToken()}" />
<input type="hidden" name="xcontinue" value="$doc.getURL('edit', 'editor=class')"/>
## A submit button that captures "enter" on the form, placed before the "propadd" submit button,
## to prevent from accidentally adding properties when pressing enter.
#editActionButton('preview', 'preview')
</div>
<div id="xwikiclassproperties">
<div id="xclass_${escapetool.xml($class.name)}" class="xclass">
<div id="xclass_${escapetool.xml($class.name)}_title" class="xclass-title"><h2>${escapetool.xml($class.name)}</h2></div>
#addPropertyForm()
<div id="xclass_${escapetool.xml($class.name)}_content" class="xclass-content"><div id="xclassContent">
#foreach ($field in $class.properties)
#displayProperty($field)
#end
</div></div>
</div>
</div> ## properties
<div class="bottombuttons sticky-buttons">#template("editactions.vm")</div>
</div> ## xwikieditcontent
</form>
#end