crams-commits Mailing List for Computer Rack & Asset Management System
Status: Pre-Alpha
Brought to you by:
cheezel
You can subscribe to this list here.
| 2009 |
Jan
(10) |
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
|
29
(6) |
30
|
31
|
|
|
|
|
|
From: Brian <ch...@us...> - 2009-03-29 12:38:18
|
Update of /cvsroot/crams/crams/db In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5142/db Modified Files: db_pgsql.php Log Message: - Improved existing SQL's - Started adding function to return the rack's configuration Index: db_pgsql.php =================================================================== RCS file: /cvsroot/crams/crams/db/db_pgsql.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** db_pgsql.php 16 Jan 2009 12:07:42 -0000 1.2 --- db_pgsql.php 29 Mar 2009 12:38:12 -0000 1.3 *************** *** 32,36 **** // Generate our SQL. ! $SQL = "SELECT id_data_centre as id, description FROM ".$CRAMS_DB_PREFIX."data_centre WHERE enabled=1"; // Retrieve the results. --- 32,36 ---- // Generate our SQL. ! $SQL = "SELECT id_data_centre as id, description FROM ".$CRAMS_DB_PREFIX."data_centre WHERE enabled=1 ORDER BY description"; // Retrieve the results. *************** *** 61,65 **** // Generate our SQL. ! $SQL = "SELECT id_rack as id, reference, description FROM ".$CRAMS_DB_PREFIX."rack WHERE enabled = 1 AND data_centre = ".$siteid; // Retrieve the results. --- 61,65 ---- // Generate our SQL. ! $SQL = "SELECT id_rack as id, reference, description FROM ".$CRAMS_DB_PREFIX."rack WHERE enabled = 1 AND data_centre = ".$siteid." ORDER BY reference"; // Retrieve the results. *************** *** 80,83 **** --- 80,111 ---- } + function db_Get_Rack_Config($rackid) + { + // Get a database handle to work with. + $dbh = db_Get_Handle(); + if (!$dbh) + { + return FALSE; + } + + // Generate our SQL. + $SQL = "SELECT id_rack as id, height, power FROM ".$CRAMS_DB_PREFIX."rack WHERE id_rack=".$rackid; + + // Retrieve the results. + $RESULT = pg_query($dbh, $SQL); + if (!$RESULT) + { + // Query failed. return failure. + return FALSE; + } + + $DATA = pg_fetch_array($RESULT); + + // Close the database handle. + db_Free_Handle($dbh); + + // Return the results. + return $DATA; + } ?> |
|
From: Brian <ch...@us...> - 2009-03-29 12:36:36
|
Update of /cvsroot/crams/crams In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5008 Modified Files: crams.css index.php rack.php Log Message: - Cleaned up code output to provide better adherance with W3C standards Index: index.php =================================================================== RCS file: /cvsroot/crams/crams/index.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.php 16 Jan 2009 12:07:42 -0000 1.3 --- index.php 29 Mar 2009 12:36:30 -0000 1.4 *************** *** 4,10 **** require_once("rack.php"); ! $GLOBALS['OUTPUT']="<html><head>\n"; $GLOBALS['OUTPUT'].="<link rel='stylesheet' href='crams.css' type='text/css' media='screen'>\n"; $GLOBALS['OUTPUT'].="<meta http-equiv='Content-Script-Type' content='text/javascript'>\n"; $GLOBALS['OUTPUT'].="<script src='js/rack.js'></script>\n"; $GLOBALS['OUTPUT'].="<title>$CRAMS_SYS_NAME Rack and Asset Management System</title></head><body>\n"; --- 4,12 ---- require_once("rack.php"); ! $GLOBALS['OUTPUT']="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\">\n"; ! $GLOBALS['OUTPUT'].="<html><head>\n"; $GLOBALS['OUTPUT'].="<link rel='stylesheet' href='crams.css' type='text/css' media='screen'>\n"; $GLOBALS['OUTPUT'].="<meta http-equiv='Content-Script-Type' content='text/javascript'>\n"; + $GLOBALS['OUTPUT'].="<meta name='Author' content='Brian Cheeseman'>\n"; $GLOBALS['OUTPUT'].="<script src='js/rack.js'></script>\n"; $GLOBALS['OUTPUT'].="<title>$CRAMS_SYS_NAME Rack and Asset Management System</title></head><body>\n"; *************** *** 31,35 **** // Allow for the rack selection drop down field. As we have no rack yet, we will not place any rack entries in it. ! $GLOBALS['OUTPUT'].=" Rack <select name='rackselect' id='rackselect'>\n"; $GLOBALS['OUTPUT'].="<option>Select Data Centre</option>\n"; $GLOBALS['OUTPUT'].="</select>\n"; --- 33,37 ---- // Allow for the rack selection drop down field. As we have no rack yet, we will not place any rack entries in it. ! $GLOBALS['OUTPUT'].=" Rack <select name='rackselect' id='rackselect' >\n"; $GLOBALS['OUTPUT'].="<option>Select Data Centre</option>\n"; $GLOBALS['OUTPUT'].="</select>\n"; *************** *** 45,48 **** --- 47,53 ---- $GLOBALS['OUTPUT'].=" <img src='images/valid_xhtml.png'> <img src='images/valid_css.png'></div>\n"; + /* Generate popup menu div holder */ + $GLOBALS['OUTPUT'].="<div id='pumenu'>Popup Menu</div>\n"; + /* Generate the host editing page */ Index: crams.css =================================================================== RCS file: /cvsroot/crams/crams/crams.css,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** crams.css 16 Jan 2009 12:07:42 -0000 1.3 --- crams.css 29 Mar 2009 12:36:30 -0000 1.4 *************** *** 1,18 **** - @CHARSET "ISO-8859-1"; - body { font-family: Sans-Serif; font-size: small; margin: 0.0em; } div#header { font-size: x-large; - width: 100%; text-align: center; background-color: #eeeeff; border-bottom: 1px solid #bbbbff; padding: 0.5em; - float: top; font-style: italic; } --- 1,15 ---- body { font-family: Sans-Serif; font-size: small; margin: 0.0em; + width: 100%; } div#header { font-size: x-large; text-align: center; background-color: #eeeeff; border-bottom: 1px solid #bbbbff; padding: 0.5em; font-style: italic; } *************** *** 32,36 **** padding: 0.3em; margin: 0.5em; - display: none; } --- 29,32 ---- *************** *** 42,46 **** border-top: 1px solid #bbbbff; margin-top: 0.5em; ! float: bottom; } --- 38,51 ---- border-top: 1px solid #bbbbff; margin-top: 0.5em; ! } ! ! div#pumenu { ! text-align: left; ! position: absolute; ! left: 0; ! top: 0; ! background-color: #eeeeff; ! border: 2px solid #3333ff; ! margin: 0.5em; } *************** *** 68,69 **** --- 73,99 ---- width: 4.8em; } + + div#pumenu div.pum { + padding: 0.3em; + } + + div#pumenu div.pum span.pumenu img { + border: none; + padding-right: 0.4em; + vertical-align: middle; + width: 24px; + height: 24px; + } + + div#pumenu div.pum:hover { + background-color: #bbbbff; + } + + div#pumenu div.pumhead { + border: none; + padding: 0.5em; + vertical-align: middle; + font-weight: bold; + background-color: #3333ff; + color: #ffffdd; + } Index: rack.php =================================================================== RCS file: /cvsroot/crams/crams/rack.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rack.php 15 Jan 2009 11:25:04 -0000 1.1 --- rack.php 29 Mar 2009 12:36:30 -0000 1.2 *************** *** 1,19 **** <?php ! function generateSingleRackHTML() { ! $GLOBALS['OUTPUT'].="<table class='racks'>\n"; ! $GLOBALS['OUTPUT'].="<tr><th>Front</th><th> </th><th>Rear</th></tr>"; ! $RUs = 48; for ($i = 0; $i < $RUs; $i++) { ! $GLOBALS['OUTPUT'].="<tr class='ru'>"; ! $GLOBALS['OUTPUT'].="<td class='ru' id='fru".($RUs-$i)."' "ruclick('fru".($RUs-$i)."')\">".($RUs-$i)."</td>"; ! $GLOBALS['OUTPUT'].="<td class='rb'> </td>"; ! $GLOBALS['OUTPUT'].="<td class='ru' id='rru".($RUs-$i)."' "ruclick('rru".($RUs-$i)."')\">".($RUs-$i)."</td></tr>\n"; } ! $GLOBALS['OUTPUT'] .= "</table>\n"; } --- 1,31 ---- <?php ! function generateSingleRackHTML($rackid, $showBack = 1) { ! $RACK=db_Get_Rack_Config($rackid); ! if (!$RACK) ! { ! return "<p>ERROR: Unable to load rack configuration.</p>"; ! } ! ! $RUs=$RACK['height']; ! $POWER=$RACK['power']; ! ! $OUT="<table class='racks'>\n"; ! $OUT.="<tr><th>Front</th><th> </th><th>Rear</th></tr>"; for ($i = 0; $i < $RUs; $i++) { ! $OUT.="<tr class='ru'>"; ! $OUT.="<td class='ru' id='f_".$rackid."_".($RUs-$i)."' "ruclick('f_".$rackid."_".($RUs-$i)."')\">".($RUs-$i)."</td>"; ! if ($showBack == 1) ! { ! $OUT.="<td class='rb'> </td>"; ! $OUT.="<td class='ru' id='r_".$rackid."_".($RUs-$i)."' "ruclick('r_".$rackid."_".($RUs-$i)."')\">".($RUs-$i)."</td></tr>\n"; ! } } ! $OUT .= "</table>\n"; ! return $OUT; } |
|
From: Brian <ch...@us...> - 2009-03-29 12:35:18
|
Update of /cvsroot/crams/crams/js In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4917/js Modified Files: rack.js Log Message: - Added initial code for popup menu - Cleaned up existing code Index: rack.js =================================================================== RCS file: /cvsroot/crams/crams/js/rack.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rack.js 16 Jan 2009 12:07:42 -0000 1.2 --- rack.js 29 Mar 2009 12:35:12 -0000 1.3 *************** *** 1,3 **** --- 1,73 ---- var xmlhttp + var mX + var mY + var ru + + document. + document. + + function onload(evt) + { + hidediv('pumenu') + hidediv('body') + } + + function mouseX(evt) + { + if (evt.pageX) + return evt.pageX; + else if (evt.clientX) + return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); + else return null; + } + + function mouseY(evt) + { + if (evt.pageY) + return evt.pageY; + else if (evt.clientY) + return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); + else return null; + } + + function mouseMove(evt) + { + mX = mouseX(evt) + mY = mouseY(evt) + } + + function showdiv(pass) + { + divs = document.getElementsByTagName('div'); + for(i=0;i<divs.length;i++) + { + if(divs[i].id.match(pass)) + { + if (document.getElementById) + divs[i].style.visibility="visible"; + else if (document.layers) + document.layers[divs[i]].display = 'visible'; + else + document.all.divs[i].visibility = 'visible'; + } + } + } + + function hidediv(pass) + { + var divs = document.getElementsByTagName('div'); + for(i=0;i<divs.length;i++) + { + if(divs[i].id.match(pass)) + { + if (document.getElementById) + divs[i].style.visibility="hidden"; + else if (!document.layers) + document.all.divs[i].visibility = 'hidden'; + else + document.layers[divs[i]].display = 'hidden'; + } + } + } function getXMLHTTP() *************** *** 14,27 **** } ! function ruclick(ru) { ! alert("You clicked on "+ru) ! return 1 } function siteChange() { site = document.getElementById('dcselect') siteid = site.options[site.selectedIndex].value getXMLHTTP() --- 84,139 ---- } ! function ruclick(rackunit) { ! hidediv('pumenu') ! ru = rackunit ! site = document.getElementById('dcselect') ! siteid = site.options[site.selectedIndex].value ! rack = document.getElementById('rackselect') ! rackid = rack.options[rack.selectedIndex].value ! document.getElementById('pumenu').innerHTML = '' ! ! getXMLHTTP() ! if (xmlhttp != null) ! { ! xmlhttp. ! xmlhttp.open("GET", "services/lookupracks.php?action=getpumenu&site="+siteid+"&rack="+rackid+"&ru="+ru, true) ! xmlhttp.send(null) ! } ! else ! { ! alert("Sorry, your browser is not supported by CRAMS."); ! } ! return true ! } ! ! function ruClickResponse() ! { ! pum = document.getElementById('pumenu') ! if (xmlhttp.readyState == 4) ! { // We have loaded. ! if (xmlhttp.status == 200) ! { // http 200 = OK. ! pum.innerHTML = xmlhttp.responseText ! } ! else ! { ! alert("Problem communicating with server. Please try again in a moment or two.\nError code: "+xmlhttp.status) ! return true ! } ! } ! ! pum.style.left = mX+"px" ! pum.style.top = mY+"px" ! showdiv('pumenu') ! return true } function siteChange() { + hidediv('pumenu') site = document.getElementById('dcselect') siteid = site.options[site.selectedIndex].value + document.getElementById('body').innerHTML = '' getXMLHTTP() *************** *** 37,41 **** } ! return 1 } --- 149,153 ---- } ! return true } *************** *** 56,72 **** } ! function state_Change() { ! if (xmlhttp.readyState==4) ! {// 4 = "loaded" ! if (xmlhttp.status==200) ! {// 200 = OK ! // ...our code here... } ! else { ! alert("Problem retrieving XML data"); } ! } } --- 168,211 ---- } ! function rackChange() { ! hidediv('pumenu') ! rack = document.getElementById('rackselect') ! rackid = rack.options[rack.selectedIndex].value ! ! getXMLHTTP() ! if (xmlhttp != null) ! { ! xmlhttp. ! xmlhttp.open("GET", "services/lookupracks.php?action=getrackcontent&rack="+rackid, true) ! xmlhttp.send(null) } ! else { ! alert("Sorry, your browser is not supported by CRAMS."); } ! ! return true } + function rackChangeResponse() + { + if (xmlhttp.readyState == 4) + { // We have loaded. + if (xmlhttp.status == 200) + { // http 200 = OK. + body = document.getElementById('body') + body.innerHTML = xmlhttp.responseText + showdiv('body') + } + else + { + alert("Problem communicating with server. Please try again in a moment or two.\nError code: "+xmlhttp.status) + } + } + } + + function popUpMenuClick(mode) + { + hidediv('pumenu') + } |
|
From: Brian <ch...@us...> - 2009-03-29 12:33:07
|
Update of /cvsroot/crams/crams/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4778 Added Files: popupmenu.php Log Message: - Added popup menu generation code --- NEW FILE: popupmenu.php --- <?php function pumGenerateEntry($icon, $text, $key) { return "<div class='pum'><span class='pumenu' "popUpMenuClick('$key')\"><img src='images/$icon')'>$text</span></div>"; } function pumGenerateHeader($title) { return "<div class='pumhead'>$title</div>"; } function pumGenerateMenu($title, $elements) { $menu = pumGenerateHeader($title); foreach ($elements as $e) { $menu .= pumGenerateEntry($e['icon'], $e['text'], $e['key']); } return $menu; } ?> |
|
From: Brian <ch...@us...> - 2009-03-29 12:31:31
|
Update of /cvsroot/crams/crams/images In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4652 Added Files: add.png del.png edit.png move.png Log Message: - Added images for the popup menu. --- NEW FILE: move.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: add.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: edit.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: del.png --- (This appears to be a binary file; contents omitted.) |
|
From: Brian <ch...@us...> - 2009-03-29 12:28:34
|
Update of /cvsroot/crams/crams/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4368/include Log Message: Directory /cvsroot/crams/crams/include added to the repository |