e81acad5382b5522b476273fda6310ec88ac110c
[old-projects.git] / philter / philter / include / form_filter.inc.php
1 <?php
2 if(!empty($_POST['rule']))
3 if(!$filter->handle_form())
4 echo "<p style=\"color:red;\">".$philter->error()."</p>\n";
5
6 require("include/js_factory.inc.php");
7 ?>
8 <div class="rubrique"><?php i18n('filter_sync'); ?></div>
9 <?php i18n('filter_sync_txt') ?>
10 <form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
11 <center>
12 <input type="submit" value='<?php i18n('filter_valid') ?>' name="filter_valid" />
13 <input type="submit" value='<?php i18n('filter_cancel') ?>' name="filter_cancel" />
14 </center>
15 </form>
16 <br />
17 <div class="rubrique"><?php i18n('filter_title'); ?></div>
18 <?php
19 i18n('filter_help');
20 ?>
21 <table width="95%" cellspacing="0" cellpadding="2" align="center">
22 <tr><td width="25%" valign="top">
23 <form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" id="order" name="order" onsubmit="return false;">
24 <table class="bicol" width="100%" cellpadding="1" cellspacing="1">
25 <tr><th><?php i18n('filter_list_title');?></th></tr>
26 <tr><td>
27 <?php
28 foreach($filter->rules as $id=>$rule)
29 if($id)
30 echo "<input type=\"hidden\" id=\"order$id\" name=\"order[$id]\" value=\"{$rule->rank}\" />\n";
31
32 $presel = (isset($_POST['rule']['id']) ? $_POST['rule']['id']
33 : (isset($_POST['order']['select']) ? $_POST['order']['select'] : 0));
34
35 echo "<select size=\"16\" style=\"width:100%;\" id=\"orderSelect\" name=\"order[select]\" onchange=\"createRuleForm()\">\n";
36 echo "<option value=\"0\" ".($presel ? "" : " selected=\"selected\"").">";
37 i18n('new_rule');
38 echo "</option>\n";
39
40 foreach($filter->rules as $id=>$rule)
41 if($id)
42 echo "<option value=\"$id\""
43 .($presel==$id ? " selected=\"selected\"":"")
44 .">{$rule->name}</option>\n";
45 ?>
46 </select>
47 </td></tr><tr><td>
48 <input type="submit" value="<?php i18n('up');?>" name="order[up]" onclick="order_up();" />
49 <input type="submit" value="<?php i18n('dn');?>" name="order[dn]" onclick="order_dn();" /><br />
50 <input type="submit" value="<?php i18n('del');?>" name="order[delete]" onclick="order_submit(this)" />
51 <input type="submit" value="<?php i18n('submit');?>" name="order[submit]" onclick="order_submit(this)" />
52 <input type="hidden" value="" name="order[action]" />
53 </td></tr>
54 </table>
55 </form>
56 </td>
57 <td valign="top">
58 <form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" id="rule" name="rule" onsubmit="return false;">
59 <table width="100%" class="bicol" cellspacing="1" cellpadding="1">
60 <tr><th><?php i18n('rule_name'); ?>
61 </th></tr><tr><td>
62 <input type="text" value="" id="ruleName" name="rule[name]" style="width: 100%;"
63 onfocus="text_onfocus(this,'<?php i18n('new_rule');?>')"
64 onblur="text_onblur(this,'<?php i18n('new_rule');?>')" />
65 </td></tr>
66 <tr class="impair"><th><?php i18n('filter_rule_conf');?>
67 </th></tr><tr class="impair"><td>
68 <input type="radio" value="1" id="ruleAll1" name="rule[all]" /><?php i18n('all_matches');?>
69 <input type="radio" value="0" id="ruleAll0" name="rule[all]" /><?php i18n('one_match');?>
70 <br />
71 <input type="checkbox" checked="checked" id="ruleBlock" name="rule[block]" />
72 <?php i18n('blocking_rule');?>
73 </td></tr><tr class="impair"><th><?php i18n('filter_matches_list');?>
74 </th></tr><tr class="impair"><td id="matchesRow">
75 </td></tr><tr class="impair"><th><?php i18n('filter_actions_list');?>
76 </th></tr><tr class="impair"><td id="actionsRow">
77 </td></tr><tr class="impair"><td>
78 <input type="hidden" value="0" id="ruleId" name="rule[id]" />
79 <input type="submit" value="<?php i18n('new_match');?>" name="rule[new_match]" onclick="newMatch() "/>
80 <input type="submit" value="<?php i18n('new_action');?>" name="rule[new_action]" onclick="newAction()" />
81 <input type="submit" value="<?php i18n('submit');?>" name="rule[submit]" onclick="this.form.submit()" />
82 </td></tr>
83 </table>
84 </form>
85 </td>
86 </tr>
87 </table>
88 <?php
89 i18n('filter_help2');
90 ?>
91
92 <script type="text/javascript">
93 createRuleForm();
94 </script>