<?
function buildlist ($assetID, $uid, $read_only) {
global $rowStyle, $accountID, $spare, $SCRIPT_NAME, $sessionSecurity;
$strSQL = "SELECT * FROM peripherals as p, peripheral_types as pt WHERE p.fk_asset=$assetID
AND pt.peripheral_pk=p.peripheral_fk AND pt.accountID=$accountID ORDER BY description ASC";
$result = dbquery($strSQL);
echo "<br><b>Peripherals associated with this system:</b> ";
If ($sessionSecurity < 2) {
echo "(<A HREF='admin_peripherals.php?fk_asset=$assetID&uid=$uid'>Add New?</A>)\n";
}
?>
<p><table border='0' cellspacing='0' cellpadding='4' width='100%'>
<TR class='title'>
<TD><b>Description</b></TD>
<TD><b>Model</b></TD>
<TD><b>Serial Number</b></TD>
<TD><b>Ext?</b></TD>
<TD><b>Status</b></TD>
<TD><b>Action</b></TD>
<?
$iCount = 0;
$rowStyle = "";
While ($row = mysql_fetch_array($result)) {
$pk_peripheral = $row["pk_peripheral"];
$serial_num = $row["serial_num"];
$peripheral_fk = $row["peripheral_fk"];
$external = $row["external"];
$manufacturer = $row['manufacturer'];
$model = $row['model'];
$description = $row['description'];
$periphStatus = $row['peripheralStatus'];
// Display all the peripherals belonging to this server
?>
<TR class='<? echo alternateRowColor(); ?>'>
<TD><? echo $description; ?></TD>
<TD><? echo $model; ?></TD>
<TD><? echo writeNA($serial_num); ?></TD>
<TD><? echo $external; ?></TD>
<TD><? echo writeStatus($periphStatus);
If ((strpos($SCRIPT_NAME, "showfull.php") === false) OR ($sessionSecurity > 1)) {
echo " ";
} Else {
?>
(<a style='text-decoration: none' href='<?=$SCRIPT_NAME?>?spare=<?=$spare?>&hardwareID=<?=$assetID?>&peripheralID=<?=$pk_peripheral?>&setStatus=w'>W</a>
<a style='text-decoration: none' href='<?=$SCRIPT_NAME?>?spare=<?=$spare?>&hardwareID=<?=$assetID?>&peripheralID=<?=$pk_peripheral?>&setStatus=n'>N</a>
<a style='text-decoration: none' href='<?=$SCRIPT_NAME?>?spare=<?=$spare?>&hardwareID=<?=$assetID?>&peripheralID=<?=$pk_peripheral?>&setStatus=i'>I</a>)
<?
}
?>
</TD>
<TD>
<?
If ($sessionSecurity > 1) {
echo "N/A";
} Else {
?>
<A HREF="admin_peripherals.php?pk_peripheral=<?=$pk_peripheral;?>&uid=<?=$uid;?>">Edit</A>
<A HREF="move_peripheral.php?objectID=<?=$pk_peripheral;?>&fromSystem=<?=$assetID;?>&spare=<?=$spare?>">Move</A>
<?
If ($sessionSecurity < 1) {
?>
<A HREF="delete.php?peripheralID=<?=$pk_peripheral;?>" onClick="return warn_on_submit('Are you sure you want to delete this?');">Delete</A>
<?
}
}
echo "</TD>";
}
echo "</table>";
mysql_free_result($result);
$strSQL = "SELECT s.id, s.serial, st.Name, st.Maker, st.Version, st.canBeMoved FROM software as s,
software_types as st WHERE s.hardware_id=$assetID AND st.id=s.type_id AND st.accountID=$accountID
ORDER BY operatingSystem DESC, name ASC";
$result = dbquery($strSQL);
echo "<br><b>Software associated with this system:</b> ";
If ($sessionSecurity < 2) {
echo "(<A HREF='admin_software.php?hardware_id=$assetID&uid=$uid'>Add New?</A>)\n";
}
?>
<p><table border='0' cellpadding='4' cellspacing='0' width='100%'>
<TR class='title'><TD><b>Name</b></TD><TD><b>Manufacturer</b></TD><TD><b>Version</b></TD><TD><b>Serial Number</b></TD><TD><b>Action</b></TD></TR> <?
$iCount = 0;
$rowStyle = "";
while ($row = mysql_fetch_array($result)) {
$int_S_id = $row["id"];
$strSerial = $row["serial"];
$strName = $row['Name'];
$strMaker = $row['Maker'];
$strVersion = $row['Version'];
$bolMovable = $row['canBeMoved'];
?>
<TR class='<? echo alternateRowColor(); ?>'><TD><? echo $strName; ?></TD>
<TD><? echo $strMaker; ?></TD>
<TD><? echo $strVersion; ?></TD>
<TD><? echo writeNA($strSerial); ?></TD>
<TD>
<?
If ($sessionSecurity > 1) {
echo "N/A";
} Else {
?>
<A HREF="admin_software.php?software_id=<?=$int_S_id;?>&uid=<?=$uid;?>">Edit</A>
<?
If ($bolMovable == 1) {
?>
<A HREF="move_software.php?objectID=<?=$int_S_id;?>&fromSystem=<?=$assetID;?>&spare=<?=$spare?>">Move</A>
<?
}
If ($sessionSecurity < 1) {
?>
<A HREF="delete.php?softwareID=<?=$int_S_id;?>" onClick="return warn_on_submit('Are you sure you want to delete this?');">Delete</A>
<?
}
echo "</TD>";
}
}
echo "</table>";
}
?>