diff --git a/lam/lib/types/dhcp.inc b/lam/lib/types/dhcp.inc
index 71da7382..7f80cf4c 100644
--- a/lam/lib/types/dhcp.inc
+++ b/lam/lib/types/dhcp.inc
@@ -178,12 +178,10 @@ class lamDHCPList extends lamList {
}
/**
- * Prints the content of a cell in the account list for a given LDAP entry and attribute.
- *
- * @param array $entry LDAP attributes
- * @param string $attribute attribute name
+ * {@inheritDoc}
+ * @see lamList::getTableCellContent()
*/
- public function listPrintTableCellContent(&$entry, &$attribute) {
+ public function getTableCellContent(&$entry, &$attribute) {
// Fixed IPs
if ($attribute=="fixed_ips") {
// find all fixed addresses:
@@ -197,48 +195,59 @@ class lamDHCPList extends lamList {
$order[$i] = fixed_ip::extractIP($entries[$i]['dhcpstatements']);
}
}
+ $group = new htmlGroup();
natcasesort($order);
- echo "
";
- foreach ($order as $i => $sortval) {
+ for ($i = 0; $i < sizeof($order); $i++) {
$dhcpstatements = array();
if (isset($entries[$i]['dhcpstatements'][0])) {
$dhcpstatements = $entries[$i]['dhcpstatements'];
}
- $style = '';
+ $cssClasses = array('nowrap');
if (!fixed_ip::isActive($dhcpstatements)) {
- $style = 'style="text-decoration: line-through;"';
+ $cssClasses[] = 'strike-through';
}
- echo "";
- echo "" . fixed_ip::extractIP($dhcpstatements) . " | ";
$dhcphwaddress = explode(" ",$entries[$i]['dhcphwaddress'][0]);
- echo "".array_pop($dhcphwaddress)." | ";
- echo "".$entries[$i]['cn'][0]." | ";
- echo "
";
- }
- echo "
";
- }
- }
- // fixed ip address
- elseif ($attribute=="dhcpstatements") {
- // Search after the fixed ip entry
- if (is_array($entry['dhcpstatements'])) {
- foreach($entry['dhcpstatements'] AS $id => $value) {
-
- if (!is_array($value) && array_shift( explode(" ", $value) ) == "fixed-address") {
- $ip = explode(" ", $value);
- echo $ip['1'];
+ $ipAddress = fixed_ip::extractIP($dhcpstatements);
+ $ip = new htmlOutputText($ipAddress);
+ $ip->setCSSClasses($cssClasses);
+ $group->addElement($ip);
+ if (!empty($ipAddress)) {
+ $group->addElement(new htmlOutputText('
', false));
+ }
+ $macAddress = array_pop($dhcphwaddress);
+ $mac = new htmlOutputText($macAddress);
+ $mac->setCSSClasses($cssClasses);
+ $group->addElement($mac);
+ if (!empty($macAddress)) {
+ $group->addElement(new htmlOutputText('
', false));
+ }
+ $name = new htmlOutputText($entries[$i]['cn'][0]);
+ $name->setCSSClasses($cssClasses);
+ $group->addElement($name);
+ $group->addElement(new htmlOutputText('
', false));
+ if ($i < (sizeof($order) - 1)) {
+ $group->addElement(new htmlOutputText('
', false));
}
}
+ return $group;
}
}
elseif ($attribute=="dhcprange") { // DHCP Range
if (isset($entry['dhcprange'])) {
- echo"";
+ $table = new htmlTable();
+ $table->setCSSClasses(array('nowrap'));
$ranges = array();
foreach($entry['dhcprange'] AS $id => $value) {
if (!empty($value) && !is_numeric($value)) {
$ex = explode(" ", $value);
- $ranges[] = "".$ex[0]." | - | ".$ex[1]." |
";
+ $row = new htmlTableRow(
+ array(
+ new htmlOutputText($ex[0]),
+ new htmlOutputText(' - '),
+ new htmlOutputText($ex[1])
+ )
+ );
+ $ranges[$ex[0] . ' - ' . $ex[1]] = $row;
}
}
$pooledRanges = searchLDAP($entry['dn'], '(objectclass=dhcpPool)', array('dhcprange'));
@@ -249,18 +258,26 @@ class lamDHCPList extends lamList {
foreach($pool['dhcprange'] AS $id => $value) {
if (!empty($value) && !is_numeric($value)) {
$ex = explode(" ", $value);
- $ranges[] = "".$ex[0]." | - | ".$ex[1]." |
";
+ $row = new htmlTableRow(
+ array(
+ new htmlOutputText($ex[0]),
+ new htmlOutputText(' - '),
+ new htmlOutputText($ex[1])
+ )
+ );
+ $ranges[$ex[0] . ' - ' . $ex[1]] = $row;
}
}
}
- natcasesort($ranges);
- echo implode('', $ranges);
- echo"
";
+ uksort($ranges, 'strnatcasecmp');
+ foreach ($ranges as $text => $row) {
+ $table->addElement($row);
+ }
+ return $table;
}
}
- else
- {
- parent::listPrintTableCellContent($entry, $attribute);
+ else {
+ return parent::getTableCellContent($entry, $attribute);
}
}
diff --git a/lam/style/500_layout.css b/lam/style/500_layout.css
index d2fbd317..347677e2 100644
--- a/lam/style/500_layout.css
+++ b/lam/style/500_layout.css
@@ -507,6 +507,10 @@ input.markOk {
.sortableList li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; }
.sortableList li span { position: absolute; margin-left: -1.3em; }
+.strike-through {
+ text-decoration: line-through;
+}
+
/**
* table style for delete.php