General Actions:
Log-in
Register
Wiki:
games
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
CreatePost
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Wiki Home
»
The Wiki Blog
»
Create a new blog post
Wiki source code of
Create a new blog post
Last modified by
Administrator
on 2011/11/06 20:09
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{include document="Blog.BlogCode"/}} 2: 3: {{velocity filter="none"}} 4: {{html clean="false" wiki="true"}} 5: #if($hasEdit) 6: $xwiki.jsx.use($blogScriptsDocumentName)## 7: ## 8: ## 9: ## 10: #set($name = "$!request.entryTitle") 11: #if($name == '') 12: ## First step, display the create form 13: #set($space = "$!request.entrySpace") 14: #if($space == '') 15: #set($space = $doc.space) 16: #end 17: <form action="${xwiki.getURL('Blog.CreatePost', 'view', 'xpage=plain')}" id="newBlogPost" method="post" class="xformInline"> 18: <div> 19: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 20: <input type="hidden" name="entrySpace" value="$!{escapetool.xml($space)}"/> 21: #if($doc.getObject($blogCategoryClassname)) 22: <input type="hidden" name="category" value="${escapetool.xml(${doc.fullName})}"/> 23: #end 24: <label class="createPost" for="entryTitle">$msg.get('xe.blog.post.createpost') </label><input type="text" id="entryTitle" name="entryTitle" value="$msg.get('xe.blog.post.title')" class="withTip" size="30" /> <span class="buttonwrapper"><input type="submit" value="${escapetool.xml($msg.get('xe.blog.post.create'))}" class="button"/></span> 25: </div> 26: </form> 27: #else 28: ## Second step, form submitted, create the document 29: #set($space = "$!request.entrySpace") 30: #if($space == '') 31: #set($space = 'Main') 32: #end 33: ## Remove . and : from the document name, as they have a special meaning in XWiki document names 34: #set($postDocName = "${space}.${name.replaceAll('[.:]', '')}") 35: ## Get the target blog document, to set it as the parent 36: #getBlogDocument($space $blogDoc) 37: #set($parent = $blogDoc.fullName) 38: #set($title = "$!{escapetool.url($name)}") 39: #if("$!request.category" != '') 40: #set($category = "&${blogPostClassname}_${blogPostObjectNumber}_category=${escapetool.url(${request.category})}") 41: #end 42: $response.sendRedirect($xwiki.getURL($postDocName, 'edit', "template=${blogPostTemplate}&parent=${parent}&title=${title}&${blogPostClassname}_0_title=${title}$!{category}&form_token=$!{request.getParameter('form_token')}")) 43: #end## name == '' 44: #elseif("$!request.entryTitle" != '')## !hasEdit && form submitted 45: #template('accessdenied.vm') 46: #end## hasEdit 47: {{/html}} 48: {{/velocity}}
Recent Blog Posts
Wedding Crashers
A New Slipknot
Getting to know you
A Falling Star
The Grand Reveal
Plans for First Flight
Akuma Crushed Beneath the Heel
Caelan Defeats the Snake Form
How Not to Win Friends and Influence People
Ancient Lunars and Frozen Fair Folk
Blog Categories
Games
(60)
Diaspora
(3)
Imperium
(7)
Selene's Flurry
(20)
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2009
(1)
2011
(1)
2012
(1)