コード例 #1
0
ファイル: androX4.php プロジェクト: KlabsTechnology/andro
 function mainLayout(&$div)
 {
     # Add the top level item as an x4Pane so it will fade in
     $x4Window = html('div', $div);
     $x4Window->addClass('x4Window');
     $x4Window->addClass('x4Pane');
     $x4Window->hp['id'] = 'x4Window';
     $x4Window->setAsParent();
     # The first two are simple, a description
     # and the menu bar.  These are permanent and will
     # be displayed for the entire time.
     $h1 = html('h1', $x4Window, $this->dd['description']);
     $h1->hp['id'] = 'x4H1Top';
     # Add the menu bar
     $x4Window->addChild($this->menuBar($this->dd));
     # Temp
     #ob_start();
     #hprint_r($_SESSION);
     #$x4Window->h('div',ob_get_clean());
     #  This is the top level display item
     #
     $x4Display = html('div', $x4Window);
     $x4Display->addClass('x4Pane');
     $x4Display->addClass('x4TableTop');
     $x4Display->ap['xTableId'] = $this->table_id;
     $x4Display->hp['id'] = 'x4TableTop_' . $this->table_id;
     $x4Display->setAsParent();
     # Create a grid for the default display
     $grid = $this->grid($this->dd);
     $grid->addClass('x4VerticalScroll1');
     $x4Display->addChild($grid);
     # Create a container and tab bar,
     #
     $tabC = html('div', $x4Display);
     $tabC->addClass('x4Pane');
     $tabC->addClass('x4TabContainer');
     $tabCId = 'x4TabContainer_' . $this->table_id;
     $tabC->hp['id'] = $tabCId;
     $tabC->ap['xTableId'] = $this->table_id;
     $tabC->setAsParent();
     $tabB = html('div', $tabC);
     $tabB->addClass('x4TabBar');
     $tabB->addClass('x4Div');
     $tabBId = 'x4TabBar';
     $tabB->hp['id'] = $tabBId;
     # For now we create only one detail pane,
     # later on we want more
     #
     $tabid = 'tab_' . $this->dd['table_id'];
     $tabx = html('div', $tabC);
     $detail = $this->detailPane('');
     $detailId = $detail->hp['id'];
     $detail->addClass('x4VerticalScroll2');
     $tabC->addChild($detail);
     $span = html('a-void', $tabB, '1: Detail');
     $span->hp['xAction'] = 'Ctrl1';
     $span->hp['id'] = 'tabFor_' . $detailId;
     $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$detailId}')";
     # Child table panes are added in a loop because there
     # may be more than one
     #
     $tabNumber = 2;
     foreach ($this->dd['fk_children'] as $table_id => $info) {
         #  First break: uidisplay set to none
         if (trim(strtolower(arr($info, 'uidisplay', ''))) == 'none') {
             continue;
         }
         # Second break: user not allowed to see
         $perms = SessionGet('TABLEPERMSSEL');
         if (!in_array($table_id, $perms)) {
             continue;
         }
         # Second skip: user not allowed
         $ddChild = ddTable($table_id, true);
         if ($ddChild['perms']['sel'] === 0) {
             continue;
         }
         $tabid = 'x4TableTop_' . $table_id;
         x4Data('dd.' . $table_id, $ddChild);
         # Make a tableTop container
         $tabx = html('div', $tabC);
         $tabx->addClass('x4Pane');
         $tabx->addClass('x4TableTop');
         $tabx->hp['id'] = $tabid;
         $tabx->ap['xTableId'] = $table_id;
         $tabx->setAsParent();
         # Create an x4 object
         $chdobj = x4Object($table_id);
         # KFD 7/8/08, look for a "mover" box, and do an
         #             alternate setup
         $table_id = $this->dd['table_id'];
         $uidisplay = $ddChild['fk_parents'][$table_id]['uidisplay'];
         if (trim($uidisplay) == 'mover') {
             $tabx->addChild($this->mover($ddChild, $table_id));
         } else {
             # Add into it the grid and the detail
             $tabx->addChild($chdobj->grid($this->table_id));
             $tabx->addChild($chdobj->detailPane($this->table_id));
         }
         # Make the tab entry
         $span = html('a-void', $tabB, $tabNumber . ': ' . $ddChild['description']);
         $span->hp['xAction'] = 'Ctrl' . $tabNumber;
         $span->hp['id'] = 'tabFor_' . $tabid;
         $tabNumber++;
         $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$tabid}')";
     }
 }
コード例 #2
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;
}