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