General Actions:
Log-in
Wiki:
L3D's Wiki
▼
:
Document Index
»
Space:
Panels
▼
:
Document Index
»
Page:
DocumentInformation
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Panels
»
Document Information
Wiki source code of
Document Information
Last modified by
Administrator
on 2011/03/02 20:49
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
## #macro(convertDocument $translatedDoc $error $oldSyntax $newSyntaxId $content) #if ($translatedDoc.realLanguage == $xwiki.languagePreference) #set($theDoc = $translatedDoc) #if ($request.content) #set($void = $translatedDoc.setContent($request.content)) #end #end ## Use the syntax and content received from the client, as the user might have made some changes that are not on saved yet. #set($void = $translatedDoc.setSyntaxId($oldSyntax)) #if (!$translatedDoc.convertSyntax($newSyntaxId) || !${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) #set($error = true) #else #set($void = $translatedDoc.save("Document converted from syntax $oldSyntax to syntax $newSyntaxId")) #end #end ## #if("$!{request.action}" == "convertSyntax") #set($oldSyntax = $request.oldSyntaxId) #set($newSyntaxId = $request.newSyntaxId) #set($mainDoc = $xwiki.getDocument($request.documentName)) #set($theDoc = $mainDoc) #set($error = false) ## ## Convert current document ## #convertDocument($mainDoc $error $oldSyntax $newSyntaxId $theDoc) ## ## Convert document translations ## #set($languages = $theDoc.translationList) #if (!$error) #foreach ($language in $languages) #if (!$error) #set($translatedDoc = $mainDoc.getTranslatedDocument($language)) #if ($translatedDoc.language != $mainDoc.language) #convertDocument($translatedDoc $error $oldSyntax $newSyntaxId $theDoc) #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:{pre}$theDoc.content{/pre} #else $response.setStatus(501) ## TODO: Find a way to put the exception in the context and send it to the client. failed #end #else #includeForm("Panels.PanelSheet") #end
Quick Links
L3D Calendar
Wiki Dashboard
Document Index
Blog
Sandbox