Skip to content

Commit

Permalink
Add OutletStatusOID and OutleStatusOn to CDU Template
Browse files Browse the repository at this point in the history
  • Loading branch information
timlegge committed Oct 31, 2019
1 parent 13b8cd1 commit ec16425
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cdu_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
$template->SNMPVersion = $_REQUEST['snmpversion'];
$template->VersionOID = $_REQUEST['versionoid'];
$template->OutletDescOID = $_REQUEST['outletdescoid'];
$template->OutletStatusOID = $_REQUEST['outletstatusoid'];
$template->OutletStatusOn = $_REQUEST['outletstatuson'];
$template->Multiplier = $_REQUEST['multiplier'];
$template->OID1 = $_REQUEST['oid1'];
$template->OID2 = $_REQUEST['oid2'];
Expand Down Expand Up @@ -142,6 +144,14 @@
<div><label for="outletdescoid">',__("Power Connections")." ".__("OID"),'</label></div>
<div><input type="text" name="outletdescoid" id="outletdescoid" value="',$template->OutletDescOID,'" size=40></div>
</div>
<div>
<div><label for="outletstatusoid">',__("Outlet Status")." ".__("OID"),'</label></div>
<div><input type="text" name="outletstatusoid" id="outletstatusoid" value="',$template->OutletStatusOID,'" size=40></div>
</div>
<div>
<div><label for="outletstatuson">',__("Outlet Status On State"),'</label></div>
<div><input type="text" name="outletstatuson" id="outletstatuson" value="',$template->OutletStatusOn,'" size=40></div>
</div>
<div>
<div><label for="multiplier">',__("Multiplier"),'</label></div>
<div><select name="multiplier" id="multiplier">';
Expand Down
12 changes: 12 additions & 0 deletions classes/CDUTemplate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class CDUTemplate {
var $ATS;
var $VersionOID;
var $OutletDescOID;
var $OutletStatusOID;
var $OutletStatusOn;
var $Multiplier;
var $OID1;
var $OID2;
Expand All @@ -54,6 +56,8 @@ function MakeSafe(){
$this->ATS=intval($this->ATS);
$this->VersionOID=sanitize($this->VersionOID);
$this->OutletDescOID=sanitize($this->OutletDescOID);
$this->OutletStatusOID=sanitize($this->OutletStatusOID);
$this->OutletStatusOn=sanitize($this->OutletStatusOn);
$this->Multiplier=(in_array($this->Multiplier, $validMultipliers))?$this->Multiplier:1;
$this->OID1=sanitize($this->OID1);
$this->OID2=sanitize($this->OID2);
Expand All @@ -70,6 +74,8 @@ function MakeDisplay(){
$this->Model=stripslashes($this->Model);
$this->VersionOID=stripslashes($this->VersionOID);
$this->OutletDescOID=stripslashes($this->OutletDescOID);
$this->OutletStatusOID=stripslashes($this->OutletStatusOID);
$this->OutletStatusOn=stripslashes($this->OutletStatusOn);
$this->OID1=stripslashes($this->OID1);
$this->OID2=stripslashes($this->OID2);
$this->OID3=stripslashes($this->OID3);
Expand All @@ -86,6 +92,8 @@ static function RowToObject($row){
$template->ATS=$row["ATS"];
$template->VersionOID=$row["VersionOID"];
$template->OutletDescOID=$row["OutletDescOID"];
$template->OutletStatusOID=$row["OutletStatusOID"];
$template->OutletStatusOn=$row["OutletStatusOn"];
$template->Multiplier=$row["Multiplier"];
$template->OID1=$row["OID1"];
$template->OID2=$row["OID2"];
Expand Down Expand Up @@ -143,6 +151,8 @@ function CreateTemplate($templateid) {
Model=\"$this->Model\", Managed=$this->Managed, ATS=$this->ATS,
VersionOID=\"$this->VersionOID\",
OutletDescOID=\"$this->OutletDescOID\",
OutletStatusOID=\"$this->OutletStatusOID\",
OutletStatusOn=\"$this->OutletStatusOn\",
Multiplier=\"$this->Multiplier\", OID1=\"$this->OID1\", OID2=\"$this->OID2\",
OID3=\"$this->OID3\", ATSStatusOID=\"$this->ATSStatusOID\", ATSDesiredResult=\"$this->ATSDesiredResult\",
ProcessingProfile=\"$this->ProcessingProfile\",
Expand Down Expand Up @@ -170,6 +180,8 @@ function UpdateTemplate() {
Model=\"$this->Model\", Managed=$this->Managed, ATS=$this->ATS,
VersionOID=\"$this->VersionOID\",
OutletDescOID=\"$this->OutletDescOID\",
OutletStatusOID=\"$this->OutletStatusOID\",
OutletStatusOn=\"$this->OutletStatusOn\",
Multiplier=\"$this->Multiplier\", OID1=\"$this->OID1\", OID2=\"$this->OID2\",
OID3=\"$this->OID3\", ATSStatusOID=\"$this->ATSStatusOID\", ATSDesiredResult=\"$this->ATSDesiredResult\",
ProcessingProfile=\"$this->ProcessingProfile\",
Expand Down
2 changes: 2 additions & 0 deletions create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ CREATE TABLE fac_CDUTemplate (
SNMPVersion varchar(2) NOT NULL DEFAULT '2c',
VersionOID varchar(80) NOT NULL,
OutletDescOID varchar(80) NOT NULL,
OutletStatusOID varchar(80) NOT NULL,
OutletStatusOn varchar(80) NOT NULL,
Multiplier varchar(6) NULL DEFAULT NULL,
OID1 varchar(80) NOT NULL,
OID2 varchar(80) NOT NULL,
Expand Down
2 changes: 2 additions & 0 deletions db-19.01-to-19.02.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ INSERT into fac_Config set Parameter='LDAPPhone3', Value='', UnitOfMeasure='stri
--

alter table fac_CDUTemplate add column OutletDescOID varchar(80) NOT NULL after VersionOID;
alter table fac_CDUTemplate add column OutletStatusOID varchar(80) NOT NULL after OutletDescOID;
alter table fac_CDUTemplate add column OutletStatusOn varchar(80) NOT NULL after OutletStatusOID;

--
-- New parameter for Changing cabinet labels from cabinet name to user preference based label
Expand Down
10 changes: 10 additions & 0 deletions device_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ function updatecdu($template,$status){
$cdutemplate->ATS=isset($_POST['ATS'])?1:0;
$cdutemplate->VersionOID=$_POST['VersionOID'];
$cdutemplate->OutletDescOID=$_POST['OutletDescOID'];
$cdutemplate->OutletStatusOID=$_POST['OutletStatusOID'];
$cdutemplate->OutletStatusOn=$_POST['OutletStatusOn'];
$cdutemplate->Multiplier=$_POST['Multiplier'];
$cdutemplate->OID1=$_POST['OID1'];
$cdutemplate->OID2=$_POST['OID2'];
Expand Down Expand Up @@ -987,6 +989,14 @@ function applynames(inputs,portnames,e){
<div><label for="OutletDescOID">',__("Power Connections")." ".__("OID"),'</label></div>
<div><input type="text" name="OutletDescOID" id="OutletDescOID" size=40></div>
</div>
<div>
<div><label for="OutletStatusOID">',__("Outlet State")." ".__("OID"),'</label></div>
<div><input type="text" name="OutletStatusOID" id="OutletStatusOID" size=40></div>
</div>
<div>
<div><label for="OutletStatusOn">',__("Outlet Status On State"),'</label></div>
<div><input type="text" name="OutletStatusOn" id="OutletStatusOn" size=40></div>
</div>
<div>
<div><label for="Multiplier">',__("Multiplier"),'</label></div>
<div><select name="Multiplier" id="Multiplier">';
Expand Down

0 comments on commit ec16425

Please sign in to comment.