Toggle navigation
Log-in
myITGuide
Page Index
User Index
Application Index
Global
Wiki Index
Home
Blog
Links
Database
SQL Server
Cassandra
BigData
PostgreSQL
Redis
MariaDB
MongoDB
Tools
T-SQL
Powershell
Python
Scala
R
Jupyter
Java
Solution
Streaming
Spark
Storm
Search
Solr
ElasticSearch
Kafka
Puppet
Kibana
Docker
Kubernetes
OS
Windows
Linux
About
About Us
Email Us
Blog
Create a new blog post
Wiki source code of
Create a new blog post
Last modified by superadmin on 2016/12/20 10:05
Copy
Export
Print preview
View Source
Siblings
Content
Comments
Information
×
Export
Office Formats
Export as PDF
Other Formats
Export as HTML
Hide line numbers
1: {{include reference="Blog.BlogCode"/}} 2: 3: {{velocity}} 4: {{html clean="false" wiki="true"}} 5: #set($name = "$!request.entryTitle") 6: #if($name == '') 7: ## If there's also a form_token passed it means the user has entered an empty blog post title, let the user know about it! 8: #if ("$!request.form_token" != '') 9: {{error}}$services.localization.render('xe.blog.post.titleEmptyError'){{/error}} 10: 11: #end 12: ## First step, display the create form 13: #if($hasEdit) 14: $xwiki.jsx.use($blogScriptsDocumentName)## 15: #set($space = "$!request.entrySpace") 16: #if($space == '') 17: #set($space = $doc.space) 18: #end 19: <form action='$doc.getURL()' id="newBlogPost" method="post" class="xformInline"> 20: <div> 21: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 22: <input type="hidden" name="entrySpace" value="$!{escapetool.xml($space)}"/> 23: #if($doc.getObject($blogCategoryClassname)) 24: <input type="hidden" name="category" value="$services.rendering.escape(${escapetool.xml(${doc.fullName})}, $doc.syntax)"/> 25: #end 26: $services.icon.renderHTML('add')<label class="createPost" for="entryTitle">$services.localization.render('xe.blog.post.createpost') </label><input type="text" id="entryTitle" name="entryTitle" value="$services.localization.render('xe.blog.post.title')" class="withTip" size="30" /> <span class="buttonwrapper"><input type="submit" value="${escapetool.xml($services.localization.render('xe.blog.post.create'))}" class="btn btn-success button"/></span> 27: </div> 28: </form> 29: #elseif("$!request.entryTitle" != '')## !hasEdit && form submitted 30: #template('accessdenied.vm') 31: #end## hasEdit 32: #else 33: ## Second step, form submitted, create the document 34: #set($space = "$!request.entrySpace") 35: #if($space == '') 36: #set($space = 'Main') 37: #end 38: ## Remove . and : from the document name, as they have a special meaning in XWiki document names 39: #set($postDocName = "${space}.${name.replaceAll('[.:]', '')}") 40: ## Get the target blog document, to set it as the parent 41: #getBlogDocument($space $blogDoc) 42: #set($parent = "$!{escapetool.url($blogDoc.fullName)}") 43: #set($title = "$!{escapetool.url($name)}") 44: #if("$!request.category" != '') 45: #set($category = "&${blogPostClassname}_${blogPostObjectNumber}_category=${escapetool.url(${request.category})}") 46: #end 47: $response.sendRedirect($xwiki.getURL($postDocName, 'edit', "template=${blogPostTemplate}&parent=${parent}&title=${title}&${blogPostClassname}_0_title=${title}$!{category}&form_token=$!{request.getParameter('form_token')}")) 48: #end## name == '' 49: {{/html}} 50: {{/velocity}}
Recent Blog Posts
My Technology Roadmap
Blog Categories
All
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2017
(1)