Ignore:
Timestamp:
07/21/11 11:24:15 (13 years ago)
Author:
Daniela Dorner
Message:
added plenty of new features to view and edit the configuration database
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/db_po/get_keys.php

    r11353 r11505  
    99        return;
    1010    }
     11    if (empty($_GET["fKey"]))
     12        $_GET["fKey"]="";
     13    if (empty($_GET["fSelectSize"]))
     14        $_GET["fSelectSize"]="10";
     15    if (empty($_GET["fMode"]))
     16        $_GET["fMode"]="view";
    1117
    1218    include("db.php");
     
    1925    mysql_select_db($db);
    2026
    21     $query0="SELECT fKey from ProgramOption ";
     27    $query1 = "SELECT Max(fCounter) FROM History";
     28    $result1=mysql_query($query1, $db_id);
     29    $row1 = mysql_fetch_row($result1);
     30    $maxcounter=$row1[0];
     31    mysql_free_result($result1);
     32
     33    $query0="SELECT Concat(fKey1, fKey2) as ourkeys from ProgramOption ";
     34    $query0.="WHERE fCounter=".$maxcounter." ";
    2235    if ($_GET["fProgram"]!="all")
    23         $query0.="WHERE fProgram='".$_GET["fProgram"]."' ";
    24     $query0.="GROUP BY fKey";
     36        $query0.="AND fProgram='".$_GET["fProgram"]."' ";
     37    $query0.="GROUP BY ourkeys";
    2538
    2639    $result0=mysql_query($query0, $db_id);
    2740
    28     printf("<td>Please select a key:</td>\n");
    29     printf("<td><select name='key' size='1' onchange=\"get_values('%s',this.value)\"class='Width'>\n", $_GET["fProgram"]);
    30     printf("<option value='empty'> ---select key--- </option>\n");
    31     printf("<option value='newkey'> add new key </option>\n");
     41    if (strcmp($_GET["fMode"], "edit")==0)
     42        printf("select key: <br>\n");
     43    else
     44        printf("select key: \n");
     45    printf("<select style='width:200px' id='key' size='%s' onchange=\"get_values(1,'%s',this.value,'%s')\"class='Width'>\n",
     46           $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
     47    if (!empty($_GET["fKey"]) && strcmp("all", $_GET["fKey"])==0)
     48        printf("<option value='all' selected> --- all keys --- </option>\n");
     49    else
     50        printf("<option value='all'> --- all keys --- </option>\n");
    3251    while ($row0 = mysql_fetch_row($result0))
    33         printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
    34     printf("</select>\n</td>\n");
     52        if (!empty($_GET["fKey"]) && strcmp($row0[0], $_GET["fKey"])==0)
     53            printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
     54        else
     55            printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
     56    printf("</select>\n<br>\n");
     57    if (strcmp($_GET["fMode"], "edit")==0)
     58        printf("<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
    3559    mysql_free_result($result0);
    3660
Note: See TracChangeset for help on using the changeset viewer.