From 4a8c43aa324beff5bebfa9a699b1dc4b29020731 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 16 Feb 2011 12:46:59 -0600 Subject: I18n update. Hard-coded messages through out the code have been replaced by i18n messages obtained from json_metadata and i18n_messages. --- install/ui/hbacrule.js | 190 ++++++++++++++++++++++++------------------------- 1 file changed, 94 insertions(+), 96 deletions(-) (limited to 'install/ui/hbacrule.js') diff --git a/install/ui/hbacrule.js b/install/ui/hbacrule.js index f55f233c..743b9e0c 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 = $('').appendTo(table); var 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 = $('').appendTo(tr); + var field = that.get_field('cn'); var span = $('', { 'name': 'cn' }).appendTo(td); $('