General Actions:
Log-in
Wiki:
CC09
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
Migration
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to the C&C 09 Doctoral Consortium Wiki
»
The Wiki Blog
»
Manage blogs on this wiki
»
Blog migration
Wiki source code of
Blog migration
Last modified by
Administrator
on 2010/08/16 20:24
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity filter="none"}} 2: #if($request.migrate) 3: #set($newContent = '#includeForm("Blog.BlogPostSheet")') 4: #set($query = ", BaseObject obj where obj.name = doc.fullName and obj.className = 'XWiki.ArticleClass'") 5: #foreach($article in $xwiki.searchDocuments($query)) 6: #if($xwiki.hasAccessLevel('edit', $context.user, $article)) 7: #set($articleDoc = $xwiki.getDocument($article)) 8: #set($articleObj = $articleDoc.getObject('XWiki.ArticleClass')) 9: #set($entryObj = $articleDoc.newObject('Blog.BlogPostClass')) 10: #foreach($property in ['title', 'content', 'extract', 'category']) 11: $!entryObj.set($property, $articleObj.getProperty($property).value) 12: #end 13: $!entryObj.set('published', 1) 14: $!entryObj.set('publishDate', $articleDoc.creationDate) 15: $!entryObj.set('hidden', 0) 16: #set($discard = $articleDoc.removeObjects('XWiki.ArticleClass')) 17: $articleDoc.setContent($newContent) 18: $!articleDoc.save($msg.get('xe.blog.migration.migrated'), true) 19: * $msg.get('xe.blog.migration.updated') [[$entryObj.title>>${article}]] ($msg.get('xe.blog.migration.inspace') [[$articleDoc.space>>${articleDoc.space}.WebHome]]) 20: #else 21: * $msg.get('xe.blog.migration.skipping') [[$article]] 22: #end 23: #end 24: $msg.get('xe.blog.migration.done') [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] 25: #else 26: $msg.get('xe.blog.migration.pleaseconfirm') 27: 28: {{html clean="false" wiki="true"}} 29: <form action="$doc.getURL()" method="post"> 30: <div><input type="submit" name="migrate" value="$msg.get('xe.blog.migration.confirm')"/></div> 31: </form> 32: {{/html}} 33: 34: [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] 35: #end 36: {{/velocity}}
Recent Blog Posts
Problems with the Bibliography System
Welcome to the Wiki
First blog post
Blog Entries
Blog Archive
2009
(3)
Quick Links
Wiki Dashboard
Document Index
Blog
Sandbox
My Recent Modifications
recentComments