Пример #1
0
    function main()
    {
        switch (gp('gp_action')) {
            case 'pull':
                $this->mainPull();
                break;
            case 'over':
                $this->mainOver();
                break;
            case 'diff':
                $this->mainDiff();
                break;
        }
        if (gp('gp_action') != '') {
            return;
        }
        if (gpExists('gp_clearremote')) {
            SessionSet('remoteUID', '');
            SessionSet('remotePWD', '');
            SessionSet('remoteNODE', '');
        }
        // Need this basic stuff for everything
        $skey = gp('gp_skey');
        hidden('gp_skey', $skey);
        hidden('gp_page', 'a_scontrol');
        $row = SQL_OneRow("Select * from applications WHERE skey={$skey}");
        $App = trim($row['application']);
        $sApp = SQLFC($App);
        $node = SQL_OneRow("Select * from nodes WHERE node=" . SQLFC($row['node']));
        $this->row = $row;
        $this->node = $node;
        // Some file functions execute before showing the screen, because
        // they affect what is displayed on the screen
        switch (gp('gpfa')) {
            case 'patch':
                $this->Patch();
                break;
            case 'overlocal':
                $this->OverLocal();
                break;
            case 'servsend':
                $this->ServerSend();
                break;
            case 'servdel':
                $this->ServerDel();
                break;
        }
        $h1 = "?gp_page=a_scontrol" . "&gp_action=pull&gp_url=" . $node['node_url'] . "&gp_app=" . $App;
        $h2 = "?gp_page=a_scontrol&gp_action=over";
        $h3 = "?gp_page=a_scontrol&gp_skey={$skey}";
        ?>
      <h1>Source Code Operations</h1>
      <p>For application 
         <a href="?gp_page=applications&gp_skey=<?php 
        echo $skey;
        ?>
"><?php 
        echo $App;
        ?>
</a>.
      </p>
      <?php 
        echo sourceDeprecated();
        ?>
      <?php 
        if (!$this->CheckRemoteUID($node['node'])) {
            return;
        }
        ?>

      <p><a href="javascript:formPostString('x=y')">Refresh This Page</a></p>
      <p>The Authoritative Node for this application is 
         <?php 
        echo $node['node'];
        ?>
 at <?php 
        echo $node['node_url'];
        ?>
.
         You are using username <b><?php 
        echo SessionGet('remoteUID');
        ?>
</b> on
         the remote node.
         <a href="javascript:formPostString('gp_clearremote=1')">Connect as New User</a>.
      </p>
      <br>
      
      <style>table.sc td { padding: 3px; }</style>
      <table cellpadding=0 cellspacing=0 class="sc">
        <tr><td class="dhead" width=100>Function</td>
            <td class="dhead">Details</td>
        <tr><td>
            <a href="javascript:Popup('<?php 
        echo $h1;
        ?>
')">
               Update Reference</a>
            <td>Pulls the latest code from the Authoritative Node and puts
                it into the "ref" directory of the application.  Does not
                modify programs in 'application' or 'appclib' (or 'lib',
                'clib', 'root' and 'templates' for the node manager).
        <!--
        <tr><td>
            <a href="javascript:Popup('< ?=$h2? >')">
               Overwrite From Reference</a>
            <td><font color=red>Unconditionally destroys any code you have
                for this application</font> and replaces it with the
                reference code. Before being destroyed, the code is backed up into
                a directory named "ref-"+current timestamp, so that it can
                be recovered if necessary.  It is the programmer's
                responsibility to delete these backup directories as desired.
           -->
      </table>
      <?php 
        $hbase = "?gp_page=a_scontrol&gp_app={$App}&gp_skey={$skey}";
        $dir = AppDir($App);
        $dirs = AppDirs($App);
        $filesL = array();
        $filesR = array();
        clearstatcache();
        // need this before scanning dirs
        foreach ($dirs as $onedir) {
            $this->WalkDir($filesL, $dir, trim($onedir));
            $this->WalkDir($filesR, $dir . "ref/", trim($onedir));
        }
        // Files they have and we don't. Pretty easy
        ?>
      <br><br>
      <h2>Server Files Not on Local Machine</h2>
      <table>
        <tr><td class="dhead">Filename
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
      <?php 
        $count = 0;
        foreach ($filesR as $name => $fileR) {
            if (!isset($filesL[$name])) {
                $hlinkC = $hbase . '&gpfa=overlocal' . '&gpfile=' . urlencode($name);
                $hlinkD = $hbase . '&gpfa=servdel' . '&gpfile=' . urlencode($name);
                $count++;
                $row = array($name, "&nbsp&nbsp;<a href='{$hlinkC}'>Overwrite Local</a>&nbsp&nbsp;", "&nbsp&nbsp;<a href='{$hlinkD}'>Delete From Server</a>&nbsp&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        if ($count == 0) {
            echo hTrFromArray('', array('none', ''));
        }
        echo "</table>";
        // Files we have and they dont
        ?>
      <br><br>
      <h2>Local Files Not on Server</h2>
      <table>
        <tr><td class="dhead">Name
            <td class="dhead">&nbsp;
      <?php 
        $count = 0;
        foreach ($filesL as $name => $fileL) {
            if (!isset($filesR[$name])) {
                $count++;
                $hlink = $hbase . '&gpfa=servsend' . '&gpfile=' . urlencode($name);
                $row = array($name, "&nbsp&nbsp;<a href='{$hlink}'>Send To Server</a>&nbsp&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        if ($count == 0) {
            echo hTrFromArray('', array('none', ''));
        }
        echo "</table>";
        ?>
      <br><br>
      <h2>Files That Are Different</h2>
      <table>
        <tr><td class="dhead">Name
            <td class="dhead">Differences
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
      <?php 
        foreach ($filesR as $name => $fileR) {
            if (!isset($filesL[$name])) {
                continue;
            }
            $fileL = $filesL[$name];
            $diffs = array();
            if ($fileL['fsize'] != $fileR['fsize']) {
                $diffs[] = 'fsize';
            }
            if ($fileL['md5'] != $fileR['md5']) {
                $diffs[] = 'md5';
            }
            if (count($diffs) != 0) {
                $hlinkP = $hbase . '&gpfa=patch' . '&gpfile=' . urlencode($name);
                $hlinkC = $hbase . '&gpfa=overlocal' . '&gpfile=' . urlencode($name);
                $hlinkD = "javascript:Popup('{$hbase}" . '&gp_action=diff' . '&gpfile=' . urlencode($name) . "')";
                $row = array($name . "&nbsp;&nbsp;", "&nbsp;&nbsp;" . implode(' ', $diffs) . "&nbsp;&nbsp;", "&nbsp;&nbsp;<a href='{$hlinkP}'>Patch To Server</a>&nbsp;&nbsp;", "&nbsp;&nbsp;<a href='{$hlinkC}'>Overwrite Local</a>&nbsp;&nbsp;", "&nbsp;&nbsp;<a href=\"{$hlinkD}\">View Diff</a>&nbsp;&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        echo "</table>";
        //hprint_r($filesL);
        //hprint_r($filesR);
        /*
        <table cellpadding=0 cellspacing=0 class="sc">
          <tr><td class="dhead">File</td>
              <td class="dhead">Local</td>
              <td class="dhead">Reference</td>
              <td class="dhead">Patch to Server</td>
              <td class="dhead">New To Server</td>
              <td class="dhead">Ovewrite Local</td>
        */
    }
Пример #2
0
    function ProcessData_OneTable($table)
    {
        $tab = trim($table["table_id"]);
        ob_start();
        ?>
       <table class="table table-striped table-bordered table-condensed table-hover">
          <thead>
          <tr>
              <th>Module</th>
              <th>Parent Tables</th>
              <th>Child Tables</th>
          </tr>
          </thead>
          <tr>
      <?php 
        echo "<td>" . $this->PageLink('Module', $table['module']);
        $pars = SQL_AllRows("Select table_id_par from zdd.tabfky\n           WHERE table_id = '{$tab}'");
        $hpars = array();
        echo "<td>";
        foreach ($pars as $par) {
            $hpars[] = $this->pagelink('Table', $par['table_id_par']);
        }
        echo implode(',&nbsp; ', $hpars);
        echo "<td>";
        $pars = SQL_AllRows("Select table_id from zdd.tabfky\n           WHERE table_id_par = '{$tab}'");
        $hpars = array();
        foreach ($pars as $par) {
            $hpars[] = $this->pagelink('Table', $par['table_id']);
        }
        echo implode(',&nbsp; ', $hpars);
        echo "</table>";
        echo "<br><br>";
        echo "<h3>Column Definitions:</h3><br/>";
        $this->ehTableHeader();
        $titles = array('Column', 'Caption', 'PK', 'Browse', 'Stats', 'Automation', 'Parent');
        echo hTRFromArray('adocs_th dark', $titles);
        $cols = SQL_AllRows("select * from zdd.tabflat where table_id = '{$tab}'\n          ORDER BY uicolseq", 'column_id');
        $hCalcCon = array();
        foreach ($cols as $row) {
            $column_id = $row['column_id'];
            $display = array($row['column_id'], $row['description'], $row['primary_key'], $row['uisearch'], $row['formula'], $this->MakeAutomation($row), $this->pagelink('Table', $row['table_id_fko']));
            echo hTRFromArray('', $display);
        }
        echo "</table>\n";
        // Output chain: Calculations and extensions
        $colsCons = SQL_AllRows("\nSelect c.* from zdd.colchains c\n  JOIN zdd.column_seqs     seq\n    ON c.table_id = seq.table_id\n   AND c.column_id= seq.column_id\n WHERE c.table_id = '{$tab}' \n ORDER BY seq.sequence,chain");
        echo "<br>";
        echo "<div class=\"head1\">Column Calculations and Constraints</div>";
        if (count($colsCons) == 0) {
            echo "There are no constraints or calculations for this table.";
        }
        foreach ($colsCons as $colsCon) {
            $column_id = $colsCon['column_id'];
            echo "<br>";
            echo "<div class=head2>" . "Column: " . $cols[$column_id]['description'] . " ({$column_id}) " . ($colsCon['chain'] == 'calc' ? 'Calculation' : 'Constraint') . "</div>";
            ?>
		<table class="table table-striped table-bordered table-condensed table-hover">
			<thead>
				<tr>
					<th width=50% class="adocs_th">Test</th>
					<th width=50% class="adocs_th">Returns</th>
				</tr>
			</thead>
			<tbody>
				<tr>
         <?php 
            $tests = SQL_AllRows("\nselect arg.*,test.funcoper,test.compoper \n  from zdd.colchainargs  arg \n  JOIN zdd.colchaintests test \n    ON arg.uicolseq = test.uicolseq\n WHERE arg.table_id = '{$tab}'\n   AND arg.column_id = " . SQLFC($column_id) . "\n ORDER by uicolseq,argtype,sequence");
            $cat = '';
            $cui = 0;
            foreach ($tests as $test) {
                $at = $test['argtype'];
                $ui = $test['uicolseq'];
                // Change from one row to the other requires closeup
                if ($cui != $ui) {
                    if ($cui != 0) {
                        echo "</tr>";
                    }
                    // close prior row
                    $cui = $ui;
                    echo "<tr><td>";
                    // open new row and cell
                    if ($at == 0) {
                        echo $test['compoper'] . "&nbsp;";
                    }
                    $cat = 0;
                }
                // when changing from comparison to
                if ($at == 1 && $cat == 0) {
                    echo "<td>" . $test['funcoper'] . "&nbsp;";
                    $cat = $at;
                }
                if ($test['column_id_arg'] != '') {
                    echo "@" . $test['column_id_arg'] . "&nbsp;";
                } else {
                    echo $test['literal_arg'] . "&nbsp;";
                }
            }
            echo "</tr>";
            echo "</tbody>";
            echo "</table>";
        }
        echo "<br><br>";
        echo "This tables's permissions by group: ";
        $this->ehtableheader();
        $headers = array('Group', 'Select', 'Insert', 'Update', 'Delete');
        echo hTRFromArray('adocs_th', $headers);
        $bymods = SQL_AllRows("SELECT * FROM zdd.perm_tabs\n            WHERE table_id = '{$tab}'\n            ORDER BY group_id");
        foreach ($bymods as $bymod) {
            if (!$this->ProcessGroup($bymod['group_id'])) {
                continue;
            }
            $display = array($this->pageLink('Group', $bymod['group_id']), $this->PermResolve($bymod['permsel']), $this->PermResolve($bymod['permins']), $this->PermResolve($bymod['permupd']), $this->PermResolve($bymod['permdel']));
            echo hTRFromArray('', $display);
        }
        echo "</table>";
        $pagetext = ob_get_Clean();
        $this->PageUpdate('Table: ' . $table['table_id'], $pagetext, 'Tables');
    }
Пример #3
0
    function hDisplayOnscreen($filters = array(), &$parent_row)
    {
        $parent_pks = $filters;
        // capture for later reference
        //hprint_r($filters);
        // Pull the rows so we know how many we have
        if (count($filters) != 0) {
            //$filters=ConSet('table',$this->table_id,'search',$filters);
            processPost_TableSearchResultsClear($this->table_id);
        }
        $rows = rowsFromUserSearch($this->table, $this->projections['_uisearch'], $filters, true);
        $early_return = $this->hDisplayOnscreenOverride($rows, $filters, $parent_row);
        if ($early_return != '') {
            return $early_return;
        }
        // Pull the nav bar.  Do this after pulling rows so we
        // know how many rows there are, what page we're on, etc.
        $hNavBar = $this->hBrowse_NavBar();
        // Generate the table header
        $cols1 = asliceValsFromKeys($this->table['flat'], 'description', $this->projections['_uisearch']);
        $cols2 = array('Edit');
        if (DDUserPerm($this->table_id, 'del')) {
            $cols2[] = 'Delete';
        }
        $cols = array_merge($cols1, $cols2);
        if (count($rows) == 0) {
            $hContent = "<tr><td colspan=99 class=\"dlite\">" . "<b>There are no records to display</b>" . "</td></tr>\n";
        } else {
            // Convert last column to hyperlink to that page/row
            foreach ($rows as $index => $row) {
                $slipin1 = hLinkPostFromArray('', 'Edit', array('gp_dd_page' => $this->table_id, 'gp_skey' => $row['skey'], 'gp_mode' => 'upd'));
                //$slipin1=array('_edit'=>$slipin);
                $slipin2 = '';
                if (DDUserPerm($this->table_id, 'del')) {
                    $slipin2 = hLinkPostFromArray('', 'Delete', array('gp_delskey_' . $this->table_id => $row['skey'], 'gp_mode' => 'upd', 'gp_skey' => gp('gp_skey')));
                }
                //$slipin=array('_del'=>$slipin);
                // Get the formatted value
                foreach ($row as $colname => $colvalue) {
                    $value = hFormat($this->table['flat'][$colname]['type_id'], $colvalue);
                    $rows[$index][$colname] = $value;
                }
                if (isset($row['skey'])) {
                    unset($rows[$index]['skey']);
                }
                $rows[$index][] = $slipin1;
                $rows[$index][] = $slipin2;
                //$rows[$index]=array_merge($rows[$index],$slipin);
            }
            $hContent = hTBodyFromRows('', $rows);
        }
        // Add an empty row for inserting
        $empty_row = '';
        $table_id = $this->table['table_id'];
        /*
        foreach($cols1 as $column=>$description){
           $value = '';
           $name_id = 'gp_onscreen_'.$table_id.'_'.$column.'';
           $iname   = 'name="'.$name_id.'" '.'id="'.$name_id.'"';
           $value   = '<input type="text" '.$iname.'></input>';
           $empty_row  .= hTD('',$value,'');
        }
        */
        $empty_row = '';
        $parent_skey = $parent_row['skey'];
        $pkcols = explode(',', $this->table['pks']);
        // KFD 1/11/07, unconditionally copied in all values supplied
        // from parent.
        foreach ($pkcols as $pkcol) {
            if (!isset($parent_row[$pkcol])) {
                continue;
            }
            $prefilled[$pkcol] = $parent_row[$pkcol];
        }
        $prefilled = $parent_pks;
        //hprint_r($prefilled);
        $opts = array('drilldownmatches' => $prefilled, 'name_prefix' => 'gp_onscreen_' . $table_id . '_', 'hpsize' => 12);
        // KFD 5/29/07, refactoring code to use new widget generation
        //   routines, no more ahInputsComprehensive.
        //$inputs = ahInputsComprehensive($this->table,'ins',$prefilled,'_uisearch',$opts);
        //foreach($inputs as $column=>$details){
        //   $empty_row  .= hTD('',$details['html'],'');
        //}
        $acols = aColsModeProj($this->table, 'ins', '_uisearch');
        $ahcols = aHColsfromACols($acols, $prefilled);
        $name_prefix = 'gp_onscreen_' . $table_id . '_';
        $xh = hDetailFromAHCols($ahcols, $name_prefix, 500, 'tds');
        $xh = jsValues($ahcols, $name_prefix, $prefilled, $xh);
        $empty_row .= $xh;
        // END OF CHANGES 5/29/07 code refactoring
        //hprint_r(htmlentities($empty_row));
        // Add a save link
        hidden('gp_child_onscreen', '');
        $name_id = 'onscreen_save';
        $iname = 'name="' . $name_id . '" ' . 'id="' . $name_id . '"';
        $value = '<a tabindex="' . hpTabIndexNext(500) . '" href="' . "javascript:SetAction('gp_skey',{$parent_skey},'gp_child_onscreen','{$table_id}')" . '">Save</a>';
        $empty_row .= hTD('', $value, '');
        // Add a <tr></tr>
        $empty_row = '<tr>' . $empty_row . '</tr>';
        // Attatch the empty row
        $hContent .= $empty_row;
        $hNew = hLinkPostFromArray('', $this->table['description'], array('gp_dd_page' => $this->table_id));
        //$hDsc="<span class=\"x2menubar_text\">"
        //   .$this->table['description']
        //   .'</span>';
        ob_start();
        ?>
      <br>
      <br>
      <div class="x2menubar" style="text-align: left">
        <?php 
        echo $hNew;
        ?>
      </div>
      <div class="andro_space2"></div>
		<fieldset>
			<?php 
        echo hTRFromArray('dhead', $cols);
        ?>
			<?php 
        echo $hContent;
        ?>
			<tr>
				<td colspan=99 class='dhead'>&nbsp;
				</td>
			</tr>
		</fieldset>
      <?php 
        return ob_get_clean();
    }
Пример #4
0
/**
* Generates and returns one or more TR elements, where the rows alternate
* between CSS_Class1 and CSS_Class2.  If the two classes have different
* background colors, this produces alternating colored rows for the table,
* which some people find easier to read.
*
* The first parameter is an [[Array of Rows]].  Each [[Row Array]] becomes
* a complete HTML TR element.  The individual elements of each Row become
* HTML TD elements.
*
* The class assignments are made to the TD elements.
*
* INPUTS
*	array $rows Rows Array
*	string $class1 CSS Class 1
*	string $class2 CSS Class 2
* RETURN
*	string Generated HTML
*/
function hTable_MethodAlternate($rows, $class1, $class2)
{
    $class = $class1;
    $retval = '';
    foreach ($rows as $row) {
        $retval .= hTRFromArray($class, $row);
        $class = $class == $class1 ? $class2 : $class1;
    }
    return $retval;
}
Пример #5
0
 function ehTab_Levels($ajax = true)
 {
     if ($ajax) {
         echo "x2_content|";
     }
     // First get basic rows, and start an array that contains level info
     $skey = SQLFN(gp('gp_skey'));
     $sq = "SELECT rc.* \n             FROM reportcolumns rc\n             JOIN reports       r  ON rc.report = r.report\n            WHERE r.skey = {$skey}\n            ORDER BY rc.uicolseq";
     $rows = SQL_AllRows($sq, 'column_id');
     $hCols = array();
     foreach ($rows as $row) {
         $hCols[$row['column_id']] = array($row['description']);
     }
     // Now get the previously defined levels and slot them out
     // into the array for display
     $hTitles = array('Column');
     $sq = "SELECT cl.* \n             FROM reportcollevels cl \n             JOIN reports         r  ON cl.report = r.report\n            WHERE r.skey = {$skey}\n            ORDER BY cl.reportlevel";
     $levels = SQL_AllRows($sq);
     foreach ($levels as $lev) {
         $js = "javascript:sndReq('" . "&gp_ajax=levmod" . "&gp_skeycl=" . $lev['skey'] . "&gp_value='+this.value" . ")";
         $hx = "<Select onchange=\"{$js}\">" . hOptionsFromTable('summacts', $lev['summact']) . "</select>";
         $hCols[$lev['column_id']][$lev['reportlevel']] = $hx;
         $hTitles[$lev['reportlevel']] = 'Level ' . $lev['reportlevel'];
     }
     ?>
   <br>
   <a href="javascript:sndReq('&gp_ajax=levadd')">Add Level</a>
   &nbsp;&nbsp;&nbsp;
   <a href="javascript:sndReq('&gp_ajax=levdel')">Remove Level</a>
   <br><br>
   <table>
     <tr>
     <?php 
     foreach ($hTitles as $hTitle) {
         echo "<td class='dhead' style='width:10em'>{$hTitle}</td>";
     }
     echo "</tr>";
     foreach ($hCols as $hCol) {
         echo hTRFromArray('', $hCol);
     }
     ?>
   </table>
   <?php 
 }