Ignore:
Timestamp:
07/26/11 10:51:38 (13 years ago)
Author:
Daniela Dorner
Message:
added various new features (min, max, user, show/hide of columns, ...) and changed layout
File:
1 edited

Legend:

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

    r11505 r11599  
    4545
    4646    //get key1 and key2 separately from DB (for function AddRow())
    47     $query2 = "SELECT fKey1, SUBSTRING(fKey2,2), fType FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."'";
     47    $query2 = "SELECT fKey1, SUBSTRING(fKey2,2), fType, fMin, fMax FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."'";
    4848    $result2=mysql_query($query2, $db_id);
    4949    $row2 = mysql_fetch_row($result2);
     
    5151    $key2=$row2[1];
    5252    $type=$row2[2];
     53    $min=$row2[3];
     54    $max=$row2[4];
    5355    mysql_free_result($result2);
    5456
    55     $query0 ="SELECT fIndex, fValidFrom, fProgram, Concat(fKey1,fKey2), fValue, fDescription, fCounter, fType, fMin, fMax, fKey1, SUBSTRING(fKey2,2), if(fOriginalIndex=0, fIndex, fOriginalIndex) FROM ProgramOption ";
     57    $query0 ="SELECT fIndex, fValidFrom, fProgram, Concat(fKey1,fKey2), fValue, ";
     58    $query0.="fDescription, fCounter, fType, fMin, fMax, fKey1, SUBSTRING(fKey2,2), ";
     59    $query0.="if(fOriginalIndex=0, fIndex, fOriginalIndex), fUser FROM ProgramOption ";
    5660    $query0.="WHERE 1=1 ";
    5761    if (strcmp($_GET["fKey"],"all")!=0)
     
    7478        printf("<button onClick='ShowCurrent();' id='showcurrent' style='display:none'>Show Current</button>\n");
    7579        printf("<button onClick='ShowAll();' id='showall' style='display:inline'>Show History</button>\n");
    76         printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
    77                $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type);
     80        printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
     81               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
    7882    }
    79     printf("<table font-size='-1' border='1' width='100px' height='100px'><tbody id='valtable%s'>\n", $_GET["fGetValCase"]);
     83
     84    if ($_GET["fGetValCase"]==1)//show only in edit mode
     85        $generalshowhide='';
     86    else
     87        $generalshowhide='none';
     88
     89    printf("<table font-size='-1' border='0' cellspacing='5px' width='100%%'><tbody id='valtable%s'>\n", $_GET["fGetValCase"]);
    8090    printf("<tr>");
    81     printf("<th>Index / Orig / Counter</th>\n");
    82     printf("<th>Valid since</th>\n");
     91    printf("<th class='indices%d' style='display:%s'>Idx/Orig/Ctr</th>\n",$_GET["fGetValCase"], $generalshowhide);
     92    printf("<th class='validsince%d' style='display:%s'>Valid since</th>\n", $_GET["fGetValCase"], $generalshowhide);
    8393    printf("<th>Program</th>\n");
    8494    //printf("<th>Key</th>\n");
     
    8797    printf("<th>Value</th>\n");
    8898    printf("<th>Type</th>\n");
    89     if ($_GET["fGetValCase"]==1)//show only in edit mode
    90         printf("<th class='description%d'>Description</th>\n", $_GET["fGetValCase"]);
    91     else
    92         printf("<th class='description%d' style='display:none'>Description</th>\n", $_GET["fGetValCase"]);
     99    printf("<th class='minimum%d' style='display:%s'>Min</th>\n", $_GET["fGetValCase"], $generalshowhide);
     100    printf("<th class='maximum%d' style='display:%s'>Max</th>\n", $_GET["fGetValCase"], $generalshowhide);
     101    printf("<th class='description%d' style='display:%s'>Description</th>\n", $_GET["fGetValCase"], $generalshowhide);
    93102    if ($_GET["fGetValCase"]==1)//show only in edit mode
    94103        printf("<th>Action</th>\n");
    95     printf("<th>Min</th>\n");
    96     printf("<th>Max</th>\n");
     104    printf("<th class='user%d' style='display:%s'>User</th>\n", $_GET["fGetValCase"], $generalshowhide);
    97105    printf("</tr>\n");
    98106    $maxindex=0;
     
    103111            {
    104112                if ($row0[6]==$counter)
    105                     printf("<tr id='new%s' style='display:'>\n", $row0[0]);
     113                    printf("<tr id='new%s' style='display:' bgcolor='#E2E2E2'>\n", $row0[0]);
    106114                else
    107                     printf("<tr id='old%s' style='display:none'>\n", $row0[0]);
     115                    printf("<tr id='old%s' style='display:none' bgcolor='#EBEBEB'>\n", $row0[0]);
    108116            }
    109117            else
    110                 printf("<tr id='%scompare%s' style='display:'>\n", $_GET["fGetValCase"], $row0[12]);
     118                printf("<tr id='%scompare%s' style='display:' bgcolor='white'>\n", $_GET["fGetValCase"], $row0[12]);
    111119
    112             printf("<td> %s / %s / %s <div id='%dorigindex%s' style='display:none'>%s</div> </td>\n",
    113                    $row0[0], $row0[12], $row0[6], $_GET["fGetValCase"], $row0[0], $row0[12]);
     120            printf("<td class='indices%d' style='display:%s'> %s / %s / %s <div id='%dorigindex%s' style='display:none'>%s</div> </td>\n",
     121                   $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[12], $row0[6], $_GET["fGetValCase"], $row0[0], $row0[12]);
     122            //valid from
    114123            if (strcmp('0000-00-00 00:00:00', $row0[1])==0)
    115                 printf("<td id='notyetvalid%s'> %s </td>\n", $row0[0], $row0[1]);
     124                printf("<td class='validsince%d' style='display:%s' id='notyetvalid%s'> %s </td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[1]);
    116125            else
    117                 printf("<td> %s </td>\n", $row0[1]);
     126                printf("<td class='validsince%d' style='display:%s'> %s </td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[1]);
     127            //program
    118128            printf("<td id='prog%s'>%s</td>\n", $row0[0], $row0[2]);
     129            //keys
    119130            //printf("<td id='key%s'>%s</td>\n", $row0[0], $row0[3]);
    120131            printf("<td id='1key%s'>%s</td>\n", $row0[0], $row0[10]);
    121132            printf("<td id='2key%s'>%s</td>\n", $row0[0], $row0[11]);
     133            //value
    122134            printf("<td align='right' id='val%s'>%s</td>\n", $row0[0], $row0[4]);
     135            //type
    123136            printf("<td id='type%s'>%s</td>\n", $row0[0], $row0[7]);
    124             if ($_GET["fGetValCase"]==1)//show only in edit mode
    125                 printf("<td class='description%d' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $row0[0], $row0[5]);
    126             else
    127                 printf("<td class='description%d' style='display:none' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $row0[0], $row0[5]);
     137            //min
     138            printf("<td class='minimum%d' style='display:%s' id='min%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[8]);
     139            //max
     140            printf("<td class='maximum%d' style='display:%s' id='max%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[9]);
     141            //descripton
     142            printf("<td class='description%d' style='display:%s' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[5]);
     143            //action
    128144            if ($_GET["fGetValCase"]==1)//show only in edit mode
    129145            {
     
    133149                    printf("<td id='action%s'></td>\n", $row0[0]);
    134150            }
    135             printf("<td id='min%s'>%s</td>\n", $row0[0], $row0[8]);
    136             printf("<td id='max%s'>%s</td>\n", $row0[0], $row0[9]);
     151            //user
     152            printf("<td class='user%d' style='display:%s' id='user%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[13]);
    137153            printf("</tr>\n");
    138154            if ($row0[0]>$maxindex)
     
    144160        printf("<button onClick='ShowCurrent();' id='showcurrent2' style='display:none'>Show Current</button>\n");
    145161        printf("<button onClick='ShowAll();' id='showall2' style='display:inline'>Show History</button>\n");
    146         printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
    147                $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type);
     162        printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
     163               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
    148164    }
     165    /*
    149166    else
    150167    {
    151         printf("<button onClick='HideDescription(%d);' id='hidedescr%d' style='display:none'>Hide Description</button>\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
    152         printf("<button onClick='ShowDescription(%d);' id='showdescr%d' style='display:'>Show Description</button>\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     168        printf("Show:\n");
     169        printf("<input type='checkbox' id='sh_indices%d' onclick='ShowHide(\"indices\", \"sh_indices\", %d);'>indices\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     170        printf("<input type='checkbox' id='sh_validsince%d' onclick='ShowHide(\"validsince\", \"sh_validsince\", %d);'>validsince\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     171        printf("<input type='checkbox' id='sh_descr%d' onclick='ShowHide(\"description\", \"sh_descr\", %d);'>description\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     172        printf("<input type='checkbox' id='sh_min%d' onclick='ShowHide(\"minimum\", \"sh_min\", %d);'>min\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     173        printf("<input type='checkbox' id='sh_max%d' onclick='ShowHide(\"maximum\", \"sh_max\", %d);'>max\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
    153174    }
     175    */
    154176
    155177    if ($_GET["fGetValCase"]==3)
Note: See TracChangeset for help on using the changeset viewer.