mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 16:31:08 -06:00
Dialog i18n
The ipa_add_dialog has been fixed to initialize the fields which will get the labels from metadata. Hard-coded labels have been removed from field declarations. The superior() method has been removed because it doesn't work with multi-level inheritance. Superclass method for now is called using <class name>_<method> (e.g. widget_init).
This commit is contained in:
parent
ca436d9ec3
commit
6350686710
@ -84,6 +84,8 @@ function ipa_add_dialog(spec) {
|
||||
that.add_button('Cancel', function() {
|
||||
that.close();
|
||||
});
|
||||
|
||||
that.dialog_init();
|
||||
};
|
||||
|
||||
that.add = function(record, on_success, on_error) {
|
||||
@ -109,7 +111,6 @@ function ipa_add_dialog(spec) {
|
||||
ipa_cmd('add', args, options, on_success, on_error, that.entity_name);
|
||||
};
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
that.add_dialog_init = that.init;
|
||||
|
||||
return that;
|
||||
|
@ -142,13 +142,6 @@ function ipa_details_section(spec){
|
||||
that.fields = [];
|
||||
that.fields_by_name = {};
|
||||
|
||||
that.superior = function(name) {
|
||||
var method = that[name];
|
||||
return function () {
|
||||
return method.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
that.__defineGetter__("entity_name", function(){
|
||||
return that._entity_name;
|
||||
});
|
||||
|
@ -47,13 +47,6 @@ function ipa_facet(spec) {
|
||||
|
||||
that.create_action_panel = ipa_facet_create_action_panel;
|
||||
|
||||
that.superior = function(name) {
|
||||
var method = that[name];
|
||||
return function () {
|
||||
return method.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
function init() {
|
||||
}
|
||||
|
||||
@ -105,13 +98,6 @@ function ipa_entity(spec) {
|
||||
that.associations = [];
|
||||
that.associations_by_name = {};
|
||||
|
||||
that.superior = function(name) {
|
||||
var method = that[name];
|
||||
return function () {
|
||||
return method.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
that.get_dialog = function(name) {
|
||||
return that.dialogs_by_name[name];
|
||||
};
|
||||
@ -273,7 +259,6 @@ function ipa_entity_set_add_definition(entity_name, data) {
|
||||
'title': data[1]
|
||||
});
|
||||
entity.add_dialog(dialog);
|
||||
dialog.init();
|
||||
|
||||
for (var i=0; i<data[2].length; i++) {
|
||||
var field = data[2][i];
|
||||
@ -284,6 +269,8 @@ function ipa_entity_set_add_definition(entity_name, data) {
|
||||
undo: false
|
||||
}));
|
||||
}
|
||||
|
||||
dialog.init();
|
||||
}
|
||||
|
||||
function ipa_entity_get_add_dialog(entity_name) {
|
||||
|
@ -87,16 +87,13 @@ function ipa_group_add_dialog(spec) {
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.add_dialog_init();
|
||||
that.add_field(ipa_text_widget({name:'cn', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', undo: false}));
|
||||
// TODO: Replace with i18n label
|
||||
that.add_field(ipa_checkbox_widget({name:'posix', label:'Is this a POSIX group?', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'gidnumber', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({name:'cn', entity_name:'group',
|
||||
undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description',
|
||||
entity_name:'group', undo: false}));
|
||||
that.add_field(ipa_checkbox_widget({name:'posix', entity_name:'group',
|
||||
undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'gidnumber', entity_name:'group',
|
||||
undo: false}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -63,23 +63,21 @@ function ipa_hbac_add_dialog(spec) {
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.add_dialog_init();
|
||||
|
||||
that.add_field(ipa_text_widget({
|
||||
'name': 'cn',
|
||||
'label': 'Rule Name',
|
||||
'undo': false
|
||||
}));
|
||||
|
||||
that.add_field(ipa_radio_widget({
|
||||
'name': 'accessruletype',
|
||||
'label': 'Rule type',
|
||||
'options': [
|
||||
{ 'value': 'allow', 'label': 'Allow' },
|
||||
{ 'value': 'deny', 'label': 'Deny' }
|
||||
],
|
||||
'undo': false
|
||||
}));
|
||||
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -61,14 +61,12 @@ function ipa_hbacsvc_add_dialog(spec) {
|
||||
|
||||
var that = ipa_add_dialog(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.superior_init();
|
||||
that.add_field(ipa_text_widget({name:'cn', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', label:'Description', undo: false}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
@ -128,10 +126,6 @@ function ipa_hbacsvc_details_facet(spec) {
|
||||
|
||||
var that = ipa_details_facet(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
that.superior_create = that.superior('create');
|
||||
that.superior_setup = that.superior('setup');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
var section = ipa_details_list_section({
|
||||
@ -143,7 +137,7 @@ function ipa_hbacsvc_details_facet(spec) {
|
||||
section.create_field({'name': 'cn'});
|
||||
section.create_field({'name': 'description'});
|
||||
|
||||
that.superior_init();
|
||||
that.details_facet_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -67,14 +67,12 @@ function ipa_hbacsvcgroup_add_dialog(spec) {
|
||||
|
||||
var that = ipa_add_dialog(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.superior_init();
|
||||
that.add_field(ipa_text_widget({name:'cn', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', label:'Description', undo: false}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -83,14 +83,13 @@ function ipa_host_add_dialog(spec) {
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.add_dialog_init();
|
||||
|
||||
that.add_field(ipa_text_widget({
|
||||
'name': 'fqdn',
|
||||
entity_name:'host',
|
||||
'size': 40,
|
||||
'undo': false
|
||||
}));
|
||||
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -47,19 +47,17 @@ IPA.add_entity( function() {
|
||||
|
||||
var dialog = ipa_add_dialog({
|
||||
name: 'add',
|
||||
title: 'Add Hostgroup',
|
||||
entity_name:'hostgroup'
|
||||
title: 'Add Hostgroup'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
|
||||
dialog.add_field(ipa_text_widget({name: 'cn', undo: false}));
|
||||
dialog.add_field(ipa_text_widget({name: 'description', undo: false}));
|
||||
dialog.init();
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn',
|
||||
entity_name:'hostgroup'}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'description',
|
||||
entity_name:'hostgroup' }));
|
||||
|
||||
that.create_association_facets();
|
||||
that.entity_init();
|
||||
}
|
||||
};
|
||||
return that;
|
||||
}());
|
||||
|
||||
|
@ -47,19 +47,17 @@ IPA.add_entity( function() {
|
||||
|
||||
var dialog = ipa_add_dialog({
|
||||
name: 'add',
|
||||
title: 'Add Netgroup',
|
||||
entity_name:'netgroup'
|
||||
title: 'Add Netgroup'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn', undo: false}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'description', undo: false}));
|
||||
dialog.init();
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn',
|
||||
entity_name:'netgroup'}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'description',
|
||||
entity_name:'netgroup' }));
|
||||
|
||||
that.create_association_facets();
|
||||
that.entity_init();
|
||||
}
|
||||
};
|
||||
return that;
|
||||
}());
|
||||
|
||||
|
@ -64,23 +64,18 @@ IPA.add_entity(function (){
|
||||
|
||||
var dialog = ipa_add_dialog({
|
||||
name: 'add',
|
||||
title: 'Add DNS Zone',
|
||||
entity_name:'dnszone'
|
||||
title: 'Add DNS Zone'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
dialog.init();
|
||||
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnsname',
|
||||
entity_name:'dnszone'}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnssoamname',
|
||||
entity_name:'dnszone'}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnssoarname',
|
||||
entity_name:'dnszone'}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnsname', undo: false}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnssoamname', undo: false}));
|
||||
dialog.add_field(ipa_text_widget({ name: 'idnssoarname', undo: false}));
|
||||
dialog.init();
|
||||
|
||||
that.create_association_facets();
|
||||
that.entity_init();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return that;
|
||||
@ -521,14 +516,13 @@ IPA.add_entity(function (){
|
||||
|
||||
var dialog = ipa_add_dialog({
|
||||
name: 'add',
|
||||
title: 'Add Automount Location',
|
||||
entity_name:'automountlocation'
|
||||
title: 'Add Automount Location'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn', undo: false}));
|
||||
dialog.init();
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn',
|
||||
entity_name:'automountlocation'}));
|
||||
|
||||
that.create_association_facets();
|
||||
that.entity_init();
|
||||
|
||||
@ -574,15 +568,15 @@ IPA.add_entity(function (){
|
||||
title: 'Add Password Policy',
|
||||
entity_name:'pwpolicy'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn', undo: false}));
|
||||
dialog.init();
|
||||
dialog.add_field(ipa_text_widget({ name: 'cn',
|
||||
entity_name:'pwpolicy'}));
|
||||
|
||||
that.create_association_facets();
|
||||
that.entity_init();
|
||||
|
||||
}
|
||||
};
|
||||
return that;
|
||||
}());
|
||||
|
||||
|
@ -76,24 +76,27 @@ function ipa_service_add_dialog(spec) {
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.add_dialog_init();
|
||||
|
||||
that.add_field(ipa_widget({
|
||||
name: 'krbprincipalname'
|
||||
}));
|
||||
|
||||
// TODO: Replace with i18n label
|
||||
that.add_field(ipa_text_widget({
|
||||
'name': 'service', 'label': 'Service',
|
||||
'name': 'service',
|
||||
'label': 'Service',
|
||||
'size': 20,
|
||||
'undo': false
|
||||
}));
|
||||
|
||||
// TODO: Replace with i18n label
|
||||
that.add_field(ipa_text_widget({
|
||||
'name': 'host',
|
||||
'label': 'Host Name',
|
||||
'size': 40,
|
||||
'undo': false
|
||||
}));
|
||||
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
that.create = function() {
|
||||
|
@ -61,14 +61,12 @@ function ipa_sudocmd_add_dialog(spec) {
|
||||
|
||||
var that = ipa_add_dialog(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.superior_init();
|
||||
that.add_field(ipa_text_widget({name:'sudocmd', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({name:'sudocmd', label:'Command', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', label:'Description', undo: false}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
@ -130,10 +128,6 @@ function ipa_sudocmd_details_facet(spec) {
|
||||
|
||||
var that = ipa_details_facet(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
that.superior_create = that.superior('create');
|
||||
that.superior_setup = that.superior('setup');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
var section = ipa_details_list_section({
|
||||
@ -145,7 +139,7 @@ function ipa_sudocmd_details_facet(spec) {
|
||||
section.create_field({'name': 'sudocmd'});
|
||||
section.create_field({'name': 'description'});
|
||||
|
||||
that.superior_init();
|
||||
that.details_facet_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -67,14 +67,12 @@ function ipa_sudocmdgroup_add_dialog(spec) {
|
||||
|
||||
var that = ipa_add_dialog(spec);
|
||||
|
||||
that.superior_init = that.superior('init');
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.superior_init();
|
||||
that.add_field(ipa_text_widget({name:'cn', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false}));
|
||||
that.add_field(ipa_text_widget({name:'description', label:'Description', undo: false}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -63,13 +63,9 @@ function ipa_sudorule_add_dialog(spec) {
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.add_dialog_init();
|
||||
that.add_field(ipa_text_widget({name: 'cn', undo: false}));
|
||||
|
||||
that.add_field(ipa_text_widget({
|
||||
'name': 'cn',
|
||||
'label': 'Rule Name',
|
||||
'undo': false
|
||||
}));
|
||||
that.add_dialog_init();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -45,14 +45,13 @@ function ipa_user(){
|
||||
'name': 'add',
|
||||
'title': 'Add User'
|
||||
});
|
||||
|
||||
that.add_dialog(dialog);
|
||||
|
||||
dialog.add_field(ipa_text_widget({ name: 'uid', undo: false }));
|
||||
dialog.add_field(ipa_text_widget({ name: 'givenname', undo: false }));
|
||||
dialog.add_field(ipa_text_widget({ name: 'sn', undo: false }));
|
||||
dialog.init();
|
||||
dialog.add_field(ipa_text_widget({ name: 'uid',entity_name:'user' }));
|
||||
dialog.add_field(ipa_text_widget({ name: 'givenname',
|
||||
entity_name:'user' }));
|
||||
dialog.add_field(ipa_text_widget({ name: 'sn',entity_name:'user' }));
|
||||
|
||||
|
||||
/*eventually, we need to call
|
||||
entity.create_association_facets();
|
||||
but we are currently defining the associator using the global
|
||||
@ -60,7 +59,7 @@ function ipa_user(){
|
||||
|
||||
|
||||
that.entity_init();
|
||||
}
|
||||
};
|
||||
|
||||
function details_facet(spec) {
|
||||
spec = spec || {};
|
||||
@ -110,7 +109,7 @@ IPA.add_entity(ipa_user());
|
||||
|
||||
ipa_entity_set_association_definition('user', {
|
||||
'group': { associator: 'serial' },
|
||||
'netgroup': { associator: 'serial' },
|
||||
'netgroup': { associator: 'serial' }
|
||||
});
|
||||
|
||||
/* ATTRIBUTE CALLBACKS */
|
||||
|
@ -44,13 +44,6 @@ function ipa_widget(spec) {
|
||||
that.save = spec.save || save;
|
||||
that.clear = spec.clear || clear;
|
||||
|
||||
that.superior = function(name) {
|
||||
var method = that[name];
|
||||
return function () {
|
||||
return method.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
that.__defineGetter__("entity_name", function(){
|
||||
return that._entity_name;
|
||||
});
|
||||
@ -793,13 +786,6 @@ function ipa_dialog(spec) {
|
||||
that.fields = [];
|
||||
that.fields_by_name = {};
|
||||
|
||||
that.superior = function(name) {
|
||||
var method = that[name];
|
||||
return function () {
|
||||
return method.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
that.__defineGetter__("entity_name", function(){
|
||||
return that._entity_name;
|
||||
});
|
||||
@ -821,12 +807,16 @@ function ipa_dialog(spec) {
|
||||
};
|
||||
|
||||
that.add_field = function(field) {
|
||||
field.entity_name = that.entity_name;
|
||||
that.fields.push(field);
|
||||
that.fields_by_name[field.name] = field;
|
||||
};
|
||||
|
||||
that.init = function() {
|
||||
for (var i=0; i<that.fields.length; i++) {
|
||||
var field = that.fields[i];
|
||||
field.entity_name = that.entity_name;
|
||||
field.init();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user