IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.