From 2e7bd6dab7de8553984d1d31034b34c595cef5ee Mon Sep 17 00:00:00 2001 From: Paweł Słowik Date: Thu, 30 Aug 2012 20:11:44 +0200 Subject: Sieve enotify/notify - GUI --- plugins/managesieve/managesieve.php | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'plugins/managesieve/managesieve.php') diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index e7828f1da..16c451845 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -625,6 +625,10 @@ class managesieve extends rcube_plugin $varnames = get_input_value('_action_varname', RCUBE_INPUT_POST); $varvalues = get_input_value('_action_varvalue', RCUBE_INPUT_POST); $varmods = get_input_value('_action_varmods', RCUBE_INPUT_POST); + $notifyaddrs = get_input_value('_action_notifyaddress', RCUBE_INPUT_POST); + $notifybodies = get_input_value('_action_notifybody', RCUBE_INPUT_POST); + $notifymessages = get_input_value('_action_notifymessage', RCUBE_INPUT_POST); + $notifyfrom = get_input_value('_action_notifyfrom', RCUBE_INPUT_POST); // we need a "hack" for radiobuttons foreach ($sizeitems as $item) @@ -878,6 +882,22 @@ class managesieve extends rcube_plugin $this->errors['actions'][$i]['value'] = $this->gettext('cannotbeempty'); } break; + + case 'notify': + if (empty($notifyaddrs[$idx])) { + $this->errors['actions'][$i]['address'] = $this->gettext('cannotbeempty'); + } + else if (!check_email($notifyaddrs[$idx])) { + $this->errors['actions'][$i]['address'] = $this->gettext('noemailwarning'); + } + if (!empty($notifyfrom[$idx]) && !check_email($notifyfrom[$idx])) { + $this->errors['actions'][$i]['from'] = $this->gettext('noemailwarning'); + } + $this->form['actions'][$i]['address'] = $notifyaddrs[$idx]; + $this->form['actions'][$i]['body'] = $notifybodies[$idx]; + $this->form['actions'][$i]['message'] = $notifymessages[$idx]; + $this->form['actions'][$i]['from'] = $notifyfrom[$idx]; + break; } $this->form['actions'][$i]['type'] = $type; @@ -1479,6 +1499,9 @@ class managesieve extends rcube_plugin if (in_array('variables', $this->exts)) { $select_action->add(Q($this->gettext('setvariable')), 'set'); } + if (in_array('enotify', $this->exts)) { + $select_action->add(Q($this->gettext('notify')), 'notify'); + } $select_action->add(Q($this->gettext('rulestop')), 'stop'); $select_type = $action['type']; @@ -1571,6 +1594,27 @@ class managesieve extends rcube_plugin } $out .= ''; + // notify + // skip :options tag - not used by the mailto method + $out .= '
'; + $out .= '' .Q($this->gettext('notifyaddress')) . '
' + .'error_class($id, 'action', 'address', 'action_notifyaddress') .' />'; + $out .= '
'. Q($this->gettext('notifybody')) .'
' + .'\n"; + $out .= '
' .Q($this->gettext('notifysubject')) . '
' + .'error_class($id, 'action', 'message', 'action_notifymessage') .' />'; + $out .= '
' .Q($this->gettext('notifyfrom')) . '
' + .'error_class($id, 'action', 'from', 'action_notifyfrom') .' />'; + $out .= '
'; + // mailbox select if ($action['type'] == 'fileinto') $mailbox = $this->mod_mailbox($action['target'], 'out'); -- cgit v1.2.3