New PSU    '; print 'Back to search    '; ?> Log Off

ERROR - Couldn't execute location query"); $idarray = array(); $locarray = array(); if(pg_num_rows($locres) != 0){ while ($locrow = pg_fetch_array($locres)){ extract($locrow); $idarray[] = $loc_id; $locarray[] = $name; } } else die ("
ERROR: cannot get the list of current locations."); print "

Low Voltage:

"; print "Insert a new Wiener PSU into table psu of gateDB (use 'NULL' for empty record):"; $WienerPars = array('serial','bin','location','type','status','mac_addr','firmware'); $NumPars = sizeof($WienerPars); echo '

'; echo Array_to_HTML_Table($WienerPars,$NumPars); print ''; $cell_serial = ''; $cell_bin = ''; $cell_loc = ''; $cell_type = ''; $cell_status = ''; $cell_mac = ''; $cell_firmw = ''; $WienerVals = array($cell_serial,$cell_bin,$cell_loc,$cell_type,$cell_status,$cell_mac,$cell_firmw); echo Array_to_HTML_Table($WienerVals,$NumPars); echo '
'; // close table print '
'; print ''; print "
INSTRUCTIONS: "; print "

High Voltage:

"; print "Insert a new ISEG PSU into table psuhv of gateDB (use 'NULL' for empty record):"; $IsegPars = array('serial','sm','location','type','channels','status','firmware'); $NumPars = sizeof($IsegPars); echo '

'; echo Array_to_HTML_Table($IsegPars,$NumPars); print ''; $cell_serial = ''; $cell_sm = ''; $cell_loc = ''; $cell_type = ''; $cell_chann = ''; $cell_status = ''; $cell_firmw = ''; $IsegVals = array($cell_serial,$cell_sm,$cell_loc,$cell_type,$cell_chann,$cell_status,$cell_firmw); echo Array_to_HTML_Table($IsegVals,$NumPars); echo '
'; // close table print '
'; print ''; print "
INSTRUCTIONS: "; } ?> ERROR: serial cannot be NULL!"; print "
Back"; exit; } $serial=$_POST['serial']; // process Wiener location: if (!$_POST['bin'] || !$_POST['loc']){ print "
ERROR: Please enter either a bin location OR a physical location! For the one not filled specify 'NULL'."; print "
Examples: bin='I28-33' and location='NULL' or bin='NULL' and location='10'"; print "
Back"; exit; } else if($_POST['bin']!='NULL' && $_POST['loc']!='NULL'){ print "
ERROR: a Wiener cannot be located in both a bin and at a physical location - one of them must be NULL!"; print "
Back"; exit; } else if($_POST['bin']!='NULL' && $_POST['loc']=='NULL'){ $rack_id=substr($_POST['bin'],0,3); $height=substr($_POST['bin'],4,2); $loc='NULL'; } else if($_POST['bin']=='NULL' && $_POST['loc']!='NULL'){ $rack_id='NULL'; $height='NULL'; $loc=$_POST['loc']; } // process the other attributes: if(!$_POST['status']) { print "
WARNING: Wiener status not entered! Default value 'LeakFixed' will be used."; $status='LeakFixed'; } else { $status=$_POST['status']; } if(!$_POST['type']) { print "
WARNING: Wiener type not entered! Default value 0 will be used."; $type='0'; } else { $type=$_POST['type']; } if(!$_POST['mac'] || $_POST['mac']=='NULL'){ print "
ERROR: Please enter MAC address! It cannot be NULL."; print "
Back"; exit; } $mac=$_POST['mac']; if(!$_POST['firmware']) { print "
ERROR: Please enter the firmware version! It can be NULL."; print "
Back"; exit; } $firmware=$_POST['firmware']; print "Inserting following new Wiener LV PSU:"; $InsertPars =array('serial','rack_id','height','location','status','type','mac_addr','firmware','person'); $NumPars = sizeof($InsertPars); echo '

'; echo Array_to_HTML_Table($InsertPars,$NumPars); $InsertVals = array($serial,$rack_id,$height,$loc,$status,$type,$mac,$firmware,$uini); echo Array_to_HTML_Table($InsertVals,$NumPars); echo '
'; // close table print "
If this is not what you intended, please go back and change it!"; print "
If it looks OK, commit it:"; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
    '; print '
'; } // new Wiener PSU (low voltage) ?> ERROR: PSU serial cannot be NULL!"; print "
Back"; exit; } $psuhv_id = $_POST['hvser']; if(!$_POST['hvsm'] || !$_POST['hvloc']){ print "
ERROR: Please enter either a sm location OR a physical location! For the one not filled specify 'NULL'."; print "
Back"; exit; } else if($_POST['hvsm']!='NULL' && $_POST['hvloc']!='NULL'){ print "
ERROR: a PSU cannot be located in both a sm and at a physical location - one of them must be NULL!"; print "
Back"; exit; } $sm_id = "NULL"; if(isset($_POST['hvsm']) && $_POST['hvsm']!='NULL'){ // query SM serial with this sector $sql = "SELECT sm_id FROM sm WHERE trd_pos=".$_POST['hvsm']; $smres = pg_query($sql) or die ("
ERROR: Cannot execute SM query:".$sql); if(pg_num_rows($smres) != 0){ $smrow = pg_fetch_array($smres); $sm_id = $smrow['sm_id']; } else die ("
ERROR: did not find the SM serial for sector ".$_POST['hvsm']); } $type=$_POST['hvtype']; $chann=$_POST['hvchann']; $loc_id=$_POST['hvloc']; $firmware=$_POST['hvfirmware']; $status=$_POST['hvstatus']; print "Inserting following new ISEG HV PSU:"; $InsertPars =array('serial','sm_id','location','type','channels','status','firmware','person'); $NumPars = sizeof($InsertPars); echo '

'; echo Array_to_HTML_Table($InsertPars,$NumPars); $InsertVals = array($psuhv_id,$sm_id,$loc_id,$type,$chann,$status,$firmware,$uini); echo Array_to_HTML_Table($InsertVals,$NumPars); echo '
'; // close table print "
If this is not what you intended, please go back and change it!"; print "
If it looks OK, commit it:"; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
    '; print '
'; } // new ISEG PSU (high voltage) ?>