diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-02-21 18:36:42 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-02-22 13:26:09 -0500 |
commit | 39a00b496c57b1617fff9564dd78529b0486216a (patch) | |
tree | ebd82a6c683747073069ed6701b763c794792957 /install | |
parent | 397da3f78192cc8eafdf6d36d0ac1f3303bfaaa4 (diff) | |
download | freeipa-39a00b496c57b1617fff9564dd78529b0486216a.tar.gz freeipa-39a00b496c57b1617fff9564dd78529b0486216a.tar.xz freeipa-39a00b496c57b1617fff9564dd78529b0486216a.zip |
I18n update for dialog box buttons.
https://fedorahosted.org/freeipa/ticket/899
Diffstat (limited to 'install')
-rwxr-xr-x | install/ui/certificate.js | 124 | ||||
-rw-r--r-- | install/ui/dialog.js | 18 | ||||
-rw-r--r-- | install/ui/ipa.js | 52 | ||||
-rw-r--r-- | install/ui/policy.js | 21 | ||||
-rw-r--r-- | install/ui/test/data/i18n_messages.json | 9 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 9 | ||||
-rw-r--r-- | install/ui/user.js | 34 |
7 files changed, 154 insertions, 113 deletions
diff --git a/install/ui/certificate.js b/install/ui/certificate.js index b91d2b9bc..c5de56c1f 100755 --- a/install/ui/certificate.js +++ b/install/ui/certificate.js @@ -98,15 +98,18 @@ IPA.cert.get_dialog = function(spec) { IPA.cert.END_CERTIFICATE); that.open = function() { + + var buttons = {}; + + buttons[IPA.messages.buttons.close] = function() { + dialog.dialog('destroy'); + }; + dialog.dialog({ modal: true, width: 500, height: 400, - buttons: { - 'Close': function() { - dialog.dialog('destroy'); - } - } + buttons: buttons }); }; @@ -153,23 +156,27 @@ IPA.cert.revoke_dialog = function(spec) { } that.open = function() { + + var buttons = {}; + + buttons[IPA.messages.buttons.revoke] = function() { + var values = {}; + values['reason'] = select.val(); + if (that.revoke) { + that.revoke(values); + } + dialog.dialog('destroy'); + }; + + buttons[IPA.messages.buttons.cancel] = function() { + dialog.dialog('destroy'); + }; + 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'); - } - } + buttons: buttons }); }; @@ -193,22 +200,26 @@ IPA.cert.restore_dialog = function(spec) { IPA.messages.objects.cert.restore_confirmation); that.open = function() { + + var buttons = {}; + + buttons[IPA.messages.buttons.restore] = function() { + var values = {}; + if (that.restore) { + that.restore(values); + } + dialog.dialog('destroy'); + }; + + buttons[IPA.messages.buttons.cancel] = function() { + dialog.dialog('destroy'); + }; + 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'); - } - } + buttons: buttons }); }; @@ -327,15 +338,18 @@ IPA.cert.view_dialog = function(spec) { }).appendTo(tr); that.open = function() { + + var buttons = {}; + + buttons[IPA.messages.buttons.close] = function() { + dialog.dialog('destroy'); + }; + dialog.dialog({ modal: true, width: 600, height: 500, - buttons: { - 'Close': function() { - dialog.dialog('destroy'); - } - } + buttons: buttons }); }; @@ -370,28 +384,32 @@ IPA.cert.request_dialog = function(spec) { dialog.append(IPA.cert.END_CERTIFICATE_REQUEST); that.open = function() { + + var buttons = {}; + + buttons[IPA.messages.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'); + }; + + buttons[IPA.messages.buttons.cancel] = function() { + dialog.dialog('destroy'); + }; + 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'); - } - } + buttons: buttons }); }; diff --git a/install/ui/dialog.js b/install/ui/dialog.js index 406779ef5..cfddd5194 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -445,14 +445,9 @@ IPA.adder_dialog = function (spec) { }; that.open = function(container) { - that.buttons = { - 'Enroll': function() { - that.execute(); - }, - 'Cancel': function() { - that.close(); - } - }; + + that.buttons[IPA.messages.buttons.enroll] = that.execute; + that.buttons[IPA.messages.buttons.cancel] = that.close; that.dialog_open(container); }; @@ -544,10 +539,9 @@ IPA.deleter_dialog = function (spec) { }; that.open = function(container) { - that.buttons = { - 'Delete': that.execute, - 'Cancel': that.close - }; + + that.buttons[IPA.messages.buttons.remove] = that.execute; + that.buttons[IPA.messages.buttons.cancel] = that.close; that.dialog_open(container); }; diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 34244b0c4..2c07d742a 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -140,15 +140,18 @@ var IPA = ( function () { html: IPA.messages.dirty }). appendTo($("#navigation")); + + var buttons = {}; + + buttons[IPA.messages.buttons.ok] = function() { + $(this).dialog("close"); + }; + message_box.dialog({ title: 'Dirty', modal:true, width: '20em', - buttons: { - Ok: function() { - $( this ).dialog( "close" ); - } - } + buttons: buttons }); return false; } @@ -351,24 +354,33 @@ IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, c function dialog_open(xhr, text_status, error_thrown) { var that = this; + var buttons = {}; + + /** + * When a user initially opens the Web UI without a Kerberos + * ticket, the messages including the button labels have not + * been loaded yet, so the button labels need default values. + */ + var label = IPA.messages.buttons ? IPA.messages.buttons.retry : 'Retry'; + buttons[label] = function() { + IPA.error_dialog.dialog('close'); + IPA.cmd(name, args, options, win_callback, fail_callback, + objname, command_name); + }; + + label = IPA.messages.buttons ? IPA.messages.buttons.cancel : 'Cancel'; + buttons[label] = function() { + IPA.error_dialog.dialog('close'); + if (fail_callback) { + fail_callback.call(that, xhr, text_status, error_thrown); + } + }; + IPA.error_dialog.dialog({ modal: true, title: error_thrown.title, width: 400, - buttons: { - 'Retry': function () { - IPA.error_dialog.dialog('close'); - IPA.cmd(name, args, options, win_callback, fail_callback, - objname, command_name); - }, - 'Cancel': function () { - IPA.error_dialog.dialog('close'); - if (fail_callback) { - fail_callback.call(that, xhr, text_status, - error_thrown); - } - } - } + buttons: buttons }); } @@ -395,7 +407,7 @@ IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, c } else { error_thrown.message = "Your kerberos ticket is no longer valid. "+ - "Please run kinit and then click 'retry'. "+ + "Please run kinit and then click 'Retry'. "+ "If this is your first time running the IPA Web UI "+ "<a href='/ipa/config/unauthorized.html'>"+ "follow these directions</a> to configure your browser."; diff --git a/install/ui/policy.js b/install/ui/policy.js index 9b8115f8c..c26dfc5c5 100644 --- a/install/ui/policy.js +++ b/install/ui/policy.js @@ -174,14 +174,15 @@ IPA.records_facet = function (spec){ add_dialog.dialog('close'); } + var buttons = {}; + + buttons[IPA.messages.buttons.add_many] = add; + buttons[IPA.messages.buttons.add_and_close] = add_and_close; + buttons[IPA.messages.buttons.cancel] = cancel; add_dialog.dialog({ modal: true, - buttons: { - 'Add many': add, - 'Add and Close': add_and_close, - 'Cancel': cancel - } + buttons: buttons }); } @@ -256,12 +257,14 @@ IPA.records_facet = function (spec){ delete_dialog.append($('<P/>', {text: IPA.messages.search.delete_confirm})); + var buttons = {}; + + buttons[IPA.messages.buttons.remove] = delete_on_click; + buttons[IPA.messages.buttons.cancel] = cancel_on_click; + delete_dialog.dialog({ modal: true, - buttons: { - 'Delete': delete_on_click, - 'Cancel': cancel_on_click - } + buttons: buttons }); diff --git a/install/ui/test/data/i18n_messages.json b/install/ui/test/data/i18n_messages.json index da20f1374..f5aa841ec 100644 --- a/install/ui/test/data/i18n_messages.json +++ b/install/ui/test/data/i18n_messages.json @@ -4,7 +4,7 @@ "result": { "messages": { "ajax": { - "401": "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'>follow these directions</a> to configure your browser." + "401": "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'>follow these directions</a> to configure your browser." }, "association": { "add": "Add ${other_entity} into ${entity} ${primary_key}", @@ -17,14 +17,19 @@ "add_and_add_another": "Add and Add Another", "add_and_close": "Add and Close", "add_and_edit": "Add and Edit", + "add_many": "Add Many", "back_to_list": "Back to List", "cancel": "Cancel", + "close": "Close", "enroll": "Enroll", "find": "Find", "get": "Get", + "issue": "Issue", + "ok": "OK", "remove": "Delete", "reset": "Reset", "restore": "Restore", + "retry": "Retry", "revoke": "Revoke", "update": "Update", "view": "View" @@ -260,7 +265,7 @@ "password_change_complete": "Password change complete", "password_must_match": "Passwords must match", "repeat_password": "Repeat Password", - "reset_password": "Reset password" + "reset_password": "Reset Password" } }, "search": { diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 59c4b20b5..ffb3ad416 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -9467,7 +9467,7 @@ { "messages": { "ajax": { - "401": "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'>follow these directions</a> to configure your browser." + "401": "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'>follow these directions</a> to configure your browser." }, "association": { "add": "Add ${other_entity} into ${entity} ${primary_key}", @@ -9480,14 +9480,19 @@ "add_and_add_another": "Add and Add Another", "add_and_close": "Add and Close", "add_and_edit": "Add and Edit", + "add_many": "Add Many", "back_to_list": "Back to List", "cancel": "Cancel", + "close": "Close", "enroll": "Enroll", "find": "Find", "get": "Get", + "issue": "Issue", + "ok": "OK", "remove": "Delete", "reset": "Reset", "restore": "Restore", + "retry": "Retry", "revoke": "Revoke", "update": "Update", "view": "View" @@ -9723,7 +9728,7 @@ "password_change_complete": "Password change complete", "password_must_match": "Passwords must match", "repeat_password": "Repeat Password", - "reset_password": "Reset password" + "reset_password": "Reset Password" } }, "search": { diff --git a/install/ui/user.js b/install/ui/user.js index 66a1b8d15..7a5bf6781 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -208,23 +208,27 @@ IPA.user_password_widget = function(spec) { '<dd class="first"><input id="password_2" type="password"/></dd>'+ '</dl></div>'); + var buttons = {}; + + buttons[IPA.messages.objects.user.reset_password] = function() { + var p1 = $("#password_1").val(); + var p2 = $("#password_2").val(); + if (p1 != p2) { + alert(IPA.messages.objects.user.password_must_match); + return; + } + reset_password(p1); + }; + + buttons[IPA.messages.buttons.cancel] = function() { + dialog.dialog('close'); + }; + dialog.dialog({ modal: true, - minWidth:400, - buttons: { - 'Reset Password': function(){ - var p1 = $("#password_1").val(); - var p2 = $("#password_2").val(); - if (p1 != p2){ - alert(IPA.messages.objects.user.password_must_match); - return; - } - reset_password(p1); - }, - 'Cancel':function(){ - dialog.dialog('close'); - } - } + title: IPA.messages.objects.user.reset_password, + minWidth: 400, + buttons: buttons }); return false; |