Changeset 28432 for trunk/ippMonitor/raw/ipp.php
- Timestamp:
- Jun 23, 2010, 12:13:24 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/ipp.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/raw/ipp.php
r28043 r28432 564 564 } 565 565 566 // 567 function button_restrict_checkbox ($key, $line) { 568 $htmlkey = preg_replace ('|\.|', '_', $key); 569 if ($_SERVER[REQUEST_METHOD] == 'GET') { 570 $value = $_GET[$htmlkey]; 571 } else { 572 $value = $_POST[$htmlkey]; 573 } 574 if ($value != "") { 575 if ($line) { 576 $line = $line . "&$htmlkey=$value"; 577 } else { 578 $line = "$htmlkey=$value"; 579 } 580 } 581 return $line; 582 } 583 584 // 585 function button_restrict_radio ($key, $line) { 586 $htmlkey = preg_replace ('|\.|', '_', $key); 587 if ($_SERVER[REQUEST_METHOD] == 'GET') { 588 $value = $_GET[$htmlkey]; 589 } else { 590 $value = $_POST[$htmlkey]; 591 } 592 if ($value != "") { 593 if ($line) { 594 $line = $line . "&$htmlkey=$value"; 595 } else { 596 $line = "$htmlkey=$value"; 597 } 598 } 599 return $line; 600 } 601 566 602 function write_header_cell ($class, $name) { 567 568 603 echo "<th class=\"$class\">$name</th>\n"; 569 604 } … … 637 672 if ($value != "") { 638 673 echo "value=\"$value\">"; 639 } 674 } else { 675 echo ">"; 676 } 640 677 echo "</td>\n"; 678 } 679 680 // checkbox 681 function write_query_checkbox ($key, $comment) { 682 $htmlkey = preg_replace ('|\.|', '_', $key); 683 684 if ($_SERVER[REQUEST_METHOD] == 'GET') { 685 $value = $_GET[$htmlkey]; 686 } else { 687 $value = $_POST[$htmlkey]; 688 } 689 echo "<td> <input type=\"checkbox\" name=\"$htmlkey\""; 690 if ($value == "on") { 691 echo " checked>"; 692 } else { 693 echo ">"; 694 } 695 echo "$comment ($htmlkey/$value)</td>\n"; 696 } 697 698 // checkbox 699 function write_query_radio ($value, $key) { 700 $htmlkey = preg_replace ('| |', '_', $key); 701 $htmlvalue = preg_replace ('|\.|', '_', $value); 702 703 if ($_SERVER[REQUEST_METHOD] == 'GET') { 704 $value = $_GET[$htmlkey]; 705 } else { 706 $value = $_POST[$htmlkey]; 707 } 708 if ($htmlvalue == get_value_from_key($htmlkey, TRUE)) { 709 $checked = "checked"; 710 } else { 711 $checked = ""; 712 } 713 echo "<td> <input type=\"radio\" name=\"$htmlkey\" value=\"$htmlvalue\" $checked/>"; 714 echo "$key ($htmlkey/$htmlvalue)</td>\n"; 641 715 } 642 716 … … 778 852 // $myPage = $_SERVER[SCRIPT_NAME] . "?pass=$pass"; 779 853 854 ////////////////////////////////////////////////////////////////////////// 855 // Return the value associated to the key (GET or POST method) 856 // If convertKeyToHtmlkey is true, the key is converted to a 857 // so-called HTML, i.e. the key where '.' are replaced by '_' 858 // (e.g. the conversion of 'f.o.o.b_a_r' is 'f_o_o_b_a_r'. 859 // 860 function get_value_from_key ($key, $convertKeyToHtmlkey) { 861 if ($convertKeyToHtmlkey) { 862 $htmlkey = preg_replace ('|\.|', '_', $key); 863 } else { 864 $htmlkey = $key; 865 } 866 if ($_SERVER[REQUEST_METHOD] == 'GET') { 867 return $_GET[$htmlkey]; 868 } else { 869 return $_POST[$htmlkey]; 870 } 871 } 872 780 873 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
