Changes for page Dashboard
Last modified by Ludovic Dubost on 2018/12/09 12:28
From version 4.1
edited by Ludovic Dubost
on 2015/09/01 11:47
on 2015/09/01 11:47
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-dashboard-ui-7.1]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (5 modified, 1 added, 2 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,34 +1,1 @@ 1 -{{velocity}} 2 -#set($displayDashboard = true) 3 -#if ($xcontext.user != 'XWiki.XWikiGuest') 4 - ## get the preferences of the current user 5 - #set($userDbPrefs = $xwiki.getDocument($xcontext.user).getObject('Dashboard.UserDashboardPreferencesClass')) 6 - #if ($userDbPrefs) 7 - ## if the object exists, use the object value 8 - #set($prefValue = $userDbPrefs.getProperty('displayOnMainPage').value) 9 - #else 10 - ## if the object does not exist, use the default value of the property in the class 11 - #set($userPrefClass = $xwiki.getClass('Dashboard.UserDashboardPreferencesClass')) 12 - #set($displayOnMainPageProp = $userPrefClass.get('displayOnMainPage')) 13 - #set($prefValue = $displayOnMainPageProp.getProperty('defaultValue').value) 14 - #end 15 - #if ($prefValue && $prefValue > 0) 16 - #set($dashboardObjects = $xwiki.getDocument($xcontext.user).getObjects('XWiki.GadgetClass')) 17 - #if ($dashboardObjects.size() > 0) 18 - {{dashboard source = "$xcontext.user" /}} 19 - #set($displayDashboard = false) 20 - #else 21 - #set($editDashboardLabel = $services.localization.render('platform.dashboard.wiki.personal.empty.edit')) 22 - #set($editDashboardUrl = $xwiki.getURL($xcontext.user, 'inline', 'category=dashboard')) 23 - {{info}}{{html}}$services.localization.render('platform.dashboard.wiki.personal.empty', ["<a href='${editDashboardUrl}'>$editDashboardLabel</a>"]){{/html}}{{/info}} 24 - #set($displayDashboard = true) 25 - #end 26 - #end 27 -#end 28 - 29 -#if($displayDashboard) 30 - {{dashboard/}} 31 -#end 32 - 33 -{{/velocity}} 34 - 1 +{{dashboard/}}
- XWiki.DocumentSheetBinding[0]
-
- XWiki.GadgetClass[0]
-
- position
-
... ... @@ -1,1 +1,1 @@ 1 -1, 21 +1,3
- XWiki.GadgetClass[1]
-
- position
-
... ... @@ -1,1 +1,1 @@ 1 -1, 31 +1,4
- XWiki.GadgetClass[2]
-
- position
-
... ... @@ -1,1 +1,1 @@ 1 -2, 21 +2,1
- XWiki.GadgetClass[3]
-
- content
-
... ... @@ -1,1 +1,54 @@ 1 -{{display reference="Main.Welcome"/}} 1 +{{velocity}} 2 +#set ($currentWiki = $xcontext.database) 3 +#set ($WorkspaceManager = $services.workspace) 4 +## 5 +## TODO: use a dependency check macro. 6 +## 7 +#set ($workspace = $WorkspaceManager.getWorkspace($currentWiki)) 8 +#if (!$workspace) 9 + {{error}}{{translation key="platform.workspace.wikiNotWorkspace"/}}{{/error}} 10 +#else 11 + #set($wikiDescriptor = $workspace.wikiDescriptor) 12 + #set($displayName = $wikiDescriptor.getValue('wikiprettyname')) 13 + #if ("$!displayName" == '') 14 + #set($displayName = $currentWiki) 15 + #end 16 + $services.localization.render('platform.workspace.gadgetWelcomeToWorkspace', [$displayName]) 17 + #set ($workspaceDescription = $wikiDescriptor.description) 18 + #if ("$!workspaceDescription" != '') 19 + 20 + $workspaceDescription 21 + #end 22 + ## User's rights 23 + #set ($currentUser = "#if($xcontext.isMainWiki())${xcontext.mainWikiName}:${xcontext.user}#{else}${xcontext.user}#end") 24 + #set ($hasOwner = ($wikiDescriptor.owner.equals($currentUser))) 25 + #if (!$isGuest) 26 + #if ($hasOwner) 27 + 28 + {{translation key="platform.workspace.currentUserIsOwner"/}} 29 + #elseif ($hasAdmin) 30 + 31 + {{translation key="platform.workspace.currentUserIsAdministrator"/}} 32 + #end 33 + #end 34 + 35 + ## Join/Leave 36 + #if ($isGuest) 37 + {{translation key="platform.workspace.joinNeedToLogIn"/}} 38 + #else 39 + #set ($workspaceGroupDocument = $workspace.groupDocument) 40 + #set ($groupsClass = "$currentWiki:XWiki.XWikiGroups") 41 + #set ($currentUserGroupObject = $workspaceGroupDocument.getObject($groupsClass, 'member', $currentUser)) 42 + #set ($hasJoin = ("$!currentUserGroupObject" == '')) 43 + #if ($hasJoin) 44 + #set ($joinPageReference = $services.model.createDocumentReference(${xcontext.mainWikiName}, 'WorkspaceManager', 'JoinWorkspaceCode')) 45 + #set ($joinUrl = $xwiki.getURL($joinPageReference, 'view', "workspaceId=${currentWiki}&workspaceName=${displayName}")) 46 + {{translation key="platform.workspace.currentUserNotMember"/}} $services.localization.render('platform.workspace.currentUserCanJoin', $joinUrl) 47 + #elseif (!$hasOwner) 48 + #set ($leavePageReference = $services.model.createDocumentReference(${xcontext.mainWikiName}, 'WorkspaceManager', 'LeaveWorkspaceCode')) 49 + #set ($leaveUrl = $xwiki.getURL($leavePageReference, 'view', "workspaceId=${currentWiki}&workspaceName=${displayName}")) 50 + {{translation key="platform.workspace.currentUserIsMember"/}} $services.localization.render('platform.workspace.currentUserCanLeave', $leaveUrl) 51 + #end 52 + #end 53 +#end 54 +{{/velocity}} - position
-
... ... @@ -1,1 +1,1 @@ 1 -1, 1 +1,1 - title
-
... ... @@ -1,1 +1,1 @@ 1 -$services.localization.render('platform. dashboard.wiki.welcome')1 +$services.localization.render('platform.workspace.gadgetWorkspaceInformationLabel')
- XWiki.GadgetClass[4]
-
- content
-
... ... @@ -1,8 +1,31 @@ 1 1 {{velocity}} 2 -#if (!$isGuest) 3 - {{messageSender/}} 4 -#else 5 - #set ($queryString = "xredirect=$escapetool.url($xwiki.requestURL)") 6 - (%class='noitems'%)$services.localization.render('xe.activity.messages.error.loginToSendMessage', ["path:$doc.getURL('login', $queryString)"]) 2 +## Max number of contributors to display. 3 +#set ($MAX_CONTRIBUTORS = 5) 4 +## We fetch a bit more contributors than needed to include some users that might be ignored. 5 +#set ($FETCHED_CONTRIBUTORS = $MAX_CONTRIBUTORS + 5) 6 +## Whether to display the main global admin (xwiki:XWiki.Admin) or not. This is useful because a lot of initial actions (wiki creation, import, etc.) are attributed to this used and it should not be counted. 7 +#set ($DISPLAY_GLOBAL_ADMIN = true) 8 +## 9 +#set ($contributors = $xcontext.xWiki.store.search("select ase.user from ActivityEventImpl ase GROUP BY ase.user ORDER BY count(*) DESC", $FETCHED_CONTRIBUTORS, 0, $xcontext.context)) 10 +#set ($validContributors = 0) 11 +#foreach ($contributor in $contributors) 12 + ## It seems that we can have empty users in the table. 13 + ## Ignore superadmin since he 'should not exist'. 14 + ## Ignore the workspace template admin since it's a side-effect of bug http://jira.xwiki.org/jira/browse/XWIKI-6261 15 + ## Ignore a 'ghost' local admin for workspaces since it should no longer exist. 16 + ## Ignore guest users. 17 + #if ("$!contributor" != '' && !$contributor.endsWith('superadmin') && "$!contributor" != 'workspacetemplate:XWiki.Admin' && 18 + ( $DISPLAY_GLOBAL_ADMIN || "$!contributor" != 'xwiki:XWiki.Admin' ) && 19 + ( $xcontext.mainWiki || "$!contributor" != 'XWiki.Admin' ) && 20 + ( "$!contributor" != 'XWiki.XWikiGuest' ) 21 + ) 22 + #set ($validContributors = $validContributors + 1) 23 + 1. [[$xwiki.getUserName($!{contributor}, false)>>$!{contributor}]] 24 + #end 25 + #if ($validContributors == $MAX_CONTRIBUTORS) 26 + #break 27 + #end 7 7 #end 29 + 30 +$services.localization.render('platform.workspace.gadgetTopActiveUsersAllMembers') 8 8 {{/velocity}} - position
-
... ... @@ -1,1 +1,1 @@ 1 - 2,11 +1,2 - title
-
... ... @@ -1,1 +1,1 @@ 1 -$services.localization.render('platform. dashboard.wiki.messageSender')1 +$services.localization.render('platform.workspace.gadgetTopActiveUsersLabel')
- XWiki.UIExtensionClass[0]
-
- Extension Point ID
-
... ... @@ -1,1 +1,0 @@ 1 -org.xwiki.platform.panels.Applications - Extension ID
-
... ... @@ -1,1 +1,0 @@ 1 -platform.panels.dashboardApplication - Extension Parameters
-
... ... @@ -1,3 +1,0 @@ 1 -label=$services.localization.render('xe.panels.quicklinks.dashboard') 2 -target=Dashboard.WebHome 3 -icon=icon:application_view_tile - Extension Scope
-
... ... @@ -1,1 +1,0 @@ 1 -wiki
- XWiki.EditModeClass[0]
-
- Default Edit Mode
-
... ... @@ -1,0 +1,1 @@ 1 +inline