Version 5.1 by Ludovic Dubost on 2017/02/07 23:57

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)
18 #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye-open'}))
Ludovic Dubost 2.1 19 #end
20 #if($isMyProfile)
Thomas Mortagne 3.1 21 #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'globe'}))
Ludovic Dubost 2.1 22 #end
Thomas Mortagne 3.1 23 #set($userWikiSheet = 'WikiManager.UserWikiSheet')
24 #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet))
Ludovic Dubost 2.1 25 #set($discard = $categories.add({
Thomas Mortagne 3.1 26 'id': 'wikis',
27 'name': $services.localization.render('platform.wiki.menu.userwikis'),
28 'sheet': $userWikiSheet,
29 'glyphicon': 'list'
Ludovic Dubost 2.1 30 }))
31 #end
32 #if($isMyProfile && $hasDashboard)
Thomas Mortagne 3.1 33 #set($discard = $categories.add({'id':'dashboard', 'sheet':'Dashboard.XWikiUserDashboardSheet', 'glyphicon': 'th'}))
Ludovic Dubost 2.1 34 #end
35 #########################
36 ## Current category
37 #########################
38 #set($currentCategory = "$!request.category")
39 #if($currentCategory == "")
Thomas Mortagne 3.1 40 #set($currentCategory = $categories[0].get('id'))
Ludovic Dubost 2.1 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"}}
Ludovic Dubost 5.1 71 #resizedUserAvatar($doc.fullName 180)
Ludovic Dubost 2.1 72 {{/html}}
73 #else
Ludovic Dubost 5.1 74 ## By specifying the image width we enable server side resizing. The width value we use is greater than the
75 ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the
76 ## image in the available space).
77 {{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,gif"/}}
Ludovic Dubost 2.1 78 #end
79 )))
80 ##########
81 ## Menu
82 ##########
83 (% id="user-vertical-menu" %)
84 (((
85 #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'})
86 )))
87 )))
88 #########################
89 ## Display the page content
90 #########################
91 (% id="user-page-content" %)
92 (((
93 #foreach($category in $userMenu)
94 #foreach($subcategory in $category.get('children'))
95 #set($tabKey = $subcategory.get('id'))
96 (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %)
97 (((
98 #set($tabInclude = $subcategory.get('sheet'))
99 {{include reference="${tabInclude}" /}}
100 )))
101 #end
102 #end
103 )))
104 #########################
105 ## END
106 #########################
107 {{html clean="false"}}
108 #if($xcontext.action == 'edit' || $xcontext.action == 'inline')
Thomas Mortagne 3.1 109 <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" />
Ludovic Dubost 2.1 110 #end
111 <div class="clearfloats">&nbsp;</div>
112 #if($request.get('xpage'))
113 <script type="text/javascript">
114 document.fire('lightbox:userprofile:loaded');
115 </script>
116 #end
117 {{/html}}
118 {{/velocity}}