From 0eb037c8932a93863e1c59de1062c73a2fcbae21 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 10 Sep 2003 09:41:50 +0000 Subject: [PATCH] IE bugfixes, js simplification --- philter/philter/include/emails.inc.php | 16 ++++++++++------ philter/philter/philter.js | 26 ++++++++++++++------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/philter/philter/include/emails.inc.php b/philter/philter/include/emails.inc.php index 15935eb..4ef2277 100644 --- a/philter/philter/include/emails.inc.php +++ b/philter/philter/include/emails.inc.php @@ -112,15 +112,15 @@ class EmailPool { . "\n" . " is_active() ? " checked=\"checked\"" : "")." />\n" - . "\n" + . "\n" . "\n"; $pair = !$pair; } $res .= "\n" . "
\n" - . " \n" + . " \n" . " \n" . "
\n" . "\n"; @@ -183,13 +183,17 @@ class EmailPool { $philter->set_error($_POST['emails']['new']." is not a valid email"); return false; } - } elseif(!empty($_POST['emails']['del'])) { // delete one email + } elseif(isset($_POST['emails']['del']) && $_POST['emails']['del'] != -1) { // delete one email $del_id = $_POST['emails']['del']; // we compute a list of all actives emails $allow = false; - foreach($this->emails as $id=>$mail) - if($del_id!=$id && $mail->is_active()) + + foreach($this->emails as $id=>$mail) { + if($del_id!=$id && $mail->is_active()) { $allow = true; + break; + } + } if($allow && isset($this->emails[$del_id])) { list($count) = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM actions " diff --git a/philter/philter/philter.js b/philter/philter/philter.js index 806062d..f8fda11 100644 --- a/philter/philter/philter.js +++ b/philter/philter/philter.js @@ -29,10 +29,10 @@ function getElement(obj) { return false; } -function del_onclick(button) { - if(window.confirm("Voulez vous réellement supprimer cette adresse mail ?")) { - getElement('emailsDel').value = button.name.slice(1); - button.form.submit(); +function del_onclick(val) { + if(window.confirm("Do you really want to delete this email address ?")) { + getElement('emailsDel').value = val; + document.forms['emails'].submit(); } } @@ -104,12 +104,14 @@ var matches_i = 0; /********** RULE.ACTION FORM FUNCTIONS **********/ -function createActionSelect(data,base) { +function createActionSelect(div,data) { var i,j; var select = document.createElement("select"); var sel = 0; - select.name = base+'[0]'; + select.name = div.name+'[0]'; + // OG: must insert select node before creating options because of IE5 bug + div.appendChild(select); for(i=0, j=0; i