separation of the GUI
[old-projects.git] / philter / philter / index.php
index 4ba4396..e8022de 100644 (file)
@@ -11,6 +11,9 @@ require("include/header.inc.php");
 require("include/philter.inc.php");
 require("include/config.inc.php");
 
+if(isset($_POST['set_adv']))
+    $philter->set_advanced();
+
 $mail_pool = new EmailPool(get_user_id());
 $filter = new Filter(get_user_id());
 
@@ -43,122 +46,12 @@ if(count($_POST)) {                             // a FORM has been submitted
 
 require("include/js_factory.inc.php");
 
-/********** globals plugins **********/
-?>
-<div class="rubrique"><?php i18n('global_title'); ?></div>
-<?php
-i18n('global_help');
-if(count($philter->config['global_plugins'])) {
-    echo "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
-        ."<table width=\"95%\" class=\"bicol\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\">\n";
-
-    $pair = 0;
-    foreach($philter->config['global_plugins'] as $id=>$g_plugin) {
-        echo "<tr><td class='".($pair ? 'pair':'impair')."'>\n";
-        echo $g_plugin->to_form($filter->get_global_data($id));
-        echo "</td></tr>\n";
-        $pair = 1 - $pair;
-    }
-
-    echo "</table><br />\n"
-        ."<center><input type='submit' name='global[submit]' value='"
-        ._i18n('apply_changes')."'/></center\n"
-        ."</form>\n";
-}
-
-/********** emails **********/
-?>
-<br />
-<div class="rubrique"><?php i18n('pool_title'); ?></div>
-<?php
-i18n('pool_help');
-echo $mail_pool->to_form();
-
-/********** filters **********/
-?>
-
-<br />
-<div class="rubrique"><?php i18n('filter_title'); ?></div>
-<?php
-i18n('filter_help');
-?>
-<table width="95%" cellspacing="0" cellpadding="2" align="center">
-<tr><td width="25%" valign="top">
-        <form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" id="order" name="order" onsubmit="return false;">
-        <table class="bicol" width="100%" cellpadding="1" cellspacing="1">
-        <tr><th><?php i18n('filter_list_title');?></th></tr>
-        <tr><td>
-<?php
-            foreach($filter->rules as $id=>$rule)
-                if($id)
-                    echo "<input type=\"hidden\" id=\"order$id\" name=\"order[$id]\" value=\"{$rule->rank}\" />\n";
-           
-            $presel = (isset($_POST['rule']['id']) ? $_POST['rule']['id']
-                        : (isset($_POST['order']['select']) ? $_POST['order']['select'] : 0));
-                
-            echo "<select size=\"16\" style=\"width:100%;\" id=\"orderSelect\" name=\"order[select]\" onchange=\"createRuleForm()\">\n";
-            echo "<option value=\"0\" ".($presel ? "" : " selected=\"selected\"").">";
-            i18n('new_rule');
-            echo "</option>\n";
-            
-            foreach($filter->rules as $id=>$rule)
-                if($id)
-                    echo "<option value=\"$id\""
-                        .($presel==$id ? " selected=\"selected\"":"")
-                        .">{$rule->name}</option>\n";
-?>
-            </select>
-        </td></tr><tr><td>
-            <input type="submit" value="<?php i18n('up');?>" name="order[up]" onclick="order_up();" />
-            <input type="submit" value="<?php i18n('dn');?>" name="order[dn]" onclick="order_dn();" /><br />
-            <input type="submit" value="<?php i18n('del');?>" name="order[delete]" onclick="order_submit(this)" />
-            <input type="submit" value="<?php i18n('submit');?>" name="order[submit]" onclick="order_submit(this)" />
-            <input type="hidden" value="" name="order[action]" />
-        </td></tr>
-        </table>
-        </form>
-    </td>
-    <td valign="top">
-        <form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" id="rule" name="rule" onsubmit="return false;">
-        <table width="100%" class="bicol" cellspacing="1" cellpadding="1">
-        <tr><th><?php i18n('rule_name'); ?>
-        </th></tr><tr><td>
-            <input type="text" value="" id="ruleName" name="rule[name]" style="width: 100%;"
-                onfocus="text_onfocus(this,'<?php i18n('new_rule');?>')"
-                onblur="text_onblur(this,'<?php i18n('new_rule');?>')" />
-        </td></tr>
-        <tr class="impair"><th><?php i18n('filter_rule_conf');?>
-        </th></tr><tr class="impair"><td>
-            <input type="radio" value="1" id="ruleAll1" name="rule[all]" /><?php i18n('all_matches');?>
-            <input type="radio" value="0" id="ruleAll0" name="rule[all]" /><?php i18n('one_match');?>
-            <br />
-            <input type="checkbox" checked="checked" id="ruleBlock" name="rule[block]" />
-            <?php i18n('blocking_rule');?>
-        </td></tr><tr class="impair"><th><?php i18n('filter_matches_list');?>
-        </th></tr><tr class="impair"><td id="matchesRow">
-        </td></tr><tr class="impair"><th><?php i18n('filter_actions_list');?>
-        </th></tr><tr class="impair"><td id="actionsRow">
-        </td></tr><tr class="impair"><td>
-            <input type="hidden" value="0" id="ruleId" name="rule[id]" />
-            <input type="submit" value="<?php i18n('new_match');?>" name="rule[new_match]" onclick="newMatch() "/>
-            <input type="submit" value="<?php i18n('new_action');?>" name="rule[new_action]" onclick="newAction()" />
-            <input type="submit" value="<?php i18n('submit');?>" name="rule[submit]" onclick="this.form.submit()" />
-        </td></tr>
-        </table>
-        </form>
-    </td>
-</tr>
-</table>
-
-<script type="text/javascript">
-    createRuleForm();
-</script>
-
-<?php
-/********** footer **********/
+if($philter->is_advanced())
+    require("include/form_filter.inc.php");
+else
+    require("include/form_emails.inc.php");
 
 require("include/footer.inc.php");
-
 /********************************************************************************
 * $id: header.inc.php,v 1.2 2003/08/03 16:02:41 madcoder exp $
 * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: