Location: PHPKode > projects > OpenDataCenter Network Management System > include/mainview_page/patch_panel/view.php
<?php
// ----------------------------------------------------------------------
// Copyright (C) 2007 by GREGORY LE BRAS
// ----------------------------------------------------------------------
// LICENSE
//
// This file is part of ODCNMS - Open DataCenter Network Management System
// 
// ODCNMS is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// Foobar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Foobar; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
// ----------------------------------------------------------------------
// Original Author of file: GREGORY LE BRAS - http://www.odcnms.org/
// ----------------------------------------------------------------------
?>
<?php
$request=mysql_query("SELECT * FROM $name_table_patch_panel WHERE id=\"$id\"") or die ("ERROR!");

while($tmp_request=mysql_fetch_array($request))
{
$patch_panel_name = $tmp_request['name'];
?>
<table class="subtitle" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="80%"><h4><img src="images/patch_panel.gif" alt="patch_panel" align="top"> <?php echo $tmp_request['name']; ?></h4></td>
		<td width="10%" style="text-align:right">[ <a href="index.php?include=mainview&page=patch_panel&action=edit&id=<?php echo $id; ?>"><?php echo TXT_EDIT; ?></a> ]</td>
		<td width="10%" style="text-align:right">[ <a href="index.php?include=mainview&page=patch_panel&action=delete&id=<?php echo $id; ?>"><?php echo TXT_DELETE; ?></a> ]</td>
	</tr>
</table>
<table class="list" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="100%" style="font-weight:normal;"><b><?php echo TXT_RACK; ?> :</b> <?php
		
		$request2=mysql_query("SELECT name,id FROM $name_table_rack WHERE id=\"$tmp_request[rack_id]\"") or die ("ERROR!");

		while($tmp_request2=mysql_fetch_array($request2))
		{
			echo "<a href=\"index.php?include=mainview&page=rack&action=view&id=$tmp_request2[id]\">$tmp_request2[name]</a>";
		}
		?>
		</td>
	</tr>
	<tr class="list_title">
		<td width="100%" style="font-weight:normal;"><b><?php echo TXT_PORT_DENSITY; ?> :</b> <?php echo $tmp_request['port_density']; ?> <?php echo TXT_PORTS; ?></td>
	</tr>
	<tr class="list_title">
		<td width="100%" style="font-weight:normal;"><b><?php echo TXT_HEIGHT; ?> :</b> <?php echo $tmp_request['height']; ?> U</td>
	</tr>
	<tr class="list_title">
		<td width="100%" style="font-weight:normal;"><b><?php echo TXT_DESCRIPTION; ?> :</b> <?php echo $tmp_request['description']; ?></td>
	</tr>
</table>
<table class="subtitle" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="100%"><h4><img src="images/patch_panel.gif" alt="Patch Panel" align="top"> <?php echo TXT_PATCH_PANEL; ?> <?php echo TXT_VIEW; ?></h4></td>
	<tr>
</table>
<div id="ajaxcontentarea"></div>
<div id="rack_view">
	<div class="rack" style="border:0px; padding: 0px; width:531px;">
<?php
	$request3=mysql_query("SELECT * FROM $name_table_patch_panel WHERE id=\"$id\" ORDER BY id ASC") or die ("ERROR!");

	while($tmp_request3=mysql_fetch_array($request3))
	{
		switch($tmp_request3['height'])
		{
			case '1':
				echo "<div class=\"patch_panel\" style=\"height:40px\"><h4><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=patch_panel&id=$tmp_request3[id]','ajaxcontentarea');\">$tmp_request3[name] ($tmp_request3[height] U)</a></h4>";
			break;
			
			case '2':
				echo "<div class=\"patch_panel\" style=\"height:80px\"><h4><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=patch_panel&id=$tmp_request3[id]','ajaxcontentarea');\">$tmp_request3[name] ($tmp_request3[height] U)</a></h4>";
			break;
			
			case '3':
				echo "<div class=\"patch_panel\" style=\"height:120px\"><h4><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=patch_panel&id=$tmp_request3[id]','ajaxcontentarea');\">$tmp_request3[name] ($tmp_request3[height] U)</a></h4>";
			break;

			case '4':
				echo "<div class=\"patch_panel\" style=\"height:160px\"><h4><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=patch_panel&id=$tmp_request3[id]','ajaxcontentarea');\">$tmp_request3[name] ($tmp_request3[height] U)</a></h4>";
			break;

      default:
        $other_height=$tmp_request3['height']*40;
				echo "<div class=\"patch_panel\" style=\"height:".$other_height."px\"><h4><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=patch_panel&id=$tmp_request3[id]','ajaxcontentarea');\">$tmp_request3[name] ($tmp_request3[height] U)</a></h4>";      
      break;
		
		}
		
		$request4=mysql_query("SELECT * FROM $name_table_port WHERE patch_panel_id=\"$tmp_request3[id]\" ORDER BY id ASC") or die ("ERROR!");

		while($tmp_request4=mysql_fetch_array($request4))
		{
			$requestcount=mysql_query("SELECT count(*) FROM $name_table_link_port_port WHERE (port_id=$tmp_request4[id] OR port2_id=$tmp_request4[id])") or die ("ERROR!");
			$count_port = mysql_fetch_array($requestcount);	
			
			$requestcount_port_interface=mysql_query("SELECT count(*) FROM $name_table_link_port_interface WHERE port_id=$tmp_request4[id]") or die ("ERROR!");
			$count_port_interface = mysql_fetch_array($requestcount_port_interface);				
			
			if (($count_port[0] > 0) || ($count_port_interface[0] > 0))
			{
				echo "<div class=\"port_linked\"><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=port&id=$tmp_request4[id]','ajaxcontentarea');\">$tmp_request4[name]</a></div>";			
			}
			else if (($count_port[0]==0)  || ($count_port_interface[0] == 0))
			{
				echo "<div class=\"port\"><a href=\"#\" onclick=\"javascript:urlredirectdiv('ajax_view.php?what=port&id=$tmp_request4[id]','ajaxcontentarea');\">$tmp_request4[name]</a></div>";
			}
		}
	}
	
?>		
		
	</div>
</div>
<br><center><a href="javascript:history.go(-1);"><?php echo TXT_BACK; ?></a></center>
<?php
}
?>
Return current item: OpenDataCenter Network Management System