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
Manage blog categories
Wiki source code of
Manage blog categories
Last modified by superadmin on 2016/12/20 10:05
Hide line numbers
1: {{include reference="Blog.CategoriesCode"/}} 2: 3: {{velocity filter="none"}} 4: {{html clean="false" wiki="true"}} 5: #set($space = "$!request.space") 6: ## 7: ## 8: ###################################################### 9: ## Execute actions 10: ###################################################### 11: #if ("$!request.xaction" == 'delete') 12: #foreach($item in $request.getParameterValues('category')) 13: #deleteCategory($item) 14: #end 15: #elseif("$!request.xaction" == 'rename') 16: #set ($newFullName = "$!{request.newCategoryName}") 17: #if($newFullName.trim().equals('')) 18: #blog__actionResponseError(400, 'xe.blog.manageCategories.create.error.emptyName', []) 19: #elseif(!$xwiki.exists($request.category)) 20: #blog__actionResponseError(404, 'xe.blog.manageCategories.create.error.notExists', []) 21: #elseif($xwiki.exists($newFullName)) 22: #blog__actionResponseError(409, 'xe.blog.manageCategories.create.error.alreadyExists', [$newFullName, $xwiki.getURL($newFullName)]) 23: #elseif(!$xwiki.hasAccessLevel('edit', $xcontext.user, $newFullName)) 24: #blog__actionResponseError(403, 'xe.blog.manageCategories.create.error.targetNotWritable', [$newFullName]) 25: #else 26: #renameCategory($request.category, $newFullName) 27: #end 28: #elseif("$!request.xaction" == 'create') 29: #set($title = "$!{request.newCategoryName}") 30: #set($name = "${doc.space}.${title}") 31: #if ($title.trim().equals('')) 32: #blog__actionResponseError(400, 'xe.blog.manageCategories.create.error.emptyName', []) 33: #elseif (!$xwiki.getDocument($name).isNew()) 34: #blog__actionResponseError(409, 'xe.blog.manageCategories.create.error.alreadyExists', []) 35: #else 36: #if($request.ajax) 37: #set($redirectParams = { 38: 'xpage': 'plain', 39: 'display': 'list', 40: 'root': "$!{request.newCategoryParent}", 41: 'entry': "$!{request.entry}", 42: 'entryObjNb': "$!{request.entryObjNb}" 43: }) 44: #if("$!{request.mode}" == 'select') 45: #set($discard = $redirectParams.put('listType', 'selectable')) 46: #end 47: #set($xredirect = $doc.getURL('view', $escapetool.url($redirectParams))) 48: #else ## request.ajax 49: #set($xredirect = $doc.getURL('view', $escapetool.url({ 50: 'entry': "$!{request.entry}", 51: 'entryObjNb': "$!{request.entryObjNb}" 52: }))) 53: #end 54: $response.sendRedirect($xwiki.getURL($name, 'save', $escapetool.url({ 55: 'template': "${blogCategoryTemplate}", 56: 'parent': "${request.newCategoryParent}", 57: "${blogCategoryClassname}_0_name": $title, 58: "${blogCategoryClassname}_0_description": '', 59: 'xredirect': $xredirect, 60: 'xhidden': 1, 61: 'form_token': "$!{services.csrf.getToken()}" 62: }))) 63: #end ## empty title 64: #end 65: ##################################################### 66: ## Action execution done 67: ##################################################### 68: #if ("$!request.display" == 'list') 69: #set($displayType = "$!{request.listType}") 70: #if($displayType == '') 71: #set($displayType = 'editable') 72: #end 73: #displayCategoryManagementTree('' $displayType) 74: #elseif ("$!request.display" == 'addForm') 75: #getCategoriesHierarchy('' $tree) 76: #addCategoryForm() 77: #elseif ("$!request.display" == 'renameForm') 78: #renameCategoryForm() 79: #elseif (!$request.ajax) 80: ## 81: $xwiki.ssx.use('Blog.ManageCategories')## 82: $xwiki.jsx.use('Blog.ManageCategories', {'minify':false})## 83: ## 84: #displayCategoryManagementTree('' 'editable') 85: #end 86: {{/html}} 87: {{/velocity}}