Changeset 19302 for trunk/ippMonitor/scripts/generate
- Timestamp:
- Aug 31, 2008, 12:42:45 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/scripts/generate (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/scripts/generate
r18212 r19302 27 27 &init_key ("MENU"); 28 28 &init_key ("STYLE"); 29 &init_key ("MODE"); 29 30 &init_key ("TABLE"); 30 31 &init_key ("TITLE"); … … 32 33 33 34 &init_key ("FIELDS"); 35 &init_key ("GROUPS"); 34 36 35 37 foreach $line (@list) { … … 47 49 ($field, $width, $format, $name, $show, $link, $extras) = split (/,\s+/, $value, 7); 48 50 if (! $name) { die "table $ARGV[0] missing required elements\n"; } 49 # ($field) = $field =~ m|\s*(\S+)\s*|; 50 51 if ($field =~ m|\S+\s+as\s+\S+|) { 52 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|; 53 } else { 54 $fieldreal = $field; 55 } 56 51 57 if ($VERBOSE) { printf "%-20s %-20s %-20s %-20s %-20s %-20s\n", $field, $name, $format, $show, $link, $extras; } 52 58 53 59 if ($show eq "") {$show = "value";} 54 push @field, $field; 55 push @width, $width; 56 push @format, $format; 57 push @name, $name; 58 push @show, $show; 59 push @link, $link; 60 push @extras, $extras; 60 push @field, $field; 61 push @fieldreal, $fieldreal; 62 push @width, $width; 63 push @format, $format; 64 push @name, $name; 65 push @show, $show; 66 push @link, $link; 67 push @extras, $extras; 61 68 } 62 69 … … 73 80 if ($key eq "IMAGE") { 74 81 push @imagedefs, $value; 82 } 83 84 # the GROUP entries are used in summary tables as arguments to the GROUP BY sql statement 85 if ($key eq "GROUP") { 86 push @group, $value; 75 87 } 76 88 … … 108 120 &check_key ("MENU", "ipp.menu.dat"); 109 121 &check_key ("STYLE", "ipp.css"); 122 &check_key ("MODE", "basic"); 110 123 &check_key ("TABLE", ""); 111 124 &check_key ("TITLE", ""); … … 115 128 for ($i = 0; $i < @key; $i++) { 116 129 if ($key[$i] eq "MENU") { $MENU = $value[$i]; } 117 } 130 if ($key[$i] eq "MODE") { 131 if ($value[$i] eq "summary") { 132 if (@group == 0) { 133 print STDERR "a summary table must have at least one group\n"; 134 exit 1; 135 } 136 &define_groups_string (@group); 137 } 138 } 139 } 140 141 &check_key ("GROUPS", "none"); 118 142 119 143 # define FIELDS and WHERE strings, add to keypairs … … 246 270 print FILE "write_sort_cell (\"list\", \"$opf{$value}\", \$buttonLink, \$ID, '$myFile');\n"; 247 271 } else { 248 print FILE "write_sort_cell (\"list\", \"$field [$i]\", \$buttonLink, \$ID, '$myFile');\n";272 print FILE "write_sort_cell (\"list\", \"$fieldreal[$i]\", \$buttonLink, \$ID, '$myFile');\n"; 249 273 } 250 274 } … … 281 305 } 282 306 for ($i = 0; $i < @field; $i++) { 283 $value = $field [$i];307 $value = $fieldreal[$i]; 284 308 if ($value eq "*") { next; } 285 309 if ($format[$i] eq "%s") { … … 291 315 } 292 316 } 293 print FILE "\$WHERE = check_ordering ( \$WHERE);\n";317 print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n"; 294 318 } 295 319 … … 298 322 299 323 for ($i = 0; $i < @field; $i++) { 300 $value = $field [$i];324 $value = $fieldreal[$i]; 301 325 if ($value eq "*") { next; } 302 326 if ($format[$i] eq "%s") { … … 323 347 } else { 324 348 if ($format[$i] eq "%s") { 325 print FILE "write_query_row ('$field [$i]', $width[$i], 'string');\n";349 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'string');\n"; 326 350 } else { 327 print FILE "write_query_row ('$field [$i]', $width[$i], 'min');\n";351 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'min');\n"; 328 352 } 329 353 } … … 336 360 print FILE "echo \"<td> </td>\\n\";\n"; 337 361 } else { 338 print FILE "write_query_row ('$field [$i]', $width[$i], 'max');\n";362 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'max');\n"; 339 363 } 340 364 } … … 421 445 } 422 446 447 sub define_groups_string { 448 my (@array) = @_; 449 my ($i); 450 451 $GROUPS = "$array[0]"; 452 for ($i = 1; $i < @array; $i++) { 453 # skip * fields (not a valid query element 454 if ($array[$i] eq "*") { next; } 455 $GROUPS = "$GROUPS,$array[$i]"; 456 } 457 set_keypair ("GROUPS", $GROUPS); 458 } 459 423 460 sub define_fields_count { 424 461 my ($i, $Nrow); … … 502 539 for ($i = 0; $i < @field; $i++) { 503 540 if ($field[$i] eq "*") { next; } 504 if ($value =~ m|^\$$field [$i]|) {505 # print "field: $field [$i]\n";506 ($name, $extra) = $value =~ m|^\$($field [$i])\@(\S+)|;541 if ($value =~ m|^\$$fieldreal[$i]|) { 542 # print "field: $fieldreal[$i]\n"; 543 ($name, $extra) = $value =~ m|^\$($fieldreal[$i])\@(\S+)|; 507 544 # print "name: $name\n"; 508 545 # print "extra: $extra\n"; … … 543 580 544 581 for ($i = 0; $i < @field; $i++) { 545 # print STDERR "$i: $field [$i] : $fieldname\n";582 # print STDERR "$i: $fieldreal[$i] : $fieldname\n"; 546 583 547 584 if ($field[$i] eq "*") { next; } 548 if ($fieldname ne $field [$i]) { next; }585 if ($fieldname ne $fieldreal[$i]) { next; } 549 586 550 587
Note:
See TracChangeset
for help on using the changeset viewer.
