From 1757eec23d0afbcf03cc1a9d27761b46df42a229 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 12 May 2012 12:25:04 +0200 Subject: [PATCH 1/2] display user informations on the bottom of the page --- scm-webapp/src/main/webapp/index.html | 2 +- .../src/main/webapp/resources/js/i18n/de.js | 6 ++- .../src/main/webapp/resources/js/sonia.scm.js | 48 ++++++++++++++++++- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index e2055a8b7c..8539f8585f 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -197,7 +197,7 @@ © SCM Manager
- ${version} + ${version}
diff --git a/scm-webapp/src/main/webapp/resources/js/i18n/de.js b/scm-webapp/src/main/webapp/resources/js/i18n/de.js index 5f44ca6d51..f05606ec87 100644 --- a/scm-webapp/src/main/webapp/resources/js/i18n/de.js +++ b/scm-webapp/src/main/webapp/resources/js/i18n/de.js @@ -570,7 +570,11 @@ if (Sonia.scm.Main){ errorNoPermissionsMessage: 'Sie haben nicht genügend Rechte um diese Aktion auszuführen.', errorNotFoundTitle: 'Nicht gefunden', - errorNotFoundMessage: 'Die Ressource konnte nicht gefunden werden.' + errorNotFoundMessage: 'Die Ressource konnte nicht gefunden werden.', + + loggedInTextTemplate: 'angemeldet als {state.user.name} - ', + userInfoMailText: 'E-Mail', + userInfoGroupsText: 'Gruppen' }); } diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js index d64bff87a0..2b43f92286 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js @@ -70,6 +70,10 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, { errorNotFoundTitle: 'Not found', errorNotFoundMessage: 'The resource could not be found.', + + loggedInTextTemplate: 'logged in as {state.user.name} - ', + userInfoMailText: 'Mail', + userInfoGroupsText: 'Groups', mainTabPanel: null, @@ -526,6 +530,44 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, { getMainTabPanel: function(){ return this.mainTabPanel; + }, + + renderUserInformations: function(state){ + if ( state.user.name != 'anonymous' ){ + var tpl = new Ext.XTemplate(this.loggedInTextTemplate); + tpl.overwrite(Ext.get('scm-userinfo'), state); + var text = ''; + if (state.user.mail){ + text += this.userInfoMailText + ': ' + state.user.mail + '
'; + } + if (state.groups && state.groups.length > 0){ + text += this.userInfoGroupsText + ': ' + this.getGroups(state.groups) + '
'; + } + + Ext.QuickTips.register({ + target : 'scm-userinfo-tip', + title : state.user.displayName, + text : text, + enabled : true + }); + } + }, + + getGroups: function(groups){ + var out = ''; + var s = groups.length; + for ( var i=0; i Date: Sat, 12 May 2012 17:19:49 +0200 Subject: [PATCH 2/2] close branch issue-146