/** * This routine will accept the name of a class, instantiates an object, * and call's the object's "main" method. In Andromeda, the "main" * method always outputs HTML. * * This is a handy way to "redirect" from one page to another. If * execution has passed to Page1.main, and the code determines that * execution must go to Page2.main, then you can issue * * <code> * <div class="PHP"> * objPageMain('Page2'); * </div> * </code> * * This routine will ''not'' wipe out HTML that has been output before it * is called. To avoid the HTML from one page appearing on the next, * be sure to call this routine before HTML has been generated. * * INPUTS * string $class Class Name */ function objPageMain($class) { $obj = objPage($class); $obj->main(); }
function main() { // ------------------------------------------------ // Branch out to ajax handling functions if (gpExists('fwajax')) { return $this->FWAjax(); } // ...early return // ------------------------------------------------ // Public sites can turn off table maintenance pages if (vgfGet('suppress_maintenance', false)) { return; } vgfset('maintenance', true); # KFD 2/17/09 Sourceforge 2546056 # If we are in default main code branch, and # there is no data dictionary, the user has # called a bad page. if (!isset($this->table['projections'])) { ?> <h1>Bad Page Request</h1> <p>There is no page <?php echo hx(gp('gp_page')); ?> <?php return; } // If a "fk jump", retrieve skey and make it look // like an edit call. if (gp('gp_pk') != '') { $pkval = gp("gp_pk"); $pkcol = $this->table["pks"]; $pktyp = $this->table['flat'][$pkcol]["type_id"]; $table_id = $this->table["table_id"]; // KFD 10/26/06, used to be $table_id $sq = "SELECT skey FROM " . $this->view_id . " WHERE " . $pkcol . " = " . SQL_Format($pktyp, $pkval); gpSet('gp_skey', SQL_OneValue('skey', $sq)); gpSet('gp_mode', 'upd'); } // If we were invoked by a child table, don't do this if (is_null($this->table_obj_child)) { // KFD 10/26/06, keep as $table_id Hidden('gp_page', $this->table_id); // always return to same page Hidden('gp_mode', ''); Hidden('gp_skey', ''); Hidden('gp_action', ''); Hidden('gp_save', ''); hidden('gp_copy', ''); } // Work out what to do if mode is blank. Might mean // upd, might mean browse. $mode = gp('gp_mode'); $skey = gp('gp_skey'); if ($mode == '') { $mode = $this->MainCheckForMover(); if ($mode == '') { $mode = $skey == '' ? 'browse' : 'upd'; gpSet('gp_mode', $mode); } } $this->mode = $mode; // KFD 8/13/07, Experimental COPY ability if (gp('gp_action') == 'copy') { $mode = 'ins'; gpSet('gp_mode', 'ins'); } switch ($mode) { case 'search': $this->PageSubtitle .= " (Lookup Mode)"; break; case 'ins': $this->PageSubtitle .= " (New Entry)"; break; } // ---------------------------------------------- // Generate the main HTML elements if ($mode == 'browse') { $this->hBrowse(); } elseif ($mode == 'mover') { $this->hMover(); } else { $this->hBoxes($mode); } if ($mode != "mover") { $this->hButtonBar($mode); } $this->hLinks($mode); $this->hExtra($mode); // Now if this is a child table in a 1:M, it will not actually // output its own stuff, it will invoke its parent, so let's // buffer the output if ($this->table_id_parent != '') { ob_start(); } // Echo out the HTML $this->ehMain(); // Put this out at end, after all HTML has been output if ($mode == "search") { //$controls=vgfGet('gpControls'); $controls = ContextGet('OldRow'); $hScript = ''; foreach ($controls as $key => $info) { $hScript .= "\nob('x2t_{$key}').value='';"; } jqDocReady("function clearBoxes() { \n" . $hScript . "}\n\n"); } // Again, if this is a child table in a 1:M, capture the output and // make it the responsibility of the parent if ($this->table_id_parent != '') { $this->h['Complete'] = ob_get_clean(); // Wipe out and replace all gp variables, fool the parent object $OldRow = ContextGet('OldRow', array()); $gpsave = aFromGP('gp_'); gpUnsetPrefix('gp_'); $dd = ContextGet('drilldown', array()); $dd1 = array_pop($dd); gpSet('gp_skey', $dd1['skey']); // Now invoke the parent object, tell it about us $object = objPage($this->table_id_parent); $object->table_obj_child = $this; $object->main(); // Replace the wiped out gp variables gpUnsetPrefix('gp_'); gpSetFromArray('gp_', $gpsave); ContextSet('OldRow', $OldRow); // Force the menu to come from the parent vgaSet('menu_selected', $this->table_id_parent); } }