Allgemeine Aktionen:
Anmelden
Registrieren
Start ▼: Wiki Verzeichnis
»
Bereich: XWiki
»
Seite: XWikiClasses
default
Aktionen:
Exportieren ▼: Als PDF exportieren Als RTF exportieren Als HTML exportieren
Weitere Aktionen ▼: Druckvorschau Zeige den Quellcode
Willkommen bei bytebang » XWiki Bereich » Data types

# Wiki-Quellcode von Data types

Zuletzt geändert von Administrator am 2014/06/29 19:30
Anhänge (0) · Information
Zeilennummern verstecken 1: {{velocity}} 2: #if($request.space && $request.name) 3: #set($className = "#toXMLName($stringtool.removeEnd($request.name, 'Class'))") 4: #set($classTitle = "$className Class") 5: #set($classReference = $services.model.createDocumentReference('', $request.space, "${className}Class")) 6: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $services.model.serialize($classReference))) 7: $response.sendRedirect($xwiki.getURL($classReference, 'edit', "editor=wiki&template=$!{request.template}&parent=$!{request.parent}&title=$escapetool.url($classTitle)")) 8: ## Stop processing, since we already sent a redirect. 9: #stop 10: #end 11: #end 12: {{/velocity}} 13: This tool allows to define structured data types (classes) in your wiki. Please consult the [[developer's guide>>http://platform.xwiki.org/xwiki/bin/DevGuide/]] to get familiar with the XWiki data model and the public APIs. 14: 15: = Templates for new data types = 16: 17: Here are the templates and sheets for creating new classes: 18: 19: * [[Default code for displaying a class>>ClassSheet]] 20: * [[Document template for new classes>>ClassTemplate]] 21: * [[Default code for displaying class instances (objects)>>ObjectSheet]] 22: 23: = Create a new data type = 24: 25: Choose a simple name, such as //Article//, //Book//, //Employee//. '//Class//' will be appended at the end automatically. 26: 27: {{velocity}} 28: #if("$!{targetClassName}" != ''){{warning}}You don't have permission to create that class{{/warning}}#end 29: 30: {{html}} 31: <form action="$doc.URL" method="post"> 32: <div> 33: <input type="hidden" name="parent" value="XWiki.XWikiClasses"/> 34: <input type="hidden" name="template" value="XWiki.ClassTemplate"/> 35: <label for="space">Space:</label> <input type="text" id="space" name="space" value="XWiki"/> 36: <label for="name">Class:</label> <input type="text" id="name" name="name" value="Name of the class" class="withTip"/> 37: <span class="buttonwrapper"><input type="submit" value="Create this Class" class="button"/></span> 38: </div> 39: </form> 40: {{/html}}{{/velocity}} 41: 42: = Data types defined in this wiki = 43: 44: {{velocity}} 45: ## 46: ## Existing classes are enumerated, grouped by space name. 47: ## The list is already sorted alphabetically 48: ## 49: #set($prevSpace = '') 50: #foreach ($classname in $xwiki.classList) 51: #set($classReference = $services.model.resolveDocument($classname)) 52: ## 53: ## Let check the user right to see the class 54: ## 55: #if($xwiki.getUser().hasAccessLevel('view', $classname)) 56: #set($space = $classReference.getLastSpaceReference().name) 57: #if($space != $prevSpace) 58: ; [[$space>>${space}.WebHome]] space: 59: #set($prevSpace = $space) 60: #end 61: : [[$classReference.name>>$classname]] 62: #end 63: #end 64: {{/velocity}}

(c) 2026, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-