예제 #1
0
 function ehProcessDisplay($SQ, $rows_col, $row_rep)
 {
     $gp_process = gp('gp_process');
     $this->dispmode = $gp_process == 1 ? 'screen' : 'print';
     // Set the template
     $html_main = gp('gp_process') == 1 ? 'html_skin_tc_prscreen' : 'html_print';
     vgaSet('html_main', $html_main);
     // Execute the query, but do not retrieve
     $result = SQL($SQ);
     // Two counters:  PageNum, and RowNum, the row number
     // inside of a page.
     $this->PageNum = 1;
     $this->RowNum = 1;
     $this->RowsPerPage = 66;
     // In all cases, begin with a header
     $this->ehPDInit();
     if ($this->PageNum == 1) {
         $this->ehPDHeader($row_rep, $rows_col);
     }
     //  This is the basic output loop
     while ($row = SQL_Fetch_Array($result)) {
         arrayStripNumericIndexes($row);
         $this->ehPDRow($row);
         // Always increase row count.  For PDF, look for reset
         $RowNum++;
         if ($dispmode == 'print') {
             if ($RowNum > $RowsPerPage) {
                 $this->ehPDFooter();
                 $this->RowNum = 1;
                 $this->PageNum++;
                 $this->ehPDHeader($PageNum);
             }
         }
     }
     // In all Cases, end with a footer
     $this->ehPDFooter();
     $this->ehPDClose();
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
/**
* @deprecated
*/
function hDetailFromAHCols($ahcols, $name, $tabindex, $display = '')
{
    // Apply the names
    ahColsNames($ahcols, $name, $tabindex);
    //hprint_r($ahcols);
    //exit;
    // Always pull the previously generated calcrow and
    // update it with the name prefix, then save it back again.
    $calcRow = vgaGet('calcRow');
    $calcRow = str_replace('--NAME-PREFIX--', $name, $calcRow);
    vgaSet('calcRow', $calcRow);
    ob_start();
    $first = '';
    if ($display == '') {
        echo "\n<fieldset>";
    }
    foreach ($ahcols as $colname => $ahcol) {
        // Establish names of crucial items
        $cname = $ahcol['cname'];
        $cnmer = $cname . "_err";
        //  if no first focus, set it now
        if ($first == '' && vgfGet('HTML_focus') == '' && $ahcol['writable']) {
            vgfSet('HTML_focus', $cname);
        }
        // Replace out the HTML
        $html = $ahcol['htmlnamed'];
        // KFD 9/7/07, replace the HTML if it is a WYSIWYG column
        if ($ahcol['type_id'] == 'mime-h' || $ahcol['type_id'] == 'mime-h-f') {
            $html = '--MIME-H--' . $ahcol['cname'] . '--MIME-H--';
        }
        if ($ahcol['type_id'] == 'date') {
            jqDocReady("\$('input[data-date-format]').each(\n                function() {\n                    if (typeof(\$(this).attr('readonly')) == 'undefined') {\n                        \$(this).datepicker().on('changeDate',function() {\n                            \$(this).datepicker('hide');\n                        });\n                    }\n                });\n            ");
        }
        // Replace out the stuff to the right
        $hrgt = $ahcol['hrgtnamed'];
        switch ($display) {
            case '':
                echo "\n<div class=\"control-group {$cname}--ERROR--CLASS\"><label class=\"control-label\">" . $ahcol['description'] . ":</label>";
                echo "\n<div class=\"controls\">{$html} {$hrgt}";
                echo "\n<span class=\"help-inline\" id=\"{$cnmer}\">{$cname}--ERROR--</span>";
                echo "\n<span class=\"help-inline\">" . $ahcol['tooltip'] . "</span></div></div>";
                break;
            case 'tds':
                echo "\n<div class=\"controls\">{$html}</div>";
                break;
        }
    }
    if ($display == '') {
        echo "</fieldset>";
    }
    return ob_get_clean();
}
예제 #4
0
function index_hidden_x4Dispatch()
{
    # This is everything that *might* go back, make a place
    # for all of it
    $GLOBALS['AG']['x4'] = array('error' => array(), 'debug' => array(), 'notice' => array(), 'html' => array(), 'script' => array());
    # EXPERIMENTAL.
    # KFD 8/18/08.  Having any gp vars might be screwing things
    #               up, remove them.  Specifically it is screwing
    #               up the gp_command
    # KFD 9/10/08.  This belonged in gp_command processing,
    #               moved it to there.
    #gpUnsetPrefix('gpx');
    #gpUnsetPrefix('gp_');
    #gpUnsetPrefix('x2t_');
    #gpUnset('gpContext');
    # If they are not logged in, or have timed out,
    # send a redirection command to the login page
    #
    if (!LoggedIn()) {
        if (gpExists('json')) {
            x4Script("window.location='index.php?gp_page=x_login'");
            echo json_encode_safe($GLOBALS['AG']['x4']);
        } else {
            echo "<script>window.location='index.php?gp_page=x_login'</script>";
        }
        return;
    }
    // Determine the library to open.  If the page exists, open
    // it, otherwise use default
    //
    $x4Page = gp('x4Page');
    hidden('x4Page', $x4Page);
    # makes form submits come back here
    if (gpExists('db')) {
        index_hidden_x4DB();
    } else {
        if (file_exists("application/{$x4Page}.page.yaml")) {
            include 'androPage.php';
            $obj_page = new androPage();
            if ($obj_page->flag_buffer) {
                ob_start();
            }
            $obj_page->main($x4Page);
            if ($obj_page->flag_buffer) {
                x4HTML("*MAIN*", ob_get_clean());
            }
        } else {
            $object = x4Object($x4Page);
            # Determine method and invoke it.  Notice any
            # direct output is considered an error
            $method = gp('x4Action', 'main');
            ob_start();
            $object->{$method}();
            $errors = ob_get_clean();
            if ($errors != '') {
                x4Error($errors);
            }
        }
    }
    # Put errors in that were reported by database operations
    if (Errors()) {
        $errs = errorsGet();
        foreach ($errs as $err) {
            x4Error($err);
        }
    }
    # if the "json" flag is set, we return all output as JSON,
    # otherwise we package it up with the normal template and
    # return it as main content
    if (gp('json') == 1) {
        echo json_encode_safe($GLOBALS['AG']['x4']);
    } else {
        # Tell the client-side library to initialize the
        # 'inert' HTML that it received from us.
        #
        x4Script("x4.main()");
        # Don't need a form in x4 mode
        vgaSet('NOFORM', true);
        #  Put things where the template expects to find them
        vgfSet('HTML', $GLOBALS['AG']['x4']['html']['*MAIN*']);
        foreach ($GLOBALS['AG']['x4']['script'] as $script) {
            jqDocReady($script);
        }
        # DUPLICATE ALERT: This code copied from
        #                  index_hidden_page() below
        index_hidden_template('x4');
        global $J;
        $mainframe = $J['mainframe'];
        $my = $J['my'];
        $mosConfig_absolute_path = $J['mC_absolute_path'];
        $mosConfig_live_site = $J['mC_live_site'];
        $template_color = $J['template_color'];
        $template_color = 'red';
        $file = $GLOBALS['AG']['dirs']['root'] . '/templates/' . $mainframe->GetTemplate() . "/index.php";
        include $file;
    }
    return;
}