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
}]
}]
}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.action.ChangePasswordWindow.superclass.initComponent.apply(this, arguments);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -33,9 +33,9 @@ Ext.override(Ext.data.Store,{
addField: function(field){
field = new Ext.data.Field(field);
this.recordType.prototype.fields.replace(field);
if(typeof field.defaultValue != 'undefined'){
if(typeof field.defaultValue !== 'undefined'){
this.each(function(r){
if(typeof r.data[field.name] == 'undefined'){
if(typeof r.data[field.name] === 'undefined'){
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, {
afterRender : function() {
if ( this.helpText != null ){
if ( this.helpText !== null ){
this.renderHelp( this.helpText );
}
this.afterRenderExt.apply(this, arguments);

View File

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

View File

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

View File

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

View File

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

View File

@@ -33,9 +33,9 @@ Ext.apply(Ext.util.Format, {
formatTimestamp: function(value){
var result = '';
if ( value != null && (value > 0 || value.length > 0)){
if ( value !== null && (value > 0 || value.length > 0)){
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";
}
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 );
}
if ( this.syntax != 'plain' ){
if ( this.syntax !== 'plain' ){
var s = null;
var found = false;
for (var i=0; i<this.syntaxes.length; i++){
s = this.syntaxes[i];
for ( var j=0;j<s.aliases.length; j++ ){
if ( this.syntax == s.aliases[j] ){
if ( this.syntax === s.aliases[j] ){
found = true;
this.brushUrl = s.fileName;
if (debug){

View File

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

View File

@@ -88,7 +88,7 @@ Sonia.repository.BlamePanel = Ext.extend(Ext.grid.GridPanel, {
scope: this
}
}
}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.BlamePanel.superclass.initComponent.apply(this, arguments);
@@ -96,12 +96,12 @@ Sonia.repository.BlamePanel = Ext.extend(Ext.grid.GridPanel, {
onClick: function(e){
var el = e.getTarget('.blame-link');
if ( el != null ){
if ( el !== null ){
var revision = el.rel;
if (debug){
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',
bbar: ['->', this.repository.name, ':', this.revision],
items: [panel]
}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ChangesetPanel.superclass.initComponent.apply(this, arguments);
@@ -99,7 +99,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, {
xtype: 'commitPanel',
repository: this.repository,
revision: this.revision
}
};
},
createDiffPanel: function(){
@@ -108,7 +108,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, {
xtype: 'syntaxHighlighterPanel',
syntax: 'diff',
contentUrl: this.createDiffUrl()
}
};
},
createDiffUrl: function(){
@@ -159,10 +159,10 @@ Sonia.History.register('changesetPanel', {
},
onChange: function(repoId, revision, view){
if (revision == 'null'){
if (revision === 'null'){
revision = null;
}
if (!view || view == 'null'){
if (!view || view === 'null'){
view = 'commit';
}
var id = 'changesetPanel;' + repoId + ';' + revision;
@@ -177,7 +177,7 @@ Sonia.History.register('changesetPanel', {
view: view,
closable: true,
autoScroll: true
}
};
} else {
panel.loadPanel(view);
}

View File

@@ -105,7 +105,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
scope: this
}
}
}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
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){
var authorValue = '';
if ( author != null ){
if ( author !== null ){
authorValue = author.name;
if ( author.mail != null ){
if ( author.mail !== null ){
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);
// }
var date = record.data.date;
if ( date != null ){
if ( date !== null ){
date = Ext.util.Format.formatTimestamp(date);
}
return String.format(
@@ -198,7 +198,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
getLabeledValue: function(label, array){
var result = '';
if ( array != null && array.length > 0 ){
if ( array !== null && array.length > 0 ){
result = label + ': ' + Sonia.util.getStringFromArray(array);
}
return result;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -51,7 +51,7 @@ Sonia.repository.typeIcons = [];
Sonia.repository.getTypeIcon = function(type){
return Sonia.repository.typeIcons[type];
}
};
Sonia.repository.createContentUrl = function(repository, path, revision){
var contentUrl = restUrl + 'repositories/' + repository.id + '/';
@@ -60,7 +60,7 @@ Sonia.repository.createContentUrl = function(repository, path, revision){
contentUrl += "&revision=" + revision;
}
return contentUrl;
}
};
Sonia.repository.createContentId = function(repository, path, revision){
var id = repository.id + '-b-' + path;
@@ -68,11 +68,11 @@ Sonia.repository.createContentId = function(repository, path, revision){
id += '-r-' + revision;
}
return id;
}
};
Sonia.repository.isOwner = function(repository){
return admin || repository.permissions != null;
}
return admin || repository.permissions !== null;
};
Sonia.repository.setEditPanel = function(panels){
var editPanel = Ext.getCmp('repositoryEditPanel');
@@ -82,25 +82,25 @@ Sonia.repository.setEditPanel = function(panels){
});
editPanel.setActiveTab(0);
editPanel.doLayout();
}
};
Sonia.repository.createUrl = function(type, name){
return Sonia.util.getBaseUrl() + '/' + type + '/' + name
}
return Sonia.util.getBaseUrl() + '/' + type + '/' + name;
};
Sonia.repository.createUrlFromObject = function(repository){
return Sonia.repository.createUrl(repository.type, repository.name);
}
};
Sonia.repository.getTypeByName = function(name){
var type = null;
repositoryTypeStore.queryBy(function(rec){
if ( rec.get('name') == name ){
if ( rec.get('name') === name ){
type = rec.data;
}
});
return type;
}
};
/**
* default panel
@@ -112,7 +112,7 @@ Sonia.repository.DefaultPanel = {
xtype: 'panel',
bodyCssClass: 'x-panel-mc',
html: 'Add or select an Repository'
}
};
// 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 name = id.substring(index);
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 ){
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) {
if (colIndex == 0) {
if (colIndex === 0) {
var store = null;
var rec = permissionStore.getAt(rowIndex);
if ( rec.data.groupPermission ){
@@ -121,8 +121,8 @@ Sonia.repository.PermissionFormPanel = Ext.extend(Sonia.repository.FormPanel, {
}
});
if ( this.item != null ){
if ( this.item.permissions == null ){
if ( this.item !== null ){
if ( this.item.permissions === null ){
this.item.permissions = [];
}
this.permissionStore.loadData( this.item );
@@ -213,7 +213,7 @@ Sonia.repository.PermissionFormPanel = Ext.extend(Sonia.repository.FormPanel, {
var permissions = [];
this.permissionStore.data.each(function(record){
permissions.push( record.data );
})
});
item.permissions = permissions;
},

View File

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

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ Sonia.rest.ExceptionHandler = function(proxy, type, action, options, response, a
if (debug){
console.debug('store returned statuscode ' + status);
}
if ( status == 200 && action == 'read' && response.responseText == 'null' ){
if ( status === 200 && action === 'read' && response.responseText === 'null' ){
if ( debug ){
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)
);
}
}
};

View File

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

View File

@@ -30,7 +30,7 @@
*/
// 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
Ext.Ajax.defaultHeaders = {
@@ -102,13 +102,13 @@ Sonia = {
id += this.idSeparator;
}
}
if (id.length() == 0){
if (id.length() === 0){
id = Ext.id();
}
return id;
}
}
};
// the main object (sonia.scm)

View File

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

View File

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

View File

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

View File

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

View File

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