1 |
7876
|
aaronmk
|
<?php
|
2 |
|
|
require_once dirname(__FILE__)."/util.php";
|
3 |
|
|
|
4 |
7956
|
aaronmk
|
$self_dir = ensure_suffix("/", dirname($_SERVER["SCRIPT_NAME"]));
|
5 |
|
|
|
6 |
7876
|
aaronmk
|
function by_prefix($url, $main_url=null)
|
7 |
|
|
{
|
8 |
|
|
if (!isset($main_url)) $main_url = $url;
|
9 |
|
|
|
10 |
|
|
return function($path) use($url, $main_url)
|
11 |
|
|
{
|
12 |
|
|
return $path ? $url.$path : $main_url;
|
13 |
|
|
};
|
14 |
|
|
}
|
15 |
|
|
|
16 |
7904
|
aaronmk
|
$h_level = 5;
|
17 |
9601
|
aaronmk
|
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?";
|
18 |
7953
|
aaronmk
|
# instead of PATH_INFO, to support the Apache ErrorDocument directive
|
19 |
|
|
$rel_fs_path = rm_prefix($self_dir, $_SERVER["REQUEST_URI"]);
|
20 |
|
|
$path = parse_dot_path($rel_fs_path);
|
21 |
7939
|
aaronmk
|
$ns = strtolower($path->head);
|
22 |
7876
|
aaronmk
|
|
23 |
7939
|
aaronmk
|
function add_ns($name, $path_pat, $url_func)
|
24 |
7876
|
aaronmk
|
{
|
25 |
7967
|
aaronmk
|
global $root, $h_level, $path, $ns;
|
26 |
7876
|
aaronmk
|
if (is_string($url_func)) $url_func = by_prefix($url_func);
|
27 |
|
|
|
28 |
7967
|
aaronmk
|
print("<h".$h_level.' id="'.$name.'">'.$root.'<big><a href="http://'.$root
|
29 |
7938
|
aaronmk
|
.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
|
30 |
7939
|
aaronmk
|
if ($ns === strtolower($name)) # found match, so redirect
|
31 |
7876
|
aaronmk
|
{
|
32 |
|
|
header("Location: ".strip_url($url_func($path->tail)));
|
33 |
|
|
ob_end_flush();
|
34 |
|
|
exit;
|
35 |
|
|
}
|
36 |
|
|
}
|
37 |
|
|
|
38 |
7937
|
aaronmk
|
function custom_separator($url, $sep, $main_url=null)
|
39 |
7910
|
aaronmk
|
{
|
40 |
7914
|
aaronmk
|
if (!isset($main_url)) $main_url = $url;
|
41 |
|
|
|
42 |
|
|
return function($path) use($url, $sep, $main_url)
|
43 |
7910
|
aaronmk
|
{
|
44 |
7914
|
aaronmk
|
if ($path === "") return $main_url;
|
45 |
7910
|
aaronmk
|
$path = parse_dot_path($path);
|
46 |
|
|
return $url.join_non_empty($sep, array($path->head, $path->tail));
|
47 |
|
|
};
|
48 |
|
|
}
|
49 |
|
|
|
50 |
7876
|
aaronmk
|
function fragment_override($url, $fragment=null)
|
51 |
|
|
{
|
52 |
|
|
return function($path) use($url, $fragment)
|
53 |
|
|
{
|
54 |
|
|
if (!isset($fragment))
|
55 |
|
|
{
|
56 |
|
|
$path = parse_dot_path($path);
|
57 |
|
|
$fragment = $path->head;
|
58 |
|
|
$path = $path->tail;
|
59 |
|
|
}
|
60 |
7902
|
aaronmk
|
if ($path !== "") $url .= "?".$path;
|
61 |
7876
|
aaronmk
|
return $url."#".$fragment;
|
62 |
|
|
};
|
63 |
|
|
}
|
64 |
|
|
|
65 |
7934
|
aaronmk
|
function phpPgAdmin($url, $table=null)
|
66 |
7876
|
aaronmk
|
{
|
67 |
7934
|
aaronmk
|
return function($path) use($url, $table)
|
68 |
7876
|
aaronmk
|
{
|
69 |
7934
|
aaronmk
|
$path = join_non_empty(".", array($table, $path));
|
70 |
7876
|
aaronmk
|
$path = parse_dot_path($path);
|
71 |
7886
|
aaronmk
|
$subject = "schema";
|
72 |
7902
|
aaronmk
|
if ($path->head !== "")
|
73 |
7876
|
aaronmk
|
{
|
74 |
|
|
$url .= "&table=".$path->head;
|
75 |
7902
|
aaronmk
|
if ($path->tail !== "")
|
76 |
7886
|
aaronmk
|
{
|
77 |
|
|
$url .= "&column=".$path->tail;
|
78 |
|
|
$subject = "column";
|
79 |
|
|
}
|
80 |
|
|
else $subject = "table";
|
81 |
7876
|
aaronmk
|
}
|
82 |
7895
|
aaronmk
|
$url .= "&subject=".$subject;
|
83 |
|
|
return $url;
|
84 |
7876
|
aaronmk
|
};
|
85 |
|
|
}
|
86 |
|
|
|
87 |
7934
|
aaronmk
|
function phpMyAdmin($url, $table=null)
|
88 |
7893
|
aaronmk
|
{
|
89 |
7934
|
aaronmk
|
return function($path) use($url, $table)
|
90 |
7893
|
aaronmk
|
{
|
91 |
7934
|
aaronmk
|
$path = join_non_empty(".", array($table, $path));
|
92 |
7893
|
aaronmk
|
$path = parse_dot_path($path);
|
93 |
|
|
$target = "db_structure";
|
94 |
7902
|
aaronmk
|
if ($path->head !== "")
|
95 |
7893
|
aaronmk
|
{
|
96 |
|
|
$url .= "&table=".$path->head;
|
97 |
7902
|
aaronmk
|
if ($path->tail !== "") $url .= "&column=".$path->tail;
|
98 |
7899
|
aaronmk
|
$target = "tbl_structure";
|
99 |
7893
|
aaronmk
|
}
|
100 |
7896
|
aaronmk
|
$url .= "&target=".$target.".php";
|
101 |
7895
|
aaronmk
|
return $url;
|
102 |
7893
|
aaronmk
|
};
|
103 |
|
|
}
|
104 |
|
|
|
105 |
7876
|
aaronmk
|
ob_start(); // delay output in case there is a redirect
|
106 |
|
|
?>
|
107 |
9613
|
aaronmk
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
108 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
109 |
7876
|
aaronmk
|
<head>
|
110 |
7881
|
aaronmk
|
<title>VegPath</title>
|
111 |
8033
|
aaronmk
|
<link rel="stylesheet" type="text/css" href="/main.css" />
|
112 |
7876
|
aaronmk
|
<style type="text/css">
|
113 |
|
|
h1 {color: green;}
|
114 |
|
|
</style>
|
115 |
8033
|
aaronmk
|
<script type="text/javascript" src="/util.js"></script>
|
116 |
7876
|
aaronmk
|
</head>
|
117 |
|
|
<body>
|
118 |
7951
|
aaronmk
|
<h1>VegPath <small><a href="http://en.wikipedia.org/wiki/PURL">persistent URLs</a> for vegetation resources</small></h1>
|
119 |
7923
|
aaronmk
|
<div>Supported URL patterns: <small>(elements in <i>italics</i> are optional)</small></div>
|
120 |
7876
|
aaronmk
|
<?php
|
121 |
|
|
# add and list URLs
|
122 |
7920
|
aaronmk
|
|
123 |
7924
|
aaronmk
|
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
|
124 |
7928
|
aaronmk
|
$Redmine_svn = $Redmine."/repository/raw";
|
125 |
7924
|
aaronmk
|
|
126 |
7920
|
aaronmk
|
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
|
127 |
7921
|
aaronmk
|
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
|
128 |
7936
|
aaronmk
|
|
129 |
|
|
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
|
130 |
7944
|
aaronmk
|
|
131 |
|
|
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
|
132 |
7931
|
aaronmk
|
?>
|
133 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
134 |
|
|
<tr valign="top">
|
135 |
|
|
<td nowrap="nowrap"><h2>Terms</h2></td>
|
136 |
8044
|
aaronmk
|
<td nowrap="nowrap"><h2> </h2></td>
|
137 |
7931
|
aaronmk
|
<td nowrap="nowrap"><h2>Data</h2></td>
|
138 |
|
|
</tr>
|
139 |
|
|
<tr valign="top">
|
140 |
|
|
<td nowrap="nowrap">
|
141 |
|
|
<?php
|
142 |
|
|
print("<blockquote>\n");
|
143 |
|
|
print("<h3>Exchange schemas</h3>");
|
144 |
7876
|
aaronmk
|
{
|
145 |
|
|
print("<blockquote>\n");
|
146 |
7939
|
aaronmk
|
add_ns("VegCore", ".term", "https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore#");
|
147 |
|
|
add_ns("DwC", ".term", "http://rs.tdwg.org/dwc/terms/#");
|
148 |
7876
|
aaronmk
|
{
|
149 |
7931
|
aaronmk
|
print("<blockquote>\n"); $h_level++;
|
150 |
8050
|
aaronmk
|
add_ns("DwC.history", ".term", "http://rs.tdwg.org/dwc/terms/history/#");
|
151 |
7931
|
aaronmk
|
print("</blockquote>\n"); $h_level--;
|
152 |
7876
|
aaronmk
|
}
|
153 |
7942
|
aaronmk
|
add_ns("TCS", "#/XPath", "http://www.tdwg.org/standards/117/download/#/v101.xsd");
|
154 |
|
|
add_ns("VegX", "#/XPath", "http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd");
|
155 |
7931
|
aaronmk
|
print("</blockquote>\n");
|
156 |
|
|
}
|
157 |
|
|
print("<h3>Aggregators</h3>");
|
158 |
|
|
{
|
159 |
|
|
print("<blockquote>\n");
|
160 |
7939
|
aaronmk
|
add_ns("VegBank", ".table.column", custom_separator("http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&entity=dba_tabledescription&where=where_tablename&wparam=",
|
161 |
7931
|
aaronmk
|
"#", "http://vegbank.org/get/index/dba_tabledescription"));
|
162 |
7945
|
aaronmk
|
add_ns("SALVIAS", ".table.column", by_prefix($SALVIAS."#Plot_", $SALVIAS));
|
163 |
7876
|
aaronmk
|
{
|
164 |
7931
|
aaronmk
|
print("<blockquote>\n"); $h_level++;
|
165 |
8050
|
aaronmk
|
add_ns("SALVIAS.db", ".table.column", nimoy_db("salvias_plots"));
|
166 |
|
|
add_ns("SALVIAS.users", ".table.column", nimoy_db("salvias_users"));
|
167 |
7931
|
aaronmk
|
print("</blockquote>\n"); $h_level--;
|
168 |
7876
|
aaronmk
|
}
|
169 |
7939
|
aaronmk
|
add_ns("BIEN2", "", $nimoy."?target=server_databases.php");
|
170 |
7876
|
aaronmk
|
{
|
171 |
7931
|
aaronmk
|
print("<blockquote>\n"); $h_level++;
|
172 |
8050
|
aaronmk
|
add_ns("BIEN2.web", ".table.column", nimoy_db("bien_web"));
|
173 |
|
|
add_ns("BIEN2.core", ".table.column", nimoy_db("bien2"));
|
174 |
|
|
add_ns("BIEN2.geoscrub", ".table.column", nimoy_db("geoscrub"));
|
175 |
|
|
add_ns("BIEN2.staging", ".table.column", nimoy_db("bien2_staging"));
|
176 |
7931
|
aaronmk
|
print("</blockquote>\n"); $h_level--;
|
177 |
7876
|
aaronmk
|
}
|
178 |
7939
|
aaronmk
|
add_ns("VegBIEN", ".table.column", phpPgAdmin("http://vegbiendev.nceas.ucsb.edu/phppgadmin/redirect.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=public"));
|
179 |
7931
|
aaronmk
|
print("</blockquote>\n");
|
180 |
|
|
}
|
181 |
|
|
print("<h3>Primary databases</h3>");
|
182 |
|
|
{
|
183 |
|
|
print("<blockquote>\n");
|
184 |
7939
|
aaronmk
|
add_ns("TNRS", ".term", fragment_override("http://tnrs.iplantcollaborative.org/instructions.html", "download_results"));
|
185 |
7961
|
aaronmk
|
add_ns("CTFS", "", $Redmine."/wiki/CTFS");
|
186 |
7929
|
aaronmk
|
{
|
187 |
7931
|
aaronmk
|
print("<blockquote>\n"); $h_level++;
|
188 |
8050
|
aaronmk
|
add_ns("CTFS.schema", ".table.column", $Redmine_svn."/inputs/CTFS/_archive/DBv5.txt#");
|
189 |
|
|
add_ns("CTFS.tables", ".table", fragment_override($Redmine."/wiki/CTFS", "Tables"));
|
190 |
|
|
add_ns("CTFS.terms", ".term", $Redmine_svn."/inputs/CTFS/_src/ctfs-comments_worksheet.xls#");
|
191 |
7931
|
aaronmk
|
print("</blockquote>\n"); $h_level--;
|
192 |
7929
|
aaronmk
|
}
|
193 |
8050
|
aaronmk
|
add_ns("IH.db", ".term", $IH_db);
|
194 |
7876
|
aaronmk
|
print("</blockquote>\n");
|
195 |
|
|
}
|
196 |
7931
|
aaronmk
|
print("<h3>People</h3>");
|
197 |
7876
|
aaronmk
|
{
|
198 |
|
|
print("<blockquote>\n");
|
199 |
8042
|
aaronmk
|
add_ns("Brad", "", "mailto:bboyleATemail.arizona.edu");
|
200 |
7931
|
aaronmk
|
{
|
201 |
|
|
print("<blockquote>\n"); $h_level++;
|
202 |
|
|
$Brad_Boyle_VegCore = $Redmine_svn."/schemas/VegCore/Brad_Boyle";
|
203 |
8050
|
aaronmk
|
add_ns("Brad.data-provenance", ".term", $Brad_Boyle_VegCore."/BIEN%20database%20entities%20related%20to%20data%20provenance%20and%20ownership.docx#");
|
204 |
|
|
add_ns("Brad.DwC-IDs.2013-2-7", ".term", $Brad_Boyle_VegCore."/vegbien_identifiers.xlsx#");
|
205 |
|
|
add_ns("Brad.DwC-IDs.2013-1-31", ".term", $Brad_Boyle_VegCore."/vegbien_identifier_examples.xlsx#");
|
206 |
7931
|
aaronmk
|
print("</blockquote>\n"); $h_level--;
|
207 |
|
|
}
|
208 |
7876
|
aaronmk
|
print("</blockquote>\n");
|
209 |
|
|
}
|
210 |
7931
|
aaronmk
|
print("</blockquote>\n");
|
211 |
|
|
?>
|
212 |
|
|
</td>
|
213 |
8044
|
aaronmk
|
<td nowrap="nowrap"></td>
|
214 |
7931
|
aaronmk
|
<td nowrap="nowrap">
|
215 |
|
|
<?php
|
216 |
|
|
print("<blockquote>\n");
|
217 |
7932
|
aaronmk
|
print("<h3>Institutions</h3>");
|
218 |
|
|
{
|
219 |
|
|
print("<blockquote>\n");
|
220 |
7939
|
aaronmk
|
add_ns("IH", ".herbarium_code", by_prefix("http://sweetgum.nybg.org/ih/herbarium_list.php?QueryName=DetailedQuery&Restriction=NamPartyType+%3D+%27IH+Herbarium%27&col_NamOrganisationAcronym=",
|
221 |
7931
|
aaronmk
|
"http://sweetgum.nybg.org/ih/"));
|
222 |
7932
|
aaronmk
|
print("</blockquote>\n");
|
223 |
|
|
}
|
224 |
7931
|
aaronmk
|
print("</blockquote>\n");
|
225 |
|
|
?>
|
226 |
|
|
</td>
|
227 |
|
|
</tr>
|
228 |
|
|
</table>
|
229 |
|
|
<?php
|
230 |
7967
|
aaronmk
|
if (ends_with($root, '#')) # URL shortener requires fragment redirect
|
231 |
7922
|
aaronmk
|
{
|
232 |
7876
|
aaronmk
|
?>
|
233 |
7931
|
aaronmk
|
<script type="text/javascript">
|
234 |
7876
|
aaronmk
|
var loc = document.location
|
235 |
8365
|
aaronmk
|
if (loc.hash) document.location = '?'+rm_prefix('#', loc.hash)
|
236 |
7931
|
aaronmk
|
</script>
|
237 |
7922
|
aaronmk
|
<?php
|
238 |
|
|
}
|
239 |
9607
|
aaronmk
|
?>
|
240 |
|
|
<p> </p>
|
241 |
|
|
<?php
|
242 |
7876
|
aaronmk
|
ob_end_flush();
|
243 |
9605
|
aaronmk
|
|
244 |
|
|
# full directory index
|
245 |
|
|
fpassthru(fopen($_SERVER["SCRIPT_URI"]."all?".$_SERVER["QUERY_STRING"], "r"));
|
246 |
9606
|
aaronmk
|
?>
|
247 |
|
|
</body>
|
248 |
|
|
</html>
|