<?php # Copyright(C) 2004-2007 INL http://www.inl.fr/ # Written by Eric Leblond <regit@inl.fr> # Vincent Deffontaines <gryzor@inl.fr> # Jean Gillaux <jean@inl.fr> # Damien Boucard <damien.boucard AT inl.fr> # # $Id: edit_local.php 17927 2009-02-16 13:16:09Z haypo $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. require_once('function.php'); require_once('acl_common.php'); function editLocal($ruleset, $container, $local, $used_desc) { global $title; print "<div class=\"acledit_tab\">"; $resources=$ruleset->resources; $protocols=$ruleset->protocols; $groups=$ruleset->groups; $my_local = $container->get_elt($local); editAclTitle($my_local, false); $proto=$protocols->get_elt($my_local->proto); $group=$groups->get_elt($my_local->group); print '<form method="post" action="'.$title.'.php" onsubmit="aclHandle(bichains_t)" name="acls">'; echo '<input type="hidden" name="dndSort" value="" />'; print "<input type=hidden name=acl value=\"$local\"/>\n"; print '<input type=hidden name=local_nb value="'.$my_local->ID.'""/>'; print '<table class="acl_edit">'; print '<tr><td class="rowtitle">'._('Name')."</td>\n"; print '<td>'; print '<input type="text" name="ch_name" value="'.$my_local->name.'"/>'; print "</td></tr>\n"; # Group print '<tr><td class="rowtitle">'; if ($group) print_reduced_link("$title.php", $group->ID, $group->name, 'grhigh'); print _('Group'); if ($group) echo "</a>"; print '</td><td><select name="group">'; $array_groups=array(); foreach (($groups->list_tab()) as $key=>$app) { array_push($array_groups,$app); } sort($array_groups); $selected=0; foreach ($array_groups as $grp) { foreach ($groups->list_tab() as $key=>$foo) { if ($foo==$grp) break; } if ($key!=""){ print "<option value=\"$key\""; if ($grp == $group->name) { echo " selected"; $selected=$group->enabled; } print ">".$grp."</option>"; } } echo "</select></td></tr>"; print "<tr><td class=rowtitle>"._('Comment')."</td><td>"; html_textarea("comment", $my_local->comment, 30, 1); print "</td></tr>"; formSeparator(_('Network parameters'), 2); if ($title == 'localsout') { $to = $resources->get_elt($my_local->to); print '<tr><td class="rowtitle">'; if ($to) print_reduced_link("resources.php", $to->ID, $to->name); print _('Destination'); if ($to) print "</a>"; print "</td>"; print "<td>"; form_resource_list($resources, $to, /*true*/ false); print "</td></tr>\n"; } else { $from = $resources->get_elt($my_local->from); print '<tr><td class="rowtitle">'; if ($from) print_reduced_link("resources.php", $from->ID, $from->name); print _('Source'); if ($from) print "</a>"; print "</td><td>"; form_subject_list($resources, $from, /*true*/ false); print "</td></tr>\n"; } print '<tr><td class="rowtitle">'; if ($proto) print_reduced_link("protocols.php", $proto->ID, $proto->name); print _('Protocol'); print "</td>"; print "<td>"; form_list_protocols($protocols, $proto); print "</td></tr>\n"; /**** print "<tr><td class=\"rowtitle\">"._('Interface')."</td>"; print '<td colspan="2">'; $array_interfaces = build_interfaces_array($ruleset->descs, $used_desc); print "<select name=interface>\n"; print "<option value=\"\" name=\"--\">--</option>\n"; foreach ($array_interfaces as $sub=>$disp) { print "<option value=\"$sub\" name=\"$sub\""; if ($sub == $my_local->interface) echo " selected"; print ">".$disp."</option>\n"; } print " </select></td></tr>\n"; ****/ formSeparator(_('Action'), 2); print '<tr><td class="rowtitle">'._('Decision')."</td>"; #print "<td>{$my_local->decision}</td><td>"; print "<td>"; form_decision_list($my_local->decision); print "</td></tr>"; # Log editAclLog($my_local); print "</table>"; if (isset($bichain_label) && $bichain_label != ''){ print '<input type="hidden" name="bichain" value="'.$bichain_label.'"/>'; } print '<input type="submit" value="'._('Save').'" class="button" />'; echo '<input type="hidden" name="dndSort" value="" />'; print "</form>\n"; print "</div>"; } ?>