Location: PHPKode > projects > OpenDataCenter Network Management System > include/mainview_page/model/edit.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

$arrayifType[1] = "other";
$arrayifType[2] = "regular1822";
$arrayifType[3] = "hdh1822";
$arrayifType[4] = "ddnX25";
$arrayifType[5] = "rfc877x25";
$arrayifType[6] = "ethernetCsmacd";
$arrayifType[7] = "iso88023Csmacd";
$arrayifType[8] = "iso88024TokenBus";
$arrayifType[9] = "iso88025TokenRing";
$arrayifType[10] = "iso88026Man";
$arrayifType[11] = "starLan";
$arrayifType[12] = "proteon10Mbit";
$arrayifType[13] = "proteon80Mbit";
$arrayifType[14] = "hyperchannel";
$arrayifType[15] = "fddi";
$arrayifType[16] = "lapb";
$arrayifType[17] = "sdlc";
$arrayifType[18] = "ds1";
$arrayifType[19] = "e1";
$arrayifType[20] = "basicISDN";
$arrayifType[21] = "primaryISDN";
$arrayifType[22] = "propPointToPointSerial";
$arrayifType[23] = "ppp";
$arrayifType[24] = "softwareLoopback";
$arrayifType[25] = "eon";
$arrayifType[26] = "ethernet3Mbit";
$arrayifType[27] = "nsip";
$arrayifType[28] = "slip";
$arrayifType[29] = "ultra";
$arrayifType[30] = "ds3";
$arrayifType[31] = "sip";
$arrayifType[32] = "frameRelay";
$arrayifType[33] = "rs232";
$arrayifType[34] = "para";
$arrayifType[35] = "arcnet";
$arrayifType[36] = "arcnetPlus";
$arrayifType[37] = "atm";
$arrayifType[38] = "miox25";
$arrayifType[39] = "sonet";
$arrayifType[40] = "x25ple";
$arrayifType[41] = "iso88022llc";
$arrayifType[42] = "localTalk";
$arrayifType[43] = "smdsDxi";
$arrayifType[44] = "frameRelayService";
$arrayifType[45] = "v35";
$arrayifType[46] = "hssi";
$arrayifType[47] = "hippi";
$arrayifType[48] = "modem";
$arrayifType[49] = "aal5";
$arrayifType[50] = "sonetPath";
$arrayifType[51] = "sonetVT";
$arrayifType[52] = "smdsIcip";
$arrayifType[53] = "propVirtual";
$arrayifType[54] = "propMultiplexor";
$arrayifType[55] = "ieee80212";
$arrayifType[56] = "fibreChannel";
$arrayifType[57] = "hippiInterface";
$arrayifType[58] = "frameRelayInterconnect";
$arrayifType[59] = "aflane8023";
$arrayifType[60] = "aflane8025";
$arrayifType[61] = "cctEmul";
$arrayifType[62] = "fastEther";
$arrayifType[63] = "isdn";
$arrayifType[64] = "v11";
$arrayifType[65] = "v36";
$arrayifType[66] = "g703at64k";
$arrayifType[67] = "g703at2mb";
$arrayifType[68] = "qllc";
$arrayifType[69] = "fastEtherFX";
$arrayifType[70] = "channel";
$arrayifType[71] = "ieee80211";
$arrayifType[72] = "ibm370parChan";
$arrayifType[73] = "escon";
$arrayifType[74] = "dlsw";
$arrayifType[75] = "isdns";
$arrayifType[76] = "isdnu";
$arrayifType[77] = "lapd";
$arrayifType[78] = "ipSwitch";
$arrayifType[79] = "rsrb";
$arrayifType[80] = "atmLogical";
$arrayifType[81] = "ds0";
$arrayifType[82] = "ds0Bundle";
$arrayifType[83] = "bsc";
$arrayifType[84] = "async";
$arrayifType[85] = "cnr";
$arrayifType[86] = "iso88025Dtr";
$arrayifType[87] = "eplrs";
$arrayifType[88] = "arap";
$arrayifType[89] = "propCnls";
$arrayifType[90] = "hostPad";
$arrayifType[91] = "termPad";
$arrayifType[92] = "frameRelayMPI";
$arrayifType[93] = "x213";
$arrayifType[94] = "adsl";
$arrayifType[95] = "radsl";
$arrayifType[96] = "sdsl";
$arrayifType[97] = "vdsl";
$arrayifType[98] = "iso88025CRFPInt";
$arrayifType[99] = "myrinet";
$arrayifType[100] = "voiceEM";
$arrayifType[101] = "voiceFXO";
$arrayifType[102] = "voiceFXS";
$arrayifType[103] = "voiceEncap";
$arrayifType[104] = "voiceOverIp";
$arrayifType[105] = "atmDxi";
$arrayifType[106] = "atmFuni";
$arrayifType[107] = "atmIma";
$arrayifType[108] = "pppMultilinkBundle";
$arrayifType[109] = "ipOverCdlc";
$arrayifType[110] = "ipOverClaw";
$arrayifType[111] = "stackToStack";
$arrayifType[112] = "virtualIpAddress";
$arrayifType[113] = "mpc";
$arrayifType[114] = "ipOverAtm";
$arrayifType[115] = "iso88025Fiber";
$arrayifType[116] = "tdlc";
$arrayifType[117] = "gigabitEthernet";
$arrayifType[118] = "hdlc";
$arrayifType[119] = "lapf";
$arrayifType[120] = "v37";
$arrayifType[121] = "x25mlp";
$arrayifType[122] = "x25huntGroup";
$arrayifType[123] = "trasnpHdlc";
$arrayifType[124] = "interleave";
$arrayifType[125] = "fast";
$arrayifType[126] = "ip";
$arrayifType[127] = "docsCableMaclayer";
$arrayifType[128] = "docsCableDownstream";
$arrayifType[129] = "docsCableUpstream";
$arrayifType[130] = "a12MppSwitch";
$arrayifType[131] = "tunnel";
$arrayifType[132] = "coffee";
$arrayifType[133] = "ces";
$arrayifType[134] = "atmSubInterface";
$arrayifType[135] = "l2vlan";
$arrayifType[136] = "l3ipvlan";
$arrayifType[137] = "l3ipxvlan";
$arrayifType[138] = "digitalPowerline";
$arrayifType[139] = "mediaMailOverIp";
$arrayifType[140] = "dtm";
$arrayifType[141] = "dcn";
$arrayifType[142] = "ipForward";
$arrayifType[143] = "msdsl";
$arrayifType[144] = "ieee1394";
$arrayifType[145] = "if-gsn";
$arrayifType[146] = "dvbRccMacLayer";
$arrayifType[147] = "dvbRccDownstream";
$arrayifType[148] = "dvbRccUpstream";
$arrayifType[149] = "atmVirtual";
$arrayifType[150] = "mplsTunnel";
$arrayifType[151] = "srp";
$arrayifType[152] = "voiceOverAtm";
$arrayifType[153] = "voiceOverFrameRelay";
$arrayifType[154] = "idsl";
$arrayifType[155] = "compositeLink";
$arrayifType[156] = "ss7SigLink";
$arrayifType[157] = "propWirelessP2P";
$arrayifType[158] = "frForward";
$arrayifType[159] = "rfc1483";
$arrayifType[160] = "usb";
$arrayifType[161] = "ieee8023adLag";
$arrayifType[162] = "bgppolicyaccounting";
$arrayifType[163] = "frf16MfrBundle";
$arrayifType[164] = "h323Gatekeeper";
$arrayifType[165] = "h323Proxy";
$arrayifType[166] = "mpls";
$arrayifType[167] = "mfSigLink";
$arrayifType[168] = "hdsl2";
$arrayifType[169] = "shdsl";
$arrayifType[170] = "ds1FDL";
$arrayifType[171] = "pos";
$arrayifType[172] = "dvbAsiIn";
$arrayifType[173] = "dvbAsiOut";
$arrayifType[174] = "plc";
$arrayifType[175] = "nfas";
$arrayifType[176] = "tr008";
$arrayifType[177] = "gr303RDT";
$arrayifType[178] = "gr303IDT";
$arrayifType[179] = "isup";
$arrayifType[180] = "propDocsWirelessMaclayer";
$arrayifType[181] = "propDocsWirelessDownstream";
$arrayifType[182] = "propDocsWirelessUpstream";
$arrayifType[183] = "hiperlan2";
$arrayifType[184] = "propBWAp2Mp";
$arrayifType[185] = "sonetOverheadChannel";
$arrayifType[186] = "digitalWrapperOverheadChannel";
$arrayifType[187] = "aal2";
$arrayifType[188] = "radioMAC";
$arrayifType[189] = "atmRadio";
$arrayifType[190] = "imt";
$arrayifType[191] = "mvl";
$arrayifType[192] = "reachDSL";
$arrayifType[193] = "frDlciEndPt";
$arrayifType[194] = "atmVciEndPt";
$arrayifType[195] = "opticalChannel";
$arrayifType[196] = "opticalTransport";
$arrayifType[197] = "propAtm";
$arrayifType[198] = "voiceOverCable";
$arrayifType[199] = "infiniband";
$arrayifType[200] = "teLink";
$arrayifType[201] = "q2931";
$arrayifType[202] = "virtualTg";
$arrayifType[203] = "sipTg";
$arrayifType[204] = "sipSig";
$arrayifType[205] = "docsCableUpstreamChannel";
$arrayifType[206] = "econet";
$arrayifType[207] = "pon155";
$arrayifType[208] = "pon622";
$arrayifType[209] = "bridge";
$arrayifType[210] = "linegroup";
$arrayifType[211] = "voiceEMFGD";
$arrayifType[212] = "voiceFGDEANA";
$arrayifType[213] = "voiceDID";
$arrayifType[214] = "mpegTransport";
$arrayifType[215] = "sixToFour";
$arrayifType[216] = "gtp";
$arrayifType[217] = "pdnEtherLoop1";
$arrayifType[218] = "pdnEtherLoop2";
$arrayifType[219] = "opticalChannelGroup";
$arrayifType[220] = "homepna";
$arrayifType[221] = "gfp";
$arrayifType[222] = "ciscoISLvlan";
$arrayifType[223] = "actelisMetaLOOP";
$arrayifType[224] = "fcipLink";
$arrayifType[225] = "rpr";
$arrayifType[226] = "qam";
$arrayifType[227] = "lmp";
$arrayifType[228] = "cblVectaStar";
$arrayifType[229] = "docsCableMCmtsDownstream";
$arrayifType[230] = "adsl2";
$arrayifType[231] = "macSecControlledIF";
$arrayifType[232] = "macSecUncontrolledIF";
$arrayifType[233] = "aviciOpticalEther";
$arrayifType[234] = "atmbond";
$arrayifType[235] = "voiceFGDOS";
$arrayifType[236] = "mocaVersion1";
$arrayifType[237] = "ieee80216WMAN";
$arrayifType[238] = "adsl2plus";
$arrayifType[239] = "dvbRcsMacLayer";
$arrayifType[240] = "dvbTdm";
$arrayifType[241] = "dvbRcsTdma";
$arrayifType[242] = "x86Laps";

if (!isset($edit))
{
	$request=mysql_query("SELECT * FROM $name_table_model WHERE id=\"$_GET[id]\"") or die ("ERROR!");

	while($tmp_request=mysql_fetch_array($request))
	{
?>
<form method="post" action="index.php?include=mainview&page=model&action=edit&edit=ok&id=<?php echo $id;?>" name="edit_model">
	<fieldset class="form">
		<legend><img src="images/edit.gif" alt="Edit" align="top"> <?php echo TXT_EDIT; ?> <?php echo TXT_MODEL; ?></legend>
		<label><?php echo TXT_NAME; ?></label>
		<input type="text" name="name" size="50" value="<?php echo $tmp_request['name']; ?>"><br>
		<label><?php echo TXT_MANUFACTURER; ?></label>
		<select name="manufacturer" id="manufacturer" size="1">
			<option value="null"><?php echo TXT_SELECT_MANUFACTURER; ?></option>
		<?php
		$request2=mysql_query("select id,name FROM $name_table_manufacturer") or die ("ERROR!");

		while($tmp_request2=mysql_fetch_array($request2))
		{
			if ($tmp_request['manufacturer_id'] == $tmp_request2['id'])
			{
				echo "<option value=\"$tmp_request2[id]\" SELECTED>$tmp_request2[name]</option>";
			}
			else
			{
				echo "<option value=\"$tmp_request2[id]\">$tmp_request2[name]</option>";
			}
		}
		?>
		</select>
		<label><?php echo TXT_CATEGORY; ?></label>		
		<select name="category" id="category" size="1">
			<option value="null"><?php echo TXT_SELECT_CATEGORY; ?></option>
		<?php
		$request3=mysql_query("select id,name FROM $name_table_category") or die ("ERROR!");

		while($tmp_request3=mysql_fetch_array($request3))
		{
			if ($tmp_request['category_id'] == $tmp_request3['id'])
			{
				echo "<option value=\"$tmp_request3[id]\" SELECTED>$tmp_request3[name]</option>";
			}
			else
			{
				echo "<option value=\"$tmp_request3[id]\">$tmp_request3[name]</option>";
			}
		}
		?>
		</select>
		<label><?php echo TXT_LAYER; ?></label>
		<select id="layer" name="layer" size="1">
			<option value="null"><?php echo TXT_SELECT_LAYER; ?></option>
			<?php
			switch ($tmp_request['layer'])
			{
				case '1':
				?>
					<option value="1" selected>2</option>
					<option value="2">2+</option>
					<option value="3">3+</option>
				<?php
				break;
				
				case '2':
				?>
					<option value="1">2</option>
					<option value="2" selected>2+</option>
					<option value="3">3+</option>
				<?php
				break;
				
				case '3':
				?>
					<option value="1">2</option>
					<option value="2">2+</option>
					<option value="3" selected>3+</option>
				<?php
				break;			
			}
			?>
		</select>		
		<label><?php echo TXT_HEIGHT; ?></label>
		<select name="height" id="height" onchange="javascript:urlredirectdiv('ajax_view.php?what=ajaxheight&height_id='+this.value,'ajaxheight');">
			<option value="null"><?php echo TXT_SELECT_HEIGHT; ?></option>	
			<?php
			switch ($tmp_request['height'])
			{
				case '1':
				?>
				<option value="1" selected>1 U</option>
				<option value="2">2 U</option>
				<option value="4">4 U</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;
				
				case '2':
				?>
				<option value="1">1 U</option>
				<option value="2" selected>2 U</option>
				<option value="4">4 U</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;
				
				case '4':
				?>
				<option value="1">1 U</option>
				<option value="2">2 U</option>
				<option value="4" selected>4 U</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;
        
        default:
				?>
				<option value="1">1 U</option>
				<option value="2">2 U</option>
				<option value="4">4 U</option>
        <option value="<?php echo $tmp_request['height']; ?>" selected><?php echo $tmp_request['height']; ?> U</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php       
        break;
			}
			?>			
		</select>
    <div id="ajaxheight"></div>
		<label><?php echo TXT_NUMBER_SLOT_AVAILABLE; ?></label>
		<input type="text" name="number_slot" id="number_slot" size="3" maxlength="3" value="<?php
		$request_count=mysql_query("SELECT count(*) FROM $name_table_model_slot WHERE model_id=$id") or die ("ERROR!");
		$data_count= mysql_fetch_array($request_count);
		
		echo "$data_count[0]";
		
		?>" onKeyPress="return numbersonly(this, event)" disabled> <input type="button" value="<?php echo TXT_EDIT; ?>" onclick="javascript:urlredirectdiv('ajax_view.php?what=addslots&nb_slot='+number_slot.value,'slotdiv');document.getElementById('slotdiv').style.display='block';" id="add_slot_button" disabled>
		<div id="slotdiv">
		<?php

		$i=0;
		$request_model_slot=mysql_query("SELECT * FROM $name_table_model_slot WHERE model_id=$id") or die ("ERROR!");
		
		while($tmp_request_model_slot=mysql_fetch_array($request_model_slot))
		{
		?>
			<fieldset class="form"><legend><span style="position:relative;top:-10px;"><?php echo TXT_SLOT; ?> # </span><input type="text" name="name_slot_<?php echo $i; ?>" id="name_slot_<?php echo $i; ?>" value="<?php echo $tmp_request_model_slot['number']; ?>" size="3" maxsize="3" onKeyPress="return numbersonly(this, event)" disabled></legend><span style="position:relative;top:-10px"><?php echo TXT_INTERFACE; ?> <?php echo TXT_DENSITY; ?></span> <select name="interface_density_<?php echo $i; ?>" id="interface_density_<?php echo $i; ?>" onchange="javascript:urlredirectdiv('ajax_view.php?what=ajaxinterfacedensity&interface_id='+this.value+'&id=<?php echo $i; ?>','ajaxinterfacedensity_<?php echo $i; ?>');" disabled> <?php
			
			switch ($tmp_request_model_slot['interface_density'])
			{
				case '6':
				?>
				<option value="6" selected>6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php
				break;
				
				case '12':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12" selected>12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;
				
				case '16':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16" selected>16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;

				case '24':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24" selected>24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;

				case '32':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32" selected>32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;

				case '48':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48" selected>48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;

				case '96':
				?>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96" selected>96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>          
				<?php				
				break;					
        
        default:
        ?>
				<option value="<?php echo $tmp_request_model_slot['interface_density']; ?>"><?php echo $tmp_request_model_slot['interface_density']; ?> <?php echo TXT_PORTS; ?></option>
				<option value="6">6 <?php echo TXT_PORTS; ?></option>
				<option value="12">12 <?php echo TXT_PORTS; ?></option>
				<option value="16">16 <?php echo TXT_PORTS; ?></option>
				<option value="24">24 <?php echo TXT_PORTS; ?></option>
				<option value="32">32 <?php echo TXT_PORTS; ?></option>
				<option value="48">48 <?php echo TXT_PORTS; ?></option>
				<option value="96">96 <?php echo TXT_PORTS; ?></option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>
        <?php
        break;
        
			}			
			?></select> <span id="ajaxinterfacedensity_<?php echo $i; ?>"></span><span style="position:relative;top:-10px;margin-left: 15px;"><?php echo TXT_INTERFACE; ?> <?php echo TXT_TYPE; ?></span> <select name="interface_type_<?php echo $i; ?>" id="interface_type_<?php echo $i; ?>" disabled><?php
			
			foreach ($arrayifType as $key => $arrayvalue)
			{
				if ($key == $tmp_request_model_slot['interface_type'])
				{
					echo "<option value=\"$key\" selected>$arrayvalue</option>";
				}
				else
				{
					echo "<option value=\"$key\">$arrayvalue</option>";
				}
			}
			
			?></select> <span style="position:relative;top:-10px;margin-left: 15px;"><?php echo TXT_INTERFACE; ?> <?php echo TXT_SPEED; ?></span> <select name="interface_speed_<?php echo $i; ?>" id="interface_speed_<?php echo $i; ?>" onchange="javascript:urlredirectdiv('ajax_view.php?what=ajaxinterfacespeed&interface_id='+this.value+'&id=<?php echo $i; ?>','ajaxinterfacespeed_<?php echo $i; ?>');" disabled> <?php
			
			switch($tmp_request_model_slot['interface_speed'])
			{
				case '10':
				?>
				<option value="10" selected>10 Mbps</option>
				<option value="100">10/100 Mbps</option>
				<option value="1000">10/100/1000 Mbps</option>
				<option value="1001">1000 Mbps</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;
				
				case '100':
				?>
				<option value="10">10 Mbps</option>
				<option value="100" selected>10/100 Mbps</option>
				<option value="1000">10/100/1000 Mbps</option>
				<option value="1001">1000 Mbps</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;

				case '1000':
				?>
				<option value="10">10 Mbps</option>
				<option value="100">10/100 Mbps</option>
				<option value="1000" selected>10/100/1000 Mbps</option>
				<option value="1001">1000 Mbps</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;

				case '1001':
				?>
				<option value="10">10 Mbps</option>
				<option value="100">10/100 Mbps</option>
				<option value="1000">10/100/1000 Mbps</option>
				<option value="1001" selected>1000 Mbps</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>        
				<?php
				break;				
        
        default:
				?>
				<option value="<?php echo $tmp_request_model_slot['interface_speed']; ?>" selected><?php echo $tmp_request_model_slot['interface_speed']; ?> Mbps</option>
				<option value="10">10 Mbps</option>
				<option value="100">10/100 Mbps</option>
				<option value="1000">10/100/1000 Mbps</option>
				<option value="1001">1000 Mbps</option>
        <option value="other"><?php echo TXT_OTHER; ?>...</option>
				<?php        
        break;
        
			}
			?></select> <span id="ajaxinterfacespeed_<?php echo $i; ?>"></span> <input type="hidden" value="" id="nb_interface_slot_<?php echo $i; ?>" name="nb_interface_slot_<?php echo $i; ?>"></fieldset>
		<?php
		$i++;
		}
		?>
		</div></div></div><br>
		<label><?php echo TXT_DESCRIPTION; ?></label>
		<textarea name="description" rows="10" cols="50"><?php echo $tmp_request['description']; ?></textarea><br>
		<input type="submit" name="submit" value="<?php echo TXT_EDIT; ?>"> <input type="button" value="<?php echo TXT_BACK; ?>" onClick="javascript:history.go(-1);">
	</fieldset>
</form>
 <script language="JavaScript" type="text/javascript">
	 var frmvalidator = new Validator("edit_model");
		 frmvalidator.addValidation("name","req","Please enter the name of the model");
		 frmvalidator.addValidation("manufacturer","dontselect=0","Please enter the manufacturer of the model");
		 frmvalidator.addValidation("category","dontselect=0","Please enter the category of the model");
		 frmvalidator.addValidation("layer","dontselect=0","Please enter the layer of the model");
		 frmvalidator.addValidation("height","dontselect=0","Please enter the height of the model");
		 frmvalidator.addValidation("number_slot","req","Please enter the number of slot(s) available on the model");
		 frmvalidator.addValidation("name","maxlen=255",
"Max length for Name is 255");
</script>
<?php
	}
}
else if ($edit=="ok")
{
	$request=mysql_query("SELECT * FROM $name_table_model WHERE id=\"$id\"") or die ("ERROR!");

	while($tmp_request=mysql_fetch_array($request))
	{
		$preceding_name = $tmp_request['name'];
		$preceding_description = $tmp_request['description'];
	}

  if ($height=="other")
  {
    $query=mysql_query("UPDATE $name_table_model SET name=\"$name\", category_id=\"$category\", manufacturer_id=\"$manufacturer\", layer=\"$layer\", height=\"$other_height\", description=\"$description\" WHERE id=$id");  
  }
  else
  {
    $query=mysql_query("UPDATE $name_table_model SET name=\"$name\", category_id=\"$category\", manufacturer_id=\"$manufacturer\", layer=\"$layer\", height=\"$height\", description=\"$description\" WHERE id=$id");
  }

	if(!$query)
	{
		echo "<center><div id=\"status\" style=\"color:red\"><img src=\"images/warning.png\" alt=\"WARNING\"><br><br>";
		echo TXT_DATABASE_ERROR;
		echo "</div><br><a href=\"javascript:history.go(-2);\">";
		echo TXT_BACK;
		echo "</a></center>";
	}
	else
	{
   
		$currentdate = date('Y-m-d');
		$currenttime = date("H:i:s"); 
	
		user_log ($_SESSION['login'],$name_table_users,$name_table_users_log,"edit","model","$name ($id)",$mysql_hostname,$mysql_username,$mysql_password,$mysql_database);
		
		foreach ($syslog_server as $arrayvalue)
		{
			$syslog = new Syslog();
			$syslog->SetFacility(13);
			$syslog->SetSeverity(5);
			$syslog->SetProcess('odcnms');
			$syslog->SetHostname('');
			$syslog->SetFqdn('');
			$syslog->SetIpFrom('');		
			$syslog->SetContent($currentdate.' '.$currenttime.' user: '.$_SESSION['login'].' - edit model '.$name.'('.$id.')');
			$syslog->SetServer($arrayvalue);
			$syslog->Send();
		}
		
		echo "<center><div id=\"status\" style=\"color:green\"><img src=\"images/info.png\" alt=\"INFO\"><br><br>";
		echo TXT_SUCCESSFULLY_EDITED_MODEL;
		echo "</div><br><a href=\"javascript:history.go(-2);\">";
		echo TXT_BACK;
		echo "</a></center>";
	}

}
?>
Return current item: OpenDataCenter Network Management System