| 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() { |
| 16 | return |
| 17 | "function(Node, data) { |
| 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); |
| 36 | hdr_s.options[9] = new Option('<"._i18n('2_daemon').">',9,false,data[1]==9); |
| 37 | hdr_s.selectIndex = data[1]; |
| 38 | |
| 39 | Node.appendChild(document.createTextNode(' ')); |
| 40 | var op_s = document.createElement('select'); |
| 41 | op_s.setAttribute('name', Node.name+'[2]'); |
| 42 | Node.appendChild(op_s); |
| 43 | |
| 44 | op_s.options[0] = new Option('"._i18n('2_contains')."',0,false,data[2]==0); |
| 45 | op_s.options[1] = new Option('"._i18n('2_not_contains')."',1,false,data[2]==1); |
| 46 | op_s.options[2] = new Option(' = ',2,false,data[2]==2); |
| 47 | op_s.options[3] = new Option(' != ',3,false,data[2]==3); |
| 48 | op_s.options[4] = new Option(' >= ',4,false,data[2]==4); |
| 49 | op_s.options[5] = new Option(' > ',5,false,data[2]==5); |
| 50 | op_s.options[6] = new Option(' <= ',6,false,data[2]==6); |
| 51 | op_s.options[7] = new Option(' < ',7,false,data[2]==7); |
| 52 | op_s.selectIndex = data[2]; |
| 53 | |
| 54 | Node.appendChild(document.createTextNode(' ')); |
| 55 | var txt_i = document.createElement('input'); |
| 56 | txt_i.setAttribute('type','text'); |
| 57 | txt_i.setAttribute('name', Node.name+'[3]'); |
| 58 | txt_i.setAttribute('value', (data[3] ? data[3] : '') ); |
| 59 | Node.appendChild(txt_i); |
| 60 | }"; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /******************************************************************************** |
| 65 | * $Id$ |
| 66 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: |
| 67 | ********************************************************************************/ |
| 68 | ?> |