function mainLayout($container) { # Erase default help message vgfSet('htmlHelp', ''); $top = $container; # Pull the values $row = SQL_OneRow("Select * from " . $this->table_id); # Basic information at top html('div', $top, 'Instance Configuration', 'hero-unit'); html('p', $top, 'Any changes made here will take immediate effect for all users of this program, except where a user has configured their own preferred setting.'); # Set up titles $table = html('table', $top); $table->addClass('table table-bordered table-condensed table-hover table-striped'); $table->hp['id'] = 'x2data1'; $thead = html('thead', $table); $tr = html('tr', $thead); $tr->h('th', 'Setting', 'dark'); $tr->h('th', 'Default Value', 'dark'); $tr->h('th', ' ', 'dark'); $tr->h('th', 'Instance Value', 'dark'); # Now put out inputs for each one $tbody = html('tbody', $table); $askip = array('recnum', '_agg', 'skey_quiet', 'skey'); foreach ($this->flat as $column_id => $colinfo) { if (in_array($column_id, $askip)) { continue; } $tr = html('tr', $tbody); $tr->hp['id'] = 'tr_' . $column_id; $tr->SetAsParent(); $td = html('td', $tr, $colinfo['description']); # The default value $td = html('td', $tr, ConfigGet($column_id, '*null*', array('user', 'inst'))); $td->hp['id'] = 'def_' . $column_id; # The reset $td = html('td', $tr); $button = html('a-void', $td, 'Use Default'); $button->hp['onclick'] = "makeDefault('{$column_id}')"; # the input $input = input($colinfo); $input->hp['id'] = 'inp_' . $column_id; if ($colinfo['type_id'] == 'text') { $input->setHTML($row[$column_id]); } else { $input->hp['value'] = $row[$column_id]; x4Script('$a.byId("' . $input->hp['id'] . '").value="' . $row[$column_id] . '"'); } $input->hp['onchange'] = 'instaSave(this)'; $input->ap['skey'] = $row['skey']; $td = html('td', $tr); $td->addChild($input); } }
function mainLayout($container) { # Erase default help message vgfSet('htmlHelp', ''); $top = $container; # Pull the values # For a user, if there is no row, enter one and try again $dd = ddTable("configuser"); $view = ddView('configuser'); $row = SQL_AllRows("Select * from {$view}"); if (count($row) == 1) { $row = $row[0]; } else { SQL("Insert into {$view} (skey_quiet) values ('N')"); $row = SQL_OneRow("Select * from {$view}"); } # Basic information at top html('h1', $top, 'User Configuration'); html('p', $top, 'Any changes made here will take immediate effect.'); # Set up titles $table = html('table', $top); $thead = html('thead', $table); $tr = html('tr', $thead); $tr->h('th', 'Setting', 'dark'); $tr->h('th', 'Your Value', 'dark'); $tr->h('th', 'Default Value', 'dark'); $tr->h('th', ' ', 'dark'); # Now put out inputs for each one $tbody = html('tbody', $table); $askip = array('recnum', '_agg', 'skey_quiet', 'skey', 'uid_ins'); foreach ($this->flat as $column_id => $colinfo) { if (in_array($column_id, $askip)) { continue; } $tr = html('tr', $tbody); $tr->hp['id'] = 'tr_' . $column_id; $tr->SetAsParent(); $td = html('td', $tr, $colinfo['description']); # the input $input = input($colinfo); $input->hp['id'] = 'inp_' . $column_id; if ($colinfo['type_id'] == 'text') { $input->setHTML($row[$column_id]); } else { $input->hp['value'] = $row[$column_id]; x4Script('$a.byId("' . $input->hp['id'] . '").value="' . $row[$column_id] . '"'); } $input->hp['onchange'] = 'instaSave(this)'; $input->ap['skey'] = $row['skey']; $td = html('td', $tr); $td->addChild($input); # The default value $td = html('td', $tr, ConfigGet($column_id, '*null*', array('user'))); $td->hp['id'] = 'def_' . $column_id; # The reset $td = html('td', $tr); $button = html('a-void', $td, 'Use Default'); $button->hp['onclick'] = "makeDefault('{$column_id}')"; } }
/** * Generate a complete layout of all form elements and deliver * it to the browser * * @author: Kenneth Downs */ function main() { # Write out the default help system $this->mainHelp(); # KFD 6/18/08, replaced, see below # If we see a "gp_pk" variable, they are requesting a certain # detail row. Find out the skey and pass instructions on. # Notice the assumption of only a single column. $apre = aFromGP('pre_'); if (count($apre) > 0) { x4Data('init', $apre); } # And also add in the mode if it has been delivered, and focus if (gp('x4Mode') != '') { x4Data('x4Mode', gp('x4Mode')); } if (gp('x4Focus') != '') { x4Data('x4Focus', gp('x4Focus')); } # KFD 6/25/08, if there is extra script, run it ob_start(); $this->extraScript(); $extra = ob_get_clean(); if ($extra != '') { x4Script($extra); } # KFD 8/7/08. Grab any "hold" variables and # attach them to the current object. This was # put in for the wholdist application to carry # context from screen to screen. # $this->hld = aFromGp('hld_'); # All top-level elements will go inside of this div $x4Top = html('div'); $x4Top->hp['id'] = 'x4Top'; $this->mainLayout($x4Top); x4Html('*MAIN*', $x4Top->bufferedRender()); # KFD 9/20/08, added a flag to go "please wait" while # saving, in case there are distribute's if (isset($this->waitOnSave)) { $this->dd['wait_on_save'] = $this->waitOnSave; } else { $this->dd['wait_on_save'] = false; } x4Data('dd.' . $this->table_id, $this->dd); x4Data('returnto', gp('x4Return')); # Now send all hold variables out on the container foreach ($this->hld as $key => $value) { $x4Top->hidden($key, $value); } return; }
/** * Stores a fragment of script to run inside of * jquery's documentReady() action. * * * string Script. May be enclosed in html SCRIPT tags, * which you may want to do if your editor makes * it easier to work with it that way. * * boolean insert. If true, inserts script at top of list * * RETURN * false Always returns false. */ function jqDocReady($script, $insert = false) { $script = preg_replace("/<script>/i", '', $script); $script = preg_replace("/<\\/script>/i", '', $script); $jdr = vgfGet('jqDocReady', array()); if ($insert) { array_unshift($jdr, $script); } else { $jdr[] = $script; } vgfSet('jqDocReady', $jdr); # KFD 10/15/08. If we are in a json call, send this back # as script instead if (gp('json') == 1) { x4Script($script, $insert); } return false; }
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; }
function mainLayout(&$container) { # load the javascript jsInclude("clib/androX4Menu.js"); # Set focus if requested if (($focus = gp('x4Focus')) != '') { x4Script("\$('#x4Menu')[0].lastFocusId = 'x4menu_{$focus}'"); } # Other miscellaneous commands vgfSet('suppress_hidden', true); //vgfSet('show_menu',false); # Fetch some text $h1 = configGet("x4menutitle", "Extended Desktop Menu"); $text = configGet("x4menutext", ""); ob_start(); ?> <div id="x4Menu" class="x4Pane x4Menu"> <center> <h1><?php echo $h1; ?> </h1> <?php echo $text; ?> </center> <br/> <?php $table = html('table'); $table->hp['class'] = 'tab100'; $tr = html('tr', $table); $array = SessionGet('AGMENU'); $first = true; $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $col = 0; $grid = array(); foreach ($array as $module => $modinfo) { if (!$first) { $td = html('td', $tr); $td->hp['style'] = 'width: 10px'; } $first = false; $td = html('td', $tr); $td->hp['class'] = 'style1'; $h3 = html('h3', $td); $h3->setHtml($letters[$col] . ') ' . $modinfo['description']); $row = 0; foreach ($modinfo['items'] as $page => $info) { // Add the link $a = html('a', $td); $a->hp['id'] = 'x4menu_' . $page; $a->hp['href'] = "?x4Return=menu&x4Page={$page}"; $a->setHTML($row . ') ' . $info['description']); $a->hp['onkeyup'] = "return \$a.byId('x4Menu').x4KeyUp(event,{$col},{$row})"; $a->hp['onkeydown'] = "return false;"; $a->hp['onmouseover'] = '$(this).focus()'; $a->hp['onfocus'] = "this.className = 'x4MenuOn'"; $a->hp['onblur'] = "this.className = ''"; $grid[$col][$row] = 'x4menu_' . $page; $row++; // Add a BR html('br', $td); } $col++; } $table->render(); echo "</div>"; # put out the grid and set the HTML x4data('grid', $grid); $container->setHTML(ob_get_clean()); }