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
Kommentare (0) · Anhänge (0)
Zeilennummern verstecken 1: {{velocity output="false"}} 2: #macro(convertDocument $targetDoc $error $oldSyntaxId $newSyntaxId) 3: #if ($targetDoc.realLanguage == $xwiki.languagePreference) 4: #if ($request.content) 5: ## Use the content received from the client if the target document is the edited one (could be also a translation of the edited document). 6: #set ($void = $targetDoc.setContent($request.content)) 7: #end 8: #end 9: ## Use the syntax received from the client as the user might have made some changes that are not saved yet. 10: #set ($void = $targetDoc.setSyntaxId($oldSyntaxId)) 11: #if (!$services.csrf.isTokenValid($request.form_token) || !$targetDoc.convertSyntax($newSyntaxId)) 12: #set ($error = true) 13: #else 14: #set ($void = $targetDoc.save("Document converted from syntax $oldSyntaxId to syntax $newSyntaxId")) 15: #end 16: #end 17: {{/velocity}} 18: 19: {{velocity wiki="false"}} 20: #if ("$!request.action" == 'convertSyntax') 21: #set ($oldSyntaxId = $request.oldSyntaxId) 22: #set ($newSyntaxId = $request.newSyntaxId) 23: #set ($targetDoc = $xwiki.getDocument($request.documentName)) 24: #set ($error = false) 25: ## 26: ## Convert the specified document 27: ## 28: #convertDocument($targetDoc $error $oldSyntaxId $newSyntaxId) 29: ## 30: ## Convert all the translations of the specified document 31: ## 32: #set($languages = $targetDoc.translationList) 33: #if (!$error) 34: #foreach ($language in $languages) 35: #if (!$error) 36: #set ($translatedDoc = $targetDoc.getTranslatedDocument($language)) 37: #if ($translatedDoc.language != $targetDoc.language) 38: #convertDocument($translatedDoc $error $oldSyntaxId $newSyntaxId) 39: #end 40: #end 41: #end 42: #end 43: ## 44: ## Error management 45: ## 46: #if (!$error) 47: ## Conversion successful. The "ok:" prefix is needed, since otherwise an empty content will result in a "This template does not exist" exception. 48: ok:${targetDoc.content}## 49: #else 50: $response.setStatus(501) 51: ## TODO: Find a way to put the exception in the context and send it to the client. 52: failed 53: #end 54: #end 55: {{/velocity}}

# Blog Kategorien

- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.Database" title="RSS"> http://scm.bytebang.at/bin/Blog/Database">Database (6)
- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.Electronics" title="RSS"> http://scm.bytebang.at/bin/Blog/Electronics">Electronics (17)
- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.Ham+Radio" title="RSS"> http://scm.bytebang.at/bin/Blog/Ham+Radio">Ham Radio (15)
- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.Programming" title="RSS"> http://scm.bytebang.at/bin/Blog/Programming">Programming (50)
- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.System+Administration" title="RSS"> http://scm.bytebang.at/bin/Blog/System+Administration">System Administration (39)
- http://scm.bytebang.at/bin/Blog/CategoryRss?xpage=plain&amp;category=Blog.Virtualisation" title="RSS"> http://scm.bytebang.at/bin/Blog/Virtualisation">Virtualisation (6)

# Get Social

Tweet

# Show some love

Do you like ths blog ?
... Buy me a beer!

1Ja5cxfZcRd5ufXNE 9g6vAAJTnQ4ToGaoD

(c) 2025, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-