From 4a8c43aa324beff5bebfa9a699b1dc4b29020731 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 16 Feb 2011 12:46:59 -0600 Subject: I18n update. Hard-coded messages through out the code have been replaced by i18n messages obtained from json_metadata and i18n_messages. --- install/ui/aci.js | 150 ++++---- install/ui/add.js | 12 +- install/ui/associate.js | 85 +++-- install/ui/certificate.js | 732 +++++++++++++++++++++------------------- install/ui/details.js | 14 +- install/ui/dialog.js | 8 +- install/ui/entity.js | 18 +- install/ui/group.js | 10 +- install/ui/hbacrule.js | 190 ++++++----- install/ui/hbacsvc.js | 6 +- install/ui/hbacsvcgroup.js | 10 +- install/ui/host.js | 79 ++--- install/ui/hostgroup.js | 9 +- install/ui/ipa.js | 61 ++-- install/ui/netgroup.js | 9 +- install/ui/policy.js | 62 ++-- install/ui/rule.js | 14 +- install/ui/search.js | 31 +- install/ui/serverconfig.js | 10 +- install/ui/service.js | 58 ++-- install/ui/sudocmd.js | 11 +- install/ui/sudocmdgroup.js | 11 +- install/ui/sudorule.js | 177 ++++------ install/ui/test/aci_tests.js | 2 +- install/ui/test/entity_tests.js | 2 +- install/ui/test/ipa_tests.js | 10 +- install/ui/user.js | 40 +-- install/ui/widget.js | 22 +- 28 files changed, 975 insertions(+), 868 deletions(-) diff --git a/install/ui/aci.js b/install/ui/aci.js index 4df65f3ff..ea220f9af 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -34,7 +34,7 @@ IPA.attributes_widget = function(spec) { var id = spec.name; - that.setup = function (){ + that.setup = function() { }; that.create = function(container) { @@ -49,6 +49,7 @@ IPA.attributes_widget = function(spec) { appendTo(container); var tr = $('').appendTo($('thead', that.table)); + tr.append($('', { style:"height:2em; vertical-align:bottom;", html:$('',{ @@ -59,8 +60,10 @@ IPA.attributes_widget = function(spec) { that.show_undo(); } }) - })). - append('Attribute'); + })).append($('', { + 'class': 'aci-attribute-column', + html: IPA.messages.objects.aci.attribute + })); if (that.undo) { that.create_undo(container); @@ -101,7 +104,7 @@ IPA.attributes_widget = function(spec) { if (!object_type || object_type === '') return; - var metadata = IPA.metadata[object_type]; + var metadata = IPA.metadata.objects[object_type]; if (!metadata) return; var aciattrs = metadata.aciattrs; @@ -189,13 +192,18 @@ IPA.rights_widget = function(spec) { IPA.rights_section = function() { - var spec = { - 'name':'rights', - 'label': 'Rights' + + var spec = { + name: 'rights', + label: IPA.messages.objects.permission.rights }; + var that = IPA.details_section(spec); - that.add_field(IPA.rights_widget( - {name: 'permissions', label: 'Permissions', join: true})); + + that.add_field(IPA.rights_widget({ + name: 'permissions', + join: true + })); return that; }; @@ -257,7 +265,7 @@ IPA.target_section = function(spec) { $('
'). append($('
'). append($('
', { @@ -306,7 +314,7 @@ IPA.target_section = function(spec) { create: function (dl) { $('
'). append($('
', { @@ -329,7 +337,7 @@ IPA.target_section = function(spec) { create: function(dl) { $('
'). append($('
', { @@ -359,7 +367,7 @@ IPA.target_section = function(spec) { value: '', text: '' })); - var type_params = IPA.get_param_info('permission', 'type'); + var type_params = IPA.get_entity_param('permission', 'type'); for (var i=0; i', { value: type_params.values[i], @@ -466,7 +474,7 @@ IPA.target_section = function(spec) { } } if (!target_type_name){ - alert('permission with invalid target specification'); + alert(IPA.messages.objects.permission.invalid_target); return; } @@ -544,22 +552,31 @@ IPA.entity_factories.permission = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add New Permission', + title: IPA.messages.objects.permission.add, width: '700px' }). field(IPA.text_widget({name: 'cn', undo: false})). - field(IPA.rights_widget( - {name: 'permissions', label: 'Permissions', - join: true, undo: false})). - section(IPA.target_section( - {name: 'target', label: 'Target', undo: false})))). + field(IPA.rights_widget({ + name: 'permissions', + join: true, undo: false})). + section(IPA.target_section({ + name: 'target', + label: IPA.messages.objects.permission.target, + undo: false + })))). facet( IPA.permission_details_facet({ name: 'details' }). section( - IPA.stanza({name:'identity', label:'Identity'}). - input({name: 'cn', 'read_only': true})). + IPA.stanza({ + name:'identity', + label: IPA.messages.objects.permission.identity + }). + input({name: 'cn', read_only: true})). section(IPA.rights_section()). - section(IPA.target_section({name: 'target', label: 'Target'}))). + section(IPA.target_section({ + name: 'target', + label: IPA.messages.objects.permission.target + }))). standard_associations(); }; @@ -575,7 +592,7 @@ IPA.entity_factories.privilege = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Privilege' + title: IPA.messages.objects.privilege.add }). field(IPA.text_widget({ name: 'cn', undo: false})). field(IPA.text_widget( @@ -583,8 +600,11 @@ IPA.entity_factories.privilege = function() { facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'Privilege Settings'}). - input({name:'cn'}). + IPA.stanza({ + name:'identity', + label: IPA.messages.objects.privilege.identity + }). + input({name: 'cn'}). input({name: 'description'}))). facet( IPA.association_facet({ @@ -617,7 +637,7 @@ IPA.entity_factories.role = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Role' + title: IPA.messages.objects.role.add }). field(IPA.text_widget({ name: 'cn', undo: false})). field(IPA.text_widget( @@ -625,8 +645,11 @@ IPA.entity_factories.role = function() { facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'Role Settings'}). - input({name:'cn'}). + IPA.stanza({ + name:'identity', + label:IPA.messages.objects.role.identity + }). + input({name: 'cn'}). input({name: 'description'}))). facet( IPA.association_facet({ @@ -649,17 +672,20 @@ IPA.entity_factories.selfservice = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Self Service Definition' + title: IPA.messages.objects.selfservice.add }). field(IPA.text_widget({ name: 'aciname', undo: false})). field(IPA.attributes_widget({ object_type:'user', - name:'attrs' + name:'attrs', undo: false })))). facet( IPA.details_facet({'name':'details'}). section( - IPA.stanza({name:'general', label:'General'}). + IPA.stanza({ + name: 'general', + label: IPA.messages.details.general + }). input({name:'aciname'}). custom_input(IPA.attributes_widget({ object_type:'user', @@ -678,36 +704,46 @@ IPA.entity_factories.delegation = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Delegation', + title: IPA.messages.objects.delegation.add, width: '700px' }). - field(IPA.text_widget({name: 'aciname', undo: false})). - field(IPA.entity_select_widget({name: 'group', - entity: 'group', undo: false})). - field(IPA.entity_select_widget( - {name: 'memberof', entity: 'group', - join: true, undo: false})). - field(IPA.attributes_widget( - {name: 'attrs', object_type: 'user', - join: true, undo: false})))). + field(IPA.text_widget({ + name: 'aciname', undo: false + })). + field(IPA.entity_select_widget({ + name: 'group', entity: 'group', undo: false + })). + field(IPA.entity_select_widget({ + name: 'memberof', entity: 'group', + join: true, undo: false + })). + field(IPA.attributes_widget({ + name: 'attrs', object_type: 'user', + join: true, undo: false + })))). facet( IPA.details_facet(). section( - IPA.stanza({name:'general', label:'General'}). + IPA.stanza({ + name: 'general', + label: IPA.messages.details.general + }). input({name:'aciname'}). - custom_input(IPA.entity_select_widget( - {name:'group', entity:'group'})). - custom_input(IPA.entity_select_widget( - {name:'memberof', label: 'Member Group', - entity:'group', join: true})). - custom_input( - IPA.rights_widget( - {name: 'permissions', label: 'Permissions', - direction: 'horizontal', join: true})). - custom_input( - IPA.attributes_widget({ - name:'attrs', object_type:'user', - join: true})))). + custom_input(IPA.entity_select_widget({ + name:'group', entity:'group' + })). + custom_input(IPA.entity_select_widget({ + name:'memberof', + entity:'group', join: true + })). + custom_input(IPA.rights_widget({ + name: 'permissions', + direction: 'horizontal', join: true + })). + custom_input(IPA.attributes_widget({ + name:'attrs', object_type:'user', + join: true + })))). standard_associations(); return that; diff --git a/install/ui/add.js b/install/ui/add.js index 2f5dff999..33ffe3dea 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -35,7 +35,7 @@ IPA.add_dialog = function (spec) { that.init = function() { - that.add_button('Add', function() { + that.add_button(IPA.messages.buttons.add, function() { var record = {}; that.save(record); that.add( @@ -51,7 +51,7 @@ IPA.add_dialog = function (spec) { }); - that.add_button('Add and Add Another', function() { + that.add_button(IPA.messages.buttons.add_and_add_another, function() { var record = {}; that.save(record); that.add( @@ -66,7 +66,7 @@ IPA.add_dialog = function (spec) { ); }); - that.add_button('Add and Edit', function() { + that.add_button(IPA.messages.buttons.add_and_edit, function() { var record = {}; that.save(record); that.add( @@ -74,7 +74,7 @@ IPA.add_dialog = function (spec) { function() { that.close(); - var pkey_name = IPA.metadata[that.entity_name].primary_key; + var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; var pkey = record[pkey_name]; var state = {}; @@ -85,7 +85,7 @@ IPA.add_dialog = function (spec) { ); }); - that.add_button('Cancel', function() { + that.add_button(IPA.messages.buttons.cancel, function() { that.close(); }); @@ -94,7 +94,7 @@ IPA.add_dialog = function (spec) { that.add = function(record, on_success, on_error) { - var pkey_name = IPA.metadata[that.entity_name].primary_key; + var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; var command = IPA.command({ method: that.entity_name+'_add', diff --git a/install/ui/associate.js b/install/ui/associate.js index c96f51279..600cd55c3 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -153,10 +153,10 @@ IPA.association_adder_dialog = function (spec) { that.init = function() { if (!that.columns.length) { - var pkey_name = IPA.metadata[that.other_entity].primary_key; + var pkey_name = IPA.metadata.objects[that.other_entity].primary_key; that.create_column({ name: pkey_name, - label: IPA.metadata[that.other_entity].label, + label: IPA.metadata.objects[that.other_entity].label, primary_key: true, width: '200px' }); @@ -173,7 +173,7 @@ IPA.association_adder_dialog = function (spec) { var results = data.result; that.clear_available_values(); - var pkey_attr = IPA.metadata[that.entity_name].primary_key; + var pkey_attr = IPA.metadata.objects[that.entity_name].primary_key; for (var i=0; i', { 'type': 'button', 'name': 'remove', - 'value': 'Remove' + 'value': IPA.messages.buttons.remove }).appendTo(buttons); $('', { 'type': 'button', 'name': 'add', - 'value': 'Add' + 'value': IPA.messages.buttons.add }).appendTo(buttons); }; @@ -445,8 +445,12 @@ IPA.association_table_widget = function (spec) { that.create_add_dialog = function() { var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var label = IPA.metadata[that.other_entity].label; - var title = 'Add '+label+' to '+that.entity_name+' '+pkey; + var label = IPA.metadata.objects[that.other_entity].label; + var title = IPA.messages.association.add; + + title = title.replace('${entity}', that.entity_name); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', label); return IPA.association_adder_dialog({ 'title': title, @@ -505,13 +509,19 @@ IPA.association_table_widget = function (spec) { var selected_values = that.get_selected_values(); if (!selected_values.length) { - alert('Select '+that.label+' to be removed.'); + var message = IPA.messages.dialogs.remove_empty; + message = message.replace('${entity}', that.label); + alert(message); return; } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var label = IPA.metadata[that.other_entity].label; - var title = 'Remove '+label+' from '+that.entity_name+' '+pkey; + var label = IPA.metadata.objects[that.other_entity].label; + var title = IPA.messages.association.remove; + + title = title.replace('${entity}', that.entity_name); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', label); var dialog = IPA.association_deleter_dialog({ 'title': title, @@ -575,7 +585,7 @@ IPA.association_facet = function (spec) { that.other_entity = spec.other_entity || that.name.substring(index+1); that.facet_group = spec.facet_group; - that.label = that.label ? that.label : (IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity); + that.label = that.label ? that.label : (IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity); that.associator = spec.associator || IPA.bulk_associator; that.add_method = spec.add_method || 'add_member'; @@ -625,8 +635,8 @@ IPA.association_facet = function (spec) { var column; var i; - var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; - var pkey_name = IPA.metadata[that.other_entity].primary_key; + var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; + var pkey_name = IPA.metadata.objects[that.other_entity].primary_key; that.table = IPA.table_widget({ 'id': that.entity_name+'-'+that.other_entity, @@ -643,7 +653,7 @@ IPA.association_facet = function (spec) { column = that.table.create_column({ name: that.table.name, - label: IPA.metadata[that.other_entity].label, + label: IPA.metadata.objects[that.other_entity].label, primary_key: true }); @@ -691,22 +701,27 @@ IPA.association_facet = function (spec) { that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var relationships = IPA.metadata[that.entity_name].relationships; + var relationships = IPA.metadata.objects[that.entity_name].relationships; var relationship = relationships[that.attribute_member]; - if (!relationship){ + if (!relationship) { relationship = ['', '', '']; } - /* TODO: I18N and some generic handling of different relationships */ + var other_label = IPA.metadata.objects[that.other_entity].label; + + /* TODO: generic handling of different relationships */ var header_message = ''; if (relationship[0] == 'Member') { - header_message = that.other_entity + '(s) enrolled in ' + - that.entity_name + ' ' + that.pkey; + header_message = IPA.messages.association.member; + } else if (relationship[0] == 'Parent') { - header_message = that.entity_name + ' ' + that.pkey + - ' is enrolled in the following ' + that.other_entity + '(s)'; + header_message = IPA.messages.association.parent; } + header_message = header_message.replace('${entity}', that.entity_name); + header_message = header_message.replace('${primary_key}', that.pkey); + header_message = header_message.replace('${other_entity}', other_label); + $('
', { 'id': that.entity_name+'-'+that.other_entity, html: $('

',{ html: header_message }) @@ -723,13 +738,13 @@ IPA.association_facet = function (spec) { $('', { 'type': 'button', 'name': 'remove', - 'value': IPA.messages.button.remove + 'value': IPA.messages.buttons.remove }).appendTo(li); $('', { 'type': 'button', 'name': 'add', - 'value': IPA.messages.button.enroll + 'value': IPA.messages.buttons.enroll }).appendTo(li); }; @@ -762,8 +777,12 @@ IPA.association_facet = function (spec) { that.show_add_dialog = function() { var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; - var title = 'Enroll ' + label + ' in ' + that.entity_name + ' ' + pkey; + var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; + var title = IPA.messages.association.add; + + title = title.replace('${entity}', that.entity_name); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', label); var dialog = IPA.association_adder_dialog({ 'title': title, @@ -807,16 +826,22 @@ IPA.association_facet = function (spec) { that.show_remove_dialog = function() { - var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; + var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; var values = that.table.get_selected_values(); if (!values.length) { - alert('Select '+label+' to be removed.'); + var message = IPA.messages.dialogs.remove_empty; + message = message.replace('${entity}', label); + alert(message); return; } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var title = 'Remove '+label+' from '+that.entity_name+' '+pkey; + var title = IPA.messages.association.remove; + + title = title.replace('${entity}', that.entity_name); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', label); var dialog = IPA.association_deleter_dialog({ title: title, diff --git a/install/ui/certificate.js b/install/ui/certificate.js index 56995282f..b91d2b9bc 100755 --- a/install/ui/certificate.js +++ b/install/ui/certificate.js @@ -20,379 +20,385 @@ * along with this program. If not, see . */ - -IPA.cert = { - BEGIN_CERTIFICATE : '-----BEGIN CERTIFICATE-----', - END_CERTIFICATE : '-----END CERTIFICATE-----', - BEGIN_CERTIFICATE_REQUEST : '-----BEGIN CERTIFICATE REQUEST-----', - END_CERTIFICATE_REQUEST : '-----END CERTIFICATE REQUEST-----', - CRL_REASON : [ - 'Unspecified', - 'Key Compromise', - 'CA Compromise', - 'Affiliation Changed', - 'Superseded', - 'Cessation of Operation', - 'Certificate Hold', - null, - 'Remove from CRL', - 'Privilege Withdrawn', - 'AA Compromise' - ], - CERTIFICATE_STATUS_MISSING : 0, - CERTIFICATE_STATUS_VALID : 1, - CERTIFICATE_STATUS_REVOKED : 2, - - parse_dn : function (dn) { - - var result = {}; - if (!dn) return result; - - // TODO: Use proper LDAP DN parser - var rdns = dn.split(','); - for (var i=0; i', { - 'title': that.title + var that = {}; + + that.title = spec.title || ''; + that.usercertificate = spec.usercertificate || ''; + + var dialog = $('
', { + 'title': that.title + }); + + var textarea = $('