Sieve enotify/notify:

- GUI for importance setting
- make tests usable for checking the GUI
pull/24/head
Paweł Słowik 12 years ago
parent 2cdaa79dce
commit 3c99599794

@ -102,6 +102,10 @@ $labels['notifyaddress'] = 'To e-mail address:';
$labels['notifybody'] = 'Notification body:';
$labels['notifysubject'] = 'Notification subject:';
$labels['notifyfrom'] = 'Notification sender:';
$labels['notifyimportance'] = 'Importance:';
$labels['notifyimportancelow'] = 'low';
$labels['notifyimportancenormal'] = 'normal';
$labels['notifyimportancehigh'] = 'high';
$labels['filtercreate'] = 'Create filter';
$labels['usedata'] = 'Use following data in the filter:';
$labels['nextstep'] = 'Next Step';

@ -93,6 +93,10 @@ $labels['notifyaddress'] = 'To e-mail address:';
$labels['notifybody'] = 'Notification body:';
$labels['notifysubject'] = 'Notification subject:';
$labels['notifyfrom'] = 'Notification sender:';
$labels['notifyimportance'] = 'Importance:';
$labels['notifyimportancelow'] = 'low';
$labels['notifyimportancenormal'] = 'normal';
$labels['notifyimportancehigh'] = 'high';
$labels['filtercreate'] = 'Create filter';
$labels['usedata'] = 'Use following data in the filter:';
$labels['nextstep'] = 'Next Step';

@ -108,6 +108,10 @@ $labels['notifyaddress'] = 'Na adres e-mail:';
$labels['notifybody'] = 'Treść powiadomienia:';
$labels['notifysubject'] = 'Temat powiadomienia:';
$labels['notifyfrom'] = 'Nadawca powiadomienia:';
$labels['notifyimportance'] = 'Priorytet:';
$labels['notifyimportancelow'] = 'niski';
$labels['notifyimportancenormal'] = 'normalny';
$labels['notifyimportancehigh'] = 'wysoki';
$labels['filtercreate'] = 'Utwórz filtr';
$labels['usedata'] = 'Użyj następujących danych do utworzenia filtra:';
$labels['nextstep'] = 'Następny krok';

@ -629,6 +629,7 @@ class managesieve extends rcube_plugin
$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);
$notifyimp = get_input_value('_action_notifyimportance', RCUBE_INPUT_POST);
// we need a "hack" for radiobuttons
foreach ($sizeitems as $item)
@ -897,6 +898,7 @@ class managesieve extends rcube_plugin
$this->form['actions'][$i]['body'] = $notifybodies[$idx];
$this->form['actions'][$i]['message'] = $notifymessages[$idx];
$this->form['actions'][$i]['from'] = $notifyfrom[$idx];
$this->form['actions'][$i]['importance'] = $notifyimp[$idx];
break;
}
@ -1613,6 +1615,20 @@ class managesieve extends rcube_plugin
.'<input type="text" name="_action_notifyfrom['.$id.']" id="action_notifyfrom'.$id.'" '
.'value="' . Q($action['from']) . '" size="35" '
. $this->error_class($id, 'action', 'from', 'action_notifyfrom') .' />';
$importance_options = array(
3 => 'notifyimportancelow',
2 => 'notifyimportancenormal',
1 => 'notifyimportancehigh'
);
$select_importance = new html_select(array(
'name' => '_action_notifyimportance[' . $id . ']',
'id' => '_action_notifyimportance' . $id,
'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance')));
foreach ($importance_options as $io_v => $io_n) {
$select_importance->add(Q($this->gettext($io_n)), $io_v);
}
$out .= '<br /><span class="label">' . Q($this->gettext('notifyimportance')) . '</span><br />';
$out .= $select_importance->show(array(intval($action['importance'])));
$out .= '</div>';
// mailbox select

@ -1,16 +1,19 @@
require ["enotify","variables"];
# rule:[notify1]
if header :contains "from" "boss@example.org"
{
notify :importance "1" :message "This is probably very important" "mailto:alm@example.com";
stop;
}
# rule:[subject]
if header :matches "Subject" "*"
{
set "subject" "${1}";
}
# rule:[from notify2]
if header :matches "From" "*"
{
set "from" "${1}";
notify :importance "3" :message "${from}: ${subject}" "mailto:alm@example.com";
}
notify :importance "3" :message "${from}: ${subject}" "mailto:alm@example.com";

@ -1,15 +1,18 @@
require ["envelope","variables","enotify"];
# rule:[from]
if envelope :all :matches "from" "*"
{
set "env_from" " [really: ${1}]";
}
# rule:[subject]
if header :matches "Subject" "*"
{
set "subject" "${1}";
}
# rule:[from notify]
if address :all :matches "from" "*"
{
set "from_addr" "${1}";
notify :message "${from_addr}${env_from}: ${subject}" "mailto:alm@example.com";
}
notify :message "${from_addr}${env_from}: ${subject}" "mailto:alm@example.com";

Loading…
Cancel
Save