Version 7.1 by Ludovic Dubost on 2018/12/09 12:24

Hide last authors
Ludovic Dubost 2.1 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 = [])
Thomas Mortagne 3.1 11 #set($discard = $categories.add({'id':'profile', 'sheet':'XWiki.XWikiUserProfileSheet', 'glyphicon': 'user'}))
Ludovic Dubost 2.1 12 #set($isMyProfile = ($services.model.resolveDocument($xcontext.user) == $doc.documentReference))
13 #if($isMyProfile || $hasAdmin)
Thomas Mortagne 3.1 14 #set($discard = $categories.add({'id':'preferences', 'sheet':'XWiki.XWikiUserPreferencesSheet', 'glyphicon': 'wrench'}))
Ludovic Dubost 2.1 15 #end
Ludovic Dubost 7.1 16 #set($discard = $categories.add({'id':'groups', 'sheet':'XWiki.XWikiUserMembershipSheet', 'glyphicon': 'group'}))
Ludovic Dubost 2.1 17 ## TODO: add APIs to be able to display users watchlists to admins
Thomas Mortagne 3.1 18 #if($isMyProfile && $hasWatch)
Ludovic Dubost 6.1 19 #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye'}))
Ludovic Dubost 2.1 20 #end
21 #if($isMyProfile)
Ludovic Dubost 6.1 22 #if ("$!services.notification.watch" != '' || $hasWatch)
23 #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'world'}))
24 #end
25 ## TODO: add an enhancement system instead
26 #set($notificationsSheet = $services.model.createDocumentReference('', ['XWiki', 'Notifications', 'Code'], 'XWikiUserNotificationsSheet'))
27 #if ($xwiki.exists($notificationsSheet))
28 #set($discard = $categories.add({'id':'notifications', 'sheet':'XWiki.Notifications.Code.XWikiUserNotificationsSheet', 'glyphicon': 'bell'}))
29 #end
Ludovic Dubost 2.1 30 #end
Thomas Mortagne 3.1 31 #set($userWikiSheet = 'WikiManager.UserWikiSheet')
32 #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet))
Ludovic Dubost 2.1 33 #set($discard = $categories.add({
Thomas Mortagne 3.1 34 'id': 'wikis',
35 'name': $services.localization.render('platform.wiki.menu.userwikis'),
36 'sheet': $userWikiSheet,
37 'glyphicon': 'list'
Ludovic Dubost 2.1 38 }))
39 #end
40 #if($isMyProfile && $hasDashboard)
Thomas Mortagne 3.1 41 #set($discard = $categories.add({'id':'dashboard', 'sheet':'Dashboard.XWikiUserDashboardSheet', 'glyphicon': 'th'}))
Ludovic Dubost 2.1 42 #end
43 #########################
44 ## Current category
45 #########################
46 #set($currentCategory = "$!request.category")
47 #if($currentCategory == "")
Thomas Mortagne 3.1 48 #set($currentCategory = $categories[0].get('id'))
Ludovic Dubost 2.1 49 #end
50 #########################
51 ## Creating vertical menu
52 #########################
53 #set($userMenu = [{
54 'id' : 'settings',
55 'cssClass' : 'user-menu-title',
56 'children' : $categories
57 }
58 ])
59 ## Setting automaticaly url & css fields of each category
60 #foreach($category in $userMenu)
61 #foreach($subcategory in $category.get('children'))
62 #set($id = $subcategory.get('id'))
63 #set($discard = $subcategory.put('url', "?category=${id}"))
64 #set($discard = $subcategory.put('cssClass', "user-menu-$id category-tab"))
65 #end
66 #end
67 #########################
68 ## Display the left menu
69 #########################
70 (% id="user-menu-col" %)
71 (((
72 ############
73 ## Avatar
74 ############
75 (% id="avatar" %)
76 (((
77 #if($request.xpage == 'edituser')
78 {{html clean="false"}}
Ludovic Dubost 5.1 79 #resizedUserAvatar($doc.fullName 180)
Ludovic Dubost 2.1 80 {{/html}}
81 #else
Ludovic Dubost 5.1 82 ## By specifying the image width we enable server side resizing. The width value we use is greater than the
83 ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the
84 ## image in the available space).
Ludovic Dubost 6.1 85 {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($isMyProfile) savemode="direct" #end defaultValue="XWiki.XWikiUserSheet@noavatar.png" width="180" alternateText="$xwiki.getUserName($doc.fullName, false)" buttontext="$services.localization.render('platform.core.profile.changePhoto')" displayImage="true" filter="png,jpg,jpeg,gif"/}}
Ludovic Dubost 2.1 86 #end
87 )))
88 ##########
89 ## Menu
90 ##########
91 (% id="user-vertical-menu" %)
92 (((
93 #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'})
94 )))
95 )))
96 #########################
97 ## Display the page content
98 #########################
99 (% id="user-page-content" %)
100 (((
101 #foreach($category in $userMenu)
102 #foreach($subcategory in $category.get('children'))
103 #set($tabKey = $subcategory.get('id'))
104 (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %)
105 (((
106 #set($tabInclude = $subcategory.get('sheet'))
107 {{include reference="${tabInclude}" /}}
108 )))
109 #end
110 #end
111 )))
112 #########################
113 ## END
114 #########################
115 {{html clean="false"}}
116 #if($xcontext.action == 'edit' || $xcontext.action == 'inline')
Thomas Mortagne 3.1 117 <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" />
Ludovic Dubost 2.1 118 #end
119 <div class="clearfloats">&nbsp;</div>
120 {{/html}}
121 {{/velocity}}