mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
display user informations on the bottom of the page
This commit is contained in:
@@ -197,7 +197,7 @@
|
|||||||
© <a target="_blank" href="http://bitbucket.org/sdorra/scm-manager">SCM Manager</a>
|
© <a target="_blank" href="http://bitbucket.org/sdorra/scm-manager">SCM Manager</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-side">
|
<div class="right-side">
|
||||||
${version}
|
<span id="scm-userinfo"></span> ${version}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -570,7 +570,11 @@ if (Sonia.scm.Main){
|
|||||||
errorNoPermissionsMessage: 'Sie haben nicht genügend Rechte um diese Aktion auszuführen.',
|
errorNoPermissionsMessage: 'Sie haben nicht genügend Rechte um diese Aktion auszuführen.',
|
||||||
|
|
||||||
errorNotFoundTitle: 'Nicht gefunden',
|
errorNotFoundTitle: 'Nicht gefunden',
|
||||||
errorNotFoundMessage: 'Die Ressource konnte nicht gefunden werden.'
|
errorNotFoundMessage: 'Die Ressource konnte nicht gefunden werden.',
|
||||||
|
|
||||||
|
loggedInTextTemplate: 'angemeldet als <a id="scm-userinfo-tip">{state.user.name}</a> - ',
|
||||||
|
userInfoMailText: 'E-Mail',
|
||||||
|
userInfoGroupsText: 'Gruppen'
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
errorNotFoundTitle: 'Not found',
|
errorNotFoundTitle: 'Not found',
|
||||||
errorNotFoundMessage: 'The resource could not be found.',
|
errorNotFoundMessage: 'The resource could not be found.',
|
||||||
|
|
||||||
|
loggedInTextTemplate: 'logged in as <a id="scm-userinfo-tip">{state.user.name}</a> - ',
|
||||||
|
userInfoMailText: 'Mail',
|
||||||
|
userInfoGroupsText: 'Groups',
|
||||||
|
|
||||||
mainTabPanel: null,
|
mainTabPanel: null,
|
||||||
|
|
||||||
infoPanels: [],
|
infoPanels: [],
|
||||||
@@ -526,6 +530,44 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
|
|
||||||
getMainTabPanel: function(){
|
getMainTabPanel: function(){
|
||||||
return this.mainTabPanel;
|
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 + '<br />';
|
||||||
|
}
|
||||||
|
if (state.groups && state.groups.length > 0){
|
||||||
|
text += this.userInfoGroupsText + ': ' + this.getGroups(state.groups) + '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
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<s; i++ ){
|
||||||
|
out += groups[i];
|
||||||
|
if ( (i+1)<s ){
|
||||||
|
out += ', ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
},
|
||||||
|
|
||||||
|
removeUserInformations: function(){
|
||||||
|
Ext.get('scm-userinfo').dom.innerHTML = '';
|
||||||
|
Ext.QuickTips.unregister('scm-userinfo-tip');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -598,6 +640,10 @@ Ext.onReady(function(){
|
|||||||
Ext.History.init();
|
Ext.History.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// user informations
|
||||||
|
main.addListeners('login', main.renderUserInformations);
|
||||||
|
main.addListeners('logout', main.removeUserInformations);
|
||||||
|
|
||||||
main.init();
|
main.init();
|
||||||
main.checkLogin();
|
main.checkLogin();
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user