Commit | Line | Data |
---|---|---|
cac0c87c PH |
1 | <?php |
2 | /******************************************************************************** | |
3 | * include/plugin_forward.inc.php : The class for forwards | |
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 AddHdrPlugin extends ActionPlugin { | |
11 | function AddHdrPlugin() { $this->ActionPlugin(); } | |
12 | function rtti() { return 3; } | |
13 | function name() { return _i18n('3_add_hdr'); } | |
14 | ||
15 | function to_js() { | |
16 | return <<<EOF | |
17 | function(Node, data) { | |
18 | var i,j; | |
19 | var sel = 0; | |
20 | ||
21 | Node.appendChild(document.createElement('br')); | |
22 | Node.appendChild(document.createTextNode('X-')); | |
23 | ||
24 | var hdr_i = document.createElement('input'); | |
25 | hdr_i.setAttribute('type', 'text'); | |
26 | hdr_i.setAttribute('name', Node.name+'[1]'); | |
27 | hdr_i.setAttribute('value', (data[1] ? data[1] :'') ); | |
28 | Node.appendChild(hdr_i); | |
29 | ||
30 | Node.appendChild(document.createTextNode(': ')); | |
31 | ||
32 | var val_i = document.createElement('input'); | |
33 | val_i.setAttribute('type', 'text'); | |
34 | val_i.setAttribute('name', Node.name+'[2]'); | |
35 | val_i.setAttribute('value', (data[2] ? data[2] :'') ); | |
36 | Node.appendChild(val_i); | |
37 | } | |
38 | EOF; | |
39 | } | |
40 | ||
41 | function to_string($_data) { | |
42 | return " xfilter \"reformail -A 'X-" | |
43 | .addslashes($_data[1]).": " | |
44 | .addslashes($_data[2])."'\"\n"; | |
45 | } | |
46 | } | |
47 | ||
48 | /******************************************************************************** | |
49 | * $Id$ | |
50 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: | |
51 | ********************************************************************************/ | |
52 | ?> |