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
Show line numbers
{{include reference="Blog.BlogCode"/}} {{velocity}} {{html clean="false" wiki="true"}} #set($name = "$!request.entryTitle") #if($name == '') ## 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! #if ("$!request.form_token" != '') {{error}}$services.localization.render('xe.blog.post.titleEmptyError'){{/error}} #end ## First step, display the create form #if($hasEdit) $xwiki.jsx.use($blogScriptsDocumentName)## #set($space = "$!request.entrySpace") #if($space == '') #set($space = $doc.space) #end <form action='$doc.getURL()' id="newBlogPost" method="post" class="xformInline"> <div> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="hidden" name="entrySpace" value="$!{escapetool.xml($space)}"/> #if($doc.getObject($blogCategoryClassname)) <input type="hidden" name="category" value="$services.rendering.escape(${escapetool.xml(${doc.fullName})}, $doc.syntax)"/> #end $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> </div> </form> #elseif("$!request.entryTitle" != '')## !hasEdit && form submitted #template('accessdenied.vm') #end## hasEdit #else ## Second step, form submitted, create the document #set($space = "$!request.entrySpace") #if($space == '') #set($space = 'Main') #end ## Remove . and : from the document name, as they have a special meaning in XWiki document names #set($postDocName = "${space}.${name.replaceAll('[.:]', '')}") ## Get the target blog document, to set it as the parent #getBlogDocument($space $blogDoc) #set($parent = "$!{escapetool.url($blogDoc.fullName)}") #set($title = "$!{escapetool.url($name)}") #if("$!request.category" != '') #set($category = "&${blogPostClassname}_${blogPostObjectNumber}_category=${escapetool.url(${request.category})}") #end $response.sendRedirect($xwiki.getURL($postDocName, 'edit', "template=${blogPostTemplate}&parent=${parent}&title=${title}&${blogPostClassname}_0_title=${title}$!{category}&form_token=$!{request.getParameter('form_token')}")) #end## name == '' {{/html}} {{/velocity}}
Recent Blog Posts
My Technology Roadmap
Blog Categories
All
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2017
(1)