IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2010, 2:59:09 PM (16 years ago)
Author:
Paul Price
Message:

Merging trunk in advance of reintegrating into trunk.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippMonitor/raw/ipp.php

    r28043 r28484  
    564564}
    565565
     566//
     567function 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//
     585function 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
    566602function write_header_cell ($class, $name) {
    567 
    568603  echo "<th class=\"$class\">$name</th>\n";
    569604}
     
    637672  if ($value != "") {
    638673    echo "value=\"$value\">";
    639   }
     674  } else {
     675    echo ">";
     676  }
    640677  echo "</td>\n";
     678}
     679
     680// checkbox
     681function 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
     699function 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";
    641715}
    642716
     
    778852// $myPage = $_SERVER[SCRIPT_NAME] . "?pass=$pass";
    779853
     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//
     860function 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
    780873?>
Note: See TracChangeset for help on using the changeset viewer.