From: Neil S. <sir...@us...> - 2003-07-19 13:46:43
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-07-19 13:46:41 UTC Modified files: edit_record.php edit_template.php edit_zone.php functions.jss index.php styleie.css styleother.css templates.php docs/CHANGELOG lib/config.php-dist Log message: Author: SiRVulcaN <sir...@si...> Log message: - Fixed small bug with ./@ formatting in edit_record.php - Added mouseover/downeffects for records/domains (from PHPMyAdmin) ---------------------- diff included ---------------------- Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.25 publicdnsadmin/docs/CHANGELOG:1.26 --- publicdnsadmin/docs/CHANGELOG:1.25 Sat Jul 19 00:26:48 2003 +++ publicdnsadmin/docs/CHANGELOG Sat Jul 19 06:46:31 2003 @@ -14,3 +14,4 @@ - Split CSS into 2 files, one for IE and the other for other browsers. - Allow template admins to delete multiple records at once in templates. - Disable "Del" button if no checkboxes checked on record lists. +SiRVulcaN <sir...@si...> - 20/7/2003 - Mouseover coloring added for tables (from PHPMyAdmin). Index: publicdnsadmin/edit_record.php diff -u publicdnsadmin/edit_record.php:1.5 publicdnsadmin/edit_record.php:1.6 --- publicdnsadmin/edit_record.php:1.5 Fri Jul 18 08:14:23 2003 +++ publicdnsadmin/edit_record.php Sat Jul 19 06:46:31 2003 @@ -48,7 +48,7 @@ echo "<td><input type=\"text\" name=\"record\" size=\"15\" maxlength=\"200\" value=\"" . htmlentities($record_name) . "\"><DIV ID=\"seperator\"><div class=\"seperator\">@</font></div></DIV><div class=\"domain\">" . htmlentities($row["domain_name"]) . "</div></td>"; } else { ?> - <td><input type="text" name="record" size="15" maxlength="200" value="<?php echo htmlentities($record_name); ?>"><DIV ID=\"seperator\"><div class=\"seperator\">.</div></DIV><div class=\"domain\"><?php echo htmlentities($row["domain_name"]); ?></div></td> + <td><input type="text" name="record" size="15" maxlength="200" value="<?php echo htmlentities($record_name); ?>"><DIV ID="seperator"><div class="seperator">.</div></DIV><div class="domain"><?php echo htmlentities($row["domain_name"]); ?></div></td> <? } } else { Index: publicdnsadmin/edit_template.php diff -u publicdnsadmin/edit_template.php:1.4 publicdnsadmin/edit_template.php:1.5 --- publicdnsadmin/edit_template.php:1.4 Sat Jul 19 00:26:47 2003 +++ publicdnsadmin/edit_template.php Sat Jul 19 06:46:31 2003 @@ -42,12 +42,20 @@ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th><input type=\"submit\" value=\"Del\" disabled=\"true\" name=\"delbut\"></th><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; $row_id = 0; + $row_c = -1; $rec_res = $dbh->query("SELECT * FROM template_records WHERE template_id = '$zoneid'"); if (!$dbh->isError($rec_res) && $rec_res->numRows()) { while ($rec_row = $rec_res->fetchRow()) { $row_id++; + $row_c++; + + if ($row_id == 1) { + $bgcolor=$row1; + } else { + $bgcolor=$row2; + } if ($rec_row["prio"]) { $priority = htmlentities($rec_row["prio"]); @@ -55,15 +63,20 @@ $priority = " "; } - echo "<tr>\n"; - echo "<td class=\"row$row_id\"><input type=\"checkbox\" name=\"recdel[]\" onClick=\"checkCount()\" value=\"". $rec_row["id"] ."\"></td>\n"; - echo "<td class=\"row$row_id\"><a href=\"edit_template_record.php?id=".$rec_row["id"]."\">".htmlentities($rec_row["name"])."</a></td>\n"; - echo "<td class=\"row$row_id\" align=\"center\">".htmlentities($rec_row["type"])."</td>\n"; - echo "<td class=\"row$row_id\">".htmlentities($rec_row["content"])."</td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">$priority</td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">".htmlentities($rec_row["ttl"])."</td>\n"; + if ($row_id == 1) { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row1', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row1', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row1', '#CCFFCC', '#FFCC99');\">"; + } else { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row2', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row2', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row2', '#CCFFCC', '#FFCC99');\">"; + } + + echo "<td bgcolor=\"$bgcolor\"><input type=\"checkbox\" name=\"recdel[]\" onClick=\"checkCount()\" value=\"". $rec_row["id"] ."\"></td>\n"; + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_template_record.php?id=".$rec_row["id"]."\">".htmlentities($rec_row["name"])."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"center\">".htmlentities($rec_row["type"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\">".htmlentities($rec_row["content"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">$priority</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">".htmlentities($rec_row["ttl"])."</td>\n"; - echo "<td class=\"row$row_id\"><a href=\"edit_template_record.php?id=".$rec_row["id"]."\"><img src=\"images/edit.png\" alt=\"Edit record\" border=\"0\"></a> <a href=\"delete_template_record.php?id=".$rec_row["id"]."\"><img src=\"images/trash.png\" alt=\"Delete record\" border=\"0\"></a></td>\n"; + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_template_record.php?id=".$rec_row["id"]."\"><img src=\"images/edit.png\" alt=\"Edit record\" border=\"0\"></a> <a href=\"delete_template_record.php?id=".$rec_row["id"]."\"><img src=\"images/trash.png\" alt=\"Delete record\" border=\"0\"></a></td>\n"; echo "</tr>\n"; if ($row_id == 2) { $row_id = 0; } Index: publicdnsadmin/edit_zone.php diff -u publicdnsadmin/edit_zone.php:1.4 publicdnsadmin/edit_zone.php:1.5 --- publicdnsadmin/edit_zone.php:1.4 Sat Jul 19 00:26:47 2003 +++ publicdnsadmin/edit_zone.php Sat Jul 19 06:46:31 2003 @@ -40,9 +40,17 @@ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th><input type=\"submit\" name=\"delbut\" disabled=\"true\" value=\"Del\"></th><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; $row_id = 0; + $row_c = -1; foreach ($records as $record) { $row_id++; + $row_c++; + + if ($row_id == 1) { + $bgcolor=$row1; + } else { + $bgcolor=$row2; + } if ($record["prio"]) { $priority = htmlentities($record["prio"]); @@ -50,7 +58,13 @@ $priority = " "; } - echo "<tr><td class=\"row$row_id\">"; + if ($row_id == 1) { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row1', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row1', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row1', '#CCFFCC', '#FFCC99');\">"; + echo "<td bgcolor=\"#e6ebef\">"; + } else { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row2', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row2', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row2', '#CCFFCC', '#FFCC99');\">"; + echo "<td bgcolor=\"#efeae6\">"; + } if ($record["type"] != "SOA") { echo "<input type=\"checkbox\" name=\"recdel[]\" onClick=\"checkCount()\" value=\"". $record["id"] ."\">"; } @@ -59,28 +73,28 @@ if (htmlentities($record["type"]) != "PTR") { if ($record["type"] != "SOA") { if ($record["type"] == "MBOXFW") { - echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">". $record["name"] ."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_record.php?id=".$record["id"]."\">". $record["name"] ."</a></td>\n"; } else { - echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">".htmlentities($record["name"])."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_record.php?id=".$record["id"]."\">".htmlentities($record["name"])."</a></td>\n"; } } else { - echo "<td class=\"row$row_id\">".htmlentities($record["name"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\">".htmlentities($record["name"])."</td>\n"; } } else { $dispaddy = $expaddy[3].".".$expaddy[2].".".$expaddy[1].".".$expaddy[0]; $expaddy = explode(".", htmlentities($record["name"])); if ($record["type"] != "SOA") { - echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">".$dispaddy."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_record.php?id=".$record["id"]."\">".$dispaddy."</a></td>\n"; } else { - echo "<td class=\"row$row_id\">".$dispaddy."</td>\n"; + echo "<td bgcolor=\"$bgcolor\">".$dispaddy."</td>\n"; } } - echo "<td class=\"row$row_id\" align=\"center\">".htmlentities($record["type"])."</td>\n"; - echo "<td class=\"row$row_id\">".htmlentities($record["content"])."</td>\n"; - echo "<td class=\"row$row_id\" align=\"center\">$priority</td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">".htmlentities($record["ttl"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"center\">".htmlentities($record["type"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\">".htmlentities($record["content"])."</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"center\">$priority</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">".htmlentities($record["ttl"])."</td>\n"; - echo "<td class=\"row$row_id\" height=\"20\">"; + echo "<td bgcolor=\"$bgcolor\" height=\"20\">"; if ($record["type"] != "SOA") { echo "<a href=\"edit_record.php?id=".$record["id"]."\"><img src=\"images/edit.png\" alt=\"Edit record\" border=\"0\"></a> <a href=\"delete_record.php?id=".$record["id"]."\"><img src=\"images/trash.png\" alt=\"Delete record\" border=\"0\"></a>"; } else { Index: publicdnsadmin/functions.jss diff -u publicdnsadmin/functions.jss:1.2 publicdnsadmin/functions.jss:1.3 --- publicdnsadmin/functions.jss:1.2 Sat Jul 19 00:26:48 2003 +++ publicdnsadmin/functions.jss Sat Jul 19 06:46:31 2003 @@ -34,3 +34,87 @@ } } + +var marked_row = new Array; + +function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor) +{ + var theCells = null; + + if ((thePointerColor == '' && theMarkColor == '') + || typeof(theRow.style) == 'undefined') { + return false; + } + + if (typeof(document.getElementsByTagName) != 'undefined') { + theCells = theRow.getElementsByTagName('td'); + } + else if (typeof(theRow.cells) != 'undefined') { + theCells = theRow.cells; + } + else { + return false; + } + + var rowCellsCnt = theCells.length; + var domDetect = null; + var currentColor = null; + var newColor = null; + if (typeof(window.opera) == 'undefined' + && typeof(theCells[0].getAttribute) != 'undefined') { + currentColor = theCells[0].getAttribute('bgcolor'); + domDetect = true; + } + else { + currentColor = theCells[0].style.backgroundColor; + domDetect = false; + } + + if (currentColor == '' + || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) { + if (theAction == 'over' && thePointerColor != '') { + newColor = thePointerColor; + } + else if (theAction == 'click' && theMarkColor != '') { + newColor = theMarkColor; + marked_row[theRowNum] = true; + } + } + else if (currentColor.toLowerCase() == thePointerColor.toLowerCase() + && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) { + if (theAction == 'out') { + newColor = theDefaultColor; + } + else if (theAction == 'click' && theMarkColor != '') { + newColor = theMarkColor; + marked_row[theRowNum] = true; + } + } + else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) { + if (theAction == 'click') { + newColor = (thePointerColor != '') + ? thePointerColor + : theDefaultColor; + marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]) + ? true + : null; + } + } + + if (newColor) { + var c = null; + if (domDetect) { + for (c = 0; c < rowCellsCnt; c++) { + theCells[c].setAttribute('bgcolor', newColor, 0); + } + } + else { + for (c = 0; c < rowCellsCnt; c++) { + theCells[c].style.backgroundColor = newColor; + } + } + } + + return true; +} + Index: publicdnsadmin/index.php diff -u publicdnsadmin/index.php:1.7 publicdnsadmin/index.php:1.8 --- publicdnsadmin/index.php:1.7 Thu Jun 19 06:47:48 2003 +++ publicdnsadmin/index.php Sat Jul 19 06:46:31 2003 @@ -46,6 +46,13 @@ $row_id++; $row_count++; + $row_c = $row_count - 1; + + if ($row_id == 1) { + $bgcolor=$row1; + } else { + $bgcolor=$row2; + } $serial = getZoneSerial($zone["id"]); $records = 0; @@ -63,12 +70,17 @@ } if (($row_count >= $offsetmin) && ($row_count <= $offsetmax)) { - echo "<tr>\n"; - echo "<td class=\"row$row_id\"><a href=\"edit_zone.php?id=".$zone["id"]."\">".htmlentities($zone["name"])."</a></td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">$serial</td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">$owner</td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">$records</td>\n"; - echo "<td class=\"row$row_id\" align=\"center\">"; + if ($row_id == 1) { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row1', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row1', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row1', '#CCFFCC', '#FFCC99');\">"; + } else { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row2', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row2', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row2', '#CCFFCC', '#FFCC99');\">"; + } + + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_zone.php?id=".$zone["id"]."\">".htmlentities($zone["name"])."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">$serial</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">$owner</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">$records</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"center\">"; if ($zone["delete"]) { echo " <a href=\"delete_zone.php?id=".$zone["id"]."\"><img src=\"images/trash.png\" alt=\"Delete zone\" border=\"0\"></a> "; Index: publicdnsadmin/lib/config.php-dist diff -u publicdnsadmin/lib/config.php-dist:1.10 publicdnsadmin/lib/config.php-dist:1.11 --- publicdnsadmin/lib/config.php-dist:1.10 Wed Jul 16 04:51:30 2003 +++ publicdnsadmin/lib/config.php-dist Sat Jul 19 06:46:31 2003 @@ -7,7 +7,7 @@ Distributed under the GPL license, see LICENSE for more information - $Id: config.php-dist,v 1.10 2003/07/16 11:51:30 key2peace Exp $ + $Id: config.php-dist,v 1.11 2003/07/19 13:46:31 sirvulcan Exp $ */ /* @@ -61,6 +61,10 @@ $ns2port = "8081"; $ns2user = "admin"; $ns2pass = "password"; + +/* row1 and row2 colors are the background colors for the domain/record tables (was in css) */ +$row1 = "#e6ebef"; +$row2 = "#efeae6"; /* Graphical code check options, You need libgd enabled in your PHP */ $NEWUSERS_GFXCHECK = 0; Index: publicdnsadmin/styleie.css diff -u publicdnsadmin/styleie.css:1.1 publicdnsadmin/styleie.css:1.2 --- publicdnsadmin/styleie.css:1.1 Fri Jul 18 08:14:23 2003 +++ publicdnsadmin/styleie.css Sat Jul 19 06:46:31 2003 @@ -93,14 +93,6 @@ font-size: 11px; } -.row1 { - background: #e6ebef; -} - -.row2 { - background: #efeae6; -} - .menu { background: #C7DDF4; color: #666666; @@ -280,4 +272,14 @@ background: #ffffff; font-family: Tahoma, Arial, sans-serif; font-size: 11px; +} + +.row1 +{ + background: #e6ebef; +} + +.row2 +{ + background: #efeae6; } Index: publicdnsadmin/styleother.css diff -u publicdnsadmin/styleother.css:1.1 publicdnsadmin/styleother.css:1.2 --- publicdnsadmin/styleother.css:1.1 Fri Jul 18 08:14:23 2003 +++ publicdnsadmin/styleother.css Sat Jul 19 06:46:31 2003 @@ -93,14 +93,6 @@ font-size: 11px; } -.row1 { - background: #e6ebef; -} - -.row2 { - background: #efeae6; -} - .menu { background: #C7DDF4; color: #666666; @@ -279,5 +271,15 @@ background: #ffffff; font-family: Tahoma, Arial, sans-serif; font-size: 11px; +} + +.row1 +{ + background: #e6ebef; +} + +.row2 +{ + background: #efeae6; } Index: publicdnsadmin/templates.php diff -u publicdnsadmin/templates.php:1.1.1.1 publicdnsadmin/templates.php:1.2 --- publicdnsadmin/templates.php:1.1.1.1 Wed Apr 16 00:19:06 2003 +++ publicdnsadmin/templates.php Sat Jul 19 06:46:31 2003 @@ -23,9 +23,17 @@ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th>Name</th><th>Records</th><th> </th></tr>\n"; $row_id = 0; + $row_c = -1; foreach ($templates as $template) { $row_id++; + $row_c++; + + if ($row_id == 1) { + $bgcolor=$row1; + } else { + $bgcolor=$row2; + } $records = 0; $tmpres = $dbh->query("SELECT COUNT(id) AS rec_count FROM template_records WHERE template_id = ".$template["id"]); @@ -34,10 +42,15 @@ $records = $tmprow["rec_count"]; } - echo "<tr>\n"; - echo "<td class=\"row$row_id\"><a href=\"edit_template.php?id=".$template["id"]."\">".htmlentities($template["name"])."</a></td>\n"; - echo "<td class=\"row$row_id\" align=\"right\">$records</td>\n"; - echo "<td class=\"row$row_id\" align=\"center\"> <a href=\"delete_template.php?id=".$template["id"]."\"><img src=\"images/trash.png\" alt=\"Delete template\" border=\"0\"></a> </td>\n"; + if ($row_id == 1) { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row1', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row1', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row1', '#CCFFCC', '#FFCC99');\">"; + } else { + echo "<tr onmouseover=\"setPointer(this, $row_c, 'over', '$row2', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, $row_c, 'out', '$row2', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, $row_c, 'click', '$row2', '#CCFFCC', '#FFCC99');\">"; + } + + echo "<td bgcolor=\"$bgcolor\"><a href=\"edit_template.php?id=".$template["id"]."\">".htmlentities($template["name"])."</a></td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"right\">$records</td>\n"; + echo "<td bgcolor=\"$bgcolor\" align=\"center\"> <a href=\"delete_template.php?id=".$template["id"]."\"><img src=\"images/trash.png\" alt=\"Delete template\" border=\"0\"></a> </td>\n"; echo "</tr>\n"; if ($row_id == 2) { $row_id = 0; } ----------------------- End of diff ----------------------- |