projects
/
old-projects.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bugfix and i18n change
[old-projects.git]
/
philter
/
philter
/
philter.js
diff --git
a/philter/philter/philter.js
b/philter/philter/philter.js
index
e574de5
..
30b573b
100644
(file)
--- a/
philter/philter/philter.js
+++ b/
philter/philter/philter.js
@@
-21,7
+21,7
@@
function cleanChilds(Node, nbChilds) {
Node.removeChild(Node.childNodes[nbChilds]);
}
Node.removeChild(Node.childNodes[nbChilds]);
}
-function getElement(obj
, index
) {
+function getElement(obj) {
if(document.getElementById)
return document.getElementById(obj);
if(document.all)
if(document.getElementById)
return document.getElementById(obj);
if(document.all)
@@
-29,11
+29,18
@@
function getElement(obj, index) {
return false;
}
return false;
}
+function del_onclick(val) {
+ if(window.confirm(del_q_i18n)) {
+ getElement('emailsDel').value = val;
+ document.forms['emails'].submit();
+ }
+}
+
/********** ORDER FORM FUNCTIONS **********/
function order_up() {
form = document.forms['order'];
/********** ORDER FORM FUNCTIONS **********/
function order_up() {
form = document.forms['order'];
- select =
form.elements['order[select]']
;
+ select =
getElement('orderSelect')
;
if(select.selectedIndex>1) {
i = select.selectedIndex;
if(select.selectedIndex>1) {
i = select.selectedIndex;
@@
-46,14
+53,14
@@
function order_up() {
select.options[i-1] = new Option(text1,value1,false,false);
select.selectedIndex = i-1;
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'];
}
}
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;
if(select.selectedIndex>0 && select.selectedIndex<select.length-1) {
i = select.selectedIndex;
@@
-66,8
+73,8
@@
function order_dn() {
select.options[i+1] = new Option(text1,value1,false,false);
select.selectedIndex = i+1;
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;
}
}
}
}
@@
-95,14
+102,19
@@
var current_rule;
var actions_i = 0;
var matches_i = 0;
var actions_i = 0;
var matches_i = 0;
+var del_i18n = 'Del';
+var del_q_i18n = 'Del';
+
/********** RULE.ACTION FORM FUNCTIONS **********/
/********** RULE.ACTION FORM FUNCTIONS **********/
-function createActionSelect(d
ata,base
) {
+function createActionSelect(d
iv,data
) {
var i,j;
var select = document.createElement("select");
var sel = 0;
var i,j;
var select = document.createElement("select");
var sel = 0;
- select.name =
bas
e+'[0]';
+ select.name =
div.nam
e+'[0]';
+ // OG: must insert select node before creating options because of IE5 bug
+ div.appendChild(select);
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));
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));
@@
-116,21
+128,19
@@
function createActionSelect(data,base) {
function createActionRow(Node,data) {
var div = document.createElement("div");
function createActionRow(Node,data) {
var div = document.createElement("div");
- div.className = 'row';
div.name = 'rule[actions]['+actions_i+']';
actions_i++;
Node.appendChild(div);
var del = document.createElement("input");
del.setAttribute("type", "submit");
div.name = 'rule[actions]['+actions_i+']';
actions_i++;
Node.appendChild(div);
var del = document.createElement("input");
del.setAttribute("type", "submit");
- del.setAttribute("value",
"Del"
);
+ del.setAttribute("value",
del_i18n
);
del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
- var select = createActionSelect(data[0],div.name);
- div.appendChild(select);
+ var select = createActionSelect(div,data[0]);
actions_func[select.options[select.selectedIndex].value](div,data);
}
actions_func[select.options[select.selectedIndex].value](div,data);
}
@@
-141,12
+151,14
@@
function newAction() {
/********** RULE.MATCH FORM FUNCTIONS **********/
/********** RULE.MATCH FORM FUNCTIONS **********/
-function createMatchSelect(d
ata,base
) {
+function createMatchSelect(d
iv,data
) {
var i,j;
var select = document.createElement("select");
var sel = 0;
var i,j;
var select = document.createElement("select");
var sel = 0;
- select.name =
bas
e+'[0]';
+ select.name =
div.nam
e+'[0]';
+ // OG: must insert select node before creating options because of IE5 bug
+ div.appendChild(select);
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));
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));
@@
-160,21
+172,19
@@
function createMatchSelect(data,base) {
function createMatchRow(Node,data) {
var div = document.createElement("div");
function createMatchRow(Node,data) {
var div = document.createElement("div");
- div.className = 'row';
div.name = 'rule[matches]['+actions_i+']';
actions_i++;
Node.appendChild(div);
var del = document.createElement("input");
del.setAttribute("type", "submit");
div.name = 'rule[matches]['+actions_i+']';
actions_i++;
Node.appendChild(div);
var del = document.createElement("input");
del.setAttribute("type", "submit");
- del.setAttribute("value",
"Del"
);
+ del.setAttribute("value",
del_i18n
);
del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
- var select = createMatchSelect(data[0],div.name);
- div.appendChild(select);
+ var select = createMatchSelect(div,data[0]);
matches_func[select.options[select.selectedIndex].value](div,data);
}
matches_func[select.options[select.selectedIndex].value](div,data);
}
@@
-193,17
+203,17
@@
function changeRow(sel, funcs) {
function createRuleForm() {
var i;
function createRuleForm() {
var i;
- var sel = getElement('order
[select]
');
+ var sel = getElement('order
Select
');
var index = sel.options[sel.selectedIndex].value;
actions_i = matches_i = 0;
current_rule = filter[index];
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('rule
Id
').value = index;
+ getElement('rule
Name
').value = current_rule.name;
var c = (current_rule.all ? '1' : '0');
var c = (current_rule.all ? '1' : '0');
- getElement('rule
[all'+c+']'
).checked = true;
- getElement('rule
[block]
').checked = current_rule.block;
+ getElement('rule
All'+c
).checked = true;
+ getElement('rule
Block
').checked = current_rule.block;
var mr = getElement('matchesRow');
cleanChilds(mr,0);
var mr = getElement('matchesRow');
cleanChilds(mr,0);