コード例 #1
0
ファイル: androLib.php プロジェクト: KlabsTechnology/andro
function x6Data($name, $data)
{
    $script = "\nx6.data.{$name} = " . json_encode_safe($data) . ";";
    x6Script($script);
}
コード例 #2
0
ファイル: androX6.php プロジェクト: KlabsTechnology/andro
    function profile_conventional()
    {
        # KFD 2/17/09 Sourceforge 2546056.  The dispatching system
        #             sends page requests here by default.  This is
        #             where we have to work out if there is a bad
        #             page request.
        if (!isset($this->dd['table_id'])) {
            ?>
            <h1>No Page By That Name</h1>
            
            <p>There is no page <b><?php 
            echo hx(gp('x6page'));
            ?>
</b>.
            <?php 
            return;
        }
        # KFD 2/9/09, new feature for Jeff/wholdist.  If "table_id_par"
        #             was passed in, load a certain row from the parent
        #             table into the bulletin board.  Specifically this
        #             is so the table can act like a child table
        #             w/respect to loading FETCH and FETCHDEF values.
        #             Maybe we'll do more with it later.
        $tid_par = gp('table_id_par', '');
        if ($tid_par != '') {
            $ddpar = ddTable($tid_par);
            $pks = explode(',', $ddpar['pks']);
            $aWhere = array();
            foreach ($pks as $pk) {
                $type_id = $ddpar['flat'][$pk]['type_id'];
                if (($pkval = gp('pre_' . $pk)) != '') {
                    $aWhere[] = $pk . '=' . SQL_Format($type_id, $pkval);
                }
            }
            $sql = 'select * from ' . ddView($tid_par) . ' where ' . implode('AND', $aWhere);
            $row = sql_oneRow($sql);
            x6Script("x6bb.fwSet('dbRow_{$tid_par}'," . json_encode($row) . ')');
        }
        # Grab the data dictionary for this table
        $dd = $this->dd;
        $table_id = $this->dd['table_id'];
        # KFD 4/15/09 Sourceforge 2765788, handle no kids gracefully,
        #             work out how many kids there are to display
        $kidCount = 0;
        foreach ($dd['fk_children'] as $child => $info) {
            if (trim(arr($info, 'x6display', '')) != 'none') {
                $kidCount++;
            }
        }
        # Create the top level div as a table controller
        $top = new androHTMLTableController($table_id);
        $top->addClass('fadein');
        # Various heights.  Assume all borders are the same and get
        # only one.
        $hinside = x6cssDefine('insideheight');
        $hh1 = x6cssHeight('h1');
        $htabs = x6cssHeight('.ui-tabs-nav li');
        $hborder = x6cssRuleSize('ui-tabs-panel', 'border-top');
        $pad0 = x6cssDefine('pad0');
        $hlh = x6CssDefine('lh0');
        # $hpane1 is the outer, it is what is left after removing
        # h1, one row of tabs, and padding at bottom.
        # KFD 4/15/09 Sourceforge 2765788, if no kids, correct height
        if ($kidCount == 0) {
            $htabs = 0;
        }
        $hpane1 = $hinside - $hh1 - $htabs - $pad0 * 2;
        # $hchild is the height of the empty nested tab
        # pane, hardcoded at pad0.  This is where the child
        # tables are initially displayed -- at the bottom of the
        # detail pane.  They are initially slid all of the way down,
        # that is why their height is only pad0.
        $hempty = $pad0;
        # $hdetail is the height of the detail pane inside of the
        # detail tab.  It is the $hpane1 less another tab (the
        # nested one), and $hempty, and a double padding
        $hdetail = $hpane1 - $htabs - $hempty - $pad0 * 2;
        # Begin with title and tabs
        $top->h('h1', $dd['description']);
        if (method_exists($this, 'insert_belowh1')) {
            $this->insert_belowh1($top);
        }
        $options = array('x6profile' => 'conventional', 'x6table' => $table_id);
        $tabs = $top->addTabs('tabs_' . $table_id, $hpane1, $options);
        $lookup = $tabs->addTab('Lookup');
        $detail = $tabs->addTab('Detail', true);
        # Make a generic grid, which will show all uisearch
        # columns, and add a row of lookup inputs to it.
        # Enclose it in a div that gives some padding on top
        # and bottom.  Divide up the left-right free space to
        # put 1/3 on the left and the remaining on the right.
        $divgrid = $lookup->h('div');
        $grid = $divgrid->addGrid($hpane1 - $hlh * 2, $table_id, true, true);
        $grid->hp['x6profile'] = 'conventional';
        $gridWidth = $this->gridGeneric($grid, $dd);
        # Work out the available free width after making the grid
        $wAvail = x6cssDefine('insidewidth') - 2 - x6cssDefine('pad0') * 2 - $gridWidth;
        $divgrid->hp['style'] = "padding-left: " . intval($wAvail / 3) . "px;\n             padding-top: " . x6CSSDefine('lh0') . "px;";
        # tell the browse tab object to focus when it is selected
        $lookup->hp['x6objectFocusId'] = $grid->hp['id'];
        # This is kind of a hack for forcing exact matches when
        # a maintenance screen is invoked with pre-set parameters
        if (gp('x6exactPre') == 1) {
            $grid->hp['x6exactPre'] = 1;
        }
        # We are making
        # the assumption that there will *always* be child tables
        # because otherwise the programmer would have selected
        # a different profile.
        #
        $divDetail = $detail->addDetail($dd['table_id'], true, $hdetail, $tid_par);
        $divDetail->addCustomButtons($this->customButtons());
        $divDetail->ap['xTabSelector'] = $tabs->ul->hp['id'];
        $divDetail->ap['xTabIndex'] = 1;
        $divDetail->ap['x6profile'] = 'conventional';
        $detail->hp['x6objectFocusId'] = $divDetail->hp['id'];
        # KFD 5/27/09 Google #21 Allow user to override the detail
        if (method_exists($this, $table_id . '_detail')) {
            $method = $table_id . '_detail';
            $this->{$method}($divDetail);
        }
        # The div kids is a tabbar of child tables.  Notice that we
        # put nothing into them.  They are loaded dynamically when
        # the user picks them.
        $options = array('x6slideUp' => $divDetail->hp['id'], 'x6slideUpInner' => $divDetail->innerId, 'x6parentTable' => $table_id, 'x6profile' => 'kids', 'x6table' => $table_id, 'styles' => array('overflow' => 'hidden'));
        # KFD 4/15/09 Sourcefroge 2765788 no kids handle gracefully
        if ($kidCount > 0) {
            $tabKids = $detail->addTabs('kids_' . $table_id, $hempty, $options);
            $tabKids->ul->hp['xOffset'] = 2;
            $tab = $tabKids->addTab("Hide");
            $idx = 0;
            foreach ($dd['fk_children'] as $child => $info) {
                # KFD 1/2/09.  If x6display is 'none', skip it
                if (trim(arr($info, 'x6display', '')) == 'none') {
                    continue;
                }
                $tc = $top->addTableController($child);
                $tc->hp['x6tablepar'] = $table_id;
                $tab = $tabKids->addTab($info['description']);
                $tab->ap['x6tablePar'] = $table_id;
                $tab->ap['x6table'] = $child;
                if ($info['x6childwrites'] == 'detail') {
                    # Create the basic detail
                    $modal = new androHTMLDetail($child, true, 700, $table_id);
                    # KFD 5/27/09 Google #21 Allow user to override
                    if (method_exists($this, $child . '_detail')) {
                        $method = $child . '_detail';
                        $this->{$method}($modal);
                    }
                    # Now see if we need to add buttons
                    if (file_exists(fsDirtop() . "application/x6{$child}.php")) {
                        include_once fsDirtop() . "application/x6{$child}.php";
                        $childClass = 'x6' . $child;
                        $objChild = new $childClass();
                        $custom = $objChild->customButtons();
                        $modal->addCustomButtons($custom);
                    }
                    # Tell framework to add it to the output.
                    addModal($modal);
                }
            }
            # And then loop through extra tabs
            foreach ($this->appTabs as $child => $caption) {
                $top->addTableController($child);
                $tab = $tabKids->addTab($caption);
                $tab->hp['x6tablePar'] = $table_id;
                $tab->hp['x6table'] = $child;
            }
        }
        # tell the screen to start out by focusing on
        # the browse
        jqDocReady("x6events.fireEvent('objectFocus','{$grid->hp['id']}')");
        # KFD 3/20/09 Sourceforge 2697962
        #             index_hidden calls this now
        #$this->hldOut($top);
        $top->render();
    }