new UI - add a shared function fromdb()

This commit is contained in:
Jessica Wang 2010-09-07 11:24:46 -07:00
parent 0ea1f370b8
commit 5aa70deae7
6 changed files with 33 additions and 25 deletions

View File

@ -2,8 +2,8 @@ function loadAccountToRigntPanelFn($rightPanelContent) {
var jsonObj = $rightPanelContent.data("jsonObj");
var $rightPanelContent = $("#right_panel_content");
$rightPanelContent.find("#role").text(toRole(jsonObj.accounttype));
$rightPanelContent.find("#account").text(jsonObj.name);
$rightPanelContent.find("#domain").text(jsonObj.domain);
$rightPanelContent.find("#account").text(fromdb(jsonObj.name));
$rightPanelContent.find("#domain").text(fromdb(jsonObj.domain));
$rightPanelContent.find("#vm_total").text(jsonObj.vmtotal);
$rightPanelContent.find("#ip_total").text(jsonObj.iptotal);
$rightPanelContent.find("#bytes_received").text(jsonObj.receivedbytes);

View File

@ -1,11 +1,11 @@
function loadEventToRigntPanelFn($rightPanelContent) {
var jsonObj = $rightPanelContent.data("jsonObj");
var $rightPanelContent = $("#right_panel_content");
$rightPanelContent.find("#username").text(jsonObj.username);
$rightPanelContent.find("#account").text(jsonObj.account);
$rightPanelContent.find("#username").text(fromdb(jsonObj.username));
$rightPanelContent.find("#account").text(fromdb(jsonObj.account));
$rightPanelContent.find("#type").text(jsonObj.type);
$rightPanelContent.find("#level").text(jsonObj.level);
$rightPanelContent.find("#description").text(jsonObj.description);
$rightPanelContent.find("#description").text(fromdb(jsonObj.description));
$rightPanelContent.find("#state").text(jsonObj.state);
setDateField(jsonObj.created, $rightPanelContent.find("#created"));
}

View File

@ -384,21 +384,21 @@ function clickInstanceGroupHeader($arrowIcon) {
var jsonObj = $t.data("jsonObj");
var vmName = getVmName(jsonObj.name, jsonObj.displayname);
$rightPanelHeader.find("#vm_name").text(vmName);
$rightPanelHeader.find("#vm_name").text(fromdb(vmName));
updateVirtualMachineStateInRightPanel(jsonObj.state);
$rightPanelContent.find("#ipAddress").text(jsonObj.ipaddress);
$rightPanelContent.find("#zoneName").text(jsonObj.zonename);
$rightPanelContent.find("#templateName").text(jsonObj.templatename);
$rightPanelContent.find("#serviceOfferingName").text(jsonObj.serviceofferingname);
$rightPanelContent.find("#zoneName").text(fromdb(jsonObj.zonename));
$rightPanelContent.find("#templateName").text(fromdb(jsonObj.templatename));
$rightPanelContent.find("#serviceOfferingName").text(fromdb(jsonObj.serviceofferingname));
if(jsonObj.haenable == "true")
$rightPanelContent.find("#ha").removeClass("cross_icon").addClass("tick_icon").show();
else
$rightPanelContent.find("#ha").removeClass("tick_icon").addClass("cross_icon").show();
$rightPanelContent.find("#created").text(jsonObj.created);
$rightPanelContent.find("#account").text(jsonObj.account);
$rightPanelContent.find("#domain").text(jsonObj.domain);
$rightPanelContent.find("#hostName").text(jsonObj.hostname);
$rightPanelContent.find("#group").text(jsonObj.group);
$rightPanelContent.find("#account").text(fromdb(jsonObj.account));
$rightPanelContent.find("#domain").text(fromdb(jsonObj.domain));
$rightPanelContent.find("#hostName").text(fromdb(jsonObj.hostname));
$rightPanelContent.find("#group").text(fromdb(jsonObj.group));
if(jsonObj.isoid != null && jsonObj.isoid.length > 0)
$rightPanelContent.find("#iso").removeClass("cross_icon").addClass("tick_icon").show();
else

View File

@ -165,6 +165,14 @@ function createURL(url) {
return url +"&response=json&sessionkey=" + g_sessionKey;
}
function fromdb(val) {
return sanitizeXSS(unescape(noNull(val)));
}
function todb(val) {
return encodeURIComponent(escape(display));
}
@ -790,16 +798,16 @@ function sanitizeXSS(val) {
function getVmName(p_vmName, p_vmDisplayname) {
if(p_vmDisplayname == null)
return sanitizeXSS(p_vmName);
return sanitizeXSS(unescape(p_vmName));
var vmName = null;
if (isAdmin()) {
if (p_vmDisplayname != p_vmName) {
vmName = p_vmName + "(" + sanitizeXSS(p_vmDisplayname) + ")";
vmName = p_vmName + "(" + sanitizeXSS(unescape(p_vmDisplayname)) + ")";
} else {
vmName = p_vmName;
}
} else {
vmName = sanitizeXSS(p_vmDisplayname);
vmName = sanitizeXSS(unescape(p_vmDisplayname));
}
return vmName;
}

View File

@ -4,11 +4,11 @@ function loadSnapshotToRigntPanelFn($rightPanelContent) {
var $rightPanelContent = $("#right_panel_content");
$rightPanelContent.find("#id").text(jsonObj.id);
$rightPanelContent.find("#name").text(jsonObj.name);
$rightPanelContent.find("#volume_name").text(jsonObj.volumename);
$rightPanelContent.find("#name").text(fromdb(jsonObj.name));
$rightPanelContent.find("#volume_name").text(fromdb(jsonObj.volumename));
$rightPanelContent.find("#interval_type").text(jsonObj.intervaltype);
$rightPanelContent.find("#account").text(jsonObj.account);
$rightPanelContent.find("#domain").text(jsonObj.domain);
$rightPanelContent.find("#account").text(fromdb(jsonObj.account));
$rightPanelContent.find("#domain").text(fromdb(jsonObj.domain));
setDateField(jsonObj.created, $rightPanelContent.find("#created"));
}

View File

@ -4,14 +4,14 @@ function loadVolumeToRigntPanelFn($rightPanelContent) {
var $rightPanelContent = $("#right_panel_content");
$rightPanelContent.find("#id").text(jsonObj.id);
$rightPanelContent.find("#name").text(jsonObj.name);
$rightPanelContent.find("#zonename").text(jsonObj.zonename);
$rightPanelContent.find("#name").text(fromdb(jsonObj.name));
$rightPanelContent.find("#zonename").text(fromdb(jsonObj.zonename));
$rightPanelContent.find("#device_id").text(jsonObj.deviceid);
$rightPanelContent.find("#state").text(jsonObj.state);
$rightPanelContent.find("#storage").text(jsonObj.storage);
$rightPanelContent.find("#account").text(jsonObj.account);
$rightPanelContent.find("#storage").text(fromdb(jsonObj.storage));
$rightPanelContent.find("#account").text(fromdb(jsonObj.account));
$rightPanelContent.find("#type").text(noNull(jsonObj.type) + " (" + noNull(jsonObj.storagetype) + " storage)");
$rightPanelContent.find("#type").text(jsonObj.type + " (" + jsonObj.storagetype + " storage)");
$rightPanelContent.find("#size").text((jsonObj.size == "0") ? "" : convertBytes(jsonObj.size));
if (jsonObj.virtualmachineid == null)