1
|
<?php
|
2
|
require_once dirname(__FILE__)."/util.php";
|
3
|
|
4
|
$self_dir = ensure_suffix("/", dirname($_SERVER["SCRIPT_NAME"]));
|
5
|
|
6
|
# config
|
7
|
$alias = $_SERVER["HTTP_HOST"].$self_dir;
|
8
|
#$alias = "j.mp/vegpath#";
|
9
|
|
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
|
$h_level = 5;
|
21
|
# 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
|
$ns = strtolower($path->head);
|
25
|
|
26
|
function add_ns($name, $path_pat, $url_func)
|
27
|
{
|
28
|
global $alias, $h_level, $path, $ns;
|
29
|
if (is_string($url_func)) $url_func = by_prefix($url_func);
|
30
|
|
31
|
print("<h".$h_level.' id="'.$name.'">'.$alias.'<big><a href="http://'.$alias
|
32
|
.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
|
33
|
if ($ns === strtolower($name)) # found match, so redirect
|
34
|
{
|
35
|
header("Location: ".strip_url($url_func($path->tail)));
|
36
|
ob_end_flush();
|
37
|
exit;
|
38
|
}
|
39
|
}
|
40
|
|
41
|
function custom_separator($url, $sep, $main_url=null)
|
42
|
{
|
43
|
if (!isset($main_url)) $main_url = $url;
|
44
|
|
45
|
return function($path) use($url, $sep, $main_url)
|
46
|
{
|
47
|
if ($path === "") return $main_url;
|
48
|
$path = parse_dot_path($path);
|
49
|
return $url.join_non_empty($sep, array($path->head, $path->tail));
|
50
|
};
|
51
|
}
|
52
|
|
53
|
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
|
if ($path !== "") $url .= "?".$path;
|
64
|
return $url."#".$fragment;
|
65
|
};
|
66
|
}
|
67
|
|
68
|
function phpPgAdmin($url, $table=null)
|
69
|
{
|
70
|
return function($path) use($url, $table)
|
71
|
{
|
72
|
$path = join_non_empty(".", array($table, $path));
|
73
|
$path = parse_dot_path($path);
|
74
|
$subject = "schema";
|
75
|
if ($path->head !== "")
|
76
|
{
|
77
|
$url .= "&table=".$path->head;
|
78
|
if ($path->tail !== "")
|
79
|
{
|
80
|
$url .= "&column=".$path->tail;
|
81
|
$subject = "column";
|
82
|
}
|
83
|
else $subject = "table";
|
84
|
}
|
85
|
$url .= "&subject=".$subject;
|
86
|
return $url;
|
87
|
};
|
88
|
}
|
89
|
|
90
|
function phpMyAdmin($url, $table=null)
|
91
|
{
|
92
|
return function($path) use($url, $table)
|
93
|
{
|
94
|
$path = join_non_empty(".", array($table, $path));
|
95
|
$path = parse_dot_path($path);
|
96
|
$target = "db_structure";
|
97
|
if ($path->head !== "")
|
98
|
{
|
99
|
$url .= "&table=".$path->head;
|
100
|
if ($path->tail !== "") $url .= "&column=".$path->tail;
|
101
|
$target = "tbl_structure";
|
102
|
}
|
103
|
$url .= "&target=".$target.".php";
|
104
|
return $url;
|
105
|
};
|
106
|
}
|
107
|
|
108
|
ob_start(); // delay output in case there is a redirect
|
109
|
?>
|
110
|
<html>
|
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
|
<p></p>
|
123
|
<?php
|
124
|
# add and list URLs
|
125
|
|
126
|
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
|
127
|
$Redmine_svn = $Redmine."/repository/raw";
|
128
|
|
129
|
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
|
130
|
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
|
131
|
|
132
|
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
|
133
|
|
134
|
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
|
135
|
?>
|
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
|
{
|
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("VegBank", ".table.column", custom_separator("http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&entity=dba_tabledescription&where=where_tablename&wparam=",
|
163
|
"#", "http://vegbank.org/get/index/dba_tabledescription"));
|
164
|
add_ns("SALVIAS", ".table.column", by_prefix($SALVIAS."#Plot_", $SALVIAS));
|
165
|
{
|
166
|
print("<blockquote>\n"); $h_level++;
|
167
|
add_ns("SALVIAS-db", ".table.column", nimoy_db("salvias_plots"));
|
168
|
add_ns("SALVIAS-users", ".table.column", nimoy_db("salvias_users"));
|
169
|
print("</blockquote>\n"); $h_level--;
|
170
|
}
|
171
|
add_ns("BIEN2", "", $nimoy."?target=server_databases.php");
|
172
|
{
|
173
|
print("<blockquote>\n"); $h_level++;
|
174
|
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
|
print("</blockquote>\n"); $h_level--;
|
179
|
}
|
180
|
add_ns("VegBIEN", ".table.column", phpPgAdmin("http://vegbiendev.nceas.ucsb.edu/phppgadmin/redirect.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=public"));
|
181
|
print("</blockquote>\n");
|
182
|
}
|
183
|
print("<h3>Primary databases</h3>");
|
184
|
{
|
185
|
print("<blockquote>\n");
|
186
|
add_ns("TNRS", ".term", fragment_override("http://tnrs.iplantcollaborative.org/instructions.html", "download_results"));
|
187
|
add_ns("CTFS", "", $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-Boyle", "", $CTFS);
|
202
|
{
|
203
|
print("<blockquote>\n"); $h_level++;
|
204
|
$Brad_Boyle_VegCore = $Redmine_svn."/schemas/VegCore/Brad_Boyle";
|
205
|
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
|
print("</blockquote>\n"); $h_level--;
|
209
|
}
|
210
|
print("</blockquote>\n");
|
211
|
}
|
212
|
print("</blockquote>\n");
|
213
|
?>
|
214
|
</td>
|
215
|
<td nowrap="nowrap">
|
216
|
<?php
|
217
|
print("<blockquote>\n");
|
218
|
print("<h3>Institutions</h3>");
|
219
|
{
|
220
|
print("<blockquote>\n");
|
221
|
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
|
"http://sweetgum.nybg.org/ih/"));
|
223
|
print("</blockquote>\n");
|
224
|
}
|
225
|
print("</blockquote>\n");
|
226
|
?>
|
227
|
</td>
|
228
|
</tr>
|
229
|
</table>
|
230
|
<?php
|
231
|
if (ends_with($alias, '#')) # URL shortener requires fragment redirect
|
232
|
{
|
233
|
?>
|
234
|
<script type="text/javascript">
|
235
|
var loc = document.location
|
236
|
if (loc.hash) document.location = rm_prefix('#', loc.hash)
|
237
|
</script>
|
238
|
<?php
|
239
|
}
|
240
|
?>
|
241
|
</body>
|
242
|
</html>
|
243
|
<?php
|
244
|
ob_end_flush();
|
245
|
?>
|