* @copyright 2002-2009 Alexandros Vellis * @package plugins * @subpackage avelsieve */ /** * Notify Action */ class avelsieve_action_notify extends avelsieve_action { var $num = 0; var $name = 'notify'; var $options = array( 'notify' => array( 'on' => '', 'method' => '', 'id' => '', 'options' => '' ) ); var $capability = 'notify'; var $image_src = 'images/icons/email.png'; var $two_dimensional_options = true; /** * The notification action is a bit more complex than the others. The * oldcyrus variable is for supporting the partially implemented notify * extension implementation of Cyrus < 2.3. * * @see https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=2135 */ function avelsieve_action_notify(&$s, $rule = array()) { $this->init(); global $notifymethods, $avelsieve_oldcyrus; if(isset($notifymethods)) { $this->notifymethods = $notifymethods; } else { $this->notifymethods = false; } $this->text = _("Notify"); $this->helptxt = _("Send a notification "); $this->notifystrings = array( 'sms' => _("Mobile Phone Message (SMS)") , 'mailto' => _("Email notification") , 'zephyr' => _("Notification via Zephyr") , 'icq' => _("Notification via ICQ") ); $this->oldcyrus = $avelsieve_oldcyrus; $this->avelsieve_action($s, $rule); } /** * Notify Options * @param array $val * @return string */ function options_html($val) { global $prioritystrings; $out = '
'; $out .= ''; /* TODO Not really used, reconsider / remove it. */ $dummy = _("Notification ID"); // for gettext /* $out .= _("Notification ID") . ": "; $out .= '
'; */ $out .= ''; $out .= '
'. _("Method") . ': '; if(is_array($this->notifymethods) && sizeof($this->notifymethods) == 1) { /* No need to provide listbox, there's only one choice */ $out .= ''; if(array_key_exists($this->notifymethods[0], $this->notifystrings)) { $out .= $this->notifystrings[$this->notifymethods[0]]; } else { $out .= $this->notifymethods[0]; } } elseif(is_array($this->notifymethods)) { /* Listbox */ $out .= ''; } elseif($this->notifymethods == false) { $out .= ''; } $out .= '
'. _("Destination") . ": ". ''. '
'. _("Priority") . ':'. ''. ''. '
'; $out .= ''. _("Help: Valid variables are:"); if($this->oldcyrus) { /* $text$ is not supported by Cyrus IMAP < 2.3 . */ $out .= ' $from$, $env-from$, $subject$'; } else { $out .= ' $from$, $env-from$, $subject$, $text$, $text[n]$'; } $out .= '
'; return $out; } }