Code source wiki de Spaces
Modifié par Administrator le 2009/01/30 19:18
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | ## | ||
2 | ## List spaces wihtin the wiki. | ||
3 | ## | ||
4 | $xwiki.ssx.use("Main.Spaces") | ||
5 | ## | ||
6 | ## List of spaces in this wiki. | ||
7 | ## This page allow to display spaces within this wiki and to delete any space. | ||
8 | ## Only wiki administrators are allowed to delete spaces. | ||
9 | ## | ||
10 | ## Optional HTTP parameter : | ||
11 | ## deleteSpace name of a space to delete. | ||
12 | ## | ||
13 | ## Delete space if requested. | ||
14 | ## | ||
15 | #set($spaceToDelete = "$!request.getParameter('deleteSpace')") | ||
16 | #if("$!spaceToDelete" != "" && $xwiki.hasAdminRights()) | ||
17 | #foreach ($page in $xwiki.getSpaceDocsName($spaceToDelete)) | ||
18 | #set($discard = $xwiki.getDocument("${spaceToDelete}.${page}").delete()) | ||
19 | #end | ||
20 | #info("Space ”${spaceToDelete}“ deleted.") | ||
21 | #set($xredirect = "$!request.getParameter('xredirect')") | ||
22 | ## Redirect to the previous page if requested. | ||
23 | #if("$!xredirect" != "") | ||
24 | $response.sendRedirect($xredirect) | ||
25 | #end | ||
26 | #end | ||
27 | #set($spaceList = $xwiki.getSpaces()) | ||
28 | ## Get this very doc, useful when it is included from another one. | ||
29 | #set($spaceListDoc = $xwiki.getDocument("Main.Spaces")) | ||
30 | <ul class="xlist"> | ||
31 | ## | ||
32 | ## List spaces. | ||
33 | ## | ||
34 | #foreach($space in $spaceList) | ||
35 | ## Display space only if the user has view right on space home and if the space is not blacklisted. | ||
36 | ## $blacklistedSpaces is set in xwikivars.vm | ||
37 | #if($xwiki.hasAccessLevel("view", "${space}.WebHome") && !$blacklistedSpaces.contains($space)) | ||
38 | <li class="xitem xunderline xhighlight space"> | ||
39 | <div class="xitemcontainer"> | ||
40 | <div class="spSpaceName">[${space}>${space}.WebHome]</div> | ||
41 | <div class="xshowonhover spSpaceActions"> | ||
42 | ## Link to the space index. | ||
43 | <a href="$xwiki.getURL("Main.SpaceIndex", "view", "space=${space}")" title="$msg.get("xe.spaces.action.index")"> | ||
44 | <img src="$xwiki.getSkinFile("icons/silk/book_open.gif")" alt="Space index icon"/> | ||
45 | </a> | ||
46 | ## If the user has admin right on the space display links to administration and delete. | ||
47 | #if($xwiki.hasAccessLevel("admin", "${space}.XWikiPreferences")) | ||
48 | <a href="$xwiki.getURL("${space}.WebPreferences", "admin")" title="$msg.get("xe.spaces.action.admin")"> | ||
49 | <img src="$xwiki.getSkinFile("icons/silk/cog.gif")" alt="Administrate space icon"/> | ||
50 | </a> | ||
51 | ## <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")"> | ||
52 | ## <img src="$xwiki.getSkinFile("icons/silk/cross.gif")" alt="Delete space icon" /> | ||
53 | ##</a> | ||
54 | #end | ||
55 | </div> | ||
56 | <div class="xspacer"> </div> | ||
57 | </div> | ||
58 | </li> | ||
59 | #end | ||
60 | #end | ||
61 | ## | ||
62 | ## Space creation. | ||
63 | ## | ||
64 | #if($xwiki.hasAdminRights()) | ||
65 | <li id="spSpaceCreateItem" class="xitem space"> | ||
66 | <div class="xitemcontainer"> | ||
67 | <div id="spSpaceCreateLabel" class="spSpaceName"><a href="#" onclick="toggleClass($('spSpaceCreateForm'), 'hidden'); return false;">$msg.get("xe.spaces.createspace")</a></div> | ||
68 | <div class="spacer"> </div> | ||
69 | <div id="spSpaceCreateForm" class="hidden"> | ||
70 | <form method="post" action="$doc.getURL("view", "xpage=create")"> | ||
71 | <div> | ||
72 | <input name="tocreate" type="hidden" value="space" /> | ||
73 | #set($newSpaceName = $msg.get("xe.spaces.createspace.defaultname")) | ||
74 | <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'" /> | ||
75 | <input type="submit" value="$msg.get("xe.spaces.createspace.submit")" /> | ||
76 | </div> | ||
77 | </form> | ||
78 | </div> | ||
79 | <div class="spacer"> </div> | ||
80 | </div> | ||
81 | </li> | ||
82 | #end | ||
83 | </ul> |