1
|
<?php
|
2
|
require_once dirname(__FILE__)."/util.php";
|
3
|
|
4
|
$self_dir = ensure_suffix("/", dirname($_SERVER["SCRIPT_NAME"]));
|
5
|
|
6
|
function to_dir($path) { return dirname($path.'_'/*in case no filename*/); }
|
7
|
|
8
|
function by_prefix($url, $main_url=null)
|
9
|
{
|
10
|
if (!isset($main_url)) $main_url = $url;
|
11
|
|
12
|
return function($path) use($url, $main_url)
|
13
|
{
|
14
|
return $path ? $url.$path : $main_url;
|
15
|
};
|
16
|
}
|
17
|
|
18
|
$h_level = 5;
|
19
|
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?";
|
20
|
# instead of PATH_INFO, to support the Apache ErrorDocument directive
|
21
|
$rel_fs_path = rm_prefix($self_dir, $_SERVER["REQUEST_URI"]);
|
22
|
$path = parse_dot_path($rel_fs_path);
|
23
|
$ns = strtolower($path->head);
|
24
|
|
25
|
function add_ns($name, $path_pat, $url_func)
|
26
|
{
|
27
|
global $root, $h_level, $path, $ns;
|
28
|
if (is_string($url_func)) $url_func = by_prefix($url_func);
|
29
|
|
30
|
print("<h".$h_level.' id="'.$name.'">'.$root.'<big><a href="http://'.$root
|
31
|
.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
|
32
|
if ($ns === strtolower($name)) # found match, so redirect
|
33
|
{
|
34
|
header("Location: ".strip_url($url_func($path->tail)));
|
35
|
ob_end_flush();
|
36
|
exit;
|
37
|
}
|
38
|
}
|
39
|
|
40
|
function custom_separator($url, $sep, $main_url=null)
|
41
|
{
|
42
|
if (!isset($main_url)) $main_url = $url;
|
43
|
|
44
|
return function($path) use($url, $sep, $main_url)
|
45
|
{
|
46
|
if ($path === "") return $main_url;
|
47
|
$path = parse_dot_path($path);
|
48
|
return $url.join_non_empty($sep, array($path->head, $path->tail));
|
49
|
};
|
50
|
}
|
51
|
|
52
|
function fragment_override($url, $fragment=null)
|
53
|
{
|
54
|
return function($path) use($url, $fragment)
|
55
|
{
|
56
|
if (!isset($fragment))
|
57
|
{
|
58
|
$path = parse_dot_path($path);
|
59
|
$fragment = $path->head;
|
60
|
$path = $path->tail;
|
61
|
}
|
62
|
if ($path !== "") $url .= "?".$path;
|
63
|
return $url."#".$fragment;
|
64
|
};
|
65
|
}
|
66
|
|
67
|
function phpPgAdmin($url, $table=null)
|
68
|
{
|
69
|
return function($path) use($url, $table)
|
70
|
{
|
71
|
$path = join_non_empty(".", array($table, $path));
|
72
|
$path = parse_dot_path($path);
|
73
|
$subject = "schema";
|
74
|
if ($path->head !== "")
|
75
|
{
|
76
|
$url .= "&table=".$path->head;
|
77
|
if ($path->tail !== "")
|
78
|
{
|
79
|
$url .= "&column=".$path->tail;
|
80
|
$subject = "column";
|
81
|
}
|
82
|
else $subject = "table";
|
83
|
}
|
84
|
$url .= "&subject=".$subject;
|
85
|
return $url;
|
86
|
};
|
87
|
}
|
88
|
|
89
|
function phpMyAdmin($url, $table=null)
|
90
|
{
|
91
|
return function($path) use($url, $table)
|
92
|
{
|
93
|
$path = join_non_empty(".", array($table, $path));
|
94
|
$path = parse_dot_path($path);
|
95
|
$target = "db_structure";
|
96
|
if ($path->head !== "")
|
97
|
{
|
98
|
$url .= "&table=".$path->head;
|
99
|
if ($path->tail !== "") $url .= "&column=".$path->tail;
|
100
|
$target = "tbl_structure";
|
101
|
}
|
102
|
$url .= "&target=".$target.".php";
|
103
|
return $url;
|
104
|
};
|
105
|
}
|
106
|
|
107
|
ob_start(); // delay output in case there is a redirect
|
108
|
?>
|
109
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
110
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
111
|
<head>
|
112
|
<title>VegPath</title>
|
113
|
<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
|
<h1>VegPath <small><a href="http://en.wikipedia.org/wiki/PURL">persistent URLs</a> for vegetation resources</small></h1>
|
121
|
<div>Supported URL patterns: <small>(elements in <i>italics</i> are optional)</small></div>
|
122
|
<?php
|
123
|
# add and list URLs
|
124
|
|
125
|
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
|
126
|
$Redmine_svn = $Redmine."/repository/raw";
|
127
|
|
128
|
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
|
129
|
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
|
130
|
|
131
|
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
|
132
|
|
133
|
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
|
134
|
?>
|
135
|
<table border="0" cellspacing="0" cellpadding="0">
|
136
|
<tr valign="top">
|
137
|
<td nowrap="nowrap"><h2>Terms</h2></td>
|
138
|
<td nowrap="nowrap"><h2> </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
|
{
|
147
|
print("<blockquote>\n");
|
148
|
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
|
{
|
151
|
print("<blockquote>\n"); $h_level++;
|
152
|
add_ns("DwC.history", ".term", "http://rs.tdwg.org/dwc/terms/history/#");
|
153
|
print("</blockquote>\n"); $h_level--;
|
154
|
}
|
155
|
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
|
print("</blockquote>\n");
|
158
|
}
|
159
|
print("<h3>Aggregators</h3>");
|
160
|
{
|
161
|
print("<blockquote>\n");
|
162
|
add_ns("TNRS", ".term", fragment_override("http://tnrs.iplantcollaborative.org/instructions.html", "download_results"));
|
163
|
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=",
|
164
|
"#", "http://vegbank.org/get/index/dba_tabledescription"));
|
165
|
add_ns("SALVIAS", ".table.column", by_prefix($SALVIAS."#Plot_", $SALVIAS));
|
166
|
{
|
167
|
print("<blockquote>\n"); $h_level++;
|
168
|
add_ns("SALVIAS.db", ".table.column", nimoy_db("salvias_plots"));
|
169
|
add_ns("SALVIAS.users", ".table.column", nimoy_db("salvias_users"));
|
170
|
print("</blockquote>\n"); $h_level--;
|
171
|
}
|
172
|
add_ns("VegBIEN", ".table.column", phpPgAdmin("http://vegbiendev.nceas.ucsb.edu/phppgadmin/redirect.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=public"));
|
173
|
add_ns("BIEN2", "", $nimoy."?target=server_databases.php");
|
174
|
{
|
175
|
print("<blockquote>\n"); $h_level++;
|
176
|
add_ns("BIEN2.web", ".table.column", nimoy_db("bien_web"));
|
177
|
add_ns("BIEN2.core", ".table.column", nimoy_db("bien2"));
|
178
|
add_ns("BIEN2.geoscrub", ".table.column", nimoy_db("geoscrub"));
|
179
|
add_ns("BIEN2.staging", ".table.column", nimoy_db("bien2_staging"));
|
180
|
print("</blockquote>\n"); $h_level--;
|
181
|
}
|
182
|
print("</blockquote>\n");
|
183
|
}
|
184
|
print("<h3>Primary databases</h3>");
|
185
|
{
|
186
|
print("<blockquote>\n");
|
187
|
add_ns("CTFS", "", $Redmine."/wiki/CTFS");
|
188
|
{
|
189
|
print("<blockquote>\n"); $h_level++;
|
190
|
add_ns("CTFS.schema", ".table.column", $Redmine_svn."/inputs/CTFS/_archive/DBv5.txt#");
|
191
|
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
|
print("</blockquote>\n"); $h_level--;
|
194
|
}
|
195
|
add_ns("IH.db", ".term", $IH_db);
|
196
|
print("</blockquote>\n");
|
197
|
}
|
198
|
print("<h3>People</h3>");
|
199
|
{
|
200
|
print("<blockquote>\n");
|
201
|
add_ns("Brad", "", "mailto:bboyleATemail.arizona.edu");
|
202
|
{
|
203
|
print("<blockquote>\n"); $h_level++;
|
204
|
$Brad_Boyle_VegCore = $Redmine_svn."/exchange_schemas/VegCore/Brad_Boyle";
|
205
|
add_ns("Brad.provenance", ".term", $Brad_Boyle_VegCore."/BIEN%20database%20entities%20related%20to%20data%20provenance%20and%20ownership.docx#");
|
206
|
add_ns("Brad.identifiers", ".term", $Brad_Boyle_VegCore."/vegbien_identifiers.xlsx#");
|
207
|
add_ns("Brad.identifier_examples", ".term", $Brad_Boyle_VegCore."/vegbien_identifier_examples.xlsx#");
|
208
|
print("</blockquote>\n"); $h_level--;
|
209
|
}
|
210
|
print("</blockquote>\n");
|
211
|
}
|
212
|
print("</blockquote>\n");
|
213
|
?>
|
214
|
</td>
|
215
|
<td nowrap="nowrap"></td>
|
216
|
<td nowrap="nowrap">
|
217
|
<?php
|
218
|
print("<blockquote>\n");
|
219
|
print("<h3>Institutions</h3>");
|
220
|
{
|
221
|
print("<blockquote>\n");
|
222
|
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=",
|
223
|
"http://sweetgum.nybg.org/ih/"));
|
224
|
print("</blockquote>\n");
|
225
|
}
|
226
|
print("</blockquote>\n");
|
227
|
?>
|
228
|
</td>
|
229
|
</tr>
|
230
|
</table>
|
231
|
<?php
|
232
|
if (ends_with($root, '#')) # URL shortener requires fragment redirect
|
233
|
{
|
234
|
?>
|
235
|
<script type="text/javascript">
|
236
|
var loc = document.location
|
237
|
if (loc.hash) document.location = '?'+rm_prefix('#', loc.hash)
|
238
|
</script>
|
239
|
<?php
|
240
|
}
|
241
|
?>
|
242
|
<p> </p>
|
243
|
<?php
|
244
|
ob_end_flush();
|
245
|
|
246
|
# full directory index
|
247
|
fpassthru(fopen(to_dir($_SERVER["SCRIPT_URI"])."/all", "r"));
|
248
|
?>
|
249
|
</body>
|
250
|
</html>
|