diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 4a5c63e806b..eabccba48d7 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -1634,7 +1634,7 @@ return "Unlimited"; } else { - return fromdb(args) + " Mb/s"; + return _s(args) + " Mb/s"; } } diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 4fac2bc3b61..54ae111faa4 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1645,7 +1645,7 @@ var jsonObj = args.context.instances[0]; args.response.success({ data: { - totalCPU: fromdb(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), + totalCPU: _s(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), cpuused: jsonObj.cpuused, networkkbsread: (jsonObj.networkkbsread == null || jsonObj.networkkbsread == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbsread * 1024), networkkbswrite: (jsonObj.networkkbswrite == null || jsonObj.networkkbswrite == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbswrite * 1024) diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index f20e3186f9f..2842a425e11 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -91,21 +91,26 @@ function createURL(apiName, options) { return urlString; } +/* function fromdb(val) { return sanitizeXSS(noNull(val)); } +*/ function todb(val) { return encodeURIComponent(val); } +/* function noNull(val) { if(val == null) return ""; else return val; } +*/ +/* function sanitizeXSS(val) { // Prevent cross-site-script(XSS) attack if(val == null || typeof(val) != "string") return val; @@ -113,6 +118,7 @@ function sanitizeXSS(val) { // Prevent cross-site-script(XSS) attack val = val.replace(/>/g, ">"); //replace > whose unicode is \u003e return unescape(val); } +*/ // Role Functions function isAdmin() { @@ -148,7 +154,7 @@ function handleError(XMLHttpResponse, handleErrorCallback) { } else { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - $("#dialog_error").text(fromdb(errorMsg)).dialog("open"); + $("#dialog_error").text(_s(errorMsg)).dialog("open"); } } @@ -163,7 +169,7 @@ function parseXMLHttpResponse(XMLHttpResponse) { var property; for(property in json) {} var errorObj = json[property]; - return fromdb(errorObj.errortext); + return _s(errorObj.errortext); } else { return ""; } @@ -439,13 +445,13 @@ function iscsiURL(server, iqn, lun) { //VM Instance function getVmName(p_vmName, p_vmDisplayname) { if(p_vmDisplayname == null) - return fromdb(p_vmName); + return _s(p_vmName); var vmName = null; if (p_vmDisplayname != p_vmName) { - vmName = fromdb(p_vmName) + " (" + fromdb(p_vmDisplayname) + ")"; + vmName = _s(p_vmName) + " (" + _s(p_vmDisplayname) + ")"; } else { - vmName = fromdb(p_vmName); + vmName = _s(p_vmName); } return vmName; } diff --git a/ui/scripts/system.js b/ui/scripts/system.js index e683451ea14..891efe761b5 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -2441,7 +2441,7 @@ addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addNetscalerLoadBalancer", "addnetscalerloadbalancerresponse", "netscalerloadbalancer"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -2660,7 +2660,7 @@ addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addF5LoadBalancer", "addf5bigiploadbalancerresponse"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -2900,7 +2900,7 @@ addExternalFirewall(args, selectedPhysicalNetworkObj, "addSrxFirewall", "addsrxfirewallresponse", "srxfirewall"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -3902,7 +3902,7 @@ addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addNetscalerLoadBalancer", "addnetscalerloadbalancerresponse", "netscalerloadbalancer"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -4085,7 +4085,7 @@ addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addF5LoadBalancer", "addf5bigiploadbalancerresponse", "f5loadbalancer"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -4290,7 +4290,7 @@ addExternalFirewall(args, selectedPhysicalNetworkObj, "addSrxFirewall", "addsrxfirewallresponse", "srxfirewall"); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -5695,7 +5695,7 @@ var jsonObj = args.context.hosts[0]; args.response.success({ data: { - totalCPU: fromdb(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), + totalCPU: _s(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), cpuused: jsonObj.cpuused, cpuallocated: (jsonObj.cpuallocated == null || jsonObj.cpuallocated == 0)? "N/A": jsonObj.cpuallocated, memorytotal: (jsonObj.memorytotal == null || jsonObj.memorytotal == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.memorytotal * 1024), @@ -7066,7 +7066,7 @@ }); } else if (result.jobstatus == 2) { - alert("failed to enable security group provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable security group provider. Error: " + _s(result.jobresult.errortext)); } } }, @@ -7147,7 +7147,7 @@ } } else if (result.jobstatus == 2) { - alert("failed to enable Virtual Router Provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable Virtual Router Provider. Error: " + _s(result.jobresult.errortext)); } } }, @@ -7161,7 +7161,7 @@ }); } else if (result.jobstatus == 2) { - alert("configureVirtualRouterElement failed. Error: " + fromdb(result.jobresult.errortext)); + alert("configureVirtualRouterElement failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -7175,7 +7175,7 @@ }); } else if (result.jobstatus == 2) { - alert("updatePhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext)); + alert("updatePhysicalNetwork failed. Error: " + _s(result.jobresult.errortext)); } } }, diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js index 8216d02d8e6..23390c026c7 100644 --- a/ui/scripts/ui-custom/physicalResources.js +++ b/ui/scripts/ui-custom/physicalResources.js @@ -93,7 +93,7 @@ cloudStack.dialog.notice({ message: 'Update SSL Certiciate succeeded' }); } else if (result.jobstatus == 2) { - cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + fromdb(result.jobresult.errortext) }); + cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + _s(result.jobresult.errortext) }); } $loading.remove(); } diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 20ebad7fc09..efe488e42ff 100644 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -1106,7 +1106,7 @@ } } else if (result.jobstatus == 2) { - alert("Failed to add Guest traffic type to basic zone. Error: " + fromdb(result.jobresult.errortext)); + alert("Failed to add Guest traffic type to basic zone. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1150,7 +1150,7 @@ } } else if (result.jobstatus == 2) { - alert("Failed to add Management traffic type to basic zone. Error: " + fromdb(result.jobresult.errortext)); + alert("Failed to add Management traffic type to basic zone. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1195,7 +1195,7 @@ } } else if (result.jobstatus == 2) { - alert("Failed to add Public traffic type to basic zone. Error: " + fromdb(result.jobresult.errortext)); + alert("Failed to add Public traffic type to basic zone. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1210,7 +1210,7 @@ } } else if (result.jobstatus == 2) { - alert("createPhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext)); + alert("createPhysicalNetwork failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1294,7 +1294,7 @@ } } else if (result.jobstatus == 2) { - alert(apiCmd + " failed. Error: " + fromdb(result.jobresult.errortext)); + alert(apiCmd + " failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1309,7 +1309,7 @@ }); } else if (result.jobstatus == 2) { - alert("createPhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext)); + alert("createPhysicalNetwork failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1495,7 +1495,7 @@ }); } else if (result.jobstatus == 2) { - alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + fromdb(result.jobresult.errortext)); + alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1532,7 +1532,7 @@ } } else if (result.jobstatus == 2) { - alert("failed to enable security group provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable security group provider. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1568,7 +1568,7 @@ } } else if (result.jobstatus == 2) { - alert("failed to enable Virtual Router Provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable Virtual Router Provider. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1582,7 +1582,7 @@ }); } else if (result.jobstatus == 2) { - alert("configureVirtualRouterElement failed. Error: " + fromdb(result.jobresult.errortext)); + alert("configureVirtualRouterElement failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1596,7 +1596,7 @@ }); } else if (result.jobstatus == 2) { - alert("updatePhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext)); + alert("updatePhysicalNetwork failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1713,7 +1713,7 @@ } } else if (result.jobstatus == 2) { - alert("failed to enable Virtual Router Provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable Virtual Router Provider. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1727,7 +1727,7 @@ }); } else if (result.jobstatus == 2) { - alert("configureVirtualRouterElement failed. Error: " + fromdb(result.jobresult.errortext)); + alert("configureVirtualRouterElement failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1741,7 +1741,7 @@ }); } else if (result.jobstatus == 2) { - alert("updatePhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext)); + alert("updatePhysicalNetwork failed. Error: " + _s(result.jobresult.errortext)); } } }, @@ -1910,7 +1910,7 @@ }); } else if(result.jobstatus == 2) { - alert("failed to enable Netscaler provider. Error: " + fromdb(result.jobresult.errortext)); + alert("failed to enable Netscaler provider. Error: " + _s(result.jobresult.errortext)); } } } @@ -1924,7 +1924,7 @@ }); } else if(result.jobstatus == 2) { //addNetscalerLoadBalancer failed - error('addNetscalerDevice', fromdb(result.jobresult.errortext), { fn: 'addNetscalerDevice', args: args }); + error('addNetscalerDevice', _s(result.jobresult.errortext), { fn: 'addNetscalerDevice', args: args }); } } } @@ -2224,7 +2224,7 @@ } } else if(result.jobstatus == 2){ - alert("error: " + fromdb(result.jobresult.errortext)); + alert("error: " + _s(result.jobresult.errortext)); } } },