From: Neil S. <sir...@us...> - 2003-07-19 05:45:44
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-07-19 05:45:40 UTC Modified files: delete_multi_records.php edit_template.php docs/CHANGELOG docs/TODO Added files: delete_multi_t_records.php Log message: Author: SiRVulcaN <sir...@si...> Log message: - Allow template admins to delete multiple records at once in templates. ---------------------- diff included ---------------------- Index: publicdnsadmin/delete_multi_records.php diff -u publicdnsadmin/delete_multi_records.php:1.1 publicdnsadmin/delete_multi_records.php:1.2 --- publicdnsadmin/delete_multi_records.php:1.1 Thu Jul 17 05:02:28 2003 +++ publicdnsadmin/delete_multi_records.php Fri Jul 18 22:45:30 2003 @@ -36,7 +36,7 @@ echo "<p class=\"error\">· You don't have permission to delete this record- ($recordid)</p>\n"; $error_occur = 1; } - // Technically the above and below errors should happen, if they do it will be a very rare occasion. -sirvulcan + // Technically the above and below errors shouldnt happen, if they do it will be a very rare occasion. -sirvulcan } else { echo "<p class=\"error\">· Zone/record not found ($recordid)</p>\n"; $error_occur = 1; Index: publicdnsadmin/delete_multi_t_records.php diff -u /dev/null publicdnsadmin/delete_multi_t_records.php:1.1 --- /dev/null Fri Jul 18 22:45:40 2003 +++ publicdnsadmin/delete_multi_t_records.php Fri Jul 18 22:45:30 2003 @@ -0,0 +1,58 @@ +<?php +/* + Public DNS Administator + Originally Written by Trond Arve Nordheim <tr...@no...> + Modified By Neil Spierling <sir...@si...> + + Distributed under the GPL license, see LICENSE for + more information + + $Id: +*/ + +require("lib/prepend.php"); +require("lib/header.php"); + +$perms = getUserPermissions($_SESSION["_UID"]); + +if (userHasAccess($_SESSION["_UID"], "edit_template")) { + +?> +<h3>Edit template » delete multiple record</h3> +<?php + + if ($recdel) { + $del_count_max = count($recdel); + + $dbh = db_connect(); + foreach($recdel as $rcount=>$recordid) { + $result = $dbh->query("SELECT templates.id, templates.name AS template_name, template_records.name, template_records.type,template_records.prio, template_records.content FROM templates, template_records WHERE template_records.id = '$recordid' AND templates.id = template_records.template_id"); + if (!$dbh->isError($result) && $result->numRows()) { + $row = $result->fetchRow(); + $dbh->query("DELETE FROM template_records WHERE id = '$recordid'"); + } else { + echo "<p class=\"error\">· Template/record not found- ($recordid)</p>\n"; + $error_occur = 1; + } + } + if ($error_occur == 1) { + echo "<p>Some records could not be deleted, please check make sure you have permission to access/delete them</p>"; + echo "<p>Some "; + } else { + echo "<p>All "; + } + echo "selected tempplate records were successfully deleted<br><a href=\"edit_template.php?id=".$row["id"]."\">Proceed»</a></p>\n"; + if ($error_occur != 1) { + echo "<script language=\"JavaScript\">\n"; + echo "document.location.href='edit_template.php?id=".$row["id"]."';\n"; + echo "</script>\n"; + } + $dbh->disconnect(); + } +} else { + displayNoAccess(); +} + +require("lib/footer.php"); + +?> Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.23 publicdnsadmin/docs/CHANGELOG:1.24 --- publicdnsadmin/docs/CHANGELOG:1.23 Fri Jul 18 08:14:23 2003 +++ publicdnsadmin/docs/CHANGELOG Fri Jul 18 22:45:30 2003 @@ -12,3 +12,4 @@ another record type. - Made it so when you click on a template record you go into edit. - 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. Index: publicdnsadmin/docs/TODO diff -u publicdnsadmin/docs/TODO:1.11 publicdnsadmin/docs/TODO:1.12 --- publicdnsadmin/docs/TODO:1.11 Fri Jul 18 08:18:35 2003 +++ publicdnsadmin/docs/TODO Fri Jul 18 22:45:30 2003 @@ -1,4 +1,3 @@ - Some sort of maintenence news system (displayed on the main login page). - Syntax check records for validity to make it more fool proof. -- Multiple template record deletion - Disable "Del" button if no checkboxes checked on record lists. Index: publicdnsadmin/edit_template.php diff -u publicdnsadmin/edit_template.php:1.2 publicdnsadmin/edit_template.php:1.3 --- publicdnsadmin/edit_template.php:1.2 Fri Jul 18 08:14:23 2003 +++ publicdnsadmin/edit_template.php Fri Jul 18 22:45:30 2003 @@ -38,10 +38,12 @@ echo "</table>\n"; echo "</form>\n"; echo "<p>· <a href=\"new_template_record.php?zone=$zoneid\">New record</a></p>\n"; - echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; - $row_id = 0; + echo "<form action=\"delete_multi_t_records.php\" method=\"post\">\n"; + 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\"></th><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; + $row_id = 0; $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()) { @@ -54,6 +56,7 @@ } echo "<tr>\n"; + echo "<td class=\"row$row_id\"><input type=\"checkbox\" name=\"recdel[]\" 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"; @@ -68,7 +71,7 @@ } } - echo "</table></td></tr></table>\n"; + echo "</table></td></tr></table></form>\n"; } else { echo "<p class=\"error\">· Template not found</p>\n"; ----------------------- End of diff ----------------------- |