function lastColumn($scrollable = true) { # Save the scrollable setting, and compute the final # width of the table #$this->scrollable=$scrollable; if ($scrollable) { $this->columns[] = array('description' => ' ', 'dispsize' => 0, 'type_id' => '', 'column_id' => '', 'width' => 15); $pad0 = x6CSSDefine('pad0'); $bord = 1; // HARDCODE! $this->colWidths += 15 + $pad0 * 2 + $bord * 2; $div = $this->dhead->h('div', ''); $div->hp['style'] = "\n max-width: 15px;\n min-width: 15px;\n width: 15px;"; } # Send the column structure back as JSON jqDocReady("x6.byId('" . $this->hp['id'] . "').zColsInfo=" . json_encode($this->columns), true); jqDocReady("x6.byId('" . $this->hp['id'] . "').zColsById=" . json_encode($this->columnsById), true); # If editable, add in the invisible row of inputs if ($this->editable) { $this->inputsRow(); } # If the lookups flag is set, add that now if ($this->lookups) { $this->addLookupInputs(); } # If the sortable flag was set, add that now if ($this->sortable) { $this->makeSortable(); } # Generate the cell styles $styles = "\n"; foreach ($this->colStyles as $selector => $rules) { $styles .= "{$selector} { " . $rules . "}\n"; } $this->children[0]->setHTML($styles); # Get the standard padding, we hardcoded # assuming 2 for border, 3 for padding left #--$extra = 5; # now work out the final width of the table by # adding up the columns, adding one for each # column (the border) and two more for the table # border. $width = $this->colWidths; # JB: Increased width of master table by 1px so it lines up #$width+= ((count($this->columns))*$extra)+1; // border + padding #--$width+= (count($this->columns))*$extra; #$width+= 39; // fudge factor, unknown $this->hp['style'] .= "width: {$width}px"; $this->width = $width; return $width; }
function profile_onerow() { # Get started with the top of the page and # a table controller $top = htmlMacroTop($this->x6page); $top->addTableController($this->x6page); # Make the tabs $height = x6CssHeightLessH1(); $tabs = $top->addTabs($this->x6page, $height); $spacing = intval(x6CSSDefine('insidewidth') / 25); # Get a list of projections, we will make a tab # for each one of them $projections = array_keys($this->dd['projections']); foreach ($projections as $idx => $projection) { if (substr($projection, 0, 1) == '_') { unset($projections[$idx]); } } # Say nothing to do if nothing to do if (count($projections) == 0) { $top->h('p', 'Nothing to configure.'); } # Get the row from the table so we can populate # the inputs $row = SQL_OneRow("Select * from " . $this->dd['viewname']); # Make a tab for each projection, and put the inputs in there! foreach ($projections as $projection) { $description = $projection; $x = 'description_' . $projection; if (isset($this->dd['flat'][$x])) { $description = $this->dd['flat'][$x]['description']; } $tab = $tabs->addTab($description); $insidetab = $tab->h('div'); $insidetab->hp['style'] = "padding: {$spacing}px"; $table = $insidetab->h('table'); $table->addClass('x6Detail'); $columns = explode(',', $this->dd['projections'][$projection]); foreach ($columns as $idx => $column) { $tabLoop = array(); $tr = $table->h('tr'); $td = $tr->h('td', $this->dd['flat'][$column]['description']); $td->addClass('x6Caption'); $input = input($this->dd['flat'][$column], $tabLoop); $input->hp['xSkey'] = $row['skey']; # KFD 2/17/09 Sourceforge bug 2609176 if ($input->htype == 'textarea') { $input->setHtml(htmlentities($row[$column])); } else { $input->hp['value'] = htmlentities($row[$column]); } $td = $tr->h('td'); $td->setHtml($input->bufferedRender()); $td->addClass('x6Input'); } } $top->render(); ob_start(); ?> <script> $('input,textarea').each( function() { this.zOriginalValue = $(this).attr('value'); this.afterBlur = function() { if(this.zOriginalValue.trim()==this.value.trim()) return; var json = new x6JSON('x6page',x6.p(this,'xTableId')); json.addParm('x6action','save'); json.addParm('x6v_skey',x6.p(this,'xSkey')); json.addParm(this.id,this.value); json.execute(false,true); this.zOriginalValue = this.value; x6inputs.setClass(this); } } ); <?php jqDocReady(ob_get_clean()); }