Changes for page Profile of XWikiUserSheet
Last modified by Ludovic Dubost on 2024/07/22 15:51
From version 3.1
edited by Thomas Mortagne
on 2014/09/29 12:41
on 2014/09/29 12:41
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-user-profile-ui-6.2]
To 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]
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. ThomasMortagne1 +xwiki:XWiki.ludovic - Content
-
... ... @@ -15,10 +15,17 @@ 15 15 #end 16 16 ## TODO: add APIs to be able to display users watchlists to admins 17 17 #if($isMyProfile && $hasWatch) 18 - #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye -open'}))18 + #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye'})) 19 19 #end 20 20 #if($isMyProfile) 21 - #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'globe'})) 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 22 22 #end 23 23 #set($userWikiSheet = 'WikiManager.UserWikiSheet') 24 24 #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet)) ... ... @@ -68,10 +68,13 @@ 68 68 ((( 69 69 #if($request.xpage == 'edituser') 70 70 {{html clean="false"}} 71 - #resizedUserAvatar($doc.fullName 1 70)78 + #resizedUserAvatar($doc.fullName 180) 72 72 {{/html}} 73 73 #else 74 - {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($isMyProfile) savemode="direct" #end defaultValue="XWiki.XWikiUserSheet@noavatar.png" width="120" alternateText="$xwiki.getUserName($doc.fullName, false)" buttontext="$services.localization.render('platform.core.profile.changePhoto')" displayImage="true" filter="png,jpg,gif"/}} 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). 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"/}} 75 75 #end 76 76 ))) 77 77 ##########
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -11,17 +11,29 @@ 11 11 this.tabsContainer.select('.category-tab').each(function (tabElement) { 12 12 tabElement.observe('click', function(event) { 13 13 Event.stop(event); 14 - this.switchTab(tabElement.id); 14 + this.switchTab(tabElement.id, true); 15 15 }.bindAsEventListener(this)); 16 16 }.bind(this)); 17 17 this.tabsContainer.select('.category-tab.current').each(function (activeTab) { 18 18 this.updateCategoryFields(activeTab.id); 19 19 document.fire('xwiki:profile:switchedCategory', {'category' : activeTab.id}); 20 + document.fire('xwiki:dom:refresh'); 20 20 }.bind(this)); 21 21 this.handleCancelAction(); 23 + 24 + // History navigation through our pushed states. 25 + window.addEventListener('popstate', function(event) { 26 + if (event.state && event.state.category) { 27 + this.switchTab('vertical-menu-' + event.state.category); 28 + } 29 + }.bindAsEventListener(this)); 30 + // Store the initial history state so we can go back. 31 + history.replaceState({ 32 + category: window.location.search.toQueryParams().category || 'profile' 33 + }, document.title, document.location.href); 22 22 }, 23 23 24 - switchTab : function(tab) { 36 + switchTab : function(tab, pushHistory) { 25 25 var tabName = tab.substring(14); // 14 = len('vertical-menu-') 26 26 $("user-page-content").select("div.user-page-pane").each(function(pane){ 27 27 pane.addClassName('hidden'); ... ... @@ -32,7 +32,11 @@ 32 32 }); 33 33 $(tab).addClassName('current'); 34 34 this.updateCategoryFields(tab); 47 + if (pushHistory) { 48 + this.updateURL(tabName); 49 + } 35 35 document.fire('xwiki:profile:switchedCategory', {'category' : tab}); 51 + document.fire('xwiki:dom:refresh'); 36 36 }, 37 37 38 38 updateCategoryFields : function (category) { ... ... @@ -43,6 +43,17 @@ 43 43 this.updateField('category', category); 44 44 }, 45 45 62 + updateURL : function (category) { 63 + if (history.pushState) { 64 + var params = window.location.search.toQueryParams(); 65 + params.category = category; 66 + newQueryString = Object.toQueryString(params); 67 + 68 + var newURL = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + newQueryString; 69 + window.history.pushState({category : category}, '', newURL); 70 + } 71 + }, 72 + 46 46 updateField : function (fieldName, value) { 47 47 var element = $$('input[name=' + fieldName + ']'); 48 48 if (element && element.size() > 0) {
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -6,6 +6,10 @@ 6 6 width: 13em; 7 7 } 8 8 9 +#avatar p { 10 + text-align: center; 11 +} 12 + 9 9 #avatar img { 10 10 border: 1px solid $theme.borderColor; 11 11 border-radius: 5px 5px 5px 5px;