fix some javascript warnings

This commit is contained in:
Sebastian Sdorra
2013-05-21 20:22:21 +02:00
parent c6a0dd6b01
commit 1d8da9a768
43 changed files with 156 additions and 154 deletions

View File

@@ -96,7 +96,7 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{
handler: this.cancel handler: this.cancel
}] }]
}] }]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.action.ChangePasswordWindow.superclass.initComponent.apply(this, arguments); Sonia.action.ChangePasswordWindow.superclass.initComponent.apply(this, arguments);

View File

@@ -77,7 +77,7 @@ Sonia.action.ExceptionWindow = Ext.extend(Ext.Window,{
scope: this, scope: this,
handler: this.showDetails handler: this.showDetails
}] }]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.action.ChangePasswordWindow.superclass.initComponent.apply(this, arguments); Sonia.action.ChangePasswordWindow.superclass.initComponent.apply(this, arguments);

View File

@@ -73,7 +73,7 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
}, },
listeners: { listeners: {
render: function(){ render: function(){
if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){ if ( this.onLoad !== null && Ext.isFunction( this.onLoad ) ){
this.onLoad(this.el); this.onLoad(this.el);
} }
}, },
@@ -108,7 +108,7 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
submitForm: function(){ submitForm: function(){
var form = this.getForm(); var form = this.getForm();
if ( this.onSubmit != null && Ext.isFunction( this.onSubmit ) ){ if ( this.onSubmit !== null && Ext.isFunction( this.onSubmit ) ){
this.onSubmit( form.getValues() ); this.onSubmit( form.getValues() );
} }
} }

View File

@@ -45,7 +45,7 @@ Sonia.config.ConfigPanel = Ext.extend(Ext.Panel, {
collapsible: false, collapsible: false,
collapsed: false, collapsed: false,
items: this.panels items: this.panels
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ConfigPanel.superclass.initComponent.apply(this, arguments); Sonia.config.ConfigPanel.superclass.initComponent.apply(this, arguments);

View File

@@ -36,7 +36,7 @@ Sonia.config.RepositoryConfig = Ext.extend(Sonia.config.ConfigPanel,{
var config = { var config = {
title: main.tabRepositoryTypesText, title: main.tabRepositoryTypesText,
panels: repositoryConfigPanels panels: repositoryConfigPanels
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.RepositoryConfig.superclass.initComponent.apply(this, arguments); Sonia.config.RepositoryConfig.superclass.initComponent.apply(this, arguments);

View File

@@ -264,7 +264,7 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
}); });
} }
}, generalConfigPanels] }, generalConfigPanels]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ScmConfigPanel.superclass.initComponent.apply(this, arguments); Sonia.config.ScmConfigPanel.superclass.initComponent.apply(this, arguments);

View File

@@ -157,7 +157,7 @@ Sonia.group.MemberFormPanel = Ext.extend(Sonia.group.FormPanel, {
var members = []; var members = [];
this.memberStore.data.each(function(record){ this.memberStore.data.each(function(record){
members.push( record.data.member ); members.push( record.data.member );
}) });
item.members = members; item.members = members;
}, },

View File

@@ -139,7 +139,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
}, },
specialKeyPressed: function(field, e){ specialKeyPressed: function(field, e){
if (e.getKey() == e.ENTER) { if (e.getKey() === e.ENTER) {
var form = this.getForm(); var form = this.getForm();
if ( form.isValid() ){ if ( form.isValid() ){
this.authenticate(); this.authenticate();

View File

@@ -49,7 +49,7 @@ Sonia.navigation.NavPanel = Ext.extend(Ext.Panel, {
}, },
renderSections: function(){ renderSections: function(){
if ( this.sections != null ){ if ( this.sections !== null ){
this.addSections( this.sections ); this.addSections( this.sections );
} }
}, },

View File

@@ -44,10 +44,10 @@ Sonia.navigation.NavSection = Ext.extend(Ext.Panel, {
initComponent: function(){ initComponent: function(){
if ( this.links == null ){ if ( this.links === null ){
this.links = this.items; this.links = this.items;
} }
if ( this.links == null ){ if ( this.links === null ){
this.links = []; this.links = [];
} }
@@ -59,7 +59,7 @@ Sonia.navigation.NavSection = Ext.extend(Ext.Panel, {
frame: true, frame: true,
collapsible:true, collapsible:true,
style: 'margin: 5px' style: 'margin: 5px'
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.navigation.NavSection.superclass.initComponent.apply(this, arguments); Sonia.navigation.NavSection.superclass.initComponent.apply(this, arguments);
@@ -68,7 +68,7 @@ Sonia.navigation.NavSection = Ext.extend(Ext.Panel, {
doAction: function(e, t){ doAction: function(e, t){
e.stopEvent(); e.stopEvent();
Ext.each(this.links, function(navItem){ Ext.each(this.links, function(navItem){
if ( navItem.id == t.id && Ext.isFunction(navItem.fn) ){ if ( navItem.id === t.id && Ext.isFunction(navItem.fn) ){
var scope = navItem.scope; var scope = navItem.scope;
if ( Ext.isObject( scope )){ if ( Ext.isObject( scope )){
navItem.fn.call(scope); navItem.fn.call(scope);

View File

@@ -33,9 +33,9 @@ Ext.override(Ext.data.Store,{
addField: function(field){ addField: function(field){
field = new Ext.data.Field(field); field = new Ext.data.Field(field);
this.recordType.prototype.fields.replace(field); this.recordType.prototype.fields.replace(field);
if(typeof field.defaultValue != 'undefined'){ if(typeof field.defaultValue !== 'undefined'){
this.each(function(r){ this.each(function(r){
if(typeof r.data[field.name] == 'undefined'){ if(typeof r.data[field.name] === 'undefined'){
r.data[field.name] = field.defaultValue; r.data[field.name] = field.defaultValue;
} }
}); });

View File

@@ -34,7 +34,7 @@ Ext.form.Field.prototype.afterRenderExt = Ext.form.Field.prototype.afterRender;
Ext.override(Ext.form.Field, { Ext.override(Ext.form.Field, {
afterRender : function() { afterRender : function() {
if ( this.helpText != null ){ if ( this.helpText !== null ){
this.renderHelp( this.helpText ); this.renderHelp( this.helpText );
} }
this.afterRenderExt.apply(this, arguments); this.afterRenderExt.apply(this, arguments);

View File

@@ -36,7 +36,7 @@ Ext.apply(Ext.form.VTypes, {
password: function(val, field) { password: function(val, field) {
if (field.initialPassField) { if (field.initialPassField) {
var pwd = Ext.getCmp(field.initialPassField); var pwd = Ext.getCmp(field.initialPassField);
return (val == pwd.getValue()); return (val === pwd.getValue());
} }
return true; return true;
}, },

View File

@@ -31,7 +31,7 @@
Ext.override(Ext.grid.ColumnModel,{ Ext.override(Ext.grid.ColumnModel,{
addColumn: function(column, colIndex){ addColumn: function(column, colIndex){
if(typeof column == 'string'){ if(typeof column === 'string'){
column = { column = {
header: column, header: column,
dataIndex: column dataIndex: column
@@ -39,7 +39,7 @@ Ext.override(Ext.grid.ColumnModel,{
} }
var config = this.config; var config = this.config;
this.config = []; this.config = [];
if(typeof colIndex == 'number'){ if(typeof colIndex === 'number'){
config.splice(colIndex, 0, column); config.splice(colIndex, 0, column);
}else{ }else{
colIndex = config.push(column); colIndex = config.push(column);

View File

@@ -51,7 +51,7 @@ Ext.override(Ext.grid.GridPanel,{
removeColumn: function(name, colIndex){ removeColumn: function(name, colIndex){
this.store.removeField(name); this.store.removeField(name);
if(typeof colIndex != 'number'){ if(typeof colIndex !== 'number'){
colIndex = this.colModel.findColumnIndex(name); colIndex = this.colModel.findColumnIndex(name);
} }
if(colIndex >= 0){ if(colIndex >= 0){

View File

@@ -58,9 +58,9 @@ Ext.override(Ext.grid.GroupingView,{
getPrefix: function(field){ getPrefix: function(field){
var prefix; var prefix;
if ( this.idPrefix == '{grid.id}' ){ if ( this.idPrefix === '{grid.id}' ){
prefix = this.grid.getId(); prefix = this.grid.getId();
} else if (this.idPrefix == '{grid.el.id}') { } else if (this.idPrefix === '{grid.el.id}') {
prefix = this.grid.getGridEl().id; prefix = this.grid.getGridEl().id;
} else { } else {
prefix = this.idPrefix; prefix = this.idPrefix;

View File

@@ -33,9 +33,9 @@ Ext.apply(Ext.util.Format, {
formatTimestamp: function(value){ formatTimestamp: function(value){
var result = ''; var result = '';
if ( value != null && (value > 0 || value.length > 0)){ if ( value !== null && (value > 0 || value.length > 0)){
var df = state.clientConfig.dateFormat; var df = state.clientConfig.dateFormat;
if ( df == null || df.length == 0 || ! Ext.isDefined(value) ){ if ( df === null || df.length === 0 || ! Ext.isDefined(value) ){
df = "YYYY-MM-DD HH:mm:ss"; df = "YYYY-MM-DD HH:mm:ss";
} }
result = moment(value).format(df); result = moment(value).format(df);

View File

@@ -148,13 +148,13 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, {
console.debug( 'try to find brush for ' + this.syntax ); console.debug( 'try to find brush for ' + this.syntax );
} }
if ( this.syntax != 'plain' ){ if ( this.syntax !== 'plain' ){
var s = null; var s = null;
var found = false; var found = false;
for (var i=0; i<this.syntaxes.length; i++){ for (var i=0; i<this.syntaxes.length; i++){
s = this.syntaxes[i]; s = this.syntaxes[i];
for ( var j=0;j<s.aliases.length; j++ ){ for ( var j=0;j<s.aliases.length; j++ ){
if ( this.syntax == s.aliases[j] ){ if ( this.syntax === s.aliases[j] ){
found = true; found = true;
this.brushUrl = s.fileName; this.brushUrl = s.fileName;
if (debug){ if (debug){

View File

@@ -177,11 +177,11 @@ Sonia.plugin.Grid = Ext.extend(Sonia.rest.Grid, {
var out = ""; var out = "";
var data = record.data; var data = record.data;
var id = Sonia.plugin.CenterInstance.getPluginId(data); var id = Sonia.plugin.CenterInstance.getPluginId(data);
if ( data.state == 'AVAILABLE' ){ if ( data.state === 'AVAILABLE' ){
out = String.format(this.actionLinkTemplate, 'Install', 'install', id); out = String.format(this.actionLinkTemplate, 'Install', 'install', id);
} else if ( data.state == 'INSTALLED' ){ } else if ( data.state === 'INSTALLED' ){
out = String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); out = String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id);
} else if ( data.state == 'UPDATE_AVAILABLE' ){ } else if ( data.state === 'UPDATE_AVAILABLE' ){
out = String.format(this.actionLinkTemplate, 'Update', 'update', id); out = String.format(this.actionLinkTemplate, 'Update', 'update', id);
out += ', ' out += ', '
out += String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); out += String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id);

View File

@@ -88,7 +88,7 @@ Sonia.repository.BlamePanel = Ext.extend(Ext.grid.GridPanel, {
scope: this scope: this
} }
} }
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.BlamePanel.superclass.initComponent.apply(this, arguments); Sonia.repository.BlamePanel.superclass.initComponent.apply(this, arguments);
@@ -96,12 +96,12 @@ Sonia.repository.BlamePanel = Ext.extend(Ext.grid.GridPanel, {
onClick: function(e){ onClick: function(e){
var el = e.getTarget('.blame-link'); var el = e.getTarget('.blame-link');
if ( el != null ){ if ( el !== null ){
var revision = el.rel; var revision = el.rel;
if (debug){ if (debug){
console.debug('load content for ' + revision); console.debug('load content for ' + revision);
} }
this.openContentPanel(revision) this.openContentPanel(revision);
} }
}, },

View File

@@ -71,7 +71,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, {
layout: 'fit', layout: 'fit',
bbar: ['->', this.repository.name, ':', this.revision], bbar: ['->', this.repository.name, ':', this.revision],
items: [panel] items: [panel]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ChangesetPanel.superclass.initComponent.apply(this, arguments); Sonia.repository.ChangesetPanel.superclass.initComponent.apply(this, arguments);
@@ -99,7 +99,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, {
xtype: 'commitPanel', xtype: 'commitPanel',
repository: this.repository, repository: this.repository,
revision: this.revision revision: this.revision
} };
}, },
createDiffPanel: function(){ createDiffPanel: function(){
@@ -108,7 +108,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, {
xtype: 'syntaxHighlighterPanel', xtype: 'syntaxHighlighterPanel',
syntax: 'diff', syntax: 'diff',
contentUrl: this.createDiffUrl() contentUrl: this.createDiffUrl()
} };
}, },
createDiffUrl: function(){ createDiffUrl: function(){
@@ -159,10 +159,10 @@ Sonia.History.register('changesetPanel', {
}, },
onChange: function(repoId, revision, view){ onChange: function(repoId, revision, view){
if (revision == 'null'){ if (revision === 'null'){
revision = null; revision = null;
} }
if (!view || view == 'null'){ if (!view || view === 'null'){
view = 'commit'; view = 'commit';
} }
var id = 'changesetPanel;' + repoId + ';' + revision; var id = 'changesetPanel;' + repoId + ';' + revision;
@@ -177,7 +177,7 @@ Sonia.History.register('changesetPanel', {
view: view, view: view,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
} else { } else {
panel.loadPanel(view); panel.loadPanel(view);
} }

View File

@@ -105,7 +105,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
scope: this scope: this
} }
} }
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ChangesetViewerGrid.superclass.initComponent.apply(this, arguments); Sonia.repository.ChangesetViewerGrid.superclass.initComponent.apply(this, arguments);
@@ -167,9 +167,9 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
renderChangesetMetadata: function(author, p, record){ renderChangesetMetadata: function(author, p, record){
var authorValue = ''; var authorValue = '';
if ( author != null ){ if ( author !== null ){
authorValue = author.name; authorValue = author.name;
if ( author.mail != null ){ if ( author.mail !== null ){
authorValue += ' ' + String.format(this.mailTemplate, author.mail); authorValue += ' ' + String.format(this.mailTemplate, author.mail);
} }
} }
@@ -178,7 +178,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
// description = Ext.util.Format.htmlEncode(description); // description = Ext.util.Format.htmlEncode(description);
// } // }
var date = record.data.date; var date = record.data.date;
if ( date != null ){ if ( date !== null ){
date = Ext.util.Format.formatTimestamp(date); date = Ext.util.Format.formatTimestamp(date);
} }
return String.format( return String.format(
@@ -198,7 +198,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
getLabeledValue: function(label, array){ getLabeledValue: function(label, array){
var result = ''; var result = '';
if ( array != null && array.length > 0 ){ if ( array !== null && array.length > 0 ){
result = label + ': ' + Sonia.util.getStringFromArray(array); result = label + ': ' + Sonia.util.getStringFromArray(array);
} }
return result; return result;

View File

@@ -56,7 +56,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
var params = { var params = {
start: this.start, start: this.start,
limit: this.startLimit limit: this.startLimit
} };
var baseParams = {}; var baseParams = {};
@@ -100,7 +100,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
}; };
if ( ! this.inline ){ if ( ! this.inline ){
config.title = String.format(this.changesetViewerTitleText, this.repository.name) config.title = String.format(this.changesetViewerTitleText, this.repository.name);
var type = Sonia.repository.getTypeByName( this.repository.type ); var type = Sonia.repository.getTypeByName( this.repository.type );
if ( type && type.supportedCommands && type.supportedCommands.indexOf('BRANCHES') >= 0){ if ( type && type.supportedCommands && type.supportedCommands.indexOf('BRANCHES') >= 0){
@@ -112,7 +112,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
displayInfo: true, displayInfo: true,
pageSize: this.pageSize, pageSize: this.pageSize,
prependButtons: true prependButtons: true
} };
} }
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
@@ -154,7 +154,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
} }
} }
}] }]
} };
}, },
selectBranch: function(combo, rec){ selectBranch: function(combo, rec){
@@ -229,7 +229,7 @@ Sonia.History.register('repositoryChangesetViewerPanel', {
pageSize: limit, pageSize: limit,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
} else { } else {
panel.loadChangesets(start, limit); panel.loadChangesets(start, limit);
} }

View File

@@ -97,7 +97,7 @@ Sonia.repository.CommitPanel = Ext.extend(Ext.Panel, {
padding: 10, padding: 10,
autoScroll: true, autoScroll: true,
items: [this.commitPanel, this.diffPanel] items: [this.commitPanel, this.diffPanel]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.CommitPanel.superclass.initComponent.apply(this, arguments); Sonia.repository.CommitPanel.superclass.initComponent.apply(this, arguments);
@@ -122,7 +122,7 @@ Sonia.repository.CommitPanel = Ext.extend(Ext.Panel, {
scope: this, scope: this,
success: function(response){ success: function(response){
var changeset = Ext.decode(response.responseText); var changeset = Ext.decode(response.responseText);
this.update(changeset) this.update(changeset);
}, },
failure: function(result){ failure: function(result){
main.handleRestFailure( main.handleRestFailure(

View File

@@ -81,7 +81,7 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
}], }],
bbar: bottomBar, bbar: bottomBar,
items: [panel] items: [panel]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ContentPanel.superclass.initComponent.apply(this, arguments); Sonia.repository.ContentPanel.superclass.initComponent.apply(this, arguments);
@@ -111,7 +111,7 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
// TODO find a better way // TODO find a better way
pageSize: 9999, pageSize: 9999,
startLimit: -1 startLimit: -1
} };
}, },
openHistoryPanel: function(){ openHistoryPanel: function(){
@@ -125,7 +125,7 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
xtype: 'syntaxHighlighterPanel', xtype: 'syntaxHighlighterPanel',
syntax: Sonia.util.getExtension(this.path), syntax: Sonia.util.getExtension(this.path),
contentUrl: this.contentUrl contentUrl: this.contentUrl
} };
}, },
openSyntaxPanel: function(){ openSyntaxPanel: function(){
@@ -140,7 +140,7 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
repository: this.repository, repository: this.repository,
revision: this.revision, revision: this.revision,
path: this.path path: this.path
} };
}, },
openBlamePanel: function(){ openBlamePanel: function(){
@@ -172,7 +172,7 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
appendRepositoryProperties: function(bar){ appendRepositoryProperties: function(bar){
bar.push('->',this.repository.name); bar.push('->',this.repository.name);
if ( this.revision != null ){ if ( this.revision !== null ){
bar.push(': ', this.revision); bar.push(': ', this.revision);
} }
}, },
@@ -205,10 +205,10 @@ Sonia.History.register('contentPanel', {
}, },
onChange: function(repoId, revision, path, view){ onChange: function(repoId, revision, path, view){
if (revision == 'null'){ if (revision === 'null'){
revision = null; revision = null;
} }
if (!view || view == 'null'){ if (!view || view === 'null'){
view = 'content'; view = 'content';
} }
var id = 'contentPanel;' + repoId + ';' + revision + ';' + path; var id = 'contentPanel;' + repoId + ';' + revision + ';' + path;
@@ -224,7 +224,7 @@ Sonia.History.register('contentPanel', {
view: view, view: view,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
} else { } else {
panel.loadPanel(view); panel.loadPanel(view);
} }

View File

@@ -54,7 +54,7 @@ Sonia.repository.DiffPanel = Ext.extend(Ext.Panel, {
syntax: 'diff', syntax: 'diff',
contentUrl: this.diffUrl contentUrl: this.diffUrl
}] }]
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.DiffPanel.superclass.initComponent.apply(this, arguments); Sonia.repository.DiffPanel.superclass.initComponent.apply(this, arguments);
@@ -92,7 +92,7 @@ Sonia.History.register('diffPanel', {
revision: revision, revision: revision,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
} }
main.addTab(panel); main.addTab(panel);
}); });

View File

@@ -45,7 +45,7 @@ Sonia.repository.ExtendedInfoPanel = Ext.extend(Sonia.repository.InfoPanel,{
modifyDefaultConfig: function(config){ modifyDefaultConfig: function(config){
var items = config.items; var items = config.items;
if ( items == null ){ if ( items === null ){
items = []; items = [];
} }
items.push({ items.push({
@@ -99,7 +99,7 @@ Sonia.repository.ExtendedInfoPanel = Ext.extend(Sonia.repository.InfoPanel,{
xtype: 'repositoryBrowser', xtype: 'repositoryBrowser',
repository: this.item, repository: this.item,
closable: true closable: true
} };
}, },
openRepositoryBrowser: function(browser){ openRepositoryBrowser: function(browser){

View File

@@ -105,7 +105,7 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
getIdFromResponse: function(response){ getIdFromResponse: function(response){
var id = null; var id = null;
var location = response.getResponseHeader('Location') var location = response.getResponseHeader('Location');
if (location){ if (location){
var parts = location.split('/'); var parts = location.split('/');
id = parts[parts.length - 1]; id = parts[parts.length - 1];

View File

@@ -275,7 +275,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
}, },
renderGroupName: function(v){ renderGroupName: function(v){
if (v == 'zzz__'){ if (v === 'zzz__'){
v = this.mainGroup; v = this.mainGroup;
} }
return v; return v;
@@ -350,7 +350,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
var desc = rec.get('description'); var desc = rec.get('description');
return (! query || rec.get('name').toLowerCase().indexOf(query) >= 0 || return (! query || rec.get('name').toLowerCase().indexOf(query) >= 0 ||
(desc && desc.toLowerCase().indexOf(query) >= 0)) && (desc && desc.toLowerCase().indexOf(query) >= 0)) &&
(! this.filterRequest.type || rec.get('type') == this.filterRequest.type) && (! this.filterRequest.type || rec.get('type') === this.filterRequest.type) &&
(archived || ! rec.get('archived')); (archived || ! rec.get('archived'));
}, this); }, this);
} }
@@ -372,7 +372,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
var desc = rec.get('description'); var desc = rec.get('description');
return (! search || rec.get('name').toLowerCase().indexOf(search) >= 0 || return (! search || rec.get('name').toLowerCase().indexOf(search) >= 0 ||
(desc && desc.toLowerCase().indexOf(search) >= 0)) && (desc && desc.toLowerCase().indexOf(search) >= 0)) &&
(! this.typeFilter || rec.get('type') == this.typeFilter); (! this.typeFilter || rec.get('type') === this.typeFilter);
}, this); }, this);
} }
}, },
@@ -444,7 +444,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
renderRepositoryType: function(repositoryType){ renderRepositoryType: function(repositoryType){
var displayName = this.unknownType; var displayName = this.unknownType;
var rec = repositoryTypeStore.queryBy(function(rec){ var rec = repositoryTypeStore.queryBy(function(rec){
return rec.data.name == repositoryType; return rec.data.name === repositoryType;
}).itemAt(0); }).itemAt(0);
if ( rec ){ if ( rec ){
displayName = rec.get('displayName'); displayName = rec.get('displayName');

View File

@@ -80,7 +80,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
scope: this scope: this
} }
} }
} };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ImportWindow.superclass.initComponent.apply(this, arguments); Sonia.repository.ImportWindow.superclass.initComponent.apply(this, arguments);
}, },

View File

@@ -51,7 +51,7 @@ Sonia.repository.typeIcons = [];
Sonia.repository.getTypeIcon = function(type){ Sonia.repository.getTypeIcon = function(type){
return Sonia.repository.typeIcons[type]; return Sonia.repository.typeIcons[type];
} };
Sonia.repository.createContentUrl = function(repository, path, revision){ Sonia.repository.createContentUrl = function(repository, path, revision){
var contentUrl = restUrl + 'repositories/' + repository.id + '/'; var contentUrl = restUrl + 'repositories/' + repository.id + '/';
@@ -60,7 +60,7 @@ Sonia.repository.createContentUrl = function(repository, path, revision){
contentUrl += "&revision=" + revision; contentUrl += "&revision=" + revision;
} }
return contentUrl; return contentUrl;
} };
Sonia.repository.createContentId = function(repository, path, revision){ Sonia.repository.createContentId = function(repository, path, revision){
var id = repository.id + '-b-' + path; var id = repository.id + '-b-' + path;
@@ -68,11 +68,11 @@ Sonia.repository.createContentId = function(repository, path, revision){
id += '-r-' + revision; id += '-r-' + revision;
} }
return id; return id;
} };
Sonia.repository.isOwner = function(repository){ Sonia.repository.isOwner = function(repository){
return admin || repository.permissions != null; return admin || repository.permissions !== null;
} };
Sonia.repository.setEditPanel = function(panels){ Sonia.repository.setEditPanel = function(panels){
var editPanel = Ext.getCmp('repositoryEditPanel'); var editPanel = Ext.getCmp('repositoryEditPanel');
@@ -82,25 +82,25 @@ Sonia.repository.setEditPanel = function(panels){
}); });
editPanel.setActiveTab(0); editPanel.setActiveTab(0);
editPanel.doLayout(); editPanel.doLayout();
} };
Sonia.repository.createUrl = function(type, name){ Sonia.repository.createUrl = function(type, name){
return Sonia.util.getBaseUrl() + '/' + type + '/' + name return Sonia.util.getBaseUrl() + '/' + type + '/' + name;
} };
Sonia.repository.createUrlFromObject = function(repository){ Sonia.repository.createUrlFromObject = function(repository){
return Sonia.repository.createUrl(repository.type, repository.name); return Sonia.repository.createUrl(repository.type, repository.name);
} };
Sonia.repository.getTypeByName = function(name){ Sonia.repository.getTypeByName = function(name){
var type = null; var type = null;
repositoryTypeStore.queryBy(function(rec){ repositoryTypeStore.queryBy(function(rec){
if ( rec.get('name') == name ){ if ( rec.get('name') === name ){
type = rec.data; type = rec.data;
} }
}); });
return type; return type;
} };
/** /**
* default panel * default panel
@@ -112,7 +112,7 @@ Sonia.repository.DefaultPanel = {
xtype: 'panel', xtype: 'panel',
bodyCssClass: 'x-panel-mc', bodyCssClass: 'x-panel-mc',
html: 'Add or select an Repository' html: 'Add or select an Repository'
} };
// load object from store or from web service // load object from store or from web service
@@ -137,7 +137,7 @@ Sonia.repository.get = function(id, callback){
var type = id.substring(0, index); var type = id.substring(0, index);
var name = id.substring(index); var name = id.substring(index);
index = store.findBy(function(rec){ index = store.findBy(function(rec){
return rec.get('name') == name && rec.get('type') == type; return rec.get('name') === name && rec.get('type') === type;
}); });
if ( index >= 0 ){ if ( index >= 0 ){
rec = store.getAt(index); rec = store.getAt(index);
@@ -168,4 +168,4 @@ Sonia.repository.get = function(id, callback){
} }
}); });
} }
} };

View File

@@ -91,7 +91,7 @@ Sonia.repository.PermissionFormPanel = Ext.extend(Sonia.repository.FormPanel, {
}], }],
getCellEditor: function(colIndex, rowIndex) { getCellEditor: function(colIndex, rowIndex) {
if (colIndex == 0) { if (colIndex === 0) {
var store = null; var store = null;
var rec = permissionStore.getAt(rowIndex); var rec = permissionStore.getAt(rowIndex);
if ( rec.data.groupPermission ){ if ( rec.data.groupPermission ){
@@ -121,8 +121,8 @@ Sonia.repository.PermissionFormPanel = Ext.extend(Sonia.repository.FormPanel, {
} }
}); });
if ( this.item != null ){ if ( this.item !== null ){
if ( this.item.permissions == null ){ if ( this.item.permissions === null ){
this.item.permissions = []; this.item.permissions = [];
} }
this.permissionStore.loadData( this.item ); this.permissionStore.loadData( this.item );
@@ -213,7 +213,7 @@ Sonia.repository.PermissionFormPanel = Ext.extend(Sonia.repository.FormPanel, {
var permissions = []; var permissions = [];
this.permissionStore.data.each(function(record){ this.permissionStore.data.each(function(record){
permissions.push( record.data ); permissions.push( record.data );
}) });
item.permissions = permissions; item.permissions = permissions;
}, },

View File

@@ -64,7 +64,7 @@ Sonia.repository.PropertiesFormPanel = Ext.extend(Sonia.repository.FormPanel, {
for ( var j in this.item.properties ){ for ( var j in this.item.properties ){
var property = this.item.properties[j]; var property = this.item.properties[j];
if ( property.key == field.property ){ if ( property.key === field.property ){
field.setValue(property.value); field.setValue(property.value);
} }
} }
@@ -86,7 +86,7 @@ Sonia.repository.PropertiesFormPanel = Ext.extend(Sonia.repository.FormPanel, {
var result = !Ext.isEmpty(p.key); var result = !Ext.isEmpty(p.key);
if ( result ){ if ( result ){
for (var i in this.properties[this.id]){ for (var i in this.properties[this.id]){
if ( p.key == this.properties[this.id][i].property ){ if ( p.key === this.properties[this.id][i].property ){
result = false; result = false;
break; break;
} }

View File

@@ -183,7 +183,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
var tbar = { var tbar = {
xtype: 'toolbar', xtype: 'toolbar',
items: [items] items: [items]
} };
return tbar; return tbar;
}, },
@@ -207,7 +207,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
loadStore: function(store, records, extra){ loadStore: function(store, records, extra){
var path = extra.params.path; var path = extra.params.path;
if ( path != null && path.length > 0 ){ if ( path !== null && path.length > 0 ){
var index = path.lastIndexOf('/'); var index = path.lastIndexOf('/');
if ( index > 0 ){ if ( index > 0 ){
@@ -240,7 +240,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
onClick: function(e){ onClick: function(e){
var el = e.getTarget('.scm-browser'); var el = e.getTarget('.scm-browser');
if ( el != null ){ if ( el !== null ){
var rel = el.rel; var rel = el.rel;
var index = rel.indexOf(':'); var index = rel.indexOf(':');
@@ -248,9 +248,9 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
var prefix = rel.substring(0, index); var prefix = rel.substring(0, index);
var path = rel.substring(index + 1); var path = rel.substring(index + 1);
if ( prefix == 'sub' ){ if ( prefix === 'sub' ){
this.openSubRepository(path); this.openSubRepository(path);
} else if ( prefix == 'dir' ){ } else if ( prefix === 'dir' ){
this.changeDirectory(path); this.changeDirectory(path);
} else { } else {
this.openFile(path); this.openFile(path);
@@ -280,7 +280,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
revision: revision, revision: revision,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
} }
main.addTab(panel); main.addTab(panel);
}); });
@@ -288,7 +288,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
appendRepositoryProperties: function(bar){ appendRepositoryProperties: function(bar){
bar.push('->',this.repository.name); bar.push('->',this.repository.name);
if ( this.revision != null ){ if ( this.revision !== null ){
bar.push(': ', this.revision); bar.push(': ', this.revision);
} }
}, },
@@ -326,7 +326,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
var params = { var params = {
path: path path: path
} };
if (this.revision){ if (this.revision){
params.revision = this.revision; params.revision = this.revision;
@@ -373,7 +373,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
var currentPath = ''; var currentPath = '';
var items = [this.createFolderButton(currentPath, '')]; var items = [this.createFolderButton(currentPath, '')];
if ( path != '' ){ if ( path !== '' ){
for (var i=0; i<parts.length; i++){ for (var i=0; i<parts.length; i++){
currentPath += parts[i] + '/'; currentPath += parts[i] + '/';
items.push(this.createFolderButton(currentPath, parts[i])); items.push(this.createFolderButton(currentPath, parts[i]));
@@ -381,7 +381,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
} }
items.push('->', this.repository.name); items.push('->', this.repository.name);
if ( this.revision != null ){ if ( this.revision !== null ){
items.push(':', this.revision); items.push(':', this.revision);
} }
@@ -395,7 +395,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
if ( i > 0 ){ if ( i > 0 ){
url = url.substring( i + ctxPath.length ); url = url.substring( i + ctxPath.length );
} }
if ( url.indexOf('/') == 0 ){ if ( url.indexOf('/') === 0 ){
url = url.substring(1); url = url.substring(1);
} }
return url; return url;
@@ -404,7 +404,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
transformLink: function(url, revision){ transformLink: function(url, revision){
var link = null; var link = null;
var server = Sonia.util.getServername(url); var server = Sonia.util.getServername(url);
if ( server == window.location.hostname || server == 'localhost' ){ if ( server === window.location.hostname || server === 'localhost' ){
var repositoryPath = this.getRepositoryPath( url ); var repositoryPath = this.getRepositoryPath( url );
if (repositoryPath){ if (repositoryPath){
link = 'sub:' + repositoryPath; link = 'sub:' + repositoryPath;
@@ -464,7 +464,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
icon = this.iconDocument; icon = this.iconDocument;
} }
var img = String.format(this.templateIcon, icon, name, name); var img = String.format(this.templateIcon, icon, name, name);
return this.renderLink(img, record) return this.renderLink(img, record);
}, },
renderLength: function(length, p, record){ renderLength: function(length, p, record){
@@ -495,10 +495,10 @@ Sonia.History.register('repositoryBrowser', {
}, },
onChange: function(repoId, revision, path){ onChange: function(repoId, revision, path){
if (revision == 'null'){ if (revision === 'null'){
revision = null; revision = null;
} }
if (path == 'null'){ if (path === 'null'){
path = ''; path = '';
} }
var id = 'repositoryBrowser;' + repoId + ';' + revision; var id = 'repositoryBrowser;' + repoId + ';' + revision;
@@ -512,7 +512,7 @@ Sonia.History.register('repositoryBrowser', {
revision: revision, revision: revision,
closable: true, closable: true,
autoScroll: true autoScroll: true
} };
if (path){ if (path){
panel.path = path; panel.path = path;
} }

View File

@@ -119,7 +119,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
renderUrl: function(url){ renderUrl: function(url){
var result = ''; var result = '';
if ( url != null ){ if ( url !== null ){
result = String.format( this.urlTemplate, url ); result = String.format( this.urlTemplate, url );
} }
return result; return result;
@@ -127,7 +127,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
renderMailto: function(mail){ renderMailto: function(mail){
var result = ''; var result = '';
if ( mail != null ){ if ( mail !== null ){
result = String.format( this.mailtoTemplate, mail ); result = String.format( this.mailtoTemplate, mail );
} }
return result; return result;
@@ -155,7 +155,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
handleHistory: function(params){ handleHistory: function(params){
if (params && params.length > 0){ if (params && params.length > 0){
this.selectById(params[0]) this.selectById(params[0]);
} else { } else {
if (debug){ if (debug){
console.debug( 'clear selection' ); console.debug( 'clear selection' );

View File

@@ -39,7 +39,7 @@ Sonia.rest.ExceptionHandler = function(proxy, type, action, options, response, a
if (debug){ if (debug){
console.debug('store returned statuscode ' + status); console.debug('store returned statuscode ' + status);
} }
if ( status == 200 && action == 'read' && response.responseText == 'null' ){ if ( status === 200 && action === 'read' && response.responseText === 'null' ){
if ( debug ){ if ( debug ){
console.debug( 'empty array, clear whole store' ); console.debug( 'empty array, clear whole store' );
} }
@@ -54,4 +54,4 @@ Sonia.rest.ExceptionHandler = function(proxy, type, action, options, response, a
String.format(Sonia.rest.exceptionMsgText, status) String.format(Sonia.rest.exceptionMsgText, status)
); );
} }
} };

View File

@@ -35,11 +35,12 @@ Sonia.rest.JsonStore = Ext.extend( Ext.data.JsonStore, {
if ( ! config.listeners ){ if ( ! config.listeners ){
config.listeners = {}; config.listeners = {};
} }
// fix jersey empty array problem // fix jersey empty array problem
config.listeners.exception = { config.listeners.exception = {
fn: Sonia.rest.ExceptionHandler, fn: Sonia.rest.ExceptionHandler,
scope: this scope: this
} };
var baseConfig = { var baseConfig = {
autoLoad: true autoLoad: true

View File

@@ -30,7 +30,7 @@
*/ */
// enable debug mode, if console is available // enable debug mode, if console is available
var debug = typeof console != 'undefined' && typeof console.debug != 'undefined'; var debug = typeof console !== 'undefined' && typeof console.debug !== 'undefined';
// send X-SCM-Client on every ajax request // send X-SCM-Client on every ajax request
Ext.Ajax.defaultHeaders = { Ext.Ajax.defaultHeaders = {
@@ -102,13 +102,13 @@ Sonia = {
id += this.idSeparator; id += this.idSeparator;
} }
} }
if (id.length() == 0){ if (id.length() === 0){
id = Ext.id(); id = Ext.id();
} }
return id; return id;
} }
} };
// the main object (sonia.scm) // the main object (sonia.scm)

View File

@@ -40,7 +40,7 @@ Sonia.History = {
add: function(token){ add: function(token){
if (this.initialized){ if (this.initialized){
if (token != Ext.History.getToken()){ if (token !== Ext.History.getToken()){
if (this.isInvokeable(this.recentlyChanged, token)){ if (this.isInvokeable(this.recentlyChanged, token)){
if ( debug ){ if ( debug ){
console.debug('add history element ' + token); console.debug('add history element ' + token);
@@ -177,7 +177,7 @@ Sonia.History = {
Ext.History.on('ready', function(history){ Ext.History.on('ready', function(history){
var token = history.getToken(); var token = history.getToken();
if (token && token != 'null'){ if (token && token !== 'null'){
Sonia.History.onChange(token); Sonia.History.onChange(token);
} }
Sonia.History.initialized = true; Sonia.History.initialized = true;

View File

@@ -99,7 +99,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
getInfoPanel: function(type){ getInfoPanel: function(type){
var rp = null; var rp = null;
var panel = this.infoPanels[type]; var panel = this.infoPanels[type];
if ( panel == null ){ if ( panel === null ){
rp = { rp = {
xtype: 'repositoryInfoPanel' xtype: 'repositoryInfoPanel'
}; };
@@ -191,7 +191,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
var securitySection = null; var securitySection = null;
if ( state.user.type == state.defaultUserType && state.user.name != 'anonymous' ){ if ( state.user.type === state.defaultUserType && state.user.name !== 'anonymous' ){
securitySection = { securitySection = {
id: 'securityConfig', id: 'securityConfig',
title: this.sectionSecurityText, title: this.sectionSecurityText,
@@ -201,7 +201,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
new Sonia.action.ChangePasswordWindow().show(); new Sonia.action.ChangePasswordWindow().show();
} }
}] }]
} };
} }
if ( admin ){ if ( admin ){
@@ -224,12 +224,12 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
}] }]
}]); }]);
if ( securitySection == null ){ if ( securitySection === null ){
securitySection = { securitySection = {
id: 'securityConfig', id: 'securityConfig',
title: this.sectionSecurityText, title: this.sectionSecurityText,
links: [] links: []
} };
} }
securitySection.links.push({ securitySection.links.push({
@@ -243,11 +243,11 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
}); });
} }
if ( securitySection != null ){ if ( securitySection !== null ){
panel.addSection( securitySection ); panel.addSection( securitySection );
} }
if ( state.user.name == 'anonymous' ){ if ( state.user.name === 'anonymous' ){
panel.addSection({ panel.addSection({
id: 'navLogin', id: 'navLogin',
title: this.sectionLoginText, title: this.sectionLoginText,
@@ -291,7 +291,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
addTab: function(panel){ addTab: function(panel){
var tab = this.mainTabPanel.findById(panel.id); var tab = this.mainTabPanel.findById(panel.id);
if ( tab == null ){ if ( tab === null ){
this.mainTabPanel.add(panel); this.mainTabPanel.add(panel);
} }
this.mainTabPanel.setActiveTab(panel.id); this.mainTabPanel.setActiveTab(panel.id);
@@ -362,10 +362,10 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
var s = null; var s = null;
var text = response.responseText; var text = response.responseText;
if ( text != null && text.length > 0 ){ if ( text !== null && text.length > 0 ){
s = Ext.decode( text ); s = Ext.decode( text );
} }
if ( s != null && s.success ){ if ( s !== null && s.success ){
this.loadState(s); this.loadState(s);
} else { } else {
// show login window // show login window
@@ -403,35 +403,35 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
console.debug( 'handle failure for status code: ' + status ); console.debug( 'handle failure for status code: ' + status );
} }
// TODO handle already exists exceptions specific // TODO handle already exists exceptions specific
if ( status == 401 ){ if ( status === 401 ){
Ext.Msg.show({ Ext.Msg.show({
title: this.errorSessionExpiredTitle, title: this.errorSessionExpiredTitle,
msg: this.errorSessionExpiredMessage, msg: this.errorSessionExpiredMessage,
buttons: Ext.Msg.OKCANCEL, buttons: Ext.Msg.OKCANCEL,
fn: function(btn){ fn: function(btn){
if ( btn == 'ok' ){ if ( btn === 'ok' ){
this.login(); this.login();
} }
}, },
scope: this scope: this
}); });
} else if ( status == 403 ){ } else if ( status === 403 ){
Ext.Msg.show({ Ext.Msg.show({
title: this.errorNoPermissionsTitle, title: this.errorNoPermissionsTitle,
msg: this.errorNoPermissionsMessage, msg: this.errorNoPermissionsMessage,
buttons: Ext.Msg.OKCANCEL buttons: Ext.Msg.OKCANCEL
}); });
} else if ( status == 404 ){ } else if ( status === 404 ){
Ext.Msg.show({ Ext.Msg.show({
title: this.errorNotFoundTitle, title: this.errorNotFoundTitle,
msg: this.errorNotFoundMessage, msg: this.errorNotFoundMessage,
buttons: Ext.Msg.OKCANCEL buttons: Ext.Msg.OKCANCEL
}); });
} else { } else {
if ( title == null ){ if ( title === null ){
title = this.errorTitle; title = this.errorTitle;
} }
if ( message == null ){ if ( message === null ){
message = this.errorMessage; message = this.errorMessage;
} }
@@ -454,7 +454,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
message = String.format(message, status); message = String.format(message, status);
if ( text == null ){ if ( text === null ){
Ext.MessageBox.show({ Ext.MessageBox.show({
title: title, title: title,
@@ -483,7 +483,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
} else { } else {
callback(); callback();
} }
} };
if ( this.scripts.indexOf(url) < 0 ){ if ( this.scripts.indexOf(url) < 0 ){
var js = document.createElement('script'); var js = document.createElement('script');
js.type = "text/javascript"; js.type = "text/javascript";
@@ -496,7 +496,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
this.readyState === 'complete'){ this.readyState === 'complete'){
doCallback(); doCallback();
} }
} };
} else { } else {
js.onload = doCallback; js.onload = doCallback;
js.onerror = doCallback; js.onerror = doCallback;
@@ -534,7 +534,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
}, },
renderUserInformations: function(state){ renderUserInformations: function(state){
if ( state.user.name != 'anonymous' ){ if ( state.user.name !== 'anonymous' ){
var tpl = new Ext.XTemplate(this.loggedInTextTemplate); var tpl = new Ext.XTemplate(this.loggedInTextTemplate);
tpl.overwrite(Ext.get('scm-userinfo'), state); tpl.overwrite(Ext.get('scm-userinfo'), state);
var text = ''; var text = '';

View File

@@ -60,7 +60,7 @@ Sonia.uistate.WebStorageProvider = Ext.extend(Ext.state.Provider,{
* @param {Mixed} value The state data * @param {Mixed} value The state data
*/ */
set : function(name, value){ set : function(name, value){
if(typeof value == "undefined" || value === null){ if(typeof value === "undefined" || value === null){
this.clear(name); this.clear(name);
} else { } else {
localStorage.setItem(name, this.encodeValue(value)); localStorage.setItem(name, this.encodeValue(value));

View File

@@ -46,7 +46,7 @@ Sonia.util.getServername = function(url){
} }
} }
return url; return url;
} };
Sonia.util.getContextPath = function(){ Sonia.util.getContextPath = function(){
var path = window.location.pathname; var path = window.location.pathname;
@@ -57,7 +57,7 @@ Sonia.util.getContextPath = function(){
} }
} }
return path; return path;
} };
Sonia.util.getBaseUrl = function(){ Sonia.util.getBaseUrl = function(){
var url = location.href; var url = location.href;
@@ -72,7 +72,7 @@ Sonia.util.getBaseUrl = function(){
url = url.substring(0, url.length -1); url = url.substring(0, url.length -1);
} }
return url; return url;
} };
Sonia.util.getName = function(path){ Sonia.util.getName = function(path){
var name = path; var name = path;
@@ -81,7 +81,7 @@ Sonia.util.getName = function(path){
name = path.substr(index +1); name = path.substr(index +1);
} }
return name; return name;
} };
Sonia.util.getExtension = function(path){ Sonia.util.getExtension = function(path){
var ext = null; var ext = null;
@@ -90,15 +90,15 @@ Sonia.util.getExtension = function(path){
ext = path.substr(index + 1, path.length); ext = path.substr(index + 1, path.length);
} }
return ext; return ext;
} };
Sonia.util.clone = function(obj) { Sonia.util.clone = function(obj) {
var newObj = (this instanceof Array) ? [] : {}; var newObj = (this instanceof Array) ? [] : {};
for (i in obj) { for (i in obj) {
if (i == 'clone') continue; if (i === 'clone') continue;
if (obj[i] && typeof obj[i] == "object") { if (obj[i] && typeof obj[i] === "object") {
newObj[i] = Sonia.util.clone(obj[i]); newObj[i] = Sonia.util.clone(obj[i]);
} else newObj[i] = obj[i] } else newObj[i] = obj[i];
} }
return newObj; return newObj;
}; };
@@ -116,7 +116,7 @@ Sonia.util.parseInt = function(string, defaultValue){
result = defaultValue; result = defaultValue;
} }
return result; return result;
} };
Sonia.util.getStringFromArray = function(array){ Sonia.util.getStringFromArray = function(array){
var value = ''; var value = '';
@@ -130,14 +130,14 @@ Sonia.util.getStringFromArray = function(array){
} }
return value; return value;
} };
Sonia.util.applySub = function(obj, name, p){ Sonia.util.applySub = function(obj, name, p){
if (name){ if (name){
obj = obj[name]; obj = obj[name];
} }
return Sonia.util.call(obj, p); return Sonia.util.call(obj, p);
} };
Sonia.util.apply = function(obj, p){ Sonia.util.apply = function(obj, p){
var result = null; var result = null;
@@ -164,7 +164,7 @@ Sonia.util.apply = function(obj, p){
} }
} }
return result; return result;
} };
if (!Array.prototype.filter) { if (!Array.prototype.filter) {
@@ -176,20 +176,20 @@ if (!Array.prototype.filter) {
} }
} }
return results; return results;
} };
} }
Sonia.util.getProperty = function(properties, key){ Sonia.util.getProperty = function(properties, key){
var value = null; var value = null;
if ( properties != null ){ if ( properties !== null ){
for (var i=0; i<properties.length; i++){ for (var i=0; i<properties.length; i++){
var property = properties[i]; var property = properties[i];
if ( property.key == key ){ if ( property.key === key ){
value = property.value; value = property.value;
break; break;
} }
} }
} }
return value; return value;
} };

View File

@@ -46,6 +46,7 @@ Sonia.util.Link = Ext.extend(Ext.BoxComponent, {
style: config.style, style: config.style,
'class': cl 'class': cl
}; };
config.listeners = { config.listeners = {
render: function(c) { render: function(c) {
c.getEl().on('click', function(){ c.getEl().on('click', function(){
@@ -54,7 +55,7 @@ Sonia.util.Link = Ext.extend(Ext.BoxComponent, {
} }
}, this); }, this);
} }
} };
Sonia.util.Link.superclass.constructor.apply(this, arguments); Sonia.util.Link.superclass.constructor.apply(this, arguments);
this.text = config.text; this.text = config.text;