Exemple #1
0
 function makeComplete($table_id, $height, $parTable)
 {
     # The complete track is much more involved, adds
     # buttons and a status bar at bottom.
     $this->addClass('box2');
     $this->hp['xInitDisabled'] = 'Y';
     $pad0 = x6CssDefine('pad0');
     $this->hp['style'] = "height: {$height}px;\n            padding-left: {$pad0}px;\n            padding-right: {$pad0}px;";
     $this->hp['xInnerWidthLost'] = $pad0 * 2 + x6cssRuleSize('.box2', 'border-left') + x6cssRuleSize('.box2', 'border-right') + x6cssRuleSize('.box1', 'border-left') + x6cssRuleSize('.box1', 'border-right') + $pad0 * 7;
     // padding left and right of box1
     # Always need this
     $dd = ddTable($table_id);
     # Now for the display
     # Put some buttons on users
     $this->addButtonBar();
     # KFD 1/29/09 break out pk/fk columns
     if ($parTable == '') {
         $colsFK = array();
     } else {
         #echo $table_id;
         #hprint_r($dd['fk_parents']);
         $x = $dd['fk_parents'][$parTable]['cols_both'];
         $x = explode(',', $x);
         foreach ($x as $pair) {
             list($chd, $par) = explode(':', $pair);
             $colsFK[$chd] = $par;
         }
     }
     # Put in a div that will be the inner box
     #
     $div = $this->h('div');
     $div->addClass('box1');
     $table = $div->h('table');
     $table->hp['style'] = 'float: left; margin-right: 20px';
     $table->addClass('x6Detail');
     $this->inputsTable = $table;
     $cols = projectionColumns($dd, '');
     # KFD 1/2/08.  Loop through columns and try to find anything
     #              with an x6breakafter.  If found, do not break
     #              every 17, use the instructions in x6breakafter.
     $break17 = true;
     foreach ($cols as $idx => $col) {
         if (arr($dd['flat'][$col], 'x6breakafter', '') != '') {
             $break17 = false;
             break;
         }
     }
     # Define this outside the loop, it is used to make
     # xdefsrc inside of the loop
     $fetches = array('fetchdef', 'fetch', 'distribute');
     $options = array('xTabGroup' => 'ddisp_' . $table_id);
     foreach ($cols as $idx => $col) {
         if ($break17) {
             if ($idx > 0 && $idx % 17 == 0) {
                 $this->inputsTable = $div->h('table');
                 $this->inputsTable->hp['style'] = 'float: left';
                 $this->inputsTable->addClass('x6Detail');
             }
         }
         # KFD 1/29/09.  If detail that is child of a parent,
         #               see if this column needs to pull
         if (!isset($colsFK[$col])) {
             $xoptions = $options;
         } else {
             $xoptions = array_merge($options, array('attributes' => array('xdefsrc' => $parTable . '.' . $colsFK[$col])));
         }
         # KFD 2/4/09. If this is in the fetch family, set its
         #             xdefsrc
         $autoid = strtolower($dd['flat'][$col]['automation_id']);
         if (in_array($autoid, $fetches)) {
             $xoptions = array_merge($options, array('attributes' => array('xdefsrc' => strtolower($dd['flat'][$col]['auto_formula']))));
         }
         $this->addTRInput($dd, $col, $xoptions);
         $x6ba = trim(arr($dd['flat'][$col], 'x6breakafter', ''));
         if ($x6ba == 'column') {
             $this->inputsTable = $div->h('table');
             $this->inputsTable->hp['style'] = 'float: left';
             $this->inputsTable->addClass('x6Detail');
         }
         if ($x6ba == 'line') {
             $tr = $this->inputsTable->h('tr');
             $td = $tr->h('td', ' ');
             $td->hp['colspan'] = 2;
         }
     }
     # Calculate height of inner area
     $hinner = $height - $pad0 * 2 - x6cssDefine('lh0') - x6cssRuleSize('.box1', 'border-top') - x6cssRuleSize('.box1', 'border-bottom') - x6cssRuleSize('.box1', 'padding-top') - x6cssRuleSize('.box1', 'padding-bottom') - x6cssHeight('div.x6buttonBar a.button');
     $div->hp['style'] = "height: {$hinner}px; clear: both; \n            overflow-y: scroll; position: relative;\n            padding: {$pad0}px;";
     # Keep track of the inner div for possible additions
     $div->hp['id'] = $this->innerId;
     $lineheight = x6cssHeight('td.x6Caption');
     $emptyHeight = $hinner - $lineheight * count($cols) - (count($cols) - 1);
     // borders between rows
     $this->hp['xInnerHeight'] = $hinner;
     $this->hp['xInnerEmpty'] = $emptyHeight;
     $this->innerDiv = $div;
     $sb = $this->h('div');
     $sb->addClass('statusBar');
     $sbl = $sb->h('div');
     $sbl->addClass('sbleft');
     $sbl->hp['id'] = 'sbl_' . $table_id;
     $sbr = $sb->h('div');
     $sbr->addClass('sbright');
     $sbr->hp['id'] = 'sbr_' . $table_id;
     return $emptyHeight;
 }
    function x6main()
    {
        $top = html('div');
        $top->addClass('fadein');
        $top->h('h1', 'User Options');
        $height = x6cssdefine('insideheight') - x6cssHeight('h1') * 2;
        $pad1 = x6cssDefine('pad1');
        $tabs = $top->addTabs('useroptions', $height);
        # --------------------------------------------------------------
        # This is skin stuff
        # --------------------------------------------------------------
        $tab1 = $tabs->addTab('Appearance');
        $tab1->hp['style'] = "padding: {$pad1}px";
        $file = fsDirTop() . 'templates/x6/skinsphp/x6skins.ser.txt';
        $skins = unserialize(file_get_contents($file));
        $select = html('select');
        $cookie = arr($_COOKIE, 'x6skin', 'Default.Gray.1024');
        foreach ($skins as $name => $stats) {
            $option = $select->h('option', $name);
            $option->hp['value'] = $stats;
            # Note that $cookie was defined above
            if ($cookie == $stats) {
                $option->hp['selected'] = 'selected';
            }
        }
        $select->hp['onchange'] = 'x6ChangeSkin(this)';
        ob_start();
        ?>
        
        <script>
        window.x6ChangeSkin = function(select) {
            // Sourceforge 2753325 use quirksmode-supplied set cookie
            createCookie('x6skin',select.value,3650);
            //document.cookie 
            //    = "x6skin="+select.value+"; expires=12/31/2049 00:00:00;";
            window.location.reload(true);
        }
        </script>
        <h2>Skin Selection</h2>
        Skin: <?php 
        echo $select->render();
        ?>
        <?php 
        $tab1->setHtml(ob_get_clean());
        # <------- EARLY RETURN
        #
        if (!inGroup('debugging')) {
            $top->render();
            return;
        }
        # --------------------------------------------------------------
        # Now for javascript and logging
        # --------------------------------------------------------------
        $tab2 = $tabs->addTab('Javascript Development');
        $tab2->hp['style'] = "padding: {$pad1}px";
        $tab2->h('h2', 'Alternate Javascript Files');
        $tab2->h('p', 'You can use this feature to debug and enhance the
            Andromeda Javascript files without having a complete installation.
            Here is how it works:');
        $ul = $tab2->h('ul');
        $ul->h('li', 'Use Firebug to make local copies of x6.js and androLib.js');
        $ul->h('li', 'Put these files somewhere you can edit them which is also
              on a <i>publicly visible website</i>.');
        $ul->h('li', 'Put the address of the public website here, including a
              trailing slash.');
        $ul->h('li', '<span style="color:red">If you make a mistake and the files
              are not visible, this demo will stop working.  Close your
              browser and try again.</span>');
        $tab2->h('span', 'Alternate Location:&nbsp;&nbsp;');
        $input = html('input');
        $input->hp['size'] = 70;
        $input->hp['id'] = 'altjs';
        $input->hp['value'] = arr($_COOKIE, 'altjs', '');
        $input->code['change'] = <<<JS
        function(input) {
            createCookie('altjs',input.value);
        }
JS;
        $tab2->addChild($input);
        $tab2->h('h2', 'Logging');
        $tab2->h('p', 'Logging is by default turned off.  Use the checkboxes
            below to turn on the various logging features.');
        $a = $tab2->h('a-void', 'Detect console devices');
        $a->code['click'] = <<<JS
        function(input) {
            var msg = x6consoleActivate();
            if(msg==false) {
                alert("No console devices found, logging is disabled");
            }
            else {
                alert(msg);
            }
        }
JS;
        $tab2->br(2);
        $loptions = array('Server' => 'Server-Side Query Log', 'FBLite' => 'I am on IE, load Firebug Lite for me', 'Group' => 'Javascript Log Outline', 'Log' => 'Javascript Log Detail', 'Warn' => 'Warnings', 'Info' => 'Informational', 'Error' => 'Errors', 'Time' => 'Time start/end (requires firebug)');
        foreach ($loptions as $loption => $description) {
            $input = html('input');
            $input->hp['type'] = 'checkbox';
            $input->hp['command'] = $loption;
            $input->code['click'] = <<<JS
            function(input) {
                var command = x6.p(input,'command');
                var checked = input.checked;
                if(checked) {
                    x6.console['enable'+command] = true;
                    createCookie('log_'+command,1);
                }
                else {
                    x6.console['enable'+command] = false;
                    eraseCookie('log_'+command);
                }
            }
JS;
            if (arr($_COOKIE, 'log_' . $loption, 0) == 1) {
                $input->hp['checked'] = 'checked';
            }
            $tab2->addChild($input);
            $tab2->h('span', $description);
            $tab2->br();
            if ($loption == 'Server') {
                $tab2->br();
            }
        }
        # --------------------------------------------------------------
        # End of the line
        # --------------------------------------------------------------
        $top->render();
    }
Exemple #3
0
    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();
    }
Exemple #4
0
 function x6main()
 {
     $top = html('div');
     $top->hp['style'] = 'text-align: center;';
     $top->addClass('fadein');
     $top->h('h1', configGet('x4menutitle'));
     # Get some basic dimensions we will use to build the
     # menu system.  Our basic metric is 10% of the
     # screen width, and then 10% of that.
     $pad0 = x6CssDefine('pad0');
     $insidewidth = x6CssDefine('insidewidth');
     $width1 = intval($insidewidth / 10);
     $widthl = $width1 * 3;
     $widthr = $width1 * 3;
     $width1b = intval($width1 / 2);
     $width2 = intval($width1 / 10);
     $outer = $top->h('div');
     $outer->hp['id'] = 'x6menu_outer';
     $outer->hp['xWidth1'] = $width1;
     $outer->hp['xWidth1b'] = $width1b;
     $outer->hp['xWidth2'] = $width2;
     $outer->hp['style'] = "padding: {$width1b}px {$width1}px;\n               text-align: left;";
     # Calculate height of inner, this forces height of outer
     $iHeight = x6cssDefine('insideheight');
     $iHeight -= x6cssHeight('h1');
     $iHeight -= $width1b * 2;
     $inner = $outer->h('div');
     $inner->hp['id'] = 'x6menu_inner';
     $inner->hp['style'] = " border: 1px solid " . x6cssDefine('bgcdark') . ";\n               height: {$iHeight}px;\n               padding:{$width2}px";
     # calculate height of left;
     $lHeight = $iHeight - $width2;
     $leftDiv = $inner->h('div');
     $leftDiv->hp['id'] = 'x6menu_left';
     $leftDiv->hp['style'] = "background-color: " . x6cssDefine('bgcdark') . ";\n             float: left;\n             height: {$lHeight}px;\n             width: {$widthl}px";
     $rightDiv = $inner->h('div');
     $rightDiv->hp['id'] = 'x6menu_right';
     $rightDiv->hp['style'] = "position: relative; float: left; width: {$widthr}px;";
     $AGMENU = SessionGet('AGMENU');
     $countLeft = 1;
     foreach ($AGMENU as $menuid => $menuinfo) {
         if (count(arr($menuinfo, 'items', array())) == 0) {
             continue;
         }
         $h2 = $leftDiv->h('div', $countLeft . ": " . $menuinfo['description']);
         $h2->hp['xKey'] = $countLeft;
         $countLeft++;
         $h2->hp['id'] = 'module_' . $menuid;
         $h2->hp['xMenuId'] = $menuid;
         $h2->hp['style'] = "padding: {$width2}px";
         $h2->hp['onclick'] = "x6.byId('x6menu_outer').clicked('module_{$menuid}');";
         $h2->hp['onmouseover'] = "this.style.textDecoration='underline'";
         $h2->hp['onmouseout'] = "this.style.textDecoration=''";
         $idLeft = $width2 * 2;
         $itemsDiv = $rightDiv->h('div');
         $itemsDiv->hp['id'] = 'items_' . $menuid;
         $itemsDiv->hp['style'] = "position: absolute; top: 0; left: {$idLeft}px; display: none";
         $countRight = 65;
         foreach ($menuinfo['items'] as $page => $pageinfo) {
             # Special hardcoded hack for x6 to remove some items
             if ($page == 'apppub') {
                 continue;
             }
             if ($page == 'userssimple') {
                 continue;
             }
             $pd = strtolower(chr($countRight)) . ': ' . $pageinfo['description'];
             $a = $itemsDiv->h('div', $pd);
             $a->hp['xKey'] = strtolower(chr($countRight));
             $a->hp['xactive'] = 'N';
             $countRight++;
             $a->hp['onmouseover'] = "\$('#x6menu_right .hilight').removeClass('hilight');\n                     \$(this).addClass('hilight')";
             # DUPLICATE CODE ALERT.  THIS CODE IS ALSO IN
             #   TEMPLATES/X6/X6MENUTOP.PHP
             # KFD 2/20/09 Sourceforge 2616802
             if ($pageinfo['uix2'] == 'Y') {
                 $href = "?gp_page={$page}&amp;x2=1";
             } else {
                 $href = "?x6page={$page}&amp;x6module={$menuid}";
             }
             $a->hp['onclick'] = "window.location='{$href}'";
             $a->hp['id'] = 'page_' . $page;
             if (arr($pageinfo, 'spaceafter', 'N') == 'Y') {
                 $itemsDiv->h('hr');
             }
         }
     }
     $top->render();
 }
 function headerOnScreenx6()
 {
     # Obtain height as insideheight less two h1
     $gheight = x6cssDefine('insideheight') - x6cssHeight('h1') * 2;
     # Make the grid with a fake table name
     $this->grid = new androHTMLGrid($gheight, 'androPage');
     # androPage does not at this point have the original
     # dictionary info available, but we can "fake it" by
     # looking at its information
     foreach ($this->cols as $idx => $info) {
         $colinfo = array('type_id' => $info['align'] == 'L' ? 'char' : 'numb', 'dispsize' => $info['clip'], 'description' => $this->captions[$idx], 'column_id' => 'apCol' . $idx);
         $this->grid->addColumn($colinfo);
     }
     $this->grid->lastColumn();
     $this->grid->addRow($this->rowCount++);
 }