General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
Migration
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
The Wiki Blog
»
Manage blogs on this wiki
»
Blog migration
Wiki source code of
Blog migration
Last modified by
Administrator
on 2012/03/21 17:41
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
{{velocity filter="none"}} #if($request.migrate && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) #set($newContent = '#includeForm("Blog.BlogPostSheet")') #set($query = ", BaseObject obj where obj.name = doc.fullName and obj.className = 'XWiki.ArticleClass'") #foreach($article in $xwiki.searchDocuments($query)) #if($xwiki.hasAccessLevel('edit', $xcontext.user, $article)) #set($articleDoc = $xwiki.getDocument($article)) #set($articleObj = $articleDoc.getObject('XWiki.ArticleClass')) #set($entryObj = $articleDoc.newObject('Blog.BlogPostClass')) #foreach($property in ['title', 'content', 'extract', 'category']) $!entryObj.set($property, $articleObj.getProperty($property).value) #end $!entryObj.set('published', 1) $!entryObj.set('publishDate', $articleDoc.creationDate) $!entryObj.set('hidden', 0) #set($discard = $articleDoc.removeObjects('XWiki.ArticleClass')) $articleDoc.setContent($newContent) $!articleDoc.save($msg.get('xe.blog.migration.migrated'), true) * $msg.get('xe.blog.migration.updated') [[$entryObj.title>>${article}]] ($msg.get('xe.blog.migration.inspace') [[$articleDoc.space>>${articleDoc.space}.WebHome]]) #else * $msg.get('xe.blog.migration.skipping') [[$article]] #end #end $msg.get('xe.blog.migration.done') [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] #else $msg.get('xe.blog.migration.pleaseconfirm') {{html clean="false" wiki="true"}} <form action="$doc.getURL()" method="post"> <div> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="submit" name="migrate" value="$msg.get('xe.blog.migration.confirm')"/> </div> </form> {{/html}} [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] #end {{/velocity}}
Recent Blog Posts
First blog post
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2009
(1)