Allgemeine Aktionen:
Anmelden
Registrieren
Start
▼
:
Wiki Verzeichnis
»
Bereich:
Panels
»
Seite:
DocumentInformation
default
Aktionen:
Exportieren
▼
:
Als PDF exportieren
Als RTF exportieren
Als HTML exportieren
Weitere Aktionen
▼
:
Druckvorschau
Zeige den Quellcode
Willkommen bei bytebang
»
Menüleisten
»
Document Information
Wiki-Quellcode von
Document Information
Zuletzt geändert von
Administrator
am 2014/06/29 19:28
Inhalt
·
Kommentare
(0)
·
Anhänge
(0)
Zeilennummern anzeigen
{{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}}
Blog Kategorien
Database
(6)
Electronics
(17)
Ham Radio
(15)
Programming
(50)
System Administration
(39)
Virtualisation
(6)
Get Social
Tweet
Show some love
Do you like ths blog ?
... Buy me a beer!
1Ja5cxfZcRd5ufXNE 9g6vAAJTnQ4ToGaoD