예제 #1
0
        // In case we changed $_SESSION but display() calls mpSessReadOnly()
        // This save won't stop the session from being automatically saved again
        // after display() and the end of the page.
        // (Though display() shouldn't write to $_SESSION anyway, except events!)
        // However: this can truncate the session file just as a background job
        // is starting, so launchBackground() makes the session read-only,
        // so this call does nothing in that case.
        mpSaveSession();
    } else {
        $GLOBALS['badEventOccurred'] = true;
        mpLog("bad-event:Event ID '{$eid}' is unknown for page {$page['delegate']}. No action taken.");
    }
}
// Clean up from event processing //////////////////////////////////////////////
clearEventHandlers();
// events defined by previous display() are not valid
// Handle a return from a called page //////////////////////////////////////////
// This should now be possible but has not been implemented yet.
// pageReturn() should set global variables ($page_return_callback and _argument)
// and there should be a while() loop here to process multi-level returns.
// Display user interface //////////////////////////////////////////////////////
$page = end($_SESSION['pages']);
// not a ref; read only
$delegate = makeDelegateObject();
// Can't call mpSessReadOnly() or we won't be able to create events.
// Other than events, display() shouldn't write to the session though.
// Not a variable function name; UI function is always 'display()'
$delegate->display($page['context']);
// creates a HTML UI
mpLogPath($page['delegate']);
// for tracking the user's path thru the system later
예제 #2
0
 /**
 * FUNKY: This simulates being on the upload page and then calls the appropriate
 * event handler depending on whether a file has been uploaded or not...
 * Don't try this at home!
 */
 function onUploadOrFetch()
 {
     //$req = $_REQUEST;
     $hasUpload = isset($_FILES['uploadFile']) && $_FILES['uploadFile']['error'] != UPLOAD_ERR_NO_FILE;
     $hasFetch = isset($_REQUEST['pdbCode']) && $_REQUEST['pdbCode'] != "";
     pageCall("upload_setup.php");
     // or else a later pageReturn() will screw us up!
     $upload_delegate = makeDelegateObject();
     if ($hasUpload) {
         if ($_REQUEST['uploadType'] == 'pdb') {
             $upload_delegate->onUploadPdbFile();
         } elseif ($_REQUEST['uploadType'] == 'xray') {
             $upload_delegate->onUploadXray();
         } elseif ($_REQUEST['uploadType'] == 'kin') {
             $upload_delegate->onUploadKinemage();
         } elseif ($_REQUEST['uploadType'] == 'map') {
             $upload_delegate->onUploadMapFile();
         } elseif ($_REQUEST['uploadType'] == 'hetdict') {
             $upload_delegate->onUploadHetDictFile();
         }
     } elseif ($hasFetch) {
         if ($_REQUEST['fetchType'] == 'pdb') {
             $upload_delegate->onFetchPdbFile();
         } elseif ($_REQUEST['fetchType'] == 'pdb_xray') {
             $_REQUEST['xray'] = 1;
             $upload_delegate->onFetchPdbFile();
         } elseif ($_REQUEST['fetchType'] == 'biolunit_xray') {
             $_REQUEST['biolunit'] = 1;
             $_REQUEST['xray'] = 1;
             $upload_delegate->onFetchPdbFile();
         } elseif ($_REQUEST['fetchType'] == 'biolunit') {
             $_REQUEST['biolunit'] = 1;
             $upload_delegate->onFetchPdbFile();
         } elseif ($_REQUEST['fetchType'] == 'eds_2fofc') {
             $_REQUEST['eds_2fofc'] = 1;
             $upload_delegate->onFetchEdsMap();
         } elseif ($_REQUEST['fetchType'] == 'eds_fofc') {
             $_REQUEST['eds_fofc'] = 1;
             $upload_delegate->onFetchEdsMap();
         }
     } else {
         $upload_delegate->onUploadPdbFile();
     }
 }