Wiki source code of Add a new category

Last modified by Admin on 2008/11/10 04:21

Show last authors
1 #set($space = "$!request.space")
2 #if("$!request.name" != '')
3 #if($space != "")
4 #set($newCategoryDoc = $xwiki.getDocument("${space}.${request.name}"))
5 #else
6 #set($newCategoryDoc = $xwiki.getDocument("${request.name}"))
7 #end
8 #if($newCategoryDoc.isNew())
9 #set($newCategoryObj = $newCategoryDoc.newObject("Blog.CategoryClass"))
10 $newCategoryObj.set("name", $request.name)
11 $newCategoryObj.set("description", $request.description)
12 $newCategoryDoc.setParent($request.parent)
13 #set($content = "#includ")
14 #set($content = "${content}eForm('Blog.CategorySheet')")
15 $newCategoryDoc.setContent($content)
16 $newCategoryDoc.save()
17 #set($catLink = "[${newCategoryDoc.name}>${newCategoryDoc.fullName}]")
18 #info($msg.get("xe.blog.category.created", [$catLink]))
19 #else
20 $response.setStatus(409)
21 #set($catLink = "[${newCategoryDoc.name}>${newCategoryDoc.fullName}]")
22 #warning($msg.get("xe.blog.category.exists", [$catLink]))
23 #end
24 #end
25 <form action="" method="post">
26 <div>
27 #if($space != "")
28 <input type="hidden" name="space" value="$space"/>
29 #end
30 <dl>
31 <dt><label for="name">$msg.get("xe.blog.categories.name")</label></dt>
32 <dd><input type="text" name="name" id="name" style="width: 95%"/></dd>
33 #if("$!parentCategory" == "")
34 <dt><label for="parent">$msg.get("xe.blog.categories.parentcategory")</label></dt>
35 #set($sql = ", BaseObject obj where ")
36 #if($space != "")
37 #set($sql = "${sql}doc.space = '${space}' and ")
38 #end
39 #set($sql = "${sql}obj.name = doc.fullName and obj.className = 'Blog.CategoryClass' and doc.fullName <> 'Blog.CategoryTemplate' order by doc.name")
40 <dd><select name="parent" id="parent" style="width: 95%">
41 <option selected="selected" value="Blog.Categories">None</option>
42 #foreach($category in $xwiki.searchDocuments($sql))
43 <option value="$category">$xwiki.getDocument($category).display('name', 'view')</option>
44 #end
45 </select></dd>
46 #else
47 <dt><input type="hidden" name="parent" value="$parentCategory"/></dt>
48 #end
49 <dt><label for="description">$msg.get("xe.blog.categories.description")</label></dt>
50 <dd><textarea name="description" id="description" rows="2" cols="20" style="width: 95%"></textarea></dd>
51 </dl>
52 <span class="buttonwrapper"><input type="submit" value="$msg.get("xe.blog.categories.add")" class="button"/></span>
53 </div>
54 </form>

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.RecentPostsPanel]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.UnpublishedPanel]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.BlogCode]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.CategoriesCode]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.
Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.CategoriesPanel]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [psiu:Blog.ArchivePanel]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.