* @copyright 2004-2007 The SquirrelMail Project Team, Alexandros Vellis
* @package plugins
* @subpackage avelsieve
*/
/** Includes */
include_once(SM_PATH . 'plugins/avelsieve/include/html_main.inc.php');
/**
* HTML Output functions for rule editing / adding
*/
class avelsieve_html_rules extends avelsieve_html {
/**
* @param array SIEVE Rules that are to be printed.
*/
var $rules = array();
/**
* @param string Display mode: 'verbose','terse','source' or 'debug'
*/
var $mode = 'terse';
/**
* Constructor function, that initializes the environment for proper
* displaying of the rules table.
*
* @return void
*/
function avelsieve_html_rules(&$rules, $mode = 'terse') {
global $avelsieve_maintypes, $scriptHints;
$this->avelsieve_html();
$this->rules = $rules;
$this->mode = $mode;
// These UI "hints" are initialized and discovered in the table.php script.
if(isset($scriptHints)) {
$this->scriptHints = $scriptHints;
}
}
/**
* "Create new rules" text, for when no rules exist.
* @return string
*/
function rules_create_new() {
return '
'.
_("Here you can add or delete filtering rules for your email account. These filters will always apply to your incoming mail, wherever you check your email.").
'
' .
'
' . _("You don't have any rules yet. Feel free to add any with the button "Add a New Rule". When you are done, please select "Save Changes" to get back to the main options screen.") . "
"._("Here you can add or delete filtering rules for your email account. These filters will always apply to your incoming mail, wherever you check your email.")."
";
}
if($conservative) {
$out .= "
"._("When you are done with editing, remember to select "Save Changes" to activate your changes!")."
"._("The following table summarizes your current mail filtering rules.")."
";
return $out;
}
/**
* Output UI-friendly script "hints":
* 1) "inconsistent" folders: a folder is mentioned in "fileinto", but the
* actual folder does not exist.
* 2) warning that vacation rule is active. (so that the user will not forget
* to disable it when she comes from vacation).
*
* @return string
*/
function scripthints() {
global $color;
$out = '';
// 1) inconsistent folders / fileinto
if(!empty($this->scriptHints['inconsistent_folders'])) {
$out .= '
' .
($this->useimages ? ''. ' ' : '' ) .
_("Warning: In your rules, you have defined an action that refers to a folder that does not exist or a folder where you do not have permission to append to.") .
'
';
}
// 2) vacation rule is active
if(!empty($this->scriptHints['vacation_rules'])) {
$fnum = $this->scriptHints['vacation_rules'][0]; // First rule number
$out .= '
' .
($this->useimages ? ''. ' ' : '' ) .
sprintf( _("Note: A Vacation Autoresponder is active (Rule #%s in your current Mail Filtering Rules). Don't forget to disable it or delete it when you are back."),
'edit.php?edit='.$fnum, '#rule_row_'.$fnum, $fnum+1) .
'
';
}
return $out;
}
/**
* Rules Table Header + 1st row, which is the heading
* @return string
*/
function rules_table_header() {
global $color, $displaymodes;
$out = '