added getRepositoryUrlWithUsername method to InfoPanel

This commit is contained in:
Sebastian Sdorra
2011-04-29 13:59:09 +02:00
parent 3f63b8081c
commit 18174093c7

View File

@@ -219,22 +219,9 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, {
actionLinkTemplate: '<a style="cursor: pointer;">{0}</a>',
initComponent: function(){
var config = {
title: this.item.name,
padding: 5,
bodyCssClass: 'x-panel-mc',
layout: 'table',
layoutConfig: {
columns: 2,
tableAttrs: {
style: 'width: 80%;'
}
},
defaults: {
style: 'font-size: 12px'
},
// TODO i18n
items: [{
var items = [{
xtype: 'label',
text: 'Name: '
},{
@@ -252,12 +239,26 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, {
},{
xtype: 'box',
html: String.format(this.linkTemplate, this.item.url)
}]
}];
var config = {
title: this.item.name,
padding: 5,
bodyCssClass: 'x-panel-mc',
layout: 'table',
layoutConfig: {
columns: 2,
tableAttrs: {
style: 'width: 80%;'
}
},
defaults: {
style: 'font-size: 12px'
},
items: items
}
console.debug(config);
this.modifyDefaultConfig(config);
console.debug(config);
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.InfoPanel.superclass.initComponent.apply(this, arguments);
@@ -267,6 +268,18 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, {
},
getRepositoryUrlWithUsername: function(){
var uri = this.item.url;
if ( state.user.name != 'anonymous' ){
var index = uri.indexOf("://");
if ( index > 0 ){
index += 3;
uri = uri.substring(0, index) + state.user.name + "@" + uri.substring(index);
}
}
return uri;
},
getRepositoryTypeText: function(t){
var text = null;
for ( var i=0; i<state.repositoryTypes.length; i++ ){