Wiki source code of ForumsHomePage
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity}} | ||
2 | #set ($discard=$xwiki.ssx.use('ForumCode.StyleSheetExtension')) | ||
3 | ## only allow users that have edit right on this page to create a forum. This is a way to restrict the users which can create a forum. | ||
4 | #set ($forumName = $request.forumName) | ||
5 | #if ("$!{forumName}" != '' && $hasEdit) | ||
6 | #set ($newForumDocName = "Forums_${forumName}.WebHome") | ||
7 | #if ($newForumDocName.length > 230) | ||
8 | #set ($newForumDocName = $newForumDocName.substring(0, 230)) | ||
9 | #end | ||
10 | #set ($newForumDoc = $xwiki.getDocument($newForumDocName)) | ||
11 | #if (!$newForumDoc.isNew()) | ||
12 | {{warning}}$services.localization.render('forum.create.alreadyexists', [$forumName, $newForumDocName]) | ||
13 | #else | ||
14 | ## Add encode uri to handle special chars in the title | ||
15 | #set ($forumTitle = $escapetool.url($forumName)) | ||
16 | ## | ||
17 | $response.sendRedirect($newForumDoc.getURL('edit', "title=${forumTitle}&parent=Forums.WebHome&template=ForumCode.ForumTemplate")) | ||
18 | #end | ||
19 | #else | ||
20 | #set ($discard = $xwiki.ssfx.use('uicomponents/widgets/userpicker/userPicker.css')) | ||
21 | #set ($discard = $xwiki.ssfx.use('uicomponents/pagination/pagination.css', 'true')) | ||
22 | #set ($discard = $xwiki.jsx.use('ForumCode.ForumsHomePage', {'language' : $xcontext.language, 'derfer' : false})) | ||
23 | {{html clean='false'}} | ||
24 | <div class="row all-forums-home-title"> | ||
25 | <div class="document-info col-xs-12 col-md-7"> | ||
26 | <h3 class="forums-title">$services.localization.render('conversations.forum.all')</h3> | ||
27 | </div> | ||
28 | ## only allow users that have edit right on this page to create a forum. This is a way to restrict the users which can create a forum. | ||
29 | #if ($hasEdit) | ||
30 | #set($discard = $xwiki.ssx.use('ForumCode.ForumsHomePage')) | ||
31 | <div class="document-info col-xs-12 col-md-5 pull-right" id="actionBox"> | ||
32 | <div class="pull-right buttonwrapper"> | ||
33 | <a class="btn btn-success hasIcon add button" id="addForum" href="#AddNewEntry"> | ||
34 | $!services.icon.renderHTML('add') $services.localization.render('conversations.forum.add') | ||
35 | </a> | ||
36 | </div> | ||
37 | #set ($entryDoc = $services.model.createDocumentReference($doc.wiki, ['Forums', '__entryName__'], 'WebHome')) | ||
38 | #set ($queryString = 'editor=inline&title=__entryName__&template=ForumCode.ForumTemplate&parent=Forums.WebHome') | ||
39 | <input type="hidden" value="$escapetool.xml($xwiki.getURL($entryDoc, 'edit', $queryString))" /> | ||
40 | </div> | ||
41 | #end | ||
42 | <div class="clearfloats"></div> | ||
43 | </div> | ||
44 | {{/html}} | ||
45 | ## | ||
46 | #set($columns = ['doc.title', 'doc.date', 'doc.creator', 'actions']) | ||
47 | #set($columnsProperties = { | ||
48 | 'doc.title' : {'type' : 'text', 'link' : 'view'}, | ||
49 | 'doc.creator' : {'type' : 'text', 'html' : true}, | ||
50 | 'actions' : {'html' : true, 'sortable' : false} | ||
51 | }) | ||
52 | #set($options = { | ||
53 | 'className' : 'ForumCode.ForumClass', | ||
54 | 'translationPrefix' : 'conversations.', | ||
55 | 'resultPage' : 'ForumCode.GetForumsJson', | ||
56 | 'rowCount' : 10 | ||
57 | }) | ||
58 | #livetable('forums' $columns $columnsProperties $options) | ||
59 | #end | ||
60 | #set($docextras = []) | ||
61 | {{/velocity}} |