一般动作
登录
Wiki:
BROPEN
▼
:
Document Index
»
Space:
Panels
▼
:
Document Index
»
Page:
DocumentInformation
搜索
default
页面动作
导出
▼
:
以PDF格式导出
以RTF格式导出
以HTML格式导出
更多动作
▼
:
打印预览
察看源码
欢迎进入Wiki
»
面板
»
Document Information
Wiki源代码
Document Information
在2013-10-09 15:02上被
Administrator
修改
内容
·
评论
(0)
·
附件
(0)
·
记录
·
信息
显示行号
{{velocity output="false"}} #macro(convertDocument $targetDoc $error $oldSyntaxId $newSyntaxId) #if ($targetDoc.realLanguage == $xwiki.languagePreference) #if ($request.content) ## Use the content received from the client if the target document is the edited one (could be also a translation of the edited document). #set ($void = $targetDoc.setContent($request.content)) #end #end ## Use the syntax received from the client as the user might have made some changes that are not saved yet. #set ($void = $targetDoc.setSyntaxId($oldSyntaxId)) #if (!$services.csrf.isTokenValid($request.form_token) || !$targetDoc.convertSyntax($newSyntaxId)) #set ($error = true) #else #set ($void = $targetDoc.save("Document converted from syntax $oldSyntaxId to syntax $newSyntaxId")) #end #end {{/velocity}} {{velocity wiki="false"}} #if ("$!request.action" == 'convertSyntax') #set ($oldSyntaxId = $request.oldSyntaxId) #set ($newSyntaxId = $request.newSyntaxId) #set ($targetDoc = $xwiki.getDocument($request.documentName)) #set ($error = false) ## ## Convert the specified document ## #convertDocument($targetDoc $error $oldSyntaxId $newSyntaxId) ## ## Convert all the translations of the specified document ## #set($languages = $targetDoc.translationList) #if (!$error) #foreach ($language in $languages) #if (!$error) #set ($translatedDoc = $targetDoc.getTranslatedDocument($language)) #if ($translatedDoc.language != $targetDoc.language) #convertDocument($translatedDoc $error $oldSyntaxId $newSyntaxId) #end #end #end #end ## ## Error management ## #if (!$error) ## Conversion successful. The "ok:" prefix is needed, since otherwise an empty content will result in a "This template does not exist" exception. ok:${targetDoc.content}## #else $response.setStatus(501) ## TODO: Find a way to put the exception in the context and send it to the client. failed #end #end {{/velocity}} {{velocity}} #if ("$!request.action" != 'convertSyntax') {{include document="Panels.PanelSheet"/}} #end {{/velocity}}
快速链接
首页
新闻动态
FAQ