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 anzeigen {{velocity}} #if($request.space && $request.name) #set($className = "#toXMLName($stringtool.removeEnd($request.name, 'Class'))") #set($classTitle = "$className Class") #set($classReference = $services.model.createDocumentReference('', $request.space, "${className}Class")) #if($xwiki.hasAccessLevel('edit', $xcontext.user, $services.model.serialize($classReference))) $response.sendRedirect($xwiki.getURL($classReference, 'edit', "editor=wiki&template=$!{request.template}&parent=$!{request.parent}&title=$escapetool.url($classTitle)")) ## Stop processing, since we already sent a redirect. #stop #end #end {{/velocity}} 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. = Templates for new data types = Here are the templates and sheets for creating new classes: * [[Default code for displaying a class>>ClassSheet]] * [[Document template for new classes>>ClassTemplate]] * [[Default code for displaying class instances (objects)>>ObjectSheet]] = Create a new data type = Choose a simple name, such as //Article//, //Book//, //Employee//. '//Class//' will be appended at the end automatically. {{velocity}} #if("$!{targetClassName}" != ''){{warning}}You don't have permission to create that class{{/warning}}#end {{html}} <form action="$doc.URL" method="post"> <div> <input type="hidden" name="parent" value="XWiki.XWikiClasses"/> <input type="hidden" name="template" value="XWiki.ClassTemplate"/> <label for="space">Space:</label> <input type="text" id="space" name="space" value="XWiki"/> <label for="name">Class:</label> <input type="text" id="name" name="name" value="Name of the class" class="withTip"/> <span class="buttonwrapper"><input type="submit" value="Create this Class" class="button"/></span> </div> </form> {{/html}}{{/velocity}} = Data types defined in this wiki = {{velocity}} ## ## Existing classes are enumerated, grouped by space name. ## The list is already sorted alphabetically ## #set($prevSpace = '') #foreach ($classname in $xwiki.classList) #set($classReference = $services.model.resolveDocument($classname)) ## ## Let check the user right to see the class ## #if($xwiki.getUser().hasAccessLevel('view', $classname)) #set($space = $classReference.getLastSpaceReference().name) #if($space != $prevSpace) ; [[$space>>${space}.WebHome]] space: #set($prevSpace = $space) #end : [[$classReference.name>>$classname]] #end #end {{/velocity}}

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