PhpLabware PHP Cross Reference Learning Management Systems

Source: /tablemanage.php - 501 lines - 23047 bytes - Summary - Text - Print

Description: Design and change tables author: Ethan Garner, Nico Stuurman <nicost@soureforge.net>

   1  <?php
   2  
   3  // tablemanage.php - Design and change tables 
   4  // tablemanage.php - author: Ethan Garner, Nico Stuurman <nicost@soureforge.net>
   5  
   6    /***************************************************************************
   7    * This script tables in phplabware.                                        *
   8    *                                                                          *
   9    * Copyright (c) 2001 by Ethan Garner, Nico Stuurman                        *
  10    * ------------------------------------------------------------------------ *
  11    *  This program is free software; you can redistribute it and/or modify it *
  12    *  under the terms of the GNU General Public License as published by the   *
  13    *  Free Software Foundation; either version 2 of the License, or (at your  *
  14    *  option) any later version.                                              *
  15    \**************************************************************************/
  16  
  17  
  18  require ('./include.php');
  19  require ('./includes/db_inc.php');
  20  require ('./includes/general_inc.php');
  21  require ('./includes/tablemanage_inc.php');
  22  include  ('./includes/defines_inc.php');
  23  
  24  $editfield=$_GET['editfield'];
  25  $editreport=$_GET['editreport'];
  26  $post_vars="newtable_name,newtable_label,newtable_sortkey,newtable_plugincode,addtable,table_id,table_name,table_display,addcol_name,addcol_label,addcol_sort,addcol_dtable,addcol_drecord,addcol_required,addcol_modifiable,addcol_datatype";
  27  globalize_vars($post_vars, $_POST);
  28  
  29  // this needs to be done before headers are sent in printheader
  30  while((list($key, $val) = each($_POST))) {
  31     if (substr($key, 0, 9) == 'expreport') { 
  32        $modarray = explode("_", $key);
  33        export_report($db,$modarray[1]);
  34        exit;
  35     }
  36  }
  37  reset($_POST);
  38  
  39  // when editing columns of a table include this javascript file:
  40  if (isset($editfield)) {
  41     $jsfiles[]='./includes/js/editfields.js';
  42  }
  43  
  44  $permissions=$USER['permissions'];
  45  if ($addcol_datatype=='table') 
  46     $jsfiles[]='./includes/js/tablemanage.js';
  47  
  48  // Except for ajax requests, we'll send the general headers now
  49  if (!isset($_POST['jsrequest'])) {
  50     printheader($httptitle,false,$jsfiles);
  51  } 
  52  
  53  if (!($permissions & $SUPER)) {
  54      navbar($USER['permissions']);
  55      echo "<h3 align='center'><b>Sorry, this page is not for you</B></h3>";
  56      printfooter($db,$USER);
  57      exit;
  58  }
  59  
  60  while((list($key, $val) = each($_POST))) {
  61     if ($key == "addtable") {
  62        add_table($db,$newtable_name,$newtable_label,$newtable_sortkey,$newtable_plugincode);
  63        break;
  64     }
  65     elseif (substr($key, 0, 8) == 'modtable') {
  66        $modarray = explode("_", $key);
  67        $id=$_POST['table_id'][$modarray[1]];
  68        mod_table($db,$id,$modarray[1]);
  69        break;
  70     }
  71     elseif (substr($key, 0, 8) == 'deltable') {  
  72        $modarray = explode("_", $key);      
  73        $id=$_POST['table_id'][$modarray[1]]; 
  74        $tablename=$_POST['table_name'][$modarray[1]];      
  75        del_table($db,$tablename,$id,$USER);   
  76        break;
  77     }
  78     elseif ($key=='table_column_select') {
  79        add_associated_table($db,$table_name,$addcol_name,$_POST['table_select'],$_POST['table_column_select']);
  80        break;
  81     }
  82     elseif ($key=="ass_to") {
  83        add_associated_table($db,$table_name,$addcol_name,false,false);
  84        break;
  85     }
  86     elseif ($key=="link_part_a") {
  87        add_active_link($db,$table_name,$addcol_name,$_POST["link_part_a"],$_POST["link_part_b"]);
  88        break;
  89     }
  90     elseif ($key == "addcolumn") {  
  91        $result=add_columnECG($db,$table_name,$addcol_name,$addcol_label,$addcol_datatype,$addcol_drecord,$addcol_dtable,$addcol_required,$addcol_modifiable,$addcol_sort);
  92        if ($addcol_datatype=="table" && $result) {
  93           navbar($USER["permissions"]);
  94           show_table_column_page($db,$table_name,$addcol_name,$addcol_label);
  95           printfooter();
  96           exit();
  97        }
  98        break;
  99     }       
 100     // when editing columns use Ajax to set this POST variable as well as the columnname that needs to be changed and the new value.  Handle this and exit (no HTML output needed).
 101     elseif (substr($key, 0, 11) == 'modcolumnjs') {  
 102        $modarray = explode("_", $key);
 103        mod_columnjs($db,$modarray[1]);
 104        exit;
 105        break;
 106     }
 107     elseif (substr($key, 0, 9) == "modcolumn") {  
 108        $modarray = explode("_", $key);
 109        mod_columnECG($db,$sort,$modarray[1]);
 110        break;
 111     }       
 112     elseif (substr($key, 0, 9) == 'delcolumn') { 
 113        $modarray = explode("_", $key);
 114        $tablename=$_POST['table_name'];
 115        $id=$_POST['column_id_'.$modarray[1]]; 
 116        $colname=$_POST['column_name_'.$modarray[1]];
 117        $datatype=$_POST['column_datatype_'.$modarray[1]];
 118        rm_columnecg($db,$tablename,$id,$colname,$datatype);
 119        break;
 120     } elseif (substr($key, 0, 11) == 'alinkcolumn') { 
 121        $modarray = explode("_", $key);
 122        $tablename=$_POST['table_name'];
 123        $id=$_POST['column_id_'.$modarray[1]]; 
 124        $colname=$_POST['column_name_'.$modarray[1]];
 125        $collabel=$_POST['column_label_'.$modarray[1]];
 126        $datatype=$_POST['column_datatype_'.$modarray[1]];
 127        $table_desc=get_cell($db,'tableoftables','table_desc_name','tablename',$tablename);
 128        $link_a=get_cell($db,$table_desc,"link_first","id",$id);
 129        $link_b=get_cell($db,$table_desc,"link_last","id",$id);
 130        navbar($USER["permissions"]);
 131        show_active_link_page($db,$tablename,$colname,$collabel,$link_a,$link_b);
 132        printfooter();
 133        exit();
 134        break;
 135     }
 136     elseif (substr($key, 0, 9) == "modreport") {  
 137        $modarray = explode("_", $key);
 138        $tplmessage=mod_report($db,$modarray[1]);
 139        break;
 140     } 
 141     elseif (substr($key, 0, 9) == "delreport") { 
 142        $modarray = explode("_", $key);
 143        rm_report($db,$modarray[1]);
 144        break;
 145     }
 146     elseif (substr($key, 0, 10) == "testreport") { 
 147        $modarray = explode("_", $key);
 148        $tplmessage=test_report($db,$modarray[1],$editreport);
 149        break;
 150     }
 151     elseif ($key=="addreport") {
 152        $tplmessage=add_report($db);
 153        break;
 154     }
 155  }
 156  
 157  if ($editfield)    {
 158     $noshow=array('id','access','magic','lastmoddate','lastmodby','gr','gw','er','ew');
 159     $nodel=array('title','date','ownerid','lastmodby','lastmoddate');
 160     $nomodifiable=array('ownerid','date','lastmodby','lastmoddate');
 161     navbar($USER["permissions"]);
 162  
 163     $r=$db->Execute("SELECT id,table_desc_name,label FROM tableoftables WHERE tablename='$editfield'");
 164     $id=$r->fields['id'];
 165     $currdesc=$r->fields['table_desc_name'];
 166     $tablelabel=$r->fields['label'];
 167     echo "<h3 align='center'>$string</h3>";
 168     echo "<h3 align='center'>Edit columns of table <i>$tablelabel</i></h3><br>";
 169  
 170     echo "<form method='post' name='tableform' id='coledit' enctype='multipart/form-data' ";
 171     $dbstring=$PHP_SELF;echo "action='$dbstring?editfield=$editfield&".SID."'>\n"; 
 172     echo "<table align='center' border='0' cellpadding='2' cellspacing='0'>\n";
 173     echo "<tr>\n";
 174     echo '<th>(SQL) Column Name</th>';
 175     echo '<th>Label</th>';
 176     echo '<th>Sortkey</th>';
 177     echo '<th>Table display</th>';
 178     echo "<th>Record display</th>\n";
 179     echo "<th>Required </th>\n";
 180     echo "<th>Modifiable </th>\n";
 181     echo "<th>Datatype</th>\n";
 182     echo "<th>Ass. Table/Column</th>\n";
 183     echo "<th>Active Link</th>\n";
 184     echo "<th>Action</th>\n";
 185     echo "</tr>\n";
 186     echo "<input type='hidden' name='table_name' value='$editfield'>\n";
 187     echo "<tr align='center' ><td><input type='text' name='addcol_name' value='' size='10'></td>\n";
 188     echo "<td><input type='text' name='addcol_label' value='' size='10'></td>\n";
 189     echo "<td><input type='text' name='addcol_sort' value='' size='5'></td>\n";
 190     echo "<td><input type='radio' name='addcol_dtable' checked value='Y'>yes<input type='radio' name='addcol_dtable'  value='N'>no</td>\n";
 191     echo "<td><input type='radio' name='addcol_drecord' checked value='Y'>yes<input type='radio' name='addcol_drecord'  value='N'>no</td>\n";
 192     echo "<td><input type='radio' name='addcol_required'  value='Y'>yes<input type='radio' name='addcol_required' checked value='N'>no</td>\n";
 193     echo "<td><input type='radio' name='addcol_modifiable' checked value='Y'>yes<input type='radio' name='addcol_modifiable' value='N'>no</td>\n";
 194     echo "<td><select name='addcol_datatype'>\n";
 195     echo "<option value='text'>text</option>\n";
 196     echo "<option value='textlong'>textlong</option>\n";
 197     echo "<option value='int'>int</option>\n";
 198     echo "<option value='float'>float</option>\n";
 199     echo "<option value='sequence'>sequence</option>\n";
 200     echo "<option value='date'>date</option>\n";
 201     echo "<option value='table'>table</option>\n";
 202     echo "<option value='pulldown'>pulldown</option>\n";
 203     echo "<option value='mpulldown'>mpulldown</option>\n";
 204     echo "<option value='link'>weblink</option>\n";
 205     echo "<option value='file'>file</option>\n";
 206     if ($system_settings["convert"])
 207        echo "<option value='image'>image</option>\n";
 208     echo "</select></td>\n";
 209     echo "<td>&nbsp;</td>\n";
 210     echo "<td>&nbsp;</td>\n";
 211     echo "<td align='center'><input type='submit' name='addcolumn' value='Add'></td></tr>\n\n";
 212     
 213     $query = "SELECT id,sortkey,columnname,label,display_table,display_record,required,datatype,thumb_x_size,associated_table,associated_column,associated_local_key,link_first,link_last,modifiable FROM $currdesc order by sortkey,label";
 214     $r=$db->Execute($query);
 215     $rownr=0;
 216     // print all entries
 217     while (!($r->EOF) && $r) {
 218        $label = $r->fields['label'];
 219        $columnname = $r->fields['columnname'];
 220        $id = $r->fields['id'];
 221        $display_table = $r->fields['display_table'];
 222        $display_record = $r->fields['display_record'];
 223        $display_required= $r->fields['required'];
 224        $datatype = $r->fields['datatype'];
 225        $thumbsize=$r->fields['thumb_x_size'];
 226        $modifiable = $r->fields['modifiable'];
 227        $link_first = $r->fields['link_first'];
 228        $link_last = $r->fields['link_last'];
 229        $sort = $r->fields['sortkey'];
 230        unset ($ass_table);
 231        unset($ass_column);
 232        if ($r->fields['associated_table']) {
 233           $ass_table=get_cell($db,'tableoftables','tablename','id',$r->fields['associated_table']);
 234           $ass_desc_table=get_cell($db,"tableoftables","table_desc_name","id",$r->fields["associated_table"]);
 235           $ass_column=get_cell($db,$ass_desc_table,"label","id",$r->fields["associated_column"]);
 236        }
 237        $show=1;
 238        foreach($noshow as $donotshow) {
 239         if ($columnname==$donotshow)
 240                $show=0;
 241        }        
 242        // print start of row of selected group
 243        if ($show==1) {
 244           echo "<input type='hidden' name='column_id_$id' value='$id'>\n";
 245           echo "<input type='hidden' name='column_datatype_$id' value='$datatype'>\n";
 246              if ($rownr % 2) 
 247               echo "<tr class='row_odd' align='center'>\n";    
 248              else 
 249               echo "<tr class='row_even' align='center'>\n";         
 250             echo "<input type='hidden' name='column_name_$id' value='$columnname'>\n";
 251           echo "<td>$columnname</td>\n";  
 252           echo "<td><input type='text' name='column_label_$id' value='$label' size='10' onchange='tellServer(\"$dbstring\", $id, this.name, this.value)'></td>\n";
 253           echo "<td><input type='text' name='column_sort_$id' value='$sort' size='5' onchange='tellServer(\"$dbstring\",$id, this.name, this.value)'></td>\n";
 254           if ($display_table=='Y') {
 255              echo "<td><input type='radio' name='column_dtable_$id' value='Y' CHECKED onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>yes";
 256              echo "<input type='radio' name='column_dtable_$id' value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>no</td>\n";
 257            } else {
 258              echo "<td><input type='radio' name='column_dtable_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>yes";
 259              echo" <input type='radio' name='column_dtable_$id' value='N' CHECKED onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>no</td>";
 260           }
 261           if ($display_record=='Y') {
 262              echo "<td><input type='radio' name='column_drecord_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)' CHECKED>yes";
 263              echo" <input type='radio' name='column_drecord_$id' value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 264           } else {
 265              echo "<td><input type='radio' name='column_drecord_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>yes";
 266              echo" <input type='radio' name='column_drecord_$id' checked value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 267           }
 268            
 269           if($display_required=='Y') {
 270              echo "<td><input type='radio' name='column_required_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)' CHECKED>yes";
 271              echo" <input type='radio' name='column_required_$id' value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 272          } else {
 273              echo "<td><input type='radio' name='column_required_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>yes";
 274              echo" <input type='radio' name='column_required_$id' checked value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 275          }
 276                     
 277          if (in_array($columnname,$nomodifiable))
 278             echo "<td>no</td>\n";
 279          elseif($modifiable=='Y') {
 280             echo "<td><input type='radio' name='column_modifiable_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)' CHECKED>yes";
 281             echo" <input type='radio' name='column_modifiable_$id' value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 282          }
 283          else {
 284             echo "<td><input type='radio' name='column_modifiable_$id' value='Y' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'>yes";
 285             echo" <input type='radio' name='column_modifiable_$id' checked value='N' onclick='tellServer(\"$dbstring\",$id, this.name, this.value)'> no </td>\n";
 286          }
 287                     
 288          echo "<input type='hidden' name='column_datatype_$id' value='$label'>\n";
 289          echo "<td>$datatype</td>\n";
 290          if ($ass_table || $ass_column) {
 291             echo "<td>";
 292             if (! $r->fields['associated_local_key']) {
 293                echo "<b>primary key</b><br>";
 294                echo "$ass_table<br>$ass_column</td>\n";
 295             }
 296             else {
 297                $ass_local_column=get_cell($db,$currdesc,'label','id',$r->fields['associated_local_key']);
 298                echo "primary key: $ass_local_column<br>\n"; 
 299                echo "$ass_column</td>\n";
 300             }
 301          }
 302          else
 303             echo "<td>&nbsp;</td>\n";
 304          if ($link_first)
 305             echo "<td>$link_first &nbsp;<i>content</i>&nbsp; $link_last</td>\n";
 306          else
 307             echo "<td>&nbsp;</td>\n";
 308          $modstring = "<input type='submit' name='modcolumn"."_$id' value='Modify'>\n";
 309          if ($datatype=="image") {
 310             $alinkstring = "<input type='hidden' name='thumbsize"."_$id' value='$thumbsize'>\n";
 311             $alinkstring.="<input type='submit' name='modcolumn"."_$id' value='Thumbnail size' Onclick='var temp=window.prompt(\"Please enter the maximum thumbnail size (in pixels):\",\"$thumbsize\");if (temp) {document.tableform.thumbsize"."_$id.value=temp} else {return false}; return true;' >\n";
 312          } else
 313              $alinkstring = "<input type='submit' name='alinkcolumn"."_$id' value='Active Link'>\n";
 314          $delstring = "<input type='submit' name='delcolumn"."_$id' value='Remove' ";
 315          $delstring .= "Onclick=\"if(confirm('Are you absolutely sure that the column $label should be removed? (No undo possible!)')){return true;}return false;\">";  
 316  
 317           echo "<td align='center'>";
 318          // the "modify button is only needed when javascript does not work
 319          if (! $_SESSION['javascript_enabled']) {
 320             echo $modstring;
 321          }
 322          echo $alinkstring;
 323           $candel=1;
 324           foreach($nodel as $checkme){
 325             if ($columnname==$checkme){
 326                  $candel=0;
 327              }
 328           }
 329           if ($candel==1)
 330              echo "$delstring</td>\n";
 331           echo "</tr>\n";
 332        }
 333        $r->MoveNext();
 334        $rownr+=1;        
 335     }
 336  
 337     echo "</table></form>\n";
 338     printfooter($db,$USER);
 339     exit;
 340  }
 341  
 342  /**
 343   */
 344  elseif ($editreport)    {
 345     navbar($USER["permissions"]);
 346     echo $tplmessage;
 347  
 348     $r=$db->Execute("SELECT id,table_desc_name,label FROM tableoftables WHERE tablename='$editreport'");
 349     $tableid=$r->fields["id"];
 350     $tablelabel=$r->fields["label"];
 351     echo "<h3 align='center'>$string</h3>";
 352     echo "<h3 align='center'>Edit report templates for table <i>$tablelabel</i></h3><br>";
 353  
 354     echo "<form method='post' name='reportform' id='repedit' enctype='multipart/form-data' ";
 355     $dbstring=$PHP_SELF;
 356     echo "action='$dbstring?editreport=$editreport&".SID."'>\n"; 
 357  
 358     // Tableheader
 359     echo "<table align='center' border='0' cellpadding='2' cellspacing='0'>\n";
 360     echo "<tr>\n";
 361     echo "<th>Report Name</th>\n";
 362     echo "<th>Sortkey</th>\n";
 363     echo "<th>Template File Add/Change</th>\n";
 364     echo "<th>File present</th>";
 365     echo "<th>Action</th>\n";
 366     echo "</tr>\n";
 367  
 368     // New addition
 369     echo "<input type='hidden' name='table_name' value='$editreport'>\n";
 370     echo "<tr align='center' >\n";
 371     echo "<td><input type='text' name='addrep_label' value='' size='10'></td>\n";
 372     echo "<td><input type='text' name='addrep_sortkey' value='' size='5'></td>\n";
 373     echo "<td><input type='file' name='addrep_template'</td>\n";
 374     echo "<td>&nbsp;</td>\n";
 375     echo "<td align='center'><input type='submit' name='addreport' value='Add'></td></tr>\n\n";
 376  
 377     // Loop through existing templates
 378     $rp=$db->Execute("SELECT id,label,sortkey,filesize FROM reports WHERE tableid='$tableid' ORDER BY sortkey");
 379     $rownr=0;
 380     while ($rp && !$rp->EOF) {
 381        $id=$rp->fields["id"];
 382        echo "<input type='hidden' name='report_id[$rownr]' value='$id'>\n";
 383        if ($rownr % 2) 
 384          echo "<tr class='row_odd' align='center'>\n";    
 385        else 
 386           echo "<tr class='row_even' align='center'>\n";         
 387  
 388        echo "<td><input type='text' name='report_label[$rownr]' value='".$rp->fields["label"]."' size=10></td>\n";
 389        echo "<td><input type='text' name='report_sortkey[$rownr]' value='".$rp->fields["sortkey"]."'size=5></td>\n";
 390        echo "<td><input type='file' name='report_template[$rownr]'</td>\n";
 391        if (is_readable($system_settings["templatedir"]."/$id.tpl"))
 392           echo "<td>Yes</td>\n";
 393        else
 394           echo "<td>No</td>\n";
 395        $modstring = "<input type='submit' name='modreport"."_$rownr' value='Modify'>\n";
 396        $exportstring = "<input type='submit' name='expreport"."_$rownr' value='Export'>\n";
 397        $teststring = "<input type='submit' name='testreport"."_$rownr' value='Test'>\n";
 398        $delstring = "<input type='submit' name='delreport"."_$rownr' value='Remove' ";
 399        $delstring .= "Onclick=\"if(confirm('Are you absolutely sure that the report ".$rp->fields["label"] ." should be removed? (No undo possible!)')){return true;}return false;\">";  
 400        echo "<td>$modstring &nbsp;\n$delstring &nbsp;\n$exportstring &nbsp;\n$teststring</td>\n";
 401        echo "</tr>\n";
 402        $rp->MoveNext();
 403        $rownr++;
 404     }
 405     echo "</table>\n";
 406     printfooter();
 407     exit;
 408  }
 409  
 410  navbar($USER["permissions"]);
 411  echo "<h3 align='center'>$string</h3>";
 412  echo "<h3 align='center'>Edit Tables</h3>\n";
 413  echo "<form method='post' id='tablemanage' enctype='multipart/form-data' ";
 414  $dbstring=$PHP_SELF;echo "action='$dbstring?".SID."'>\n"; 
 415  echo "<table align='center' border='0' cellpadding='2' cellspacing='0'>\n";
 416  
 417  echo "<tr>\n";
 418  echo "<th>Table Name</th>\n";
 419  echo "<th>Name in linkbar</th>\n";
 420  echo "<th>Display</th>\n";
 421  echo "<th>Groups</th>\n";
 422  echo "<th>Sort key</th>\n";
 423  echo "<th>Plugin code</th>\n";
 424  echo "<th>Action</th>\n";
 425  echo "<th>Fields</th>\n";
 426  echo "<th>Reports</th>\n";
 427  
 428  echo "</tr>\n";
 429  echo "<tr><td><input type='text' name='newtable_name' value='' ></td>\n";
 430  echo "<td><input type='text' name='newtable_label' value=''></td>\n";
 431  echo "<td></td>\n";
 432  echo "<td></td>\n";
 433  echo "<td><input type='text' name='newtable_sortkey' value='' size=6></td>\n";
 434  echo "<td><input type='text' name='newtable_plugincode' value=''></td>\n";
 435  echo "<td align='center'><input type='submit' name='addtable' value='New'></td>\n";
 436  echo "<td></td>\n<td></td>\n</tr>\n";
 437   
 438  $query = "SELECT id,tablename,label,display,sortkey,plugin_code FROM tableoftables where display='Y' or display='N' ORDER BY sortkey";
 439  $r=$db->Execute($query);
 440  
 441  // query for group select boxes
 442  $rg=$db->Execute("SELECT name,id from groups");
 443  $rownr=0;
 444  
 445  // print all entries
 446  while (!($r->EOF) && $r) {
 447     // get results of each row
 448     $id = $r->fields["id"];
 449     $name = $r->fields["tablename"];
 450     $label = $r->fields["label"];
 451     $Display = $r->fields["display"];
 452     $sortkey = $r->fields["sortkey"];
 453     $plugincode=$r->fields["plugin_code"];
 454     
 455     // print start of row of selected group
 456     if ($rownr % 2) 
 457        echo "<tr class='row_odd' align='center'>\n";
 458     else 
 459        echo "<tr class='row_even' align='center'>\n";
 460           
 461     echo "<input type='hidden' name='table_id[]' value='$id'>\n";
 462     echo "<input type='hidden' name='table_name[]' value='$name'>\n";
 463     echo "<td><b>$name</b></td>";
 464     echo "<td><input type='text' name='table_label[]' value='$label'></td>\n";
 465     if($Display=="Y")
 466        echo "<td><input type='radio' checked value='Y' name='table_display[$rownr]'>yes<input type='radio' value='N' name='table_display[$rownr]'>no</td>\n";
 467     else
 468        echo "<td><input type='radio' value='Y' name='table_display[$rownr]'>yes<input type='radio' checked value='N' name='table_display[$rownr]'>no</td>\n";
 469     $rgs=$db->Execute("SELECT groupid FROM groupxtable_display WHERE tableid='$id'");
 470     while ($rgs && !$rgs->EOF) {
 471        $groups_table[]=$rgs->fields["groupid"];
 472        $rgs->MoveNext();
 473     }
 474     echo "<td>".$rg->GetMenu2("tablexgroups[$id][]",$groups_table,true,true,3)."</td>\n";
 475     $rg->MoveFirst();
 476     unset($groups_table);
 477     echo "<td><input type='text' name='table_sortkey[]' value='$sortkey' size=6></td>\n";
 478     if ($Custom=="")
 479        echo "<td><input type='text' name='table_plugincode[]' value='$plugincode'></td>\n";
 480     else
 481        echo "<td>&nbsp;<input type='hidden' name='table_plugincode[]' value=''></td>\n";
 482     $modstring = "<input type='submit' name='modtable"."_$rownr' value='Modify'>";
 483     $delstring = "<input type='submit' name='deltable"."_$rownr' value='Remove' ";
 484     $delstring .= "Onclick=\"if(confirm('Are you absolutely sure the table $name should be removed? (No Undo possible!)')){return true;}return false;\">";  
 485     if ($Custom=="") {
 486        echo "<td align='center'>$modstring $delstring</td>\n";
 487        echo "<td><a href='$PHP_SELF?editfield=$name&'>Edit Fields</td></a>";
 488        echo "<td><a href='editreports.php?tablename=$name'>Edit Reports</td></a>";
 489     }
 490     else
 491        echo "<td align='center'>$modstring</td><td></td>";
 492  
 493     echo "</tr>\n";
 494     $r->MoveNext();
 495     $rownr+=1;
 496  }
 497  
 498  echo "</table>\n";
 499     
 500  printfooter($db,$USER);
 501  ?>

title

Description

title

Description

title

Description

title

title

Body