$p->display(); if (isset($_POST["bconfirm"])) { $ret = msc_download_file($_GET['objectUUID']); if (is_array($ret) && ($ret[0] === True)) { new NotifyWidgetSuccess(_T('The download is in progress.', 'msc')); } else { if ($ret[1] == 1) { new NotifyWidgetFailure(_T("A file is already being downloaded.", "msc")); } else { new NotifyWidgetFailure(_T("The download has failed.", "msc")); } } } $ajax = new AjaxFilter(urlStrRedirect('base/computers/ajaxDownloadFile', array('objectUUID' => $_GET['objectUUID']))); $ajax->setRefresh(web_def_refresh_time()); $ajax->display(); $f = new Form(array('id' => 'dl')); $f->addSummary(_T('Click below to start downloading file from this computer. Warning: the download may last a long time', 'msc')); $computer = getMachine(array('uuid'=>$_GET['objectUUID']), $ping = False); $f->addButton('bconfirm', sprintf(_T('Start download from computer %s', 'msc'), $computer->hostname)); $f->display(); print '<br />'; $ajax->displayDivToUpdate(); ?>
$actionRemove = new ActionPopupItem(_T("Delete file", "msc"), "download_file_remove", "delete", "msc", "base", "computers"); $actionsdl = array(); $actionsrm = array(); $fnames = array(); $flengths = array(); $ftimestamps = array(); $fcomputers = array(); $finodes = array(); $states = array(); $computersCache = array(); foreach ($files as $file) { $uuid = $file[1]; if (array_key_exists($uuid, $computersCache)) { $computer = $computersCache[$uuid]; } else { $computer = getMachine(array('uuid' => $uuid), $ping = False); $computersCache[$uuid] = $computer; } if (strlen($filter) == 0 || strlen($filter) > 0 && (strpos($file[0], $filter) !== False || strpos($computer->hostname, $filter) !== False)) { $fnames[] = $file[0]; $fcomputers[] = $computer->hostname; $ftimestamps[] = _toDate($file[2]); $finodes[] = array("id" => $file[4], "objectUUID" => $_GET["objectUUID"]); if ($file[0] == '' && $file[3] == 0) { $states[] = _T('Downloading', 'msc'); $flengths[] = ''; $actionsdl[] = new EmptyActionItem(); $actionsrm[] = new EmptyActionItem(); } else { if ($file[0] == '' && $file[3] == -1) { $states[] = _T('Error', 'msc');
<?php /************************ dispatcher.php This process continuously checks whether there exist unjudged submissions. If there's unjudged submissions, start 'submit_curl.php' process to send it to a available judge VM. **************************/ require_once "dispatcherFunction.php"; writeLog("================================"); writeLog("================================"); $machine = getMachine(); if ($machine != null) { initMachine($machine); } else { writeLog("get machine file error"); } print_r($machine); $i = 0; echo "submit_test start<br>"; writeLog("dispatcher start"); while (1) { /*sleep(10);*/ $con = get_database_object(); $sidQuery = "SELECT * FROM problem_submission WHERE status = 'WAIT' ORDER BY id ASC LIMIT 100"; $sidRs = mysql_query($sidQuery) or die(mysql_error()); echo "sidRsNum" . mysql_num_rows($sidRs) . "\n"; while ($sidRow = mysql_fetch_array($sidRs)) { $sid = $sidRow['id']; $pid = $sidRow['problem_id']; $problemQuery = "SELECT * FROM problem_problem where id = '{$pid}'"; $problemRs = mysql_query($problemQuery);
// Vars seeding $from = quick_get('from'); $pid = quick_get('pid'); $p_api = new ServerAPI(); $p_api->fromURI(quick_get("papi")); $name = quick_get('ltitle'); if (!isset($name) || $name == '') { $name = getPackageLabel($p_api, quick_get('pid')); } // form design $f = new ValidatingForm(); // display top label if (isset($_GET['uuid']) && $_GET['uuid']) { $hostname = $_GET['hostname']; $uuid = $_GET['uuid']; $machine = getMachine(array('uuid' => $uuid), True); $hostname = $machine->hostname; $label = new RenderedLabel(3, sprintf(_T('Single advanced launch : action "%s" on "%s"', 'msc'), $name, $machine->hostname)); $f->push(new Table()); $f->add(new HiddenTpl("uuid"), array("value" => $uuid, "hide" => True)); $f->add(new HiddenTpl("name"), array("value" => $hostname, "hide" => True)); } else { $gid = $_GET['gid']; $group = new Group($gid, true); if ($group->exists != False) { if (quick_get('convergence')) { $label = new RenderedLabel(3, sprintf(_T('Software Convergence: action "%s" on "%s"', 'msc'), $name, $group->getName())); } else { $label = new RenderedLabel(3, sprintf(_T('Group Advanced launch : action "%s" on "%s"', 'msc'), $name, $group->getName())); } $f->push(new Table());
require_once('modules/msc/includes/machines.inc.php'); require_once('modules/msc/includes/widgets.inc.php'); require_once('modules/base/computers/localSidebar.php'); require_once('graph/navbar.inc.php'); require_once("modules/pulse2/includes/utilities.php"); if (!isset($_GET['hostname'])) { $_GET['hostname'] = $_GET['cn']; } if (!isset($_GET['uuid'])) { $_GET['uuid'] = $_GET['objectUUID']; } /* * Display right top shortcuts menu */ right_top_shortcuts_display(); if ($_GET['uuid']) { $machine = getMachine(array('uuid'=>$_GET['uuid'])); if ($machine->uuid != $_GET['uuid']) { $p = new PageGenerator(sprintf(_T("%s's computer secure control", 'msc'), $_GET['hostname'])); $p->setSideMenu($sidemenu); $p->display(); include('modules/msc/msc/header.php'); } else { if (empty($_GET['hostname'])) $_GET['hostname'] = $machine->hostname; $p = new TabbedPageGenerator(); $p->setSideMenu($sidemenu); $p->addTop(sprintf(_T("%s's computer secure control", 'msc'), $machine->hostname), "modules/msc/msc/header.php"); $p->addTab("tablaunch", _T("Launch Actions", 'msc'), "", "modules/msc/msc/launch.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname)); $p->addTab("tabbundle", _T("Launch Bundle", 'msc'), "", "modules/msc/msc/launch_bundle.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname)); $p->addTab("tablogs", _T("Logs", 'msc'), "", "modules/msc/msc/logs.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname)); $p->addTab("tabhistory", _T("History", 'msc'), "", "modules/msc/msc/history.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname)); $p->display();
function machineExists($h_params) { $machine = getMachine($h_params); return $machine->hostname != ''; }
} else { $name = $_GET["machine"]; } /* If the edit form has been submited */ if (isset($_POST["bmachineedit"])) { list($name, $description, $enabled) = _parseEditMachineForm(); $editSuccess = editMachine($name, array($name, $description, $enabled)); if (!isXMLRPCError() and $editSuccess) { new NotifyWidgetSuccess(_T("Computer successfully modified.")); header("Location: " . urlStrRedirect("samba4/machines/index")); exit; } } /* Showing the edit machine details form */ if ($name) { $machineDetails = getMachine($name); $form = new ValidatingForm(); $form->push(new Table()); $tr = new TrFormElement(_T("Computer name", "samba4"), new HiddenTpl("name")); $form->add($tr, array("value" => $machineDetails["name"], "required" => True)); $tr = new TrFormElement(_T("Computer description", "samba4"), new InputTpl("description")); $form->add($tr, array("value" => $machineDetails["description"], "required" => True)); $tr = new TrFormElement(_T("Computer account is enabled", "samba4"), new CheckboxTpl("enabled"), array("tooltip" => _T("If checked, the computer account is enabled", "samba4"))); $form->add($tr, array("value" => $machineDetails["enabled"] ? "checked" : "")); $form->addButton("bmachineedit", _("Confirm")); $form->display(); } /* Private functions */ function _parseEditMachineForm() { $FH = new FormHandler("editMachineFH", $_POST);