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