function main() { $this->PageSubtitle = "Please Login"; // KFD 3/6/08, changed login processing to st2login=1, // its not a page anymore. hidden('st2login', 1); hidden('gp_page', 'x_login'); hidden('gp_posted', '1'); // Send these out so they are available after successful login $gpz = aFromGp('gpz_'); foreach ($gpz as $var => $val) { hidden('gpz_' . $var, $val); } $loginUID = gp("loginUID", "", false); vgfSet("HTML_focus", "loginUID"); // EXPERIMENTAL. DOING THIS FOR ONLY ONE CLIENT RIGHT NOW $hForgot = vgaget('hfmode', false) == true ? 'x_password.phtml' : 'index.php?gp_page=x_password'; /** name:Replace Login Form You can replace the default login form by putting a file named "x_login_form.inc.html" into the [[Application Directory]]. */ if (File_exists_incpath('x_login_form.inc.html')) { if (vgaGet('html_main') != 'html_skin_tc') { include 'x_login_form.inc.html'; return; } } ?> <!-- LOGIN HTML (BEGIN) --> <div class="row"> <div class="span3"></div> <div class="span3"> <fieldset> <legend align="center"><?php echo configGet('loginbefore', $GLOBALS['AG']['app_desc']); ?> </legend> <div class="control-group"> <label class="control-label">Login Name:</label> <div class="controls"> <input type="text" id="loginUID" name="loginUID" maxlength="60" value="<?php echo $loginUID; ?> " /> </div> </div> <div class="control-group"> <label class="control-label">Password:</label> <div class="controls"> <input name="loginPWD" type="password" maxlength="20"/> </div> </div> <div class="control-group"> <div class="controls"> <input class="btn btn-primary" type="submit" name="pushSave" value="Login" /> </div> </div> <p align="center"><a href="<?php echo $hForgot; ?> ">Forgotten Password and Change Password</a></p> </fieldset> </div> <div class="span3"></div> </div> <!-- LOGIN HTML (END) --> <?php }
/** * 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; }
function profile_twosides() { # Grab the data dictionary for this table $dd = $this->dd; $table_id = $this->dd['table_id']; # Get the standard padding, we are going to double it $pad0 = x6CSSDefine('pad0'); $heightRemain = x6cssDefine('insideheight'); # Now put in your basic title $div = new androHTMLTableController($table_id); $div->addClass('fadein'); $div->ap['xCache'] = 'Y'; // results will be cached $div->h('h1', '<center>' . $dd['description'] . '</center>'); $heightRemain -= x6cssHeight('h1'); $heightRemain -= $pad0 * 2; # Create a two-sided layout by creating two boxes # Left side is a grid with the entire table $area0 = $div->h('div'); $area0->hp['style'] = "float: left; \n padding-left: {$pad0}px;\n padding-right: {$pad0}px;"; $x6grid = $area0->addGrid($heightRemain, $table_id, false, true, false); $x6grid->hp['x6profile'] = 'twosides'; $this->gridGeneric($x6grid, $this->dd); # Now put the data over there $uisearch = $this->dd['projections']['_uisearch']; $ob = $this->dd['pks']; # KFD 1/22/09, allow filtering on "pre" values $pre = aFromGp('pre_'); $awhere = array(); $where = ''; foreach ($pre as $colname => $value) { $awhere[] = sqlfilter($this->dd['flat'][$colname], $value); } if (count($awhere) > 0) { $where = 'WHERE ' . implode(' AND ', $awhere); } $view_id = ddView($table_id); $sql = "Select skey,{$uisearch} from {$view_id} {$where} ORDER BY {$ob}"; $rows = SQL_AllRows($sql); $aColumns = explode(',', $uisearch); foreach ($rows as $row) { $x6grid->addRow($row['skey']); foreach ($aColumns as $column) { $x6grid->addCell($row[$column]); } } # Calculate how much width is left $wInner = x6CSSDefine('insidewidth'); $wInner -= $x6grid->width; $wInner -= 2; // assume a border on the grid $wInner -= 2; // assume a border on the right-side $wInner -= $pad0 * 6; // 3 times padding doubled $box2 = $div->h('div'); $box2->hp['style'] = "float: left; width: {$wInner}px;"; $detail = $box2->addDetail($table_id, true, $heightRemain - 2); $detail->ap['x6profile'] = 'twosides'; # Generate a list of child xrefs. The idea here is to # work out the dimensions first, because we must tell the # class how high to make itself. Then we generate the # list. If it comes back empty, we forget about it, otherwise # we create a div of the correct position and put it into it. $xrtop = $detail->hp['xInnerHeight'] - $detail->hp['xInnerEmpty'] + x6CssHeight('h1'); $xrhgt = $detail->hp['xInnerEmpty'] - x6cssHeight('h1') - $pad0 * 10; // total hack, don't know why 7 works $xrwdth = $wInner - $detail->hp['xInnerWidthLost']; $xrefs = new androHTMLxrefs($table_id, $xrhgt); if ($xrefs->hp['xCount'] > 0) { $xrefParent = $detail->innerDiv->h('div'); $xrefParent->hp['style'] = "position: absolute;\n width: {$xrwdth}px;\n top: {$xrtop}px;\n left: {$pad0}px;"; $xrefParent->addChild($xrefs); } # tell the screen to start out by # focusing on the browse jqDocReady("x6events.fireEvent('objectFocus','{$x6grid->hp['id']}')"); # KFD 3/7/09 Sourceforge 2669466 # Turn on new buttons by default jqDocReady('x6events.fireEvent("buttonsNew_' . $table_id . '",true)'); # Render it! That's it! # KFD 3/20/09 Sourceforge 2697962 # index_hidden calls this now #$this->hldOut($top); $div->render(); }
function hBrowse($filters = array()) { // Pull the rows so we know how many we have if (count($filters) != 0) { $filters = ConSet('table', $this->table_id, 'search', $filters); } $rows = rowsFromUserSearch($this->table, $this->projections['_uisearch']); // Pull the nav bar. Do this after pulling rows so we // know how many rows there are, what page we're on, etc. $this->h['NavBar'] = $this->hBrowse_NavBar(); ob_start(); $this->ehBrowse_Data($rows); // KFD 8/9/07 DUPECHECK. If they did a dupe check before entering // a new row, give them a button to say they want to do // a new one anyway if (gp('gp_action') == 'dupecheck') { $href = "?gp_page=" . $this->table_id . "&gp_mode=ins&gp_nodupecheck=1"; $agp = aFromGp('x2t_'); foreach ($agp as $colname => $colvalue) { $href .= '&pre_' . $colname . '=' . urlEncode($colvalue); } ?> <script> function keypress_f9() { window.location="<?php echo $href; ?> "; } </script> <br/><br/> <a href="<?php echo $href; ?> " onclick="window.location='<?php echo $href; ?> '" id="object_for_f9" name="object_for_f9">(F9) Do New Entry</a> <?php } $this->h['Content'] = ob_get_clean(); }
function index_hidden_page() { global $AG; $sessok = !LoggedIn() ? false : true; // KFD 3/6/08, moved here from the main stream of index_hidden // because these are relevant only to page processing if (gpExists('x_module')) { SessionSet('AGMENU_MODULE', gp('x_module')); } elseif (vgaGet('nomodule') != '' && SessionGet('AGMENU_MODULE') == '') { SessionSet('AGMENU_MODULE', vgaGet('nomodule')); } // If the search flag is set, we need to know what class for this // application handles searchs if (gpExists('gp_search')) { gpSet('gp_page', vgaGet('SEARCH_CLASS')); } // Load up a list of pages that public users are allowed to see, // with home and password always there. global $MPPages; // allows it to be in applib $MP = array(); //$MPPages= array(); // This is the old method, load $MPPages from its own file if (file_exists_incpath('appPublicMenu.php')) { include_once 'appPublicMenu.php'; } if (!is_array($MPPages)) { $MPPages = array(); } $MPPages['x_home'] = 'Home Page'; $MPPages['x_login'] = '******'; $MPPages['x_noauth'] = 'Authorization Required'; $MPPages['x_password'] = "******"; $MPPages['x_mpassword'] = "******"; $MPPages['x_paypalipn'] = 'Paypal IPN'; // If the install page exists, it will be used, no getting // around it. $install = $GLOBALS['AG']['dirs']['application'] . 'install.php'; $instal2 = $GLOBALS['AG']['dirs']['application'] . 'install.done.php'; if (file_exists($install)) { if (gp('gp_install') == 'finish') { rename($install, $instal2); } else { $MPPages['install'] = 'install'; gpSet('gp_page', 'install'); } } // First pass is to look for the "flaglogin" flag. This says save all // current page settings and go to login screen. They will be restored // on a successful login. Very useful for links that say "Login to // see nifty stuff..." if (gp('gp_flaglogin') == '1') { gpSet('gp_flaglogin', ''); gpToSession(); gpSet('gp_page', 'x_login'); } // Second pass redirection, pick default page if there // is none, and verify public pages. // $gp_page = gp('gp_page'); if ($gp_page == '') { if (vgfGet('LoginAttemptOK') === true && vgfGet('x4') === true) { $gp_page = 'x4init'; gpSet('gp_page', 'x4init'); SessionSet('TEMPLATE', 'x4'); } else { if (function_exists('appNoPage')) { $gp_page = appNoPage(); } else { if (!LoggedIn()) { $gp_page = FILE_EXISTS_INCPATH('x_home.php') ? 'x_home' : 'x_login'; } else { // KFD 3/2/07, pull vga stuff to figure defaults if (vgaGet('nopage') != '') { $gp_page = vgaGet('nopage'); } else { $gp_page = 'x_welcome'; } } } } } // If they are trying to access a restricted page and are not // logged in, cache their request and redirect to login page if (!$sessok && !isset($MPPages[$gp_page])) { if (vgfGet('loglogins', false)) { fwLogEntry('1014', 'Page access w/o login', $gp_page); } gpToSession(); $gp_page = 'x_login'; } // If pos is activated and the current requested page does not // match what they are cleared for, redirect to login if (vgaGet('POS_SECURITY', false) == true && SessionGet('ADMIN') == false) { if (SessionGet('POS_PAGE', '', 'FW') != $gp_page) { gpToSession(); $gp_page = 'x_login'; } } gpSet('gp_page', $gp_page); // Make any database saves. Do this universally, even if save // was not selected. If errors, reset to previous request. //if(gp('gp_save')=='1') processPost(); processPost(); if (Errors()) { gpSetFromArray('gp_', aFromGp('gpx_')); } // Put Userid where HTML forms can find it //vgfSet("UID",SessionGet("UID")); //if (vgfSet("UID")=="") { vgfSet("UID","Not Logged In"); } // THIS IS NEWER X_TABLE2 version of drilldown commands, // considerably simpler than the older ones. It makes use of // three gp_dd variables. // // Notice how we process drillbacks FIRST, allowing a link // to contain both drillback and drilldown, for the super-nifty // effect of a "drill-across" hidden('gp_dd_page'); hidden('gp_dd_skey'); hidden('gp_dd_back'); if (intval(gp('gp_dd_back')) > 0 && $sessok) { // this is drillback $dd = ContextGet('drilldown', array()); $back = intval(gp('gp_dd_back')); if (count($dd) >= $back) { $spot = count($dd) - $back; $aback = $dd[$spot]; gpSet('gp_skey', $aback['skey']); gpSet('gp_page', $aback['page']); $gp_page = $aback['page']; gpSet('gpx_skey', $aback['skey']); gpSet('gpx_page', $aback['page']); gpSetFromArray('parent_', $aback['parent']); if (!gpExists('gp_mode')) { gpSet('gp_mode', 'upd'); } $dd = $spot == 0 ? array() : array_slice($dd, 0, $spot); ContextSet('drilldown', $dd); ContextSet('drilldown_top', $aback['page']); //ContextSet('drilldown_level',count($dd)); } } if (gp('gp_dd_page') != '' && $sessok) { // this is drilldown... $matches = DrillDownMatches(); $matches = array_merge($matches, aFromGP('parent_')); $dd = ContextGet('drilldown', array()); $newdd = array('matches' => $matches, 'parent' => aFromGP('parent_'), 'skey' => gp('gpx_skey'), 'page' => gp('gpx_page')); $dd[] = $newdd; ContextSet('drilldown', $dd); ContextSet('drilldown_top', gp('gp_dd_page')); //ContextSet('drilldown_level',count($dd)); // having saved the stack, redirect to new page. $tnew = gp('gp_dd_page'); $gp_page = $tnew; gpSet('gp_page', $tnew); if (gp('gp_dd_skey') != '') { gpSet('gp_skey', gp('gp_dd_skey')); gpSet('gp_mode', 'upd'); } // Clear search of new page, set filters to blank processPost_TableSearchResultsClear($tnew); ConSet('table', $tnew, 'search', array()); } // If no drilldown commands were received, and we are not on // the page that is the top, user must have picked a new page // altogether, wipe out the drilldown stack if (gp('gp_page') != ContextGet('drilldown_top', '')) { ContextSet('drilldown', array()); ContextSet('drilldown_top', ''); } // Must always have these on the user's form. These can // be retired with x_Table, they are for old drilldown // hidden("dd_page", ""); hidden("dd_ddc", ""); hidden("dd_ddv", ""); hidden("dd_ddback", ""); hidden("dd_action", "searchexecute"); hidden("dd_skey", ""); // Load user preferences just before display UserPrefsLoad(); $dir = $GLOBALS['AG']['dirs']['root'] . 'application/'; if (file_exists($dir . $gp_page . ".page.yaml")) { include 'androPage.php'; $obj_page = new androPage(); if ($obj_page->flag_buffer) { ob_start(); } $obj_page->main($gp_page); if ($obj_page->flag_buffer) { vgfSet("HTML", ob_get_clean()); //ob_end_clean(); } vgfSet("PageSubtitle", $obj_page->PageSubtitle); } else { $obj_page = DispatchObject($gp_page); if ($obj_page->flag_buffer) { ob_start(); } $obj_page->main(); if ($obj_page->flag_buffer && vgfGet('HTML') == '') { vgfSet("HTML", ob_get_contents()); ob_end_clean(); } vgfSet("PageSubtitle", $obj_page->PageSubtitle); } // Save context onto the page. Note that it is not really // protected by these methods, just compressed and obscured. // $t2 = serialize($GLOBALS['AG']['clean']['gpContext']); $t2 = gzcompress($t2); $t2 = base64_encode($t2); Hidden('gpContext', $t2); // KFD 3/7/07, give the app the final opportunity to process // things before the display, while logged in. if (function_exists('appdisplaypre')) { appDisplayPre(); } // ...and write output and we are done. Assume if there was // no buffering that the output is already done. if ($obj_page->flag_buffer != false) { // Work out what template we are using index_hidden_template('x2'); // KFD 5/30/07, send back only main content if asked if (gp('ajxBUFFER') == 1) { echo "andromeda_main_content|"; ehStandardContent(); echo "|-|_focus|" . vgfGet('HTML_focus'); $ajax = ElementReturn('ajax', array()); echo '|-|' . implode('|-|', $ajax); echo '|-|_title|' . vgfGet('PageTitle'); } elseif (defined('_VALID_MOS')) { // This is the default branch, using a Joomla template // DUPLICATE ALERT: This code copied into // index_hidden_x4Dispatch() above 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; } elseif ($obj_page->html_template !== '') { // This is newer style, let the class specify the template. include $obj_page->html_template . '.php'; } else { // This is old style, defaults to "html_main.php", can be // set also by vgaSet() or by gp(gp_out) $html_main = vgaGet('html_main') == '' ? 'html_main' : vgaGet('html_main'); switch (CleanGet("gp_out", "", false)) { case "print": include "html_print.php"; break; case "info": include "html_info.php"; break; case "": include $html_main . ".php"; break; default: } } } }