Toggle navigation
Go
English
Log-in
Register
KEN
Go to Wiki
Wiki Index
Document Index
User Index
CAPHCCode
Go to Space
Document Index
Spaces
Wiki source code of
Spaces
More actions
Content
Comments
Information
Hide line numbers
1: {{velocity}} 2: ## 3: ## List spaces wihtin the wiki. 4: ## 5: $xwiki.ssx.use("Main.Spaces")## 6: #macro(spacelist $spacesList $displayCategories) 7: {{html wiki="true"}} 8: <ul class="xlist"> 9: ## 10: ## List spaces. 11: ## 12: #foreach($space in $spacesList) 13: ## Display space only if the user has view right on space home and if the space is not blacklisted. 14: ## $blacklistedSpaces is set in xwikivars.vm 15: #if($xwiki.hasAccessLevel("view", "${space}.WebHome") && !$blacklistedSpaces.contains($space)) 16: <li class="xitem xunderline xhighlight space"> 17: <div class="xitemcontainer"> 18: <div class="spSpaceName"> 19: #if($displayCategories) 20: #set($categoryFullName = "${space}.WebHome") 21: #set($categoryDoc = $xwiki.getDocument($categoryFullName)) 22: #set($categoryTitle = $categoryDoc.getTranslatedDocument().title) 23: #if($categoryTitle != "") 24: [[$categoryTitle>>${space}.WebHome]] 25: #else 26: [[${space}>>${space}.WebHome]] 27: #end 28: #else 29: [[${space}>>${space}.WebHome]] 30: #end 31: </div> 32: <div class="xshowonhover spSpaceActions"> 33: ## Link to the space index. 34: <a href="$xwiki.getURL("Main.SpaceIndex", "view", "space=${space}")" title="$msg.get("xe.spaces.action.index")"> 35: <img src="$xwiki.getSkinFile("icons/silk/book_open.gif")" alt="Space index icon"/> 36: </a> 37: ## If the user has admin right on the space display links to administration and delete. 38: #if($xwiki.hasAccessLevel("admin", "${space}.XWikiPreferences")) 39: <a href="$xwiki.getURL("${space}.WebPreferences", "admin")" title="$msg.get("xe.spaces.action.admin")"> 40: <img src="$xwiki.getSkinFile("icons/silk/cog.gif")" alt="Administrate space icon"/> 41: </a> 42: ## <a href="#" onclick="confirm('ALL THE PAGES WITHIN THE SPACE “${space}” WILL BE DELETED, are you sure that you want to continue ?'); this.href='$spaceListDoc.getURL("view", "deleteSpace=${space}&xredirect=$doc.getExternalURL()")'" title="$msg.get("xe.spaces.action.delete")"> 43: ## <img src="$xwiki.getSkinFile("icons/silk/cross.gif")" alt="Delete space icon" /> 44: ##</a> 45: #end 46: </div> 47: <div class="xspacer"> </div> 48: </div> 49: </li> 50: #end 51: #end 52: ## 53: ## Space creation. 54: ## 55: #if($xwiki.hasAdminRights()) 56: #if($displayCategories) 57: <li id="spSpaceCreateItem" class="xitem space"> 58: <div class="xitemcontainer"> 59: <div id="spSpaceCreateLabel" class="spSpaceName"> 60: <a href="$xwiki.getURL("Admin.CreateCategory")">Create a new category</a> 61: </div> 62: <div class="spacer"> </div> 63: <div class="spacer"> </div> 64: </div> 65: </li> 66: #else 67: <li id="spSpaceCreateItem" class="xitem space"> 68: <div class="xitemcontainer"> 69: <div id="spSpaceCreateLabel" class="spSpaceName"><a href="#" onclick="toggleClass($('spSpaceCreateForm'), 'hidden'); return false;">$msg.get("xe.spaces.createspace")</a></div> 70: <div class="spacer"> </div> 71: <div id="spSpaceCreateForm" class="hidden"> 72: <form method="post" action="$doc.getURL("view", "xpage=create")"> 73: <div> 74: <input name="tocreate" type="hidden" value="space" /> 75: #set($newSpaceName = $msg.get("xe.spaces.createspace.defaultname")) 76: <input type="text" name="title" value="$newSpaceName" class="panelinput" style="margin:auto;" onfocus="if(this.value=='$newSpaceName') this.value=''" onblur="if(this.value=='') this.value='$newSpaceName'" /> 77: <input type="submit" value="$msg.get("xe.spaces.createspace.submit")" /> 78: </div> 79: </form> 80: </div> 81: <div class="spacer"> </div> 82: </div> 83: </li> 84: #end 85: #end 86: </ul> 87: {{/html}} 88: #end 89: ## 90: ## List of spaces in this wiki. 91: ## This page allow to display spaces within this wiki and to delete any space. 92: ## Only wiki administrators are allowed to delete spaces. 93: ## 94: ## Optional HTTP parameter : 95: ## deleteSpace name of a space to delete. 96: ## 97: ## Delete space if requested. 98: ## 99: #set($spaceToDelete = "$!request.getParameter('deleteSpace')") 100: #if("$!spaceToDelete" != "" && $xwiki.hasAdminRights()) 101: #foreach ($page in $xwiki.getSpaceDocsName($spaceToDelete)) 102: #set($discard = $xwiki.getDocument("${spaceToDelete}.${page}").delete()) 103: #end 104: {{info}}Space ”${spaceToDelete}“ deleted.{{/info}} 105: #set($xredirect = "$!request.getParameter('xredirect')") 106: ## Redirect to the previous page if requested. 107: #if("$!xredirect" != "") 108: $response.sendRedirect($xredirect) 109: #end 110: #end 111: #set($spaceList = $xwiki.getSpaces()) 112: #set($categorySpaces = $util.arrayList) 113: #set($otherSpaces = $util.arrayList) 114: #foreach($space in $spaceList) 115: #set($spaceDocFullName = $space + ".WebHome") 116: #set($spaceDoc = $xwiki.getDocument($spaceDocFullName)) 117: #if($spaceDoc.getObjectNumbers("CAPHCCode.CategoryClass")>0) 118: #set($ok = $categorySpaces.add($space)) 119: #else 120: #if(!$hasAdmin && ($space == "CAPHCCode" || $space == "BBCode" || $space == "Development")) #else #set($ok = $otherSpaces.add($space)) #end 121: #end 122: #end 123: ## Get this very doc, useful when it is included from another one. 124: #set($spaceListDoc = $xwiki.getDocument("Main.Spaces")) 125: = Categories = 126: #spacelist($categorySpaces true) 127: 128: = Spaces = 129: #spacelist($otherSpaces false) 130: 131: 132: {{/velocity}}
Applications
Admin Tools
CAPHC Presents!
User Index
More applications
Create your own!