Beispiel #1
0
function schedule()
{
    $tpl = new templates();
    $sock = new sockets();
    $page = CurrentPageName();
    $sock->getFrameWork("cmd.php?apt-mirror-schedule=yes");
    $config = unserialize(base64_decode($sock->GET_INFO("AptMirrorConfigSchedule")));
    $table = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>&nbsp;</th>\n\t<th>{schedules}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $cron = new cron();
    if (is_array($config)) {
        while (list($uid, $schedule) = each($config)) {
            $schedule_enc = base64_encode($schedule);
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            $array_text = $cron->ParseCronCommand("{$schedule} toto /dev/null", null, 1, true);
            $delete = imgtootltip("delete-32.png", "{delete}", "MirDelCron('{$schedule_enc}')");
            $table = $table . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td width=99%><strong style='font-size:14px'>{$array_text}</strong><br><div style='font-size:10px;text-align:right'><i>{$schedule}</i></div></td>\n\t\t\t<td width=1%>{$delete}</td>\n\t\t\t</tr>\n\t\t\t";
        }
    }
    $table = $table . "</tbody></table>";
    $html = "<div id='schedule-div'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend nowrap width=1%>{schedule}:</td>\n\t\t<td width=99%>" . Field_text("mirror-schedule", null, "font-size:15px;padding:3px;width:100%") . "</td>\n\t\t<td width=1%>" . button("{select}", "Loadjs('cron.php?field=mirror-schedule')") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "SaveScheduleMirror()") . "</td>\n\t</tr>\n\t</table>\n\t<br>\n\t{$table}\n\t</div>\n\t\n\t\n\t\n\t<script>\n\tvar x_SaveScheduleMirror= function (obj) {\n\t\t\tRefreshTab('mirror_tabs');\n\t\t}\n\t\n\t\n\tfunction SaveScheduleMirror(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('mirror-schedule',document.getElementById('mirror-schedule').value);\n\t\tdocument.getElementById('schedule-div').innerHTML='<center style=\"margin:20px;padding:20px\"><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveScheduleMirror);\n\t}\n\t\n\tfunction MirDelCron(pattern){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('mirror-del-schedule',pattern);\n\t\tdocument.getElementById('schedule-div').innerHTML='<center style=\"margin:20px;padding:20px\"><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveScheduleMirror)\t\n\t}\n\n\t</script>";
    echo $tpl->_ENGINE_parse_body($html);
}