Code source wiki de Manage blogs on this wiki

Modifié par Administrator le 2008/11/26 07:22

Afficher les derniers auteurs
1 #includeMacros("Blog.BlogCode")
2 #if($hasAdmin)
3 ##
4 ##
5 ## List existing blogs.
6 ## TODO: Display the number of articles in each blog
7 ## TODO: Provide some management links: delete, edit title, configure...
8 ##
9 1 Existing blogs
10
11 #foreach($item in $xwiki.wrapDocs($xwiki.searchDocuments(", BaseObject obj where obj.name = doc.fullName and obj.className = '$blogClassname'")))
12 #getBlogTitle($item $title)
13 #if($title != "")
14 * [$title>$item.fullName]
15 #else
16 * [$item.displayTitle>$item.fullName]
17 #end
18 #end
19 ##
20 ##
21 ## New blog
22 ##
23 1 Create a new blog
24
25 #set($title = "$!request.blogTitle")
26 #if($title != '')
27 #set($space = "$!request.blogSpace")
28 #if($space == '')
29 #warning('No space provided. Please enter a valid space where the blog should be created.')
30 #else
31 #if("$!request.blogType" == 'main')
32 #set($blogDocName = "${space}.WebHome")
33 #else
34 #set($blogDocName = "${space}.Blog")
35 #end
36 #set($title = $util.encodeURI($title))
37 #set($parent = 'Main.WebHome')
38 $response.sendRedirect($xwiki.getURL($blogDocName, 'save', "parent=${parent}&title=${title}&template=${blogTemplate}&${blogClassname}_0_title=${title}"))
39 #end
40 #end
41 ##
42 ## Show the form
43 <form action="${xwiki.getURL('Blog.Management')}" id="newBlog" method="post">
44 <div>
45 <dl>
46 <dt><label for="blogSpace">Space:</label></dt>
47 <dd><input type="text" name="blogSpace" id="blogSpace" value=""/></dd>
48 <dt><label for="blogTitle">Title:</label></dt>
49 <dd><input type="text" name="blogTitle" id="blogTitle" value="Blog title"/></dd>
50 <dt><label for="blogType">Blog type:</label></dt>
51 <dd><select name="blogType" id="blogType">
52 <option value="inner" selected="selected">blog inside an existing space</option>
53 <option value="main">blog as the main content of a space</option>
54 </select></dd>
55 </dl>
56 <input type="submit" value="Create"/>
57 </div>
58 </form>
59 #else ## !hasAdmin
60 #xwikimessageboxstart($msg.get("error") $msg.get("notallowed"))
61 #xwikimessageboxend()
62 #end
#getBlogDocument($space $blogDoc)