Changeset 18143
- Timestamp:
- Jun 15, 2008, 1:56:02 PM (18 years ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 4 edited
-
def/autocode.php (modified) (1 diff)
-
def/detProcessedImfile.d (modified) (1 diff)
-
raw/ipp.php (modified) (6 diffs)
-
scripts/generate (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/def/autocode.php
r14113 r18143 74 74 75 75 // query restriction form 76 echo "<tr>\n";76 // echo "<tr>\n"; 77 77 // echo "<td class=list> <input type=\"text\" name=\"expID\"></td>\n"; 78 78 // ** TABLE QUERY ** 79 echo "</tr>\n";79 // echo "</tr>\n"; 80 80 81 81 // list the results -
trunk/ippMonitor/def/detProcessedImfile.d
r15954 r18143 12 12 FIELD rawExp.exp_name, 5, %s, Exp Name 13 13 FIELD detProcessedImfile.class_id, 8, %s, Chip ID 14 FIELD detProcessedImfile.bg, 8, % s, backgnd14 FIELD detProcessedImfile.bg, 8, %f, backgnd 15 15 FIELD detProcessedImfile.bg_stdev, 8, %s, stdev 16 16 FIELD detProcessedImfile.bg_mean_stdev, 8, %s, [stdev] 17 FIELD detProcessedImfile.path_base, 5, %s, path_base17 FIELD detProcessedImfile.path_base, 10, %s, path_base 18 18 19 19 TAIL PHP insert_image ('PPIMAGE.JPEG1'); -
trunk/ippMonitor/raw/ipp.php
r15954 r18143 364 364 } 365 365 366 function check_restrict ($key, $where ) {366 function check_restrict ($key, $where, $mode) { 367 367 $htmlkey = preg_replace ('|\.|', '_', $key); 368 if ($mode == 'min') { 369 $htmlkey = $htmlkey . "_min"; 370 } 371 if ($mode == 'max') { 372 $htmlkey = $htmlkey . "_max"; 373 } 374 368 375 if ($_SERVER[REQUEST_METHOD] == 'GET') { 369 376 $value = $_GET[$htmlkey]; … … 371 378 $value = $_POST[$htmlkey]; 372 379 } 373 if ($value != "") { 374 if ($where) { 375 $where = $where . " AND $key = '$value'"; 376 } else { 377 $where = "WHERE $key = '$value'"; 378 } 379 } 380 if ($value == "") { return $where; } 381 if ($where) { 382 $where = $where . " AND"; 383 } else { 384 $where = "WHERE"; 385 } 386 387 if ($mode == 'string') { 388 // can we pass the '%' through the html? 389 $where = $where . " $key like '$value'"; 390 } 391 if ($mode == 'min') { 392 // can we pass the '%' through the html? 393 $where = $where . " $key >= '$value'"; 394 } 395 if ($mode == 'max') { 396 // can we pass the '%' through the html? 397 $where = $where . " $key <= '$value'"; 398 } 399 380 400 return $where; 381 401 } … … 394 414 } 395 415 396 function button_restrict ($key, $line) { 416 // if we have a restriction for a string-valued field, supply it to outgoing links 417 function button_restrict_string ($key, $line) { 397 418 $htmlkey = preg_replace ('|\.|', '_', $key); 398 419 if ($_SERVER[REQUEST_METHOD] == 'GET') { … … 411 432 } 412 433 434 // for numerical fields, test for both 'min' and 'max' values 435 function button_restrict_min ($key, $line) { 436 $htmlkey = preg_replace ('|\.|', '_', $key); 437 $htmlkey = $htmlkey . '_min'; 438 if ($_SERVER[REQUEST_METHOD] == 'GET') { 439 $value = $_GET[$htmlkey]; 440 } else { 441 $value = $_POST[$htmlkey]; 442 } 443 if ($value != "") { 444 if ($line) { 445 $line = $line . "&$htmlkey=$value"; 446 } else { 447 $line = "$htmlkey=$value"; 448 } 449 } 450 return $line; 451 } 452 453 // for numerical fields, test for both 'min' and 'max' values 454 function button_restrict_max ($key, $line) { 455 $htmlkey = preg_replace ('|\.|', '_', $key); 456 $htmlkey = $htmlkey . '_max'; 457 if ($_SERVER[REQUEST_METHOD] == 'GET') { 458 $value = $_GET[$htmlkey]; 459 } else { 460 $value = $_POST[$htmlkey]; 461 } 462 if ($value != "") { 463 if ($line) { 464 $line = $line . "&$htmlkey=$value"; 465 } else { 466 $line = "$htmlkey=$value"; 467 } 468 } 469 return $line; 470 } 471 413 472 function write_table_header ($class, $name, $value, $buttonLink, $ID, $file) { 414 473 … … 420 479 } 421 480 422 function write_query_row ($key, $width) { 481 // there are two query rows: for strings, only the first is set; for numbers, the first = min, the second = max 482 // mode == string, min, max 483 function write_query_row ($key, $width, $mode) { 423 484 $htmlkey = preg_replace ('|\.|', '_', $key); 485 if ($mode == 'min') { 486 $htmlkey = $htmlkey . "_min"; 487 } 488 if ($mode == 'max') { 489 $htmlkey = $htmlkey . "_max"; 490 } 424 491 if ($_SERVER[REQUEST_METHOD] == 'GET') { 425 492 $value = $_GET[$htmlkey]; … … 427 494 $value = $_POST[$htmlkey]; 428 495 } 496 // XXX need to modify $key (should it be htmlkey here?) 429 497 if ($value != "") { 430 echo "<td class=\"list\"> <input type=\"text\" name=\"$ key\" size=\"$width\" value=\"$value\"> </td>\n";431 } else { 432 echo "<td class=\"list\"> <input type=\"text\" name=\"$ key\" size=\"$width\"> </td>\n";498 echo "<td class=\"list\"> <input type=\"text\" name=\"$htmlkey\" size=\"$width\" value=\"$value\"> </td>\n"; 499 } else { 500 echo "<td class=\"list\"> <input type=\"text\" name=\"$htmlkey\" size=\"$width\"> </td>\n"; 433 501 } 434 502 } -
trunk/ippMonitor/scripts/generate
r15969 r18143 267 267 $value = $field[$i]; 268 268 if ($value eq "*") { next; } 269 print FILE "\$WHERE = check_restrict ('$value', \$WHERE);\n"; 269 if ($format[$i] eq "%s") { 270 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string');\n"; 271 } else { 272 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min');\n"; 273 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max');\n"; 274 } 270 275 } 271 276 print FILE "\$WHERE = check_ordering (\$WHERE);\n"; … … 278 283 $value = $field[$i]; 279 284 if ($value eq "*") { next; } 280 print FILE "\$buttonLink = button_restrict ('$value', \$buttonLink);\n"; 281 } 285 if ($format[$i] eq "%s") { 286 print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n"; 287 } else { 288 print FILE "\$buttonLink = button_restrict_min ('$value', \$buttonLink);\n"; 289 print FILE "\$buttonLink = button_restrict_max ('$value', \$buttonLink);\n"; 290 } 291 } 292 } 293 294 # there are two query rows: the first is populated for both strings 295 # and numbers, the second only for numbers 296 sub write_table_query { 297 my ($i); 298 299 print FILE "echo \"<tr>\\n\";\n"; 300 for ($i = 0; $i < @field; $i++) { 301 if ($show[$i] eq "none") { next; } 302 if ($field[$i] eq "*") { 303 # * fields create an empty cell 304 print FILE "echo \"<td> </td>\\n\";\n"; 305 } else { 306 if ($format[$i] eq "%s") { 307 print FILE "write_query_row ('$field[$i]', $width[$i], 'string');\n"; 308 } else { 309 print FILE "write_query_row ('$field[$i]', $width[$i], 'min');\n"; 310 } 311 } 312 } 313 print FILE "echo \"</tr> <tr>\\n\";\n"; 314 for ($i = 0; $i < @field; $i++) { 315 if ($show[$i] eq "none") { next; } 316 if (($field[$i] eq "*") || ($format[$i] eq "%s")) { 317 # * fields create an empty cell 318 print FILE "echo \"<td class=\\\"list\\\"> </td>\\n\";\n"; 319 } else { 320 print FILE "write_query_row ('$field[$i]', $width[$i], 'max');\n"; 321 } 322 } 323 print FILE "echo \"</tr>\\n\";\n"; 282 324 } 283 325 … … 342 384 } 343 385 344 sub write_table_query {345 my ($i);346 for ($i = 0; $i < @field; $i++) {347 if ($show[$i] eq "none") { next; }348 if ($field[$i] eq "*") {349 # * fields create an empty cell350 print FILE "echo \"<td> </td>\\n\";\n";351 } else {352 print FILE "write_query_row ('$field[$i]', $width[$i]);\n";353 }354 }355 }356 357 386 sub define_fields_string { 358 387 my (@array) = @_;
Note:
See TracChangeset
for help on using the changeset viewer.
