Changeset 13264 for trunk/ippMonitor/generate
- Timestamp:
- May 4, 2007, 3:07:41 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/generate (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/generate
r11490 r13264 14 14 # @headcode, @tailcode : additional HTML or PHP code before or after table 15 15 # @field, @width, @name, @show, @link, @extras : properties of each table column 16 # @imagedefs, %image: array of image defines 16 17 17 18 &parse_schema; … … 61 62 if ($key eq "HEAD") { 62 63 push @headcode, $value; 64 } 65 66 # the IMAGE commands sets up a reference name 67 if ($key eq "IMAGE") { 68 push @imagedefs, $value; 69 } 70 71 # the IMAGE commands sets up a reference name 72 if ($key eq "ARGS") { 73 push @linkargs, $value; 63 74 } 64 75 … … 94 105 &define_where_string (@where); 95 106 107 foreach $linkarg (@linkargs) { 108 &parse_linkarg ($linkarg); 109 } 110 111 foreach $imagedef (@imagedefs) { 112 &parse_imagedef ($imagedef); 113 } 114 96 115 if (0) { 97 116 print STDERR "show: $show[0]\n"; … … 220 239 printf FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 221 240 # add extra GET data to target 222 if ($extras[$i]) { &parse_extras ($ extras[$i]); }241 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 223 242 # print the actual table cell line with the link... 224 243 if (! $value && ($field[$i] ne "*")) { $value = "\$row[$Nrow]"; } … … 229 248 if (($label eq "image") && !$link[$i]) { 230 249 # print the actual table cell line with the image... 231 printf FILE " echo \"<td class=\\\"list\\\"><img src=\\\" getimage.php?name=$value\\\"></td>\\n\";\n";250 printf FILE " echo \"<td class=\\\"list\\\"><img src=\\\"$image{$value}\\\"></td>\\n\";\n"; 232 251 next; 233 252 } … … 237 256 printf FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 238 257 # add extra php data to target 239 if ($extras[$i]) { &parse_extras ($ extras[$i]); }258 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 240 259 # print the actual table cell line with the link... 241 printf FILE " echo \"<td class=\\\"list\\\"><a href=\\\"\$link\\\"> <img src=\\\" getimage.php?name=$value\\\"> </a></td>\\n\";\n";260 printf FILE " echo \"<td class=\\\"list\\\"><a href=\\\"\$link\\\"> <img src=\\\"$image{$value}\\\"> </a></td>\\n\";\n"; 242 261 next; 243 262 } … … 314 333 printf FILE " \$link = \$link . \"&$outline\";\n"; 315 334 } 335 } 336 337 # each linkarg is an entry of the form "word name=value" 338 # the entries for matching words are concatenated together 339 # separated by commas to create the value $linkarg{word} 340 sub parse_linkarg { 341 my ($word, $value); 342 343 ($word, $value) = split (" ", $_[0]); 344 345 if ($linkarg{$word}) { 346 $linkarg{$word} = "$linkarg{$word},$value"; 347 } else { 348 $linkarg{$word} = $value; 349 } 316 350 } 317 351 … … 360 394 } 361 395 396 # given a variable of the form $fieldname, return the corresponding 397 # row entry in the form $row[N], otherwise return $fieldname 398 # globals: field (list of field names), count (list of sequence) 399 sub parse_fieldname { 400 my ($variable) = $_[0]; 401 my ($i); 402 403 unless ($variable =~ m|^\$|) { 404 return $variable; 405 } 406 407 $fieldname = substr ($variable, 1); 408 409 print STDERR "fieldname: $fieldname\n"; 410 411 for ($i = 0; $i < @field; $i++) { 412 print STDERR "$i: $field[$i] : $fieldname\n"; 413 414 if ($field[$i] eq "*") { next; } 415 if ($fieldname ne $field[$i]) { next; } 416 417 418 $Nrow = $count[$i]; 419 420 $value = "\$row[$Nrow]"; 421 422 print STDERR "found : $i : $count[$i] : $Nrow : $value\n"; 423 return $value; 424 } 425 return $variable; 426 } 427 428 sub parse_imagedef { 429 my ($value) = $_[0]; 430 431 ($var, $name, $rule, $camera, $class) = split (" ", $value); 432 $name = &parse_fieldname ($name); 433 $camera = &parse_fieldname ($camera); 434 $class = &parse_fieldname ($class); 435 $image{$var} = "getimage.php?name=$name&rule=$rule&camera=$camera&class_id=$class"; 436 return 1; 437 } 438 362 439 sub init_key { 363 440 my ($key) = $_[0];
Note:
See TracChangeset
for help on using the changeset viewer.
