IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2012, 2:15:33 PM (14 years ago)
Author:
eugene
Message:

finish split out of dvodist and ippdata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120905/dvodist/www-util/ipp.php

    r34551 r34609  
    11<?php
    22
    3 global $realroot;
    4 $realroot = "/dvodist";
     3global $rootdir;
    54
    65function head ($title) {
     
    7776    }
    7877
    79     global $realroot;
     78    global $rootdir;
    8079
    8180    // hi-lite the current page (use select-style, not style)
    8281    $thisname = $_SERVER[SCRIPT_NAME];
    83     $page = $realroot . $base;
     82    $page = $rootdir . $base;
    8483    if ($page == $thisname) {
    8584      $style = trim($line[1]);
     
    121120
    122121function dirlist ($source) {
     122  if (!file_exists($source)) return;
     123
    123124  $file = fopen ($source, "r");
    124125  echo "<table class=\"dirlist\">\n";
     
    139140    // }
    140141
    141     if (count($line) != 4) continue;
    142 
    143     $name  = trim($line[0]);
    144     $type  = trim($line[1]);
    145     $style = trim($line[2]);
    146     $info  = trim($line[3]);
     142    if ((count($line) != 4) && (count($line) != 5)) continue;
     143
     144    // support both the old and new style tables:
     145    // old: name | type | style | info
     146    // new: name | link | type | style | info
     147
     148    if (count($line) == 4) {
     149      echo "count = 4<br>\n";
     150      $name  = trim($line[0]);
     151      $type  = trim($line[1]);
     152      $style = trim($line[2]);
     153      $info  = trim($line[3]);
     154      $link  = $name;
     155    }
     156    if (count($line) == 5) {
     157      echo "count = 5<br>\n";
     158      $name  = trim($line[0]);
     159      $link  = trim($line[1]);
     160      $type  = trim($line[2]);
     161      $style = trim($line[3]);
     162      $info  = trim($line[4]);
     163    }
    147164
    148165    switch ($type) {
     
    172189    if (ereg ('^[:blank:]*#', $line[0])) continue;
    173190    if (count($line) < 2) continue;
    174     if (count($line) != 4) continue;
    175 
    176     $name  = trim($line[0]);
    177     $type  = trim($line[1]);
    178     $style = trim($line[2]);
    179     $info  = trim($line[3]);
     191
     192    if ((count($line) != 4) && (count($line) != 5)) continue;
     193
     194    // support both the old and new style tables:
     195    // old: name | type | style | info
     196    // new: name | link | type | style | info
     197
     198    if (count($line) == 4) {
     199      $name  = trim($line[0]);
     200      $type  = trim($line[1]);
     201      $style = trim($line[2]);
     202      $info  = trim($line[3]);
     203      $link  = $name;
     204    }
     205    if (count($line) == 5) {
     206      $name  = trim($line[0]);
     207      $link  = trim($line[1]);
     208      $type  = trim($line[2]);
     209      $style = trim($line[3]);
     210      $info  = trim($line[4]);
     211    }
    180212
    181213    switch ($type) {
     
    195227
    196228function verbatim ($source) {
     229  if (!file_exists($source)) return;
     230
    197231  $file = fopen ($source, "r");
    198232
     
    218252// lines which start with @ are processed by 'dirlist', all others are processed by Markdown
    219253function do_markdown ($source) {
     254  if (!file_exists($source)) return;
     255
    220256  $file = fopen ($source, "r");
    221257
Note: See TracChangeset for help on using the changeset viewer.