IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13566


Ignore:
Timestamp:
May 30, 2007, 6:13:58 PM (19 years ago)
Author:
eugene
Message:

various updates to the user interface: sorting, respect table selections, etc

Location:
trunk/ippMonitor
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/def/autocode.php

    r10963 r13566  
    2727
    2828// get the result table count
    29 if ($WHERE) {
    30   $sql = "SELECT count(*) FROM $TABLE WHERE $WHERE";
    31 } else {
    32   $sql = "SELECT count(*) FROM $TABLE";
    33 }
     29$sql = "SELECT count(*) FROM $TABLE $WHERE";
     30
    3431$qry = $db->query($sql);
    3532if (DB::iserror($db)) {
     
    5350
    5451// query the database
    55 if ($WHERE) {
    56   $sql = "SELECT $FIELDS FROM $TABLE WHERE $WHERE LIMIT $dTABLE OFFSET $rowStart";
    57 } else {
    58   $sql = "SELECT $FIELDS FROM $TABLE LIMIT $dTABLE OFFSET $rowStart";
    59 }
     52$sql = "SELECT $FIELDS FROM $TABLE $WHERE LIMIT $dTABLE OFFSET $rowStart";
    6053
    6154$qry = $db->query($sql);
     
    6760// ** HEAD CODE **
    6861
    69 if ($rowStart > 0) {
    70   $value = 0;
    71   $link = "$FILE" . "?" . $ID['link'] . "&from=$value";
    72   echo "<a width=10 class=\"button\" href=\"$link\">&#60&#60</a>\n";
    73 } else {
    74   echo "&#60&#60\n";
    75 }
    76 if ($rowStart >= $dTABLE) {
    77   $value = $rowStart - $dTABLE;
    78   $link = "$FILE" . "?" . $ID['link'] . "&from=$value";
    79   echo "<a class=\"button\" href=\"$link\">&#60</a>\n";
    80 } else {
    81   echo "&#60\n";
    82 }
    83 
    84 if ($rowLast < $rowTotal) {
    85   $value = $rowStart + $dTABLE;
    86   $link = "$FILE" . "?" . $ID['link'] . "&from=$value";
    87   echo "<a class=\"button\" href=\"$link\">&#62</a>\n";
    88 } else {
    89   echo "&#62\n";
    90 }
    91 
    92 if ($rowLast < $rowTotal) {
    93   $value = $rowTotal - $dTABLE;
    94   $link = "$FILE" . "?" . $ID['link'] . "&from=$value";
    95   echo "<a class=\"button\" href=\"$link\">&#62&#62</a>\n";
    96 } else {
    97   echo "&#62&#62\n";
    98 }
     62// ** BUTTON RESTRICTIONS **
     63navigate_buttons ($rowStart, $rowLast, $dTABLE, $rowTotal, $buttonLink, $ID, '$FILE');
    9964
    10065echo "&nbsp; : &nbsp; or enter start row: <input type=\"text\" name=\"from\" size=\"5\" value=\"$rowStart\">\n";
     
    10469echo "<tr>\n";
    10570// ** TABLE HEADER **
    106 // echo "<th class=list> FIELD </th>\n";
    10771echo "</tr>\n";
    10872
     
    11781  // $link = "$FILE" . "?expID=" . $row[0] . "&" . $ID['link'];
    11882
     83  $class = "list";
     84  // ** TD CLASS **
     85
    11986  echo "<tr>\n";
    12087  // ** TABLE DATA **
    121   // echo "<td class=list><a href=\"$link\"> $row[0] </a></td>\n";
    122   // echo "<td class=list> $row[1] </td>\n";
    12388  echo "</tr>\n";
    12489}
  • trunk/ippMonitor/def/detInputExp.d

    r13264 r13566  
    44MENU  ipp.detrend.dat
    55
    6 ARGS  ARG1  exp_tag=$exp_tag
     6ARGS  ARG1  rawImfile.exp_tag=$detInputExp.exp_tag
    77
    8 ARGS  ARG2  exp_tag=$exp_tag
    9 ARGS  ARG2  det_id=$det_id
    10 ARGS  ARG2  iteration=$iteration
     8ARGS  ARG2  detResidImfile.exp_tag=$detInputExp.exp_tag
     9ARGS  ARG2  detResidImfile.det_id=$detInputExp.det_id
     10ARGS  ARG2  detResidImfile.iteration=$detInputExp.iteration
    1111
    12 #     field      width  name        show         link to                 extras
    13 FIELD det_id,    7,     det_id
    14 FIELD exp_tag,   20,    exposure,   value,       rawImfile.php,          ARG1
    15 FIELD iteration, 5,     iteration
    16 FIELD include,   7,     include
    17 FIELD *,         5,     resid,      value=goto,  detResidImfile.php,     ARG2
    18 FIELD *,         5,     proc,       value=goto,  detProcessedImfile.php, ARG2
     12ARGS  ARG2  detProcessedImfile.exp_tag=$detInputExp.exp_tag
     13ARGS  ARG2  detProcessedImfile.det_id=$detInputExp.det_id
     14ARGS  ARG2  detProcessedImfile.iteration=$detInputExp.iteration
    1915
     16#     field                  width      name        show         link to                 extras
     17FIELD detInputExp.det_id,    7,         det_id
     18FIELD detInputExp.exp_tag,   20,        exposure,   value,       rawImfile.php,          ARG1
     19FIELD detInputExp.iteration, 5,         iteration
     20FIELD detInputExp.include,   7,         include
     21FIELD *,                     5,         choose,     value=resid, detResidImfile.php,     ARG2
     22FIELD *,                     5,         choose,     value=proc,  detProcessedImfile.php, ARG3
     23
  • trunk/ippMonitor/def/detResidExp.d

    r13264 r13566  
    3131FIELD detResidExp.path_base,    20,   path_base,  none
    3232FIELD rawExp.camera,            20,   camera,     none
     33
     34TD_CLASS list_off $detResidExp.accept == 0
  • trunk/ippMonitor/def/masterDetrendFrames.d

    r13264 r13566  
    1212WHERE detRun.iteration = detRunSummary.iteration
    1313
    14 ARGS  ARG1 det_id=$detRunSummary.det_id
     14ARGS  ARG1 detRunSummary.det_id=$detRunSummary.det_id
    1515
    16 ARGS  ARG2 det_id=$detRunSummary.det_id
    17 ARGS  ARG2 iteration=$detRunSummary.iteration
     16ARGS  ARG2 detInputExp.det_id=$detRunSummary.det_id
     17ARGS  ARG2 detInputExp.iteration=$detRunSummary.iteration
     18
     19ARGS  ARG3 detProcessedExp.det_id=$detRunSummary.det_id
     20
     21ARGS  ARG4 detResidExp.det_id=$detRunSummary.det_id
     22ARGS  ARG4 detResidExp.iteration=$detRunSummary.iteration
    1823
    1924#     field                    width name          show         link to                   extras
     
    2126FIELD detRunSummary.iteration, 5,    iter
    2227FIELD detRun.det_type,         5,    type
    23 FIELD *,                       20,   choose,       value=files, detNormalizedImfiles.php, ARG2
    2428FIELD *,                       20,   choose,       value=input, detInputExp.php,          ARG2
    25 FIELD *,                       20,   choose,       value=resid, detResidExp.php,          ARG2
     29FIELD *,                       20,   choose,       value=proc,  detProcessedExp.php,      ARG3
     30FIELD *,                       20,   choose,       value=resid, detResidExp.php,          ARG4
    2631FIELD detRunSummary.bg,        20,   bg
    2732FIELD detRunSummary.bg_stdev,  20,   bg_stdev
  • trunk/ippMonitor/generate

    r13264 r13566  
    5959        }
    6060
     61        if ($key eq "FILE") {
     62            $myFile = $value;
     63        }
     64
    6165        # list of the table fields
    6266        if ($key eq "HEAD") {
     
    6973        }
    7074
    71         # the IMAGE commands sets up a reference name
     75        # the ARGS commands defines arguments to FIELDS commands
    7276        if ($key eq "ARGS") {
    7377            push @linkargs, $value;
     78        }
     79
     80        # the TD_CLASS command sets up an alternate TD class
     81        if ($key eq "TD_CLASS") {
     82            $tdClass = $value;
     83            # print STDERR "found TD_CLASS\n";
    7484        }
    7585
     
    151161        }
    152162
     163        # fill in TD_CLASS test
     164        if ($line =~ m|// \*\* TD CLASS \*\*|) {
     165            &write_td_class;
     166        }
     167
    153168        # fill in table data
    154169        if ($line =~ m|// \*\* TABLE DATA \*\*|) {
     
    164179        if ($line =~ m|// \*\* TABLE RESTRICTIONS \*\*|) {
    165180            &write_table_restrict;
     181        }
     182
     183        # fill in table restricts
     184        if ($line =~ m|// \*\* BUTTON RESTRICTIONS \*\*|) {
     185            &write_button_restrict;
    166186        }
    167187
     
    200220    for ($i = 0; $i < @field; $i++) {
    201221        if ($show[$i] eq "none")  { next; }
    202         printf FILE "echo \"<th class=\\\"list\\\"> $name[$i] </th>\\n\";\n";
    203     }
     222        # printf FILE "echo \"<th class=\\\"list\\\"> $name[$i] </th>\\n\";\n";
     223        printf FILE "write_table_header (\"list\", \"$name[$i]\", \"$field[$i]\", \$buttonLink, \$ID, '$myFile');\n";
     224    }
     225}
     226
     227sub write_td_class {
     228    my ($field, $testline);
     229
     230    if ($tdClass eq "") { return; }
     231    # print STDERR "write TD CLASS: $tdClass...\n";
     232
     233    # TD_CLASS class field expression
     234    ($class, $field, $testline) = split (" ", $tdClass, 3);
     235
     236    $field = &parse_fieldname ($field);
     237
     238    printf FILE "  if ($field $testline) {\n";
     239    printf FILE "    \$class = \"$class\";\n";
     240    printf FILE "  }\n";
    204241}
    205242
     
    208245
    209246    if ($WHERE) {
    210         printf FILE "\$WHERE = \"$WHERE\";\n";
     247        printf FILE "\$WHERE = \"WHERE $WHERE\";\n";
    211248    }   
    212249    for ($i = 0; $i < @field; $i++) {
     
    215252        printf FILE "\$WHERE = check_restrict ('$value', \$WHERE);\n";
    216253    }
     254    printf FILE "\$WHERE = check_ordering (\$WHERE);\n";
     255}
     256
     257# generate a button link entry for each field (field != *)
     258sub write_button_restrict {
     259
     260    for ($i = 0; $i < @field; $i++) {
     261        $value = $field[$i];
     262        if ($value eq "*") { next; }
     263        printf FILE "\$buttonLink = button_restrict ('$value', \$buttonLink);\n";
     264    }
    217265}
    218266
     
    228276        if ($label eq "none")  { next; }
    229277
    230         if (($label eq "value") && !$link[$i]) {
    231             # print value without link or image
    232             if (! $value && ($field[$i] ne "*")) { $value = "\$row[$Nrow]"; }
    233             print FILE "  echo \"<td class=\\\"list\\\"> $value </td>\\n\";\n";
    234             next;
    235         }
    236 
    237         if (($label eq "value") && $link[$i]) {
     278        if ($label eq "value") {
    238279            # create the basic link variable
    239             printf FILE "  \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n";
    240             # add extra GET data to target
    241             if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); }
     280            if ($link[$i]) {
     281                printf FILE "  \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n";
     282                # add extra GET data to target
     283                if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); }
     284                $myLink = "\$link";
     285            } else {
     286                $myLink = "\"\"";
     287            }
    242288            # print the actual table cell line with the link...
    243289            if (! $value && ($field[$i] ne "*")) { $value = "\$row[$Nrow]"; }
    244             printf FILE "  echo \"<td class=\\\"list\\\"><a href=\\\"\$link\\\"> $value </a></td>\\n\";\n";
     290            printf FILE "  write_table_cell (\$class, $myLink, $value);\n";
    245291            next;
    246292        }
     
    248294        if (($label eq "image") && !$link[$i]) {
    249295            # print the actual table cell line with the image...
    250             printf FILE "  echo \"<td class=\\\"list\\\"><img src=\\\"$image{$value}\\\"></td>\\n\";\n";
     296            printf FILE "  echo \"<td class=\\\"\$class\\\"><img src=\\\"$image{$value}\\\"></td>\\n\";\n";
    251297            next;
    252298        }
     
    258304            if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); }
    259305            # print the actual table cell line with the link...
    260             printf FILE "  echo \"<td class=\\\"list\\\"><a href=\\\"\$link\\\"> <img src=\\\"$image{$value}\\\"> </a></td>\\n\";\n";
     306            printf FILE "  echo \"<td class=\\\"\$class\\\"><a href=\\\"\$link\\\"> <img src=\\\"$image{$value}\\\"> </a></td>\\n\";\n";
    261307            next;
    262308        }
     
    401447    my ($i);
    402448   
     449    # print STDERR "variable: $variable\n";
     450
    403451    unless ($variable =~ m|^\$|) {
    404452        return $variable;
     
    407455    $fieldname = substr ($variable, 1);
    408456
    409     print STDERR "fieldname: $fieldname\n";
    410 
    411     for ($i = 0; $i < @field; $i++) {
    412         print STDERR "$i: $field[$i] : $fieldname\n";
     457    # print STDERR "fieldname: $fieldname\n";
     458
     459    for ($i = 0; $i < @field; $i++) {
     460        # print STDERR "$i: $field[$i] : $fieldname\n";
    413461
    414462        if ($field[$i] eq "*") { next; }
     
    420468        $value = "\$row[$Nrow]";
    421469
    422         print STDERR "found : $i : $count[$i] : $Nrow : $value\n";
     470        # print STDERR "found : $i : $count[$i] : $Nrow : $value\n";
    423471        return $value;
    424472    }
  • trunk/ippMonitor/raw/ipp.css

    r12835 r13566  
    101101}
    102102
     103td.list_off  {
     104           text-align: left;
     105           font-size: normal; 
     106           font-weight: normal; 
     107           vertical-align: top;
     108           background: #a0a0a0;
     109           background-color: #a0a0a0;
     110           border: 2px solid #000000;
     111           padding: 2px;
     112}
     113
    103114th.list  {
    104115           text-align: left;
  • trunk/ippMonitor/raw/ipp.php

    r13264 r13566  
    11<?php
    22
    3 $dTABLE = 10;
     3$dTABLE = 80;
    44
    55function logintext () {
     
    282282}
    283283
     284function navigate_buttons ($rowStart, $rowLast, $dTABLE, $rowTotal, $buttonLink, $ID, $file) {
     285
     286  if ($rowStart > 0) {
     287    $value = 0;
     288    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     289    if ($buttonLink != "") {
     290      $link = $link . "&$buttonLink";
     291    }
     292    echo "<a width=10 class=\"button\" href=\"$link\">&#60&#60</a>\n";
     293  } else {
     294    echo "&#60&#60\n";
     295  }
     296  if ($rowStart >= $dTABLE) {
     297    $value = $rowStart - $dTABLE;
     298    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     299    if ($buttonLink != "") {
     300      $link = $link . "&$buttonLink";
     301    }
     302    echo "<a class=\"button\" href=\"$link\">&#60</a>\n";
     303  } else {
     304    echo "&#60\n";
     305  }
     306
     307  if ($rowLast < $rowTotal) {
     308    $value = $rowStart + $dTABLE;
     309    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     310    if ($buttonLink != "") {
     311      $link = $link . "&$buttonLink";
     312    }
     313    echo "<a class=\"button\" href=\"$link\">&#62</a>\n";
     314  } else {
     315    echo "&#62\n";
     316  }
     317
     318  if ($rowLast < $rowTotal) {
     319    $value = $rowTotal - $dTABLE;
     320    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     321    if ($buttonLink != "") {
     322      $link = $link . "&$buttonLink";
     323    }
     324    echo "<a class=\"button\" href=\"$link\">&#62&#62</a>\n";
     325  } else {
     326    echo "&#62&#62\n";
     327  }
     328}
     329
    284330function check_restrict ($key, $where) {
    285331  $htmlkey = preg_replace ('|\.|', '_', $key);
    286332  if ($_SERVER[REQUEST_METHOD] == 'GET') {
    287333    $value = $_GET[$htmlkey];
    288     // echo "using GET: $value<br>\n";
    289334  } else {
    290335    $value = $_POST[$htmlkey];
    291     // echo "using POST: $value<br>\n";
    292   }
    293   // echo "value: $value<br>\n";
     336  }
    294337  if ($value != "") {
    295338    if ($where) {
    296339      $where = $where . " AND $key = '$value'";
    297       // echo "where 1: $where<br>\n";
    298340    } else {
    299       $where = "$key = '$value'";
    300       // echo "where 2: $where<br>\n";
     341      $where = "WHERE $key = '$value'";
    301342    }
    302343  }
    303344  return $where;
     345}
     346
     347function check_ordering ($where) {
     348
     349  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     350    $value = $_GET['sort'];
     351  } else {
     352    $value = $_POST['sort'];
     353  }
     354  if ($value != "") {
     355    $where = $where . " ORDER BY $value";
     356  }
     357  return $where;
     358}
     359
     360function button_restrict ($key, $line) {
     361  $htmlkey = preg_replace ('|\.|', '_', $key);
     362  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     363    $value = $_GET[$htmlkey];
     364  } else {
     365    $value = $_POST[$htmlkey];
     366  }
     367  if ($value != "") {
     368    if ($line) {
     369      $line = $line . "&$key=$value";
     370    } else {
     371      $line = "$key=$value";
     372    }
     373  }
     374  return $line;
     375}
     376
     377function write_table_header ($class, $name, $value, $buttonLink, $ID, $file) {
     378
     379  $link = "$file" . "?" . $ID['link'] . "&sort=$value";
     380  if ($buttonLink != "") {
     381    $link = $link . "&$buttonLink";
     382  }
     383  echo "<th class=\"$class\"><a href=\"$link\"> $name </a></th>\n";
    304384}
    305385
    306386function write_query_row ($key, $width) {
    307387  $htmlkey = preg_replace ('|\.|', '_', $key);
    308   $value = $_POST[$htmlkey];
    309   if (($_SERVER[REQUEST_METHOD] == 'POST') && $value) {
     388  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     389    $value = $_GET[$htmlkey];
     390  } else {
     391    $value = $_POST[$htmlkey];
     392  }
     393  if ($value != "") {
    310394    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\" value=\"$value\"> </td>\n";
    311395  } else {
    312396    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\"> </td>\n";
     397  }
     398}
     399
     400function write_table_cell ($class, $link, $value) {
     401  $myValue = $value;
     402  if ($myValue == "") { $myValue = "&nbsp;"; }
     403
     404  if ($link) {
     405    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
     406  } else {
     407    echo "<td class=\"$class\"> $myValue </td>\n";
    313408  }
    314409}
Note: See TracChangeset for help on using the changeset viewer.