Show last authors
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, 'blog.manageCategories.create.error.emptyName', [])
19 #elseif(!$xwiki.exists($request.category))
20 #blog__actionResponseError(404, 'blog.manageCategories.create.error.notExists', [])
21 #elseif($xwiki.exists($newFullName))
22 #blog__actionResponseError(409, 'blog.manageCategories.create.error.alreadyExists', [$newFullName, $xwiki.getURL($newFullName)])
23 #elseif(!$xwiki.hasAccessLevel('edit', $xcontext.user, $newFullName))
24 #blog__actionResponseError(403, '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 ($escapedTitle = $title.replaceAll('\.', '\\.')) ## Escape categories with dots
31 #set($name = "${doc.space}.${escapedTitle}")
32 #if ("$!request.newCategoryParent" != '')
33 #set ($name = "${xwiki.getDocument($request.newCategoryParent).space}.${escapedTitle}")
34 #end
35 #if ($title.trim().equals(''))
36 #blog__actionResponseError(400, 'blog.manageCategories.create.error.emptyName', [])
37 #elseif (!$xwiki.getDocument($name).isNew())
38 #blog__actionResponseError(409, 'blog.manageCategories.create.error.alreadyExists', [])
39 #else
40 #if($request.ajax)
41 #set($redirectParams = {
42 'xpage': 'plain',
43 'display': 'list',
44 'root': "$!{request.newCategoryParent}",
45 'entry': "$!{request.entry}",
46 'entryObjNb': "$!{request.entryObjNb}"
47 })
48 #if("$!{request.mode}" == 'select')
49 #set($discard = $redirectParams.put('listType', 'selectable'))
50 #end
51 #set($xredirect = $doc.getURL('view', $escapetool.url($redirectParams)))
52 #else ## request.ajax
53 #set($xredirect = $doc.getURL('view', $escapetool.url({
54 'entry': "$!{request.entry}",
55 'entryObjNb': "$!{request.entryObjNb}"
56 })))
57 #end
58 $response.sendRedirect($xwiki.getURL($name, 'save', $escapetool.url({
59 'template': "${blogCategoryTemplate}",
60 'parent': "${request.newCategoryParent}",
61 "${blogCategoryClassname}_0_name": $title,
62 "${blogCategoryClassname}_0_description": '',
63 'xredirect': $xredirect,
64 'xhidden': 1,
65 'form_token': "$!{services.csrf.getToken()}"
66 })))
67 #end ## empty title
68 #end
69 #####################################################
70 ## Action execution done
71 #####################################################
72 #set($categoriesLocation = $defaultBlogSpace)
73 #if ("$!request.root" != '')
74 #set ($categoriesLocation = $xwiki.getDocument($request.root).space)
75 #elseif ("$!request.categoriesSpace" != '')
76 #set ($categoriesLocation = $request.categoriesSpace)
77 #elseif ("$!request.categoryParent" != '')
78 #set ($categoriesLocation = $xwiki.getDocument($request.categoryParent).space)
79 #set ($defaultCategoryParent = $request.categoryParent)
80 #elseif ("$!request.category" != '')
81 #set ($categoriesLocation = $xwiki.getDocument($request.category).space)
82 #end
83 #if ("$!categoriesLocation" != $defaultBlogSpace && "$!defaultCategoryParent" != '')
84 #set($defaultCategoryParent = "${categoriesLocation}.WebHome")
85 #end
86
87 #if ("$!request.display" == 'list')
88 #set($displayType = "$!{request.listType}")
89 #if($displayType == '')
90 #set($displayType = 'editable')
91 #end
92 #displayCategoryManagementTree($categoriesLocation $displayType)
93 #elseif ("$!request.display" == 'addForm')
94 #getCategoriesHierarchy($categoriesLocation $tree)
95 #addCategoryForm()
96 #elseif ("$!request.display" == 'renameForm')
97 #renameCategoryForm()
98 #elseif (!$request.ajax)
99 ##
100 $xwiki.ssx.use('Blog.ManageCategories')##
101 $xwiki.jsx.use('Blog.ManageCategories', {'minify':false})##
102 ##
103 #displayCategoryManagementTree($defaultBlogSpace 'editable')
104 #end
105 {{/html}}
106 {{/velocity}}

Get Connected