1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- License: public domain.
Distribution: http://lcr.math.ist.utl.pt/texdoc-php/
Author: Joao P Matos jmatos@math.ist.utl.pt -->
<head>
<title>Items</title>
<?php
include("css.php");
?>
</head>
<body>
<?php
include("config.php");
### It seems natural to give higher precedence to files in the local tree
### but build lists starting with the distribution tree.
$texmftrees2 = array_reverse($texmftrees,TRUE);
### TODO!
### Changes should make possible to use an arbitrary set of texmf trees
### Detecting the absolute location of this script both
### in the file system and url space
$ourfs = dirname($_SERVER['SCRIPT_FILENAME']);
$oururl = dirname($_SERVER['PHP_SELF']);
### checklink checks all trees for the file in the given order
### returns $link (a relative URL to the document)
function checklink($relpath)
{
global $texmftrees2, $ourfs, $oururl, $class, $zextensions;
reset($texmftrees2['fs']);
$link = "";
while (list( $treekey, $treepath ) = each($texmftrees2['fs']))
{
foreach ($zextensions as $zext)
{
if ( $_GET[$treekey] <> "no" )
{
$docpath = $ourfs . "/" . $treepath . "doc/";
if ( file_exists($docpath . $relpath . $zext))
{
if ( $treekey == "local" )
{
$class = " class=\"local\" ";
}
$link = $texmftrees2['url'][$treekey] . "doc/" . $relpath . $zext ;
break;
}
$texpath = $ourfs . "/" . $treepath . "tex/";
if ( file_exists($texpath . $relpath . $zext))
{
if ( $treekey == "local" )
{
$class = " class=\"local\" ";
}
$link = $texmftrees2['url'][$treekey] . "tex/" . $relpath . $zext;
break;
}
}
}
}
return $link;
}
##### Parse the texdoc data files
$section=$_GET["section"];
$line=0;
while (list( $treekey, $treepath) = each($texmftrees['fs']))
{
if ($_GET[$treekey] <> "no")
{
$texdocdat=$treepath . "texdoctk/" . $texmftrees['datname'][$treekey] ;
if (file_exists($texdocdat))
{
$row = 0;
$handle = fopen ($texdocdat,"r");
while ($data[$row] = fgetcsv ($handle, 1000, ";"))
{
if ( strpos($data[$row][0],"#") === false )
{
if ( count($data[$row]) == 1 )
{
$section_name = str_replace("@", "", $data[$row][0]);
}
else
{
if ( $section_name==$section)
{
if ($treekey == "local")
{
$class = " class=\"local\" ";
}
else
{
$class = "";
}
$mydata[$data[$row][0]]["link"] = $data[$row][2];
$mydata[$data[$row][0]]["description"] = $data[$row][1];
$colorcode = "";
$link = checklink($mydata[$data[$row][0]]["link"]);
if ($link == "")
{
$colorcode = " style=\"color:red\" ";
$link = $treepath . $mydata[$data[$row][0]]["link"];
}
$linha[$line]= "<tr><td><a " . $class . " href=\"" . $link . "\" target=\"_blank\"" . $colorcode . ">" . $mydata[$data[$row][0]]["description"] . "</a></td></tr>\n";
$line++;
}
}
}
$row++;
}
fclose ($handle);
}
}
}
echo "<h3>" . $section . "</h3>";
?>
<table>
<?php
$numline= $line;
$line=0;
while ($line < $numline)
{
echo $linha[$line];
$line++;
}
?>
</table>
<?php
?>
</body>
</html>
|