to_header_string was a bad idea...
[old-projects.git] / philter / philter / include / plugin_header.inc.php
CommitLineData
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
10class 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() {
27c46cc1
PH
16 return <<<EOF
17function(Node, data) {
ee524d70
PH
18 var i,j;
19 var sel = 0;
20
21 Node.appendChild(document.createTextNode(' '));
22
23 var hdr_s = document.createElement('select');
24 hdr_s.setAttribute('name', Node.name+'[1]');
25 Node.appendChild(hdr_s);
26
27 hdr_s.options[0] = new Option('<"._i18n('2_dests').">',0,false,data[1]==0);
28 hdr_s.options[1] = new Option('Subject:',1,false,data[1]==1);
29 hdr_s.options[2] = new Option('From:',2,false,data[1]==2);
30 hdr_s.options[3] = new Option('To:',3,false,data[1]==3);
31 hdr_s.options[4] = new Option('Cc:',4,false,data[1]==4);
32 hdr_s.options[5] = new Option('Reply-To:',5,false,data[1]==5);
33 hdr_s.options[6] = new Option('Organization:',6,false,data[1]==6);
34 hdr_s.options[7] = new Option('List-Id:',7,false,data[1]==7);
35 hdr_s.options[8] = new Option('X-Mailing-List:',8,false,data[1]==8);
ee524d70
PH
36 hdr_s.selectIndex = data[1];
37
f1abd4dd 38 Node.appendChild(document.createTextNode(' '));
ee524d70
PH
39 var op_s = document.createElement('select');
40 op_s.setAttribute('name', Node.name+'[2]');
41 Node.appendChild(op_s);
42
43 op_s.options[0] = new Option('"._i18n('2_contains')."',0,false,data[2]==0);
44 op_s.options[1] = new Option('"._i18n('2_not_contains')."',1,false,data[2]==1);
45 op_s.options[2] = new Option(' = ',2,false,data[2]==2);
46 op_s.options[3] = new Option(' != ',3,false,data[2]==3);
47 op_s.options[4] = new Option(' >= ',4,false,data[2]==4);
48 op_s.options[5] = new Option(' > ',5,false,data[2]==5);
49 op_s.options[6] = new Option(' <= ',6,false,data[2]==6);
50 op_s.options[7] = new Option(' < ',7,false,data[2]==7);
51 op_s.selectIndex = data[2];
52
f1abd4dd 53 Node.appendChild(document.createTextNode(' '));
ee524d70
PH
54 var txt_i = document.createElement('input');
55 txt_i.setAttribute('type','text');
56 txt_i.setAttribute('name', Node.name+'[3]');
e20c62c3 57 txt_i.setAttribute('value', (data[3] ? data[3] : '') );
ee524d70 58 Node.appendChild(txt_i);
27c46cc1
PH
59}
60EOF;
ee524d70
PH
61 }
62}
63
64/********************************************************************************
65* $Id$
66* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
67********************************************************************************/
68?>