### Eclipse Workspace Patch 1.0
#P racktables
Index: wwwroot/inc/database.php
===================================================================
--- wwwroot/inc/database.php	(Revision 234)
+++ wwwroot/inc/database.php	(Arbeitskopie)
@@ -518,7 +518,7 @@
 
 function getObjectPortsAndLinks ($object_id)
 {
-	$query = "SELECT id, name, label, l2address, iif_id, (SELECT iif_name FROM PortInnerInterface WHERE id = iif_id) AS iif_name, " .
+	$query = "SELECT id, name, label, l2address, vlan, iif_id, (SELECT iif_name FROM PortInnerInterface WHERE id = iif_id) AS iif_name, " .
 		"(SELECT name FROM RackObject WHERE Port.object_id = RackObject.id) AS object_name, " .
 		"type AS oif_id, (SELECT dict_value FROM Dictionary WHERE dict_key = type) AS oif_name, reservation_comment " .
 		"FROM Port WHERE object_id = ?";
@@ -531,6 +531,7 @@
 		$row['remote_id'] = NULL;
 		$row['remote_name'] = NULL;
 		$row['remote_object_id'] = NULL;
+        $row['remote_vlan'] = NULL;
 		$ret[] = $row;
 	}
 	unset ($result);
@@ -554,13 +555,14 @@
 		unset ($result);
 		if ($remote_id) // there's a remote end here
 		{
-			$query = "SELECT name, object_id FROM Port WHERE id = ?";
+			$query = "SELECT name, object_id, vlan FROM Port WHERE id = ?";
 			$result = usePreparedSelectBlade ($query, array ($remote_id));
 			if ($row = $result->fetch (PDO::FETCH_ASSOC))
 			{
 				$ret[$tmpkey]['remote_name'] = $row['name'];
 				$ret[$tmpkey]['remote_object_id'] = $row['object_id'];
 				$ret[$tmpkey]['cableid'] = $cable;
+                $ret[$tmpkey]['remote_vlan'] = $row['vlan'];
 			}
 			$ret[$tmpkey]['remote_id'] = $remote_id;
 			unset ($result);
@@ -1066,7 +1068,7 @@
 	return $ret;
 }
 
-function commitAddPort ($object_id = 0, $port_name, $port_type_id, $port_label, $port_l2address)
+function commitAddPort ($object_id = 0, $port_name, $port_type_id, $port_label, $port_l2address, $port_vlan)
 {
 	$db_l2address = l2addressForDatabase ($port_l2address);
 	global $dbxlink;
@@ -1102,6 +1104,7 @@
 			'iif_id' => $iif_id,
 			'type' => $oif_id,
 			'l2address' => ($db_l2address === '') ? NULL : $db_l2address,
+			'vlan' => $port_vlan
 		)
 	);
 	$dbxlink->exec ('UNLOCK TABLES');
@@ -1110,7 +1113,7 @@
 // The fifth argument may be either explicit 'NULL' or some (already quoted by the upper layer)
 // string value. In case it is omitted, we just assign it its current value.
 // It would be nice to simplify this semantics later.
-function commitUpdatePort ($object_id, $port_id, $port_name, $port_type_id, $port_label, $port_l2address, $port_reservation_comment)
+function commitUpdatePort ($object_id, $port_id, $port_name, $port_type_id, $port_label, $port_l2address, $port_reservation_comment, $port_vlan)
 {
 	$db_l2address = l2addressForDatabase ($port_l2address);
 	global $dbxlink;
@@ -1133,6 +1136,7 @@
 			'label' => $port_label,
 			'reservation_comment' => mb_strlen ($port_reservation_comment) ? $port_reservation_comment : NULL,
 			'l2address' => ($db_l2address === '') ? NULL : $db_l2address,
+			'vlan' => $port_vlan,
 		),
 		array
 		(
Index: wwwroot/inc/ophandlers.php
===================================================================
--- wwwroot/inc/ophandlers.php	(Revision 234)
+++ wwwroot/inc/ophandlers.php	(Arbeitskopie)
@@ -602,7 +602,8 @@
 		trim ($_REQUEST['port_name']),
 		$_REQUEST['port_type_id'],
 		trim ($_REQUEST['port_label']),
-		trim ($_REQUEST['port_l2address'])
+		trim ($_REQUEST['port_l2address']),
+		trim ($_REQUEST['port_vlan'])
 	);
 	return buildRedirectURL (__FUNCTION__, 'OK', array ($_REQUEST['port_name']));
 }
@@ -616,7 +617,7 @@
 	assertStringArg ('reservation_comment', TRUE);
 	genericAssertion ('l2address', 'l2address0');
 	genericAssertion ('name', 'string');
-	commitUpdatePort ($sic['object_id'], $sic['port_id'], $sic['name'], $sic['port_type_id'], $sic['label'], $sic['l2address'], $sic['reservation_comment']);
+	commitUpdatePort ($sic['object_id'], $sic['port_id'], $sic['name'], $sic['port_type_id'], $sic['label'], $sic['l2address'], $sic['reservation_comment'], $sic['vlan']);
 	return buildRedirectURL (__FUNCTION__, 'OK', array ($_REQUEST['name']));
 }
 
Index: wwwroot/inc/interface.php
===================================================================
--- wwwroot/inc/interface.php	(Revision 234)
+++ wwwroot/inc/interface.php	(Arbeitskopie)
@@ -788,6 +788,7 @@
 		echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>";
 		echo '<tr><th class=tdleft>Local name</th><th class=tdleft>Visible label</th>';
 		echo '<th class=tdleft>Interface</th><th class=tdleft>L2 address</th>';
+        echo '<th class=tdleft>VLAN</th>';        
 		echo '<th class=tdcenter colspan=2>Remote object and port</th>';
 		echo '<th class=tdleft>Cable ID</th></tr>';
 		foreach ($info['ports'] as $port)
@@ -799,12 +800,17 @@
 			echo "><td class='tdleft' NOWRAP><a name='port-${port['id']}' class='ancor interactive-portname nolink $a_class'>${port['name']}</a></td>";
 			echo "<td class=tdleft>${port['label']}</td>";
 			echo "<td class=tdleft>" . formatPortIIFOIF ($port) . "</td><td class=tdleft><tt>${port['l2address']}</tt></td>";
+            echo "<td class=tdleft>${port['vlan']}</td>";
 			if ($port['remote_object_id'])
 			{
 				$remote_object = spotEntity ('object', $port['remote_object_id']);
 				echo "<td class=tdleft><a href='".makeHref(array('page'=>'object', 'object_id'=>$port['remote_object_id'], 'hl_port_id'=>$port['remote_id']))."'>${remote_object['dname']}</a></td>";
 				echo "<td class=tdleft>${port['remote_name']}</td>";
-				echo "<td class='tdleft rsvtext'>${port['cableid']}</td>";
+				echo "<td class='tdleft rsvtext'>${port['cableid']}";                
+				if ($port['remote_vlan'] != NULL) {
+				    echo " VLAN " . $port['remote_vlan'];
+                }
+				echo "</td>";
 			}
 			else
 				echo implode ('', formatPortReservation ($port)) . '<td></td>';
@@ -1066,7 +1072,8 @@
 		echo "<td><input type=text name=port_label tabindex=101></td><td>";
 		printNiftySelect (getNewPortTypeOptions(), array ('name' => 'port_type_id', 'tabindex' => 102), $prefs['selected']);
 		echo "<td><input type=text name=port_l2address tabindex=103 size=18 maxlength=24></td>\n";
-		echo "<td colspan=3>&nbsp;</td><td>";
+        echo "<td><input type=text name=port_vlan tabindex=104 size=5 maxlength=200></td>\n";
+		echo "<td colspan=2>&nbsp;</td><td>";
 		printImageHREF ('add', 'add a port', TRUE, 104);
 		echo "</td></tr></form>";
 	}
@@ -1095,7 +1102,7 @@
 	}
 	
 	echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n";
-	echo "<tr><th>&nbsp;</th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>L2 address</th>";
+	echo "<tr><th>&nbsp;</th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>L2 address</th><th class=tdleft>VLAN</th>";
 	echo "<th class=tdcenter colspan=2>Cable, Remote object and port</th><th class=tdcenter>(Un)link or (un)reserve</th><th>&nbsp;</th></tr>\n";
 	if (getConfigVar ('ADDNEW_AT_TOP') == 'yes')
 		printNewItemTR ($prefs);
@@ -1140,6 +1147,7 @@
 		// 18 is enough to fit 6-byte MAC address in its longest form,
 		// while 24 should be Ok for WWN
 		echo "<td><input type=text name=l2address value='${port['l2address']}' size=18 maxlength=24></td>\n";
+        echo "<td><input type=text name=vlan value='${port['vlan']}' size=5 maxlength=24></td>\n";
 		if ($port['remote_object_id'])
 		{
 			$remote_object = spotEntity ('object', $port['remote_object_id']);
