Hide last authors
Admin 1.1 1 {{include document="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(''))
Admin 6.1 18 #blog__actionResponseError(400, 'xe.blog.manageCategories.create.error.emptyName', [])
Admin 1.1 19 #elseif(!$xwiki.exists($request.category))
Admin 6.1 20 #blog__actionResponseError(404, 'thispagedoesnotexist', [])
Admin 1.1 21 #elseif($xwiki.exists($newFullName))
Admin 6.1 22 #blog__actionResponseError(409, 'core.rename.alreadyExists', [$newFullName, $xwiki.getURL($newFullName)])
Admin 2.1 23 #elseif(!$xwiki.hasAccessLevel('edit', $xcontext.user, $newFullName))
Admin 6.1 24 #blog__actionResponseError(403, 'core.rename.targetNotWritable', [$newFullName])
Admin 1.1 25 #else
26 #renameCategory($request.category, $newFullName)
27 #end
28 #elseif("$!request.xaction" == 'create')
29 #set($title = "$!{request.newCategoryName}")
Admin 6.1 30 #set($name = "${doc.space}.${title}")
Admin 1.1 31 #if ($title.trim().equals(''))
Admin 6.1 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', [])
Admin 1.1 35 #else
Vincent Massol 8.1 36 #set($title = $escapetool.url($title))
37 #set($newCategoryParent = $escapetool.url($request.newCategoryParent))
Admin 1.1 38 #if($request.ajax)
39 #if("$!{request.mode}" == 'select')
40 #set($xredirect = ${doc.getURL('view', "xpage=plain&display=list&listType=selectable&root=${newCategoryParent}")})
41 #else
42 #set($xredirect = ${doc.getURL('view', "xpage=plain&display=list&root=${newCategoryParent}")})
43 #end
Vincent Massol 8.1 44 $response.sendRedirect($xwiki.getURL($name, 'save', "template=${blogCategoryTemplate}&parent=${newCategoryParent}&${blogCategoryClassname}_0_name=${title}&${blogCategoryClassname}_0_description=&xredirect=${escapetool.url($xredirect)}&form_token=$!{services.csrf.getToken()}"))
Admin 1.1 45 #else ## request.ajax
Vincent Massol 8.1 46 $response.sendRedirect($xwiki.getURL($name, 'save', "template=${blogCategoryTemplate}&parent=${newCategoryParent}&${blogCategoryClassname}_0_name=${title}&${blogCategoryClassname}_0_description=&xredirect=${escapetool.url(${doc.getURL()})}&form_token=$!{services.csrf.getToken()}"))
Admin 1.1 47 #end
48 #end ## empty title
49 #end
50 #####################################################
51 ## Action execution done
52 #####################################################
53 #if ("$!request.display" == 'list')
54 #set($displayType = "$!{request.listType}")
55 #if($displayType == '')
56 #set($displayType = 'editable')
57 #end
58 #displayCategoryManagementTree('' $displayType)
59 #elseif ("$!request.display" == 'addForm')
60 #getCategoriesHierarchy('' $tree)
61 #addCategoryForm()
62 #elseif ("$!request.display" == 'renameForm')
63 #renameCategoryForm()
Admin 6.1 64 #elseif (!$request.ajax)
Admin 1.1 65 ##
66 $xwiki.ssx.use('Blog.ManageCategories')##
67 $xwiki.jsx.use('Blog.ManageCategories', {'minify':false})##
68 ##
69 #displayCategoryManagementTree('' 'editable')
70 #end
71 {{/html}}
72 {{/velocity}}

Get Connected