IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 30, 2007, 6:13:58 PM (19 years ago)
Author:
eugene
Message:

various updates to the user interface: sorting, respect table selections, etc

File:
1 edited

Legend:

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

    r13264 r13566  
    11<?php
    22
    3 $dTABLE = 10;
     3$dTABLE = 80;
    44
    55function logintext () {
     
    282282}
    283283
     284function navigate_buttons ($rowStart, $rowLast, $dTABLE, $rowTotal, $buttonLink, $ID, $file) {
     285
     286  if ($rowStart > 0) {
     287    $value = 0;
     288    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     289    if ($buttonLink != "") {
     290      $link = $link . "&$buttonLink";
     291    }
     292    echo "<a width=10 class=\"button\" href=\"$link\">&#60&#60</a>\n";
     293  } else {
     294    echo "&#60&#60\n";
     295  }
     296  if ($rowStart >= $dTABLE) {
     297    $value = $rowStart - $dTABLE;
     298    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     299    if ($buttonLink != "") {
     300      $link = $link . "&$buttonLink";
     301    }
     302    echo "<a class=\"button\" href=\"$link\">&#60</a>\n";
     303  } else {
     304    echo "&#60\n";
     305  }
     306
     307  if ($rowLast < $rowTotal) {
     308    $value = $rowStart + $dTABLE;
     309    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     310    if ($buttonLink != "") {
     311      $link = $link . "&$buttonLink";
     312    }
     313    echo "<a class=\"button\" href=\"$link\">&#62</a>\n";
     314  } else {
     315    echo "&#62\n";
     316  }
     317
     318  if ($rowLast < $rowTotal) {
     319    $value = $rowTotal - $dTABLE;
     320    $link = "$file" . "?" . $ID['link'] . "&from=$value";
     321    if ($buttonLink != "") {
     322      $link = $link . "&$buttonLink";
     323    }
     324    echo "<a class=\"button\" href=\"$link\">&#62&#62</a>\n";
     325  } else {
     326    echo "&#62&#62\n";
     327  }
     328}
     329
    284330function check_restrict ($key, $where) {
    285331  $htmlkey = preg_replace ('|\.|', '_', $key);
    286332  if ($_SERVER[REQUEST_METHOD] == 'GET') {
    287333    $value = $_GET[$htmlkey];
    288     // echo "using GET: $value<br>\n";
    289334  } else {
    290335    $value = $_POST[$htmlkey];
    291     // echo "using POST: $value<br>\n";
    292   }
    293   // echo "value: $value<br>\n";
     336  }
    294337  if ($value != "") {
    295338    if ($where) {
    296339      $where = $where . " AND $key = '$value'";
    297       // echo "where 1: $where<br>\n";
    298340    } else {
    299       $where = "$key = '$value'";
    300       // echo "where 2: $where<br>\n";
     341      $where = "WHERE $key = '$value'";
    301342    }
    302343  }
    303344  return $where;
     345}
     346
     347function check_ordering ($where) {
     348
     349  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     350    $value = $_GET['sort'];
     351  } else {
     352    $value = $_POST['sort'];
     353  }
     354  if ($value != "") {
     355    $where = $where . " ORDER BY $value";
     356  }
     357  return $where;
     358}
     359
     360function button_restrict ($key, $line) {
     361  $htmlkey = preg_replace ('|\.|', '_', $key);
     362  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     363    $value = $_GET[$htmlkey];
     364  } else {
     365    $value = $_POST[$htmlkey];
     366  }
     367  if ($value != "") {
     368    if ($line) {
     369      $line = $line . "&$key=$value";
     370    } else {
     371      $line = "$key=$value";
     372    }
     373  }
     374  return $line;
     375}
     376
     377function write_table_header ($class, $name, $value, $buttonLink, $ID, $file) {
     378
     379  $link = "$file" . "?" . $ID['link'] . "&sort=$value";
     380  if ($buttonLink != "") {
     381    $link = $link . "&$buttonLink";
     382  }
     383  echo "<th class=\"$class\"><a href=\"$link\"> $name </a></th>\n";
    304384}
    305385
    306386function write_query_row ($key, $width) {
    307387  $htmlkey = preg_replace ('|\.|', '_', $key);
    308   $value = $_POST[$htmlkey];
    309   if (($_SERVER[REQUEST_METHOD] == 'POST') && $value) {
     388  if ($_SERVER[REQUEST_METHOD] == 'GET') {
     389    $value = $_GET[$htmlkey];
     390  } else {
     391    $value = $_POST[$htmlkey];
     392  }
     393  if ($value != "") {
    310394    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\" value=\"$value\"> </td>\n";
    311395  } else {
    312396    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\"> </td>\n";
     397  }
     398}
     399
     400function write_table_cell ($class, $link, $value) {
     401  $myValue = $value;
     402  if ($myValue == "") { $myValue = "&nbsp;"; }
     403
     404  if ($link) {
     405    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
     406  } else {
     407    echo "<td class=\"$class\"> $myValue </td>\n";
    313408  }
    314409}
Note: See TracChangeset for help on using the changeset viewer.