custom header plugin header plugin bugfix : undefined was as a value when
[old-projects.git] / philter / philter / include / plugin_custheader.inc.php
1 <?php
2 /********************************************************************************
3 * include/plugin_custheader.inc.php : The class for Custom 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 CustHdrPlugin extends MatchPlugin {
11 function HdrPlugin($glob) { $this->MatchPlugin(false); }
12 function rtti() { return 3; }
13 function name() { return _i18n('3_cust_hdr'); }
14
15 function to_js() {
16 return
17 "function(Node, data) {
18 var i,j;
19 var sel = 0;
20
21 Node.appendChild(document.createTextNode(' '));
22 var txt_i = document.createElement('input');
23 txt_i.setAttribute('type','text');
24 txt_i.setAttribute('name', Node.name+'[1]');
25 txt_i.setAttribute('value', (data[1] ? data[1] :'') );
26 Node.appendChild(txt_i);
27
28 Node.appendChild(document.createTextNode(' '));
29 var op_s = document.createElement('select');
30 op_s.setAttribute('name', Node.name+'[2]');
31 Node.appendChild(op_s);
32
33 op_s.options[0] = new Option('"._i18n('3_contains')."',0,false,data[2]==0);
34 op_s.options[1] = new Option('"._i18n('3_not_contains')."',1,false,data[2]==1);
35 op_s.options[2] = new Option(' = ',2,false,data[2]==2);
36 op_s.options[3] = new Option(' != ',3,false,data[2]==3);
37 op_s.options[4] = new Option(' >= ',4,false,data[2]==4);
38 op_s.options[5] = new Option(' > ',5,false,data[2]==5);
39 op_s.options[6] = new Option(' <= ',6,false,data[2]==6);
40 op_s.options[7] = new Option(' < ',7,false,data[2]==7);
41 op_s.selectIndex = data[2];
42
43 Node.appendChild(document.createTextNode(' '));
44 var txt_i = document.createElement('input');
45 txt_i.setAttribute('type','text');
46 txt_i.setAttribute('name', Node.name+'[3]');
47 txt_i.setAttribute('value', (data[3] ? data[3] : '') );
48 Node.appendChild(txt_i);
49 }";
50 }
51 }
52
53 /********************************************************************************
54 * $Id$
55 * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
56 ********************************************************************************/
57 ?>