function ValueSet($key, $value)
{
    echo "Calling Valueset {$key} <br/>";
    vgfSet($key, $value);
    if (!isset($GLOBALS['AG']['values'])) {
        $GLOBALS['AG']['values'] = array();
    }
    $GLOBALS["AG"]["values"][$key] = $value;
}
Esempio n. 2
0
 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', '&nbsp;', '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);
     }
 }
Esempio n. 3
0
function tmpModuleLeft()
{
    // April 4, 2007, KFD.  Allow a breakout here
    if (function_exists('appModuleLeft')) {
        $continue = appModuleLeft();
        return $continue;
    }
    //echo "<br/>";
    if (!LoggedIn()) {
        return;
    }
    // Only display menu if
    if (OptionGet('MENULEFT', 'Y') == 'Y') {
        $module = SessionGet("AGMENU_MODULE");
        $AGMENU = SessionGet("AGMENU");
        $kount = 0;
        if (isset($AGMENU[$module])) {
            $desc = $AGMENU[$module]['description'];
            echo "<ul class=\"nav nav-list\">";
            echo "<li class=\"nav-header\">{$desc}</li>";
            foreach ($AGMENU[$module]['items'] as $key => $info) {
                $hExtra = ' tabindex="' . hpTabIndexNext(100) . '"';
                // We may make the first item the focused item if nothing else
                // has been picked yet.  This code runs when rendering is going on
                // and the class-specific biz code has all run already, so it will
                // not override any business-specific focus setting
                if (vgfGet('HTML_focus') == '') {
                    $hExtra .= ' ID="FIRSTSPLITMENU" NAME="FIRSTSPLITMENU" ';
                    vgfSet('HTML_focus', 'FIRSTSPLITMENU');
                }
                $kount++;
                $d = '?gp_page=' . $key;
                $h = hLink("mainlevel", $info['description'], $d, $hExtra);
                echo "\n<li>{$h}</li>";
                // Possibly two more links
                if (ArraySafe($info, 'linknew') == 'Y') {
                    $hx = ' tabindex="' . hpTabIndexNext(100) . '" style="margin-left:30px"';
                    $h = hLink("mainlevel", 'New', $d . '&gp_mode=ins', $hx);
                    echo "\n<li>{$h}</td></li>";
                }
                if (ArraySafe($info, 'linksearch') == 'Y') {
                    $hx = ' tabindex="' . hpTabIndexNext(100) . '" style="margin-left:30px"';
                    $h = hLink("mainlevel", 'Search', $d . '&gp_mode=search', $hx);
                    echo "\n<li>{$h}</li>";
                }
            }
            echo "</ul>";
        }
    }
    if (isset($continue)) {
        return $continue;
    }
    //while ($kount++ < 30) { echo "<br>"; }
}
Esempio n. 4
0
 function mainLayout($container)
 {
     # Erase default help message
     vgfSet('htmlHelp', '');
     configLayoutX4($container, 'Application');
 }
Esempio n. 5
0
 function mainLayout($container)
 {
     # Erase default help message
     vgfSet('htmlHelp', '');
     html('h1', $container, 'Configuration Review');
     $table = html('table', $container);
     $table->hp['id'] = 'x2data1';
     $thead = html('thead', $table);
     $tr = html('tr', $thead);
     $tr->h('th', 'Setting', 'dark');
     $tr->h('th', 'Framework', 'dark');
     $tr->h('th', 'Application', 'dark');
     $tr->h('th', 'Instance', 'dark');
     $tr->h('th', 'User', 'dark');
     $tr->h('th', 'Your Setting', 'dark');
     # Include any of the files that exist
     $dir = fsDirTop() . "/dynamic/table_config";
     $configfw = $configapp = $configinst = $configuser = array();
     if (file_exists($dir . 'fw.php')) {
         include $dir . 'fw.php';
     }
     if (file_exists($dir . 'app.php')) {
         include $dir . 'app.php';
     }
     if (file_exists($dir . 'inst.php')) {
         include $dir . 'inst.php';
     }
     if (file_exists($dir . 'user_' . SessionGet('UID') . '.php')) {
         include $dir . 'user_' . SessionGet('UID') . '.php';
     }
     $dd = ddTable('configapp');
     $askip = array('recnum', 'skey', 'skey_quiet', '_agg', 'uid_ins');
     $tbody = html('tbody', $table);
     $flipper = 0;
     foreach ($dd['flat'] as $column_id => $colinfo) {
         if (in_array($column_id, $askip)) {
             continue;
         }
         $tr = html('tr', $tbody);
         if ($flipper > 2) {
             $tr->addClass('lightgray');
         } else {
             if ($flipper != 2) {
                 $tr->addClass('lightgraybottom');
             }
         }
         $flipper += 1;
         if ($flipper == 6) {
             $flipper = 0;
         }
         html('td', $tr, $colinfo['description']);
         # The four levels from files
         html('td', $tr, a($configfw, $column_id));
         html('td', $tr, a($configapp, $column_id));
         html('td', $tr, a($configinst, $column_id));
         if (a($colinfo, 'flagcarry', 'N') == 'Y') {
             html('td', $tr, a($configuser, $column_id));
         } else {
             html('td', $tr, 'n/a');
         }
         # The final resolved value
         html('td', $tr, ConfigGet($column_id));
     }
 }
Esempio n. 6
0
 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', '&nbsp', '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}')";
     }
 }
Esempio n. 7
0
    function mainHelp()
    {
        if ($this->table_id == 'menu') {
            vgfSet('htmlHelp', false);
            return;
        }
        ob_start();
        ?>
        <div style="font-size:125%; line-height: 125%">
        <h2>Some basic ideas:</h2>
        <ul>
<li>When in doubt, keep hitting ESC to you get back to the menu
<li>The buttons are activated by CTRL- combinations, they have
underlined letters that show this, so:
    <ul><li>CTRL-A is equivalent to hitting [Add...]
        <li>CTRL-S is equivalent to hitting [SAVE]
        <li>etc.
    </ul>
<li>A button is grayed out when it cannot be used
</ul>

    <h2>The Search Screen</h2>
    <p>When you are in search mode, there are some advanced search
    abilities available:
    <ul><li>Just start typing in any box and see what comes up!
        <li>Whichever box you type in is automatically the sorted column
        <li>You can hit Shift-UpArrow or Shift-DownArrow to force sorting
            on a particular column
        <li>You can click on the column headers to force a search
        <li>Searches can contain lists, like "d,g,p" 
        <li>Searches can contain ranges, like "100--120"
        <li>Searches can contain comparisons, like "&gt;100" or "&lt;200"
        <li>Advanced search abilities can be combined, like "d,f--g,>x"
    </ul>
    </div>
        
        
        <?php 
        vgfSet('htmlHelp', ob_get_clean());
    }
Esempio n. 8
0
function mosShowListMenu($menutype)
{
    // -------------------------------------------------------
    // Andromeda Code: If we are in an Andromeda situation
    // then everything is vastly simplified, we already have
    // the menu and we don't do much conversion
    // -------------------------------------------------------
    if (defined('_ANDROMEDA_JOOMLA')) {
        if (!LoggedIn()) {
            return;
        }
        // KFD 7/6/07, cache the menu so we don't have to do
        // this on every call.
        // Cachegrind cost to build menu          : 259 / 199
        // Cachegrind cost logging in             : 140
        // Cachegrind cost login, cache to session: 2!!!!
        // Cachegrind cost to cache to disk       : 400!
        # KFD 4/17/08, rebuild menu if they switched modes
        # KFD 6/21/08, simplify this by just looking at x4Welcome
        #$menu_mode = gpExists('x4Page')
        #  ? (vgfGet('x4menu',false)==true ? 'x4' : 'classic')
        #  : 'classic';
        $menu_mode = configGet('x4welcome', 'N') == 'Y' ? 'x4' : 'classic';
        vgfSet('menu_mode', $menu_mode);
        # KFD 6/21/08 (END)
        if ($menu_mode != SessionGet('menu_mode')) {
            sessionSet('menu', '');
            sessionSet('menu_mode', $menu_mode);
        }
        $menu = SessionGet('menu', '');
        if ($menu != '') {
            echo $menu;
            return;
        }
        ob_start();
        $children = array();
        $open = array();
        $indents = array(array("<ul>", "<li>", "</li>", "</ul>"));
        $class_sfx = null;
        $hilightid = SessionGET('AGMENU_MODULE');
        $hilightid = '';
        $menus = SessionGET("AGMENU");
        foreach ($menus as $menuid => $menuinfo) {
            //if($menuid=='datadict') continue;
            //if($menuid=='sysref')   continue;
            $x = new joomla_fake();
            $x->type = 'url';
            $x->id = $menuid;
            if (sessionGet('menu_mode') == 'x4') {
                $x->link = 'javascript:void(0);';
            } else {
                $x->link = "?x_module=" . urlencode($menuid);
            }
            $x->browserNav = '';
            $x->name = $menuinfo['description'];
            $children[0][] = $x;
            foreach ($menuinfo['items'] as $page => $pageinfo) {
                $x = new joomla_fake();
                $x->type = 'url';
                $x->id = $page;
                # KFD 6/26/08, the vgfX(x4) was experimental, get rid of it
                #if(vgfGet('x4')===true) {
                #    $pd = $pageinfo['description'];
                #    $x->link="javascript:x4Page('$page','$pd')";
                #}
                #else {
                # KFD 6/26/08, work out the menu mode first
                $xmode = 'x2';
                if (sessionGet('menu_mode') == 'x4') {
                    $xmode = a($pageinfo, 'uix2', 'N') == 'Y' ? 'x2' : 'x4';
                }
                if ($xmode == 'x4') {
                    $x->link = '?x4Page=' . urlencode($page);
                    $x->link .= '&x4Return=' . vgaGet('nopage', 'menu');
                } else {
                    $x->link = "?x_module={$menuid}&x2=1&gp_page=" . urlencode($page);
                }
                if (ArraySafe($pageinfo, 'menu_parms') != '') {
                    $x->link .= '&' . urlencode($pageinfo['menu_parms']);
                }
                #}
                $x->browserNav = '';
                $x->name = $pageinfo['description'];
                $children[$menuid][] = $x;
            }
        }
        mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid);
        $menu = ob_get_clean();
        echo $menu;
        SessionSet('menu', $menu);
        //$fsMenuFileHTML=ob_get_clean();
        //file_put_contents($fsMenuFile,$fsMenuFileHTML);
        //echo $fsMenuFileHTML;
        return;
    }
    // -------------------------------------------------------
    // Andromeda Code: END
    // -------------------------------------------------------
    global $database, $my, $cur_template, $Itemid;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_shownoauth;
    $class_sfx = null;
    $hilightid = null;
    /* If a user has signed in, get their user type */
    $intUserType = 0;
    if ($my->gid) {
        switch ($my->usertype) {
            case 'Super Administrator':
                $intUserType = 0;
                break;
            case 'Administrator':
                $intUserType = 1;
                break;
            case 'Editor':
                $intUserType = 2;
                break;
            case 'Registered':
                $intUserType = 3;
                break;
            case 'Author':
                $intUserType = 4;
                break;
            case 'Publisher':
                $intUserType = 5;
                break;
            case 'Manager':
                $intUserType = 6;
                break;
        }
    } else {
        /* user isn't logged in so make their usertype 0 */
        $intUserType = 0;
    }
    if ($mosConfig_shownoauth) {
        $database->setQuery("SELECT m.*, count(p.parent) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering ");
    } else {
        $database->setQuery("SELECT m.*, sum(case when p.published=1 then 1 else 0 end) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1' AND m.access <= '{$my->gid}'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering ");
    }
    $rows = $database->loadObjectList('id');
    echo $database->getErrorMsg();
    //work out if this should be highlighted
    $sql = "SELECT m.* FROM #__menu AS m" . "\nWHERE menutype='" . $menutype . "' AND m.published='1'";
    $database->setQuery($sql);
    $subrows = $database->loadObjectList('id');
    $maxrecurse = 5;
    $parentid = $Itemid;
    //this makes sure toplevel stays hilighted when submenu active
    while ($maxrecurse-- > 0) {
        $parentid = getParentRow($subrows, $parentid);
        if (isset($parentid) && $parentid >= 0 && $subrows[$parentid]) {
            if (vgfGet('menu_mode') != 'x4') {
                $hilightid = $parentid;
            }
        } else {
            break;
        }
    }
    if (vgfGet('menu_mode') == 'x4') {
        $hilightid = '';
    }
    //echo "<!--[if lte IE 7]>\n";
    include_once "{$mosConfig_absolute_path}/templates/" . $cur_template . "/js/ie.js";
    //echo "<![endif]-->\n";
    $indents = array(array("<ul>", "<li>", "</li>", "</ul>"));
    // establish the hierarchy of the menu
    $children = array();
    // first pass - collect children
    foreach ($rows as $v) {
        $pt = $v->parent;
        $list = @$children[$pt] ? $children[$pt] : array();
        array_push($list, $v);
        $children[$pt] = $list;
    }
    // second pass - collect 'open' menus
    $open = array($Itemid);
    $count = 20;
    // maximum levels - to prevent runaway loop
    $id = $Itemid;
    while (--$count) {
        if (isset($rows[$id]) && $rows[$id]->parent > 0) {
            $id = $rows[$id]->parent;
            $open[] = $id;
        } else {
            break;
        }
    }
    $class_sfx = null;
    mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid);
}
Esempio n. 9
0
    function CheckRemoteUID($node)
    {
        // If the node we were last on is not the current one, wipe
        // out any memory of previous UID and PWD
        if (SessionGet('remoteNODE') != $node) {
            SessionSet('remoteUID', '');
            SessionSet('remotePWD', '');
            SessionSet('remoteNODE', $node);
        }
        // Already a user?  Fine, go back.
        if (SessionGet('remoteUID') != '') {
            return true;
        }
        // If they posted a uid/pw, assume it is ok and go back
        // and tell them to continue.  Notice we don't check or anything,
        // to do that we'd have to have a function on the remote server
        // that told us if a login was ok, and we kind of don't really
        // want that, it could be abused.
        if (gp('remoteUID') != '') {
            SessionSet('remoteUID', gp('remoteUID'));
            SessionSet('remotePWD', gp('remotePWD'));
            return true;
        }
        ?>
      <p>
      The authoritative node for this application is <b><?php 
        echo $node;
        ?>
</b>.
      Please provide your user id and password for that node.
      </p>
      <table>
      <tr><td style="text-align: right">Remote user id
          <td style="text-align: left"><input name="remoteUID" id="remoteUID" 
                                        tabindex="<?php 
        echo hpTabIndexNext(100);
        ?>
">
      <tr><td style="text-align: right">Remote password
          <td style="text-align: left"><input name="remotePWD" type="password"
                     tabindex="<?php 
        echo hpTabIndexNext(100);
        ?>
">
      </table>
      <br/>
      <input type="submit" value="Save" tabindex="<?php 
        echo hpTabIndexNext(100);
        ?>
">
      
      <?php 
        vgfSet('HTML_focus', 'remoteUID');
        // Since we don't have a remote uid/pwd anymore, return false
        // so they don't display the rest of the page
        return false;
    }
Esempio n. 10
0
 function tabIndex($startHere = null)
 {
     if (!is_null($startHere)) {
         $tabIndex = $startHere;
     } else {
         $tabIndex = vgfGet('tabindex', 0);
         if ($tabIndex == 0) {
             $this->hp['x6firstFocus'] = 'Y';
             $tabIndex = 1000;
         }
     }
     $this->hp['tabIndex'] = $tabIndex;
     vgfSet('tabindex', ++$tabIndex);
     if (is_object(vgfGet('lastTab', 0))) {
         $obj = vgfGet('lastTab');
         $obj->hp['xNextTab'] = $this->hp['tabIndex'];
         $this->hp['xPrevTab'] = $obj->hp['tabIndex'];
     }
     vgfSet('lastTab', $this);
 }
Esempio n. 11
0
 function hBoxesFromAhComprehensive($ahc, $mode = 'upd')
 {
     $HFirst = '';
     ob_start();
     $count = 0;
     foreach ($ahc as $colname => $colinfo) {
         $count++;
         $extra = $colinfo['input'] == 'textarea' ? 'style="vertical-align:top; padding-top:2px"' : '';
         if ($colinfo['writeable'] && $HFirst == '') {
             $HFirst = $colinfo['parms']['name'];
         }
         if (!isset($this->table['flat'][$colname])) {
             echo "Reference non-existent column: " . $colname;
             exit;
         }
         $desc = $this->table['flat'][$colname]['description'];
         $hr = $colinfo['hright'] == '' ? '' : '&nbsp;&nbsp;' . $colinfo['hright'];
         echo "\n<tr>";
         echo "\n" . hTD('inp-caption', $desc, 'id="inp-caption" ' . $extra);
         echo "\n" . hTD('inp-input', $colinfo['html'] . $hr);
         if ($count == 1 && $mode == 'search') {
             ?>
         <td rowspan="99" 
               style="border: 1px solid #606060;
                     width: 33%;
                     padding: 0px 8px;
                     background-color: #E0FFE0">
         <h3>Lookup Mode</h3>
         Fill in as many boxes as you like.  Hit
         ENTER or ALT-L to execute the lookup.
         <br/><br/>
         Put a "%" sign anywhere to act as a wildcard.
         <br/><br/>
         Use "&gt;" for greater than, as in "&gt;Jones"
         or "&gt;5/1/07" or "&gt;200".  The "&lt;" works
         the same way.
         <br/><br/>
         Use a dash for ranges as in "100-200" or
         "5/1/07-6/31/07".
         <br/><br/>
         Use a comma for lists of exact values, as in
         "5/1/07,3/31/06" or "Jones,Smith"
         <br/><br/>
         You can also do combinations, such as "&lt;2,6,7-10,&gt;15"
         <br/><br/>
         All searches are case-insensitive.
         
         </td>
         <?php 
         }
         echo "\n</tr>";
     }
     vgfSet('HTML_focus', $HFirst);
     return ob_get_clean();
 }
Esempio n. 12
0
<?php

# Deprecate files list:
#
# a_pullsvna.php, since 4/14/08, not necessary after we "rationalized"
#                  the downloads.
//vgaSet('MENU_TYPE','TABLE');
global $MPPages;
$MPPages = array('public_downloads' => 1);
vgfSet('ajaxTM', 0);
vgfSet('loglogins', true);
vgfSet('buttons_in_commands', true);
vgfSet('template', 'bootstrap');
/* FUTURE X6 STUFF 
function app_nopage() {
    if(LoggedIn()) {
        return 'cpanel';
    }
}

function defaultSuperUser() {
    return 'install';
}
*/
function AppDir($app)
{
    $app = trim($app);
    $wp = SQL_OneValue('dir_pub', "Select dir_pub\n         from applications a\n         JOIN webpaths     w ON a.webpath=w.webpath\n        WHERE a.application='{$app}'");
    return trim($wp) . "/{$app}/";
}
function AppDirs($app)
Esempio n. 13
0
    function MD5_ForgotPage0()
    {
        // Next time around go to page 1
        vgfSet("HTML_focus", "txt_email");
        echo hErrors();
        ?>
      <input type="hidden" name="gpp" value="1">
		<p>Please enter your user_id below so that we can process your
      request.  You will be sent an email that contains
      further instructions.</p>
	
		<p>This page is <b>case-sensitive</b>, so that 'John' is
         not the same thing as 'JOHN' or 'john'.</p>
      <p>User id:
  		   <input name="txt_user_id" id="txt_user_id" width="30"
			  value="<?php 
        echo CleanGet("txt_user_id", "", false);
        ?>
"></input>
      </p>
           
		<br><br>
		<button type="submit" value="Submit">Submit</button>

	<?php 
    }
Esempio n. 14
0
function index_hidden_template($mode)
{
    # KFD 1/10/08.  If x6 is set, we follow a completely different
    #               path, x6 settings win out.
    $flagx6 = configGet('flag_x6', 'N');
    $x6template = configGet('x6_template', '');
    $x6group = configGet('x6_group', '');
    if ($flagx6 == 'Y') {
        # In x6, we consider the "app_template()" function first,
        # if it returns something it always wins.
        if (function_exists('app_template')) {
            vgfSet('template', app_template());
        } else {
            if ($x6template == '') {
                vgfSet('template', 'x6');
            } else {
                if (!LoggedIn() || inGroup($x6group)) {
                    vgfSet('template', $x6template);
                } else {
                    vgfSet('template', 'x6');
                }
            }
        }
    } else {
        # this is old x2/x4 mode, begin by obtaining a
        # 'candidate' they may have been set
        $candidate = vgfGet('template');
        # KFD 7/23/08. Give application a chance to
        #              play with setting
        if (function_exists('app_template')) {
            vgfSet('template', app_template($candidate));
        }
        # KFD 7/23/08. If no template has been set by vgfSet,
        #              and the candidate is not empty, pick it
        if ($candidate != '' && vgfGet('template') == '') {
            vgfSet('template', $candidate);
        }
        # KFD 7/23/08. Finally, if we still don't have something,
        #              pick according to mode
        if (vgfGet('template') == '') {
            if ($mode == 'x4') {
                vgfSet('template', 'pixel2');
            } else {
                vgfSet('template', 'rt_pixel');
            }
        }
    }
    # KFD 9/2/08.  We still have one customer with a public
    #        interface that is not a Joomla template.  If the
    #        template is "*" then we DO NOT set up Joomla
    #        compatibility.  The application will use its own
    #        file in the application directory that is specified
    #        with vgaSet('html_pub').
    if (vgfGet('template') == '*') {
        return;
    }
    # Tell the JOOMLA files that we are legit
    # Fool them, that is...
    define("_ANDROMEDA_JOOMLA", 1);
    define("_JOOMLA_ANDROMEDA", 1);
    # Activate the template by creating public $J and calling funcs
    global $J, $AG;
    $J['TEMPLATE'] = vgfGet('template');
    JoomlaCompatibility($J['TEMPLATE']);
    $aphp = $AG['dirs']['root'] . '/templates/' . $J['TEMPLATE'] . '/andromeda.php';
    if (file_exists($aphp)) {
        include $aphp;
    }
    # <----- EARLY RETURN
    # The rest of this is totally superseded, and can
    # be removed after we go live with Beta 1
    return;
    /*
     global $AG;
    # KFD 7/3/08.  Have the vgfGet() value override anything else
    #
    if(vgfGet('template')<>'') {
        # Assign the template to spots where the legacy code will find it
        $AG['template'] = vgfGet('template');
    }
    
    // First conditional fix contributed by Don Organ 9/07, $AG['template']
    // was getting lost on passes 2+
    if(ArraySafe($AG,'template')<>'') {
        SessionSet('TEMPLATE',$AG['template']); 
    }
    else {
        if(SessionGet("TEMPLATE")=='') {
           if(!file_exists(fsDirTop().'templates')) {
              // There is no templates directory, so stop looking
              SessionSet('TEMPLATE','*');
           }
           else {
              if(ArraySafe($AG,'template')<>'') {
                 // if the app or instance specified a template at build time,
                 // use that.
                 SessionSet('TEMPLATE',$AG['template']);
              }
              else {
                 // At this point nobody has told us what to do, pick the
                 // first template we can find.
                 
                 // Big change by KFD 3/15/08  If we do not know what
                 // template to use, prefer to pick rt_pixel, our 
                 // default template, unless we find another one.
                 // In that case we assume that template is there for
                 // a reason and we use it.
                 $dir = $AG['dirs']['root'].'templates/';
                 $DIR = opendir($dir);
                 $rt_pixel = false;
                 while (false!==($filename = readdir($DIR))) {
                    if ($filename=='.')  continue;
                    if ($filename=='..') continue;
                    if ($filename=='andro_classic') continue;
                    if ($filename=='x4') continue;
                    // DO 2-1-2008 Added to ignore SVN directory
                    if ($filename=='.svn') continue;
                    if ($filename=='rt_pixel') $rt_pixel = true; 
                    if (is_dir($dir.$filename)) {
                       SessionSet('TEMPLATE',scFileName($filename));
                       break;
                    }
                 }
                 closedir($DIR);
                 // Here is where we pick rt_pixel if we could not
                 // find anything else
                 if($rt_pixel && SessionGet('TEMPLATE','')=='') {
                     SessionSet('TEMPLATE',$rt_pixel);
                 }
              }
           }
        }
    }
    // Now if a template was identified
    if(SessionGet("TEMPLATE")<>'*') {
       // Notify any code that may need to know that we are in a hybrid
       // Andromeda-joomla situation.  This is for both template code and
       // Andromeda code.  We define both variables in case people forget
       // which one we defined.
       define("_ANDROMEDA_JOOMLA",1); 
       define("_JOOMLA_ANDROMEDA",1); 
       
       // Activate the template by creating public $J and calling funcs
       global $J;
       $J['TEMPLATE']=SessionGet('TEMPLATE');
       JoomlaCompatibility($J['TEMPLATE']);
       $aphp=$AG['dirs']['root'].'/templates/'.$J['TEMPLATE'].'/andromeda.php';
       if(file_exists($aphp)) {
          include($aphp);
       }
    }
    */
}
Esempio n. 15
0
    function ehMain()
    {
        hidden('gp_page', 'reports');
        hidden('gp_skey', gp('gp_skey'));
        if ($this->mode != 'upd') {
            parent::ehMain();
            return;
        }
        // Reset this, set it later
        vgfSet('HTML_focus', '');
        ?>
      <script>
      function TableAdd() {
         TableX=ob('sel_tablesavl').value
         if(TableX=='') {
            alert("Please choose a table from the list first");
         }
         else {
            sndReq('&gp_ajax=tableadd&gp_rtable='+TableX);
         }
      }
      function TableDel() {
         TableX=ob('sel_tablesrep').value
         if(TableX=='') {
            alert("Please choose a table from the list first");
         }
         else {
            sndReq('&gp_ajax=tabledel&gp_rtable='+TableX);
         }
      }
      function ColumnAdd() {
         ColumnX=ob('sel_columnsavl').value
         if(ColumnX=='') {
            alert("Please choose a column from the list first");
         }
         else {
            sndReq('&gp_ajax=columnadd&gp_rcolumn='+ColumnX);
         }
      }
      function ColumnSort() {
         ColumnX=ob('sel_columnsrep').value
         if(ColumnX=='') {
            alert("Please choose a column from the list first");
         }
         else {
            sndReq('&gp_ajax=columnsort&gp_rcolumn='+ColumnX);
         }
      }
      function ColumnUnSort() {
         ColumnX=ob('sel_colsort').value
         if(ColumnX=='') {
            alert("Please choose a column from the list first");
         }
         else {
            sndReq('&gp_ajax=columnunsort&gp_rcolumn='+ColumnX);
         }
      }
      
      
      </script>
      <h1><?php 
        echo $this->PageSubtitle;
        ?>
</h1>
      <table cellpadding=0 cellspacing=0 width=100%  
             style="border-collapse:collapse">
        <tr>
          <td height="40" valign=top><?php 
        echo $this->h['ButtonBar'];
        ?>
        </tr>
        <tr>
          <td>
            <hr/>
            <div class="x2menubar" id="x2tabbar" name="x2tabbar">
            <?php 
        echo $this->ehTabbar(false);
        ?>
            <hr/>
            </div>
          </td>
        </tr>
        <tr><td>&nbsp;
        <tr>
          <td class="x2_content" id="x2_content" name="x2_content">
          <?php 
        echo $this->ehTab_Main();
        ?>
          </td>
        </tr>
      </table>
      <?php 
        return;
    }
Esempio n. 16
0
 function Login_Process()
 {
     $arg2 = $this->directlogin == true ? 'direct' : '';
     // only process if user hit "post"
     if (gp('gp_posted', '', false) == '') {
         return;
     }
     vgfSet('LoginAttemptOK', false);
     // Error title
     vgfSet('ERROR_TITLE', '*');
     // If the user supplied a loginUID, this is a post and we
     // must process the request.
     $ale = vgaGet('login_errors', array());
     $app = $GLOBALS['AG']['application'];
     $em000 = isset($ale['000']) ? $ale['000'] : "That username/password combination did not work.  Please try again.";
     $em001 = isset($ale['001']) ? $ale['001'] : "That username/password combination did not work.  Please try again.";
     $em002 = isset($ale['002']) ? $ale['002'] : "That username/password combination did not work.  Please try again.";
     $em099 = isset($ale['099']) ? $ale['099'] : "That username/password combination did not work.  Please try again.";
     $terror = "";
     $uid = gp('loginUID');
     $uid = MakeUserID($uid);
     //$uid = str_replace('@','_',$uid);
     //$uid = str_replace('.','_',$uid);
     $pwd = gp("loginPWD", "", false);
     // First check, never allow the database server's superuser
     // account
     //
     if ($uid == "postgres") {
         ErrorAdd($em000);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt as postgres");
             fwLogEntry('1011', 'Attempt login as postgres', '', $arg2);
         }
         return;
     }
     $app = $GLOBALS['AG']['application'];
     if (substr($uid, 0, strlen($app)) == $app) {
         ErrorAdd($em001);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt as group role");
             fwLogEntry('1012', 'Attempt login as group role', $uid, $arg2);
         }
         return;
     }
     // Begin with a connection attempt.
     // on fail, otherwise continue
     $tcs = @SQL_CONN($uid, $pwd);
     if ($tcs === false) {
         ErrorAdd($em099);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_NOTICE, "Andromeda:{$app}:Bad login attempt server rejected");
             fwLogEntry('1013', 'Server rejected username/password', $uid, $arg2);
         }
         return;
     } else {
         SQL_CONNCLOSE($tcs);
     }
     // The rest of this routine uses an admin connection.  If we
     // have an error, we must close the connection before returning!
     //    ...yes, yes, that's bad form, all complaints to /dev/null
     //
     if (vgfGet('loglogins', false)) {
         fwLogEntry('1010', 'Login OK', $uid, $arg2);
     }
     scDBConn_Push();
     // See if they are a root user.  If not, do they have an
     //  active account?
     $root = false;
     $admin = false;
     $group_id_eff = '';
     $results = SQL("\n         Select oid\n           FROM pg_roles   \n          WHERE rolname = CAST('{$uid}' as name)\n            AND rolsuper= true");
     $cr = SQL_NUMROWS($results);
     if ($cr != 0) {
         $root = true;
     } else {
         $results = SQL("Select * from users WHERE LOWER(user_id)='{$uid}'" . "AND (user_disabled<>'Y' or user_disabled IS NULL)");
         $cr = SQL_NUMROWS($results);
         if ($cr == 0) {
             scDBConn_Pop();
             ErrorAdd($em002);
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt code 002");
             return;
         } else {
             $userinfo = SQL_Fetch_Array($results);
             $group_id_eff = $userinfo['group_id_eff'];
             SessionSet('user_name', $userinfo['user_name']);
         }
     }
     // Flag if the user is an administrator
     if ($root == true) {
         $admin = true;
     } else {
         $results = SQL("select count(*) as admin from usersxgroups " . "where user_id='{$uid}' and group_id ='{$app}" . "_admin'");
         $row = SQL_FETCH_ARRAY($results);
         $admin = intval($row["admin"]) > 0 ? true : false;
     }
     // Get the users' groups
     $groups = "";
     if ($root) {
         $results = SQL("\n            select group_id \n              from zdd.groups \n             where COALESCE(grouplist,'')=''");
     } else {
         $results = SQL("select group_id from usersxgroups WHERE LOWER(user_id)='{$uid}'");
     }
     while ($row = SQL_FETCH_ARRAY($results)) {
         $agroups[] = "'" . trim($row['group_id']) . "'";
         #$groups.=ListDelim($groups)."'".trim($row["group_id"])."'";
     }
     $groups = array();
     if (!empty($agroups)) {
         $groups = implode(",", $agroups);
     }
     //scDBConn_Pop();
     // We have a successful login.  If somebody else was already
     // logged in, we need to wipe out that person's session.  But
     // don't do this if there was an anonymous login.
     if (LoggedIn()) {
         $uid_previous = SessionGet('UID');
         if ($uid != $uid_previous) {
             //Session_Destroy();
             SessionReset();
             //Index_Hidden_Session_Start(false);
         }
     }
     // We know who they are and that they can connect,
     // see if there is any app-specific confirmation required
     //
     if (function_exists('app_login_process')) {
         //echo "Calling the process now";
         if (!app_login_process($uid, $pwd, $admin, $groups)) {
             return;
         }
     }
     // Protect the session from hijacking, generate a new ID
     Session_regenerate_id();
     // We now have a successful connection, set some
     // flags and lets go
     //
     vgfSet('LoginAttemptOK', true);
     SessionSet("UID", $uid);
     SessionSet("PWD", $pwd);
     SessionSet("ADMIN", $admin);
     SessionSet("ROOT", $root);
     SessionSet("GROUP_ID_EFF", $group_id_eff);
     SessionSet("groups", $groups);
     if (gp('gpz_page') == '') {
         # KFD 9/12/08, extra command to not change page
         if (gp('st2keep') != 1) {
             gpSet('gp_page', '');
         }
     }
     $GLOBALS['session_st'] = 'N';
     // for "N"ormal
     // -------------------------------------------------------------------
     // We are about to make the menu.  Before doing so, see if there
     // are any variables set for the menu layout.  Set defaults and then
     // load from database.
     //
     $this->pmenu = array('MENU_TYPE' => vgaGet('MENU_TYPE', 'div'), 'MENU_CLASS_MODL' => vgaGet('MENU_CLASS_MODL', 'modulename'), 'MENU_CLASS_ITEM' => vgaGet('MENU_CLASS_ITEM', 'menuentry'), 'MENU_TICK' => vgaGET('MENU_TICK', ' - '));
     //$sql = "SELECT * from variables WHERE variable like 'MENU%'";
     //$dbres = SQL($sql);
     //while ($row = SQL_FETCH_ARRAY($dbres)) {
     //   $this->pmenu[trim($row['variable'])]=trim($row['variable_value']);
     //}
     // -------------------------------------------------------------------
     // KFD 10/28/06, Modified to examine "nomenu" instead of permsel
     //   pulls all tables user has nomenu='N'.  The basic idea is
     //   to remove from $AGMENU the stuff they don't see
     //
     // GET AGMENU
     $AGMENU = array();
     // avoid compiler warning, populated next line
     include "ddmodules.php";
     // Pull distinct modules person has any menu options in.
     $sq = "SELECT DISTINCT module\n             FROM zdd.perm_tabs \n            WHERE nomenu='N'\n              AND group_id iN ({$groups})";
     $modules = SQL_AllRows($sq, 'module');
     $AGkeys = array_keys($AGMENU);
     foreach ($AGkeys as $AGkey) {
         if (!isset($modules[$AGkey])) {
             unset($AGMENU[$AGkey]);
         }
     }
     // Now recurse the remaining modules and do the same trick
     // for each one, removing the tables that don't exist
     foreach ($AGMENU as $module => $moduleinfo) {
         $sq = "SELECT DISTINCT table_id\n                FROM zdd.perm_tabs \n               WHERE nomenu='N'\n                 AND module = '{$module}'\n                 AND group_id iN ({$groups})";
         $tables = SQL_AllRows($sq, 'table_id');
         $tkeys = array_keys($moduleinfo['items']);
         foreach ($tkeys as $tkey) {
             if (!isset($tables[$tkey])) {
                 unset($AGMENU[$module]['items'][$tkey]);
             }
         }
     }
     // KFD 12/18/06.  Put all table permissions into session
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND nomenu='N'", 'table_id');
     SessionSet('TABLEPERMSMENU', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permsel='Y'", 'table_id');
     SessionSet('TABLEPERMSSEL', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permins='Y'", 'table_id');
     SessionSet('TABLEPERMSINS', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permupd='Y'", 'table_id');
     SessionSet('TABLEPERMSUPD', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permdel='Y'", 'table_id');
     SessionSet('TABLEPERMSDEL', array_keys($table_perms));
     //echo "<div style='background-color:white'>";
     //echo "$uid $groups $group_id_eff";
     //hprint_r(SessionGet('TABLEPERMSMENU'));
     //hprint_r(SessionGet('TABLEPERMSSEL'));
     //echo "</div>";
     // KFD 7/9/07, we always use joomla templates now, don't need
     // options to turn them off
     //if(defined('_ANDROMEDA_JOOMLA')) {
     // In a hybrid situation, put the menu into the session
     SessionSet('AGMENU', $AGMENU);
     //}
     $HTML_Menu = "";
     $WML_Menu = "";
     /*
     foreach ($AGMENU as $key=>$module) {
        //if($key=="datadict") continue;
        //if($key=="sysref")   continue;
        $HTML_Module="";
        $WML_Module="";
        foreach($module["items"] as $itemname=>$item) {
           if (!isset($item["mode"])) { $item["mode"]="normal"; }
           switch ($item["mode"]) {
              case "normal":
                 $ins=false;
                 $extra=array();
                 if($item['menu_parms']<>'') {
                    $aextras=explode('&',$item['menu_parms']);
                    foreach($aextras as $aextra) {
                       list($var,$value)=explode("=",$aextra);
                       $extra[$var]=$value;
                    }
                 }
                 $HTML_Module.=$this->_MenuItem(
                    $item['description'],$itemname,$ins,$extra
                 );
                 $WML_Module.="<div>";
                 $WML_Module.=hLink(
                    '',$item['description'],'?gp_page='.$itemname
                 );
                 $WML_Module.="</div>";
                 break;
              case "ins":
                 //if ($admin || isset($tables_ins[$item["name"]]))  {
                    $HTML_Module.=$this->_MenuItem(
                       $item['description'],$itemname,true
                    );
                 //}
                 break;
                    
                    #$HTML_Module.=
                    #   "\n<font class=\"tablename\">- <a href=\"index.php?gp_page=".$itemname."\">".
                    #   $item["description"]."</a></font><br />";
                    
              }
        }
        
        // the module is defined AFTER its contents so it can be
        // left off if it has no entries
        if ($HTML_Module!="") {
           $HTML_Menu.=$this->_MenuModule($module['description']);
           $HTML_Menu.=$HTML_Module;
        }
        if ($WML_Module!="") {
           $WML_Menu.="<div><b>".$module['description']."</b></div>";
           $WML_Menu.=$WML_Module;
        }
     }
     */
     DynamicSave("menu_" . $uid . ".php", $HTML_Menu);
     DynamicSave("menu_wml_" . $uid . ".php", $WML_Menu);
     // -------------------------------------------------------------------
     // Fetch and cache user preferences
     if (vgaGet('member_profiles')) {
         cacheMember_Profiles();
     }
     // -------------------------------------------------------------------
     // Now find the user's table permissions more precisely table by table
     $sql = "select p.table_id,\n\t\t\t\tmax(case when p.permins='Y' then 1 else 0 end) as permins,\n\t\t\t\tmax(case when p.permupd='Y' then 1 else 0 end) as permupd,\n\t\t\t\tmax(case when p.permdel='Y' then 1 else 0 end) as permdel,\n\t\t\t\tmax(case when p.permsel='Y' then 1 else 0 end) as permsel\n\t\t\t\tfrom zdd.perm_tabs  P\n\t\t\t\tWHERE group_id in ({$groups})\n\t\t\t\tGROUP BY p.table_id";
     //echo $sql;
     $results = SQL($sql);
     $HTML_Perms = "<?php\n\$table_perms = array();\n";
     while ($row = SQL_FETCH_ARRAY($results)) {
         $tn = $row["table_id"];
         $ti = $row["permins"];
         $tu = $row["permupd"];
         $td = $row["permdel"];
         $ts = $row["permsel"];
         $HTML_Perms .= "\$table_perms[\"{$tn}\"]=array(\"ins\"=>{$ti},\"upd\"=>{$tu},\"del\"=>{$td},\"sel\"=>{$ts});\n";
     }
     $HTML_Perms .= "?>\n";
     DynamicSave("perms_" . $uid . ".php", $HTML_Perms);
     /* October 28, 2006, KFD.  Rem'd this all out, column and row security
              made this irrelevant
     		// -------------------------------------------------------------------
     		// Find out if this user has any UID Columns, columns that create
     		// filters on the user's UID
     		$sql = "Select column_id FROM groupuids WHERE group_id IN ($groups)";
     		//echo $sql;
     		$results = SQL($sql);
     		$groupuids = array();
     		while ($row = SQL_FETCH_ARRAY($results)) {
     			//echo "Found this one".$row["column_id"];
     			$groupuids[$row["column_id"]] = $row["column_id"];
     		}
     		SessionSet("groupuids",$groupuids);
           */
     scDBConn_Pop();
     return;
 }
Esempio n. 17
0
    function mainHelp()
    {
        ob_start();
        ?>
        This is the <?php 
        echo $this->yamlP2['options']['title'];
        ?>
 inquiry screen
        <br/><br/>
        The input boxes accept a very flexible set of values,
        you can enter ranges like a-e or 100-200, you can enter
        comparisons like &gt;x or &lt;500, and you can put multiple
        criteria separated by commas, like &lt;b,d,g-k,$gt;x
        <br/><br/>
        Hit CTRL-P to get a printable PDF report, or hit 
        CTRL-O to see the results displayed onscreen.
        <br/><br/>
        When results are displayed onscreen, use the up and down
        arrow keys to navigate, or the pageUp and pageDown keys.
        <br/><br/>
        Sometimes the onscreen results will show hyperlinks to 
        other pages.  Hit rightArrow to jump to the link.
        <br/><br/>
        Hit ESC to clear results, and ESC to return to menu
        <br/><br/>
        <?php 
        vgfSet('htmlHelp', ob_get_clean());
    }
Esempio n. 18
0
 function mainLayout($container)
 {
     # Erase default help message
     vgfSet('htmlHelp', '');
     configLayoutX4($container, 'Framework');
 }
Esempio n. 19
0
    function main()
    {
        $this->PageSubtitle = "Imports";
        // Process uploaded files if there are any
        if (!gpExists('gp_xajax')) {
            foreach ($_FILES as $onefile) {
                if (!$onefile['error']) {
                    // Generate a previously unused name, give up after 20 tries
                    $dir = $GLOBALS['AG']['dirs']['root'] . 'tmp/';
                    $count = 0;
                    while (true) {
                        $fn = $onefile['name'] . '.' . rand(1000, 9999);
                        $fs = $dir . $fn;
                        if (!file_exists($fs)) {
                            break;
                        }
                        $count++;
                        if ($count > 20) {
                            $fn = '';
                            break;
                        }
                    }
                    if ($fn == '') {
                        continue;
                    }
                    // skip this file, we couldn't name it
                    // If we got to here, then we have a good name to use, lets copy
                    // the file over.
                    move_uploaded_file($onefile['tmp_name'], $fs);
                    $newfile = array('name' => $onefile['name'], 'uname' => $fs, 'type' => $onefile['type'], 'error' => $onefile['error'], 'size' => $onefile['size']);
                    vgfSet('files', array($newfile));
                    break;
                    // only do one file!
                }
            }
        }
        // Routing
        if (gp('gp_fbproc') == '1') {
            return $this->fbProc();
        }
        if (gpExists('gp_xajax')) {
            return $this->xAjax();
        }
        // Obtain the basic parameters we need on this page, and then assign
        // them to hidden variables so that FORM POSTs will return here.
        $tid = gp('gp_table_id');
        $t = DD_TableRef(gp('gp_table_id'));
        hidden('gp_page', 'x_import');
        hidden('gp_nofile', '');
        hidden('gp_table_id', gp('gp_table_id'));
        //  Process requests.  If they uploaded a file, save the
        //  info to the session.  If they requested file destroy,
        //  throw it away.
        $files = vgfGet('files', array());
        $fi = null;
        if (isset($files[0])) {
            $fi = $files[0];
            SessionSet('importfile', $fi);
        }
        if (gp('gp_nofile') == 1) {
            SessionUnSet('importfile');
            $fi = null;
        }
        // If a file is uploaded we just output the div and then call
        // back for the content
        // On this branch we
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // BEGIN HTML
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ?>
      <h1>Table Import</h1>
      <p><b>Destination Table:</b><?php 
        echo hLinkPage('', $tid);
        ?>
      </p>
      <p><b>Table Name in Database:</b> <?php 
        echo $tid;
        ?>
.
      </p>
      <p>This is standardized import program that can accept file 
         uploads in the popular "CSV" format.  The first row is expected
         to name columns, and all subsequent rows are expected to 
         contain comma-separated values.
      </p>
      <p>This routine will match known column names and display the 
         columns that will be imported.
      </p>
      <hr />
      <?php 
        if ($fi) {
            ?>
         <div id="xajax"></div>
         <div id="xajaxm"></div>
         
         <script type="text/javascript">
         
         </script>
         <?php 
            elementAdd('scriptend', "andrax('?gp_page=x_import&gp_table_id=" . gp("gp_table_id") . "&gp_xajax=1');");
            return;
        } else {
            ?>
         <h2>File Upload</h2>
         <p>Please upload a file to process.
         <p><?php 
            echo hFileUpload();
            ?>
         <?php 
        }
    }
Esempio n. 20
0
    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());
    }