html cleaning
authorPierre Habouzit <madcoder@debian.org>
Mon, 8 Sep 2003 11:10:45 +0000 (11:10 +0000)
committerPierre Habouzit <madcoder@debian.org>
Mon, 8 Sep 2003 11:10:45 +0000 (11:10 +0000)
philter/philter/include/emails.inc.php
philter/philter/index.php
philter/philter/philter.js

index cac401f..074cc32 100644 (file)
@@ -112,9 +112,8 @@ class EmailPool {
 
         $res .= "<tr><td colspan=\"2\">\n"
             .   "    <input type=\"submit\" name=\"emails[apply]\" value=\"Apply changes\" /></td>\n"
-            .   "</tr>\n";
-
-        $res .= "</table>\n</form>\n";
+            .   "</tr>\n"
+            .   "</table>\n</form>\n";
 
         $val = 'your email ...';
         
@@ -123,7 +122,7 @@ class EmailPool {
             .   "<tr><td colspan=\"2\">\n"
             .   "   <input type=\"text\" name=\"emails[new]\" size=\"60\" value='$val' "
             .   "onfocus=\"text_onfocus(this,'$val')\" onblur=\"text_onblur(this,'$val')\" />\n"
-            .   "   <input type=\"submit\" name=\"emails[add]\" value=\"Add\" /></td>\n"
+            .   "   <input type=\"submit\" name=\"emails[add]\" value=\"Add\" />\n"
             .   "</td></tr>\n"
             .   "</table>\n</form>\n";
         
index 5f4ab09..b8819ce 100644 (file)
@@ -40,10 +40,9 @@ require("include/js_factory.inc.php");
 /********** globals plugins **********/
 
 if(count($philter->config['global_plugin'])) {
-    echo "<tr><td>\n"
-        ."<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
+    echo "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
         ."<table width=\"100%\">\n"
-        ."<tr><th>Global rules</th></tr>";
+        ."<tr><th>Global rules</th></tr>\n";
 
     foreach($philter->config['global_plugin'] as $g_plugin) {
         echo "<tr><td>\n";
@@ -64,9 +63,10 @@ if(count($philter->config['global_plugin'])) {
 <tr><td>
 <?php
 echo $mail_pool->to_form();
+?>
+</td></tr></table>
 
-echo "</td></tr>\n</table>\n";
-
+<?php
 /********** filters **********/
 ?>
 
@@ -78,12 +78,12 @@ echo "</td></tr>\n</table>\n";
         <tr><td>
 <?php
             foreach($filter->rules as $id=>$rule)
-                echo "<input type=\"hidden\" id=\"order[$id]\" name=\"order[$id]\" value=\"{$rule->rank}\" />\n";
+                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\" id=\"order[select]\" name=\"order[select]\" onchange=\"createRuleForm()\">\n";
+            echo "<select size=\"16\" id=\"orderSelect\" name=\"order[select]\" onchange=\"createRuleForm()\">\n";
             echo "<option value=\"0\" ".($presel ? "" : " selected=\"selected\"")
                 .">[ new rule ]</option>\n";
             
@@ -108,19 +108,19 @@ echo "</td></tr>\n</table>\n";
         <table width="100%">
         <tr><th>Rule Configuration
         </th></tr><tr><td>
-            <input type="hidden" value="0" id="rule[id]" name="rule[id]" />
+            <input type="hidden" value="0" id="ruleId" name="rule[id]" />
             Name of this rule :
-            <input type="text" size="60" value="" id="rule[name]" name="rule[name]"
+            <input type="text" size="60" value="" id="ruleName" name="rule[name]"
                 onfocus="text_onfocus(this,'[ new rule ]')" onblur="text_onblur(this,'[ new rule ]')" />
             <br />
-            <input type="radio" value="1" id="rule[all1]" name="rule[all]">All matches</input>
-            <input type="radio" value="0" id="rule[all0]" name="rule[all]">One match</input>
+            <input type="radio" value="1" id="ruleAll1" name="rule[all]" />All matches
+            <input type="radio" value="0" id="ruleAll0" name="rule[all]" />One match
             <br />
-            <input type="checkbox" checked="checked" id="rule[block]" name="rule[block]">Blocking Rule</input>
+            <input type="checkbox" checked="checked" id="ruleBlock" name="rule[block]" />Blocking Rule
         </td></tr><tr><th>Matches List
-        </th></tr><tr><td id="matchesRow" name="matches_row">
+        </th></tr><tr><td id="matchesRow">
         </td></tr><tr><th>Actions List
-        </th></tr><tr><td id="actionsRow" name="actions_row">
+        </th></tr><tr><td id="actionsRow">
         </td></tr><tr><td>
             <input type="submit" value="New Match" name="rule[new_match]" onclick="newMatch() "/>
             <input type="submit" value="New Action" name="rule[new_action]" onclick="newAction()" />
index 38852d8..9ccd363 100644 (file)
@@ -21,7 +21,7 @@ function cleanChilds(Node, nbChilds) {
         Node.removeChild(Node.childNodes[nbChilds]);
 }
 
-function getElement(obj, index) {
+function getElement(obj) {
     if(document.getElementById)
         return document.getElementById(obj);
     if(document.all)
@@ -37,7 +37,7 @@ function del_onsubmit() {
 
 function order_up() {
     form = document.forms['order'];
-    select = form.elements['order[select]'];
+    select = getElement('orderSelect');
 
     if(select.selectedIndex>1) {
         i = select.selectedIndex;
@@ -50,14 +50,14 @@ function order_up() {
         select.options[i-1] = new Option(text1,value1,false,false);
         select.selectedIndex = i-1;
 
-        form.elements['order['+value1+']'].value = i-1;
-        form.elements['order['+value2+']'].value = i;
+        form.elements['order'+value1].value = i-1;
+        form.elements['order'+value2].value = i;
     }
 }
 
 function order_dn() {
     form = document.forms['order'];
-    select = form.elements['order[select]'];
+    select = getElement['orderSelect'];
 
     if(select.selectedIndex>0 && select.selectedIndex<select.length-1) {
         i = select.selectedIndex;
@@ -70,16 +70,16 @@ function order_dn() {
         select.options[i+1] = new Option(text1,value1,false,false);
         select.selectedIndex = i+1;
 
-        form.elements['order['+value1+']'].value = i+1;
-        form.elements['order['+value2+']'].value = i;
+        form.elements['order'+value1].value = i+1;
+        form.elements['order'+value2].value = i;
     }
 }
 
 function order_submit(obj) {
     if(obj.name == 'order[submit]')
-        obj.form.elements['order[action]'].value = 'submit';
+        obj.form.elements['orderAction'].value = 'submit';
     if(obj.name == 'order[delete]')
-        obj.form.elements['order[action]'].value = 'delete';
+        obj.form.elements['orderAction'].value = 'delete';
     obj.form.submit();
 }
 
@@ -197,17 +197,17 @@ function changeRow(sel, funcs) {
 
 function createRuleForm() {
     var i;
-    var sel = getElement('order[select]');
+    var sel = getElement('orderSelect');
     var index = sel.options[sel.selectedIndex].value;
 
     actions_i = matches_i = 0;
     current_rule = filter[index];
 
-    getElement('rule[id]').value = index;
-    getElement('rule[name]').value = current_rule.name;
+    getElement('ruleId').value = index;
+    getElement('ruleName').value = current_rule.name;
     var c = (current_rule.all ? '1' : '0');
-    getElement('rule[all'+c+']').checked = true;
-    getElement('rule[block]').checked = current_rule.block;
+    getElement('ruleAll'+c).checked = true;
+    getElement('ruleBlock').checked = current_rule.block;
 
     var mr = getElement('matchesRow');
     cleanChilds(mr,0);