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