From 5aa91b6d5591512d65fe172ec0cadce0595ad9d7 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 2 Feb 2011 15:35:08 -0800 Subject: [PATCH] localize Download Template success/fail message. --- client/WEB-INF/classes/resources/messages.properties | 5 +++-- ui/jsp/template.jsp | 3 ++- ui/scripts/cloud.core.iso.js | 10 ++-------- ui/scripts/cloud.core.template.js | 10 ++++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index cd2502402da..14cea729e42 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -6,8 +6,9 @@ label.numretries = Number of Retries label.timeout.in.second = Timeout(seconds) message.action.delete.external.firewall=Please confirm that you would like to remove this external firewall. Warning: If you are planning to add back the same external firewall, you must reset usage data on the device. message.action.delete.external.load.balancer=Please confirm that you would like to remove this external load balancer. Warning: If you are planning to add back the same external load balancer, you must reset usage data on the device. -message.download.ISO=Please click # to download ISO - +message.download.template=Please click # to download template +message.download.ISO=Please click # to download ISO + #Labels label.account.id=Account ID label.account.name=Account Name diff --git a/ui/jsp/template.jsp b/ui/jsp/template.jsp index 08695687177..8bf340e7779 100644 --- a/ui/jsp/template.jsp +++ b/ui/jsp/template.jsp @@ -16,7 +16,8 @@ dictionary = { 'label.action.copy.template.processing' : '', 'label.action.create.vm' : '', 'label.action.create.vm.processing' : '', - 'label.action.download.template' : '' + 'label.action.download.template' : '', + 'message.download.template': '' }; diff --git a/ui/scripts/cloud.core.iso.js b/ui/scripts/cloud.core.iso.js index 4586a62e52a..75e593e2dd7 100644 --- a/ui/scripts/cloud.core.iso.js +++ b/ui/scripts/cloud.core.iso.js @@ -731,14 +731,8 @@ function doDownloadISO($actionLink, $detailsTab, $midmenuItem1) { var htmlMsg2 = htmlMsg.replace(/#/g, url); $infoContainer.find("#info").html(htmlMsg2); $infoContainer.show(); - } else if (result.jobstatus == 2) { // Failed - var label = $actionLink.data("label"); - var label2; - if(label in dictionary) - label2 = dictionary[label]; - else - label2 = label; - var errorMsg = label2 + " - " + g_dictionary["label.failed"] + " - " + g_dictionary["label.error.code"] + " " + fromdb(result.jobresult.errorcode); + } else if (result.jobstatus == 2) { // Failed + var errorMsg = g_dictionary["label.failed"] + " - " + g_dictionary["label.error.code"] + " " + fromdb(result.jobresult.errorcode); handleErrorInDialog2(errorMsg, $dialogDownloadISO); } } diff --git a/ui/scripts/cloud.core.template.js b/ui/scripts/cloud.core.template.js index a8f5e55c671..71c3c71f01c 100644 --- a/ui/scripts/cloud.core.template.js +++ b/ui/scripts/cloud.core.template.js @@ -761,11 +761,13 @@ function doDownloadTemplate($actionLink, $detailsTab, $midmenuItem1) { $infoContainer.removeClass("error"); $infoContainer.find("#icon,#info").removeClass("error"); var url = decodeURIComponent(json.queryasyncjobresultresponse.jobresult.template.url); - var htmlMsg = "Please click " + url + "" + " to download template"; - $infoContainer.find("#info").html(htmlMsg); + var htmlMsg = dictionary["message.download.template"]; + var htmlMsg2 = htmlMsg.replace(/#/g, url); + $infoContainer.find("#info").html(htmlMsg2); $infoContainer.show(); - } else if (result.jobstatus == 2) { // Failed - handleErrorInDialog2(fromdb(result.jobresult.errortext), $dialogDownloadTemplate); + } else if (result.jobstatus == 2) { // Failed + var errorMsg = g_dictionary["label.failed"] + " - " + g_dictionary["label.error.code"] + " " + fromdb(result.jobresult.errorcode); + handleErrorInDialog2(errorMsg, $dialogDownloadTemplate); } } },