示例#1
0
function SieveSelectAction($action = null, $default = null)
{
    if ($action != null) {
        $_GET["SieveSelectAction"] = $action;
    }
    $text = "{sieve_" . $_GET["SieveSelectAction"] . "_text}";
    $sieve = new clSieve();
    if ($_GET["SieveSelectAction"] == 'vacation') {
        if ($default != null) {
            $tbl = explode('\\|\\|', $default);
            $default_days = $tbl[0];
            $default_subject = $tbl[1];
            $default_content = $tbl[2];
            $default_content = str_replace('<br>', "\n", $default_content);
        } else {
            $default_content = '{vacation_default}';
            $default_subject = 'i am in vacation';
            $default_days = "7";
        }
    }
    $vacation = "\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t<tr>\n\t<td align='right'><strong>{every}:&nbsp;</td>\n\t<td>" . Field_text('operations_days', $default_days, 'width:50px', null) . "&nbsp;<strong>{days}</strong></td>\n\t</tr>\t\n\t<td align='right'><strong>{subject}</strong>:&nbsp;</td><td>" . Field_text('operation_subject', $default_subject, 'width:300px', null) . "</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2><strong>{body}</strong>:&nbsp;<br>\n\t<TEXTAREA NAME='operation_message' id='operation_message' ROWS='12' COLS='50'>{$default_content}</TEXTAREA>\n\t</td>\n\t</table>";
    switch ($_GET["SieveSelectAction"]) {
        case 'reject':
            $field = "<br><textarea id='operation' style='width:100%;height:50px'>{$default}</textarea>";
            break;
        case 'fileinto':
            $field = Field_array_Hash($sieve->LoadImapFoldersList($_GET["userid"]), 'operation', $default, null, null, 0, 'width:300px');
            break;
        case 'redirect':
            $field = Field_text('operation', $default, 'width:300px', null);
            break;
        case 'vacation':
            $field = $vacation;
            break;
    }
    $html = "<div class=caption>{$text}</div>\n\t<div style='width:100%'>{$field}</div>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}