IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 19, 2008, 6:15:23 AM (18 years ago)
Author:
eugene
Message:

all sorts of updates to the format; up/down icons, etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/ipp.php

    r18143 r18193  
    315315    $sortKey = "&sort=" . $_POST['sort'];
    316316  }
     317  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     318    $sortKey = "&rsort=" . $_GET['rsort'];
     319  } else {
     320    $sortKey = "&rsort=" . $_POST['rsort'];
     321  }
    317322
    318323  if ($rowStart > 0) {
     
    410415  if ($value != "") {
    411416    $where = $where . " ORDER BY $value";
     417    return $where;
     418  }
     419  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     420    $value = $_GET['rsort'];
     421  } else {
     422    $value = $_POST['rsort'];
     423  }
     424  if ($value != "") {
     425    $where = $where . " ORDER BY $value DESC";
     426    return $where;
    412427  }
    413428  return $where;
     
    432447}
    433448
    434 // for numerical fields, test for both 'min' and 'max' values
     449// for numerical fields, test for both 'min' and plain values
    435450function button_restrict_min ($key, $line) {
    436451  $htmlkey = preg_replace ('|\.|', '_', $key);
     
    470485}
    471486
    472 function write_table_header ($class, $name, $value, $buttonLink, $ID, $file) {
    473 
    474   $link = "$file" . "?" . $ID['link'] . "&sort=$value";
     487function write_header_cell ($class, $name) {
     488
     489  echo "<th class=\"$class\">$name</th>\n";
     490}
     491
     492// write a table cell with the up and down sort arrows
     493function write_sort_cell ($class, $value, $buttonLink, $ID, $file) {
     494 
     495  echo "<td class=\"$class\">";
     496
     497  // base link
     498  $baselink = "$file" . "?" . $ID['link'];
     499  if ($buttonLink != "") {
     500    $baselink = $baselink . "&$buttonLink";
     501  }
     502
     503  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     504    $up   = $_GET['sort'];
     505    $down = $_GET['rsort'];
     506  } else {
     507    $up   = $_POST['sort'];
     508    $down = $_POST['rsort'];
     509  }
     510
     511  // up button link
     512  $link = "$baselink" . "&sort=$value";
     513  if ($up == $value) {
     514    echo "<a href=\"$link\"><img src=\"up.png\"></a>";
     515  } else {
     516    echo "<a href=\"$link\"><img src=\"left.png\"></a>";
     517  }
     518
     519  // down button link
     520  $link = "$baselink" . "&rsort=$value";
     521  if ($down == $value) {
     522    echo "<a href=\"$link\"><img src=\"down.png\"></a>";
     523  } else {
     524    echo "<a href=\"$link\"><img src=\"right.png\"></a>";
     525  }
     526
     527  echo "</td>\n";
     528}
     529
     530function write_write_sort_down ($class, $name, $value, $buttonLink, $ID, $file) {
     531
     532  $link = "$file" . "?" . $ID['link'] . "&rsort=$value";
    475533  if ($buttonLink != "") {
    476534    $link = $link . "&$buttonLink";
     
    483541function write_query_row ($key, $width, $mode) {
    484542  $htmlkey = preg_replace ('|\.|', '_', $key);
     543
     544  // optional bits by mode
    485545  if ($mode == 'min') {
    486546    $htmlkey = $htmlkey . "_min";
     
    494554    $value = $_POST[$htmlkey];
    495555  }
    496   // XXX need to modify $key (should it be htmlkey here?)
     556
     557  // full table element includes optionally the <= or >= words
     558  echo "<td class=\"list\"> <input type=\"text\" name=\"$htmlkey\" size=\"$width\"";
    497559  if ($value != "") {
    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";
    501   }
     560    echo "value=\"$value\">";
     561  }
     562  echo "</td>\n";
    502563}
    503564
    504565function write_table_cell ($class, $format, $link, $value) {
     566
     567  if ($format == '%T') {
     568    $format = '%s';
     569  }
     570  if ($format == '%t') {
     571    $format = '%s';
     572    if ($value == 0) {
     573      $value = 'N';
     574    } else {
     575      $value = 'Y';
     576    }
     577  }
     578
    505579  $myValue = sprintf ($format, $value);
    506580  if ($myValue == "") { $myValue = "&nbsp;"; }
Note: See TracChangeset for help on using the changeset viewer.