diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-02-16 12:46:59 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-02-21 15:36:32 -0500 |
commit | 4a8c43aa324beff5bebfa9a699b1dc4b29020731 (patch) | |
tree | 35d4ed4076e0c8e098946c8d96290f03699657a3 /install/ui | |
parent | 2e25b2ed27ebe7a0a612d120bda6a23596e21b64 (diff) | |
download | freeipa-4a8c43aa324beff5bebfa9a699b1dc4b29020731.tar.gz freeipa-4a8c43aa324beff5bebfa9a699b1dc4b29020731.tar.xz freeipa-4a8c43aa324beff5bebfa9a699b1dc4b29020731.zip |
I18n update.
Hard-coded messages through out the code have been replaced by i18n
messages obtained from json_metadata and i18n_messages.
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/aci.js | 150 | ||||
-rw-r--r-- | install/ui/add.js | 12 | ||||
-rw-r--r-- | install/ui/associate.js | 85 | ||||
-rwxr-xr-x | install/ui/certificate.js | 732 | ||||
-rw-r--r-- | install/ui/details.js | 14 | ||||
-rw-r--r-- | install/ui/dialog.js | 8 | ||||
-rw-r--r-- | install/ui/entity.js | 18 | ||||
-rw-r--r-- | install/ui/group.js | 10 | ||||
-rw-r--r-- | install/ui/hbacrule.js | 190 | ||||
-rw-r--r-- | install/ui/hbacsvc.js | 6 | ||||
-rw-r--r-- | install/ui/hbacsvcgroup.js | 10 | ||||
-rw-r--r-- | install/ui/host.js | 79 | ||||
-rw-r--r-- | install/ui/hostgroup.js | 9 | ||||
-rw-r--r-- | install/ui/ipa.js | 61 | ||||
-rw-r--r-- | install/ui/netgroup.js | 9 | ||||
-rw-r--r-- | install/ui/policy.js | 62 | ||||
-rw-r--r-- | install/ui/rule.js | 14 | ||||
-rw-r--r-- | install/ui/search.js | 31 | ||||
-rw-r--r-- | install/ui/serverconfig.js | 10 | ||||
-rw-r--r-- | install/ui/service.js | 58 | ||||
-rw-r--r-- | install/ui/sudocmd.js | 11 | ||||
-rw-r--r-- | install/ui/sudocmdgroup.js | 11 | ||||
-rw-r--r-- | install/ui/sudorule.js | 177 | ||||
-rw-r--r-- | install/ui/test/aci_tests.js | 2 | ||||
-rw-r--r-- | install/ui/test/entity_tests.js | 2 | ||||
-rw-r--r-- | install/ui/test/ipa_tests.js | 10 | ||||
-rw-r--r-- | install/ui/user.js | 40 | ||||
-rw-r--r-- | 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 = $('<tr></tr>').appendTo($('thead', that.table)); + tr.append($('<th/>', { style:"height:2em; vertical-align:bottom;", html:$('<input/>',{ @@ -59,8 +60,10 @@ IPA.attributes_widget = function(spec) { that.show_undo(); } }) - })). - append('<th class="aci-attribute-column">Attribute</th>'); + })).append($('<th/>', { + '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) { $('<dt/>'). append($('<label/>', { - text: 'Filter:' + text: IPA.messages.objects.permission.filter+':' })). appendTo(dl); @@ -283,7 +291,7 @@ IPA.target_section = function(spec) { create:function(dl) { $('<dt/>'). append($('<label/>', { - text: 'By Subtree:' + text: IPA.messages.objects.permission.subtree+':' })). appendTo(dl); var dd = $('<dd/>', { @@ -306,7 +314,7 @@ IPA.target_section = function(spec) { create: function (dl) { $('<dt/>'). append($('<label/>', { - text: 'Target Group:' + text: IPA.messages.objects.permission.targetgroup+':' })). appendTo(dl); var dd = $('<dd/>', { @@ -329,7 +337,7 @@ IPA.target_section = function(spec) { create: function(dl) { $('<dt/>'). append($('<label/>', { - text: 'Object By Type:' + text: IPA.messages.objects.permission.type+':' })). appendTo(dl); var dd = $('<dd/>', { @@ -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<type_params.values.length; i++){ select.append($('<option/>', { 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<results.count; i++){ var result = results.result[i]; @@ -186,7 +186,7 @@ IPA.association_adder_dialog = function (spec) { var options = {'all': true}; if (hide_checkbox.attr('checked')) { - var relationships = IPA.metadata[that.other_entity].relationships; + var relationships = IPA.metadata.objects[that.other_entity].relationships; /* TODO: better generic handling of different relationships! */ var other_attribute_member = ''; @@ -310,7 +310,7 @@ IPA.association_table_widget = function (spec) { if (!that.columns.length) { that.create_column({ 'name': that.name, - 'label': IPA.metadata[that.other_entity].label, + 'label': IPA.metadata.objects[that.other_entity].label, 'primary_key': true }); } @@ -337,13 +337,13 @@ IPA.association_table_widget = function (spec) { $('<input/>', { 'type': 'button', 'name': 'remove', - 'value': 'Remove' + 'value': IPA.messages.buttons.remove }).appendTo(buttons); $('<input/>', { '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); + $('<div/>', { 'id': that.entity_name+'-'+that.other_entity, html: $('<h2/>',{ html: header_message }) @@ -723,13 +738,13 @@ IPA.association_facet = function (spec) { $('<input/>', { 'type': 'button', 'name': 'remove', - 'value': IPA.messages.button.remove + 'value': IPA.messages.buttons.remove }).appendTo(li); $('<input/>', { '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 <http://www.gnu.org/licenses/>. */ - -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<rdns.length; i++) { - var rdn = rdns[i]; - if (!rdn) continue; - - var parts = rdn.split('='); - var name = $.trim(parts[0].toLowerCase()); - var value = $.trim(parts[1]); - - var old_value = result[name]; - if (!old_value) { - result[name] = value; - } else if (typeof old_value == "string") { - result[name] = [old_value, value]; - } else { - result[name].push(value); - } +IPA.cert = {}; + +IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----'; +IPA.cert.END_CERTIFICATE = '-----END CERTIFICATE-----'; + +IPA.cert.BEGIN_CERTIFICATE_REQUEST = '-----BEGIN CERTIFICATE REQUEST-----'; +IPA.cert.END_CERTIFICATE_REQUEST = '-----END CERTIFICATE REQUEST-----'; + +IPA.cert.CERTIFICATE_STATUS_MISSING = 0; +IPA.cert.CERTIFICATE_STATUS_VALID = 1; +IPA.cert.CERTIFICATE_STATUS_REVOKED = 2; + +IPA.cert.CRL_REASON = [ + 'Unspecified', + 'Key Compromise', + 'CA Compromise', + 'Affiliation Changed', + 'Superseded', + 'Cessation of Operation', + 'Certificate Hold', + null, + 'Remove from CRL', + 'Privilege Withdrawn', + 'AA Compromise' +]; + +IPA.cert.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<rdns.length; i++) { + var rdn = rdns[i]; + if (!rdn) continue; + + var parts = rdn.split('='); + var name = $.trim(parts[0].toLowerCase()); + var value = $.trim(parts[1]); + + var old_value = result[name]; + if (!old_value) { + result[name] = value; + } else if (typeof old_value == "string") { + result[name] = [old_value, value]; + } else { + result[name].push(value); } + } - return result; - }, - + return result; +}; - get_dialog: function (spec) { - var that = {}; - spec = spec || {}; +IPA.cert.get_dialog = function(spec) { - that.title = spec.title || ''; - that.usercertificate = spec.usercertificate || ''; + spec = spec || {}; - var dialog = $('<div/>', { - 'title': that.title + var that = {}; + + that.title = spec.title || ''; + that.usercertificate = spec.usercertificate || ''; + + var dialog = $('<div/>', { + 'title': that.title + }); + + var textarea = $('<textarea/>', { + readonly: 'yes', + style: 'width: 100%; height: 275px;' + }).appendTo(dialog); + + textarea.val( + IPA.cert.BEGIN_CERTIFICATE+'\n'+ + that.usercertificate+'\n'+ + IPA.cert.END_CERTIFICATE); + + that.open = function() { + dialog.dialog({ + modal: true, + width: 500, + height: 400, + buttons: { + 'Close': function() { + dialog.dialog('destroy'); + } + } }); + }; - var textarea = $('<textarea/>', { - readonly: 'yes', - style: 'width: 100%; height: 275px;' - }).appendTo(dialog); - - textarea.val( - IPA.cert.BEGIN_CERTIFICATE+'\n'+ - that.usercertificate+'\n'+ - IPA.cert.END_CERTIFICATE ); - - that.open = function() { - dialog.dialog({ - modal: true, - width: 500, - height: 400, - buttons: { - 'Close': function() { - dialog.dialog('destroy'); - } - } - }); - }; + return that; +}; - return that; - }, +IPA.cert.revoke_dialog = function(spec) { + spec = spec || {}; - revoke_dialog: function (spec) { - var that = {}; - spec = spec || {}; + var that = {}; - that.title = spec.title || ''; - that.revoke = spec.revoke; + that.title = spec.title || ''; + that.revoke = spec.revoke; - var dialog = $('<div/>', { - 'title': that.title - }); + var dialog = $('<div/>', { + 'title': that.title + }); - var table = $('<table/>').appendTo(dialog); + var table = $('<table/>').appendTo(dialog); - var tr = $('<tr/>').appendTo(table); + var tr = $('<tr/>').appendTo(table); - var td = $('<td/>').appendTo(tr); - td.append('Note:'); + var td = $('<td/>').appendTo(tr); + td.append(IPA.messages.objects.cert.note+':'); - td = $('<td/>').appendTo(tr); - td.append( - 'To confirm your intention to revoke this certificate, '+ - 'select a reason from the pull-down list, and click '+ - 'the "Revoke" button.'); + td = $('<td/>').appendTo(tr); + td.append(IPA.messages.objects.cert.revoke_confirmation); - tr = $('<tr/>').appendTo(table); + tr = $('<tr/>').appendTo(table); - td = $('<td/>').appendTo(tr); - td.append('Reason for Revocation:'); + td = $('<td/>').appendTo(tr); + td.append(IPA.messages.objects.cert.reason+':'); - td = $('<td/>').appendTo(tr); + td = $('<td/>').appendTo(tr); - var select = $('<select/>').appendTo(td); - for (var i=0; i<IPA.cert.CRL_REASON.length; i++) { - if (!IPA.cert.CRL_REASON[i]) continue; - $('<option/>', { - 'value': i, - 'html': IPA.cert.CRL_REASON[i] - }).appendTo(select); - } + var select = $('<select/>').appendTo(td); + for (var i=0; i<IPA.cert.CRL_REASON.length; i++) { + if (!IPA.cert.CRL_REASON[i]) continue; + $('<option/>', { + 'value': i, + 'html': IPA.cert.CRL_REASON[i] + }).appendTo(select); + } - that.open = function() { - dialog.dialog({ - modal: true, - width: 500, - height: 300, - buttons: { - 'Revoke': function() { - var values = {}; - values['reason'] = select.val(); - if (that.revoke) { - that.revoke(values); - } - dialog.dialog('destroy'); - }, - 'Cancel': function() { - dialog.dialog('destroy'); + that.open = function() { + dialog.dialog({ + modal: true, + width: 500, + height: 300, + buttons: { + 'Revoke': function() { + var values = {}; + values['reason'] = select.val(); + if (that.revoke) { + that.revoke(values); } + dialog.dialog('destroy'); + }, + 'Cancel': function() { + dialog.dialog('destroy'); } - }); - }; + } + }); + }; - return that; - }, + return that; +}; - restore_dialog: function (spec) { - var that = {}; - spec = spec || {}; +IPA.cert.restore_dialog = function(spec) { - that.title = spec.title || ''; - that.restore = spec.restore; + spec = spec || {}; - var dialog = $('<div/>', { - 'title': that.title - }); + var that = {}; - dialog.append( - 'To confirm your intention to restore this certificate, '+ - 'click the "Restore" button.'); - - that.open = function() { - dialog.dialog({ - modal: true, - width: 400, - height: 200, - buttons: { - 'Restore': function() { - var values = {}; - if (that.restore) { - that.restore(values); - } - dialog.dialog('destroy'); - }, - 'Cancel': function() { - dialog.dialog('destroy'); - } - } - }); - }; - - return that; - }, - - view_dialog: function (spec) { - var that = {}; - spec = spec || {}; - - that.title = spec.title || ''; - that.subject = IPA.cert.parse_dn(spec.subject); - that.serial_number = spec.serial_number || ''; - that.issuer = IPA.cert.parse_dn(spec.issuer); - that.issued_on = spec.issued_on || ''; - that.expires_on = spec.expires_on || ''; - that.md5_fingerprint = spec.md5_fingerprint || ''; - that.sha1_fingerprint = spec.sha1_fingerprint || ''; - - var dialog = $('<div/>', { - 'title': that.title - }); + that.title = spec.title || ''; + that.restore = spec.restore; + + var dialog = $('<div/>', { + 'title': that.title + }); - var table = $('<table/>').appendTo(dialog); - - var tr = $('<tr/>').appendTo(table); - $('<td/>', { - 'colspan': 2, - 'html': '<h3>Issued To</h3>' - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Common Name:</td>').appendTo(tr); - $('<td/>', { - 'html': that.subject.cn - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Organization:</td>').appendTo(tr); - $('<td/>', { - 'html': that.subject.o - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Organizational Unit:</td>').appendTo(tr); - $('<td/>', { - 'html': that.subject.ou - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Serial Number:</td>').appendTo(tr); - $('<td/>', { - 'html': that.serial_number - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td/>', { - 'colspan': 2, - 'html': '<h3>Issued By</h3>' - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Common Name:</td>').appendTo(tr); - $('<td/>', { - 'html': that.issuer.cn - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Organization:</td>').appendTo(tr); - $('<td/>', { - 'html': that.issuer.o - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Organizational Unit:</td>').appendTo(tr); - $('<td/>', { - 'html': that.issuer.ou - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td/>', { - 'colspan': 2, - 'html': '<h3>Validity</h3>' - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Issued On:</td>').appendTo(tr); - $('<td/>', { - 'html': that.issued_on - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>Expires On:</td>').appendTo(tr); - $('<td/>', { - 'html': that.expires_on - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td/>', { - 'colspan': 2, - 'html': '<h3>Fingerprints</h3>' - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>SHA1 Fingerprint:</td>').appendTo(tr); - $('<td/>', { - 'html': that.sha1_fingerprint - }).appendTo(tr); - - tr = $('<tr/>').appendTo(table); - $('<td>MD5 Fingerprint:</td>').appendTo(tr); - $('<td/>', { - 'html': that.md5_fingerprint - }).appendTo(tr); - - that.open = function() { - dialog.dialog({ - modal: true, - width: 600, - height: 500, - buttons: { - 'Close': function() { - dialog.dialog('destroy'); + dialog.append( + IPA.messages.objects.cert.restore_confirmation); + + that.open = function() { + dialog.dialog({ + modal: true, + width: 400, + height: 200, + buttons: { + 'Restore': function() { + var values = {}; + if (that.restore) { + that.restore(values); } + dialog.dialog('destroy'); + }, + 'Cancel': function() { + dialog.dialog('destroy'); } - }); - }; + } + }); + }; - return that; - }, + return that; +}; - request_dialog: function (spec) { - var that = {}; - spec = spec || {}; +IPA.cert.view_dialog = function(spec) { - that.title = spec.title || ''; - that.request = spec.request; + spec = spec || {}; - var dialog = $('<div/>', { - 'title': that.title + var that = {}; + + that.title = spec.title || ''; + that.subject = IPA.cert.parse_dn(spec.subject); + that.serial_number = spec.serial_number || ''; + that.issuer = IPA.cert.parse_dn(spec.issuer); + that.issued_on = spec.issued_on || ''; + that.expires_on = spec.expires_on || ''; + that.md5_fingerprint = spec.md5_fingerprint || ''; + that.sha1_fingerprint = spec.sha1_fingerprint || ''; + + var dialog = $('<div/>', { + 'title': that.title + }); + + var table = $('<table/>').appendTo(dialog); + + var tr = $('<tr/>').appendTo(table); + $('<td/>', { + 'colspan': 2, + 'html': '<h3>'+IPA.messages.objects.cert.issued_to+'</h3>' + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.common_name+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.subject.cn + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.organization+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.subject.o + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.organizational_unit+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.subject.ou + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.serial_number+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.serial_number + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td/>', { + 'colspan': 2, + 'html': '<h3>'+IPA.messages.objects.cert.issued_by+'</h3>' + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.common_name+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.issuer.cn + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.organization+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.issuer.o + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.organizational_unit+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.issuer.ou + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td/>', { + 'colspan': 2, + 'html': '<h3>'+IPA.messages.objects.cert.validity+'</h3>' + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.issued_on+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.issued_on + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.expires_on+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.expires_on + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td/>', { + 'colspan': 2, + 'html': '<h3>'+IPA.messages.objects.cert.fingerprints+'</h3>' + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.sha1_fingerprint+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.sha1_fingerprint + }).appendTo(tr); + + tr = $('<tr/>').appendTo(table); + $('<td>'+IPA.messages.objects.cert.md5_fingerprint+':</td>').appendTo(tr); + $('<td/>', { + 'html': that.md5_fingerprint + }).appendTo(tr); + + that.open = function() { + dialog.dialog({ + modal: true, + width: 600, + height: 500, + buttons: { + 'Close': function() { + dialog.dialog('destroy'); + } + } }); + }; - dialog.append('Copy and paste the Base64-encoded CSR below:'); - dialog.append('<br/>'); - dialog.append('<br/>'); - - dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST); - dialog.append('<br/>'); - - var textarea = $('<textarea/>', { - style: 'width: 100%; height: 225px;' - }).appendTo(dialog); - - dialog.append('<br/>'); - dialog.append(IPA.cert.END_CERTIFICATE_REQUEST); - - that.open = function() { - dialog.dialog({ - modal: true, - width: 500, - height: 400, - buttons: { - 'Issue': function() { - var values = {}; - var request = textarea.val(); - request = - IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+ - $.trim(request)+'\n'+ - IPA.cert.END_CERTIFICATE_REQUEST+'\n'; - values['request'] = request; - if (that.request) { - that.request(values); - } - dialog.dialog('destroy'); - }, - 'Cancel': function() { - dialog.dialog('destroy'); + return that; +}; + +IPA.cert.request_dialog = function(spec) { + + spec = spec || {}; + + var that = {}; + + that.title = spec.title || ''; + that.request = spec.request; + + var dialog = $('<div/>', { + 'title': that.title + }); + + dialog.append(IPA.messages.objects.cert.enter_csr+':'); + dialog.append('<br/>'); + dialog.append('<br/>'); + + dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST); + dialog.append('<br/>'); + + var textarea = $('<textarea/>', { + style: 'width: 100%; height: 225px;' + }).appendTo(dialog); + + dialog.append('<br/>'); + dialog.append(IPA.cert.END_CERTIFICATE_REQUEST); + + that.open = function() { + dialog.dialog({ + modal: true, + width: 500, + height: 400, + buttons: { + 'Issue': function() { + var values = {}; + var request = textarea.val(); + request = + IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+ + $.trim(request)+'\n'+ + IPA.cert.END_CERTIFICATE_REQUEST+'\n'; + values['request'] = request; + if (that.request) { + that.request(values); } + dialog.dialog('destroy'); + }, + 'Cancel': function() { + dialog.dialog('destroy'); } - }); - }; + } + }); + }; - return that; - } + return that; }; -IPA.certificate_status_widget = function(spec) { +IPA.cert.status_widget = function(spec) { spec = spec || {}; @@ -430,14 +436,14 @@ IPA.certificate_status_widget = function(spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Valid Certificate Present:</b>'); + content_div.append('<b>'+IPA.messages.objects.cert.valid+':</b>'); content_div.append(' '); $('<input/>', { 'type': 'button', 'name': 'get', - 'value': 'Get' + 'value': IPA.messages.buttons.get }).appendTo(content_div); content_div.append(' '); @@ -446,7 +452,7 @@ IPA.certificate_status_widget = function(spec) { $('<input/>', { 'type': 'button', 'name': 'revoke', - 'value': 'Revoke' + 'value': IPA.messages.buttons.revoke }).appendTo(content_div); content_div.append(' '); @@ -455,7 +461,7 @@ IPA.certificate_status_widget = function(spec) { $('<input/>', { 'type': 'button', 'name': 'view', - 'value': 'View' + 'value': IPA.messages.buttons.view }).appendTo(content_div); content_div.append(' '); @@ -463,7 +469,7 @@ IPA.certificate_status_widget = function(spec) { $('<input/>', { 'type': 'button', 'name': 'create', - 'value': 'New Certificate' + 'value': IPA.messages.objects.cert.new_certificate }).appendTo(content_div); if (!that.is_selfsign()) { @@ -482,7 +488,7 @@ IPA.certificate_status_widget = function(spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Certificate Revoked:</b>'); + content_div.append('<b>'+IPA.messages.objects.cert.revoked+':</b>'); content_div.append(' '); @@ -495,7 +501,7 @@ IPA.certificate_status_widget = function(spec) { $('<input/>', { 'type': 'button', 'name': 'restore', - 'value': 'Restore' + 'value': IPA.messages.buttons.restore }).appendTo(content_div); content_div.append(' '); @@ -503,7 +509,7 @@ IPA.certificate_status_widget = function(spec) { $('<input/>', { 'type': 'button', 'name': 'create', - 'value': 'New Certificate' + 'value': IPA.messages.objects.cert.new_certificate }).appendTo(content_div); } @@ -522,14 +528,14 @@ IPA.certificate_status_widget = function(spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>No Valid Certificate:</b>'); + content_div.append('<b>'+IPA.messages.objects.cert.missing+':</b>'); content_div.append(' '); $('<input/>', { 'type': 'button', 'name': 'create', - 'value': 'New Certificate' + 'value': IPA.messages.objects.cert.new_certificate }).appendTo(content_div); }; @@ -543,7 +549,7 @@ IPA.certificate_status_widget = function(spec) { var button = $('input[name=get]', that.container); that.get_button = IPA.button({ - 'label': 'Get', + label: IPA.messages.buttons.get, 'click': function() { IPA.cmd(that.entity_name+'_show', [that.pkey], {}, function(data, text_status, xhr) { @@ -556,7 +562,7 @@ IPA.certificate_status_widget = function(spec) { button = $('input[name=revoke]', that.container); that.revoke_button = IPA.button({ - 'label': 'Revoke', + label: IPA.messages.buttons.revoke, 'click': function() { IPA.cmd(that.entity_name+'_show', [that.pkey], {}, function(data, text_status, xhr) { @@ -569,7 +575,7 @@ IPA.certificate_status_widget = function(spec) { button = $('input[name=view]', that.container); that.view_button = IPA.button({ - 'label': 'View', + label: IPA.messages.buttons.view, 'click': function() { IPA.cmd(that.entity_name+'_show', [that.pkey], {}, function(data, text_status, xhr) { @@ -584,7 +590,7 @@ IPA.certificate_status_widget = function(spec) { button = $('input[name=restore]', that.container); that.restore_button = IPA.button({ - 'label': 'Restore', + label: IPA.messages.buttons.restore, 'click': function() { IPA.cmd(that.entity_name+'_show', [that.pkey], {}, function(data, text_status, xhr) { @@ -598,7 +604,7 @@ IPA.certificate_status_widget = function(spec) { $('input[name=create]', that.container).each(function(index) { button = $(this); that.create_button = IPA.button({ - 'label': 'New Certificate', + label: IPA.messages.objects.cert.new_certificate, 'click': function() { request_certificate(that.result); } @@ -626,9 +632,9 @@ IPA.certificate_status_widget = function(spec) { if (!that.is_selfsign()) { that.status_revoked.css('display', status == IPA.cert.CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none'); - that.revoke_button.css('visibility', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden'); + that.revoke_button.css('display', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'inline' : 'none'); that.revocation_reason.html(revocation_reason == undefined ? '' : IPA.cert.CRL_REASON[revocation_reason]); - that.restore_button.css('visibility', revocation_reason == 6 ? 'visible' : 'hidden'); + that.restore_button.css('display', revocation_reason == 6 ? 'inline' : 'none'); } } @@ -664,8 +670,12 @@ IPA.certificate_status_widget = function(spec) { var entity_name = that.get_entity_name(result); + var title = IPA.messages.objects.cert.view_certificate; + title = title.replace('${entity}', that.entity_label); + title = title.replace('${primary_key}', entity_name); + var dialog = IPA.cert.view_dialog({ - 'title': 'Certificate for '+that.entity_label+' '+entity_name, + 'title': title, 'subject': result['subject'], 'serial_number': result['serial_number'], 'issuer': result['issuer'], @@ -688,8 +698,12 @@ IPA.certificate_status_widget = function(spec) { var entity_name = that.get_entity_name(result); + var title = IPA.messages.objects.cert.view_certificate; + title = title.replace('${entity}', that.entity_label); + title = title.replace('${primary_key}', entity_name); + var dialog = IPA.cert.get_dialog({ - 'title': 'Certificate for '+that.entity_label+' '+entity_name, + 'title': title, 'usercertificate': entity_certificate }); @@ -701,8 +715,12 @@ IPA.certificate_status_widget = function(spec) { var entity_name = that.get_entity_name(result); var entity_principal = that.get_entity_principal(result); + var title = IPA.messages.objects.cert.issue_certificate; + title = title.replace('${entity}', that.entity_label); + title = title.replace('${primary_key}', entity_name); + var dialog = IPA.cert.request_dialog({ - 'title': 'Issue New Certificate for '+that.entity_label+' '+entity_name, + 'title': title, 'request': function(values) { var request = values['request']; @@ -733,8 +751,12 @@ IPA.certificate_status_widget = function(spec) { var entity_name = that.get_entity_name(result); var serial_number = result['serial_number']; + var title = IPA.messages.objects.cert.revoke_certificate; + title = title.replace('${entity}', that.entity_label); + title = title.replace('${primary_key}', entity_name); + var dialog = IPA.cert.revoke_dialog({ - 'title': 'Revoke Certificate for '+that.entity_label+' '+entity_name, + 'title': title, 'revoke': function(values) { var reason = values['reason']; @@ -765,8 +787,12 @@ IPA.certificate_status_widget = function(spec) { var entity_name = that.get_entity_name(result); var serial_number = result['serial_number']; + var title = IPA.messages.objects.cert.restore_certificate; + title = title.replace('${entity}', that.entity_label); + title = title.replace('${primary_key}', entity_name); + var dialog = IPA.cert.restore_dialog({ - 'title': 'Restore Certificate for '+that.entity_label+' '+entity_name, + 'title': title, 'restore': function(values) { IPA.cmd( 'cert_remove_hold', diff --git a/install/ui/details.js b/install/ui/details.js index 82800eb35..f579fb612 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -239,9 +239,6 @@ IPA.details_list_section = function(spec) { var label = field.label || ''; - // no need to get i18n label from metadata - // because it's already done by field.init() - $('<dt/>', { html: label+':', title: label @@ -340,7 +337,7 @@ IPA.details_facet = function(spec) { }; that.get_primary_key = function() { - var pkey_name = IPA.metadata[that.entity_name].primary_key; + var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; if (that.record[pkey_name] instanceof Array){ return that.record[pkey_name][0]; }else{ @@ -352,8 +349,13 @@ IPA.details_facet = function(spec) { container.attr('title', that.entity_name); + var label = IPA.metadata.objects[that.entity_name].label; + + var title = IPA.messages.details.settings; + title = title.replace('${entity}', label); + $('<h1/>',{ - html: "<span id='headerpkey' />"+that.entity_name + ' Settings' + html: "<span id='headerpkey' />"+title }).append(IPA.create_network_spinner()). appendTo(container); @@ -650,7 +652,7 @@ IPA.details_update = function(on_win, on_fail) { values = field.save(); if (!values) continue; - var param_info = IPA.get_param_info(entity_name, field.name); + var param_info = IPA.get_entity_param(entity_name, field.name); if (param_info) { if (param_info['primary_key']) continue; if (values.length === 1) { diff --git a/install/ui/dialog.js b/install/ui/dialog.js index 535804426..406779ef5 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -349,7 +349,7 @@ IPA.adder_dialog = function (spec) { style: 'margin-left: 3px' }); - label.text('Hide already enrolled.'); + label.text(IPA.messages.dialogs.hide_already_enrolled); label.appendTo(search_panel); @@ -365,7 +365,7 @@ IPA.adder_dialog = function (spec) { }).appendTo(results_panel); $('<div/>', { - html: 'Available', + html: IPA.messages.dialogs.available, 'class': 'ui-widget-header' }).appendTo(available_panel); @@ -396,7 +396,7 @@ IPA.adder_dialog = function (spec) { }).appendTo(results_panel); $('<div/>', { - html: 'Prospective', + html: IPA.messages.dialogs.prospective, 'class': 'ui-widget-header' }).appendTo(selected_panel); @@ -511,7 +511,7 @@ IPA.deleter_dialog = function (spec) { var that = IPA.dialog(spec); - that.title = spec.title || IPA.messages.button.remove; + that.title = spec.title || IPA.messages.buttons.remove; that.values = spec.values || []; diff --git a/install/ui/entity.js b/install/ui/entity.js index a5aed0d78..01ad47eb7 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -188,7 +188,7 @@ IPA.entity = function (spec) { that.create_association_facets = function() { - var attribute_members = IPA.metadata[that.name].attribute_members; + var attribute_members = IPA.metadata.objects[that.name].attribute_members; for (var attribute_member in attribute_members) { @@ -200,9 +200,9 @@ IPA.entity = function (spec) { for (var j = 0; j < other_entities.length; j++) { var other_entity = other_entities[j]; - var label = IPA.metadata[other_entity].label; + var label = IPA.metadata.objects[other_entity].label; - var relationships = IPA.metadata[that.name].relationships; + var relationships = IPA.metadata.objects[that.name].relationships; var relationship = relationships[attribute_member]; if (!relationship) @@ -222,7 +222,7 @@ IPA.entity = function (spec) { that.init = function() { if (!that.label) { - that.label = IPA.metadata[that.name].label; + that.label = IPA.metadata.objects[that.name] ? IPA.metadata.objects[that.name].label : that.name; } if (that.autogenerate_associations) { @@ -268,7 +268,7 @@ IPA.entity_get_search_facet = function (entity_name) { facet = IPA.search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); entity.add_facet(facet); @@ -488,7 +488,7 @@ IPA. facet_create_action_panel = function(container) { var that = this; var entity_name = that.entity_name; - var panel_title = IPA.metadata[entity_name].label; + var panel_title = IPA.metadata.objects[entity_name].label; var nested_tabs = IPA.nested_tabs(entity_name); @@ -527,7 +527,7 @@ IPA. facet_create_action_panel = function(container) { if ( entity.facets[0].name === IPA.current_facet( entity)){ if (nested_tabs.length > 1 ){ main_facet.html(IPA.selected_icon + - IPA.metadata[nested_tabs[nested_index]].label); + IPA.metadata.objects[nested_tabs[nested_index]].label); main_facet.addClass('entity-facet-selected'); main_facet.appendTo(ul); @@ -538,7 +538,7 @@ IPA. facet_create_action_panel = function(container) { $('<span />',{ "class":"input_link" }). - append(IPA.back_icon + ' Back to List ')); + append(IPA.back_icon + ' '+IPA.messages.buttons.back_to_list+' ')); main_facet.addClass('back-to-search'); main_facet.appendTo(ul); } @@ -600,7 +600,7 @@ IPA. facet_create_action_panel = function(container) { }else{ $('<li/>', { title: nested_tabs[nested_index], - text: IPA.metadata[nested_tabs[nested_index]].label, + text: IPA.metadata.objects[nested_tabs[nested_index]].label, "class": "search-facet", click: function() { var state = {}; diff --git a/install/ui/group.js b/install/ui/group.js index 8b7fc46b8..d2e35e258 100644 --- a/install/ui/group.js +++ b/install/ui/group.js @@ -37,21 +37,23 @@ IPA.entity_factories.group = function () { dialog( IPA.add_dialog({ 'name': 'add', - 'title': 'Add New Group' + 'title': IPA.messages.objects.group.add }). field(IPA.text_widget({name: 'cn', undo: false})). field(IPA.text_widget({name: 'description', undo: false})). - // TODO: Replace with i18n label field(IPA.checkbox_widget({ name: 'posix', - label: 'Is this a POSIX group?', + label: IPA.messages.objects.group.posix, undo: false, checked: 'checked'})). field(IPA.text_widget({name: 'gidnumber', undo: false})))). facet( IPA.details_facet(). section( - IPA.stanza({label: 'Group Settings' }). + IPA.stanza({ + name: 'details', + label: IPA.messages.objects.group.details + }). input({name: 'cn' }). input({name: 'description'}). input({name: 'gidnumber' }))). diff --git a/install/ui/hbacrule.js b/install/ui/hbacrule.js index f55f233cc..743b9e0c5 100644 --- a/install/ui/hbacrule.js +++ b/install/ui/hbacrule.js @@ -32,12 +32,12 @@ IPA.entity_factories.hbacrule = function () { var facet = IPA.hbacrule_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.hbacrule_add_dialog({ 'name': 'add', - 'title': 'Add New Rule' + 'title': IPA.messages.objects.hbacrule.add }); facet.dialog(dialog); @@ -73,8 +73,8 @@ IPA.hbacrule_add_dialog = function (spec) { that.add_field(IPA.radio_widget({ 'name': 'accessruletype', 'options': [ - { 'value': 'allow', 'label': 'Allow' }, - { 'value': 'deny', 'label': 'Deny' } + { 'value': 'allow', 'label': IPA.messages.objects.hbacrule.allow }, + { 'value': 'deny', 'label': IPA.messages.objects.hbacrule.deny } ], 'undo': false })); @@ -143,39 +143,41 @@ IPA.hbacrule_details_facet = function (spec) { if (IPA.layout) { section = that.create_section({ 'name': 'general', - 'label': 'General', + 'label': IPA.messages.details.general, 'template': 'hbacrule-details-general.html #contents' }); } else { section = IPA.hbacrule_details_general_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.details.general }); that.add_section(section); } - section.text({name: 'cn', label: 'Name', read_only: true}); - section.radio({name: 'accessruletype', label: 'Rule Type'}); - section.textarea({name: 'description', label: 'Description'}); - section.radio({name: 'ipaenabledflag', label: 'Enabled'}); + section.text({name: 'cn', read_only: true}); + section.radio({name: 'accessruletype'}); + section.textarea({name: 'description'}); + section.radio({name: 'ipaenabledflag'}); + + var param_info = IPA.get_entity_param('hbacrule', 'usercategory'); if (IPA.layout) { section = that.create_section({ 'name': 'user', - 'label': 'Who', + 'label': IPA.messages.objects.hbacrule.user, 'template': 'hbacrule-details-user.html #contents' }); } else { section = IPA.rule_details_section({ 'name': 'user', - 'label': 'Who', - 'text': 'Rule applies when access is requested by:', + 'label': IPA.messages.objects.hbacrule.user, + 'text': param_info.doc+':', 'field_name': 'usercategory', 'options': [ - { 'value': 'all', 'label': 'Anyone' }, - { 'value': '', 'label': 'Specified Users and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.hbacrule.anyone }, + { 'value': '', 'label': IPA.messages.objects.hbacrule.specified_users } ], 'tables': [ { 'field_name': 'memberuser_user' }, @@ -185,34 +187,36 @@ IPA.hbacrule_details_facet = function (spec) { that.add_section(section); } - var category = section.radio({ name: 'usercategory', label: 'User category' }); + var category = section.radio({ name: 'usercategory' }); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberuser_user', - 'name': 'memberuser_user', 'label': 'Users', 'category': category, + 'name': 'memberuser_user', 'category': category, 'other_entity': 'user', 'add_method': 'add_user', 'remove_method': 'remove_user' })); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberuser_group', - 'name': 'memberuser_group', 'label': 'Groups', 'category': category, + 'name': 'memberuser_group', 'category': category, 'other_entity': 'group', 'add_method': 'add_user', 'remove_method': 'remove_user' })); + param_info = IPA.get_entity_param('hbacrule', 'hostcategory'); + if (IPA.layout) { section = that.create_section({ 'name': 'host', - 'label': 'Accessing', + 'label': IPA.messages.objects.hbacrule.host, 'template': 'hbacrule-details-host.html #contents' }); } else { section = IPA.rule_details_section({ 'name': 'host', - 'label': 'Accessing', - 'text': 'Rule applies when access is requested to:', + 'label': IPA.messages.objects.hbacrule.host, + 'text': param_info.doc+':', 'field_name': 'hostcategory', 'options': [ - { 'value': 'all', 'label': 'Any Host' }, - { 'value': '', 'label': 'Specified Hosts and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.hbacrule.any_host }, + { 'value': '', 'label': IPA.messages.objects.hbacrule.specified_hosts } ], 'tables': [ { 'field_name': 'memberhost_host' }, @@ -222,34 +226,36 @@ IPA.hbacrule_details_facet = function (spec) { that.add_section(section); } - category = section.radio({ 'name': 'hostcategory', 'label': 'Host category' }); + category = section.radio({ 'name': 'hostcategory' }); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberhost_host', - 'name': 'memberhost_host', 'label': 'Hosts', 'category': category, + 'name': 'memberhost_host', 'category': category, 'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host' })); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberhost_hostgroup', - 'name': 'memberhost_hostgroup', 'label': 'Host Groups', 'category': category, + 'name': 'memberhost_hostgroup', 'category': category, 'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host' })); + param_info = IPA.get_entity_param('hbacrule', 'servicecategory'); + if (IPA.layout) { section = that.create_section({ 'name': 'service', - 'label': 'Via Service', + 'label': IPA.messages.objects.hbacrule.service, 'template': 'hbacrule-details-service.html #contents' }); } else { section = IPA.rule_details_section({ 'name': 'service', - 'label': 'Via Service', - 'text': 'Rule applies when access is requested via:', + 'label': IPA.messages.objects.hbacrule.service, + 'text': param_info.doc+':', 'field_name': 'servicecategory', 'options': [ - { 'value': 'all', 'label': 'Any Service' }, - { 'value': '', 'label': 'Specified Services and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.hbacrule.any_service }, + { 'value': '', 'label': IPA.messages.objects.hbacrule.specified_services } ], 'tables': [ { 'field_name': 'memberservice_hbacsvc' }, @@ -259,34 +265,36 @@ IPA.hbacrule_details_facet = function (spec) { that.add_section(section); } - category = section.radio({ 'name': 'servicecategory', 'label': 'Service category' }); + category = section.radio({ 'name': 'servicecategory' }); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberservice_hbacsvc', - 'name': 'memberservice_hbacsvc', 'label': 'Services', 'category': category, + 'name': 'memberservice_hbacsvc', 'category': category, 'other_entity': 'hbacsvc', 'add_method': 'add_service', 'remove_method': 'remove_service' })); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-memberservice_hbacsvcgroup', - 'name': 'memberservice_hbacsvcgroup', 'label': 'Service Groups', 'category': category, + 'name': 'memberservice_hbacsvcgroup', 'category': category, 'other_entity': 'hbacsvcgroup', 'add_method': 'add_service', 'remove_method': 'remove_service' })); + param_info = IPA.get_entity_param('hbacrule', 'sourcehostcategory'); + if (IPA.layout) { section = that.create_section({ 'name': 'sourcehost', - 'label': 'From', + 'label': IPA.messages.objects.hbacrule.sourcehost, 'template': 'hbacrule-details-sourcehost.html #contents' }); } else { section = IPA.rule_details_section({ 'name': 'sourcehost', - 'label': 'From', - 'text': 'Rule applies when access is being initiated from:', + 'label': IPA.messages.objects.hbacrule.sourcehost, + 'text': param_info.doc+':', 'field_name': 'sourcehostcategory', 'options': [ - { 'value': 'all', 'label': 'Any Host' }, - { 'value': '', 'label': 'Specified Hosts and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.hbacrule.any_host }, + { 'value': '', 'label': IPA.messages.objects.hbacrule.specified_hosts } ], 'tables': [ { 'field_name': 'sourcehost_host' }, @@ -296,15 +304,15 @@ IPA.hbacrule_details_facet = function (spec) { that.add_section(section); } - category = section.radio({ 'name': 'sourcehostcategory', 'label': 'Source host category' }); + category = section.radio({ 'name': 'sourcehostcategory' }); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-sourcehost_host', - 'name': 'sourcehost_host', 'label': 'Host', 'category': category, + 'name': 'sourcehost_host', 'category': category, 'other_entity': 'host', 'add_method': 'add_sourcehost', 'remove_method': 'remove_sourcehost' })); section.add_field(IPA.rule_association_table_widget({ 'id': that.entity_name+'-sourcehost_hostgroup', - 'name': 'sourcehost_hostgroup', 'label': 'Host Groups', 'category': category, + 'name': 'sourcehost_hostgroup', 'category': category, 'other_entity': 'hostgroup', 'add_method': 'add_sourcehost', 'remove_method': 'remove_sourcehost' })); /* @@ -430,7 +438,7 @@ IPA.hbacrule_details_facet = function (spec) { var values = field.save(); if (!values) continue; - var param_info = IPA.get_param_info(that.entity_name, field.name); + var param_info = IPA.get_entity_param(that.entity_name, field.name); // skip primary key if (param_info && param_info['primary_key']) continue; @@ -555,12 +563,15 @@ IPA.hbacrule_details_general_section = function (spec){ var tr = $('<tr/>').appendTo(table); var td = $('<td/>', { - 'style': 'width: 100px; text-align: right;', - 'html': 'Name:' + 'style': 'width: 100px; text-align: right;' }).appendTo(tr); + var param_info = IPA.get_entity_param('hbacrule', 'cn'); + td.append(param_info.label+':'); + td = $('<td/>').appendTo(tr); + var field = that.get_field('cn'); var span = $('<span/>', { 'name': 'cn' }).appendTo(td); $('<label/>', { @@ -576,19 +587,16 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); td = $('<td/>', { 'style': 'text-align: right;' }).appendTo(tr); - td.append('Rule type:'); + param_info = IPA.get_entity_param('hbacrule', 'accessruletype'); + td.append(param_info.label+':'); + field = that.get_field('accessruletype'); span = $('<span/>', { 'name': 'accessruletype' }).appendTo(td); $('<input/>', { @@ -599,8 +607,7 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Allow'); + span.append(IPA.messages.objects.hbacrule.allow); span.append(' '); @@ -612,29 +619,26 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Deny'); + span.append(IPA.messages.objects.hbacrule.deny); span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); tr = $('<tr/>').appendTo(table); td = $('<td/>', { - 'style': 'text-align: right; vertical-align: top;', - 'html': 'Description:' + 'style': 'text-align: right; vertical-align: top;' }).appendTo(tr); + param_info = IPA.get_entity_param('hbacrule', 'description'); + td.append(param_info.label+':'); + td = $('<td/>', { 'colspan': 2 }).appendTo(tr); + field = that.get_field('description'); span = $('<span/>', { 'name': 'description' }).appendTo(td); $('<textarea/>', { @@ -645,24 +649,21 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); tr = $('<tr/>').appendTo(table); td = $('<td/>', { - 'style': 'text-align: right; vertical-align: top;', - 'html': 'Rule status:' + 'style': 'text-align: right; vertical-align: top;' }).appendTo(tr); + td.append(IPA.messages.objects.hbacrule.ipaenabledflag+':'); + td = $('<td/>', { 'colspan': 2 }).appendTo(tr); + field = that.get_field('ipaenabledflag'); span = $('<span/>', { 'name': 'ipaenabledflag' }).appendTo(td); $('<input/>', { @@ -673,8 +674,7 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Active'); + span.append(IPA.messages.objects.hbacrule.active); span.append(' '); @@ -686,17 +686,11 @@ IPA.hbacrule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Inactive'); + span.append(IPA.messages.objects.hbacrule.inactive); span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); }; return that; @@ -753,12 +747,7 @@ IPA.hbacrule_accesstime_widget = function (spec) { container.append(' '); } - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(container); + that.create_undo(container); container.append('<br/>'); @@ -771,13 +760,13 @@ IPA.hbacrule_accesstime_widget = function (spec) { $('<input/>', { 'type': 'button', 'name': 'remove', - 'value': 'Remove '+that.label + 'value': IPA.messages.buttons.remove }).appendTo(buttons); $('<input/>', { 'type': 'button', 'name': 'add', - 'value': 'Add '+that.label + 'value': IPA.messages.buttons.add }).appendTo(buttons); }; @@ -847,7 +836,10 @@ IPA.hbacrule_accesstime_widget = function (spec) { that.add = function() { var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var title = 'Add '+that.label+' to '+that.entity_name+' '+pkey; + var title = IPA.messages.association.add; + title = title.replace('${entity}', IPA.metadata.objects[that.entity_name].label); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', that.label); var dialog = IPA.dialog({ 'title': title @@ -917,20 +909,20 @@ IPA.hbacrule_accesstime_widget = function (spec) { command.execute(); } - dialog.add_button('Add', function() { + dialog.add_button(IPA.messages.buttons.add, function() { add( function() { dialog.reset(); } ); }); - dialog.add_button('Add and Close', function() { + dialog.add_button(IPA.messages.buttons.add_and_close, function() { add( function() { dialog.close(); }, function() { dialog.close(); } ); }); - dialog.add_button('Cancel', function() { + dialog.add_button(IPA.messages.buttons.cancel, function() { dialog.close(); }); @@ -943,13 +935,19 @@ IPA.hbacrule_accesstime_widget = function (spec) { var values = that.table.get_selected_values(); + var title; if (!values.length) { - alert('Select '+that.label+' to be removed.'); + title = IPA.messages.dialogs.remove_empty; + title = title.replace('${entity}', that.label); + alert(title); return; } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var title = 'Remove '+that.label+' from '+that.entity_name+' '+pkey; + title = IPA.messages.association.remove; + title = title.replace('${entity}', IPA.metadata.objects[that.entity_name].label); + title = title.replace('${primary_key}', pkey); + title = title.replace('${other_entity}', that.label); var dialog = IPA.deleter_dialog({ 'title': title, diff --git a/install/ui/hbacsvc.js b/install/ui/hbacsvc.js index 23e9da788..2112f3afe 100644 --- a/install/ui/hbacsvc.js +++ b/install/ui/hbacsvc.js @@ -32,12 +32,12 @@ IPA.entity_factories.hbacsvc = function () { var facet = IPA.hbacsvc_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.hbacsvc_add_dialog({ 'name': 'add', - 'title': 'Add New HBAC Service' + 'title': IPA.messages.objects.hbacsvc.add }); facet.dialog(dialog); @@ -102,7 +102,7 @@ IPA.hbacsvc_details_facet = function (spec) { var section = IPA.details_list_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.details.general }); that.add_section(section); diff --git a/install/ui/hbacsvcgroup.js b/install/ui/hbacsvcgroup.js index 61bce15e7..a69841397 100644 --- a/install/ui/hbacsvcgroup.js +++ b/install/ui/hbacsvcgroup.js @@ -32,12 +32,12 @@ IPA.entity_factories.hbacsvcgroup = function () { var facet = IPA.hbacsvcgroup_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.hbacsvcgroup_add_dialog({ 'name': 'add', - 'title': 'Add New HBAC Service Group' + 'title': IPA.messages.objects.hbacsvcgroup.add }); facet.dialog(dialog); @@ -102,7 +102,7 @@ IPA.hbacsvcgroup_details_facet = function (spec) { var section = IPA.details_list_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.details.general }); that.add_section(section); @@ -111,13 +111,13 @@ IPA.hbacsvcgroup_details_facet = function (spec) { section = IPA.details_section({ 'name': 'services', - 'label': 'Services' + 'label': IPA.messages.objects.hbacsvcgroup.services }); that.add_section(section); var field = IPA.hbacsvcgroup_member_hbacsvc_table_widget({ 'name': 'member_hbacsvc', - 'label': 'Services', + 'label': IPA.messages.objects.hbacsvcgroup.services, 'other_entity': 'hbacsvc', 'save_values': false }); diff --git a/install/ui/host.js b/install/ui/host.js index 943783e3b..981bfc021 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -34,13 +34,13 @@ IPA.entity_factories.host = function () { var facet = IPA.host_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); that.add_facet(facet); var dialog = IPA.host_add_dialog({ 'name': 'add', - 'title': 'Add New Host' + 'title': IPA.messages.objects.host.add }); facet.dialog(dialog); @@ -95,11 +95,12 @@ IPA.host_add_dialog = function (spec) { undo: false })); - // TODO: Replace with i18n label + var param_info = IPA.get_method_param('host_add', 'force'); + that.add_field(IPA.checkbox_widget({ name: 'force', - label: 'Force', - tooltip: 'force host name even if not in DNS', + label: param_info.label, + tooltip: param_info.doc, undo: false })); @@ -147,9 +148,11 @@ IPA.host_search_facet = function (spec) { that.create_column({name:'fqdn'}); that.create_column({name:'description'}); //TODO use the value of this field to set enrollment status - that.create_column({name:'krblastpwdchange', label:'Enrolled?', - format:IPA.utc_date_column_format - }); + that.create_column({ + name: 'krblastpwdchange', + label: IPA.messages.objects.host.enrolled, + format: IPA.utc_date_column_format + }); that.create_column({name:'nshostlocation'}); that.search_facet_init(); @@ -168,51 +171,47 @@ IPA.host_details_facet = function (spec) { that.init = function() { var section = IPA.details_list_section({ - 'name': 'details', - 'label': 'Host Settings' + name: 'details', + label: IPA.messages.objects.host.details }); that.add_section(section); - //TODO: use i18n labels section.text({ name: 'fqdn', - label: 'Fully Qualified Host Name' + label: IPA.messages.objects.host.fqdn }); section.text({'name': 'krbprincipalname'}); - //TODO: add this to the host plugin - //TODO: use i18n labels section.text({ - 'name': 'serverhostname', - 'label': 'Host Name' + name: 'cn', + label: IPA.messages.objects.host.cn, + read_only: true }); section.text({'name': 'description'}); - //TODO: use i18n labels section = IPA.details_list_section({ - 'name': 'enrollment', - 'label': 'Enrollment' + name: 'enrollment', + label: IPA.messages.objects.host.enrollment }); that.add_section(section); - //TODO add label to messages section.add_field(IPA.host_provisioning_status_widget({ 'name': 'provisioning_status', - 'label': 'Status', + label: IPA.messages.objects.host.status, 'facet': that })); section = IPA.details_list_section({ - 'name': 'certificate', - 'label': 'Host Certificate' + name: 'certificate', + label: IPA.messages.objects.host.status }); that.add_section(section); section.add_field(IPA.host_certificate_status_widget({ 'name': 'certificate_status', - 'label': 'Status' + label: IPA.messages.objects.host.status })); that.details_facet_init(); @@ -274,14 +273,14 @@ IPA.host_provisioning_status_widget = function (spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Kerberos Key Present, Host Provisioned:</b>'); + content_div.append('<b>'+IPA.messages.objects.host.valid+':</b>'); content_div.append(' '); $('<input/>', { 'type': 'button', 'name': 'unprovision', - 'value': 'Delete Key, Unprovision' + 'value': IPA.messages.objects.host.delete_key_unprovision }).appendTo(content_div); div = $('<div/>', { @@ -299,11 +298,11 @@ IPA.host_provisioning_status_widget = function (spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Kerberos Key Not Present</b>'); + content_div.append('<b>'+IPA.messages.objects.host.missing+'</b>'); content_div.append('<br/>'); - content_div.append('Enroll via One-Time-Password:'); + content_div.append(IPA.messages.objects.host.enroll_otp+':'); content_div.append('<br/>'); content_div.append('<br/>'); @@ -319,7 +318,7 @@ IPA.host_provisioning_status_widget = function (spec) { $('<input/>', { 'type': 'button', 'name': 'enroll', - 'value': 'Set OTP' + 'value': IPA.messages.objects.host.set_otp }).appendTo(content_div); }; @@ -332,7 +331,7 @@ IPA.host_provisioning_status_widget = function (spec) { var button = $('input[name=unprovision]', that.container); that.unprovision_button = IPA.button({ - 'label': 'Delete Key, Unprovision', + 'label': IPA.messages.objects.host.delete_key_unprovision, 'click': that.show_unprovision_dialog }); button.replaceWith(that.unprovision_button); @@ -341,7 +340,7 @@ IPA.host_provisioning_status_widget = function (spec) { that.enroll_button = $('input[name=enroll]', that.container); button = IPA.button({ - 'label': 'Set OTP', + 'label': IPA.messages.objects.host.set_otp, 'click': that.set_otp }); @@ -351,17 +350,19 @@ IPA.host_provisioning_status_widget = function (spec) { that.show_unprovision_dialog = function() { - var label = IPA.metadata[that.entity_name].label; + var label = IPA.metadata.objects[that.entity_name].label; + var title = IPA.messages.objects.host.unprovision_title; + title = title.replace('${entity}', label); + var dialog = IPA.dialog({ - 'title': 'Unprovisioning '+label + 'title': title }); dialog.create = function() { - dialog.container.append( - 'Are you sure you want to unprovision this host?'); + dialog.container.append(IPA.messages.objects.host.unprovision_confirmation); }; - dialog.add_button('Unprovision', function() { + dialog.add_button(IPA.messages.objects.host.unprovision, function() { that.unprovision( function(data, text_status, xhr) { set_status('missing'); @@ -411,7 +412,7 @@ IPA.host_provisioning_status_widget = function (spec) { 'userpassword': otp }, 'on_success': function(data, text_status, xhr) { - alert('One-Time-Password has been set.'); + alert(IPA.messages.objects.host.otp_confirmation); } }); @@ -436,11 +437,11 @@ IPA.host_certificate_status_widget = function (spec) { spec = spec || {}; - var that = IPA.certificate_status_widget(spec); + var that = IPA.cert.status_widget(spec); that.init = function() { - that.entity_label = IPA.metadata[that.entity_name].label; + that.entity_label = IPA.metadata.objects[that.entity_name].label; that.get_entity_pkey = function(result) { var values = result['fqdn']; diff --git a/install/ui/hostgroup.js b/install/ui/hostgroup.js index 6b7cb0a57..4738a26d6 100644 --- a/install/ui/hostgroup.js +++ b/install/ui/hostgroup.js @@ -34,7 +34,7 @@ IPA.entity_factories.hostgroup = function() { that.facet( IPA.search_facet({ name: 'search', - label: 'Search', + label: IPA.messages.facets.search, entity_name: that.name }). column({name:'cn'}). @@ -42,7 +42,7 @@ IPA.entity_factories.hostgroup = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Hostgroup' + title: IPA.messages.objects.hostgroup.add }). field(IPA.text_widget({name: 'cn', undo: false})). field(IPA.text_widget({name: 'description', undo: false})))); @@ -50,7 +50,10 @@ IPA.entity_factories.hostgroup = function() { that.facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'Hostgroup Settings'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.hostgroup.identity + }). input({name:'cn'}). input({name: 'description'}))); diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 17b4b0695..386ce3775 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -43,8 +43,8 @@ var IPA = ( function () { processData: false }; - that.messages = {}; that.metadata = {}; + that.messages = {}; that.whoami = {}; that.entities = []; @@ -92,11 +92,12 @@ var IPA = ( function () { IPA.cmd('batch', startup_batch, {}, function (data, text_status, xhr) { - that.metadata = data.result.results[0].metadata; + that.metadata = data.result.results[0]; that.messages = data.result.results[1].messages; that.whoami = data.result.results[2].result[0]; that.env = data.result.results[3].result; that.dns_enabled = data.result.results[4].result; + if (on_success) { on_success(data, text_status, xhr); } @@ -130,7 +131,6 @@ var IPA = ( function () { } }; - that.test_dirty = function(){ if (IPA.current_entity){ var facet_name = IPA.current_facet(IPA.current_entity); @@ -186,7 +186,7 @@ var IPA = ( function () { return that; }()); -IPA.command = function (spec) { +IPA.command = function(spec) { spec = spec || {}; @@ -395,7 +395,7 @@ IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, c error_thrown.message = IPA.messages.ajax["401"]; } else { error_thrown.message = - "Your kerberos ticket no longer valid. "+ + "Your kerberos ticket is no longer valid. "+ "Please run kinit and then click 'retry'. "+ "If this is your first time running the IPA Web UI "+ "<a href='/ipa/config/unauthorized.html'>"+ @@ -488,32 +488,56 @@ IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, c /* helper function used to retrieve information about an attribute */ -IPA.get_param_info = function(obj_name, attr) { - var obj = IPA.metadata[obj_name]; - if (!obj) { +IPA.get_entity_param = function(entity_name, name) { + + var metadata = IPA.metadata.objects[entity_name]; + if (!metadata) { return null; } - var takes_params = obj.takes_params; - if (!takes_params) { - return (null); + var params = metadata.takes_params; + if (!params) { + return null; + } + + for (var i=0; i<params.length; i++) { + if (params[i].name === name) { + return params[i]; + } + } + + return null; +}; + +IPA.get_method_param = function(method_name, name) { + var metadata = IPA.metadata.methods[method_name]; + if (!metadata) { + return null; } - for (var i = 0; i < takes_params.length; i += 1) { - if (takes_params[i].name === attr){ - return (takes_params[i]); + + var options = metadata.takes_options; + if (!options) { + return null; + } + + for (var i=0; i<options.length; i++) { + if (options[i].name === name) { + return options[i]; } } - return (null); + return null; }; /* helper function used to retrieve attr name with members of type `member` */ -IPA.get_member_attribute = function (obj_name, member) { - var obj = IPA.metadata[obj_name]; +IPA.get_member_attribute = function(obj_name, member) { + + var obj = IPA.metadata.objects[obj_name]; if (!obj) { return null; } + var attribute_members = obj.attribute_members; for (var a in attribute_members) { var objs = attribute_members[a]; @@ -523,11 +547,10 @@ IPA.get_member_attribute = function (obj_name, member) { } } } - return null; + return null; }; - IPA.create_network_spinner = function(){ return $('<span />',{ 'class':'network-activity-indicator', diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js index 14be6c0a0..251ffa4d2 100644 --- a/install/ui/netgroup.js +++ b/install/ui/netgroup.js @@ -33,7 +33,7 @@ IPA.entity_factories.netgroup = function() { that.facet( IPA.search_facet({ name: 'search', - label: 'Search', + label: IPA.messages.facets.search, entity_name: that.name }). column({name:'cn'}). @@ -41,7 +41,7 @@ IPA.entity_factories.netgroup = function() { dialog( IPA.add_dialog({ name: 'add', - title: 'Add Netgroup' + title: IPA.messages.objects.netgroup.add }). field(IPA.text_widget({ name: 'cn', undo: false})). field(IPA.text_widget({ name: 'description', undo: false})))); @@ -49,7 +49,10 @@ IPA.entity_factories.netgroup = function() { that.facet( IPA.details_facet({name: 'details'}). section( - IPA.stanza({name: 'identity', label: 'Netgroup Settings'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.netgroup.identity + }). input({name: 'cn'}). input({name: 'description'}). input({name: 'nisdomainname'}))); diff --git a/install/ui/policy.js b/install/ui/policy.js index 8e6274122..9b8115f8c 100644 --- a/install/ui/policy.js +++ b/install/ui/policy.js @@ -35,14 +35,14 @@ IPA.entity_factories.dnszone = function() { that.facet( IPA.search_facet({ name: 'search', - label: 'Search', + label: IPA.messages.facets.search, entity_name: that.name }). column({name:'idnsname'}). dialog( IPA.add_dialog({ name: 'add', - title: 'Add DNS Zone' + title: IPA.messages.objects.dnszone.add }). field(IPA.text_widget({ name: 'idnsname', undo: false})). field(IPA.text_widget({ name: 'idnssoamname', undo: false})). @@ -51,7 +51,10 @@ IPA.entity_factories.dnszone = function() { that.facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'DNS Zone Settings'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.dnszone.identity + }). input({name:'idnsname'}). input({name:'idnszoneactive'}). input({name:'idnssoamname'}). @@ -69,7 +72,7 @@ IPA.entity_factories.dnszone = function() { that.facet( IPA.records_facet({ 'name': 'records', - 'label': IPA.metadata.dnsrecord.label + 'label': IPA.metadata.objects.dnsrecord.label })); that.create_association_facets(); @@ -123,15 +126,15 @@ IPA.records_facet = function (spec){ var add_dialog = $('<div/>',{ id: 'add_dns_resource_record', - title: 'Add DNS Resource Record' + title: IPA.messages.objects.dnsrecord.add }); var dl = $('<dl></dl>').appendTo(add_dialog); - dl.append('<dt>Resource</dt>'); + dl.append('<dt>'+IPA.messages.objects.dnsrecord.resource+'</dt>'); dl.append( $('<dd/>'). append($('<input type="text" id="dns-record-resource" />'))); - dl.append('<dt>Type</dt>'); + dl.append('<dt>'+IPA.messages.objects.dnsrecord.type+'</dt>'); dl.append( $('<dd/>').append(create_type_select('dns-record-type'))); - dl.append('<dt>Data</dt>'); + dl.append('<dt>'+IPA.messages.objects.dnsrecord.data+'</dt>'); dl.append($('<dd/>').append($('<textarea/>',{ id: 'dns-record-data', rows:"8", @@ -197,7 +200,7 @@ IPA.records_facet = function (spec){ var delete_dialog = $('<div/>', { - title: IPA.messages.button.remove + title: IPA.messages.buttons.remove }); var to_delete_table = $('<table class="search-table" >'+ @@ -286,7 +289,7 @@ IPA.records_facet = function (spec){ appendTo(details); var control_span =$('<span class="record-filter"></span>').appendTo(div); - control_span.append('Resource'); + control_span.append(IPA.messages.objects.dnsrecord.resource); control_span.append($('<input />',{ type: "text", id: 'dns-record-resource-filter', @@ -305,7 +308,7 @@ IPA.records_facet = function (spec){ */ IPA.button({ - 'label': IPA.messages.button.find, + 'label': IPA.messages.buttons.find, 'icon': 'ui-icon-search', 'click': function(){refresh();} }).appendTo(control_span); @@ -318,13 +321,13 @@ IPA.records_facet = function (spec){ IPA.action_button({ - 'label': IPA.messages.button.add, + 'label': IPA.messages.buttons.add, 'icon': 'ui-icon-plus', 'click': add_click }).appendTo(action_controls); IPA.action_button({ - 'label': IPA.messages.button.remove, + 'label': IPA.messages.buttons.remove, 'icon': 'ui-icon-trash', 'click': function(){delete_records(records_table);} }).appendTo(action_controls); @@ -353,7 +356,7 @@ IPA.records_facet = function (spec){ } }))); tr.append($('<th/>',{ - text: IPA.get_param_info("dnsrecord", "idnsname").label })); + text: IPA.get_entity_param("dnsrecord", "idnsname").label })); tr.append($('<th>Record Type</th>')); tr.append($('<th>Data</th>')); @@ -368,7 +371,7 @@ IPA.records_facet = function (spec){ $('h1',container). - html("<span id='headerpkey' />Records for DNS Zone:" + that.pkey); + html("<span id='headerpkey' />"+IPA.messages.objects.dnsrecord.title+":" + that.pkey); //commented out until data is searchable @@ -496,9 +499,9 @@ IPA.records_facet = function (spec){ } if (data.result.truncated) { - tfoot.text( - 'Query returned results than configured size limit will show.' + - 'First ' + data.result.count + ' results shown.' ); + var message = IPA.messages.search.truncated; + message = message.replace('${counter}', data.result.count); + tfoot.text(message); } else { tfoot.text(data.result.summary); } @@ -526,21 +529,24 @@ IPA.entity_factories.automountlocation = function() { that.facet( IPA.search_facet({ name: 'search', - label: 'Search', + label: IPA.messages.facets.search, entity_name: that.name }). column({name:'cn'}). dialog( IPA.add_dialog({ name: 'add', - title: 'Add Automount Location' + title: IPA.messages.objects.automountlocation.add }). field(IPA.text_widget({ name: 'cn', undo: false})))); that.facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'Automount Location Settings'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.automountlocation.identity + }). input({name:'cn'}))); that.create_association_facets(); @@ -565,14 +571,14 @@ IPA.entity_factories.pwpolicy = function() { that.facet( IPA.search_facet({ name: 'search', - label: 'Search', + label: IPA.messages.facets.search, entity_name: that.name }). column({name:'cn'}). dialog( IPA.add_dialog({ name: 'add', - title: 'Add Password Policy', + title: IPA.messages.objects.pwpolicy.add, entity_name:'pwpolicy' }). field(IPA.text_widget({name: 'cn', undo: false})))); @@ -580,7 +586,10 @@ IPA.entity_factories.pwpolicy = function() { that.facet( IPA.details_facet({name:'details'}). section( - IPA.stanza({name:'identity', label:'Password Policy'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.pwpolicy.identity + }). input({name:'krbmaxpwdlife'}). input({name:'krbminpwdlife'}). input({name:'krbpwdhistorylength'}). @@ -612,7 +621,10 @@ IPA.entity_factories.krbtpolicy = function() { name: 'details' }). section( - IPA.stanza({name: 'identity', label: 'Kerberos ticket policy'}). + IPA.stanza({ + name: 'identity', + label: IPA.messages.objects.krbtpolicy.identity + }). //input({name: 'uid',label:' '}). input({name: 'krbmaxrenewableage'}). input({name: 'krbmaxticketlife'}))); diff --git a/install/ui/rule.js b/install/ui/rule.js index a6e11f2c2..9076f4ee4 100644 --- a/install/ui/rule.js +++ b/install/ui/rule.js @@ -40,7 +40,8 @@ IPA.rule_details_section = function (spec){ if (that.text) container.append(that.text); - var param_info = IPA.get_param_info(that.entity_name, that.field_name); + var field = that.get_field(that.field_name); + var param_info = IPA.get_entity_param(that.entity_name, that.field_name); var span = $('<span/>', { name: that.field_name, @@ -64,12 +65,7 @@ IPA.rule_details_section = function (spec){ span.append(' '); } - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); span.append('<br/>'); } @@ -77,14 +73,14 @@ IPA.rule_details_section = function (spec){ for (var j=0; j<that.tables.length; j++) { var table = that.tables[j]; - param_info = IPA.get_param_info(that.entity_name, table.field_name); + param_info = IPA.get_entity_param(that.entity_name, table.field_name); var table_span = $('<span/>', { name: table.field_name, title: param_info ? param_info.doc : table.field_name }).appendTo(span); - var field = that.get_field(table.field_name); + field = that.get_field(table.field_name); field.create(table_span); } }; diff --git a/install/ui/search.js b/install/ui/search.js index fe88d05ef..11aa4f756 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -53,7 +53,7 @@ IPA.search_widget = function (spec) { $('<input/>', { 'type': 'button', 'name': 'find', - 'value': 'Find' + 'value': IPA.messages.buttons.find }).appendTo(search_filter); var action_panel = that.facet.get_action_panel(); @@ -66,13 +66,13 @@ IPA.search_widget = function (spec) { $('<input/>', { 'type': 'button', 'name': 'remove', - 'value': 'Remove' + 'value': IPA.messages.buttons.remove }).appendTo(search_buttons); $('<input/>', { 'type': 'button', 'name': 'add', - 'value': 'Add' + 'value': IPA.messages.buttons.add }).appendTo(search_buttons); $('<div/>', { @@ -90,7 +90,7 @@ IPA.search_widget = function (spec) { var button = $('input[name=find]', search_filter); that.find_button = IPA.button({ - 'label': IPA.messages.button.find, + 'label': IPA.messages.buttons.find, 'icon': 'ui-icon-search', 'click': function() { that.find(); } }); @@ -101,7 +101,7 @@ IPA.search_widget = function (spec) { button = $('input[name=remove]', search_buttons); that.remove_button = IPA.action_button({ - 'label': IPA.messages.button.remove, + 'label': IPA.messages.buttons.remove, 'icon': 'ui-icon-trash' }); that.remove_button.addClass('input_link_disabled'); @@ -111,7 +111,7 @@ IPA.search_widget = function (spec) { button = $('input[name=add]', search_buttons); that.add_button = IPA.action_button({ - 'label': IPA.messages.button.add, + 'label': IPA.messages.buttons.add, 'icon': 'ui-icon-plus', 'click': function() { that.add(); } }); @@ -176,12 +176,16 @@ IPA.search_widget = function (spec) { var values = that.get_selected_values(); + var title; if (!values.length) { - alert('Select '+that.label+' to be removed.'); + title = IPA.messages.dialogs.remove_empty; + title = title.replace('${entity}', that.label); + alert(title); return; } - var title = 'Remove '+that.label; + title = IPA.messages.dialogs.remove_title; + title = title.replace('${entity}', that.label); var dialog = IPA.deleter_dialog({ 'title': title, @@ -237,10 +241,9 @@ IPA.search_widget = function (spec) { var summary = $('span[name=summary]', that.tfoot); if (data.result.truncated) { - summary.text( - 'Query returned more results than configured size limit '+ - 'will show. First ' + - data.result.count + ' results shown.'); + var message = IPA.messages.search.truncated; + message = message.replace('${counter}', data.result.count); + summary.text(message); } else { summary.text(data.result.summary); } @@ -342,7 +345,7 @@ IPA.search_facet = function(spec) { that.table = IPA.search_widget({ 'id': that.entity_name+'-search', - 'name': 'search', 'label': IPA.metadata[that.entity_name].label, + 'name': 'search', 'label': IPA.metadata.objects[that.entity_name].label, 'entity_name': that.entity_name, 'facet': that }); @@ -350,7 +353,7 @@ IPA.search_facet = function(spec) { for (var i=0; i<that.columns.length; i++) { var column = that.columns[i]; - var param_info = IPA.get_param_info(that.entity_name, column.name); + var param_info = IPA.get_entity_param(that.entity_name, column.name); column.primary_key = param_info && param_info['primary_key']; if (column.primary_key) { diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js index 46e2e4856..6f54bbabe 100644 --- a/install/ui/serverconfig.js +++ b/install/ui/serverconfig.js @@ -34,8 +34,14 @@ IPA.entity_factories.config = function(){ }).facet( IPA.details_facet(). section( - IPA.stanza({name:'ipaserver', label:'Configuration'}). - input({name:'cn', label:'Name'}). + IPA.stanza({ + name: 'ipaserver', + label: IPA.messages.objects.config.ipaserver + }). + input({ + name: 'cn', + label: IPA.messages.objects.config.cn + }). input({name:'ipacertificatesubjectbase'}). input({name:'ipadefaultloginshell'}). input({name:'ipadefaultprimarygroup'}). diff --git a/install/ui/service.js b/install/ui/service.js index 001ec8211..ff642a808 100644 --- a/install/ui/service.js +++ b/install/ui/service.js @@ -34,7 +34,7 @@ IPA.entity_factories.service = function() { dialog( IPA.service_add_dialog({ name: 'add', - title: 'Add New Service', + title: IPA.messages.objects.service.add, width: '450px' }))). facet(IPA.service_details_facet()). @@ -75,8 +75,6 @@ IPA.service_select_widget = function(spec) { }; -/*TODO: the following labels etc. all need to be replaced with I18N strings */ - IPA.service_add_dialog = function(spec) { spec = spec || {}; @@ -88,20 +86,24 @@ IPA.service_add_dialog = function(spec) { })). field(IPA.service_select_widget({ name: 'service', - label: 'Service', + label: IPA.messages.objects.service.service, size: 20, undo: false })). field(IPA.text_widget({ name: 'host', - label: 'Host Name', + label: IPA.messages.objects.service.host, size: 40, undo: false - })). - field(IPA.checkbox_widget({ + })); + + var param_info = IPA.get_method_param('service_add', 'force'); + + that.field( + IPA.checkbox_widget({ name: 'force', - label: 'Force', - tooltip: 'force principal name even if not in DNS', + label: param_info.label, + tooltip: param_info.doc, undo: false })); @@ -131,38 +133,38 @@ IPA.service_details_facet = function(spec) { var that = IPA.details_facet(spec). section(IPA.stanza({ name: 'details', - label: 'Service Settings' + label: IPA.messages.objects.service.details }). input({ name: 'krbprincipalname' }). custom_input(IPA.service_name_widget({ name: 'service', - label: 'Service', + label: IPA.messages.objects.service.service, read_only: true })). custom_input(IPA.service_host_widget({ name: 'host', - label: 'Host Name', + label: IPA.messages.objects.service.host, read_only: true }))). section( IPA.stanza({ name: 'provisioning', - label: 'Provisioning' + label: IPA.messages.objects.service.provisioning }). custom_input(IPA.service_provisioning_status_widget({ name: 'provisioning_status', - label: 'Status' + label: IPA.messages.objects.service.status }))). section( IPA.stanza({ name: 'certificate', - label: 'Service Certificate' + label: IPA.messages.objects.service.certificate }). custom_input((IPA.service_certificate_status_widget({ name: 'certificate_status', - label: 'Status' + label: IPA.messages.objects.service.status })))); @@ -235,14 +237,14 @@ IPA.service_provisioning_status_widget = function (spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Kerberos Key Present, Service Provisioned:</b>'); + content_div.append('<b>'+IPA.messages.objects.service.valid+':</b>'); content_div.append(' '); $('<input/>', { 'type': 'button', 'name': 'unprovision', - 'value': 'Delete Key, Unprovision' + 'value': IPA.messages.objects.service.delete_key_unprovision }).appendTo(content_div); div = $('<div/>', { @@ -260,7 +262,7 @@ IPA.service_provisioning_status_widget = function (spec) { style: 'float: left;' }).appendTo(div); - content_div.append('<b>Kerberos Key Not Present</b>'); + content_div.append('<b>'+IPA.messages.objects.service.missing+'</b>'); }; that.setup = function(container) { @@ -272,7 +274,7 @@ IPA.service_provisioning_status_widget = function (spec) { var button = $('input[name=unprovision]', that.container); that.unprovision_button = IPA.button({ - 'label': 'Delete Key, Unprovision', + 'label': IPA.messages.objects.service.delete_key_unprovision, 'click': that.unprovision }); button.replaceWith(that.unprovision_button); @@ -280,17 +282,19 @@ IPA.service_provisioning_status_widget = function (spec) { that.unprovision = function() { - var label = IPA.metadata[that.entity_name].label; + var label = IPA.metadata.objects[that.entity_name].label; + var title = IPA.messages.objects.service.unprovision_title; + title = title.replace('${entity}', label); + var dialog = IPA.dialog({ - 'title': 'Unprovisioning '+label + 'title': title }); dialog.create = function() { - dialog.container.append( - 'Are you sure you want to unprovision this service?'); + dialog.container.append(IPA.messages.objects.service.unprovision_confirmation); }; - dialog.add_button('Unprovision', function() { + dialog.add_button(IPA.messages.objects.service.unprovision, function() { var pkey = that.result['krbprincipalname'][0]; IPA.cmd(that.entity_name+'_disable', [pkey], {}, function(data, text_status, xhr) { @@ -328,11 +332,11 @@ IPA.service_certificate_status_widget = function (spec) { spec = spec || {}; - var that = IPA.certificate_status_widget(spec); + var that = IPA.cert.status_widget(spec); that.init = function() { - that.entity_label = IPA.metadata[that.entity_name].label; + that.entity_label = IPA.metadata.objects[that.entity_name].label; that.get_entity_pkey = function(result) { var values = result['krbprincipalname']; diff --git a/install/ui/sudocmd.js b/install/ui/sudocmd.js index 1229db7eb..b98f2d4dc 100644 --- a/install/ui/sudocmd.js +++ b/install/ui/sudocmd.js @@ -32,12 +32,12 @@ IPA.entity_factories.sudocmd = function () { var facet = IPA.sudocmd_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.sudo.cmd_add_dialog({ 'name': 'add', - 'title': 'Add New SUDO Command' + 'title': IPA.messages.objects.sudocmd.add }); facet.dialog(dialog); @@ -101,7 +101,7 @@ IPA.sudocmd_details_facet = function (spec) { var section = IPA.details_list_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.details.general }); that.add_section(section); @@ -110,13 +110,13 @@ IPA.sudocmd_details_facet = function (spec) { section = IPA.details_section({ 'name': 'groups', - 'label': 'Groups' + 'label': IPA.messages.objects.sudocmd.groups }); that.add_section(section); var field = IPA.sudocmd_member_sudocmdgroup_table_widget({ 'name': 'memberof', - 'label': 'Groups', + 'label': IPA.messages.objects.sudocmd.groups, 'other_entity': 'sudocmdgroup', 'save_values': false }); @@ -166,7 +166,6 @@ IPA.sudocmd_member_sudocmdgroup_table_widget = function (spec) { that.create_column({ name: 'description', - label: 'Description', width: '150px' }); diff --git a/install/ui/sudocmdgroup.js b/install/ui/sudocmdgroup.js index 8e29aa20b..47be03d70 100644 --- a/install/ui/sudocmdgroup.js +++ b/install/ui/sudocmdgroup.js @@ -32,12 +32,12 @@ IPA.entity_factories.sudocmdgroup = function () { var facet = IPA.sudocmdgroup_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.sudo.cmdgroup_add_dialog({ 'name': 'add', - 'title': 'Add New SUDO Command Group' + 'title': IPA.messages.objects.sudocmdgroup.add }); facet.dialog(dialog); @@ -101,7 +101,7 @@ IPA.sudocmdgroup_details_facet = function (spec) { var section = IPA.details_list_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.dialogs.general }); that.add_section(section); @@ -110,13 +110,13 @@ IPA.sudocmdgroup_details_facet = function (spec) { section = IPA.details_section({ 'name': 'commands', - 'label': 'Commands' + 'label': IPA.messages.objects.sudocmdgroup.commands }); that.add_section(section); var field = IPA.sudocmdgroup_member_sudocmd_table_widget({ 'name': 'member_sudocmd', - 'label': 'Commands', + 'label': IPA.messages.objects.sudocmdgroup.commands, 'other_entity': 'sudocmd', 'save_values': false }); @@ -166,7 +166,6 @@ IPA.sudocmdgroup_member_sudocmd_table_widget = function (spec) { that.create_column({ name: 'description', - label: 'Description', width: '150px' }); diff --git a/install/ui/sudorule.js b/install/ui/sudorule.js index b9fc7be88..a97a7720a 100644 --- a/install/ui/sudorule.js +++ b/install/ui/sudorule.js @@ -34,12 +34,12 @@ IPA.entity_factories.sudorule = function () { var facet = IPA.sudorule_search_facet({ 'name': 'search', - 'label': 'Search' + 'label': IPA.messages.facets.search }); var dialog = IPA.sudo.rule_add_dialog({ 'name': 'add', - 'title': 'Add New Rule' + 'title': IPA.messages.objects.sudorule.add }); facet.dialog(dialog); @@ -106,14 +106,14 @@ IPA.sudorule_details_facet = function (spec) { if (IPA.layout) { section = that.create_section({ 'name': 'general', - 'label': 'General', + 'label': IPA.messages.dialogs.general, 'template': 'sudorule-details-general.html #contents' }); } else { section = IPA.sudo.rule_details_general_section({ 'name': 'general', - 'label': 'General' + 'label': IPA.messages.dialogs.general }); that.add_section(section); } @@ -124,11 +124,11 @@ IPA.sudorule_details_facet = function (spec) { section = IPA.rule_details_section({ 'name': 'user', - 'label': 'Who', + 'label': IPA.messages.objects.sudorule.user, 'field_name': 'usercategory', 'options': [ - { 'value': 'all', 'label': 'Anyone' }, - { 'value': '', 'label': 'Specified Users and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.sudorule.anyone }, + { 'value': '', 'label': IPA.messages.objects.sudorule.specified_users } ], 'tables': [ { 'field_name': 'memberuser_user' }, @@ -137,26 +137,26 @@ IPA.sudorule_details_facet = function (spec) { }); that.add_section(section); - var category = section.radio({ name: 'usercategory', label: 'User category' }); + var category = section.radio({ name: 'usercategory' }); section.add_field(IPA.sudorule_association_table_widget({ 'id': that.entity_name+'-memberuser_user', - 'name': 'memberuser_user', 'label': 'Users', 'category': category, + 'name': 'memberuser_user', 'category': category, 'other_entity': 'user', 'add_method': 'add_user', 'remove_method': 'remove_user', 'external': 'externaluser' })); section.add_field(IPA.sudorule_association_table_widget({ 'id': that.entity_name+'-memberuser_group', - 'name': 'memberuser_group', 'label': 'Groups', 'category': category, + 'name': 'memberuser_group', 'category': category, 'other_entity': 'group', 'add_method': 'add_user', 'remove_method': 'remove_user' })); section = IPA.rule_details_section({ 'name': 'host', - 'label': 'Access this host', + 'label': IPA.messages.objects.sudorule.host, 'field_name': 'hostcategory', 'options': [ - { 'value': 'all', 'label': 'Any Host' }, - { 'value': '', 'label': 'Specified Hosts and Groups' } + { 'value': 'all', 'label': IPA.messages.objects.sudorule.any_host }, + { 'value': '', 'label': IPA.messages.objects.sudorule.specified_hosts } ], 'tables': [ { 'field_name': 'memberhost_host' }, @@ -165,28 +165,28 @@ IPA.sudorule_details_facet = function (spec) { }); that.add_section(section); - category = section.radio({ 'name': 'hostcategory', 'label': 'Host category' }); + category = section.radio({ 'name': 'hostcategory' }); section.add_field(IPA.sudorule_association_table_widget({ 'id': that.entity_name+'-memberhost_host', - 'name': 'memberhost_host', 'label': 'Host', 'category': category, + 'name': 'memberhost_host', 'category': category, 'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host', 'external': 'externalhost' })); section.add_field(IPA.sudorule_association_table_widget({ 'id': that.entity_name+'-memberhost_hostgroup', - 'name': 'memberhost_hostgroup', 'label': 'Groups', 'category': category, + 'name': 'memberhost_hostgroup', 'category': category, 'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host' })); section = IPA.sudo.rule_details_command_section({ 'name': 'command', - 'label': 'Run Commands' + 'label': IPA.messages.objects.sudorule.command }); that.add_section(section); section = IPA.sudo.rule_details_runas_section({ 'name': 'runas', - 'label': 'As Whom' + 'label': IPA.messages.objects.sudorule.runas }); that.add_section(section); @@ -291,7 +291,7 @@ IPA.sudorule_details_facet = function (spec) { var values = field.save(); if (!values) continue; - var param_info = IPA.get_param_info(that.entity_name, field.name); + var param_info = IPA.get_entity_param(that.entity_name, field.name); // skip primary key if (param_info && param_info['primary_key']) continue; @@ -391,7 +391,7 @@ IPA.sudo.rule_details_general_section = function (spec){ 'style': 'width: 100%;' }).appendTo(container); - var param_info = IPA.get_param_info(that.entity_name, 'cn'); + var param_info = IPA.get_entity_param(that.entity_name, 'cn'); var tr = $('<tr/>').appendTo(table); @@ -403,6 +403,8 @@ IPA.sudo.rule_details_general_section = function (spec){ td = $('<td/>').appendTo(tr); + var field = that.get_field('cn'); + var span = $('<span/>', { name: 'cn', title: param_info ? param_info.doc : 'cn' @@ -421,14 +423,9 @@ IPA.sudo.rule_details_general_section = function (spec){ span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); - param_info = IPA.get_param_info(that.entity_name, 'description'); + param_info = IPA.get_entity_param(that.entity_name, 'description'); tr = $('<tr/>').appendTo(table); @@ -440,6 +437,8 @@ IPA.sudo.rule_details_general_section = function (spec){ td = $('<td/>').appendTo(tr); + field = that.get_field('description'); + span = $('<span/>', { name: 'description', title: param_info ? param_info.doc : 'description' @@ -453,29 +452,26 @@ IPA.sudo.rule_details_general_section = function (spec){ span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); - param_info = IPA.get_param_info(that.entity_name, 'ipaenabledflag'); + param_info = IPA.get_entity_param(that.entity_name, 'ipaenabledflag'); + var label = IPA.messages.objects.sudorule.ipaenabledflag; tr = $('<tr/>').appendTo(table); - // TODO: Use i18n label td = $('<td/>', { style: 'text-align: right; vertical-align: top;', - html: 'Rule status:', - title: 'Rule status' + html: label+':', + title: label }).appendTo(tr); td = $('<td/>').appendTo(tr); + field = that.get_field('ipaenabledflag'); + span = $('<span/>', { name: 'ipaenabledflag', - title: 'Rule status' + title: label }).appendTo(td); $('<input/>', { @@ -486,8 +482,7 @@ IPA.sudo.rule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Active'); + span.append(IPA.messages.objects.sudorule.active); span.append(' '); @@ -499,17 +494,11 @@ IPA.sudo.rule_details_general_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Inactive'); + span.append(IPA.messages.objects.sudorule.inactive); span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); }; return that; @@ -559,17 +548,17 @@ IPA.sudo.rule_details_command_section = function (spec){ if (that.template) return; - var param_info = IPA.get_param_info(that.entity_name, 'cmdcategory'); + var field = that.get_field('cmdcategory'); + var param_info = IPA.get_entity_param(that.entity_name, 'cmdcategory'); var span = $('<span/>', { name: 'cmdcategory', title: param_info ? param_info.doc : 'cmdcategory' }).appendTo(container); - // TODO: replace with i18n label $('<h3/>', { - text: 'Allow', - title: 'Allow' + text: IPA.messages.objects.sudorule.allow, + title: IPA.messages.objects.sudorule.allow }).appendTo(span); $('<input/>', { @@ -580,8 +569,7 @@ IPA.sudo.rule_details_command_section = function (spec){ span.append(' '); - // TODO: replace with i18n label - span.append('Any Command'); + span.append(IPA.messages.objects.sudorule.any_command); span.append(' '); @@ -593,29 +581,23 @@ IPA.sudo.rule_details_command_section = function (spec){ span.append(' '); - // TODO: replace with i18n label - span.append('Specified Commands and Groups'); + span.append(IPA.messages.objects.sudorule.specified_commands); span.append(' '); - var undo = $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); - param_info = IPA.get_param_info(that.entity_name, 'memberallowcmd_sudocmd'); + param_info = IPA.get_entity_param(that.entity_name, 'memberallowcmd_sudocmd'); var table_span = $('<span/>', { name: 'memberallowcmd_sudocmd', title: param_info ? param_info.doc : 'memberallowcmd_sudocmd' }).appendTo(span); - var field = that.get_field('memberallowcmd_sudocmd'); + field = that.get_field('memberallowcmd_sudocmd'); field.create(table_span); - param_info = IPA.get_param_info(that.entity_name, 'memberallowcmd_sudocmdgroup'); + param_info = IPA.get_entity_param(that.entity_name, 'memberallowcmd_sudocmdgroup'); table_span = $('<span/>', { name: 'memberallowcmd_sudocmdgroup', @@ -625,13 +607,12 @@ IPA.sudo.rule_details_command_section = function (spec){ field = that.get_field('memberallowcmd_sudocmdgroup'); field.create(table_span); - // TODO: replace with i18n label $('<h3/>', { - text: 'Deny', - title: 'Deny' + text: IPA.messages.objects.sudorule.deny, + title: IPA.messages.objects.sudorule.deny }).appendTo(span); - param_info = IPA.get_param_info(that.entity_name, 'memberdenycmd_sudocmd'); + param_info = IPA.get_entity_param(that.entity_name, 'memberdenycmd_sudocmd'); table_span = $('<span/>', { name: 'memberdenycmd_sudocmd', @@ -641,7 +622,7 @@ IPA.sudo.rule_details_command_section = function (spec){ field = that.get_field('memberdenycmd_sudocmd'); field.create(table_span); - param_info = IPA.get_param_info(that.entity_name, 'memberdenycmd_sudocmdgroup'); + param_info = IPA.get_entity_param(that.entity_name, 'memberdenycmd_sudocmdgroup'); table_span = $('<span/>', { name: 'memberdenycmd_sudocmdgroup', @@ -722,7 +703,8 @@ IPA.sudo.rule_details_runas_section = function (spec){ if (that.template) return; - var param_info = IPA.get_param_info(that.entity_name, 'ipasudorunasusercategory'); + var field = that.get_field('ipasudorunasusercategory'); + var param_info = IPA.get_entity_param(that.entity_name, 'ipasudorunasusercategory'); var span = $('<span/>', { name: 'ipasudorunasusercategory', @@ -737,8 +719,7 @@ IPA.sudo.rule_details_runas_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Anyone'); + span.append(IPA.messages.objects.sudorule.anyone); span.append(' '); @@ -750,31 +731,25 @@ IPA.sudo.rule_details_runas_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Specified Users and Groups'); + span.append(IPA.messages.objects.sudorule.specified_users); span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); span.append('<br/>'); - param_info = IPA.get_param_info(that.entity_name, 'ipasudorunas_user'); + param_info = IPA.get_entity_param(that.entity_name, 'ipasudorunas_user'); var table_span = $('<span/>', { name: 'ipasudorunas_user', title: param_info ? param_info.doc : 'ipasudorunas_user' }).appendTo(span); - var field = that.get_field('ipasudorunas_user'); + field = that.get_field('ipasudorunas_user'); field.create(table_span); - param_info = IPA.get_param_info(that.entity_name, 'ipasudorunas_group'); + param_info = IPA.get_entity_param(that.entity_name, 'ipasudorunas_group'); table_span = $('<span/>', { name: 'ipasudorunas_group', @@ -784,7 +759,8 @@ IPA.sudo.rule_details_runas_section = function (spec){ field = that.get_field('ipasudorunas_group'); field.create(table_span); - param_info = IPA.get_param_info(that.entity_name, 'ipasudorunasgroupcategory'); + field = that.get_field('ipasudorunasgroupcategory'); + param_info = IPA.get_entity_param(that.entity_name, 'ipasudorunasgroupcategory'); span = $('<span/>', { name: 'ipasudorunasgroupcategory', @@ -799,8 +775,7 @@ IPA.sudo.rule_details_runas_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Any Group'); + span.append(IPA.messages.objects.sudorule.any_group); span.append(' '); @@ -812,21 +787,15 @@ IPA.sudo.rule_details_runas_section = function (spec){ span.append(' '); - // TODO: i18n - span.append('Specified Groups'); + span.append(IPA.messages.objects.sudorule.specified_groups); span.append(' '); - $('<span/>', { - 'name': 'undo', - 'class': 'ui-state-highlight ui-corner-all', - 'style': 'display: none;', - 'html': 'undo' - }).appendTo(span); + field.create_undo(span); span.append('<br/>'); - param_info = IPA.get_param_info(that.entity_name, 'ipasudorunasgroup_group'); + param_info = IPA.get_entity_param(that.entity_name, 'ipasudorunasgroup_group'); table_span = $('<span/>', { name: 'ipasudorunasgroup_group', @@ -907,7 +876,7 @@ IPA.sudorule_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 label = IPA.metadata.objects[that.other_entity].label; var title = 'Add '+label+' to '+that.entity_name+' '+pkey; var template; @@ -949,10 +918,10 @@ IPA.sudo.rule_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' }); @@ -996,7 +965,7 @@ IPA.sudo.rule_association_adder_dialog = function (spec) { $('<input/>', { type: 'button', name: 'find', - value: 'Find' + value: IPA.messages.buttons.find }).appendTo(search_panel); var results_panel = $('<div/>', { @@ -1011,7 +980,7 @@ IPA.sudo.rule_association_adder_dialog = function (spec) { }).appendTo(results_panel); $('<div/>', { - html: 'Available', + html: IPA.messages.dialogs.available, 'class': 'ui-widget-header' }).appendTo(available_panel); @@ -1042,7 +1011,7 @@ IPA.sudo.rule_association_adder_dialog = function (spec) { }).appendTo(results_panel); $('<div/>', { - html: 'Prospective', + html: IPA.messages.dialogs.prospective, 'class': 'ui-widget-header' }).appendTo(selected_panel); @@ -1055,7 +1024,7 @@ IPA.sudo.rule_association_adder_dialog = function (spec) { }).appendTo(results_panel); $('<div/>', { - html: 'External', + html: IPA.messages.objects.sudorule.external, 'class': 'ui-widget-header' }).appendTo(external_panel); @@ -1077,7 +1046,7 @@ IPA.sudo.rule_association_adder_dialog = function (spec) { that.selected_table.add_rows(rows); if (that.external) { - var pkey_name = IPA.metadata[that.other_entity].primary_key; + var pkey_name = IPA.metadata.objects[that.other_entity].primary_key; var value = that.external_field.val(); if (!value) return; diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js index ff8b5de04..d51f1ea6d 100644 --- a/install/ui/test/aci_tests.js +++ b/install/ui/test/aci_tests.js @@ -48,7 +48,7 @@ module('aci',{ test("IPA.attributes_widget.", function() { - var aciattrs = IPA.metadata['user'].aciattrs; + var aciattrs = IPA.metadata.objects['user'].aciattrs; var container = $('<span/>', { name: 'attrs' diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js index 1178b99fa..c901c35dd 100644 --- a/install/ui/test/entity_tests.js +++ b/install/ui/test/entity_tests.js @@ -135,7 +135,7 @@ test('Testing ipa_facet_setup_views().', function() { li = li.next(); // skip action controls li = li.next(); // skip the header line for Member of - var attribute_members = IPA.metadata['user'].attribute_members; + var attribute_members = IPA.metadata.objects['user'].attribute_members; for (var attribute_member in attribute_members) { var objects = attribute_members[attribute_member]; for (var i = 0; i < objects.length; i++) { diff --git a/install/ui/test/ipa_tests.js b/install/ui/test/ipa_tests.js index 4fa0d1ea2..41163df18 100644 --- a/install/ui/test/ipa_tests.js +++ b/install/ui/test/ipa_tests.js @@ -40,7 +40,7 @@ test("Testing ipa_init().", function() { test("Testing IPA.get_param_info().", function() { - var param_info = IPA.get_param_info("user", "uid"); + var param_info = IPA.get_entity_param("user", "uid"); ok( param_info, "IPA.get_param_info(\"user\", \"uid\") not null" @@ -52,22 +52,22 @@ test("Testing IPA.get_param_info().", function() { ); equals( - IPA.get_param_info("user", "wrong_attribute"), null, + IPA.get_entity_param("user", "wrong_attribute"), null, "IPA.get_param_info(\"user\", \"wrong_attribute\")" ); equals( - IPA.get_param_info("user", null), null, + IPA.get_entity_param("user", null), null, "IPA.get_param_info(\"user\", null)" ); equals( - IPA.get_param_info("wrong_entity", "uid"), null, + IPA.get_entity_param("wrong_entity", "uid"), null, "IPA.get_param_info(\"wrong_entity\", \"uid\")" ); equals( - IPA.get_param_info(null, "uid"), null, + IPA.get_entity_param(null, "uid"), null, "IPA.get_param_info(null, \"uid\")" ); }); diff --git a/install/ui/user.js b/install/ui/user.js index 32b79db1f..66a1b8d15 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -39,7 +39,7 @@ IPA.entity_factories.user = function() { dialog( IPA.add_dialog({ 'name': 'add', - 'title': 'Add User' + 'title': IPA.messages.objects.user.add }). field(IPA.text_widget({ name: 'uid', undo: false })). field(IPA.text_widget({ name: 'givenname', undo: false })). @@ -54,7 +54,7 @@ IPA.entity_factories.user = function() { input({name:'displayname'}). input({name:'initials'})). section( - IPA.stanza({name: 'account', label: IPA.messages.details.account}). + IPA.stanza({name: 'account', label: IPA.messages.objects.user.account}). custom_input(IPA.user_status_widget({name:'nsaccountlock'})). input({name:'uid'}). custom_input(IPA.user_password_widget({name:'userpassword'})). @@ -63,24 +63,24 @@ IPA.entity_factories.user = function() { input({name:'loginshell'}). input({name:'homedirectory'})). section( - IPA.stanza({name: 'contact', label: IPA.messages.details.contact}). + IPA.stanza({name: 'contact', label: IPA.messages.objects.user.contact}). multivalued_text({name:'mail'}). multivalued_text({name:'telephonenumber'}). multivalued_text({name:'pager'}). multivalued_text({name:'mobile'}). multivalued_text({name:'facsimiletelephonenumber'})). section( - IPA.stanza({name: 'mailing', label: IPA.messages.details.mailing}). + IPA.stanza({name: 'mailing', label: IPA.messages.objects.user.mailing}). input({name:'street'}). - input({name:'l',label:'City'}). - input({name:'st',label:'State/Province'}). + input({name:'l'}). + input({name:'st'}). input({name:'postalcode'})). section( - IPA.stanza({name: 'employee', label: IPA.messages.details.employee}). - input({name:'ou', label:'Org. Unit'}). + IPA.stanza({name: 'employee', label: IPA.messages.objects.user.employee}). + input({name:'ou'}). input({name:'manager'})). section( - IPA.stanza({name: 'misc', label: IPA.messages.details.misc}). + IPA.stanza({name: 'misc', label: IPA.messages.objects.user.misc}). input({name:'carlicense'}))). facet( IPA.association_facet({ @@ -119,11 +119,11 @@ IPA.user_status_widget = function(spec) { var locked = that.record[lock_field] && that.record[lock_field][0].toLowerCase() === 'true'; - var title = "Active"; - var text = "Active: Click to Deactivate"; + var title = IPA.messages.objects.user.active; + var text = title+": "+IPA.messages.objects.user.deactivate; if (locked) { - title = "Inactive"; - text = "Inactive: Click to Activate"; + title = IPA.messages.objects.user.inactive; + text = title+": "+IPA.messages.objects.user.activate; } function on_lock_win(data, textStatus, xhr){ @@ -134,7 +134,7 @@ IPA.user_status_widget = function(spec) { } function on_lock_fail(data, textStatus, xhr){ - $("#userstatuslink").text = "Error changing account status"; + $("#userstatuslink").text = IPA.messages.objects.user.error_changing_status; return false; } @@ -150,7 +150,7 @@ IPA.user_status_widget = function(spec) { var val = jobj.attr('title'); var pkey = $.bbq.getState('user-pkey'); var command = 'user_enable'; - if (val == 'Active') { + if (val == IPA.messages.objects.user.active) { command = 'user_disable'; } IPA.cmd(command, [pkey], {}, on_lock_win,on_lock_fail); @@ -174,7 +174,7 @@ IPA.user_password_widget = function(spec) { $('<a/>', { href: 'jslink', title: 'userpassword', - text: 'reset password', + text: IPA.messages.objects.user.reset_password, click: resetpwd_on_click }).appendTo(container); }; @@ -194,7 +194,7 @@ IPA.user_password_widget = function(spec) { IPA.cmd('passwd', pw_pkey, {"password":new_password}, function(){ - alert("Password change complete"); + alert(IPA.messages.objects.user.password_change_complete); dialog.dialog("close"); }, function(){}); @@ -202,9 +202,9 @@ IPA.user_password_widget = function(spec) { var dialog = $('<div ><dl class="modal">'+ - '<dt>New Password</dt>'+ + '<dt>'+IPA.messages.objects.user.new_password+'</dt>'+ '<dd class="first" ><input id="password_1" type="password"/></dd>'+ - '<dt>Repeat Password</dt>'+ + '<dt>'+IPA.messages.objects.user.repeat_password+'</dt>'+ '<dd class="first"><input id="password_2" type="password"/></dd>'+ '</dl></div>'); @@ -216,7 +216,7 @@ IPA.user_password_widget = function(spec) { var p1 = $("#password_1").val(); var p2 = $("#password_2").val(); if (p1 != p2){ - alert("passwords must match"); + alert(IPA.messages.objects.user.password_must_match); return; } reset_password(p1); diff --git a/install/ui/widget.js b/install/ui/widget.js index 1a2a94a0a..3b32d4692 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -99,7 +99,7 @@ IPA.widget = function(spec) { function init() { if (that.entity_name) { - that.param_info = IPA.get_param_info(that.entity_name, that.name); + that.param_info = IPA.get_entity_param(that.entity_name, that.name); if (that.param_info) { @@ -307,7 +307,7 @@ IPA.text_widget = function(spec) { $('<span/>', { name: 'error_link', - html: 'Text does not match field pattern', + html: IPA.messages.widget.validation_error, 'class': 'ui-state-error ui-corner-all', style: 'display:none' }).appendTo(container); @@ -415,8 +415,8 @@ IPA.multivalued_text_widget = function(spec) { $('<a/>', { name: 'remove', href: 'jslink', - title: 'Remove', - html: 'Remove' + title: IPA.messages.buttons.remove, + html: IPA.messages.buttons.remove }).appendTo(div); if (that.undo) { @@ -428,7 +428,7 @@ IPA.multivalued_text_widget = function(spec) { $('<span/>', { name: 'error_link', - html: 'Text does not match field pattern', + html: IPA.messages.widget.validation_error, 'class': 'ui-state-error ui-corner-all', style: 'display:none' }).appendTo(div); @@ -436,8 +436,8 @@ IPA.multivalued_text_widget = function(spec) { $('<a/>', { name: 'add', href: 'jslink', - title: 'Add', - html: 'Add' + title: IPA.messages.buttons.add, + html: IPA.messages.buttons.add }).appendTo(container); container.append(' '); @@ -951,7 +951,7 @@ IPA.textarea_widget = function (spec) { $("<span/>",{ name:'error_link', - html:"Text does not match field pattern", + html: IPA.messages.widget.validation_error, "class":"ui-state-error ui-corner-all", style:"display:none" }).appendTo(container); @@ -1019,7 +1019,7 @@ IPA.column = function (spec) { that.init = function() { if (that.entity_name && !that.label) { - var param_info = IPA.get_param_info(that.entity_name, that.name); + var param_info = IPA.get_entity_param(that.entity_name, that.name); if (param_info) that.label = param_info.label; } }; @@ -1206,11 +1206,11 @@ IPA.table_widget = function (spec) { that.tfoot = $('tfoot', that.table); var select_all_checkbox = $('input[name=select]', that.thead); - select_all_checkbox.attr('title', 'Select All'); + select_all_checkbox.attr('title', IPA.messages.search.select_all); select_all_checkbox.change(function() { var checked = select_all_checkbox.is(':checked'); - select_all_checkbox.attr('title', checked ? 'Unselect All' : 'Select All'); + select_all_checkbox.attr('title', checked ? IPA.messages.search.unselect_all : IPA.messages.search.select_all); var checkboxes = $('input[name=select]', that.tbody).get(); for (var i=0; i<checkboxes.length; i++) { checkboxes[i].checked = checked; |