}
$buttons = "";
if (isset($_REQUEST['new'])) {
    $new = true;
} else {
    $new = false;
}
if (isset($_REQUEST['edit']) || $new) {
    $edit = true;
} else {
    $edit = false;
}
$del = isset($_REQUEST['del']);
if (isset($_REQUEST['Actie'])) {
    if (!$del || !delActie($_REQUEST['Actie'])) {
        $Actie = readActie($_REQUEST['Actie']);
    } else {
        $Actie = false;
    }
    // delete was a succes!
} else {
    if ($new) {
        $Actie = new Actie();
    } else {
        $Actie = false;
    }
}
if ($Actie) {
    writeHead("<TITLE>Actie - Meterkast - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="js/edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="js/navigate.js"></SCRIPT>') . "\n");
    if ($edit) {
        echo '<FORM name="editForm" action="' . $_SERVER['PHP_SELF'] . '" method="POST" class="Edit">';
 // $havops=array();
 function trygetActie($file, $op)
 {
     foreach ($file->get_compilations() as $c) {
         if ($c['operatie'] == $op) {
             return $c['id'];
         }
     }
     return false;
 }
 foreach (getEachOperatie() as $opid) {
     if ($op = readOperatie($opid)) {
         echo '<LI id="op' . $opid . '">' . $op->get_naam() . ': <SPAN>';
         // reason that getName() is not shown as htmlspecialchars: only the Admin can change this, and maybe he'd like to put in an image, such as the LaTeX logo
         if ($actid = trygetActie($file, $opid)) {
             if ($act = readActie($actid)) {
                 $target = escapeshellcmd(COMPILATIONS_PATH . $file->getId() . '_' . $opid . '/');
                 $source = escapeshellcmd(FILEPATH . $file->getId() . '.adl');
                 $compileurl = '' . sprintf($op->get_outputURL(), $target, $source, $file->getId(), USER);
                 if ($act->get_error()) {
                     echo $act->get_error();
                 } else {
                     if ($act->get_compiled()) {
                         echo '<A HREF="' . $compileurl . '" target="_blank"/><IMG SRC="' . IMGPATH . 'ok.png" /></A>';
                     } else {
                         echo '<small><A href="JavaScript:compile(\'' . $opid . '\');">Uitvoeren</A></small>';
                     }
                 }
             } else {
                 echo '<small><A href="JavaScript:compile(\'' . $opid . '\');">Uitvoeren</A></small>';
             }