Changes for page Profile of XWikiUserSheet
Last modified by Ludovic Dubost on 2024/07/22 15:51
From version 6.1
edited by Ludovic Dubost
on 2018/07/01 11:40
on 2018/07/01 11:40
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-user-profile-ui/10.5]
To version 10.1
edited by Ludovic Dubost
on 2020/12/03 18:41
on 2020/12/03 18:41
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-user-profile-ui/12.8]
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 -#set($userName="$!doc.getValue('first_name') $!doc.getValue('last_name')")#if($userName==' ')#set($userName=$doc.name)#{end}$services.localization.render('platform.core.profile.title', [$userName]) 1 +#set($userName="$!doc.getValue('first_name') $!doc.getValue('last_name')")#if($userName==' ')#set($userName=$doc.documentReference.name)#{end}$services.localization.render('platform.core.profile.title', [$userName]) - Content
-
... ... @@ -8,37 +8,21 @@ 8 8 ## Setting categories 9 9 ######################### 10 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'})) 19 -#end 20 -#if($isMyProfile) 21 - #if ("$!services.notification.watch" != '' || $hasWatch) 22 - #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'world'})) 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 + #if(!$uix.parameters.containsKey('isActive') || $uix.parameters.get('isActive') != 'false') 15 + #if (!$uix.parameters.containsKey('id')) 16 + ## when no id is explicitly provided, we use the id of the UIX. 17 + #set ($discard = $uix.parameters.put('id', $uix.id)) 18 + #end 19 + #if ($uix.parameters.containsKey('icon')) 20 + #set ($discard = $uix.parameters.put('glyphicon', $uix.parameters.get('icon'))) 21 + #end 22 + #set ($discard = $uix.parameters.put('uix', $uix)) 23 + #set($discard = $categories.add($uix.parameters)) 23 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 29 29 #end 30 -#set($userWikiSheet = 'WikiManager.UserWikiSheet') 31 -#if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet)) 32 - #set($discard = $categories.add({ 33 - 'id': 'wikis', 34 - 'name': $services.localization.render('platform.wiki.menu.userwikis'), 35 - 'sheet': $userWikiSheet, 36 - 'glyphicon': 'list' 37 - })) 38 -#end 39 -#if($isMyProfile && $hasDashboard) 40 - #set($discard = $categories.add({'id':'dashboard', 'sheet':'Dashboard.XWikiUserDashboardSheet', 'glyphicon': 'th'})) 41 -#end 42 42 ######################### 43 43 ## Current category 44 44 ######################### ... ... @@ -81,6 +81,7 @@ 81 81 ## By specifying the image width we enable server side resizing. The width value we use is greater than the 82 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 83 ## image in the available space). 68 + #set($isMyProfile = ($services.model.resolveDocument($xcontext.user) == $doc.documentReference)) 84 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"/}} 85 85 #end 86 86 ))) ... ... @@ -102,8 +102,7 @@ 102 102 #set($tabKey = $subcategory.get('id')) 103 103 (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %) 104 104 ((( 105 - #set($tabInclude = $subcategory.get('sheet')) 106 - {{include reference="${tabInclude}" /}} 90 + {{html}}$services.rendering.render($subcategory.uix.execute(), 'html/5.0'){{/html}} 107 107 ))) 108 108 #end 109 109 #end ... ... @@ -116,10 +116,5 @@ 116 116 <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" /> 117 117 #end 118 118 <div class="clearfloats"> </div> 119 - #if($request.get('xpage')) 120 - <script type="text/javascript"> 121 - document.fire('lightbox:userprofile:loaded'); 122 - </script> 123 - #end 124 124 {{/html}} 125 125 {{/velocity}}
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -2,9 +2,9 @@ 2 2 // Start XWiki augmentation. 3 3 Object.extend(XWiki, { 4 4 userprofile : { 5 - init : function() { 5 + init : function(container) { 6 6 this.crtCategory = ''; 7 - this.tabsContainer = $('user-vertical-menu'); 7 + this.tabsContainer = (container || $('body')).down('#user-vertical-menu'); 8 8 if (!this.tabsContainer) { 9 9 return; 10 10 } ... ... @@ -63,7 +63,7 @@ 63 63 if (history.pushState) { 64 64 var params = window.location.search.toQueryParams(); 65 65 params.category = category; 66 - newQueryString = Object.toQueryString(params); 66 + var newQueryString = Object.toQueryString(params); 67 67 68 68 var newURL = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + newQueryString; 69 69 window.history.pushState({category : category}, '', newURL); ... ... @@ -91,12 +91,14 @@ 91 91 } 92 92 }); 93 93 94 -var init = function() { 95 - XWiki.userprofile.init(); 94 +var init = function(event) { 95 + ((event && event.memo.elements) || [$('body')]).each(function(element) { 96 + XWiki.userprofile.init(element); 97 + }); 96 96 return true; 97 97 }; 98 98 (XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init); 99 -document.observe(' lightbox:userprofile:loaded', init);101 +document.observe('xwiki:dom:updated', init); 100 100 // End XWiki augmentation. 101 101 return XWiki; 102 102 }(XWiki || {}));
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -126,7 +126,12 @@ 126 126 .userInfo img { 127 127 max-width: 100%; 128 128 } 129 - 129 + 130 +.userInfo h2 { 131 + font-size: larger; 132 + font-weight: bolder; 133 +} 134 + 130 130 div.userInfo input[type="text"], div.userInfo input[type="password"], div.userInfo textarea, div.userInfo select, div.userPreferences select { 131 131 width: 100%; 132 132 }