一般动作
登录
Wiki: BROPEN ▼: Document Index
»
Space: XWiki ▼: Document Index
»
Page: XWikiClasses
搜索
default
页面动作
导出 ▼: 以PDF格式导出 以RTF格式导出 以HTML格式导出
更多动作 ▼: 打印预览 察看源码
欢迎进入Wiki » XWiki空间 » Data types

# Wiki源代码Data types

在2013-10-09 15:03上被Administrator修改
评论 (0) · 附件 (0) · 记录 · 信息
显示行号 {{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}}

# 快速链接

- 首页
- 新闻动态
- FAQ

Copyright © 2013 北京博瑞开源软件有限公司
京ICP备12048974号