philter is fully compatible with : IE 6.0+, Opera 7.0+, Konqueror 3.1.99+,
authorPierre Habouzit <madcoder@debian.org>
Fri, 29 Aug 2003 09:18:45 +0000 (09:18 +0000)
committerPierre Habouzit <madcoder@debian.org>
Fri, 29 Aug 2003 09:18:45 +0000 (09:18 +0000)
    Mozilla 1.4+
need some tests under IE 5.0+

philter/philter/include/philter.js
philter/philter/include/plugin_autoreply.inc.php
philter/philter/include/plugin_forward.inc.php

index f7a9c6a..41a9122 100644 (file)
@@ -6,14 +6,6 @@
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
-function ta_onfocus(obj) {
-    obj.setAttribute('rows', '10');
-}
-
-function ta_onblur(obj) {
-    obj.setAttribute('rows', '2');
-}
-
 function text_onfocus(object,val) {
     if(object.value == val)
         object.value = '';
@@ -107,16 +99,17 @@ var matches_i = 0;
 function createActionSelect(data,base) {
     var i,j;
     var select = document.createElement("select");
+    var sel = 0;
     select.name = base+'[0]';
 
-    for(i=0, j=0; i<actions_list.length; i++)
-        if(actions_list[i])
-            select.options[j++] = new Option(actions_list[i],i,false,(data==i));
-
-    select.setAttribute("onchange", "changeRow(this,actions_func)");
+    for(i=0, j=0; i<actions_list.length; i++) {
+        if(data==i) sel = j;
+        if(actions_list[i]) select.options[j++] = new Option(actions_list[i],i,false,(data==i));
+    }
 
-    if(select.selectedIndex<0)
-        select.selectedIndex = 0;
+    select.selectedIndex = sel;
+    select.onchange = function () { changeRow(this,actions_func); };
+    
     return select;
 }
 
@@ -130,7 +123,7 @@ function createActionRow(Node,data) {
     var del = document.createElement("input");
     del.setAttribute("type", "submit");
     del.setAttribute("value", "Del");
-    del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+    del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
     div.appendChild(del);
 
     div.appendChild(document.createTextNode(" "));
@@ -150,16 +143,17 @@ function newAction() {
 function createMatchSelect(data,base) {
     var i,j;
     var select = document.createElement("select");
+    var sel = 0;
     select.name = base+'[0]';
 
-    for(i=0, j=0; i<matches_list.length; i++)
-        if(matches_list[i])
-            select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+    for(i=0, j=0; i<matches_list.length; i++) {
+        if(data==i) sel = j;
+        if(matches_list[i]) select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+    }
 
-    select.setAttribute("onchange", "changeRow(this,matches_func)");
+    select.selectedIndex = sel;
+    select.onchange = function () { changeRow(this,matches_func); };
 
-    if(select.selectedIndex<0)
-        select.selectedIndex = 0;
     return select;
 }
 
@@ -173,7 +167,7 @@ function createMatchRow(Node,data) {
     var del = document.createElement("input");
     del.setAttribute("type", "submit");
     del.setAttribute("value", "Del");
-    del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+    del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
     div.appendChild(del);
 
     div.appendChild(document.createTextNode(" "));
index 561e4f9..671d7a0 100644 (file)
@@ -18,9 +18,7 @@ class AutoReplyPlugin extends ActionPlugin {
             .   "    var ta = document.createElement('textarea');\n"
             .   "    ta.setAttribute('name', Node.name+'[1]');\n"
             .   "    ta.setAttribute('cols', '74');\n"
-            .   "    ta.setAttribute('rows', '2');\n"
-            .   "    ta.setAttribute('onfocus', 'ta_onfocus(this);');\n"
-            .   "    ta.setAttribute('onblur', 'ta_onblur(this);');\n"
+            .   "    ta.setAttribute('rows', '10');\n"
             .   "    if(data[1]) ta.value = data[1];\n"
             .   "\n"
             .   "    Node.appendChild(document.createElement('br'));\n"
index 73fef05..7ee74a6 100644 (file)
@@ -15,12 +15,16 @@ class FwdPlugin extends ActionPlugin {
     function to_js() {
         $res  = "function(Node, data) {\n"
             .   "    var i,j;\n"
+            .   "    var sel = 0;\n"
             .   "    var select = document.createElement('select');\n"
             .   "    select.setAttribute('name', Node.name+'[1]');\n"
             .   "\n"
-            .   "    for(i=0,j=0; i<mail_pool.length; i++)\n"
+            .   "    for(i=0,j=0; i<mail_pool.length; i++) {\n"
+            .   "        if(data[1]==i) sel = j;\n"
             .   "        if(mail_pool[i])\n"
             .   "            select.options[j++] = new Option(mail_pool[i],i,false,(data[1]==i));\n"
+            .   "    }\n"
+            .   "    select.selectedIndex = sel;\n"
             .   "\n"
             .   "    Node.appendChild(document.createTextNode(' email : '));\n"
             .   "    Node.appendChild(select);\n"