From 58a629691340ca4ba77bc4b348a79bf40c9b087b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 30 Sep 2010 10:13:09 -0700 Subject: [PATCH] new UI - add a new shared function: switchBetweenDifferentTabs() --- ui/new/scripts/cloud.core2.instance.js | 30 +++++--------------------- ui/new/scripts/cloud.core2.js | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js index 97f46c1557e..133a54a6e90 100644 --- a/ui/new/scripts/cloud.core2.instance.js +++ b/ui/new/scripts/cloud.core2.instance.js @@ -632,31 +632,11 @@ function clickInstanceGroupHeader($arrowIcon) { zIndex: 2000 })); - //***** switch to different tab (begin) ******************************************************************** - $("#tab_details").bind("click", function(event){ - $(this).removeClass("off").addClass("on"); - $("#tab_volume, #tab_statistics").removeClass("on").addClass("off"); - $("#tab_content_details").show(); - $("#tab_content_volume, #tab_content_statistics").hide(); - return false; - }); - - $("#tab_volume").bind("click", function(event){ - $(this).removeClass("off").addClass("on"); - $("#tab_details, #tab_statistics").removeClass("on").addClass("off"); - $("#tab_content_volume").show(); - $("#tab_content_details, #tab_content_statistics").hide(); - return false; - }); - - $("#tab_statistics").bind("click", function(event){ - $(this).removeClass("off").addClass("on"); - $("#tab_details, #tab_volume").removeClass("on").addClass("off"); - $("#tab_content_statistics").show(); - $("#tab_content_details, #tab_content_volume").hide(); - return false; - }); - //***** switch to different tab (end) ********************************************************************** + //***** switch between different tabs (begin) ******************************************************************** + var tabArray = ["tab_details", "tab_volume", "tab_statistics"]; + var tabContentArray = ["tab_content_details", "tab_content_volume", "tab_content_statistics"]; + switchBetweenDifferentTabs(tabArray, tabContentArray); + //***** switch between different tabs (end) ********************************************************************** //***** VM Wizard (begin) ****************************************************************************** $vmPopup = $("#vm_popup"); diff --git a/ui/new/scripts/cloud.core2.js b/ui/new/scripts/cloud.core2.js index a85cbe2cbf8..1d22397daa4 100644 --- a/ui/new/scripts/cloud.core2.js +++ b/ui/new/scripts/cloud.core2.js @@ -664,6 +664,28 @@ function initializeEditFunction($readonlyFields, $editFields, doUpdateFn) { }); } +function switchBetweenDifferentTabs(tabArray, tabContentArray) { + for(var tabIndex=0; tabIndex