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
Hide line numbers
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: #info("The category [$newCategoryDoc.name>$newCategoryDoc.fullName] has been created.") 18: #else 19: $response.setStatus(409) 20: #warning("The category [$newCategoryDoc.name>$newCategoryDoc.fullName] already exists.") 21: #end 22: #end 23: <form action="" method="post"> 24: <div> 25: #if($space != "") 26: <input type="hidden" name="space" value="$space"/> 27: #end 28: <dl> 29: <dt><label for="name">Name:</label></dt> 30: <dd><input type="text" name="name" id="name" style="width: 95%"/></dd> 31: #if("$!parentCategory" == "") 32: <dt><label for="parent">Parent category:</label></dt> 33: #set($sql = ", BaseObject obj where ") 34: #if($space != "") 35: #set($sql = "${sql}doc.space = '${space}' and ") 36: #end 37: #set($sql = "${sql}obj.name = doc.fullName and obj.className = 'Blog.CategoryClass' and doc.fullName <> 'Blog.CategoryTemplate' order by doc.name") 38: <dd><select name="parent" id="parent" style="width: 95%"> 39: <option selected="selected" value="Blog.Categories">None</option> 40: #foreach($category in $xwiki.searchDocuments($sql)) 41: <option value="$category">$xwiki.getDocument($category).display('name', 'view')</option> 42: #end 43: </select></dd> 44: #else 45: <dt><input type="hidden" name="parent" value="$parentCategory"/></dt> 46: #end 47: <dt><label for="description">Description:</label></dt> 48: <dd><textarea name="description" id="description" rows="2" cols="20" style="width: 95%"></textarea></dd> 49: </dl> 50: <span class="buttonwrapper"><input type="submit" value="Add" class="button"/></span> 51: </div> 52: </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