add_perm_templ.php
changeset 85 1687c1b107fa
child 116 cc09385a62aa
equal deleted inserted replaced
84:c8ebeadd438e 85:1687c1b107fa
       
     1 <?php
       
     2 
       
     3 /*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
       
     4  *  See <https://rejo.zenger.nl/poweradmin> for more details.
       
     5  *
       
     6  *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
       
     7  *
       
     8  *  This program is free software: you can redistribute it and/or modify
       
     9  *  it under the terms of the GNU General Public License as published by
       
    10  *  the Free Software Foundation, either version 3 of the License, or
       
    11  *  (at your option) any later version.
       
    12  *
       
    13  *  This program is distributed in the hope that it will be useful,
       
    14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    16  *  GNU General Public License for more details.
       
    17  *
       
    18  *  You should have received a copy of the GNU General Public License
       
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    20  */
       
    21 
       
    22 require_once("inc/toolkit.inc.php");
       
    23 include_once("inc/header.inc.php");
       
    24 
       
    25 if (!verify_permission(templ_perm_edit)) {
       
    26 	error(ERR_PERM_EDIT_PERM_TEMPL);
       
    27 } else {
       
    28 
       
    29 	if (isset($_POST['commit'])) {
       
    30 		add_perm_templ($_POST);	
       
    31 	}
       
    32 
       
    33 	$perms_avail = get_permissions_by_template_id();
       
    34 
       
    35 	echo "    <h2>" . _('Add permission template') . "</h2>\n"; 
       
    36         echo "    <form method=\"post\">\n";
       
    37 	echo "     <table>\n";
       
    38 	echo "      <tr>\n";
       
    39 	echo "       <th>" . _('Name') . "</th>\n"; 
       
    40 	echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"\"></td>\n";
       
    41 	echo "      </tr>\n";
       
    42 	echo "      <tr>\n";
       
    43 	echo "       <th>" . _('Description') . "</th>\n"; 
       
    44 	echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"\"></td>\n";
       
    45 	echo "      </tr>\n";
       
    46 	echo "     </table>\n";
       
    47 	echo "     <table>\n";
       
    48 	echo "      <tr>\n";
       
    49 	echo "       <th>&nbsp;</th>\n";
       
    50 	echo "       <th>" . _('Name') . "</th>\n"; 
       
    51 	echo "       <th>" . _('Description') . "</th>\n"; 
       
    52 	echo "      </tr>\n";
       
    53 
       
    54 	foreach ($perms_avail as $perm_a) {
       
    55 
       
    56 		echo "      <tr>\n";
       
    57 		echo "       <td><input type=\"checkbox\" name=\"perm_id[]\" value=\"" . $perm_a['id'] . "\"></td>\n";
       
    58 		echo "       <td>" . $perm_a['name'] . "</td>\n";
       
    59 		echo "       <td>" . $perm_a['descr'] . "</td>\n";
       
    60 		echo "      </tr>\n";
       
    61 	}
       
    62 	echo "     </table>\n";
       
    63 	echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
       
    64 	echo "     </form>\n";
       
    65 
       
    66 }
       
    67 
       
    68 include_once("inc/footer.inc.php");
       
    69 ?>