General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
CategoriesCode
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
The Wiki Blog
»
Macros for the Blog Categories
Wiki source code of
Macros for the Blog Categories
Last modified by
Administrator
on 2012/03/21 17:41
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{include document="Blog.BlogCode"/}} 2: 3: {{velocity output="false"}} 4: ## 5: ## 6: ## 7: #** 8: * Retrieves the list of blog entries from a given category. Entries belonging to subcategories 9: * are not returned. 10: * 11: * @param category The name of the category (XDocument full name, for example 'MyBlog.Fishing'). 12: * @param articles Return parameter, where the list of entries is placed. 13: * @param total Return parameter, where the total number of entries belonging to this category is 14: * placed. Useful for a paginated view. 15: *### 16: #macro(getEntriesForCategory $category $entries $totalEntries) 17: #set ($entries = $util.null) 18: #set ($totalEntries = $util.null) 19: #if ("$!{blogCategoryEntriesCache.containsKey($!{category})}" == 'true') 20: #setVariable ("$entries" $blogCategoryEntriesCache.get($!{category}).get(0)) 21: #setVariable ("$totalEntries" $blogCategoryEntriesCache.get($!{category}).get(1)) 22: #preparePagedViewParams ($totalEntries 10) 23: #else 24: #getCategoriesHierarchy ('' $tree) 25: #set ($subcategories = []) 26: #getSubcategories ($tree $category $subcategories) 27: #set ($categories = [${category}]) 28: #set ($discard = $categories.addAll(${subcategories})) 29: #set ($parameters = '?') 30: #foreach ($subcategory in $subcategories) 31: #set ($parameters = $parameters.concat(', ?')) 32: #end 33: #getBlogEntriesBaseQuery ($query) 34: #set ($query = ", DBStringListProperty as categories join categories.list as category${query} and obj.id = categories.id.id and categories.id.name='category' and category in (${parameters})") 35: #set ($totalResult = $xwiki.countDocuments(${query}, ${categories})) 36: #preparePagedViewParams ($totalResult 10) 37: #set ($result = $xwiki.searchDocuments("${query} order by publishDate.value desc", $itemsPerPage, $startAt, ${categories})) 38: #if ("$!{blogCategoryEntriesCache.containsKey($!{category})}" == '') 39: #set ($blogCategoryEntriesCache = {}) 40: #end 41: #set ($discard = $blogCategoryEntriesCache.put("$!{category}", [$result, $totalResult])) 42: #setVariable ("$entries" $result) 43: #setVariable ("$totalEntries" $totalResult) 44: #end 45: #end 46: #macro(getSubcategories $tree $category $subcategories) 47: #if(!$subcategories.contains($category)) 48: #foreach($subcategory in $tree.get($category)) 49: #set($discard = $subcategories.add($subcategory)) 50: #getSubcategories($tree $subcategory $subcategories) 51: #end 52: #end 53: #end 54: ## 55: ## 56: ## 57: #** 58: * Builds a tree of categories, respecting the parent<->subcategory relation. Each node holds the 59: * full name of the category's document. The root of the tree is 'Blog.Categories'. 60: * 61: * @param space The space where to search for categories. If this parameter is an emptry string or 62: * null, all the categories in the wiki are returned. 63: * @param tree Return parameter, HashMap<String, List<String>> structure holding the categories 64: * hierarchy, where the key is the name of a category, and the value contains the names of 65: * all its subcategories. To obtain the full hierarchy, start with the key 'Blog.Categories'. 66: *### 67: #macro(getCategoriesHierarchy $space $tree) 68: #set ($tree = $util.null) 69: #if ("$!{blogCategoriesHierarchyCache.containsKey($!{space})}" == 'true') 70: #setVariable ("$tree" $blogCategoriesHierarchyCache.get($!{space})) 71: #else 72: #set ($result = {}) 73: #set($query = ', BaseObject obj where ') 74: #if("$!space" != '') 75: #set($query = "${query}doc.space = '${space}' and ") 76: #end 77: #set($query = "${query}obj.name = doc.fullName and obj.className = '${blogCategoryClassname}' order by doc.name") 78: #foreach($category in $xwiki.searchDocuments($query)) 79: #set($categoryDoc = $xwiki.getDocument($category)) 80: #set($categoryParent = "$!categoryDoc.parent") 81: #if($categoryParent == '') 82: #set($categoryParent = $defaultCategoryParent) 83: #end 84: #if(!$result.containsKey($categoryParent)) 85: #set($discard = $result.put($categoryParent, [])) 86: #end 87: #set($discard = $result.get($categoryParent).add($category)) 88: #end 89: #if ("$!{blogCategoriesHierarchyCache.containsKey($!{space})}" == '') 90: #set ($blogCategoriesHierarchyCache = {}) 91: #end 92: #set ($discard = $blogCategoriesHierarchyCache.put("$!{space}", $result)) 93: #setVariable ("$tree" $result) 94: #end 95: #end 96: ## 97: ## 98: ## 99: #** 100: * Displays the category hierarchy held in the <tt>tree</tt> parameter. 101: * 102: * @param tree The category hierarchy, a HashMap<String, List<String>> structure, where the key 103: * is the name of a category, and the value contains the names of all its subcategories. 104: * @param displayMethod Selects how to display the category tree. Possible values are: 105: * <ul> 106: * <li><em>"simple"</em>: tree with links to the category pages.</li> 107: * <li><em>"selectable"</em>: each category name in the tree is preceded by a checkbox.</li> 108: * <li><em>"option"</em>: wraps each category name in an <option> element, to be used 109: * in a select box.</li> 110: * <li><em>"editable"</em>: displays links to delete and edit each category, if the rights 111: * allow such actions.</li> 112: * </ul> 113: * For any other value, the default ("simple") is considered. 114: *### 115: #macro(displayCategoriesHierarchy $tree $displayMethod) 116: #set($processedCategories = $util.arrayList) 117: #displayCategoriesHierarchyRecursive($tree $defaultCategoryParent 1 $displayMethod) 118: #end 119: ## 120: ## 121: ## 122: #** 123: * Displays recursively the category hierarchy held in the <tt>tree</tt> parameter, starting at 124: * the node indicated by the <tt>root</tt> parameter, which is on the <tt>level</tt>th level in 125: * the tree. 126: * 127: * @param tree The category hierarchy HashMap<String, List<String>> structure, where the key 128: * is the name of a category, and the value contains the names of all its subcategories. 129: * @param root The full name of the document containing the category that is to be considered the 130: * root of the displayed subtree. 131: * @param level The current depth of the tree, used for proper indentation. 132: * @param displayMethod Selects how to display the category tree. Possible values are: 133: * <ul> 134: * <li><em>"simple"</em>: tree with links to the category pages.</li> 135: * <li><em>"selectable"</em>: each category name in the tree is preceded by a checkbox.</li> 136: * <li><em>"option"</em>: wraps each category name in an <option> element, to be used 137: * in a select box.</li> 138: * <li><em>"editable"</em>: displays links to delete and edit each category, if the rights 139: * allow such actions.</li> 140: * </ul> 141: * For any other value, the default ("simple") is considered. 142: *### 143: #macro(displayCategoriesHierarchyRecursive $tree $root $level $displayMethod) 144: #if(!$processedCategories) 145: #set($processedCategories = $util.arrayList) 146: #end 147: #foreach($item in $tree.get($root)) 148: #if(!$processedCategories.contains($item)) 149: #set($discard = $processedCategories.add($item)) 150: #displayCategory($item $level $displayMethod) 151: #displayCategoriesHierarchyRecursive($tree $item $mathtool.add($level, 1) $displayMethod) 152: #end 153: #end 154: #end 155: ## 156: ## 157: ## 158: #** 159: * Displays a category as part of a category hierarchy. 160: * 161: * @param name The full name of the document containing the category to be displayed. 162: * @param level The depth where this category is in the tree, used for proper indentation. 163: * @param displayMethod Selects how to display the category tree. Possible values are: 164: * <ul> 165: * <li><em>"simple"</em>: tree with links to the category pages.</li> 166: * <li><em>"selectable"</em>: each category name in the tree is preceded by a checkbox.</li> 167: * <li><em>"option"</em>: wraps each category name in an <option> element, to be used 168: * in a select box.</li> 169: * <li><em>"editable"</em>: displays links to delete and edit each category, if the rights 170: * allow such actions.</li> 171: * </ul> 172: * For any other value, the default ("simple") is considered. 173: *### 174: #macro(displayCategory $name $level $displayMethod) 175: #if("$!displayMethod" == "option") 176: #displayOptionCategory($name $level) 177: #elseif("$!displayMethod" == "selectable") 178: #displaySelectableCategory($name $level) 179: #elseif("$!displayMethod" == "editable") 180: #displayEditableCategory($name $level) 181: #else 182: #displaySimpleCategory($name $level) 183: #end 184: #end 185: ## 186: ## 187: ## 188: #** 189: * Displays a category as part of a category hierarchy, preceded by a checkbox that allows choosing 190: * this category for a blog entry. 191: * 192: * @param name The full name of the document containing the category to be displayed. 193: * @param level The depth where this category is in the tree, used for proper indentation. 194: *### 195: #macro(displaySelectableCategory $name $level) 196: #set($categoryDoc = $xwiki.getDocument($name)) 197: #set($nameUrl = $escapetool.url($name)) 198: #foreach($i in [1..$level])*#end ## 199: <span class="blog-category-level"><span class="blog-category">## 200: <label id='blog_category_${escapetool.xml($name)}' title="#getCategoryDescription($categoryDoc)"><input name="${blogPostClassname}_$!{entryObj.number}_category" value="${escapetool.xml($name)}" type="checkbox"#if($entryObj.getProperty('category').getValue().contains($name)) checked="checked" #end/> #getCategoryName($categoryDoc)</label>## 201: </span>## 202: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $doc.fullName) && ("$!{request.xaction}" != "showAddCategory" || "$!{request.parentCategory}" != $name)) 203: <span class="blog-category-tools">## 204: <a href="$doc.getURL('view', "xaction=showAddCategory&parentCategory=$nameUrl")" class="tool add-subcategory">#toolImage('chart_organisation_add' 'Add a subcategory ')</a>## 205: </span>## 206: #end 207: </span> 208: #end 209: ## 210: ## 211: ## 212: #** 213: * Displays a form for creating a new category. If a parentCategory parameter is present in the 214: * query string, the parent category is set accordingly. Otherwise, the form provides a selection 215: * control for choosing the parent category among existing categories. 216: *### 217: ## DO NOT CHANGE INDENTATION 218: #macro(addCategoryForm) <form action="$doc.getURL()" method="post" class="category-add-form"><div class='create-category'> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="hidden" name="xaction" value="create"/> <label>$msg.get("xe.blog.categories.new")<br/> <input type="text" name="newCategoryName" class="category-name-input" /></label><br/>#if("$!{request.parentCategory}" == "")<label>#* $msg.get("xe.blog.categories.parent")*# Subcategory of:<br/> <select name="newCategoryParent" id="blog_category_selectBox" class="category-add-input"> <option value="${defaultCategoryParent}" selected="selected">None</option> $!processedCategories.clear() #displayCategoriesHierarchy($tree 'option') </select> <br/></label>#else<input type="hidden" name="newCategoryParent" value="${escapetool.xml($request.parentCategory)}"/>#end<span class="buttonwrapper"><input class="button" type="submit" value="Add" /></span> <a href="$doc.getURL()">Cancel</a> </div></form> #end 219: ## 220: ## 221: ## 222: #** 223: * Displays a form for renaming a category. 224: *### 225: ## DO NOT CHANGE INDENTATION 226: #macro(renameCategoryForm)## 227: <form action="$doc.getURL()" method="post" class="category-rename-form"><div class='rename-category'>## 228: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 229: <input type="hidden" name="xaction" value="rename"/>## 230: <input type="hidden" name="category" value="${escapetool.xml($request.category)}"/>## 231: <label>$msg.get("xe.blog.categories.newName")<br/> <input type="text" name="newCategoryName" class="category-name-input" /></label><br/>## 232: <span class="buttonwrapper"><input class="button" type="submit" value="Rename" /></span> ## 233: <a href="$doc.getURL()">Cancel</a>## 234: </div></form>## 235: #end 236: ## 237: ## 238: ## 239: #** 240: * Displays a category as part of a category hierarchy, followed by links for editing and deleting 241: * this category, if the current user has the rights to perform these actions. 242: * 243: * @param name The full name of the document containing the category to be displayed. 244: * @param level The depth where this category is in the tree, used for proper indentation. 245: *### 246: ## DO NOT CHANGE INDENTATION 247: #macro(displayEditableCategory $name $level) 248: #getEntriesForCategory($name $discard $totalEntries) 249: #set($nameUrl = $escapetool.url($name)) 250: #foreach($i in [1..$level])*#end ## 251: <span class="blog-category-level"><span class="blog-category">## 252: <a href="$xwiki.getURL('Blog.CategoryRss', 'view', "xpage=plain&category=$nameUrl")" title="RSS"><img class="icon icon-manage" src="$xwiki.getSkinFile('icons/xwiki/rss-medium.png')" alt="[RSS]"/></a>## 253: [[#getCategoryName($xwiki.getDocument($name)) (% class="itemCount" %)($totalEntries)(%%)>>${name}]]</span> ## 254: <span class="blog-category-tools">## 255: #if($xwiki.hasAccessLevel('delete', $xcontext.user, $name) && ("$!{request.xaction}" != 'showRenameCategory' || "$!{request.category}" != $name))<a href="$xwiki.getURL('Blog.ManageCategories', 'view', "xaction=showRenameCategory&category=$nameUrl")" class="tool rename">#toolImage('pencil' 'Rename ')</a>#end ## 256: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $doc.fullName) && ("$!{request.xaction}" != "showAddCategory" || "$!{request.parentCategory}" != $name))<a href="$xwiki.getURL('Blog.ManageCategories', 'view', "xaction=showAddCategory&parentCategory=$nameUrl")" class="tool add-subcategory">#toolImage('chart_organisation_add' 'Add a subcategory ')</a> #end ## 257: #if($xwiki.hasAccessLevel('delete', $xcontext.user, $name)) <a href="$xwiki.getURL('Blog.ManageCategories', 'view', "xaction=delete&category=$nameUrl&form_token=$!{services.csrf.getToken()}")" class="tool delete">#toolImage('cross' 'Delete ')</a>#end ## 258: </span>## 259: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $doc.fullName) && "$!{request.xaction}" == "showRenameCategory" && "$!{request.category}" == $name) #renameCategoryForm() #end## 260: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $doc.fullName) && "$!{request.xaction}" == "showAddCategory" && "$!{request.parentCategory}" == $name) #addCategoryForm() #end## 261: </span> 262: #end 263: ## 264: ## 265: ## 266: #** 267: * Displays a category as part of a category hierarchy, wrapped in an <option> element, to 268: * be used in a select box. 269: * 270: * @param name The full name of the document containing the category to be displayed. 271: * @param level The depth where this category is in the tree, used for proper indentation. 272: *### 273: #macro(displayOptionCategory $name $level) 274: <option id="blog_category_${escapetool.xml($name)}_option" value="${escapetool.xml($name)}">#if($level > 1)#foreach($i in [2..$level]) #end#end#getCategoryName($xwiki.getDocument($name))</option> 275: #end 276: ## 277: ## 278: ## 279: #** 280: * Displays a category as part of a category hierarchy, wrapped in a link. 281: * 282: * @param name The full name of the document containing the category to be displayed. 283: * @param level The depth where this category is in the tree, used for proper indentation. 284: *### 285: #macro(displaySimpleCategory $name $level) 286: #getEntriesForCategory($name $discard $totalEntries) 287: #set($nameUrl = $escapetool.url($name)) 288: #foreach($i in [1..$level])*#end <span class="blog-category-level"><a href="$xwiki.getURL('Blog.CategoryRss', 'view', "xpage=plain&category=$nameUrl")" title="RSS">#toolImage('bullet_feed', '[RSS]')</a> <a href="$xwiki.getURL($name)">#getCategoryName($xwiki.getDocument($name))</a> <span class="itemCount"> ($totalEntries)</span></span> 289: #end 290: ## 291: ## 292: ## 293: #** 294: * Prints the name of a category, indicated by its document. 295: * The result is XML-escaped 296: * 297: * @param categoryDoc The document containing the category to be displayed. 298: *### 299: #macro(getCategoryName $categoryDoc) 300: ## Don't indent! 301: #set($result = "$!categoryDoc.getObject(${blogCategoryClassname}).getProperty('name').value.trim()")## 302: #if($result == '') 303: #set($result = $categoryDoc.name) 304: #end 305: $escapetool.xml($result)## 306: #end 307: ## 308: ## 309: ## 310: #** 311: * Prints the description of a category, indicated by its document. 312: * The result is XML-escaped 313: * 314: * @param categoryDoc The document containing the category to be displayed. 315: *### 316: #macro(getCategoryDescription $categoryDoc) 317: ## Don't indent! 318: $escapetool.xml($!categoryDoc.getObject(${blogCategoryClassname}).getProperty('description').value.trim())## 319: #end 320: ## 321: ## 322: ## 323: #** 324: * Generates a form for creating a new category. The form allows to enter the name of the new 325: * category, and select a parent category from the existing ones. 326: * 327: * @param tree The category hierarchy, a HashMap<String, List<String>> structure, where the key 328: * is the name of a category, and the value contains the names of all its subcategories. 329: * @todo When javascript is disabled, a link to "Manage categories" should be displayed instead. 330: * This "form" should be created from javascript. 331: *### 332: #macro(showCreateCategoryBoxWithForm $tree) 333: <form action="" method="post"> 334: #showCreateCategoryBox($tree) 335: </form> 336: #end 337: #** 338: * Generates a box for creating a new category. This allows to enter the name of the new 339: * category, and select a parent category from the existing ones. Note that this does not create 340: * a HTML form element, but requires one to be defined already as its ancestor. 341: * 342: * @param tree The category hierarchy HashMap<String, List<String>> structure, where the key 343: * is the name of a category, and the value contains the names of all its subcategories. 344: * @todo When javascript is disabled, a link to "Manage categories" should be displayed instead. 345: * This "form" should be created from javascript. 346: *### 347: #macro(showCreateCategoryBox $tree) 348: <div class='create-category'> 349: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 350: <input type="hidden" name="xaction" value="create"/> 351: <label>$msg.get("xe.blog.categories.new") <input type="text" name="newCategoryName" /></label> 352: <label>$msg.get("xe.blog.categories.parent") 353: <select name="newCategoryParent" id="blog_category_selectBox"> 354: <option value="${defaultCategoryParent}" selected="selected">None</option> 355: $!processedCategories.clear()## 356: #displayCategoriesHierarchy($tree 'option') 357: </select> 358: </label> 359: <span class="buttonwrapper"><input class="button" type="button" value="Add" id="blog_AddCategoryButton" /></span> 360: </div> 361: #end 362: ## 363: ## 364: ## 365: #macro(displayCategoryManagementTree $space $displayType) 366: <div class="blog-categories-list"> 367: #getCategoriesHierarchy("$!{space}" $tree) 368: #displayCategoriesHierarchy($tree $displayType) 369: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $doc.fullName)) 370: * <span class="blog-add-category-label"><a href="$doc.getURL('view', "xaction=showAddCategory&parentCategory=")">$msg.get("xe.blog.categories.addcategory")</a></span> 371: #if("$!{request.xaction}" == "showAddCategory" && "$!{request.parentCategory}" == "") #addCategoryForm() #end 372: #end 373: 374: 375: </div> 376: #end 377: ## 378: ## 379: ## 380: #** 381: * Deletes a category, moving all the subcategories to its parent and removing this category from 382: * all existing blog entries. 383: * 384: * @param category The full name of the document containing the category to be deleted. 385: *### 386: #macro(deleteCategory $category) 387: #set($categoryDoc = $xwiki.getDocument($category)) 388: #set($categoryParent = "$!categoryDoc.parent") 389: #if($categoryParent == '') 390: #set($categoryParent = "{$defaultCategoryParent}")) 391: #end 392: #set($parameterValues = ["$!{category}"]) 393: #set($query = ', BaseObject obj where ') 394: #if($space != '') 395: #set($query = "${query}doc.space = '${space}' and ") 396: #end 397: #set($query = "${query}obj.name = doc.fullName and obj.className = '${blogCategoryClassname}' and doc.fullName <> 'Blog.CategoryTemplate' and doc.parent = ? order by doc.name") 398: #foreach($item in $xwiki.searchDocuments($query, $parameterValues)) 399: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $item) && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 400: #set($subcategoryDoc = $xwiki.getDocument($item)) 401: $subcategoryDoc.setParent($categoryParent) 402: $subcategoryDoc.save($msg.get('xe.blog.manageCategories.comment.updatedParent'), true) 403: #end 404: #end 405: #set($query = ', BaseObject obj, DBStringListProperty categories join categories.list as category where ') 406: #if($space != '') 407: #set($query = "${query}doc.space = '${space}' and ") 408: #end 409: #set($query = "${query}obj.name = doc.fullName and obj.className = '${blogPostClassname}' and doc.fullName <> 'Blog.BlogPostTemplate' and categories.id.id = obj.id and categories.id.name = 'category' and category = ? order by doc.name") 410: #foreach($item in $xwiki.searchDocuments($query, $parameterValues)) 411: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $item) && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 412: #set($blogEntryDoc = $xwiki.getDocument($item)) 413: #set($discard = $blogEntryDoc.getObject(${blogPostClassname}).getProperty('category').value.remove($category)) 414: $blogEntryDoc.save($msg.get('xe.blog.manageCategories.comment.removedDeletedCategory'), true) 415: #end 416: #end 417: $categoryDoc.delete() 418: #end 419: ## 420: ## 421: ## 422: #** 423: * Renames a category, updating all the subcategories and all existing blog entries. 424: * 425: * @param category The full name of the document containing the category to be renamed. 426: * @param newCategoryName The new name of the category. 427: *### 428: #macro(renameCategory $category $newCategoryName) 429: #set($categoryDoc = $xwiki.getDocument($category)) 430: #set($newCategoryDoc = $xwiki.getDocument($newCategoryName)) 431: #set($parameterValues = ["$!{category}"]) 432: #set($query = ', BaseObject obj where ') 433: #set($query = "${query}obj.name = doc.fullName and obj.className = '${blogCategoryClassname}' and doc.fullName <> 'Blog.CategoryTemplate' and doc.parent = ? order by doc.name") 434: #foreach($item in $xwiki.searchDocuments($query, $parameterValues)) 435: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $item) && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 436: #set($subcategoryDoc = $xwiki.getDocument($item)) 437: $subcategoryDoc.setParent($newCategoryDoc.fullName) 438: $subcategoryDoc.save($msg.get('xe.blog.manageCategories.comment.updatedParent'), true) 439: #end 440: #end 441: #set($query = ', BaseObject obj, DBStringListProperty categories join categories.list as category where ') 442: #set($query = "${query}obj.name = doc.fullName and obj.className = '${blogPostClassname}' and doc.fullName <> 'Blog.BlogPostTemplate' and categories.id.id = obj.id and categories.id.name = 'category' and category = ? order by doc.name") 443: #foreach($item in $xwiki.searchDocuments($query, $parameterValues)) 444: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $item) && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 445: #set($blogEntryDoc = $xwiki.getDocument($item)) 446: #set($discard = $blogEntryDoc.getObject(${blogPostClassname}).getProperty('category').value.remove($category)) 447: #set($discard = $blogEntryDoc.getObject(${blogPostClassname}).getProperty('category').value.add($newCategoryDoc.fullName)) 448: $blogEntryDoc.save($msg.get('xe.blog.manageCategories.comment.updatedRenamedCategory'), true) 449: #end 450: #end 451: #if ($!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 452: $categoryDoc.getObject('Blog.CategoryClass').set('name', $newCategoryName) 453: $categoryDoc.save($msg.get('xe.blog.manageCategories.comment.updatedCategory'), true) 454: $categoryDoc.rename($newCategoryName) 455: #end 456: #end 457: {{/velocity}}
Recent Blog Posts
First blog post
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2009
(1)