function index_hidden_ajxfSELECT()
{
    // fetch parms
    $table = gp('ajxfSELECT');
    $col1 = gp('col1');
    $col1val = gp('col1val');
    $col2 = gp('col2');
    $col2val = gp('col2val');
    $pfx = gp('pfx');
    // Now do matches, make call
    $matches = array($col1 => $col1val);
    $html = hOptionsFromTable($table, $col2val, '', $matches, $col2);
    echo "{$pfx}{$col2}|" . $html;
    exit;
}
Exemple #2
0
/**
* @deprecated
*/
function jsValuesOne($ahcols, $colname, $ahcol, $name, $row, $h)
{
    // KFD 9/7/07, slip this in for mime-h columns, they are
    //             much simpler.
    if ($ahcol['type_id'] == 'mime-h' || $ahcol['type_id'] == 'mime-h-f') {
        $editor = "<textarea class=\"wysiwyg\"  style=\"width: 810px; height: 200px\" x_original_value=\"" . htmlentities(trim(ArraySafe($row, $colname, ''))) . "\" class=\"wysiwyg\" name=\"{$name}{$colname}\">" . htmlentities(trim(ArraySafe($row, $colname, ''))) . "</textarea>";
        /*
            $dir = $GLOBALS['AG']['dirs']['root'];
            @include_once($dir.'/clib/FCKeditor/fckeditor.php');
            $oFCKeditor = new FCKeditor($name.$colname);
            $oFCKeditor->BasePath   = 'clib/FCKeditor/';
            $oFCKeditor->ToolbarSet = ( $ahcol['type_id'] == 'mime-h' ? 'Basic' : 'Default' );
            $oFCKeditor->Width  = ( $ahcol['type_id'] == 'mime-h' ? '275' : '470' );
            $oFCKeditor->Height = ( $ahcol['type_id'] == 'mime-h' ? '200' : '400' );
            $oFCKeditor->Value = trim(ArraySafe($row,$colname,''));
            $hx = $oFCKeditor->CreateHtml();
        */
        $h = str_replace('--MIME-H--' . $name . $colname . '--MIME-H--', $editor, $h);
        jqDocReady("\n                \$('.wysiwyg').each(function() {\n                    \$(this).wysihtml5({html: true, color: true});\n                });\n            ");
        $herr = '';
        if (count($colerrsx) > 0) {
            $herr = "<span class=\"x2columnerr\">" . implode("<br/>", $colerrsx) . "</span>";
            $scr = "getNamedItem('x_class_base').value='err'";
            $scr = "ob('{$name}{$colname}').attributes." . $scr;
            #E*lementAdd('ajax',"_script|$scr");
            #E*lementAdd('ajax',"_script|ob('$name$colname').className='x3err'");
        }
        if (!empty($herr)) {
            $h = str_replace($name . $colname . '--ERROR--CLASS', 'error', $h);
        } else {
            $h = str_replace($name . $colname . '--ERROR--CLASS', '', $h);
        }
        $h = str_replace($name . $colname . '--ERROR--', $herr, $h);
        return $h;
    }
    // Set the value (which also sets x_value_original)
    // KFD 8/6/07, put in the TRIM.  Otherwise a user clicks on a field
    //             and it mysteriously won't accept input.  This is
    //             because it is full of blank spaces!
    $colvalue = trim(ArraySafe($row, $colname, ''));
    if ($colvalue == '' && $ahcol['mode'] == 'ins' && !is_null($ahcol['default'])) {
        $colvalue = $ahcol['default'];
    }
    // KFD 6/28/07, use formatted value for all except time, and
    //    blank numbers on lookup
    // KFD 8/2/07,  removed this entirely, was putting in zeros
    //              for key columns.  These things should be handled
    //              entirely by defaults in the data dictionary.
    // KFD 8/6/07,  put formatting for dates back in, otherwise it
    //              was coming up 2007-08-07 for dates.
    // KFD 9/7/07,  put in a clause to handle double quotes in char values.
    if ($ahcol['type_id'] == 'date') {
        $colvalue = hFormat($ahcol['type_id'], trim($colvalue));
    } elseif ($ahcol['type_id'] == 'dtime') {
        if (trim($colvalue) != '') {
            $colvalue = date('m/d/Y h:i A', dEnsureTS($colvalue));
        }
    }
    if ($ahcol['formshort'] == 'char' || $ahcol['formshort'] == 'varchar' || $ahcol['formshort'] == 'text') {
        $colvalue = str_replace('"', '&quot;', $colvalue);
    }
    /*
    if($ahcol['type_id']<>'time') {
     if(!(   $ahcol['mode']=='search'
          && in_array($ahcol['formshort'],array('int','numb'))
          && trim($colvalue)==''
          )
        ) {
        $colvalue=hFormat($ahcol['type_id'],trim($colvalue));
     }
    }
    */
    //echo "Setting $name.$colname to $colvalue<br/>";
    $h = str_replace($name . $colname . '--VALUE--', htmlentities($colvalue), $h);
    $setInScript = false;
    # KFD 4/21/08, also set in script for value_min/max
    if ($ahcol['type_id'] == 'time') {
        $setInScript = true;
    }
    if ($ahcol['type_id'] == 'cbool') {
        $setInScript = true;
    }
    if ($ahcol['type_id'] == 'gender') {
        $setInScript = true;
    }
    if ($ahcol['value_min'] != '') {
        $setInScript = true;
    }
    #if($ahcol['type_id']=='time' ||
    #    $ahcol['type_id']=='cbool' ||
    #    $ahcol['type_id']=='gender'
    # ) {
    if ($setInScript) {
        if (gp('ajxBUFFER')) {
            #E*lementAdd('ajax',"_script|ob('$name$colname').value='$colvalue'");
        } else {
            jqDocReady("ob('{$name}{$colname}').value='{$colvalue}'");
        }
    }
    // KFD 3/3/08, translate y/n columns
    $replace_y = $colvalue == 'Y' ? 'SELECTED' : '';
    $replace_n = $colvalue == 'N' ? 'SELECTED' : '';
    $h = str_replace('--SELECTED-Y--', $replace_y, $h);
    $h = str_replace('--SELECTED-N--', $replace_n, $h);
    // If it's a select, we need to grab some hforSelect
    $innerHTML = '';
    if ($ahcol['table_id_fko'] != '' && $ahcol['fkdisplay'] != 'dynamic') {
        // Generate uifiltercolumns
        $uifc = trim(ArraySafe($ahcol, 'uifiltercolumn', ''));
        $matches = array();
        if ($uifc != '') {
            $matches[$uifc] = ArraySafe($row, $uifc, '');
        }
        // KFD 10/8/07, application PROMAT needs compound foreign key
        $fkpks = explode(',', $ahcol['fk_pks']);
        $pull = true;
        $dist = '';
        if (count($fkpks) > 1) {
            // This is a compound.  The first column gets distinct, the
            // second and further columns get nothing
            if (trim($colname) == trim($fkpks[0])) {
                $dist = $colname;
                // pull distinct
            } else {
                // Don't pull.  Use ajax during runtime and make a
                // one-value dropdown now
                $pull = false;
                $innerHTML = "<option SELECTED value=\"{$colvalue}\">{$colvalue}</option>";
            }
        }
        // Pull the options
        if ($pull) {
            $innerHTML = hOptionsFromTable($ahcol['table_id_fko'], $colvalue, '', $matches, $dist);
        }
        // In some cases there should be a blank value
        if (ArraySafe($ahcol, 'allow_empty', false)) {
            if (substr($innerHTML, 0, 26) != '<OPTION VALUE="" SELECTED>') {
                $innerHTML = '<OPTION VALUE="" SELECTED></OPTION>' . $innerHTML;
            }
        }
    }
    $h = str_replace($name . $colname . '--HINNER--', $innerHTML, $h);
    // Slip in the errors if they are there.
    // Grab these for later
    $colerrs = vgfget('errorsCOL', array());
    $colerrsx = ArraySafe($colerrs, $colname, array());
    $herr = '';
    if (count($colerrsx) > 0) {
        $herr = "<span class=\"x2columnerr\">" . implode("<br/>", $colerrsx) . "</span>";
        $scr = "getNamedItem('x_class_base').value='err'";
        $scr = "ob('{$name}{$colname}').attributes." . $scr;
        #E*lementAdd('ajax',"_script|$scr");
        #E*lementAdd('ajax',"_script|ob('$name$colname').className='x3err'");
    }
    if (!empty($herr)) {
        $h = str_replace($name . $colname . '--ERROR--CLASS', 'error', $h);
    } else {
        $h = str_replace($name . $colname . '--ERROR--CLASS', '', $h);
    }
    $h = str_replace($name . $colname . '--ERROR--', $herr, $h);
    // ------------------------------------
    // Infinity plus one, register the clear
    // ------------------------------------
    $x = "ob('{$name}{$colname}')";
    #
    #ElementAdd('clearBoxes',"if($x) { $x.value='' }");
    return $h;
}
Exemple #3
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 
 }