Exemplo n.º 1
0
 function mainProcess()
 {
     $errors = array();
     # Make x6main scrollable
     jqDocReady("\$('.x6body').css('overflow-y','scroll')");
     # Define the directories
     $dirx6 = fsDirTop() . 'templates/x6/';
     $dirx6src = $dirx6 . 'skinsources/';
     $dirapp = fsDirTop() . 'application/';
     # Now scan for other skins and process those
     $dirs = array($dirx6src, $dirapp);
     foreach ($dirs as $dir) {
         $files = scandir($dir);
         foreach ($files as $file) {
             echo "<br/>{$dir}{$file};";
             # These lines filter out entries that are not skins
             $apieces = explode('.', $file);
             if (count($apieces) != 3) {
                 continue;
             }
             if ($apieces[0] != 'x6skin') {
                 continue;
             }
             if ($apieces[2] != 'yaml') {
                 continue;
             }
             # Load the file and process it.  We assume the
             # middle piece of the file is the name of the
             # template.
             list($yaml, $errors) = loadYaml($dir . $file);
             if (count($errors) > 0) {
                 echo "<h2>Errors encountered in skin file</h2>";
                 echo "<p>File: {$dir}{$file}</p>";
                 hprint_r($errors);
                 return;
             }
             removeYamlLineNumbers($yaml);
             $this->writeCSS($apieces[1], $yaml['defines'], $yaml['css']);
         }
     }
     # Finally, write the list of skins out to apppub
     file_put_contents(fsDirTop() . 'templates/x6/skinsphp/x6skins.ser.txt', serialize($this->skinFiles));
 }
Exemplo n.º 2
0
# Spit out previously registered JS files.
# The jsOutput() command decides whether to send a
# single minified file or to send them individually
#
# =====================================================================
jsOutput();
# =====================================================================
#
# Old-fashioned pre-x4 pre-jquery way to set focus.
# Don't ever use this!  It will be deprecated
# sooner or later.
#
# =====================================================================
if (vgfGet('HTML_focus') != '') {
    $f = vgfGet('HTML_focus');
    jqDocReady('$("#' . $f . '").focus()');
}
# -------------------------------------------------------------
# Put out some invisible divs that are used for modals,
# popups and so forth
# -------------------------------------------------------------
?>
<div style="display:none" id="idiv1" class="idiv1" onclick="x4.helpClear()">
</div>
<div  style="display:none" id="idiv2" class="idiv2"> 
  <table width="100%">
    <tr>
    <td align="left"><h1>Help System</h1></td>
    <td align="right" style="padding-right: 15px">
        <h3><a href="javascript:x4.helpClear()">Close</a></h3>
    </td>
Exemplo n.º 3
0
 /**
  *  Generates an x3 HTML page requesting input from the
  *  user.  No parameters, accesses the object's yamlP2 property.
  *
  *  @access private
  */
 private function x3HTML()
 {
     $x6 = vgfGet('x6', false);
     $yamlP2 = $this->yamlP2;
     if (isset($yamlP2['options']['title'])) {
         # This is for classic x2 displays
         $this->PageSubtitle = $yamlP2['options']['title'];
     }
     # There are few tweaks based on x4/x_table2 version
     $x4 = gp('x4Page') == '' ? false : true;
     # Create top-level div, x4 library is looking for this
     # and x2 library will ignore it.
     $top = html('div');
     $top->hp['id'] = 'x4Top';
     $top->autoFormat(true);
     if ($x6) {
         $top->hp['id'] = 'x4Top';
         $top->addClass('fadein');
         $top->hp['x6plugin'] = 'androPage';
         jqDocReady("var plugin = x6.byId('x4Top');");
         jqDocReady("x6plugins.androPage(plugin,'x4Top','*');");
     }
     # Hidden variables so posts will come back here
     if ($x4) {
         x4Data('return', 'menu');
         $h = $top->h('input');
         $h->hp['id'] = 'x4Page';
         $h->hp['type'] = 'hidden';
         $h->hp['value'] = $this->page;
     } else {
         hidden('gp_page', $this->page);
     }
     # List of ids for buttons below
     if ($yamlP2['template'] == '') {
         $ids = array('pdf' => 'printNow', 'onscreen' => 'showOnScreen', 'showSql' => 'showSql', 'csv' => 'csvExport');
     } else {
         $ids = array('smarty' => 'RunReport');
     }
     $x4D = html('div', $top);
     if ($x4) {
         $x4D->addClass('x4Pane');
     }
     $x4D->addClass('x4AndroPage');
     # Triggers all browser-side x4 stuff
     $x4D->hp['id'] = 'x4AndroPage';
     $x4D->ap['defaultOutput'] = a($ids, a($yamlP2['options'], 'default'));
     # Put out the title and the help link
     $tabx = html('table', $x4D);
     $tabx->addClass('tab100');
     $tabxtr = html('tr', $tabx);
     $td = html('td', $tabxtr);
     $td->hp['style'] = "text-align: left; vertical-align: top";
     $h1 = html('h1', $td, $this->PageSubtitle);
     $h1->hp['id'] = 'x4H1Top';
     $td = html('td', $tabxtr);
     $td->hp['style'] = "text-align: right; vertical-align: top;\n        padding-top: 8px; font-size: 120%";
     #if($x4) {
     #$a = html('a-void',$td,"F1:Help");
     #$a->hp['onclick'] = "$('#x4AndroPage')[0].help()";
     #$a->addClass('button');
     #}
     # Make top level container
     $tabtop = html('table', $x4D);
     $tr = html('tr', $tabtop);
     $td1 = html('td', $tr);
     $td1->hp['style'] = 'vertical-align: top';
     $td2 = html('td', $tr);
     $td2->hp['style'] = 'vertical-align: top';
     # Do right-hand side first actually, the on-screen display area
     $div = html('div', $td2);
     $div->hp['id'] = 'divOnScreen';
     # Put out the inputs
     if (!$x6) {
         $table = html('table', $td1);
     } else {
         $form = $td1->form();
         $table = $form->h('table');
         $table->addClass('x6Detail');
         $table->hp['style'] = 'float: left';
     }
     $filters = ArraySafe($this->yamlP2, 'uifilter', array());
     foreach ($filters as $id => $options) {
         if (isset($options['table'])) {
             $dd = ddTable($options['table']);
             $opt2 = $dd['flat'][$options['column']];
             $options = array_merge($opt2, $options);
         } else {
             $options['inputId'] = 'ap_' . $id;
         }
         if (isset($options['value']) && gp('ap_' . $id) == '') {
             $options['value'] = $options['value'];
         } else {
             $options['value'] = gp('ap_' . $id);
         }
         $type_id = a($options, 'cotype_id', 'vchar');
         $tr = html('tr', $table);
         $td = html('td', $tr);
         if ($x6) {
             $td->addClass('x6Caption');
         } else {
             $td->hp['style'] = "text-align: right";
         }
         $td->setHTML($options['description']);
         $td = html('td', $tr);
         if ($x6) {
             $td->addClass('x6Input');
         } else {
             $td->hp['style'] = "text-align: left";
         }
         $input = input($options);
         $input->hp['autocomplete'] = 'off';
         if ($x6) {
             $input->hp['xNoPassup'] = 'Y';
         }
         $td->setHTML($input->bufferedRender());
     }
     $h = $top->h('input');
     $h->hp['type'] = 'hidden';
     $h->hp['id'] = 'gp_post';
     $h->hp['name'] = 'gp_post';
     if (isset($yamlP2['template'])) {
         $h->hp['value'] = 'smarty';
     } else {
         $h->hp['value'] = 'pdf';
     }
     $td1->br();
     // DO 7/31/2008 Only need a button to run the report for Smarty AndroPage
     if ($this->yamlP2['template'] == '') {
         # First button: print
         $inp = html('a-void', $td1, '<u>P</u>rint Now');
         $inp->ap['xLabel'] = 'CtrlP';
         $inp->hp['id'] = $ids['pdf'];
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlP')";
         } elseif (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').printNow()";
         } else {
             $inp->hp['onclick'] = 'formSubmit();';
         }
         $td1->br(2);
         # Second button: show onscreen
         $inp = html('a-void', $td1, 'Show <u>O</u>nscreen');
         $inp->hp['id'] = $ids['onscreen'];
         $inp->ap['xLabel'] = 'CtrlO';
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlO')";
         } elseif (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showOnScreen()";
         } else {
             $inp->hp['onclick'] = "SetAndPost('gp_post','onscreen')";
         }
         # KFD 9/20/08, new option: export to csv
         $td1->br(2);
         $inp = html('a-void', $td1, '<u>E</u>xport as CSV');
         $inp->hp['id'] = $ids['csv'];
         $inp->ap['xLabel'] = 'CtrlE';
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlE')";
         } else {
             if (gpExists('x4Page')) {
                 $inp->hp['onclick'] = "\$a.byId('x4AndroPage').csvExport()";
             } else {
                 $inp->hp['onclick'] = "SetAndPost('gp_post','csvexport')";
             }
         }
     } else {
         # First button: Run Report
         $inp = html('a-void', $td1, '<u>R</u>un Report');
         $inp->ap['xLabel'] = 'CtrlR';
         $inp->hp['id'] = $ids['smarty'];
         $inp->addClass('button');
         if (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showOnScreen()";
         } else {
             $inp->hp['onclick'] = 'formSubmit();';
         }
     }
     $td1->br(2);
     if (SessionGet('ADMIN') == true && $x4) {
         $x4D->nbsp(2);
         $inp = html('a-void', $td1, 'Show S<u>Q</u>L');
         $inp->ap['xLabel'] = 'CtrlQ';
         $inp->hp['id'] = $ids['showSql'];
         $inp->hp['name'] = 'showsql';
         // For x2
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlQ')";
         } else {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showSql()";
         }
     }
     # Put in the spot where we display the SQL
     $td1->br(2);
     $showSql = html('div', $td1);
     $showSql->hp['id'] = 'divShowSql';
     echo $top->render();
 }
Exemplo n.º 4
0
 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' => '&nbsp;', '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;
 }
Exemplo n.º 5
0
 function main()
 {
     // ------------------------------------------------
     // Branch out to ajax handling functions
     if (gpExists('fwajax')) {
         return $this->FWAjax();
     }
     //   ...early return
     // ------------------------------------------------
     // Public sites can turn off table maintenance pages
     if (vgfGet('suppress_maintenance', false)) {
         return;
     }
     vgfset('maintenance', true);
     # KFD 2/17/09 Sourceforge 2546056
     #             If we are in default main code branch, and
     #             there is no data dictionary, the user has
     #             called a bad page.
     if (!isset($this->table['projections'])) {
         ?>
       <h1>Bad Page Request</h1>
       <p>There is no page <?php 
         echo hx(gp('gp_page'));
         ?>
       <?php 
         return;
     }
     // If a "fk jump", retrieve skey and make it look
     // like an edit call.
     if (gp('gp_pk') != '') {
         $pkval = gp("gp_pk");
         $pkcol = $this->table["pks"];
         $pktyp = $this->table['flat'][$pkcol]["type_id"];
         $table_id = $this->table["table_id"];
         // KFD 10/26/06, used to be $table_id
         $sq = "SELECT skey FROM " . $this->view_id . " WHERE " . $pkcol . " = " . SQL_Format($pktyp, $pkval);
         gpSet('gp_skey', SQL_OneValue('skey', $sq));
         gpSet('gp_mode', 'upd');
     }
     // If we were invoked by a child table, don't do this
     if (is_null($this->table_obj_child)) {
         // KFD 10/26/06, keep as $table_id
         Hidden('gp_page', $this->table_id);
         // always return to same page
         Hidden('gp_mode', '');
         Hidden('gp_skey', '');
         Hidden('gp_action', '');
         Hidden('gp_save', '');
         hidden('gp_copy', '');
     }
     // Work out what to do if mode is blank.  Might mean
     // upd, might mean browse.
     $mode = gp('gp_mode');
     $skey = gp('gp_skey');
     if ($mode == '') {
         $mode = $this->MainCheckForMover();
         if ($mode == '') {
             $mode = $skey == '' ? 'browse' : 'upd';
             gpSet('gp_mode', $mode);
         }
     }
     $this->mode = $mode;
     // KFD 8/13/07, Experimental COPY ability
     if (gp('gp_action') == 'copy') {
         $mode = 'ins';
         gpSet('gp_mode', 'ins');
     }
     switch ($mode) {
         case 'search':
             $this->PageSubtitle .= " (Lookup Mode)";
             break;
         case 'ins':
             $this->PageSubtitle .= " (New Entry)";
             break;
     }
     // ----------------------------------------------
     // Generate the main HTML elements
     if ($mode == 'browse') {
         $this->hBrowse();
     } elseif ($mode == 'mover') {
         $this->hMover();
     } else {
         $this->hBoxes($mode);
     }
     if ($mode != "mover") {
         $this->hButtonBar($mode);
     }
     $this->hLinks($mode);
     $this->hExtra($mode);
     // Now if this is a child table in a 1:M, it will not actually
     // output its own stuff, it will invoke its parent, so let's
     // buffer the output
     if ($this->table_id_parent != '') {
         ob_start();
     }
     // Echo out the HTML
     $this->ehMain();
     // Put this out at end, after all HTML has been output
     if ($mode == "search") {
         //$controls=vgfGet('gpControls');
         $controls = ContextGet('OldRow');
         $hScript = '';
         foreach ($controls as $key => $info) {
             $hScript .= "\nob('x2t_{$key}').value='';";
         }
         jqDocReady("function clearBoxes() { \n" . $hScript . "}\n\n");
     }
     // Again, if this is a child table in a 1:M, capture the output and
     // make it the responsibility of the parent
     if ($this->table_id_parent != '') {
         $this->h['Complete'] = ob_get_clean();
         // Wipe out and replace all gp variables, fool the parent object
         $OldRow = ContextGet('OldRow', array());
         $gpsave = aFromGP('gp_');
         gpUnsetPrefix('gp_');
         $dd = ContextGet('drilldown', array());
         $dd1 = array_pop($dd);
         gpSet('gp_skey', $dd1['skey']);
         // Now invoke the parent object, tell it about us
         $object = objPage($this->table_id_parent);
         $object->table_obj_child = $this;
         $object->main();
         // Replace the wiped out gp variables
         gpUnsetPrefix('gp_');
         gpSetFromArray('gp_', $gpsave);
         ContextSet('OldRow', $OldRow);
         // Force the menu to come from the parent
         vgaSet('menu_selected', $this->table_id_parent);
     }
 }
Exemplo n.º 6
0
 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());
 }
Exemplo n.º 7
0
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;
}