Skip to content
5 changes: 5 additions & 0 deletions cabinets.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
$cab->CabRowID=$_POST['cabrowid'];
$cab->CabinetHeight=$_POST['cabinetheight'];
$cab->Model=$_POST['model'];
$cab->SerialNo=isset($_POST['serialno'])?$_POST['serialno']:'';
$cab->Keylock=$_POST['keylock'];
$cab->MaxKW=$_POST['maxkw'];
$cab->MaxWeight=$_POST['maxweight'];
Expand Down Expand Up @@ -315,6 +316,10 @@
<div>',__("Model"),'</div>
<div><input type="text" name="model" size=30 maxlength=80 value="',$cab->Model,'"></div>
</div>
<div>
<div>',__("Cabinet Serial Number"),'</div>
<div><input type="text" name="serialno" size=30 maxlength=30 value="',$cab->SerialNo,'"></div>
</div>
<div>
<div>',__("Key/Lock Information"),'</div>
<div><input type="text" name="keylock" size=30 maxlength=30 value="',$cab->Keylock,'"></div>
Expand Down
1 change: 1 addition & 0 deletions cabnavigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function renderCabinetProps($cab, $audit, $AuditorName){
$renderedHTML="\t\t<table id=\"cabprop\">
\t\t<tr><td>".__("Last Audit").":</td><td id=\"lastaudit\">$audit->AuditStamp$AuditorName</td></tr>
\t\t<tr><td>".__("Model").":</td><td>$cab->Model</td></tr>
\t\t<tr><td>".__("SerialNo").":</td><td>$cab->SerialNo</td></tr>
\t\t<tr><td>".__("Data Center").":</td><td>$tmpDC->Name</td></tr>
\t\t<tr><td>".__("Install Date").":</td><td>$cab->InstallationDate</td></tr>\n";

Expand Down
7 changes: 5 additions & 2 deletions classes/Cabinet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Cabinet {
var $CabRowID; //JMGA: Row of this cabinet
var $CabinetHeight;
var $Model;
var $SerialNo;
var $Keylock;
var $MaxKW;
var $MaxWeight;
Expand All @@ -62,6 +63,7 @@ function MakeSafe() {
$this->CabRowID=intval($this->CabRowID);
$this->CabinetHeight=intval($this->CabinetHeight);
$this->Model=sanitize($this->Model);
$this->SerialNo=sanitize($this->SerialNo);
$this->Keylock=sanitize($this->Keylock);
$this->MaxKW=float_sqlsafe(floatval($this->MaxKW));
$this->MaxWeight=intval($this->MaxWeight);
Expand Down Expand Up @@ -97,6 +99,7 @@ static function RowToObject($dbRow,$filterrights=true){
$cab->CabRowID=$dbRow["CabRowID"];
$cab->CabinetHeight=$dbRow["CabinetHeight"];
$cab->Model=$dbRow["Model"];
$cab->SerialNo=$dbRow["SerialNo"];
$cab->Keylock=$dbRow["Keylock"];
$cab->MaxKW=$dbRow["MaxKW"];
$cab->MaxWeight=$dbRow["MaxWeight"];
Expand Down Expand Up @@ -188,7 +191,7 @@ function CreateCabinet($deferTreeRebuild=false){
$sql="INSERT INTO fac_Cabinet SET DataCenterID=$this->DataCenterID,
Location=\"$this->Location\", LocationSortable=\"$this->LocationSortable\",
AssignedTo=$this->AssignedTo, ZoneID=$this->ZoneID, CabRowID=$this->CabRowID,
CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\",
CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", SerialNo=\"$this->SerialNo\",
Keylock=\"$this->Keylock\", MaxKW=$this->MaxKW, MaxWeight=$this->MaxWeight,
InstallationDate=\"".date("Y-m-d", strtotime($this->InstallationDate))."\",
MapX1=$this->MapX1, MapY1=$this->MapY1,
Expand Down Expand Up @@ -225,7 +228,7 @@ function UpdateCabinet(){
$sql="UPDATE fac_Cabinet SET DataCenterID=$this->DataCenterID,
Location=\"$this->Location\", LocationSortable=\"$this->LocationSortable\",
AssignedTo=$this->AssignedTo, ZoneID=$this->ZoneID, CabRowID=$this->CabRowID,
CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\",
CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", SerialNo=\"$this->SerialNo\",
Keylock=\"$this->Keylock\", MaxKW=$this->MaxKW, MaxWeight=$this->MaxWeight,
InstallationDate=\"".date("Y-m-d", strtotime($this->InstallationDate))."\",
MapX1=$this->MapX1, MapY1=$this->MapY1,
Expand Down
1 change: 1 addition & 0 deletions create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CREATE TABLE fac_Cabinet (
CabRowID int(11) NOT NULL,
CabinetHeight int(11) NOT NULL,
Model varchar(80) NOT NULL,
SerialNo varchar(30) NOT NULL,
Keylock varchar(30) NOT NULL,
MaxKW float(11) NOT NULL,
MaxWeight int(11) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion custom_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@ function newtab(searchlink){
</div><!-- END div.main -->
</div><!-- END div.page -->
</body>
</html>
</html>
8 changes: 7 additions & 1 deletion db-23.04-to-25.01.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
--- Schema changes for 23.04 to 25.01
---

--
-- Schema changes for 23.04 to 25.01
-- Table structure for table `fac_Cabinet`
--
-- Add SerialNo column to fac_Cabinet after Model
ALTER TABLE fac_Cabinet ADD COLUMN SerialNo VARCHAR(30) AFTER Model;

--
-- Table structure for table `fac_MediaConnectors`
Expand Down
4 changes: 4 additions & 0 deletions scripts/ajax_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
$field="Owner";
}elseif(isset($_REQUEST["notes"])){
$field="Notes";
}elseif(isset($_REQUEST["cabserial"])){
$field="CabinetSerial";
}elseif(isset($_REQUEST["ip"])){
$field="PrimaryIP";
}else{
Expand Down Expand Up @@ -65,6 +67,8 @@
$sql="SELECT DISTINCT Value FROM fac_DeviceCustomValue WHERE
AttributeID=$custom AND Value LIKE '%$searchTerm%' AND Value !='' ORDER BY
Value ASC;";
}elseif($field=="CabinetSerial"){
$sql="SELECT DISTINCT SerialNo FROM fac_Cabinet WHERE SerialNo LIKE '%$searchTerm%' ORDER BY SerialNo ASC LIMIT 500;";
}else{
$sql="SELECT DISTINCT $field FROM fac_Device WHERE $field LIKE '%$searchTerm%' LIMIT 500;";
}
Expand Down
7 changes: 6 additions & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
$devList=$dev->SearchDevicebyAssetTag();
$resultcount=count($devList);
$title=__("Asset tag search results for")." &quot;$searchTerm&quot;";
}elseif($searchKey=='cabserial'){
$cab->SerialNo=$searchTerm;
$cabList=$cab->Search(true,true);
$resultcount=count($cabList);
$title=__("Cabinet Serial Number search results for")." &quot;$searchTerm&quot;";
}elseif($searchKey=="ctag"){
// TODO: this could be enhanced to allow searching for a specific custom attribute
$devList=$dev->SearchByCustomTag($searchTerm);
Expand Down Expand Up @@ -413,7 +418,7 @@ function formatTime(time) {
hundredths = pad(time - (sec * 100) - (min * 6000), 2);
return pad(sec, 2);
}
var msg=$('<p>').append('<?php printf(__("Only one result, will autoforward in %s seconds."),'<span id="countdown"></span>'); ?>').click(function(){timer.stop();$(this).remove();})
var msg=$('<p>').append('<?php printf(__("Only one result; auto-forwarding in %s seconds. Click here to cancel the countdown."),'<span id="countdown"></span>'); ?>').click(function(){timer.stop();$(this).remove();})
$('#resultcount').parent('p').append(msg);
var currentTime=500,
incrementTime=100,
Expand Down
21 changes: 11 additions & 10 deletions sidebar.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
<br>
<label for="searchadv">',__("Advanced Search:"),'</label><br>
<input class="search" id="searchadv" name="search"><button class="iebug" type="submit"><img src="css/searchbutton.png" alt="search"></button>
<select name="key">
<option value="label">',__("Label"),'</option>
<option value="ctag">',__("Custom Tag"),'</option>
<option value="serial">',__("Serial Number"),'</option>
<option value="asset">',__("Asset Tag"),'</option>
<option value="owner">',__("Owner"),'</option>
<option value="project">',__("Project"),'</option>
<option value="model">',__("Device Model"),'</option>
<option value="ip">',__("PrimaryIP"),'</option>
<option value="notes">',__("Notes"),'</option>';
<select name="key">
<option value="label">',__("Label"),'</option>
<option value="ctag">',__("Custom Tag"),'</option>
<option value="serial">',__("Serial Number"),'</option>
<option value="asset">',__("Asset Tag"),'</option>
<option value="owner">',__("Owner"),'</option>
<option value="project">',__("Project"),'</option>
<option value="model">',__("Device Model"),'</option>
<option value="ip">',__("PrimaryIP"),'</option>
<option value="notes">',__("Notes"),'</option>
<option value="cabserial">',__("Cabinet Serial Number"),'</option>';

foreach($attrList as $ca){
print "\t<option value=\"$ca->Label\">CustomAttr: $ca->Label</option>\n";
Expand Down