Changes for page Profile of XWikiUserSheet

Last modified by Ludovic Dubost on 2024/07/22 15:51

From version 8.1
edited by Ludovic Dubost
on 2019/05/20 19:03
Change comment: Install extension [org.xwiki.platform:xwiki-platform-user-profile-ui/11.3]
To version 3.1
edited by Thomas Mortagne
on 2014/09/29 12:41
Change comment: Install extension [org.xwiki.platform:xwiki-platform-user-profile-ui-6.2]

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
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])
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])
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.ludovic
1 +xwiki:XWiki.ThomasMortagne
Content
... ... @@ -13,20 +13,12 @@
13 13  #if($isMyProfile || $hasAdmin)
14 14   #set($discard = $categories.add({'id':'preferences', 'sheet':'XWiki.XWikiUserPreferencesSheet', 'glyphicon': 'wrench'}))
15 15  #end
16 -#set($discard = $categories.add({'id':'groups', 'sheet':'XWiki.XWikiUserMembershipSheet', 'glyphicon': 'group'}))
17 17  ## TODO: add APIs to be able to display users watchlists to admins
18 18  #if($isMyProfile && $hasWatch)
19 - #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye'}))
18 + #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye-open'}))
20 20  #end
21 21  #if($isMyProfile)
22 - #if ("$!services.notification.watch" != '' || $hasWatch)
23 - #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'world'}))
24 - #end
25 - ## TODO: add an enhancement system instead
26 - #set($notificationsSheet = $services.model.createDocumentReference('', ['XWiki', 'Notifications', 'Code'], 'XWikiUserNotificationsSheet'))
27 - #if ($xwiki.exists($notificationsSheet))
28 - #set($discard = $categories.add({'id':'notifications', 'sheet':'XWiki.Notifications.Code.XWikiUserNotificationsSheet', 'glyphicon': 'bell'}))
29 - #end
21 + #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'globe'}))
30 30  #end
31 31  #set($userWikiSheet = 'WikiManager.UserWikiSheet')
32 32  #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet))
... ... @@ -76,13 +76,10 @@
76 76   (((
77 77   #if($request.xpage == 'edituser')
78 78   {{html clean="false"}}
79 - #resizedUserAvatar($doc.fullName 180)
71 + #resizedUserAvatar($doc.fullName 170)
80 80   {{/html}}
81 81   #else
82 - ## By specifying the image width we enable server side resizing. The width value we use is greater than the
83 - ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the
84 - ## image in the available space).
85 - {{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"/}}
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"/}}
86 86   #end
87 87   )))
88 88   ##########
... ... @@ -117,5 +117,10 @@
117 117   <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" />
118 118   #end
119 119   <div class="clearfloats">&nbsp;</div>
109 + #if($request.get('xpage'))
110 + <script type="text/javascript">
111 + document.fire('lightbox:userprofile:loaded');
112 + </script>
113 + #end
120 120  {{/html}}
121 121  {{/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(container) {
5 + init : function() {
6 6   this.crtCategory = '';
7 - this.tabsContainer = (container || $('body')).down('#user-vertical-menu');
7 + this.tabsContainer = $('user-vertical-menu');
8 8   if (!this.tabsContainer) {
9 9   return;
10 10   }
... ... @@ -11,29 +11,17 @@
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, true);
14 + this.switchTab(tabElement.id);
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');
21 21   }.bind(this));
22 22   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);
34 34   },
35 35  
36 - switchTab : function(tab, pushHistory) {
24 + switchTab : function(tab) {
37 37   var tabName = tab.substring(14); // 14 = len('vertical-menu-')
38 38   $("user-page-content").select("div.user-page-pane").each(function(pane){
39 39   pane.addClassName('hidden');
... ... @@ -44,11 +44,7 @@
44 44   });
45 45   $(tab).addClassName('current');
46 46   this.updateCategoryFields(tab);
47 - if (pushHistory) {
48 - this.updateURL(tabName);
49 - }
50 50   document.fire('xwiki:profile:switchedCategory', {'category' : tab});
51 - document.fire('xwiki:dom:refresh');
52 52   },
53 53  
54 54   updateCategoryFields : function (category) {
... ... @@ -59,17 +59,6 @@
59 59   this.updateField('category', category);
60 60   },
61 61  
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 -
73 73   updateField : function (fieldName, value) {
74 74   var element = $$('input[name=' + fieldName + ']');
75 75   if (element && element.size() > 0) {
... ... @@ -91,14 +91,12 @@
91 91   }
92 92  });
93 93  
94 -var init = function(event) {
95 - ((event && event.memo.elements) || [$('body')]).each(function(element) {
96 - XWiki.userprofile.init(element);
97 - });
67 +var init = function() {
68 + XWiki.userprofile.init();
98 98   return true;
99 99  };
100 100  (XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init);
101 -document.observe('xwiki:dom:updated', init);
72 +document.observe('lightbox:userprofile:loaded', init);
102 102  // End XWiki augmentation.
103 103  return XWiki;
104 104  }(XWiki || {}));
XWiki.StyleSheetExtension[0]
Code
... ... @@ -6,10 +6,6 @@
6 6   width: 13em;
7 7  }
8 8  
9 -#avatar p {
10 - text-align: center;
11 -}
12 -
13 13  #avatar img {
14 14   border: 1px solid $theme.borderColor;
15 15   border-radius: 5px 5px 5px 5px;