From 7bc9eaeef543497a80a23ce8d757a9f1d5c3de39 Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Wed, 28 Nov 2007 19:37:25 +0000 Subject: [PATCH] More clean up of web interface and clean up of ajax operations git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@90 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-web/js_xcat/ui.js | 18 +++--- xCAT-web/lib/GroupNodeTable.class.php | 3 +- .../XCATCommand/XCATCommandRunner.class.php | 8 +-- .../XCAT/webservice/XCATWebservice.class.php | 55 ------------------- xCAT-web/machines/groups.php | 2 +- xCAT-web/{ => machines}/nodes_by_group.php | 5 +- xCAT-web/nodegroups.php | 10 ---- xCAT-web/webservice.php | 18 ------ 8 files changed, 20 insertions(+), 99 deletions(-) delete mode 100644 xCAT-web/lib/XCAT/webservice/XCATWebservice.class.php rename xCAT-web/{ => machines}/nodes_by_group.php (62%) delete mode 100644 xCAT-web/nodegroups.php delete mode 100644 xCAT-web/webservice.php diff --git a/xCAT-web/js_xcat/ui.js b/xCAT-web/js_xcat/ui.js index 2a0681e11..c2b8bcd91 100644 --- a/xCAT-web/js_xcat/ui.js +++ b/xCAT-web/js_xcat/ui.js @@ -89,12 +89,12 @@ XCATui.toggleSection = function(nodeGroupName) { if(!tableObj.style.display || tableObj.style.display == 'inline') { // the inner table is currently visible tableObj.style.display = 'none'; - imageTag.src = "./images/plus-sign.gif"; + imageTag.src = "../images/plus-sign.gif"; expandSpanObj.title = "Click to expand section"; } else { // the inner table is currently invisible tableObj.style.display = 'inline'; - imageTag.src = "./images/minus-sign.gif"; + imageTag.src = "../images/minus-sign.gif"; expandSpanObj.title = "Click to collapse section"; } @@ -109,7 +109,7 @@ XCATui.getFailureSpanHTML = function(nodeGroupName) { XCATui.getLoadingSpanHTML = function(nodeGroupName) { var spanId = "nodegroup_" + nodeGroupName + "_loading"; - var html = ''; + var html = ''; return html; } @@ -150,24 +150,24 @@ XCATui.updateNodeList = function(nodeGroupName) { var imageId = tableId + '-im'; var expandSpanId = "img_gr_" + nodeGroupName; - var tableObj = $(tableId); + var tableObj = document.getElementById(tableId); //$(tableId); if(null == tableObj) { alert('Error: section ' + tableId + ' not found.'); return false; } - var imageTag = $(imageId); - var expandSpanObj = $(expandSpanId); + var imageTag = document.getElementById(imageId); //$(imageId); + var expandSpanObj = document.getElementById(expandSpanId); //$(expandSpanId); if(!tableObj.style.display || tableObj.style.display == 'inline') {// currently visible tableObj.style.display = 'none'; - imageTag.src = "./images/plus-sign.gif"; + imageTag.src = "../images/plus-sign.gif"; expandSpanObj.title = "Click to expand section"; } else { //currently invisible - imageTag.src = "./images/minus-sign.gif"; + imageTag.src = "../images/minus-sign.gif"; expandSpanObj.title = "Click to collapse section"; var target = "div_" + nodeGroupName; @@ -178,6 +178,7 @@ XCATui.updateNodeList = function(nodeGroupName) { //var URL = "webservice.php?method=getXCATNodeRows&nodeGroupName=" + encodeURIComponent(nodeGroupName); + alert('About to call Ajax.Updater'); new Ajax.Updater(target, URL, { method: 'post', parameters: pars, onCreate: function() { XCATui.updateNodeListLoading(nodeGroupName) }, // Needs Prototype 1.5.1 @@ -187,6 +188,7 @@ XCATui.updateNodeList = function(nodeGroupName) { // the inner table is currently invisible tableObj.style.display = 'inline'; + alert('Back from Ajax.Updater'); } diff --git a/xCAT-web/lib/GroupNodeTable.class.php b/xCAT-web/lib/GroupNodeTable.class.php index 1dfcc8f00..f396b0c04 100644 --- a/xCAT-web/lib/GroupNodeTable.class.php +++ b/xCAT-web/lib/GroupNodeTable.class.php @@ -2,7 +2,8 @@ /** * Produces HTML for use in the interface. */ -//require_once("config.php"); +if (!$TOPDIR) { $TOPDIR = '..'; } +require_once "$TOPDIR/lib/functions.php"; class GroupNodeTable { diff --git a/xCAT-web/lib/XCAT/XCATCommand/XCATCommandRunner.class.php b/xCAT-web/lib/XCAT/XCATCommand/XCATCommandRunner.class.php index 7b699d6f2..300132092 100644 --- a/xCAT-web/lib/XCAT/XCATCommand/XCATCommandRunner.class.php +++ b/xCAT-web/lib/XCAT/XCATCommand/XCATCommandRunner.class.php @@ -14,7 +14,7 @@ class XCATCommandRunner { function XCATCommandRunner() { $this->XCATRoot = ''; //'/opt/xcat/bin'; //todo: get rid of these $this->CurrDir = ''; //'/opt/xcat/web'; - $this->Sudo = '\bin\sudo '; + $this->Sudo = '/bin/sudo '; $this->XCATNodeManager = &XCATNodeManager::getInstance(); $this->XCATNodeGroupManager = &XCATNodeGroupManager::getInstance(); @@ -44,7 +44,7 @@ class XCATCommandRunner { * @return An array containing the name of all nodes in the group. */ function getNodeNamesByGroupName($groupName) { - $cmdString = $this->Sudo . $this->XCATRoot . "/nodels $groupName"; + $cmdString = $this->Sudo . "nodels $groupName"; $outputStat = $this->runCommand($cmdString); return $outputStat["output"]; @@ -55,7 +55,7 @@ class XCATCommandRunner { */ function getXCATNodeByName($nodeName) { - $cmdString = $this->Sudo . $this->XCATRoot . "/nodestat $nodeName"; + $cmdString = $this->Sudo . "nodestat $nodeName"; $outputStat = $this->runCommand($cmdString); $xcn = new XCATNode(); @@ -98,7 +98,7 @@ class XCATCommandRunner { * @return An array containing the name of every node group. */ function getAllGroupNames() { - $cmdString = $this->Sudo . $this->XCATRoot . "/listattr"; + $cmdString = $this->Sudo . "listattr"; $outputStat = $this->runCommand($cmdString); return $outputStat["output"]; diff --git a/xCAT-web/lib/XCAT/webservice/XCATWebservice.class.php b/xCAT-web/lib/XCAT/webservice/XCATWebservice.class.php deleted file mode 100644 index 619ff7cbe..000000000 --- a/xCAT-web/lib/XCAT/webservice/XCATWebservice.class.php +++ /dev/null @@ -1,55 +0,0 @@ - \ No newline at end of file diff --git a/xCAT-web/machines/groups.php b/xCAT-web/machines/groups.php index cd3967222..e4bd41d62 100644 --- a/xCAT-web/machines/groups.php +++ b/xCAT-web/machines/groups.php @@ -9,7 +9,7 @@ if (isAIX()) { $aixDisabled = 'disabled'; } require_once("$TOPDIR/lib/GroupNodeTable.class.php"); require_once("$TOPDIR/lib/XCAT/XCATCommand/XCATCommandRunner.class.php"); -insertHeader('Groups', array('groups.css'), NULL, array('machines','groups')); +insertHeader('Groups', array('groups.css'), array("$TOPDIR/js_xcat/ui.js","$TOPDIR/js/prototype.js"), array('machines','groups')); echo "
\n"; diff --git a/xCAT-web/nodes_by_group.php b/xCAT-web/machines/nodes_by_group.php similarity index 62% rename from xCAT-web/nodes_by_group.php rename to xCAT-web/machines/nodes_by_group.php index 6a84fc120..0df303f0c 100644 --- a/xCAT-web/nodes_by_group.php +++ b/xCAT-web/machines/nodes_by_group.php @@ -1,6 +1,7 @@ getAllXCATNodeGroups(); -echo "$var."; -print_r($var); -?> diff --git a/xCAT-web/webservice.php b/xCAT-web/webservice.php deleted file mode 100644 index bffa7a6ca..000000000 --- a/xCAT-web/webservice.php +++ /dev/null @@ -1,18 +0,0 @@ -