General Actions:
Log-in
Wiki:
CC09
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
AddCategory
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to the C&C 09 Doctoral Consortium Wiki
»
The Wiki Blog
»
Add a new category
Wiki source code of
Add a new category
Last modified by
Administrator
on 2008/11/09 20:21
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
#set($space = "$!request.space") #if("$!request.name" != '') #if($space != "") #set($newCategoryDoc = $xwiki.getDocument("${space}.${request.name}")) #else #set($newCategoryDoc = $xwiki.getDocument("${request.name}")) #end #if($newCategoryDoc.isNew()) #set($newCategoryObj = $newCategoryDoc.newObject("Blog.CategoryClass")) $newCategoryObj.set("name", $request.name) $newCategoryObj.set("description", $request.description) $newCategoryDoc.setParent($request.parent) #set($content = "#includ") #set($content = "${content}eForm('Blog.CategorySheet')") $newCategoryDoc.setContent($content) $newCategoryDoc.save() #info("The category [$newCategoryDoc.name>$newCategoryDoc.fullName] has been created.") #else $response.setStatus(409) #warning("The category [$newCategoryDoc.name>$newCategoryDoc.fullName] already exists.") #end #end <form action="" method="post"> <div> #if($space != "") <input type="hidden" name="space" value="$space"/> #end <dl> <dt><label for="name">Name:</label></dt> <dd><input type="text" name="name" id="name" style="width: 95%"/></dd> #if("$!parentCategory" == "") <dt><label for="parent">Parent category:</label></dt> #set($sql = ", BaseObject obj where ") #if($space != "") #set($sql = "${sql}doc.space = '${space}' and ") #end #set($sql = "${sql}obj.name = doc.fullName and obj.className = 'Blog.CategoryClass' and doc.fullName <> 'Blog.CategoryTemplate' order by doc.name") <dd><select name="parent" id="parent" style="width: 95%"> <option selected="selected" value="Blog.Categories">None</option> #foreach($category in $xwiki.searchDocuments($sql)) <option value="$category">$xwiki.getDocument($category).display('name', 'view')</option> #end </select></dd> #else <dt><input type="hidden" name="parent" value="$parentCategory"/></dt> #end <dt><label for="description">Description:</label></dt> <dd><textarea name="description" id="description" rows="2" cols="20" style="width: 95%"></textarea></dd> </dl> <span class="buttonwrapper"><input type="submit" value="Add" class="button"/></span> </div> </form>
Recent Blog Posts
Problems with the Bibliography System
Welcome to the Wiki
First blog post
Blog Entries
Blog Archive
2009
(3)
Quick Links
Wiki Dashboard
Document Index
Blog
Sandbox
My Recent Modifications
recentComments