Version 6.1 by Ludovic Dubost on 2018/07/01 11:40

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