From adecd3a424fd3a5a4a8eb76edeb73bd08e395797 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 26 Jan 2011 18:02:30 -0800 Subject: [PATCH] bug 4556: account page - localize Edit User action. --- .../classes/resources/messages.properties | 1 + ui/jsp/account.jsp | 4 +- ui/scripts/cloud.core.account.js | 4 +- ui/scripts/cloud.core.js | 41 ++++++++++++++----- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 83f79c74913..18e12e46170 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -431,6 +431,7 @@ label.action.enable.account=Enable account label.action.enable.account.processing=Enabling account.... label.action.delete.account=Delete account label.action.delete.account.processing=Deleting account.... +label.action.edit.user=Edit User #Messages message.edit.limits=Please specify limits to the following resources. A "-1" indicates no limit to the amount of resources create. diff --git a/ui/jsp/account.jsp b/ui/jsp/account.jsp index b8e020ce8f8..cb5c6421f82 100644 --- a/ui/jsp/account.jsp +++ b/ui/jsp/account.jsp @@ -20,11 +20,11 @@ dictionary = { "label.action.enable.account": '', "label.action.enable.account.processing": '', "label.action.delete.account": '', - "label.action.delete.account.processing": '' + "label.action.delete.account.processing": '', + "label.action.edit.user": '' }; -
diff --git a/ui/scripts/cloud.core.account.js b/ui/scripts/cloud.core.account.js index 633bd5c37b1..2b4414170eb 100644 --- a/ui/scripts/cloud.core.account.js +++ b/ui/scripts/cloud.core.account.js @@ -513,7 +513,7 @@ function accountUserJSONToTemplate(jsonObj, $template) { var noAvailableActions = true; if(isAdmin()) { - buildActionLinkForSubgridItem("Edit User", accountUserActionMap, $actionMenu, $template); + buildActionLinkForSubgridItem("label.action.edit.user", accountUserActionMap, $actionMenu, $template); buildActionLinkForSubgridItem("Change Password", accountUserActionMap, $actionMenu, $template); buildActionLinkForSubgridItem("Generate Keys", accountUserActionMap, $actionMenu, $template); noAvailableActions = false; @@ -797,7 +797,7 @@ function doDeleteAccount($actionLink, $detailsTab, $midmenuItem1) { } var accountUserActionMap = { - "Edit User": { + "label.action.edit.user": { dialogBeforeActionFn : doEditUser }, "Change Password": { diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js index f5cdd5077f5..e0f6d33f0f3 100644 --- a/ui/scripts/cloud.core.js +++ b/ui/scripts/cloud.core.js @@ -207,9 +207,16 @@ function handleMidMenuItemAfterDetailsTabAction($midmenuItem1, isSuccessful, aft function buildActionLinkForSubgridItem(label, actionMap, $actionMenu, $subgridItem) { var apiInfo = actionMap[label]; var $listItem = $("#action_list_item").clone(); - $actionMenu.find("#action_list").append($listItem.show()); - $listItem.find("#link").text(label); - $listItem.data("label", label); + $actionMenu.find("#action_list").append($listItem.show()); + $listItem.data("label", label); + + var label2; + if(label in dictionary) + label2 = dictionary[label]; + else + label2 = label; + $listItem.find("#link").text(label2); + $listItem.data("apiInfo", apiInfo); var id = $subgridItem.data("jsonObj").id; @@ -232,15 +239,27 @@ function buildActionLinkForSubgridItem(label, actionMap, $actionMenu, $subgridIt function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) { var label = $actionLink.data("label"); + var label2; + if(label in dictionary) + label2 = dictionary[label]; + else + label2 = label; + var apiInfo = $actionLink.data("apiInfo"); - var inProcessText = apiInfo.inProcessText; + var inProcessText = apiInfo.inProcessText; + var inProcessText2; + if(inProcessText in dictionary) + inProcessText2 = dictionary[inProcessText]; + else + inProcessText2 = inProcessText; + var isAsyncJob = apiInfo.isAsyncJob; var asyncJobResponse = apiInfo.asyncJobResponse; var afterActionSeccessFn = apiInfo.afterActionSeccessFn; var $spinningWheel = $subgridItem.find("#spinning_wheel"); - $spinningWheel.find("#description").text(inProcessText); + $spinningWheel.find("#description").text(inProcessText2); $spinningWheel.show(); $subgridItem.find("#after_action_info_container").removeClass("error").addClass("success").hide(); @@ -267,11 +286,11 @@ function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) { $("body").stopTime(timerKey); $spinningWheel.hide(); if (result.jobstatus == 1) { // Succeeded - $subgridItem.find("#after_action_info").text(label + " action succeeded."); + $subgridItem.find("#after_action_info").text(label2 + " action succeeded."); $subgridItem.find("#after_action_info_container").removeClass("error").addClass("success").show(); afterActionSeccessFn(json, id, $subgridItem); } else if (result.jobstatus == 2) { // Failed - $subgridItem.find("#after_action_info").text(label + " action failed. Reason: " + fromdb(result.jobresult.errortext)); + $subgridItem.find("#after_action_info").text(label2 + " action failed. Reason: " + fromdb(result.jobresult.errortext)); $subgridItem.find("#after_action_info_container").removeClass("success").addClass("error").show(); } } @@ -279,7 +298,7 @@ function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) { error: function(XMLHttpResponse) { $("body").stopTime(timerKey); handleError(XMLHttpResponse, function() { - handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label); + handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label2); }); } }); @@ -289,7 +308,7 @@ function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) { }, error: function(XMLHttpResponse) { handleError(XMLHttpResponse, function() { - handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label); + handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label2); }); } }); @@ -304,13 +323,13 @@ function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) { async: false, success: function(json) { $spinningWheel.hide(); - $subgridItem.find("#after_action_info").text(label + " action succeeded."); + $subgridItem.find("#after_action_info").text(label2 + " action succeeded."); $subgridItem.find("#after_action_info_container").removeClass("error").addClass("success").show(); afterActionSeccessFn(json, id, $subgridItem); }, error: function(XMLHttpResponse) { handleError(XMLHttpResponse, function() { - handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label); + handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label2); }); } });