From e20c62c3b01ed29b7fcefc8ec20a290b5370d72c Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 12 Sep 2003 07:37:56 +0000 Subject: [PATCH] custom header plugin header plugin bugfix : undefined was as a value when data[3] was null --- philter/philter/include/plugin_custheader.inc.php | 57 ++++++++++++++++++++++ philter/philter/include/plugin_header.inc.php | 2 +- philter/philter/install.d/config.inc.php | 1 + .../philter/locales/plugins/custheader.en.inc.php | 17 +++++++ .../philter/locales/plugins/custheader.fr.inc.php | 17 +++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 philter/philter/include/plugin_custheader.inc.php create mode 100644 philter/philter/locales/plugins/custheader.en.inc.php create mode 100644 philter/philter/locales/plugins/custheader.fr.inc.php diff --git a/philter/philter/include/plugin_custheader.inc.php b/philter/philter/include/plugin_custheader.inc.php new file mode 100644 index 0000000..ca179ba --- /dev/null +++ b/philter/philter/include/plugin_custheader.inc.php @@ -0,0 +1,57 @@ +MatchPlugin(false); } + function rtti() { return 3; } + function name() { return _i18n('3_cust_hdr'); } + + function to_js() { + return +"function(Node, data) { + var i,j; + var sel = 0; + + Node.appendChild(document.createTextNode(' ')); + var txt_i = document.createElement('input'); + txt_i.setAttribute('type','text'); + txt_i.setAttribute('name', Node.name+'[1]'); + txt_i.setAttribute('value', (data[1] ? data[1] :'') ); + Node.appendChild(txt_i); + + Node.appendChild(document.createTextNode(' ')); + var op_s = document.createElement('select'); + op_s.setAttribute('name', Node.name+'[2]'); + Node.appendChild(op_s); + + op_s.options[0] = new Option('"._i18n('3_contains')."',0,false,data[2]==0); + op_s.options[1] = new Option('"._i18n('3_not_contains')."',1,false,data[2]==1); + op_s.options[2] = new Option(' = ',2,false,data[2]==2); + op_s.options[3] = new Option(' != ',3,false,data[2]==3); + op_s.options[4] = new Option(' >= ',4,false,data[2]==4); + op_s.options[5] = new Option(' > ',5,false,data[2]==5); + op_s.options[6] = new Option(' <= ',6,false,data[2]==6); + op_s.options[7] = new Option(' < ',7,false,data[2]==7); + op_s.selectIndex = data[2]; + + Node.appendChild(document.createTextNode(' ')); + var txt_i = document.createElement('input'); + txt_i.setAttribute('type','text'); + txt_i.setAttribute('name', Node.name+'[3]'); + txt_i.setAttribute('value', (data[3] ? data[3] : '') ); + Node.appendChild(txt_i); +}"; + } +} + +/******************************************************************************** +* $Id$ +* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: +********************************************************************************/ +?> diff --git a/philter/philter/include/plugin_header.inc.php b/philter/philter/include/plugin_header.inc.php index 96dad0f..8b044c5 100644 --- a/philter/philter/include/plugin_header.inc.php +++ b/philter/philter/include/plugin_header.inc.php @@ -55,7 +55,7 @@ class HdrPlugin extends MatchPlugin { var txt_i = document.createElement('input'); txt_i.setAttribute('type','text'); txt_i.setAttribute('name', Node.name+'[3]'); - txt_i.setAttribute('value', data[3]); + txt_i.setAttribute('value', (data[3] ? data[3] : '') ); Node.appendChild(txt_i); }"; } diff --git a/philter/philter/install.d/config.inc.php b/philter/philter/install.d/config.inc.php index bad906d..622c835 100644 --- a/philter/philter/install.d/config.inc.php +++ b/philter/philter/install.d/config.inc.php @@ -32,6 +32,7 @@ $philter->config['path']['spool'] = "/var/spool/philter"; $philter->register_global_plugin(new BogoPlugin(true)); $philter->register_plugin(new HdrPlugin(false)); +$philter->register_plugin(new CustHdrPlugin(false)); $philter->register_plugin(new FwdPlugin()); $philter->register_plugin(new AutoReplyPlugin()); diff --git a/philter/philter/locales/plugins/custheader.en.inc.php b/philter/philter/locales/plugins/custheader.en.inc.php new file mode 100644 index 0000000..0903eb2 --- /dev/null +++ b/philter/philter/locales/plugins/custheader.en.inc.php @@ -0,0 +1,17 @@ +config['i18n']['3_cust_hdr'] = 'Custom Header'; +$philter->config['i18n']['3_contains'] = 'contains'; +$philter->config['i18n']['3_not_contains'] = 'contains not'; + +/******************************************************************************** +* $Id$ +* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: +********************************************************************************/ +?> diff --git a/philter/philter/locales/plugins/custheader.fr.inc.php b/philter/philter/locales/plugins/custheader.fr.inc.php new file mode 100644 index 0000000..965f11f --- /dev/null +++ b/philter/philter/locales/plugins/custheader.fr.inc.php @@ -0,0 +1,17 @@ +config['i18n']['3_hdr'] = 'EntĂȘte Perso.'; +$philter->config['i18n']['3_contains'] = 'contient'; +$philter->config['i18n']['3_not_contains'] = 'ne contient pas'; + +/******************************************************************************** +* $Id$ +* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: +********************************************************************************/ +?> -- 2.1.4