super to superior

This commit is contained in:
Adam Young 2010-11-12 20:51:15 -05:00 committed by Endi Sukma Dewata
parent 828f87e4a6
commit 59a0c17c54
12 changed files with 81 additions and 190 deletions

View File

@ -94,7 +94,7 @@ function ipa_add_dialog(spec) {
ipa_cmd('add', args, options, on_success, on_error, that.entity_name);
};
that.super_init = that.super('init');
that.superior_init = that.superior('init');
return that;
}

View File

@ -243,8 +243,8 @@ function ipa_association_widget(spec) {
that.other_entity = spec.other_entity;
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.create = function(container) {
@ -256,7 +256,7 @@ function ipa_association_widget(spec) {
'primary_key': true
});
that.super_create(container);
that.superior_create(container);
var div = $('#'+that.id, container);
var buttons = $('span[name=buttons]', div);
@ -276,7 +276,7 @@ function ipa_association_widget(spec) {
that.setup = function(container) {
that.super_setup(container);
that.superior_setup(container);
var entity = IPA.get_entity(that.entity_name);
var association = entity.get_association(that.other_entity);

View File

@ -168,7 +168,7 @@ function ipa_details_section(spec){
that.fields = [];
that.fields_by_name = {};
that.super = function(name) {
that.superior = function(name) {
var method = that[name];
return function () {
return method.apply(that, arguments);

View File

@ -45,7 +45,7 @@ function ipa_facet(spec) {
that.setup_views = ipa_facet_setup_views;
that.super = function(name) {
that.superior = function(name) {
var method = that[name];
return function () {
return method.apply(that, arguments);
@ -88,7 +88,7 @@ function ipa_entity(spec) {
that.associations = [];
that.associations_by_name = {};
that.super = function(name) {
that.superior = function(name) {
var method = that[name];
return function () {
return method.apply(that, arguments);

View File

@ -26,7 +26,7 @@ function ipa_group() {
'name': 'group'
});
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -37,7 +37,7 @@ function ipa_group() {
that.add_dialog(dialog);
dialog.init();
that.super_init();
that.superior_init();
};
return that;
@ -51,11 +51,11 @@ function ipa_group_add_dialog(spec) {
var that = ipa_add_dialog(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
this.super_init();
this.superior_init();
this.add_field(ipa_text_widget({name:'cn', label:'Name'}));
this.add_field(ipa_text_widget({name:'description', label:'Description'}));

View File

@ -26,7 +26,7 @@ function ipa_hbac() {
'name': 'hbac'
});
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -49,7 +49,7 @@ function ipa_hbac() {
});
that.add_facet(facet);
that.super_init();
that.superior_init();
};
return that;
@ -63,11 +63,11 @@ function ipa_hbac_add_dialog(spec) {
var that = ipa_add_dialog(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
that.super_init();
that.superior_init();
that.add_field(ipa_text_widget({
'name': 'cn',
@ -89,9 +89,9 @@ function ipa_hbac_search_facet(spec) {
var that = ipa_search_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -108,7 +108,7 @@ function ipa_hbac_search_facet(spec) {
setup: ipa_hbac_quick_links
});
that.super_init();
that.superior_init();
};
that.create = function(container) {
@ -159,7 +159,7 @@ function ipa_hbac_search_facet(spec) {
container.append('<br/><br/>');
that.super_create(container);
that.superior_create(container);
};
return that;
@ -210,9 +210,9 @@ function ipa_hbac_details_facet(spec) {
var that = ipa_details_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -415,7 +415,7 @@ function ipa_hbac_details_facet(spec) {
'name': 'accesstime', 'label': 'Access Time'
}));
that.super_init();
that.superior_init();
};
return that;
@ -533,7 +533,7 @@ function ipa_hbac_details_tables_section(spec){
that.tables = spec.tables;
that.columns = spec.columns;
that.super_setup = that.super('setup');
that.superior_setup = that.superior('setup');
that.create = function(container) {
@ -584,9 +584,9 @@ function ipa_hbac_association_widget(spec) {
that.add_method = spec.add_method;
that.delete_method = spec.delete_method;
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
// create a column if none defined
@ -598,12 +598,12 @@ function ipa_hbac_association_widget(spec) {
});
}
that.super_init();
that.superior_init();
};
that.create = function(container) {
that.super_create(container);
that.superior_create(container);
var div = $('#'+that.id, container);
@ -624,7 +624,7 @@ function ipa_hbac_association_widget(spec) {
that.setup = function(container) {
that.super_setup(container);
that.superior_setup(container);
var entity = IPA.get_entity(that.entity_name);
var association = entity.get_association(that.other_entity);
@ -744,9 +744,9 @@ function ipa_hbac_accesstime_widget(spec) {
var that = ipa_table_widget(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
// create a column if none defined
@ -758,12 +758,12 @@ function ipa_hbac_accesstime_widget(spec) {
});
}
that.super_init();
that.superior_init();
};
that.create = function(container) {
that.super_create(container);
that.superior_create(container);
var div = $('#'+that.id);

View File

@ -26,7 +26,7 @@ function ipa_hbacsvc() {
'name': 'hbacsvc'
});
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -49,7 +49,7 @@ function ipa_hbacsvc() {
});
that.add_facet(facet);
that.super_init();
that.superior_init();
};
return that;
@ -63,11 +63,11 @@ function ipa_hbacsvc_add_dialog(spec) {
var that = ipa_add_dialog(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
this.super_init();
this.superior_init();
this.add_field(ipa_text_widget({name:'cn', label:'Name'}));
this.add_field(ipa_text_widget({name:'description', label:'Description'}));
@ -82,9 +82,9 @@ function ipa_hbacsvc_search_facet(spec) {
var that = ipa_search_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -97,7 +97,7 @@ function ipa_hbacsvc_search_facet(spec) {
setup: ipa_hbacsvc_quick_links
});
that.super_init();
that.superior_init();
};
that.create = function(container) {
@ -133,7 +133,7 @@ function ipa_hbacsvc_search_facet(spec) {
container.append('<br/><br/>');
that.super_create(container);
that.superior_create(container);
};
return that;
@ -170,9 +170,9 @@ function ipa_hbacsvc_details_facet(spec) {
var that = ipa_details_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -184,7 +184,7 @@ function ipa_hbacsvc_details_facet(spec) {
section.create_field({ 'name': 'cn', 'label': 'Name' });
section.create_field({ 'name': 'description', 'label': 'Description' });
that.super_init();
that.superior_init();
};
return that;

View File

@ -26,7 +26,7 @@ function ipa_hbacsvcgroup() {
'name': 'hbacsvcgroup'
});
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -60,7 +60,7 @@ function ipa_hbacsvcgroup() {
});
that.add_facet(facet);
that.super_init();
that.superior_init();
};
return that;
@ -74,11 +74,11 @@ function ipa_hbacsvcgroup_add_dialog(spec) {
var that = ipa_add_dialog(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
this.super_init();
this.superior_init();
this.add_field(ipa_text_widget({name:'cn', label:'Name'}));
this.add_field(ipa_text_widget({name:'description', label:'Description'}));
@ -93,9 +93,9 @@ function ipa_hbacsvcgroup_search_facet(spec) {
var that = ipa_search_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -108,7 +108,7 @@ function ipa_hbacsvcgroup_search_facet(spec) {
setup: ipa_hbacsvcgroup_quick_links
});
that.super_init();
that.superior_init();
};
that.create = function(container) {
@ -144,7 +144,7 @@ function ipa_hbacsvcgroup_search_facet(spec) {
container.append('<br/><br/>');
that.super_create(container);
that.superior_create(container);
};
return that;
@ -181,9 +181,9 @@ function ipa_hbacsvcgroup_details_facet(spec) {
var that = ipa_details_facet(spec);
that.super_init = that.super('init');
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_init = that.superior('init');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.init = function() {
@ -195,7 +195,7 @@ function ipa_hbacsvcgroup_details_facet(spec) {
section.create_field({ 'name': 'cn', 'label': 'Name' });
section.create_field({ 'name': 'description', 'label': 'Description' });
that.super_init();
that.superior_init();
};
return that;

View File

@ -28,8 +28,8 @@ function ipa_search_widget(spec) {
var that = ipa_table_widget(spec);
that.super_create = that.super('create');
that.super_setup = that.super('setup');
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
that.create = function(container) {
@ -71,12 +71,12 @@ function ipa_search_widget(spec) {
'class': 'search-results'
}).appendTo(div);
that.super_create(container);
that.superior_create(container);
};
that.setup = function(container) {
that.super_setup(container);
that.superior_setup(container);
var filter = $.bbq.getState(that.entity_name + '-filter', true) || '';
this.filter.val(filter);

View File

@ -26,7 +26,7 @@ function ipa_service() {
'name': 'service'
});
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -60,7 +60,7 @@ function ipa_service() {
});
that.add_facet(facet);
that.super_init();
that.superior_init();
};
return that;
@ -74,11 +74,11 @@ function ipa_service_add_dialog(spec) {
var that = ipa_add_dialog(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
this.super_init();
this.superior_init();
this.add_field(ipa_widget({
name: 'krbprincipalname',
@ -155,12 +155,12 @@ function ipa_service_search_facet(spec) {
var that = ipa_search_facet(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
this.create_column({name:'krbprincipalname', label:'Principal'});
that.super_init();
that.superior_init();
};
return that;
@ -172,7 +172,7 @@ function ipa_service_details_facet(spec) {
var that = ipa_details_facet(spec);
that.super_init = that.super('init');
that.superior_init = that.superior('init');
that.init = function() {
@ -211,7 +211,7 @@ function ipa_service_details_facet(spec) {
load: service_usercertificate_load
});
that.super_init();
that.superior_init();
};
return that;

View File

@ -132,112 +132,3 @@ test('Testing ipa_facet_setup_views().', function() {
IPA.show_page = orig_show_page;
});
test('Testing ipa_entity_quick_links().', function() {
var orig_push_state = nav_push_state;
var orig_get_state = nav_get_state;
var orig_remove_state = nav_remove_state;
var state = {};
nav_push_state = function(params) {
$.extend(state, params);
};
nav_get_state = function(key) {
return state[key];
};
nav_remove_state = function(key) {
delete state[key];
};
IPA.ajax_options.async = false;
IPA.init(
'data',
true,
function(data, text_status, xhr) {
ok(true, 'ipa_init() succeeded.');
},
function(xhr, text_status, error_thrown) {
ok(false, 'ipa_init() failed: '+error_thrown);
}
);
var obj_name = 'user';
var pkey = IPA.metadata[obj_name].primary_key;
var pkey_value = 'test';
var entry_attrs = {};
entry_attrs[pkey] = [pkey_value];
var container = $('<div/>', {
title: obj_name,
class: 'entity-container'
});
var search_table = $('<table/>', {
class: 'search-table'
}).appendTo(container);
var tbody = $('<tbody/>').appendTo(search_table);
var tr = $('<tr/>').appendTo(tbody);
var td = $('<td/>').appendTo(tr);
var span = $('<span/>', {name:'quick_links'}).appendTo(td);
ipa_entity_quick_links(tr, 'quick_links', null, entry_attrs);
var link = span.children().first();
equals(
link.attr('href'), '#details',
'Checking details link'
);
link.click();
equals(
state[obj_name+'-facet'], 'details',
'Checking state[\''+obj_name+'-facet\']'
);
equals(
state[obj_name+'-pkey'], pkey_value,
'Checking state[\''+obj_name+'-pkey\']'
);
var attribute_members = IPA.metadata[obj_name].attribute_members;
for (attr_name in attribute_members) {
var objs = attribute_members[attr_name];
for (var i = 0; i < objs.length; ++i) {
var m = objs[i];
link = link.next();
equals(
link.attr('href'), '#'+m,
'Checking '+m+' link'
);
link.click();
equals(
state[obj_name+'-facet'], 'associate',
'Checking state[\''+obj_name+'-facet\']'
);
equals(
state[obj_name+'-enroll'], m,
'Checking state[\''+obj_name+'-enroll\']'
);
equals(
state[obj_name+'-pkey'], pkey_value,
'Checking state[\''+obj_name+'-pkey\']'
);
}
}
nav_push_state = orig_push_state;
nav_get_state = orig_get_state;
nav_remove_state = orig_remove_state;
});

View File

@ -39,7 +39,7 @@ function ipa_widget(spec) {
that.save = spec.save || save;
that.clear = spec.clear || clear;
that.super = function(name) {
that.superior = function(name) {
var method = that[name];
return function () {
return method.apply(that, arguments);
@ -570,7 +570,7 @@ function ipa_dialog(spec) {
that.fields = [];
that.fields_by_name = {};
that.super = function(name) {
that.superior = function(name) {
var method = that[name];
return function () {
return method.apply(that, arguments);
@ -696,7 +696,7 @@ function ipa_adder_dialog(spec) {
that.width = spec.width || 600;
that.super_open = that.super('open');
that.superior_open = that.superior('open');
that.create = function() {
@ -785,7 +785,7 @@ function ipa_adder_dialog(spec) {
'Cancel': that.close
};
that.super_open(container);
that.superior_open(container);
};
that.get_filter = function() {
@ -841,7 +841,7 @@ function ipa_deleter_dialog(spec) {
that.title = spec.title || IPA.messages.button.remove;
that.remove = spec.remove;
that.super_open = that.super('open');
that.superior_open = that.superior('open');
that.values = spec.values || [];
@ -874,7 +874,7 @@ function ipa_deleter_dialog(spec) {
'Cancel': that.close
};
that.super_open(container);
that.superior_open(container);
};
return that;