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 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(); }