Version 2.1 by XWikiGuest on 2026/10/03 21:16
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 | |||
| 12 | ## load the user menu from the 'org.xwiki.plaftorm.user.profile.menu' UIXP. | ||
| 13 | #foreach ($uix in $services.uix.getExtensions('org.xwiki.plaftorm.user.profile.menu', {'sortByParameter': 'priority'})) | ||
| 14 | ## We only call this once | ||
| 15 | #set ($uixParameters = $collectiontool.map) | ||
| 16 | #set ($discard = $uixParameters.putAll($uix.parameters)) | ||
| 17 | #if(!$uixParameters.containsKey('isActive') || $uixParameters.get('isActive') != 'false') | ||
| 18 | #if (!$uixParameters.containsKey('id')) | ||
| 19 | ## when no id is explicitly provided, we use the id of the UIX. | ||
| 20 | #set ($discard = $uixParameters.put('id', $uix.id)) | ||
| 21 | #end | ||
| 22 | #if ($uixParameters.containsKey('icon')) | ||
| 23 | #set ($discard = $uixParameters.put('glyphicon', $uixParameters.get('icon'))) | ||
| 24 | #end | ||
| 25 | #set ($discard = $uixParameters.put('uix', $uix)) | ||
| 26 | #set($discard = $categories.add($uixParameters)) | ||
| 27 | #end | ||
| 28 | #end | ||
| 29 | ######################### | ||
| 30 | ## Current category | ||
| 31 | ######################### | ||
| 32 | #set($currentCategory = "$!request.category") | ||
| 33 | #if($currentCategory == "") | ||
| 34 | #set($currentCategory = $categories[0].get('id')) | ||
| 35 | #end | ||
| 36 | ######################### | ||
| 37 | ## Creating vertical menu | ||
| 38 | ######################### | ||
| 39 | #set($userMenu = [{ | ||
| 40 | 'id' : 'settings', | ||
| 41 | 'cssClass' : 'user-menu-title', | ||
| 42 | 'children' : $categories | ||
| 43 | } | ||
| 44 | ]) | ||
| 45 | ## Setting automaticaly url & css fields of each category | ||
| 46 | #foreach($category in $userMenu) | ||
| 47 | #foreach($subcategory in $category.get('children')) | ||
| 48 | #set($id = $subcategory.get('id')) | ||
| 49 | #set($discard = $subcategory.put('url', "?category=${id}")) | ||
| 50 | #set($discard = $subcategory.put('cssClass', "user-menu-$id category-tab")) | ||
| 51 | #end | ||
| 52 | #end | ||
| 53 | ######################### | ||
| 54 | ## Display the left menu | ||
| 55 | ######################### | ||
| 56 | (% id="user-menu-col" %) | ||
| 57 | ((( | ||
| 58 | ############ | ||
| 59 | ## Avatar | ||
| 60 | ############ | ||
| 61 | (% id="avatar" %) | ||
| 62 | ((( | ||
| 63 | #if($request.xpage == 'edituser') | ||
| 64 | {{html clean="false"}} | ||
| 65 | #resizedUserAvatar($doc.fullName 180) | ||
| 66 | {{/html}} | ||
| 67 | #else | ||
| 68 | ## By specifying the image width we enable server side resizing. The width value we use is greater than the | ||
| 69 | ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the | ||
| 70 | ## image in the available space). | ||
| 71 | {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($hasEdit) 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"/}} | ||
| 72 | #end | ||
| 73 | ))) | ||
| 74 | ########## | ||
| 75 | ## Menu | ||
| 76 | ########## | ||
| 77 | (% id="user-vertical-menu" %) | ||
| 78 | ((( | ||
| 79 | #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'}) | ||
| 80 | ))) | ||
| 81 | ))) | ||
| 82 | ######################### | ||
| 83 | ## Display the page content | ||
| 84 | ######################### | ||
| 85 | (% id="user-page-content" %) | ||
| 86 | ((( | ||
| 87 | #foreach($category in $userMenu) | ||
| 88 | #foreach($subcategory in $category.get('children')) | ||
| 89 | #set($tabKey = $subcategory.get('id')) | ||
| 90 | (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %) | ||
| 91 | ((( | ||
| 92 | {{html}}$services.rendering.render($subcategory.uix.execute(), 'html/5.0'){{/html}} | ||
| 93 | ))) | ||
| 94 | #end | ||
| 95 | #end | ||
| 96 | ))) | ||
| 97 | ######################### | ||
| 98 | ## END | ||
| 99 | ######################### | ||
| 100 | {{html clean="false"}} | ||
| 101 | #if($xcontext.action == 'edit' || $xcontext.action == 'inline') | ||
| 102 | <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" /> | ||
| 103 | #end | ||
| 104 | <div class="clearfloats"> </div> | ||
| 105 | {{/html}} | ||
| 106 | {{/velocity}} |