Allgemeine Aktionen:
Anmelden
Erstellen
▼
:
Kommentar erstellen
Wiki
▼
:
Dokumentenindex
»
Space:
AnnotationCode
▼
:
Dokumentenverzeichnis
»
Seite:
Settings
Suche
Aktionen:
Exportieren
▼
:
Als PDF exportieren
Als RTF exportieren
Als HTML exportieren
Weitere Aktionen
▼
:
Druckvorschau
Zeige den Quellcode
Willkommen in den metamagix Wikis!
»
WebHome
»
Settings
Wiki-Quellcode von
Settings
Zuletzt geändert von
Administrator
am 2010/04/22 16:11
Inhalt
·
Kommentare
(0)
·
Anmerkungen
(0)
·
Anhänge
(0)
·
Historie
·
Information
Zeilennummern verstecken
1: {{velocity output="false"}} 2: #* 3: * Display the checkboxes for a given criterion, according to the values passed in $options 4: * @param $label the pabel of the criterion, the way it should be displayed 5: * @param $expanded true if the criterion should be displayed with options visible, false otherwise 6: * @param $active true if any value in this criterion is checked, false otherwise 7: * @param $options map of maps with the values to display for this criterion, which contains, for each value, the value to be sent to the filter request as key and as value a map with "checked" a boolean indicating whether the value is chosen or not and "prettyName" the display string corresponding to the respective value 8: *# 9: #macro(displayCriterion $label $name $expanded $active $options) 10: <div class="criterion #if(!$expanded) collapsed #end #if($active) active #end"> 11: <span class="criterion-label">$label <span class="details">($msg.get('annotations.filters.anyvalue'))</span> <span class="clear">($msg.get('annotations.filters.clearvalue'))</span></span> 12: ## and the hidden input holding the criterion name, that allows the javascript to extract the filter from this criterion 13: <input type="hidden" name="${name}" value="${name}"/> 14: #if ($expanded) 15: <div class="criterion-options"> 16: <div class="criterion-option-list"> 17: #if ($options.keySet().size() == 0) 18: <span class="no-option">$msg.get('annotations.filters.nooption', [$label])</span> 19: #end 20: #foreach ($option in $options.keySet()) 21: #set($optionValue = $options.get($option)) 22: <label class="option #if($optionValue.checked) selected #end"><input type="checkbox" value="${option}" #if($optionValue.checked) checked="checked" #end/>$optionValue.prettyName</label> 23: #end 24: </div> 25: </div> 26: #end 27: </div> 28: #end 29: 30: #* 31: * Extracts the unique values of propertyName for the annotations in annotationsList and returns them, along with the number of occurrences, in $valuesMap. 32: * @param $annotationsList the list of annotations to group the values for 33: * @param $propertyName the property whose values to group 34: * @param $valuesMap the map to return the values in 35: *# 36: #macro(getValues $annotationsList $propertyName $valuesMap) 37: #set($valuesMap = {}) 38: #foreach($ann in $annotationsList) 39: #set($value = "") 40: #set($value = $ann.get($propertyName)) 41: #if("$!{value}" != "") 42: #set($previousValue = $valuesMap.get($value)) 43: #if ($previousValue) 44: #set($newValue = $previousValue + 1) 45: #set($dispose = $valuesMap.put($value, $newValue)) 46: #else 47: #set($dispose = $valuesMap.put($value, 1)) 48: #end 49: #end 50: #end 51: #end 52: 53: #* 54: * Displays the annotators checkbox selectors for the annotations authors. 55: * @param $annotationsList the list of annotations to display the annotators selector for 56: *# 57: #macro(displayAnnotatorCheckboxes $annotationsList) 58: #set($checkboxesMap = {}) 59: #set($valuesMap = {}) 60: #getValues($annotationsList, "author", $valuesMap) 61: #foreach($value in $valuesMap.keySet()) 62: #set($dispose = $checkboxesMap.put($value, {"checked" : false, "prettyName" : $xwiki.getUserName($value, false)})) 63: #end 64: #set($config = 'AnnotationCode.AnnotationConfig') 65: #set($annotationClassDocName = $xwiki.getDocument($config).getObject($config).getProperty('annotationClass').value) 66: #set($annotationClass = $xwiki.getDocument("$!{annotationClassDocName}").getxWikiClass()) 67: #displayCriterion($annotationClass.get("author").prettyName, "author", true, false, $checkboxesMap) 68: #end 69: 70: 71: #* 72: * Displays the checkboxes for criterion extracted from the passed property name. 73: * @param $propertyName the name of the property to extract this criterion from 74: * @param $annotationsList the list of annotations to display the annotators selector for 75: *# 76: #macro(displayPropertyCheckboxes $annotationsList $propertyName) 77: #set($checkboxesMap = {}) 78: #set($valuesMap = {}) 79: #getValues($annotationsList, $propertyName, $valuesMap) 80: #foreach($value in $valuesMap.keySet()) 81: #set($dispose = $checkboxesMap.put($value, {"checked" : false, "prettyName" : $value})) 82: #end 83: #set($config = 'AnnotationCode.AnnotationConfig') 84: #set($annotationClassDocName = $xwiki.getDocument($config).getObject($config).getProperty('annotationClass').value) 85: #set($annotationClass = $xwiki.getDocument("$!{annotationClassDocName}").getxWikiClass()) 86: #displayCriterion($annotationClass.get($propertyName).prettyName, $propertyName, true, false, $checkboxesMap) 87: #end 88: 89: {{/velocity}} 90: 91: {{velocity}} 92: {{html clean="false"}} 93: <div class="annotationsettings"> 94: #if ("$!{request.target}" != "") 95: ## check the syntax of the target (should be an annotations function called instead of a standard xwiki call) 96: #set($targetDoc = $xwiki.getDocument($!request.target)) 97: #set($targetDocSyntax = $targetDoc.syntax) 98: #if (!($targetDocSyntax.type.id == 'xwiki' && $targetDocSyntax.version == '1.0')) 99: <div class="box plainmessage">$msg.get("annotations.action.create.helpmessage", ["<strong>Ctrl + M (Meta + M)</strong>"])</div> 100: <input type="checkbox" name="annotationsdisplay" id="annotationsdisplay" /> 101: <label for="annotationsdisplay">$msg.get('annotations.settings.display')</label> 102: <div class="annotation-filters collapsed" id="annotation-filters"> 103: <div class="annotation-filters-toggler"><a href="#annotation-filters">$msg.get('annotations.filters.show')</a></div> 104: <div class="criteria"> 105: #set($annotationsList = $annotations.getAnnotations($!request.target)) 106: #displayAnnotatorCheckboxes($annotationsList) 107: </div> 108: </div> 109: <div class="clearfloats" /> 110: #else 111: <div class="box infomessage">$msg.get("annotations.settings.error.wrongsyntax")</div> 112: #end 113: #else 114: <div class="box infomessage">$msg.get("annotations.settings.error.notarget")</div> 115: #end 116: </div> 117: {{/html}} 118: {{/velocity}}