javascript lint cleanup

This commit is contained in:
Adam Young 2011-01-12 14:47:29 -05:00 committed by Endi Sukma Dewata
parent 4da9228fb2
commit b79bf4ab17
19 changed files with 177 additions and 193 deletions

View File

@ -43,8 +43,7 @@ IPA.populate_attribute_table = function (table, entity){
td.append($('<label/>',{ td.append($('<label/>',{
text:aciattrs[a].toLowerCase()})); text:aciattrs[a].toLowerCase()}));
} }
} };
IPA.attribute_table_widget= function (spec){ IPA.attribute_table_widget= function (spec){
var id = spec.name; var id = spec.name;
@ -93,7 +92,7 @@ IPA.attribute_table_widget= function (spec){
} }
return [retval]; return [retval];
} };
var attrs = []; var attrs = [];
that.reset =function(){ that.reset =function(){
@ -101,7 +100,7 @@ IPA.attribute_table_widget= function (spec){
for (var i = 0; i < attrs.length; i+=1){ for (var i = 0; i < attrs.length; i+=1){
$(attrs[i], table).attr('checked','checked'); $(attrs[i], table).attr('checked','checked');
} }
} };
that.load = function(record){ that.load = function(record){
if (!record.attrs) return; if (!record.attrs) return;
@ -110,12 +109,10 @@ IPA.attribute_table_widget= function (spec){
attrs.push('#aciattr-' +record.attrs[i]); attrs.push('#aciattr-' +record.attrs[i]);
} }
that.reset(); that.reset();
} };
return that; return that;
} };
IPA.entity_select_widget = function(spec){ IPA.entity_select_widget = function(spec){
@ -145,7 +142,7 @@ IPA.entity_select_widget = function(spec){
args:[that.entity_filter.val()], args:[that.entity_filter.val()],
options:{}, options:{},
on_success:find_success, on_success:find_success,
on_error:find_error, on_error:find_error
}).execute(); }).execute();
} }
@ -180,24 +177,24 @@ IPA.entity_select_widget = function(spec){
} }
}).appendTo(dd); }).appendTo(dd);
populate_select(); populate_select();
} };
var value = ''; var value = '';
that.reset = function(){ that.reset = function(){
that.entity_filter.val(value ); that.entity_filter.val(value );
populate_select(value); populate_select(value);
} };
that.load = function(record){ that.load = function(record){
value = record[that.name]; value = record[that.name];
that.reset(); that.reset();
} };
that.save = function(){ that.save = function(){
return [$('option:selected', that.entity_select).val()]; return [$('option:selected', that.entity_select).val()];
} };
return that; return that;
} };
IPA.rights_widget = function(spec){ IPA.rights_widget = function(spec){
var rights = ['write','add','delete']; var rights = ['write','add','delete'];
@ -220,7 +217,7 @@ IPA.rights_widget = function(spec){
appendTo(container); appendTo(container);
} }
} };
var values = []; var values = [];
that.reset = function(){ that.reset = function(){
@ -232,18 +229,18 @@ IPA.rights_widget = function(spec){
checkboxes.attr('checked',''); checkboxes.attr('checked','');
} }
for (var i = 0; i < values.length; i +=1){ for (var j = 0; j < values.length; j +=1){
var value = values[i]; var value = values[j];
var cb = $('#'+value+ selector); var cb = $('#'+value+ selector);
cb.attr('checked', 'checked'); cb.attr('checked', 'checked');
} }
} };
that.load = function(record) { that.load = function(record) {
values = record[that.name] || []; values = record[that.name] || [];
that.reset(); that.reset();
} };
that.save = function(){ that.save = function(){
var rights_input = $('.'+ that.entity_name +"_"+ that.name); var rights_input = $('.'+ that.entity_name +"_"+ that.name);
@ -255,10 +252,10 @@ IPA.rights_widget = function(spec){
retval += rights_input[i].value; retval += rights_input[i].value;
} }
return [retval]; return [retval];
} };
return that; return that;
} };
IPA.hidden_widget = function(spec){ IPA.hidden_widget = function(spec){
spec.label = ''; spec.label = '';
@ -272,22 +269,22 @@ IPA.hidden_widget = function(spec){
value: value value: value
}). }).
appendTo(container); appendTo(container);
} };
that.save = function(){ that.save = function(){
return [value]; return [value];
} };
that.reset = function(){ that.reset = function(){
} };
return that; return that;
} };
function ipa_rights_section() { function ipa_rights_section() {
var spec = {'name':'rights', var spec = {
'label': 'Rights'} 'name':'rights',
'label': 'Rights'
};
var that = ipa_details_section(spec); var that = ipa_details_section(spec);
that.add_field(IPA.rights_widget({name:'permissions'})); that.add_field(IPA.rights_widget({name:'permissions'}));
@ -295,8 +292,10 @@ function ipa_rights_section() {
} }
function ipa_target_section() { function ipa_target_section() {
var spec = {'name':'target', var spec = {
'label': 'Target'} 'name':'target',
'label': 'Target'
};
var that = ipa_details_section(spec); var that = ipa_details_section(spec);
var groupings = ['aci_by_type', 'aci_by_query', 'aci_by_group', var groupings = ['aci_by_type', 'aci_by_query', 'aci_by_group',
@ -321,14 +320,14 @@ function ipa_target_section() {
function display_filter_target(dl){ function display_filter_target(dl){
$("<dt/>"). $("<dt/>").
append($("<label/>",{ append($("<label/>",{
text: "Filter", text: "Filter" })).
})).
append($('<input/>',{ append($('<input/>',{
type:"radio", type:"radio",
name:"type", name:"type",
checked:"true", checked:"true",
id:"aci_by_filter" id:"aci_by_filter"
})).appendTo(dl); })).
appendTo(dl);
$('<dd/>',{ $('<dd/>',{
'class': 'aci_by_filter first'}). 'class': 'aci_by_filter first'}).
@ -345,18 +344,17 @@ function ipa_target_section() {
function display_type_target(dl){ function display_type_target(dl){
$("<dt/>"). $("<dt/>").
append($("<label/>",{ append($("<label/>",{
text: "Object By Type ", text: "Object By Type " })).
})).
append($('<input/>',{ append($('<input/>',{
type:"radio", type:"radio",
name:"type", name:"type",
checked:"true", checked:"true",
id:"aci_by_type" id:"aci_by_type" })).
})).appendTo(dl); appendTo(dl);
var dd = $('<dd/>',{ var dd = $('<dd/>',{
"class":"aci_by_type first", "class":"aci_by_type first" }).
}).appendTo(dl); appendTo(dl);
var type_select = $('<select/>', { var type_select = $('<select/>', {
id: 'object_type_select', id: 'object_type_select',
@ -435,8 +433,7 @@ function ipa_target_section() {
that.group_filter = $('<input/>',{ that.group_filter = $('<input/>',{
type: 'text', type: 'text',
id: 'group_filter', id: 'group_filter' });
});
that.group_select = $('<select/>', { that.group_select = $('<select/>', {
id: 'aci_target_group_select', id: 'aci_target_group_select',
change: function(){ change: function(){
@ -495,8 +492,7 @@ function ipa_target_section() {
}; };
that.setup = function(container) { that.setup = function(container) {
};
}
that.load = function(result) { that.load = function(result) {
if(result.subtree){ if(result.subtree){
@ -527,8 +523,7 @@ function ipa_target_section() {
}else{ }else{
alert('permission with invalid target specification'); alert('permission with invalid target specification');
} }
};
}
that.reset = function() { that.reset = function() {
}; };
@ -559,9 +554,7 @@ function ipa_target_section() {
} }
record.attributes += id; record.attributes += id;
}); });
} };
return that; return that;
} }
@ -639,8 +632,7 @@ function ipa_permission_search_facet(spec) {
that.create_column({name:'cn'}); that.create_column({name:'cn'});
that.create_column({name:'description'}); that.create_column({name:'description'});
that.search_facet_init(); that.search_facet_init();
} };
return that; return that;
} }
@ -673,13 +665,12 @@ function ipa_permission_details_facet() {
that.load = function(result) { that.load = function(result) {
that.superior_load(result); that.superior_load(result);
} };
that.superior_update = that.update; that.superior_update = that.update;
that.update = function(on_win, on_fail){ that.update = function(on_win, on_fail){
that.superior_update(on_win, on_fail); that.superior_update(on_win, on_fail);
} };
return that; return that;
} }
@ -781,7 +772,7 @@ IPA.add_entity( function() {
that.init = function() { that.init = function() {
that.create_column({name:'aciname'}); that.create_column({name:'aciname'});
that.search_facet_init(); that.search_facet_init();
} };
return that; return that;
}()); }());
@ -796,13 +787,8 @@ IPA.add_entity( function() {
custom_input(IPA.attribute_table_widget({ custom_input(IPA.attribute_table_widget({
object_type:'user', object_type:'user',
name:'attrs' name:'attrs'
})) })));
); };
}
return that; return that;
}()); }());
@ -821,8 +807,7 @@ IPA.add_entity( function() {
name:'attrs' name:'attrs'
})); }));
dialog.init(); dialog.init();
} };
return that; return that;
}()); }());
@ -841,7 +826,7 @@ IPA.add_entity( function() {
that.init = function() { that.init = function() {
that.create_column({name:'aciname'}); that.create_column({name:'aciname'});
that.search_facet_init(); that.search_facet_init();
} };
return that; return that;
}()); }());
that.add_facet(function(){ that.add_facet(function(){
@ -881,7 +866,7 @@ IPA.add_entity( function() {
dialog.init(); dialog.init();
that.create_association_facets(); that.create_association_facets();
} };
return that; return that;
}()); }());

View File

@ -77,8 +77,7 @@ function serial_associator(spec) {
options, options,
that.execute, that.execute,
that.on_error, that.on_error,
that.other_entity that.other_entity);
);
}; };
return that; return that;
@ -121,8 +120,7 @@ function bulk_associator(spec) {
options, options,
that.on_success, that.on_success,
that.on_error, that.on_error,
that.entity_name that.entity_name);
);
}; };
return that; return that;
@ -293,7 +291,7 @@ function ipa_association_table_widget(spec) {
var entity = IPA.get_entity(that.entity_name); var entity = IPA.get_entity(that.entity_name);
var association = entity.get_association(that.other_entity); var association = entity.get_association(that.other_entity);
var column;
if (association) { if (association) {
if (association.associator) { if (association.associator) {
that.associator = association.associator == 'serial' ? serial_associator : bulk_associator; that.associator = association.associator == 'serial' ? serial_associator : bulk_associator;
@ -313,12 +311,12 @@ function ipa_association_table_widget(spec) {
} }
for (var i=0; i<that.columns.length; i++) { for (var i=0; i<that.columns.length; i++) {
var column = that.columns[i]; column = that.columns[i];
column.entity_name = that.other_entity; column.entity_name = that.other_entity;
} }
for (var i=0; i<that.adder_columns.length; i++) { for (var j=0; j<that.adder_columns.length; j++) {
var column = that.adder_columns[i]; column = that.adder_columns[j];
column.entity_name = that.other_entity; column.entity_name = that.other_entity;
} }
@ -353,8 +351,11 @@ function ipa_association_table_widget(spec) {
'label': button.val(), 'label': button.val(),
'icon': 'ui-icon-trash', 'icon': 'ui-icon-trash',
'click': function() { 'click': function() {
if ($(this).hasClass('action-button-disabled')) return false; if ($(this).hasClass('action-button-disabled')) {
return false;
}
that.show_remove_dialog(); that.show_remove_dialog();
return false;
} }
})); }));
@ -365,6 +366,7 @@ function ipa_association_table_widget(spec) {
'click': function() { 'click': function() {
if ($(this).hasClass('action-button-disabled')) return false; if ($(this).hasClass('action-button-disabled')) return false;
that.show_add_dialog(); that.show_add_dialog();
return false;
} }
})); }));
}; };
@ -446,7 +448,7 @@ function ipa_association_table_widget(spec) {
'entity_name': that.entity_name, 'entity_name': that.entity_name,
'pkey': pkey, 'pkey': pkey,
'other_entity': that.other_entity, 'other_entity': that.other_entity,
'attribute_member': that.attribute_member, 'attribute_member': that.attribute_member
}); });
}; };
@ -610,6 +612,8 @@ function ipa_association_facet(spec) {
var entity = IPA.get_entity(that.entity_name); var entity = IPA.get_entity(that.entity_name);
var association = entity.get_association(that.other_entity); var association = entity.get_association(that.other_entity);
var column;
var i;
if (association) { if (association) {
if (association.associator) { if (association.associator) {
@ -636,7 +640,7 @@ function ipa_association_facet(spec) {
} else { } else {
var column = that.table.create_column({ column = that.table.create_column({
name: that.table.name, name: that.table.name,
label: IPA.metadata[that.other_entity].label, label: IPA.metadata[that.other_entity].label,
primary_key: true primary_key: true
@ -658,19 +662,19 @@ function ipa_association_facet(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };
} }
for (var i=0; i<that.columns.length; i++) { for (i=0; i<that.columns.length; i++) {
var column = that.columns[i]; column = that.columns[i];
column.entity_name = that.other_entity; column.entity_name = that.other_entity;
} }
for (var i=0; i<that.adder_columns.length; i++) { for (i=0; i<that.adder_columns.length; i++) {
var column = that.adder_columns[i]; column = that.adder_columns[i];
column.entity_name = that.other_entity; column.entity_name = that.other_entity;
} }
@ -752,7 +756,7 @@ function ipa_association_facet(spec) {
button.replaceWith(IPA.action_button({ button.replaceWith(IPA.action_button({
'label': button.val(), 'label': button.val(),
'icon': 'ui-icon-plus', 'icon': 'ui-icon-plus',
'click': function() { that.show_add_dialog() } 'click': function() { that.show_add_dialog(); }
})); }));
}; };
@ -767,7 +771,7 @@ function ipa_association_facet(spec) {
'entity_name': that.entity_name, 'entity_name': that.entity_name,
'pkey': pkey, 'pkey': pkey,
'other_entity': that.other_entity, 'other_entity': that.other_entity,
'attribute_member': that.attribute_member, 'attribute_member': that.attribute_member
}); });
if (that.adder_columns.length) { if (that.adder_columns.length) {

View File

@ -89,8 +89,7 @@ function certificate_get_dialog(spec) {
textarea.val( textarea.val(
BEGIN_CERTIFICATE+'\n'+ BEGIN_CERTIFICATE+'\n'+
that.usercertificate+'\n'+ that.usercertificate+'\n'+
END_CERTIFICATE END_CERTIFICATE );
);
that.open = function() { that.open = function() {
dialog.dialog({ dialog.dialog({

View File

@ -524,17 +524,15 @@ function ipa_details_facet(spec) {
var header = $('h2[name='+section.name+']', that.container); var header = $('h2[name='+section.name+']', that.container);
var div = $( var div = $('#'+that.entity_name+'-'+that.name+'-'+section.name,
'#'+that.entity_name+'-'+that.name+'-'+section.name, that.container);
that.container
);
header.click(function(section, header, div) { header.click(function(section, header, div) {
return function() { return function() {
var visible = div.is(":visible"); var visible = div.is(":visible");
header.html(that.get_section_header_prefix(!visible) + ' ' + section.label); header.html(that.get_section_header_prefix(!visible) + ' ' + section.label);
div.slideToggle(); div.slideToggle();
} };
}(section, header, div)); }(section, header, div));
section.setup(div); section.setup(div);
@ -573,7 +571,7 @@ IPA.action_button = function(spec) {
var button = ipa_button(spec); var button = ipa_button(spec);
button.removeClass("ui-state-default").addClass("action-button"); button.removeClass("ui-state-default").addClass("action-button");
return button; return button;
} };
function ipa_button(spec) { function ipa_button(spec) {
@ -613,9 +611,8 @@ function ipa_details_refresh() {
var params = []; var params = [];
if (that.pkey) params.push(that.pkey); if (that.pkey) params.push(that.pkey);
ipa_cmd( ipa_cmd( 'show', params, {all: true, rights: true}, on_success, on_failure,
'show', params, {all: true, rights: true}, on_success, on_failure, that.entity_name that.entity_name );
);
} }
function ipa_details_update(on_win, on_fail) function ipa_details_update(on_win, on_fail)
@ -687,8 +684,9 @@ function ipa_details_update(on_win, on_fail)
for (attr in attrs_wo_option) { for (attr in attrs_wo_option) {
values = attrs_wo_option[attr]; values = attrs_wo_option[attr];
modlist['setattr'].push(attr + '=' + values[0]); modlist['setattr'].push(attr + '=' + values[0]);
for (var i = 1; i < values.length; ++i) for (var k = 1; k < values.length; ++k){
modlist['addattr'].push(attr + '=' + values[i]); modlist['addattr'].push(attr + '=' + values[k]);
}
} }
ipa_cmd('mod', [pkey], modlist, update_on_win, null, entity_name); ipa_cmd('mod', [pkey], modlist, update_on_win, null, entity_name);
@ -724,7 +722,7 @@ function ipa_insert_first_dd(jobj, content){
function ipa_insert_dd(jobj, content, dd_class){ function ipa_insert_dd(jobj, content, dd_class){
jobj.after( $('<dd/>',{ jobj.after( $('<dd/>',{
"class": dd_class "class": dd_class
}).append(content)) }).append(content));
} }
@ -757,8 +755,9 @@ function ipa_details_field_create_input(value,hint,rights, index)
}else if (param_info['primary_key'] || }else if (param_info['primary_key'] ||
('no_update' in param_info['flags'])){ ('no_update' in param_info['flags'])){
/* check if the param value can be modified */ /* check if the param value can be modified */
/* THis is currently a no-op, as we use this logic for the /* This is currently a no-op, as we use this logic for the
default case as well */ default case as well */
return input;
}else{ }else{
/* call handler by param class */ /* call handler by param class */
var handler = _ipa_param_type_2_handler_map[param_info['class']]; var handler = _ipa_param_type_2_handler_map[param_info['class']];
@ -791,7 +790,7 @@ function _ipa_create_remove_link(attr, param_info)
return $('<a/>',{ return $('<a/>',{
href:"jslink", href:"jslink",
click: function (){return (_ipa_remove_on_click(this))}, click: function (){return (_ipa_remove_on_click(this));},
title: attr, title: attr,
text: 'Remove'}); text: 'Remove'});

View File

@ -141,8 +141,7 @@ function ipa_entity(spec) {
if (!attribute_member) { if (!attribute_member) {
attribute_member = ipa_get_member_attribute( attribute_member = ipa_get_member_attribute(
that.entity_name, other_entity that.entity_name, other_entity);
);
} }
return ipa_association_facet({ return ipa_association_facet({
@ -150,7 +149,7 @@ function ipa_entity(spec) {
'label': label, 'label': label,
'other_entity': other_entity, 'other_entity': other_entity,
'facet_group': facet_group, 'facet_group': facet_group,
'attribute_member': attribute_member, 'attribute_member': attribute_member
}); });
}; };
@ -180,8 +179,7 @@ function ipa_entity(spec) {
var facet_group = relationship[0]; var facet_group = relationship[0];
var facet = that.create_association_facet( var facet = that.create_association_facet(
attribute_member, other_entity, label, facet_group attribute_member, other_entity, label, facet_group);
);
if (that.get_facet(facet.name)) continue; if (that.get_facet(facet.name)) continue;
@ -386,6 +384,8 @@ function ipa_entity_setup(container) {
IPA.nested_tabs = function(entity_name){ IPA.nested_tabs = function(entity_name){
var siblings = []; var siblings = [];
var nested_index;
var nested_entities;
if (!IPA.tab_set) { if (!IPA.tab_set) {
siblings.push(entity_name); siblings.push(entity_name);
@ -403,17 +403,17 @@ IPA.nested_tabs = function(entity_name){
if (top_tab.children[subtab_index].name === entity_name){ if (top_tab.children[subtab_index].name === entity_name){
siblings.push(entity_name); siblings.push(entity_name);
if (top_tab.children[subtab_index].children){ if (top_tab.children[subtab_index].children){
var nested_entities = top_tab.children[subtab_index].children; nested_entities = top_tab.children[subtab_index].children;
for (var nested_index = 0; for ( nested_index = 0;
nested_index < nested_entities.length; nested_index < nested_entities.length;
nested_index += 1){ nested_index += 1){
siblings.push (nested_entities[nested_index].name); siblings.push (nested_entities[nested_index].name);
} }
} }
}else{ }else{
if (top_tab.children[subtab_index].children){ if (top_tab.children[subtab_index].children){
var nested_entities = top_tab.children[subtab_index].children; nested_entities = top_tab.children[subtab_index].children;
for (var nested_index = 0; for (nested_index = 0;
nested_index < nested_entities.length; nested_index < nested_entities.length;
nested_index += 1){ nested_index += 1){
if (nested_entities[nested_index].name === entity_name){ if (nested_entities[nested_index].name === entity_name){
@ -431,7 +431,7 @@ IPA.nested_tabs = function(entity_name){
} }
} }
return siblings; return siblings;
} };
@ -478,7 +478,7 @@ function ipa_facet_create_action_panel(container) {
var other_facet = entity.facets[0]; var other_facet = entity.facets[0];
var other_facet_name = other_facet.name; var other_facet_name = other_facet.name;
var nested_tabs = IPA.nested_tabs(entity_name); var nested_tabs = IPA.nested_tabs(entity_name);
var main_facet = build_link(other_facet,other_facet.label) var main_facet = build_link(other_facet,other_facet.label);
for (var nested_index = 0 ; for (var nested_index = 0 ;
nested_index < nested_tabs.length; nested_index < nested_tabs.length;
nested_index += 1){ nested_index += 1){
@ -494,15 +494,17 @@ function ipa_facet_create_action_panel(container) {
main_facet.html( main_facet.html(
$('<span />',{ $('<span />',{
"class":"input_link" "class":"input_link"
}).append( }).
$('<span/>',{ append(
"class":"ui-icon ui-icon-triangle-1-w " $('<span/>',{
}) "class":"ui-icon ui-icon-triangle-1-w "
).append('Back to List ')); })).
append('Back to List '));
main_facet.appendTo(ul); main_facet.appendTo(ul);
} }
} }
var facet_groups = {}; var facet_groups = {};
var li;
for (var i=1; i<entity.facets.length; i++) { for (var i=1; i<entity.facets.length; i++) {
other_facet = entity.facets[i]; other_facet = entity.facets[i];
other_facet_name = other_facet.name; other_facet_name = other_facet.name;
@ -510,16 +512,16 @@ function ipa_facet_create_action_panel(container) {
if (other_facet.facet_group) { if (other_facet.facet_group) {
var facet_group = other_facet.facet_group; var facet_group = other_facet.facet_group;
if (!facet_groups[facet_group]) { if (!facet_groups[facet_group]) {
var li = $('<li/>', { li = $('<li/>', {
'class': 'entity-facet-relation-label', 'class': 'entity-facet-relation-label',
'text': other_facet.facet_group, 'text': other_facet.facet_group,
'title': other_facet.facet_group, 'title': other_facet.facet_group
}) });
ul.append(li); ul.append(li);
facet_groups[facet_group] = li; facet_groups[facet_group] = li;
} }
var li = facet_groups[facet_group]; li = facet_groups[facet_group];
var link = build_link(other_facet, other_facet.label) var link = build_link(other_facet, other_facet.label);
link.addClass('facet-group-member'); link.addClass('facet-group-member');
li.after(link ); li.after(link );
/* /*
@ -538,10 +540,9 @@ function ipa_facet_create_action_panel(container) {
})})). })})).
append($('<li/>',{ append($('<li/>',{
html:$('<span />',{ html:$('<span />',{
class:"action-controls" 'class':"action-controls"
}) })
})) })));
);
} }
facet_groups[facet_group] = li.next(); facet_groups[facet_group] = li.next();
} else { } else {

View File

@ -167,7 +167,7 @@ function ipa_group_member_user_facet(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -475,11 +475,10 @@ function ipa_hbacrule_details_facet(spec) {
// use setattr/addattr if param_info not available // use setattr/addattr if param_info not available
if (!param_info) { if (!param_info) {
for (var k=0; k<values.length; k++) { for (var l=0; l<values.length; l++) {
modify_operation.command.set_option( modify_operation.command.set_option(
k == 0 ? 'setattr' : 'addattr', l === 0 ? 'setattr' : 'addattr',
field.name+'='+values[k] field.name+'='+values[l]);
);
modify_operation.execute = true; modify_operation.execute = true;
} }
continue; continue;
@ -774,7 +773,7 @@ function ipa_hbacrule_accesstime_widget(spec) {
button.replaceWith(ipa_button({ button.replaceWith(ipa_button({
'label': button.val(), 'label': button.val(),
'icon': 'ui-icon-plus', 'icon': 'ui-icon-plus',
'click': function() { that.add(that.container) } 'click': function() { that.add(that.container); }
})); }));
var input = $('input[name="'+that.name+'"]', that.container); var input = $('input[name="'+that.name+'"]', that.container);
@ -790,7 +789,7 @@ function ipa_hbacrule_accesstime_widget(spec) {
that.save = function() { that.save = function() {
var value = $('input[name="'+that.name+'"]:checked', that.container).val(); var value = $('input[name="'+that.name+'"]:checked', that.container).val();
if (value == '') { if (value === '') {
return that.table.save(); return that.table.save();
} else { } else {
return []; return [];

View File

@ -164,7 +164,7 @@ function ipa_hbacsvcgroup_member_hbacsvc_table_widget(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -406,7 +406,7 @@ function host_certificate_status_widget(spec) {
that.get_entity_certificate = function(result) { that.get_entity_certificate = function(result) {
var values = result['usercertificate']; var values = result['usercertificate'];
return values ? values[0].__base64__ : null; return values ? values[0].__base64__ : null;
} };
}; };
return that; return that;
@ -444,7 +444,7 @@ function ipa_host_managedby_host_facet(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -30,7 +30,7 @@ var IPA = ( function () {
that.use_static_files = false; that.use_static_files = false;
that.json_url = '/ipa/json'; that.json_url = '/ipa/json';
if (that.use_static_files){ if (that.use_static_files){
that.json_url = 'test/data' that.json_url = 'test/data';
} }
that.ajax_options = { that.ajax_options = {
@ -98,8 +98,7 @@ var IPA = ( function () {
}, },
on_error, on_error,
null, null,
'ipa_init' 'ipa_init');
);
}; };
that.get_entities = function () { that.get_entities = function () {
@ -172,8 +171,7 @@ function ipa_command(spec) {
that.on_success, that.on_success,
that.on_error, that.on_error,
null, null,
that.name that.name);
);
}; };
that.to_json = function() { that.to_json = function() {
@ -263,11 +261,12 @@ function ipa_batch_command(spec) {
}, },
function(xhr, text_status, error_thrown) { function(xhr, text_status, error_thrown) {
// TODO: undefined behavior // TODO: undefined behavior
if (that.on_error) that.on_error(xhr, text_status, error_thrown) if (that.on_error) {
that.on_error(xhr, text_status, error_thrown);
}
}, },
null, null,
that.name that.name);
);
}; };
return that; return that;
@ -319,7 +318,7 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname, comm
error_thrown = { error_thrown = {
name: xhr.responseText || 'Unknown Error', name: xhr.responseText || 'Unknown Error',
message: xhr.statusText || 'Unknown Error' message: xhr.statusText || 'Unknown Error'
} };
} }
if (xhr.status === 401) { if (xhr.status === 401) {
@ -332,7 +331,7 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname, comm
"Please run kinit and then click 'retry'. "+ "Please run kinit and then click 'retry'. "+
"If this is your first time running the IPA Web UI "+ "If this is your first time running the IPA Web UI "+
"<a href='/ipa/config/unauthorized.html'>"+ "<a href='/ipa/config/unauthorized.html'>"+
"follow these directions</a> to configure your browser." "follow these directions</a> to configure your browser.";
} }
} }

View File

@ -147,8 +147,6 @@ function ipa_records_facet(spec){
var options = {}; var options = {};
function add_win(data, text_status, xhr) { function add_win(data, text_status, xhr) {
reload(); reload();
if (called_from_add_and_edit) {
}
} }
function add_fail(data, text_status, xhr) { function add_fail(data, text_status, xhr) {
@ -220,7 +218,7 @@ function ipa_records_facet(spec){
var type = $(tr).find('[title="type"]'). var type = $(tr).find('[title="type"]').
text().toLowerCase(); text().toLowerCase();
var data = $(tr).find('[title="data"]').text(); var data = $(tr).find('[title="data"]').text();
var rectype=type+"record" var rectype=type+"record";
var options = {}; var options = {};
options[rectype]=data; options[rectype]=data;
@ -253,9 +251,9 @@ function ipa_records_facet(spec){
} }
if (delete_list.length == 0) if (delete_list.length === 0){
return; return;
}
delete_dialog.append($('<P/>', delete_dialog.append($('<P/>',
{text: IPA.messages.search.delete_confirm})); {text: IPA.messages.search.delete_confirm}));
@ -296,8 +294,8 @@ function ipa_records_facet(spec){
}).appendTo(that.container); }).appendTo(that.container);
var div = $('<div class="search-controls"></div>') var div = $('<div class="search-controls"></div>').
.appendTo(that.container); appendTo(that.container);
var control_span =$('<span class="record-filter"></span>').appendTo(div); var control_span =$('<span class="record-filter"></span>').appendTo(div);
@ -324,7 +322,7 @@ function ipa_records_facet(spec){
ipa_button({ ipa_button({
'label': IPA.messages.button.find, 'label': IPA.messages.button.find,
'icon': 'ui-icon-search', 'icon': 'ui-icon-search',
'click': function(){refresh()} 'click': function(){refresh();}
}).appendTo(control_span); }).appendTo(control_span);
var action_panel_ul = $('.action-panel ul', that.container); var action_panel_ul = $('.action-panel ul', that.container);
@ -367,8 +365,7 @@ function ipa_records_facet(spec){
tbody.find("INPUT[type='checkbox']"). tbody.find("INPUT[type='checkbox']").
attr('checked', this.checked); attr('checked', this.checked);
} }
}) })));
));
tr.append($('<th/>',{ tr.append($('<th/>',{
text: ipa_get_param_info("dnsrecord", "idnsname").label })); text: ipa_get_param_info("dnsrecord", "idnsname").label }));
tr.append($('<th>Record Type</th>')); tr.append($('<th>Record Type</th>'));
@ -395,8 +392,8 @@ function ipa_records_facet(spec){
var options = {}; var options = {};
var resource_filter = that.container.find("#dns-record-resource-filter") var resource_filter = that.container.
.val(); find("#dns-record-resource-filter").val();
if (resource_filter){ if (resource_filter){
options.idnsname = resource_filter; options.idnsname = resource_filter;
} }
@ -475,8 +472,7 @@ function ipa_records_facet(spec){
if (data.result.truncated) { if (data.result.truncated) {
tfoot.text( tfoot.text(
'Query returned results than configured size limit will show.' + 'Query returned results than configured size limit will show.' +
'First ' + data.result.count + ' results shown.' 'First ' + data.result.count + ' results shown.' );
);
} else { } else {
tfoot.text(data.result.summary); tfoot.text(data.result.summary);
} }
@ -529,7 +525,7 @@ IPA.add_entity(function (){
that.create_association_facets(); that.create_association_facets();
that.entity_init(); that.entity_init();
} };
return that; return that;
}()); }());

View File

@ -70,8 +70,8 @@ function ipa_rule_details_section(spec){
span.append('<br/>'); span.append('<br/>');
} }
for (var i=0; i<that.tables.length; i++) { for (var j=0; i<that.tables.length; i++) {
var table = that.tables[i]; var table = that.tables[j];
param_info = ipa_get_param_info(that.entity_name, table.field_name); param_info = ipa_get_param_info(that.entity_name, table.field_name);
@ -91,7 +91,7 @@ function ipa_rule_details_section(spec){
function update_tables(value) { function update_tables(value) {
var enabled = '' == value; var enabled = ('' === value);
for (var i=0; i<that.tables.length; i++) { for (var i=0; i<that.tables.length; i++) {
var table = that.tables[i]; var table = that.tables[i];
@ -105,7 +105,9 @@ function ipa_rule_details_section(spec){
category.reset = function() { category.reset = function() {
category.widget_reset(); category.widget_reset();
var values = category.save(); var values = category.save();
if (values.length == 0) return; if (values.length === 0){
return;
}
var value = values[0]; var value = values[0];
update_tables(value); update_tables(value);
}; };

View File

@ -222,9 +222,9 @@ function ipa_search_widget(spec) {
var summary = $('span[name=summary]', that.tfoot); var summary = $('span[name=summary]', that.tfoot);
if (data.result.truncated) { if (data.result.truncated) {
summary.text( summary.text(
'Query returned results than configured size limit will show.' + 'Query returned more results than configured size limit '+
'First ' + data.result.count + ' results shown.' 'will show. First ' +
); data.result.count + ' results shown.');
} else { } else {
summary.text(data.result.summary); summary.text(data.result.summary);
} }
@ -239,8 +239,8 @@ function ipa_search_widget(spec) {
var filter = $.bbq.getState(that.entity_name + '-filter', true) || ''; var filter = $.bbq.getState(that.entity_name + '-filter', true) || '';
ipa_cmd( ipa_cmd(
'find', [filter], {all: true}, on_success, on_error, that.entity_name 'find', [filter], {all: true}, on_success, on_error,
); that.entity_name);
}; };
return that; return that;
@ -311,7 +311,7 @@ function ipa_search_facet(spec) {
state[that.entity_name + '-pkey'] = value; state[that.entity_name + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -427,7 +427,7 @@ function ipa_service_managedby_host_facet(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -149,7 +149,6 @@ function ipa_sudocmd_member_sudocmdgroup_table_widget(spec) {
$('<a/>', { $('<a/>', {
'href': '#'+value, 'href': '#'+value,
'html': value,
'click': function (value) { 'click': function (value) {
return function() { return function() {
var state = IPA.tab_state(that.other_entity); var state = IPA.tab_state(that.other_entity);
@ -157,8 +156,9 @@ function ipa_sudocmd_member_sudocmdgroup_table_widget(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value),
'html': value
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -163,7 +163,7 @@ function ipa_sudocmdgroup_member_sudocmd_table_widget(spec) {
state[that.other_entity + '-pkey'] = value; state[that.other_entity + '-pkey'] = value;
$.bbq.pushState(state); $.bbq.pushState(state);
return false; return false;
} };
}(value) }(value)
}).appendTo(container); }).appendTo(container);
}; };

View File

@ -326,9 +326,8 @@ function ipa_sudorule_details_facet(spec) {
if (!param_info) { if (!param_info) {
for (var k=0; k<values.length; k++) { for (var k=0; k<values.length; k++) {
modify_operation.command.set_option( modify_operation.command.set_option(
k == 0 ? 'setattr' : 'addattr', k === 0 ? 'setattr' : 'addattr',
field.name+'='+values[k] field.name+'='+values[k]);
);
modify_operation.execute = true; modify_operation.execute = true;
} }
continue; continue;
@ -639,7 +638,7 @@ function ipa_sudorule_details_command_section(spec){
function update_tables(value) { function update_tables(value) {
var enabled = '' == value; var enabled = ('' === value);
var field = that.get_field('memberallowcmd_sudocmd'); var field = that.get_field('memberallowcmd_sudocmd');
field.set_enabled(enabled); field.set_enabled(enabled);
@ -652,7 +651,7 @@ function ipa_sudorule_details_command_section(spec){
cmdcategory.reset = function() { cmdcategory.reset = function() {
cmdcategory.widget_reset(); cmdcategory.widget_reset();
var values = cmdcategory.save(); var values = cmdcategory.save();
if (values.length == 0) return; if (values.length === 0) return;
var value = values[0]; var value = values[0];
update_tables(value); update_tables(value);
}; };
@ -807,7 +806,7 @@ function ipa_sudorule_details_runas_section(spec){
function user_update_tables(value) { function user_update_tables(value) {
var enabled = '' == value; var enabled = ('' === value);
var field = that.get_field('ipasudorunas_user'); var field = that.get_field('ipasudorunas_user');
field.set_enabled(enabled); field.set_enabled(enabled);
@ -820,7 +819,7 @@ function ipa_sudorule_details_runas_section(spec){
user_category.reset = function() { user_category.reset = function() {
user_category.widget_reset(); user_category.widget_reset();
var values = user_category.save(); var values = user_category.save();
if (values.length == 0) return; if (values.length === 0) return;
var value = values[0]; var value = values[0];
user_update_tables(value); user_update_tables(value);
}; };
@ -834,7 +833,7 @@ function ipa_sudorule_details_runas_section(spec){
function group_update_tables(value) { function group_update_tables(value) {
var enabled = '' == value; var enabled = ('' === value);
var field = that.get_field('ipasudorunasgroup_group'); var field = that.get_field('ipasudorunasgroup_group');
field.set_enabled(enabled); field.set_enabled(enabled);
@ -844,7 +843,7 @@ function ipa_sudorule_details_runas_section(spec){
group_category.reset = function() { group_category.reset = function() {
group_category.widget_reset(); group_category.widget_reset();
var values = group_category.save(); var values = group_category.save();
if (values.length == 0) return; if (values.length === 0) return;
var value = values[0]; var value = values[0];
group_update_tables(value); group_update_tables(value);
}; };

View File

@ -94,8 +94,9 @@ IPA.tab_state = function(entity_name){
} }
} }
} }
} /*should never reach here*/
return null;
};
/* main (document onready event handler) */ /* main (document onready event handler) */

View File

@ -597,7 +597,7 @@ function ipa_table_widget(spec) {
if (that.scrollable && (i == that.columns.length-1)) { if (that.scrollable && (i == that.columns.length-1)) {
if (column.width) { if (column.width) {
var width = parseInt(column.width.substring(0, column.width.length-2)); var width = parseInt(column.width.substring(0, column.width.length-2),10);
width += 16; width += 16;
th.css('width', width+'px'); th.css('width', width+'px');
} }
@ -640,8 +640,8 @@ function ipa_table_widget(spec) {
'value': 'user' 'value': 'user'
}).appendTo(td); }).appendTo(td);
for (var i=0; i<that.columns.length; i++) { for (/* var */ i=0; i<that.columns.length; i++) {
var column = that.columns[i]; /* var */ column = that.columns[i];
td = $('<td/>').appendTo(tr); td = $('<td/>').appendTo(tr);
if (column.width) { if (column.width) {
@ -1093,12 +1093,12 @@ function ipa_adder_dialog(spec) {
name: 'hidememb', name: 'hidememb',
id: 'hidememb', id: 'hidememb',
checked: 'checked', checked: 'checked',
style: 'margin-left: 5px; vertical-align: middle', style: 'margin-left: 5px; vertical-align: middle'
}).appendTo(search_panel); }).appendTo(search_panel);
var label = $('<label/>', { var label = $('<label/>', {
'for': 'hidememb', 'for': 'hidememb',
style: 'margin-left: 3px', style: 'margin-left: 3px'
}); });
label.text('Hide already enrolled.'); label.text('Hide already enrolled.');