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