* * Licensed under the GNU GPL. For full terms see the file COPYING that came * with the Squirrelmail distribution. * */ /** * This file contains functions that spit out HTML, mostly intended for use by * addrule.php and edit.php. */ /** * Start form. */ function avelsieve_printheader() { global $PHP_SELF; print '
'; } /** * Print bottom control and navigation buttons. */ function printaddbuttons() { global $part; print ''; if ($part!=1) { print ''; } print '
'; if (($part < 1) || ($part > 4)) { return; } if ($part!=1) { print ''; } if ($part=="4") { print ''; } else { print ''; } } /** * Print simple footer that closes tables, form and HTML. */ function printnakedfooter() { print '
'; } /** * Print mailbox select widget. * * @param $selectname name for the select HTML variable * @param $selectedmbox which mailbox to be selected in the form */ function printmailboxlist($selectname, $selectedmbox) { global $boxes, $imap_server_type; if (count($boxes)) { $mailboxlist = ' '; } else { print ' '; } print $tp['name']; print '
'; print $tp['description']; print '
'; } } function print_2_1_addressmatch() { print _("The rule will trigger if the following addresses appear anywhere in the message's headers:"); /* TODO */ } /* * Header match stuff functions. */ /** * Print listbox widget with available headers to choose from. * * @param $selected_header Selected header * @param $n option number */ function print_header_listbox($selected_header, $n) { global $headers; print ''; } function print_matchtype_listbox($selected_matchtype, $n) { global $matchtypes, $comparators, $matchregex, $sieve_capabilities; reset($matchtypes); reset($comparators); reset($matchregex); print ''; } function print_condition_listbox($selected_condition) { $conditions = array( "and" => _("AND (Every item must match)"), "or" => _("OR (Either item will match)") ); print _("The condition for the following rules is:"); print ''; } function print_2_2_headermatch($items) { global $HTTP_POST_VARS, $maxitems, $edit, $matchtypes, $comparators; print ''; if(isset($edit)) { if(isset($_SESSION['rules'][$edit]['condition'])) { $condition = $_SESSION['rules'][$edit]['condition']; } else { $condition = "and"; /* FIXME */ } if(isset($_SESSION['rules'][$edit]['header'])) $header = $_SESSION['rules'][$edit]['header']; if(isset($_SESSION['rules'][$edit]['matchtype'])) $matchtype = $_SESSION['rules'][$edit]['matchtype']; if(isset($_SESSION['rules'][$edit]['headermatch'])) $headermatch = $_SESSION['rules'][$edit]['headermatch']; } else { if(isset($_POST['condition'])) { $condition = $_POST['condition']; } else { $condition = false; } if(isset($_POST['header'])) { $header = $_POST['header']; } else { $header = false; } if(isset($_POST['matchtype'])) { $matchtype = $_POST['matchtype']; } else { $matchtype = false; } if(isset($_POST['headermatch'])) { $headermatch = $_POST['headermatch']; } else { $headermatch = false; } } if($items > 1) { print_condition_listbox($condition); } print '

'; if($items > 1) { print ''; } if($items < $maxitems) { print ''; } } function print_2_3_sizematch() { global $edit; print '

'; print _("This rule will trigger if message is"); print ''; print _("than"); print '

'; } function print_2_4_allmessages() { print _("The following action will be applied to all incoming messages that do not match any of the previous rules."); } function print_2_5_bodymatch() { print '

'; print _("This rule will trigger upon the occurrence of one or more strings in the body of an e-mail message. "); } function print_3_action_checkedaction($num, $selectedaction) { print ''; } function print_3_action() { /* Preferences from config.php */ global $useimages, $translate_return_msgs; /* Data taken from addrule.php */ global $boxes, $createnewfolder, $emailaddresses, $sieve_capabilities; /* If editing an existing rule */ global $edit, $selectedmailbox; if(isset($edit)) { $selectedaction = $_SESSION['rules'][$edit]['action']; } else { $selectedaction = 1; } //print '' print '

'; print _("Choose what to do when this rule triggers, from one of the following:"); /*-*-*-*/ print '

'; print_3_action_checkedaction(1, $selectedaction); print _("Keep (Default action)"); print '
'; /*-*-*-*/ print_3_action_checkedaction(2, $selectedaction); print _("Discard Silently"); print '
'; /*-*-*-*/ if(avelsieve_capability_exists('reject')) { print_3_action_checkedaction(3, $selectedaction); print _("Reject, sending this excuse to the sender:"); print '

'; } /*-*-*-*/ print_3_action_checkedaction(4, $selectedaction); print _("Redirect to the following email address:"); print '

'; /*-*-*-*/ if(avelsieve_capability_exists('fileinto')) { print_3_action_checkedaction(5, $selectedaction); global $selectedmailbox; print _("Move message into"); if(isset($edit)) { /* The section here will be slightly different for the edit * page. This part takes care of this. */ print ' '; print _("the existing folder"); print ' '; print printmailboxlist("folder", $selectedmailbox); } else { /* This is the section for the addrule part. Is it kludgy? Is * it? IS IT? :-p */ print '
'; print _("the existing folder"); print ' '; print printmailboxlist("folder", $selectedmailbox); if ($createnewfolder) { print '
'; print _("a new folder, named"); print ' '; print _("created as a subfolder of"); print printmailboxlist("subfolder", false); } } if(avelsieve_capability_exists('imapflags')) { if(isset($edit)) { print '
'; } print '
'; print _("Also keep copy in INBOX, marked as deleted."); } print '
'; print '
'; } /*-*-*-*/ if(avelsieve_capability_exists('vacation')) { print_3_action_checkedaction(6, $selectedaction); global $emailaddresses; print '"'; print _("Vacation"); print '":'; print _("The notice will be sent only once to each person that sends you mail, and will not be sent to a mailing list address."); print '
'; print _("Addresses: Only reply if sent to these addresses:"); print '
'; print _("Days: Reply message will be resent after"); print ' '; print _("days"); print '
'; print _("Use the following message:"); print '

'; } /*-*-*-*/ print '

'. _("Additional Actions") . '

'; /*-*-*-*/ /* STOP */ print ' '; if ($useimages) { print '';
		print _( '; } else { print ""._("STOP").": "; } print _("If this rule matches, do not check any rules after it."); /*-*-*-*/ /* Notify */ if(avelsieve_capability_exists('notify')) { global $notifymethods, $notifystrings; print '
'; print _("Notify me, using the following method:"); if(is_array($notifymethods)) { print ''; } elseif($notifymethods == false) { print ''; } print '
'; print _("Notification ID") . ": "; print '
'; print _("Parameters") . ": "; print '
'; global $prioritystrings; print 'Priority:
'; print _("Message") . " "; print '
'; print ''; print _("Help: Valid variables are:"); print ' $from$, $env-from$, $subject$, $text$, $text[n]$'; print '
'; } } function print_4_confirmation() { /* global $sieverule; */ global $text; print '

'; print _("Your new rule states:"); print '

'.$text.'

'; print _("If this is what you wanted, select Finished. You can also start over or cancel adding a rule altogether."); print '

'; } ?>