Document Information
Log-in
|
Panels
:
Panels
>
Document Information
Top Menu
Show
:
Comments
Attachments
History
Information
Stampa
:
Stampa
Anteprima di stampa
Esporta come PDF
Esporta in formato RTF
Esporta come HTML
Esporta in formato XAR
Wiki source code of
Document 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)) #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
Search
Quick Links
Wiki Dashboard
Document Index
Blog
Sandbox
My Recent Modifications
dany
|
marco