From f8e063109e984a81740ac2c8869cc4e8538a868e Mon Sep 17 00:00:00 2001 From: wilpig Date: Thu, 19 Jul 2012 00:10:55 -0500 Subject: [PATCH] Added rack location picker to devices screen. Continuation of #11 --- css/inventory.php | 15 +++++++++++ devices.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++- rackrequest.php | 2 +- 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/css/inventory.php b/css/inventory.php index cea273363..8a47f5a04 100644 --- a/css/inventory.php +++ b/css/inventory.php @@ -16,6 +16,8 @@ select {padding: .05em;} fieldset table, table {border: 1px solid grey;} textarea {white-space: pre;word-wrap: break-word;} +.hide {display: none;} +.show {display: block;} [readonly],[disabled] { background-color: #dcdcdc; @@ -295,6 +297,19 @@ .device .table .table .table > div > div {padding: 3px;} .right .table + .table {margin-top: 1em;} +.positionselector {font-size: .7em; background-color: white;} +.positionselector > div > div > div {width: 1em; height: 1em; padding-left: .5em; padding-right: .5em; text-align: right;} +.positionselector > div > div + div > div {width: 3em; padding-right: 1em; padding-right: 1em;} +.notavail {background-color: black; border-color: black !important;} +/* borders were too thick looking */ +.positionselector > div > div > div{ border-top: 0px; border-left: 0px;} +.positionselector > div > div + div > div{ border-top: 0px; border-right: 0px;} +.positionselector > div { border-width: 1px;} +.positionselector, .positionselector > div > div {border-width: 0px;} +#positionselector .positionselector > div > div {min-width: 0;} +#positionselector {padding: 10px; position: absolute; left: -1000px; background-color: white; border: 1px solid black;} + + /* Button code primarily from http://somadesign.ca */ /* Button */ .button, input[type=button], input[type=submit], button { diff --git a/devices.php b/devices.php index bccfe0bc5..14bda4903 100644 --- a/devices.php +++ b/devices.php @@ -296,6 +296,68 @@ function swaplayout(){ setCookie("layout","Portrait"); } } +$(document).ready(function() { + $('#position').focus(function() { + var cab=$("select#cabinetid").val(); + $.get('scripts/ajax_cabinetuse.php?cabinet='+cab, function(data) { + var rackhtmlleft=''; + var rackhtmlright=''; + $.each(data, function(i,inuse){ + if(inuse){var cssclass='notavail'}else{var cssclass=''}; + rackhtmlleft+='
'+i+'
'; + rackhtmlright+='
'; + }); + var rackhtml='
'+rackhtmlleft+'
'+rackhtmlright+'
'; + $('#positionselector').html(rackhtml); + setTimeout(function(){ + var divwidth=$('.positionselector').width(); + $('#positionselector').width(divwidth); + $('#height').focus(function(){$('#positionselector').css({'left': '-1000px'});}); + $('#positionselector').css({'left':(($('.right').position().left)-(divwidth+20))}); + $('#positionselector').mouseleave(function(){ + $('#positionselector').css({'left': '-1000px'}); + }); + $('.positionselector > div > div + div > div').mouseover(function(){ + $('.positionselector > div > div + div > div').each(function(){ + $(this).removeAttr('style'); + }); + var unum=$("#height").val(); + if(unum>=1 && $(this).attr('class')!='notavail'){ + var test=''; + var background='green'; + // check each element start with pointer + for (var x=0; x} @@ -313,7 +375,7 @@ function setPreferredLayout() {Data Center Device Detail
-
+DeviceID";} ?>" method="POST">
Asset Tracking diff --git a/rackrequest.php b/rackrequest.php index 3e295f7ad..7815444a6 100644 --- a/rackrequest.php +++ b/rackrequest.php @@ -339,7 +339,7 @@ if($req->DeviceClass==$tempRow->TemplateID){$selected = 'selected';}else{$selected = '';} $mfg->ManufacturerID=$tempRow->ManufacturerID; $mfg->GetManufacturerByID($facDB); - print " \n"; } ?>