I18n update for dialog box buttons.

https://fedorahosted.org/freeipa/ticket/899
This commit is contained in:
Endi S. Dewata 2011-02-21 18:36:42 -06:00 committed by Adam Young
parent 397da3f781
commit 39a00b496c
8 changed files with 164 additions and 118 deletions

View File

@ -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
});
};

View File

@ -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);
};

View File

@ -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.";

View File

@ -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
});

View File

@ -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": {

View File

@ -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": {

View File

@ -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;

View File

@ -305,7 +305,7 @@ class i18n_messages(Command):
"inactive":_("Inactive"),
"activate":_("Click to Activate"),
"error_changing_status":_("Error changing account status"),
"reset_password":_("Reset password"),
"reset_password":_("Reset Password"),
"new_password":_("New Password"),
"repeat_password":_("Repeat Password"),
"password_change_complete":_("Password change complete"),
@ -317,17 +317,22 @@ class i18n_messages(Command):
"add_and_add_another":_("Add and Add Another"),
"add_and_edit":_("Add and Edit"),
"add_and_close":_("Add and Close"),
"add_many":_("Add Many"),
"back_to_list":_("Back to List"),
"cancel": _("Cancel"),
"close": _("Close"),
"enroll":_("Enroll"),
"find": _("Find"),
"get": _("Get"),
"issue": _("Issue"),
"ok": _("OK"),
"reset":_("Reset"),
"update":_("Update"),
"enroll":_("Enroll"),
"remove":_("Delete"),
"restore":_("Restore"),
"retry":_("Retry"),
"revoke":_("Revoke"),
"update":_("Update"),
"view":_("View"),
"back_to_list":_("Back to List"),
},
"dialogs":{
"remove_empty":_("Select ${entity} to be removed."),
@ -375,7 +380,7 @@ class i18n_messages(Command):
},
"ajax":{
"401":_("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.")