Changeset 18143 for trunk/ippMonitor/raw/ipp.php
- Timestamp:
- Jun 15, 2008, 1:56:02 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/ipp.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
