Wiki source code of Create a new blog post

Last modified by Administrator on 2008/11/25 23:44

Show last authors
1 #includeMacros("Blog.BlogCode")
2 #if($hasEdit)
3 $xwiki.jsx.use($blogScriptsDocumentName)##
4 ##
5 ##
6 ##
7 #set($name = "$!request.entryTitle")
8 #if($name == '')
9 ## First step, display the create form
10 #set($space = "$!request.entrySpace")
11 #if($space == '')
12 #set($space = $doc.space)
13 #end
14 1.1 Create a new post
15 <form action="${xwiki.getURL('Blog.CreatePost')}" id="newBlogPost" method="post">
16 <div>
17 <input type="hidden" name="entrySpace" value="$space"/>
18 <input type="text" name="entryTitle" value="Post title"/>
19 <input type="submit" value="Create"/>
20 </div>
21 </form>
22 #else
23 ## Second step, form submitted, create the document
24 #set($space = "$!request.entrySpace")
25 #if($space == '')
26 #set($space = 'Main')
27 #end
28 ## Remove . and : from the document name, as they have a special meaning in XWiki document names
29 #set($postDocName = "${space}.${name.replaceAll('[.:]', '')}")
30 ## Get the target blog document, to set it as the parent
31 #getBlogDocument($space $blogDoc)
32 #set($parent = $blogDoc.fullName)
33 #set($title = $util.encodeURI($name))
34 $response.sendRedirect($xwiki.getURL($postDocName, 'inline', "template=${blogPostTemplate}&parent=${parent}&title=${title}&${blogPostClassname}_0_title=${title}"))
35 #end## name == ''
36 #end## hasEdit