Project

General

Profile

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 13714 aaronmk
function to_dir($path) { return dirname($path.'_'/*in case no filename*/); }
7
8 7904 aaronmk
$h_level = 5;
9 9601 aaronmk
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?";
10 7876 aaronmk
11 13780 aaronmk
function add_ns($name, $path_pat)
12 7876 aaronmk
{
13 13780 aaronmk
	global $root, $h_level, $path;
14 7876 aaronmk
15 7967 aaronmk
	print("<h".$h_level.' id="'.$name.'">'.$root.'<big><a href="http://'.$root
16 7938 aaronmk
		.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
17 7876 aaronmk
}
18
19 7937 aaronmk
function custom_separator($url, $sep, $main_url=null)
20 7910 aaronmk
{
21 7914 aaronmk
	if (!isset($main_url)) $main_url = $url;
22
23
	return function($path) use($url, $sep, $main_url)
24 7910 aaronmk
	{
25 7914 aaronmk
		if ($path === "") return $main_url;
26 7910 aaronmk
		$path = parse_dot_path($path);
27
		return $url.join_non_empty($sep, array($path->head, $path->tail));
28
	};
29
}
30
31 7876 aaronmk
function fragment_override($url, $fragment=null)
32
{
33
	return function($path) use($url, $fragment)
34
	{
35
		if (!isset($fragment))
36
		{
37
			$path = parse_dot_path($path);
38
			$fragment = $path->head;
39
			$path = $path->tail;
40
		}
41 7902 aaronmk
		if ($path !== "") $url .= "?".$path;
42 7876 aaronmk
		return $url."#".$fragment;
43
	};
44
}
45
46 7934 aaronmk
function phpPgAdmin($url, $table=null)
47 7876 aaronmk
{
48 7934 aaronmk
	return function($path) use($url, $table)
49 7876 aaronmk
	{
50 7934 aaronmk
		$path = join_non_empty(".", array($table, $path));
51 7876 aaronmk
		$path = parse_dot_path($path);
52 7886 aaronmk
		$subject = "schema";
53 7902 aaronmk
		if ($path->head !== "")
54 7876 aaronmk
		{
55
			$url .= "&table=".$path->head;
56 7902 aaronmk
			if ($path->tail !== "")
57 7886 aaronmk
			{
58
				$url .= "&column=".$path->tail;
59
				$subject = "column";
60
			}
61
			else $subject = "table";
62 7876 aaronmk
		}
63 7895 aaronmk
		$url .= "&subject=".$subject;
64
		return $url;
65 7876 aaronmk
	};
66
}
67
68 7934 aaronmk
function phpMyAdmin($url, $table=null)
69 7893 aaronmk
{
70 7934 aaronmk
	return function($path) use($url, $table)
71 7893 aaronmk
	{
72 7934 aaronmk
		$path = join_non_empty(".", array($table, $path));
73 7893 aaronmk
		$path = parse_dot_path($path);
74
		$target = "db_structure";
75 7902 aaronmk
		if ($path->head !== "")
76 7893 aaronmk
		{
77
			$url .= "&table=".$path->head;
78 7902 aaronmk
			if ($path->tail !== "") $url .= "&column=".$path->tail;
79 7899 aaronmk
			$target = "tbl_structure";
80 7893 aaronmk
		}
81 7896 aaronmk
		$url .= "&target=".$target.".php";
82 7895 aaronmk
		return $url;
83 7893 aaronmk
	};
84
}
85
86 7876 aaronmk
ob_start(); // delay output in case there is a redirect
87
?>
88 9613 aaronmk
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
89
<html xmlns="http://www.w3.org/1999/xhtml">
90 7876 aaronmk
	<head>
91 7881 aaronmk
		<title>VegPath</title>
92 8033 aaronmk
		<link rel="stylesheet" type="text/css" href="/main.css" />
93 7876 aaronmk
		<style type="text/css">
94
h1 {color: green;}
95
		</style>
96 8033 aaronmk
		<script type="text/javascript" src="/util.js"></script>
97 7876 aaronmk
	</head>
98
	<body>
99 7951 aaronmk
		<h1>VegPath&nbsp;&nbsp; <small><a href="http://en.wikipedia.org/wiki/PURL">persistent URLs</a> for vegetation resources</small></h1>
100 7923 aaronmk
		<div>Supported URL patterns:&nbsp;&nbsp; <small>(elements in <i>italics</i> are optional)</small></div>
101 7876 aaronmk
<?php
102
# add and list URLs
103 7920 aaronmk
104 7924 aaronmk
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
105 7928 aaronmk
$Redmine_svn = $Redmine."/repository/raw";
106 7924 aaronmk
107 7920 aaronmk
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
108 7921 aaronmk
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
109 7936 aaronmk
110
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
111 7944 aaronmk
112
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
113 7931 aaronmk
?>
114
		<table border="0" cellspacing="0" cellpadding="0">
115
			<tr valign="top">
116
				<td nowrap="nowrap"><h2>Terms</h2></td>
117 8044 aaronmk
				<td nowrap="nowrap"><h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h2></td>
118 7931 aaronmk
				<td nowrap="nowrap"><h2>Data</h2></td>
119
			</tr>
120
			<tr valign="top">
121
				<td nowrap="nowrap">
122
<?php
123
print("<blockquote>\n");
124
print("<h3>Exchange schemas</h3>");
125 7876 aaronmk
{
126
	print("<blockquote>\n");
127 13780 aaronmk
	add_ns("VegCore", ".term");
128
	add_ns("DwC", ".term");
129 7876 aaronmk
	{
130 7931 aaronmk
		print("<blockquote>\n"); $h_level++;
131 13780 aaronmk
		add_ns("DwC.history", ".term");
132 7931 aaronmk
		print("</blockquote>\n"); $h_level--;
133 7876 aaronmk
	}
134 13780 aaronmk
	add_ns("TCS", "#/XPath");
135
	add_ns("VegX", "#/XPath");
136 7931 aaronmk
	print("</blockquote>\n");
137
}
138
print("<h3>Aggregators</h3>");
139
{
140
	print("<blockquote>\n");
141 13780 aaronmk
	add_ns("TNRS", ".term");
142 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=",
143 7931 aaronmk
		"#", "http://vegbank.org/get/index/dba_tabledescription"));
144 13780 aaronmk
	add_ns("SALVIAS", ".table.column");
145 7876 aaronmk
	{
146 7931 aaronmk
		print("<blockquote>\n"); $h_level++;
147 13780 aaronmk
		add_ns("SALVIAS.db", ".table.column");
148
		add_ns("SALVIAS.users", ".table.column");
149 7931 aaronmk
		print("</blockquote>\n"); $h_level--;
150 7876 aaronmk
	}
151 13780 aaronmk
	add_ns("VegBIEN", ".table.column");
152
	add_ns("BIEN2", "");
153 7876 aaronmk
	{
154 7931 aaronmk
		print("<blockquote>\n"); $h_level++;
155 13780 aaronmk
		add_ns("BIEN2.web", ".table.column");
156
		add_ns("BIEN2.core", ".table.column");
157
		add_ns("BIEN2.geoscrub", ".table.column");
158
		add_ns("BIEN2.staging", ".table.column");
159 7931 aaronmk
		print("</blockquote>\n"); $h_level--;
160 7876 aaronmk
	}
161 7931 aaronmk
	print("</blockquote>\n");
162
}
163
print("<h3>Primary databases</h3>");
164
{
165
	print("<blockquote>\n");
166 13780 aaronmk
	add_ns("CTFS", "");
167 7929 aaronmk
	{
168 7931 aaronmk
		print("<blockquote>\n"); $h_level++;
169 13780 aaronmk
		add_ns("CTFS.schema", ".table.column");
170
		add_ns("CTFS.tables", ".table");
171
		add_ns("CTFS.terms", ".term");
172 7931 aaronmk
		print("</blockquote>\n"); $h_level--;
173 7929 aaronmk
	}
174 13780 aaronmk
	add_ns("IH.db", ".term");
175 7876 aaronmk
	print("</blockquote>\n");
176
}
177 7931 aaronmk
print("<h3>People</h3>");
178 7876 aaronmk
{
179
	print("<blockquote>\n");
180 13780 aaronmk
	add_ns("Brad", "");
181 7931 aaronmk
	{
182
		print("<blockquote>\n"); $h_level++;
183 13775 aaronmk
		$Brad_Boyle_VegCore = $Redmine_svn."/exchange_schemas/VegCore/Brad_Boyle";
184 13780 aaronmk
		add_ns("Brad.provenance", ".term");
185
		add_ns("Brad.identifiers", ".term");
186
		add_ns("Brad.identifier_examples", ".term");
187 7931 aaronmk
		print("</blockquote>\n"); $h_level--;
188
	}
189 7876 aaronmk
	print("</blockquote>\n");
190
}
191 7931 aaronmk
print("</blockquote>\n");
192
?>
193
				</td>
194 8044 aaronmk
				<td nowrap="nowrap"></td>
195 7931 aaronmk
				<td nowrap="nowrap">
196
<?php
197
print("<blockquote>\n");
198 7932 aaronmk
print("<h3>Institutions</h3>");
199
{
200
	print("<blockquote>\n");
201 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=",
202 7931 aaronmk
		"http://sweetgum.nybg.org/ih/"));
203 7932 aaronmk
	print("</blockquote>\n");
204
}
205 7931 aaronmk
print("</blockquote>\n");
206
?>
207
				</td>
208
			</tr>
209
		</table>
210
<?php
211 7967 aaronmk
if (ends_with($root, '#')) # URL shortener requires fragment redirect
212 7922 aaronmk
{
213 7876 aaronmk
?>
214 7931 aaronmk
		<script type="text/javascript">
215 7876 aaronmk
var loc = document.location
216 8365 aaronmk
if (loc.hash) document.location = '?'+rm_prefix('#', loc.hash)
217 7931 aaronmk
		</script>
218 7922 aaronmk
<?php
219
}
220 9607 aaronmk
?>
221
		<p>&nbsp;</p>
222
<?php
223 7876 aaronmk
ob_end_flush();
224 9605 aaronmk
225
# full directory index
226 13714 aaronmk
fpassthru(fopen(to_dir($_SERVER["SCRIPT_URI"])."/all", "r"));
227 9606 aaronmk
?>
228
	</body>
229
</html>