Version 4.1 by Ludovic Dubost on 2015/09/01 11:46
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity}} | ||
2 | ######################### | ||
3 | ## CSS & Javascripts | ||
4 | ######################### | ||
5 | #set($discard = $xwiki.ssx.use("XWiki.XWikiUserSheet")) | ||
6 | #set($discard = $xwiki.jsx.use("XWiki.XWikiUserSheet")) | ||
7 | ######################### | ||
8 | ## Setting categories | ||
9 | ######################### | ||
10 | #set($categories = []) | ||
11 | #set($discard = $categories.add({'id':'profile', 'sheet':'XWiki.XWikiUserProfileSheet', 'glyphicon': 'user'})) | ||
12 | #set($isMyProfile = ($services.model.resolveDocument($xcontext.user) == $doc.documentReference)) | ||
13 | #if($isMyProfile || $hasAdmin) | ||
14 | #set($discard = $categories.add({'id':'preferences', 'sheet':'XWiki.XWikiUserPreferencesSheet', 'glyphicon': 'wrench'})) | ||
15 | #end | ||
16 | ## TODO: add APIs to be able to display users watchlists to admins | ||
17 | #if($isMyProfile && $hasWatch) | ||
18 | #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye-open'})) | ||
19 | #end | ||
20 | #if($isMyProfile) | ||
21 | #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'globe'})) | ||
22 | #end | ||
23 | #set($userWikiSheet = 'WikiManager.UserWikiSheet') | ||
24 | #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet)) | ||
25 | #set($discard = $categories.add({ | ||
26 | 'id': 'wikis', | ||
27 | 'name': $services.localization.render('platform.wiki.menu.userwikis'), | ||
28 | 'sheet': $userWikiSheet, | ||
29 | 'glyphicon': 'list' | ||
30 | })) | ||
31 | #end | ||
32 | #if($isMyProfile && $hasDashboard) | ||
33 | #set($discard = $categories.add({'id':'dashboard', 'sheet':'Dashboard.XWikiUserDashboardSheet', 'glyphicon': 'th'})) | ||
34 | #end | ||
35 | ######################### | ||
36 | ## Current category | ||
37 | ######################### | ||
38 | #set($currentCategory = "$!request.category") | ||
39 | #if($currentCategory == "") | ||
40 | #set($currentCategory = $categories[0].get('id')) | ||
41 | #end | ||
42 | ######################### | ||
43 | ## Creating vertical menu | ||
44 | ######################### | ||
45 | #set($userMenu = [{ | ||
46 | 'id' : 'settings', | ||
47 | 'cssClass' : 'user-menu-title', | ||
48 | 'children' : $categories | ||
49 | } | ||
50 | ]) | ||
51 | ## Setting automaticaly url & css fields of each category | ||
52 | #foreach($category in $userMenu) | ||
53 | #foreach($subcategory in $category.get('children')) | ||
54 | #set($id = $subcategory.get('id')) | ||
55 | #set($discard = $subcategory.put('url', "?category=${id}")) | ||
56 | #set($discard = $subcategory.put('cssClass', "user-menu-$id category-tab")) | ||
57 | #end | ||
58 | #end | ||
59 | ######################### | ||
60 | ## Display the left menu | ||
61 | ######################### | ||
62 | (% id="user-menu-col" %) | ||
63 | ((( | ||
64 | ############ | ||
65 | ## Avatar | ||
66 | ############ | ||
67 | (% id="avatar" %) | ||
68 | ((( | ||
69 | #if($request.xpage == 'edituser') | ||
70 | {{html clean="false"}} | ||
71 | #resizedUserAvatar($doc.fullName 170) | ||
72 | {{/html}} | ||
73 | #else | ||
74 | {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($isMyProfile) savemode="direct" #end defaultValue="XWiki.XWikiUserSheet@noavatar.png" width="120" alternateText="$xwiki.getUserName($doc.fullName, false)" buttontext="$services.localization.render('platform.core.profile.changePhoto')" displayImage="true" filter="png,jpg,gif"/}} | ||
75 | #end | ||
76 | ))) | ||
77 | ########## | ||
78 | ## Menu | ||
79 | ########## | ||
80 | (% id="user-vertical-menu" %) | ||
81 | ((( | ||
82 | #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'}) | ||
83 | ))) | ||
84 | ))) | ||
85 | ######################### | ||
86 | ## Display the page content | ||
87 | ######################### | ||
88 | (% id="user-page-content" %) | ||
89 | ((( | ||
90 | #foreach($category in $userMenu) | ||
91 | #foreach($subcategory in $category.get('children')) | ||
92 | #set($tabKey = $subcategory.get('id')) | ||
93 | (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %) | ||
94 | ((( | ||
95 | #set($tabInclude = $subcategory.get('sheet')) | ||
96 | {{include reference="${tabInclude}" /}} | ||
97 | ))) | ||
98 | #end | ||
99 | #end | ||
100 | ))) | ||
101 | ######################### | ||
102 | ## END | ||
103 | ######################### | ||
104 | {{html clean="false"}} | ||
105 | #if($xcontext.action == 'edit' || $xcontext.action == 'inline') | ||
106 | <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" /> | ||
107 | #end | ||
108 | <div class="clearfloats"> </div> | ||
109 | #if($request.get('xpage')) | ||
110 | <script type="text/javascript"> | ||
111 | document.fire('lightbox:userprofile:loaded'); | ||
112 | </script> | ||
113 | #end | ||
114 | {{/html}} | ||
115 | {{/velocity}} |