Changeset 26888
- Timestamp:
- Feb 10, 2010, 7:19:23 PM (16 years ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 12 edited
- 1 copied
-
INSTALL (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
def/camProcessedImfile.d (modified) (2 diffs)
-
def/detNormalizedImfile_failure.d (modified) (1 diff)
-
def/detProcessedImfile.d (modified) (1 diff)
-
def/detResidImfile.d (modified) (1 diff)
-
def/diffProcessedSkyfile_Images.d (modified) (1 diff)
-
def/magicProcessedMasks_Images.d (copied) (copied from branches/eam_branches/20091201/ippMonitor/def/magicProcessedMasks_Images.d )
-
def/stackProcessedSkyfile_Images.d (modified) (1 diff)
-
raw/getimage.php (modified) (1 diff)
-
raw/ipp.php (modified) (2 diffs)
-
raw/ipp.stack.dat (modified) (1 diff)
-
scripts/generate (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/INSTALL
r24662 r26888 14 14 psconfigure --dbhost ipp004 --dbuser ipp --dbpass ipp --htdocs ~ipp/htdocs 15 15 16 # note that we have a special version for ippmonitor without $PSCONFIG/$PSCONFDIR values: 16 17 ipp@ipp004 / ippdb01 example: 17 psconfigure --dbhost ippdb01 --dbuser ipp --dbpass ipp --htdocs ~/htdocs --site ~/ippconfig/ipp rc.config18 psconfigure --dbhost ippdb01 --dbuser ipp --dbpass ipp --htdocs ~/htdocs --site ~/ippconfig/ippmonitor.config 18 19 -
trunk/ippMonitor/Makefile.in
r25786 r26888 145 145 $(DESTWWW)/magicProcessedNodes.php \ 146 146 $(DESTWWW)/magicProcessedMasks.php \ 147 $(DESTWWW)/magicProcessedMasks_Images.php \ 147 148 $(DESTWWW)/magicFailedTrees.php \ 148 149 $(DESTWWW)/magicFailedNodes.php \ -
trunk/ippMonitor/def/camProcessedImfile.d
r24867 r26888 17 17 OP OP1 $rawExp.ra * 57.295783 18 18 OP OP2 $rawExp.decl * 57.295783 19 20 HEAD PHP insert_image ('PPIMAGE.JPEG1', 'width=1000pix'); 19 21 20 22 # field size format name show link to extras … … 43 45 FIELD rawExp.comment, 65, %s, Comment 44 46 45 TAIL PHP insert_image ('PPIMAGE.JPEG1');46 47 TAIL PHP insert_log ('LOG.EXP'); -
trunk/ippMonitor/def/detNormalizedImfile_failure.d
r19726 r26888 16 16 #FIELD path_base, 20, %s, path_base 17 17 18 TAIL PHP insert_image ('PPIMAGE.JPEG1' );18 TAIL PHP insert_image ('PPIMAGE.JPEG1', 'width=90%'); 19 19 TAIL PHP insert_log ('LOG.EXP'); -
trunk/ippMonitor/def/detProcessedImfile.d
r19809 r26888 20 20 TD_CLASS det_off $detProcessedImfile.fault > 0 21 21 22 TAIL PHP insert_image ('PPIMAGE.JPEG1' );22 TAIL PHP insert_image ('PPIMAGE.JPEG1', 'width=90%'); 23 23 TAIL PHP insert_log ('LOG.EXP'); 24 24 -
trunk/ippMonitor/def/detResidImfile.d
r24218 r26888 22 22 FIELD detResidImfile.uri, 5, %s, uri, none 23 23 24 TAIL PHP insert_image ('PPIMAGE.JPEG1' );24 TAIL PHP insert_image ('PPIMAGE.JPEG1', 'width=90%'); 25 25 TAIL PHP insert_log ('LOG.EXP'); -
trunk/ippMonitor/def/diffProcessedSkyfile_Images.d
r24061 r26888 38 38 FIELD diffSkyfile.path_base, 5, %s, path_base, none 39 39 40 TAIL PHP insert_image ('PPSUB.OUTPUT.JPEG1' );40 TAIL PHP insert_image ('PPSUB.OUTPUT.JPEG1', 'width=90%'); 41 41 TAIL PHP insert_log ('LOG.EXP'); -
trunk/ippMonitor/def/stackProcessedSkyfile_Images.d
r21339 r26888 43 43 FIELD stackSumSkyfile.path_base, 5, %s, path_base, none 44 44 45 TAIL PHP insert_image ('PPSTACK.OUTPUT.JPEG1' );45 TAIL PHP insert_image ('PPSTACK.OUTPUT.JPEG1', 'width=90%'); 46 46 TAIL PHP insert_log ('LOG.EXP'); -
trunk/ippMonitor/raw/getimage.php
r24394 r26888 60 60 if ($debug) { 61 61 exec ("which ipp_filename.pl", $output, $status); 62 echo "output: $output[0]<br>"; 62 echo "which ipp_filename.pl output:<br>"; 63 for ($i = 0; $i < count($output); $i++) { 64 echo "output $i: $output[$i]<br>"; 65 } 63 66 echo "status: $status<br>"; 64 67 65 68 exec ("whoami", $output, $status); 66 echo "output: $output[0]<br>"; 69 echo "which whoami output:<br>"; 70 for ($i = 0; $i < count($output); $i++) { 71 echo "output $i: $output[$i]<br>"; 72 } 67 73 echo "status: $status<br>"; 68 74 } -
trunk/ippMonitor/raw/ipp.php
r26456 r26888 651 651 // expect image supplied with key=name 652 652 // this function should define matching hidden inputs in the form 653 function insert_image ($rule ) {653 function insert_image ($rule, $size) { 654 654 655 655 if ($_SERVER[REQUEST_METHOD] == 'GET') { … … 666 666 667 667 if ($basename && $camera && $rule) { 668 echo "<img src=\"getimage.php?name=$basename&rule=$rule&camera=$camera&class_id=$class_id\">\n";668 echo "<img $size src=\"getimage.php?name=$basename&rule=$rule&camera=$camera&class_id=$class_id\">\n"; 669 669 } 670 670 } -
trunk/ippMonitor/raw/ipp.stack.dat
r24674 r26888 47 47 menulink | menuselect | link | Magic Processed Nodes | magicProcessedNodes.php 48 48 menulink | menuselect | link | Magic Processed Masks | magicProcessedMasks.php 49 menulink | menuselect | link | Magic Masks w/ Images | magicProcessedMasks_Images.php 49 50 menulink | menuselect | link | Magic Failed Trees | magicFailedTrees.php 50 51 menulink | menuselect | link | Magic Failed Nodes | magicFailedNodes.php -
trunk/ippMonitor/scripts/generate
r26456 r26888 37 37 38 38 foreach $line (@list) { 39 chop $line;40 ($key, $value) = split (" ", $line, 2);41 42 # strip leading and trailing white space from the following43 if ($key eq "TABLE") { ($value) = $value =~ m|^\s*(.+)\s*$|; }44 if ($key eq "TYPE") { ($value) = $value =~ m|^\s*(.+)\s*$|; }45 46 &set_keypair ($key, $value);47 48 # list of the table fields49 if ($key eq "FIELD") {50 ($field, $width, $format, $name, $show, $link, $extras) = split (/,\s+/, $value, 7);51 if (! $name) { die "table $ARGV[0] missing required elements\n"; }52 if ($field =~ m|\S+\s+as\s+\S+|) {53 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|;54 } else {55 $fieldreal = $field;56 }57 58 if ($VERBOSE) { printf "%-20s %-20s %-20s %-20s %-20s %-20s\n", $field, $name, $format, $show, $link, $extras; }59 60 if ($show eq "") {$show = "value";}61 push @field, $field;62 push @fieldreal, $fieldreal;63 push @width, $width;64 push @format, $format;65 push @name, $name;66 push @show, $show;67 push @link, $link;68 push @extras, $extras;69 }70 71 if ($key eq "FILE") {72 $myFile = $value;73 }74 75 # list of the table fields76 if ($key eq "HEAD") {77 push @headcode, $value;78 }79 80 # the IMAGE commands sets up a reference name81 if ($key eq "IMAGE") {82 push @imagedefs, $value;83 }84 85 # the GROUP entries are used in summary tables as arguments to the GROUP BY sql statement86 if ($key eq "GROUP") {87 push @group, $value;88 }89 90 # the ARGS commands define arguments to FIELDS commands91 if ($key eq "ARGS") {92 push @linkargs, $value;93 }94 95 # the OP commands define field operations96 if ($key eq "OP") {97 push @opwords, $value;98 }99 100 # the TD_CLASS command sets up an alternate TD class101 if ($key eq "TD_CLASS") {102 push @tdClasses, $value;103 # print STDERR "found TD_CLASS\n";104 }105 106 # list of the table fields107 if ($key eq "TAIL") {108 push @tailcode, $value;109 }110 111 # list of the table restrictions112 # replace this with a flexible where statement?113 if ($key eq "WHERE") {114 ($field) = split (/,\s+/, $value, 1);115 if ($VERBOSE) { printf "%-20s\n", $field; }116 push @where, $field;117 }39 chop $line; 40 ($key, $value) = split (" ", $line, 2); 41 42 # strip leading and trailing white space from the following 43 if ($key eq "TABLE") { ($value) = $value =~ m|^\s*(.+)\s*$|; } 44 if ($key eq "TYPE") { ($value) = $value =~ m|^\s*(.+)\s*$|; } 45 46 &set_keypair ($key, $value); 47 48 # list of the table fields 49 if ($key eq "FIELD") { 50 ($field, $width, $format, $name, $show, $link, $extras) = split (/,\s+/, $value, 7); 51 if (! $name) { die "table $ARGV[0] missing required elements\n"; } 52 if ($field =~ m|\S+\s+as\s+\S+|) { 53 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|; 54 } else { 55 $fieldreal = $field; 56 } 57 58 if ($VERBOSE) { printf "%-20s %-20s %-20s %-20s %-20s %-20s\n", $field, $name, $format, $show, $link, $extras; } 59 60 if ($show eq "") {$show = "value";} 61 push @field, $field; 62 push @fieldreal, $fieldreal; 63 push @width, $width; 64 push @format, $format; 65 push @name, $name; 66 push @show, $show; 67 push @link, $link; 68 push @extras, $extras; 69 } 70 71 if ($key eq "FILE") { 72 $myFile = $value; 73 } 74 75 # list of the table fields 76 if ($key eq "HEAD") { 77 push @headcode, $value; 78 } 79 80 # the IMAGE commands sets up a reference name 81 if ($key eq "IMAGE") { 82 push @imagedefs, $value; 83 } 84 85 # the GROUP entries are used in summary tables as arguments to the GROUP BY sql statement 86 if ($key eq "GROUP") { 87 push @group, $value; 88 } 89 90 # the ARGS commands define arguments to FIELDS commands 91 if ($key eq "ARGS") { 92 push @linkargs, $value; 93 } 94 95 # the OP commands define field operations 96 if ($key eq "OP") { 97 push @opwords, $value; 98 } 99 100 # the TD_CLASS command sets up an alternate TD class 101 if ($key eq "TD_CLASS") { 102 push @tdClasses, $value; 103 # print STDERR "found TD_CLASS\n"; 104 } 105 106 # list of the table fields 107 if ($key eq "TAIL") { 108 push @tailcode, $value; 109 } 110 111 # list of the table restrictions 112 # replace this with a flexible where statement? 113 if ($key eq "WHERE") { 114 ($field) = split (/,\s+/, $value, 1); 115 if ($VERBOSE) { printf "%-20s\n", $field; } 116 push @where, $field; 117 } 118 118 } 119 119 … … 126 126 &check_key ("TITLE", ""); 127 127 &check_key ("FILE", ""); 128 128 129 129 # these are used internally (not just a replacement) 130 130 for ($i = 0; $i < @key; $i++) { 131 if ($key[$i] eq "MENU") { $MENU = $value[$i]; }132 if ($key[$i] eq "MODE") { 133 if ($value[$i] eq "summary") {134 if (@group == 0) {135 print STDERR "a summary table must have at least one group\n";136 exit 1;137 }138 &define_groups_string (@group);139 }140 }131 if ($key[$i] eq "MENU") { $MENU = $value[$i]; } 132 if ($key[$i] eq "MODE") { 133 if ($value[$i] eq "summary") { 134 if (@group == 0) { 135 print STDERR "a summary table must have at least one group\n"; 136 exit 1; 137 } 138 &define_groups_string (@group); 139 } 140 } 141 141 } 142 142 … … 149 149 150 150 foreach $linkarg (@linkargs) { 151 &parse_linkarg ($linkarg); 151 # print STDERR "linkarg: $linkarg\n"; 152 &parse_linkarg ($linkarg); 152 153 } 153 154 154 155 foreach $imagedef (@imagedefs) { 155 &parse_imagedef ($imagedef);156 &parse_imagedef ($imagedef); 156 157 } 157 158 158 159 foreach $opword (@opwords) { 159 &parse_opwords ($opword); 160 } 161 162 if (0) { 163 print STDERR "show: $show[0]\n"; 164 ($a, $b, $c) = &parse_label ($show[0]); 165 print STDERR "a: $a, b: $b, c: $c\n"; 166 167 print STDERR "extras: $extras[0]\n"; 168 ($a, $b, $c) = &parse_label ($extras[0]); 169 print STDERR "a: $a, b: $b, c: $c\n"; 170 171 print STDERR "show: $show[1]\n"; 172 ($a, $b, $c) = &parse_label ($show[1]); 173 print STDERR "a: $a, b: $b, c: $c\n"; 174 175 print STDERR "extras: $extras[1]\n"; 176 ($a, $b, $c) = &parse_label ($extras[1]); 177 print STDERR "a: $a, b: $b, c: $c\n"; 178 exit 0; 160 &parse_opwords ($opword); 161 } 162 163 if ($VERBOSE) { 164 print STDERR "show: $show[0]\n"; 165 ($a, $b, $c) = &parse_label ($show[0]); 166 print STDERR "a: $a, b: $b, c: $c\n"; 167 168 print STDERR "extras: $extras[0]\n"; 169 ($a, $b, $c) = &parse_label ($extras[0]); 170 print STDERR "a: $a, b: $b, c: $c\n"; 171 172 print STDERR "show: $show[1]\n"; 173 ($a, $b, $c) = &parse_label ($show[1]); 174 print STDERR "a: $a, b: $b, c: $c\n"; 175 176 print STDERR "extras: $extras[1]\n"; 177 ($a, $b, $c) = &parse_label ($extras[1]); 178 print STDERR "a: $a, b: $b, c: $c\n"; 179 179 } 180 180 } … … 188 188 189 189 foreach $line (@list) { 190 191 &check_keypairs;192 193 print FILE $line;194 195 # fill in table header196 if ($line =~ m|// \*\* TABLE HEADER \*\*|) {197 &write_table_header;198 }199 200 # fill in TD_CLASS test201 if ($line =~ m|// \*\* TD CLASS \*\*|) {202 &write_td_class;203 }204 205 # fill in table data206 if ($line =~ m|// \*\* TABLE DATA \*\*|) {207 &write_table_data;208 }209 210 # fill in table query211 if ($line =~ m|// \*\* TABLE QUERY \*\*|) {212 &write_table_query;213 }214 215 # fill in table restricts216 if ($line =~ m|// \*\* TABLE RESTRICTIONS \*\*|) {217 &write_table_restrict;218 }219 220 # fill in table restricts221 if ($line =~ m|// \*\* BUTTON RESTRICTIONS \*\*|) {222 &write_button_restrict;223 }224 225 # fill in head HTML or PHP code226 if ($line =~ m|// \*\* HEAD CODE \*\*|) {227 &write_inline_code (@headcode);228 }229 230 # fill in tail HTML or PHP code231 if ($line =~ m|// \*\* TAIL CODE \*\*|) {232 &write_inline_code (@tailcode);233 }190 191 &check_keypairs; 192 193 print FILE $line; 194 195 # fill in table header 196 if ($line =~ m|// \*\* TABLE HEADER \*\*|) { 197 &write_table_header; 198 } 199 200 # fill in TD_CLASS test 201 if ($line =~ m|// \*\* TD CLASS \*\*|) { 202 &write_td_class; 203 } 204 205 # fill in table data 206 if ($line =~ m|// \*\* TABLE DATA \*\*|) { 207 &write_table_data; 208 } 209 210 # fill in table query 211 if ($line =~ m|// \*\* TABLE QUERY \*\*|) { 212 &write_table_query; 213 } 214 215 # fill in table restricts 216 if ($line =~ m|// \*\* TABLE RESTRICTIONS \*\*|) { 217 &write_table_restrict; 218 } 219 220 # fill in table restricts 221 if ($line =~ m|// \*\* BUTTON RESTRICTIONS \*\*|) { 222 &write_button_restrict; 223 } 224 225 # fill in head HTML or PHP code 226 if ($line =~ m|// \*\* HEAD CODE \*\*|) { 227 &write_inline_code (@headcode); 228 } 229 230 # fill in tail HTML or PHP code 231 if ($line =~ m|// \*\* TAIL CODE \*\*|) { 232 &write_inline_code (@tailcode); 233 } 234 234 } 235 235 close (FILE); … … 239 239 my (@code) = @_; 240 240 my ($i, $code, $type); 241 241 242 242 for ($i = 0; $i < @code; $i++) { 243 ($type, $line) = split (" ", $code[$i], 2);244 if ($type eq "PHP") {245 print FILE "$line\n";246 }247 if ($type eq "HTML") {248 print FILE "?> $line <?\n";249 }243 ($type, $line) = split (" ", $code[$i], 2); 244 if ($type eq "PHP") { 245 print FILE "$line\n"; 246 } 247 if ($type eq "HTML") { 248 print FILE "?> $line <?\n"; 249 } 250 250 } 251 251 } … … 255 255 256 256 # print the table header (field labels) 257 print FILE "echo \"<tr><td></td>\\n\";\n"; 258 for ($i = 0; $i < @field; $i++) { 259 ($label, $value, $string) = &parse_label ($show[$i]);260 if ($show[$i] eq "none") { next; }261 print FILE "write_header_cell (\"list\", \"$name[$i]\");\n";257 print FILE "echo \"<tr><td></td>\\n\";\n"; 258 for ($i = 0; $i < @field; $i++) { 259 ($label, $value, $string) = &parse_label ($show[$i]); 260 if ($show[$i] eq "none") { next; } 261 print FILE "write_header_cell (\"list\", \"$name[$i]\");\n"; 262 262 } 263 263 print FILE "echo \"</tr>\\n\";\n"; 264 264 265 265 # print the column sort cells 266 print FILE "echo \"<tr><td></td>\\n\";\n"; 267 for ($i = 0; $i < @field; $i++) { 268 ($label, $value, $string) = &parse_label ($show[$i]);269 if ($show[$i] eq "none") { next; }270 if ($field[$i] eq "*") { print FILE "echo \"<td></td>\\n\";\n"; next; } # empty cell (no sort for such fields)271 if ($label eq "op") {272 print FILE "write_sort_cell (\"list\", \"$opf{$value}\", \$buttonLink, \$ID, '$myFile');\n";273 } else {274 print FILE "write_sort_cell (\"list\", \"$fieldreal[$i]\", \$buttonLink, \$ID, '$myFile');\n";275 }266 print FILE "echo \"<tr><td></td>\\n\";\n"; 267 for ($i = 0; $i < @field; $i++) { 268 ($label, $value, $string) = &parse_label ($show[$i]); 269 if ($show[$i] eq "none") { next; } 270 if ($field[$i] eq "*") { print FILE "echo \"<td></td>\\n\";\n"; next; } # empty cell (no sort for such fields) 271 if ($label eq "op") { 272 print FILE "write_sort_cell (\"list\", \"$opf{$value}\", \$buttonLink, \$ID, '$myFile');\n"; 273 } else { 274 print FILE "write_sort_cell (\"list\", \"$fieldreal[$i]\", \$buttonLink, \$ID, '$myFile');\n"; 275 } 276 276 } 277 277 print FILE "echo \"</tr>\\n\";\n"; … … 284 284 foreach $tdClass (@tdClasses) { 285 285 286 # TD_CLASS class field expression287 ($class, $testline) = split (" ", $tdClass, 2);288 289 $testlineFixed = "";290 @testlineBits = split (" ", $testline);291 foreach my $bit (@testlineBits) {292 $newbit = &parse_fieldname ($bit);293 $testlineFixed = "$testlineFixed $newbit";294 }295 296 print FILE " if ($testlineFixed) {\n";297 print FILE " \$class = \"$class\";\n";298 print FILE " }\n";286 # TD_CLASS class field expression 287 ($class, $testline) = split (" ", $tdClass, 2); 288 289 $testlineFixed = ""; 290 @testlineBits = split (" ", $testline); 291 foreach my $bit (@testlineBits) { 292 $newbit = &parse_fieldname ($bit); 293 $testlineFixed = "$testlineFixed $newbit"; 294 } 295 296 print FILE " if ($testlineFixed) {\n"; 297 print FILE " \$class = \"$class\";\n"; 298 print FILE " }\n"; 299 299 } 300 300 } … … 304 304 305 305 if ($WHERE) { 306 print FILE "\$WHERE = \"WHERE $WHERE\";\n";307 } 308 for ($i = 0; $i < @field; $i++) { 309 $value = $fieldreal[$i];310 if ($value eq "*") { next; }311 if ($format[$i] eq "%s") {312 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string', 1.0);\n";313 next;314 } 315 if ($format[$i] eq "%C") {316 # convert the RA & DEC limits to radians for comparison317 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min', 0.017453);\n";318 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max', 0.017453);\n";319 next;320 } 321 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string', 1.0);\n";322 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min', 1.0);\n";323 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max', 1.0);\n";306 print FILE "\$WHERE = \"WHERE $WHERE\";\n"; 307 } 308 for ($i = 0; $i < @field; $i++) { 309 $value = $fieldreal[$i]; 310 if ($value eq "*") { next; } 311 if ($format[$i] eq "%s") { 312 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string', 1.0);\n"; 313 next; 314 } 315 if ($format[$i] eq "%C") { 316 # convert the RA & DEC limits to radians for comparison 317 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min', 0.017453);\n"; 318 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max', 0.017453);\n"; 319 next; 320 } 321 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string', 1.0);\n"; 322 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min', 1.0);\n"; 323 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max', 1.0);\n"; 324 324 } 325 325 print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n"; … … 330 330 331 331 for ($i = 0; $i < @field; $i++) { 332 $value = $fieldreal[$i];333 if ($value eq "*") { next; }334 if ($format[$i] eq "%s") {335 print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n";336 } else {337 print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n";338 print FILE "\$buttonLink = button_restrict_min ('$value', \$buttonLink);\n";339 print FILE "\$buttonLink = button_restrict_max ('$value', \$buttonLink);\n";340 }332 $value = $fieldreal[$i]; 333 if ($value eq "*") { next; } 334 if ($format[$i] eq "%s") { 335 print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n"; 336 } else { 337 print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n"; 338 print FILE "\$buttonLink = button_restrict_min ('$value', \$buttonLink);\n"; 339 print FILE "\$buttonLink = button_restrict_max ('$value', \$buttonLink);\n"; 340 } 341 341 } 342 342 } … … 349 349 print FILE "echo \"<tr><td>≥</td>\\n\";\n"; 350 350 for ($i = 0; $i < @field; $i++) { 351 if ($show[$i] eq "none") { next; }352 if ($field[$i] eq "*") { 353 # * fields create an empty cell 354 print FILE "echo \"<td> </td>\\n\";\n";355 } else {356 if ($format[$i] eq "%s") {357 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'string');\n";358 } else {359 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'min');\n";360 }361 }351 if ($show[$i] eq "none") { next; } 352 if ($field[$i] eq "*") { 353 # * fields create an empty cell 354 print FILE "echo \"<td> </td>\\n\";\n"; 355 } else { 356 if ($format[$i] eq "%s") { 357 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'string');\n"; 358 } else { 359 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'min');\n"; 360 } 361 } 362 362 } 363 363 print FILE "echo \"</tr><tr><td>≤</td>\\n\";\n"; 364 364 for ($i = 0; $i < @field; $i++) { 365 if ($show[$i] eq "none") { next; }366 if (($field[$i] eq "*") || ($format[$i] eq "%s")) { 367 # * fields create an empty cell 368 print FILE "echo \"<td> </td>\\n\";\n";369 } else {370 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'max');\n";371 }365 if ($show[$i] eq "none") { next; } 366 if (($field[$i] eq "*") || ($format[$i] eq "%s")) { 367 # * fields create an empty cell 368 print FILE "echo \"<td> </td>\\n\";\n"; 369 } else { 370 print FILE "write_query_row ('$fieldreal[$i]', $width[$i], 'max');\n"; 371 } 372 372 } 373 373 print FILE "echo \"</tr>\\n\";\n"; … … 379 379 380 380 for ($i = 0; $i < @field; $i++) { 381 ($label, $value, $string) = &parse_label ($show[$i]); 382 $Nrow = $count[$i]; 383 384 # create the link variable if this entry should be linked 385 if ($label eq "none") { next; } 386 387 if ($label eq "value") { 388 # create the basic link variable 389 if ($link[$i]) { 390 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 391 # add extra GET data to target 392 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 393 $myLink = "\$link"; 394 } else { 395 $myLink = "\"\""; 396 } 397 # print the actual table cell line with the link... 398 if (! $value && ($field[$i] ne "*")) { $value = "\$row[$Nrow]"; } 399 400 # add special format elements 401 # $realFormat = $format[$i]; 402 # if ($format[$i] eq '%T') { 403 # $realFormat = '%s'; 404 # } 405 print FILE " write_table_cell (\$class, '$format[$i]', $myLink, $value);\n"; 406 next; 407 } 408 409 if ($label eq "op") { 410 # create the basic link variable 411 if ($link[$i]) { 412 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 413 # add extra GET data to target 414 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 415 $myLink = "\$link"; 416 } else { 417 $myLink = "\"\""; 418 } 419 print FILE " write_table_cell (\$class, '$format[$i]', $myLink, $ops{$value});\n"; 420 next; 421 } 422 423 if (($label eq "image") && !$link[$i]) { 424 # print the actual table cell line with the image... 425 print FILE " echo \"<td class=\\\"\$class\\\">\n"; 426 print FILE " echo \" <img src=\\\"$image{$value}\\\"></td>\\n\";\n"; 427 next; 428 } 429 430 if (($label eq "image") && $link[$i]) { 431 # create the basic link 432 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 433 # add extra php data to target 434 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 435 # print the actual table cell line with the link... 436 print FILE " echo \"<td class=\\\"\$class\\\"><a href=\\\"\$link\\\"> <img src=\\\"$image{$value}\\\"> </a></td>\\n\";\n"; 437 next; 438 } 381 ($label, $value, $string) = &parse_label ($show[$i]); 382 $Nrow = $count[$i]; 383 384 # create the link variable if this entry should be linked 385 if ($label eq "none") { next; } 386 387 if ($label eq "value") { 388 # create the basic link variable 389 # print STDERR "value: $link[$i]\n"; 390 if ($link[$i]) { 391 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 392 # add extra GET data to target 393 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 394 $myLink = "\$link"; 395 } else { 396 $myLink = "\"\""; 397 } 398 # print the actual table cell line with the link... 399 if (! $value && ($field[$i] ne "*")) { $value = "\$row[$Nrow]"; } 400 401 # add special format elements 402 # $realFormat = $format[$i]; 403 # if ($format[$i] eq '%T') { 404 # $realFormat = '%s'; 405 # } 406 print FILE " write_table_cell (\$class, '$format[$i]', $myLink, $value);\n"; 407 next; 408 } 409 410 if ($label eq "op") { 411 # create the basic link variable 412 if ($link[$i]) { 413 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 414 # add extra GET data to target 415 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 416 $myLink = "\$link"; 417 } else { 418 $myLink = "\"\""; 419 } 420 print FILE " write_table_cell (\$class, '$format[$i]', $myLink, $ops{$value});\n"; 421 next; 422 } 423 424 if (($label eq "image") && !$link[$i]) { 425 # print the actual table cell line with the image... 426 print FILE " echo \"<td class=\\\"\$class\\\">\n"; 427 print FILE " echo \" <img src=\\\"$image{$value}\\\"></td>\\n\";\n"; 428 next; 429 } 430 431 if (($label eq "image") && $link[$i]) { 432 # create the basic link 433 print FILE " \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n"; 434 # add extra php data to target 435 if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 436 # print the actual table cell line with the link... 437 print FILE " echo \"<td class=\\\"\$class\\\"><a href=\\\"\$link\\\"> <img src=\\\"$image{$value}\\\"> </a></td>\\n\";\n"; 438 next; 439 } 439 440 } 440 441 } … … 446 447 $FIELDS = "$array[0]"; 447 448 for ($i = 1; $i < @array; $i++) { 448 # skip * fields (not a valid query element449 if ($array[$i] eq "*") { next; }450 $FIELDS = "$FIELDS,$array[$i]";449 # skip * fields (not a valid query element 450 if ($array[$i] eq "*") { next; } 451 $FIELDS = "$FIELDS,$array[$i]"; 451 452 } 452 453 set_keypair ("FIELDS", $FIELDS); … … 459 460 $GROUPS = "$array[0]"; 460 461 for ($i = 1; $i < @array; $i++) { 461 # skip * fields (not a valid query element462 if ($array[$i] eq "*") { next; }463 $GROUPS = "$GROUPS,$array[$i]";462 # skip * fields (not a valid query element 463 if ($array[$i] eq "*") { next; } 464 $GROUPS = "$GROUPS,$array[$i]"; 464 465 } 465 466 set_keypair ("GROUPS", $GROUPS); … … 473 474 $Nrow = 0; 474 475 for ($i = 0; $i < @field; $i++) { 475 # skip * fields (not a valid query element476 if ($field[$i] eq "*") { 477 $count[$i] = -1;478 } else {479 $count[$i] = $Nrow;480 $Nrow ++;481 }476 # skip * fields (not a valid query element 477 if ($field[$i] eq "*") { 478 $count[$i] = -1; 479 } else { 480 $count[$i] = $Nrow; 481 $Nrow ++; 482 } 482 483 } 483 484 } … … 491 492 $WHERE = "$array[0]"; 492 493 for ($i = 1; $i < @array; $i++) { 493 $WHERE = "$WHERE AND $array[$i]";494 } 495 494 $WHERE = "$WHERE AND $array[$i]"; 495 } 496 496 497 set_keypair ("WHERE", $WHERE); 497 498 } … … 504 505 505 506 # examine the extras and parse the embedded fields (comma-separated) 507 506 508 @extfields = split (/,/, $extras); 507 509 for ($i = 0; $i < @extfields; $i++) { 508 ($label, $value, $outline) = &parse_label ($extfields[$i]);509 print FILE " \$link = \$link . \"&$outline\";\n";510 ($label, $value, $outline) = &parse_label ($extfields[$i]); 511 print FILE " \$link = \$link . \"&$outline\";\n"; 510 512 } 511 513 } … … 519 521 ($word, $value) = split (" ", $_[0]); 520 522 523 # print STDERR "0: $_[0], $word, $value\n"; 524 521 525 if ($linkarg{$word}) { 522 $linkarg{$word} = "$linkarg{$word},$value";526 $linkarg{$word} = "$linkarg{$word},$value"; 523 527 } else { 524 $linkarg{$word} = $value; 525 } 528 $linkarg{$word} = $value; 529 } 530 # print STDERR "linkarg($word) : $linkarg{$word}\n"; 526 531 } 527 532 528 533 # parse strings of the form label=value 529 # if 'value' is of the form $field, try to match with 534 # if 'value' is of the form $field, try to match with 530 535 # a supplied DB field, and replace with $row[$n] if found 531 536 sub parse_label { … … 542 547 if ($VERBOSE) { print STDERR "string: $string\n"; } 543 548 if ($string =~ m|\S+=\S+|) { 544 ($label, $value) = $string =~ m|(\S+)=(\S+)|; 545 if ($value =~ m|^\$|) { 546 MATCH_LABEL: 547 for ($i = 0; $i < @field; $i++) { 548 if ($field[$i] eq "*") { next; } 549 if ($value =~ m|^\$$fieldreal[$i]|) { 550 # print "field: $fieldreal[$i]\n"; 551 ($name, $extra) = $value =~ m|^\$($fieldreal[$i])\@(\S+)|; 552 # print "name: $name\n"; 553 # print "extra: $extra\n"; 554 # print "value: $value\n"; 555 556 $Nrow = $count[$i]; 557 if ($extra) { 558 $value = "\$row[$Nrow]\@$extra"; 559 } else { 560 $value = "\$row[$Nrow]"; 561 } 562 # print "outval: $value\n"; 563 last MATCH_LABEL; 564 } 565 } 566 $outline = "$label=$value"; 567 } 549 ($label, $value) = $string =~ m|(\S+)=(\S+)|; 550 if ($value =~ m|^\$|) { 551 MATCH_LABEL: 552 for ($i = 0; $i < @field; $i++) { 553 if ($field[$i] eq "*") { next; } 554 while ($value =~ m|\$$fieldreal[$i]|) { 555 # print "field: $fieldreal[$i]\n"; 556 # ($part1, $name, $part2) = $value =~ m|\$($fieldreal[$i])\@(\S+)|; 557 ($part1, $name, $part2) = $value =~ m|(\S*)\$($fieldreal[$i])(\S*)|; 558 # print "name: $name\n"; 559 # print "part1: $part1\n"; 560 # print "part2: $part2\n"; 561 # print "value: $value\n"; 562 563 $Nrow = $count[$i]; 564 $value = $part1 . "\$row[$Nrow]" . $part2; 565 566 # if ($part1 || $part2) { 567 # } else { 568 # $value = "\$row[$Nrow]"; 569 # } 570 # print "outval: $value\n"; 571 # last MATCH_LABEL; 572 } 573 } 574 $outline = "$label=$value"; 575 } 568 576 } 569 577 return ($label, $value, $outline); … … 576 584 my ($variable) = $_[0]; 577 585 my ($i); 578 586 579 587 # print STDERR "variable: $variable\n"; 580 588 581 589 unless ($variable =~ m|^\$|) { 582 return $variable;590 return $variable; 583 591 } 584 592 … … 588 596 589 597 for ($i = 0; $i < @field; $i++) { 590 # print STDERR "$i: $fieldreal[$i] : $fieldname\n";591 592 if ($field[$i] eq "*") { next; }593 if ($fieldname ne $fieldreal[$i]) { next; }594 595 596 $Nrow = $count[$i];597 598 $value = "\$row[$Nrow]";599 600 # print STDERR "found : $i : $count[$i] : $Nrow : $value\n";601 return $value;598 # print STDERR "$i: $fieldreal[$i] : $fieldname\n"; 599 600 if ($field[$i] eq "*") { next; } 601 if ($fieldname ne $fieldreal[$i]) { next; } 602 603 604 $Nrow = $count[$i]; 605 606 $value = "\$row[$Nrow]"; 607 608 # print STDERR "found : $i : $count[$i] : $Nrow : $value\n"; 609 return $value; 602 610 } 603 611 return $variable; … … 625 633 @outfields = (); 626 634 foreach $word (@words) { 627 $fword = &parse_fieldname ($word);628 # print "field: $word -> $fword\n";629 push @outwords, $fword;630 if ($word =~ m|^\$|) {631 $word = substr ($word, 1);632 }633 push @outfields, $word;635 $fword = &parse_fieldname ($word); 636 # print "field: $word -> $fword\n"; 637 push @outwords, $fword; 638 if ($word =~ m|^\$|) { 639 $word = substr ($word, 1); 640 } 641 push @outfields, $word; 634 642 } 635 643 $outline = join (" ", @outwords); … … 657 665 658 666 for ($i = 0; $i < @key; $i++) { 659 if ($key eq $key[$i]) {660 if ($value[$i] ne "") { die "key is multiply defined\n"; }661 $value[$i] = $value;662 if ($VERBOSE) { print STDERR "setting $key = $value\n"; }663 return;664 }667 if ($key eq $key[$i]) { 668 if ($value[$i] ne "") { die "key is multiply defined\n"; } 669 $value[$i] = $value; 670 if ($VERBOSE) { print STDERR "setting $key = $value\n"; } 671 return; 672 } 665 673 } 666 674 } … … 672 680 673 681 for ($i = 0; $i < @key; $i++) { 674 if ($key eq $key[$i]) {675 if ($VERBOSE) { print "found $key: $key[$i] -- $value[$i] (def: $default)\n"; }676 if (($default eq "") && ($value[$i] eq "")) { die "missing value for required key $key[$i]\n"; }677 if ($value[$i] eq "") { $value[$i] = $default; }678 return;679 }682 if ($key eq $key[$i]) { 683 if ($VERBOSE) { print "found $key: $key[$i] -- $value[$i] (def: $default)\n"; } 684 if (($default eq "") && ($value[$i] eq "")) { die "missing value for required key $key[$i]\n"; } 685 if ($value[$i] eq "") { $value[$i] = $default; } 686 return; 687 } 680 688 } 681 689 die "unknown key $key\n"; … … 685 693 my ($i); 686 694 for ($i = 0; $i < @key; $i++) { 687 if ($VERBOSE) { print "$key[$i] -- $value[$i]\n"; }688 if ($line =~ m|\$$key[$i]|) {689 if ($value[$i] eq "") { die "missing value for required key $key[$i]\n"; }690 $line =~ s|\$$key[$i]|$value[$i]|g;691 }692 } 693 } 694 695 # we need to find the structure size, including padding 696 # i'm not sure I know the answer to this: it is probably 697 # the total number of bytes rounded up to the largest 695 if ($VERBOSE) { print "$key[$i] -- $value[$i]\n"; } 696 if ($line =~ m|\$$key[$i]|) { 697 if ($value[$i] eq "") { die "missing value for required key $key[$i]\n"; } 698 $line =~ s|\$$key[$i]|$value[$i]|g; 699 } 700 } 701 } 702 703 # we need to find the structure size, including padding 704 # i'm not sure I know the answer to this: it is probably 705 # the total number of bytes rounded up to the largest 698 706 # data item in the structure (ie, 8 for a double, etc) 699 707 # if we have the size, then we can double check the structure 700 708 # against the expectation at runtime. for the moment, 701 # calculate by hand and add to def.d file 702 709 # calculate by hand and add to def.d file 710
Note:
See TracChangeset
for help on using the changeset viewer.
