Commit | Line | Data |
---|---|---|
ee524d70 PH |
1 | <?php |
2 | /******************************************************************************** | |
3 | * include/plugin_header.inc.php : The class for Header Based Match | |
4 | * ----------------------------- | |
5 | * | |
6 | * This file is part of the philter distribution | |
7 | * Copyright: See COPYING files that comes with this distribution | |
8 | ********************************************************************************/ | |
9 | ||
10 | class HdrPlugin extends MatchPlugin { | |
11 | function HdrPlugin($glob) { $this->MatchPlugin(false); } | |
12 | function rtti() { return 2; } | |
13 | function name() { return _i18n('2_hdr'); } | |
14 | ||
15 | function to_js() { | |
50f4c0cf PH |
16 | $_2_dests = _i18n('2_dests'); |
17 | $_2_contains = _i18n('2_contains'); | |
18 | $_2_not_contains = _i18n('2_not_contains'); | |
27c46cc1 PH |
19 | return <<<EOF |
20 | function(Node, data) { | |
ee524d70 PH |
21 | var i,j; |
22 | var sel = 0; | |
23 | ||
24 | Node.appendChild(document.createTextNode(' ')); | |
25 | ||
26 | var hdr_s = document.createElement('select'); | |
27 | hdr_s.setAttribute('name', Node.name+'[1]'); | |
28 | Node.appendChild(hdr_s); | |
29 | ||
50f4c0cf | 30 | hdr_s.options[0] = new Option('<$_2_dests>',0,false,data[1]==0); |
ee524d70 PH |
31 | hdr_s.options[1] = new Option('Subject:',1,false,data[1]==1); |
32 | hdr_s.options[2] = new Option('From:',2,false,data[1]==2); | |
33 | hdr_s.options[3] = new Option('To:',3,false,data[1]==3); | |
34 | hdr_s.options[4] = new Option('Cc:',4,false,data[1]==4); | |
35 | hdr_s.options[5] = new Option('Reply-To:',5,false,data[1]==5); | |
36 | hdr_s.options[6] = new Option('Organization:',6,false,data[1]==6); | |
37 | hdr_s.options[7] = new Option('List-Id:',7,false,data[1]==7); | |
38 | hdr_s.options[8] = new Option('X-Mailing-List:',8,false,data[1]==8); | |
ee524d70 PH |
39 | hdr_s.selectIndex = data[1]; |
40 | ||
f1abd4dd | 41 | Node.appendChild(document.createTextNode(' ')); |
ee524d70 PH |
42 | var op_s = document.createElement('select'); |
43 | op_s.setAttribute('name', Node.name+'[2]'); | |
44 | Node.appendChild(op_s); | |
45 | ||
50f4c0cf PH |
46 | op_s.options[0] = new Option('$_2_contains',0,false,data[2]==0); |
47 | op_s.options[1] = new Option('$_2_not_contains',1,false,data[2]==1); | |
ee524d70 PH |
48 | op_s.options[2] = new Option(' = ',2,false,data[2]==2); |
49 | op_s.options[3] = new Option(' != ',3,false,data[2]==3); | |
50 | op_s.options[4] = new Option(' >= ',4,false,data[2]==4); | |
51 | op_s.options[5] = new Option(' > ',5,false,data[2]==5); | |
52 | op_s.options[6] = new Option(' <= ',6,false,data[2]==6); | |
53 | op_s.options[7] = new Option(' < ',7,false,data[2]==7); | |
54 | op_s.selectIndex = data[2]; | |
55 | ||
f1abd4dd | 56 | Node.appendChild(document.createTextNode(' ')); |
ee524d70 PH |
57 | var txt_i = document.createElement('input'); |
58 | txt_i.setAttribute('type','text'); | |
59 | txt_i.setAttribute('name', Node.name+'[3]'); | |
e20c62c3 | 60 | txt_i.setAttribute('value', (data[3] ? data[3] : '') ); |
ee524d70 | 61 | Node.appendChild(txt_i); |
27c46cc1 PH |
62 | } |
63 | EOF; | |
ee524d70 PH |
64 | } |
65 | } | |
66 | ||
67 | /******************************************************************************** | |
68 | * $Id$ | |
69 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: | |
70 | ********************************************************************************/ | |
71 | ?> |