Project

General

Profile

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
$h_level = 5;
9
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?";
10

    
11
function add_ns($name, $path_pat)
12
{
13
	global $root, $h_level, $path;
14
	
15
	print("<h".$h_level.' id="'.$name.'">'.$root.'<big><a href="http://'.$root
16
		.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
17
}
18

    
19
function custom_separator($url, $sep, $main_url=null)
20
{
21
	if (!isset($main_url)) $main_url = $url;
22
	
23
	return function($path) use($url, $sep, $main_url)
24
	{
25
		if ($path === "") return $main_url;
26
		$path = parse_dot_path($path);
27
		return $url.join_non_empty($sep, array($path->head, $path->tail));
28
	};
29
}
30

    
31
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
		if ($path !== "") $url .= "?".$path;
42
		return $url."#".$fragment;
43
	};
44
}
45

    
46
function phpPgAdmin($url, $table=null)
47
{
48
	return function($path) use($url, $table)
49
	{
50
		$path = join_non_empty(".", array($table, $path));
51
		$path = parse_dot_path($path);
52
		$subject = "schema";
53
		if ($path->head !== "")
54
		{
55
			$url .= "&table=".$path->head;
56
			if ($path->tail !== "")
57
			{
58
				$url .= "&column=".$path->tail;
59
				$subject = "column";
60
			}
61
			else $subject = "table";
62
		}
63
		$url .= "&subject=".$subject;
64
		return $url;
65
	};
66
}
67

    
68
function phpMyAdmin($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
		$target = "db_structure";
75
		if ($path->head !== "")
76
		{
77
			$url .= "&table=".$path->head;
78
			if ($path->tail !== "") $url .= "&column=".$path->tail;
79
			$target = "tbl_structure";
80
		}
81
		$url .= "&target=".$target.".php";
82
		return $url;
83
	};
84
}
85

    
86
ob_start(); // delay output in case there is a redirect
87
?>
88
<!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
	<head>
91
		<title>VegPath</title>
92
		<link rel="stylesheet" type="text/css" href="/main.css" />
93
		<style type="text/css">
94
h1 {color: green;}
95
		</style>
96
		<script type="text/javascript" src="/util.js"></script>
97
	</head>
98
	<body>
99
		<h1>VegPath&nbsp;&nbsp; <small><a href="http://en.wikipedia.org/wiki/PURL">persistent URLs</a> for vegetation resources</small></h1>
100
		<div>Supported URL patterns:&nbsp;&nbsp; <small>(elements in <i>italics</i> are optional)</small></div>
101
<?php
102
# add and list URLs
103

    
104
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
105
$Redmine_svn = $Redmine."/repository/raw";
106

    
107
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
108
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
109

    
110
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
111

    
112
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
113
?>
114
		<table border="0" cellspacing="0" cellpadding="0">
115
			<tr valign="top">
116
				<td nowrap="nowrap"><h2>Terms</h2></td>
117
				<td nowrap="nowrap"><h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h2></td>
118
				<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
{
126
	print("<blockquote>\n");
127
	add_ns("VegCore", ".term");
128
	add_ns("DwC", ".term");
129
	{
130
		print("<blockquote>\n"); $h_level++;
131
		add_ns("DwC.history", ".term");
132
		print("</blockquote>\n"); $h_level--;
133
	}
134
	add_ns("TCS", "#/XPath");
135
	add_ns("VegX", "#/XPath");
136
	print("</blockquote>\n");
137
}
138
print("<h3>Aggregators</h3>");
139
{
140
	print("<blockquote>\n");
141
	add_ns("TNRS", ".term");
142
	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
		"#", "http://vegbank.org/get/index/dba_tabledescription"));
144
	add_ns("SALVIAS", ".table.column");
145
	{
146
		print("<blockquote>\n"); $h_level++;
147
		add_ns("SALVIAS.db", ".table.column");
148
		add_ns("SALVIAS.users", ".table.column");
149
		print("</blockquote>\n"); $h_level--;
150
	}
151
	add_ns("VegBIEN", ".table.column");
152
	add_ns("BIEN2", "");
153
	{
154
		print("<blockquote>\n"); $h_level++;
155
		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
		print("</blockquote>\n"); $h_level--;
160
	}
161
	print("</blockquote>\n");
162
}
163
print("<h3>Primary databases</h3>");
164
{
165
	print("<blockquote>\n");
166
	add_ns("CTFS", "");
167
	{
168
		print("<blockquote>\n"); $h_level++;
169
		add_ns("CTFS.schema", ".table.column");
170
		add_ns("CTFS.tables", ".table");
171
		add_ns("CTFS.terms", ".term");
172
		print("</blockquote>\n"); $h_level--;
173
	}
174
	add_ns("IH.db", ".term");
175
	print("</blockquote>\n");
176
}
177
print("<h3>People</h3>");
178
{
179
	print("<blockquote>\n");
180
	add_ns("Brad", "");
181
	{
182
		print("<blockquote>\n"); $h_level++;
183
		$Brad_Boyle_VegCore = $Redmine_svn."/exchange_schemas/VegCore/Brad_Boyle";
184
		add_ns("Brad.provenance", ".term");
185
		add_ns("Brad.identifiers", ".term");
186
		add_ns("Brad.identifier_examples", ".term");
187
		print("</blockquote>\n"); $h_level--;
188
	}
189
	print("</blockquote>\n");
190
}
191
print("</blockquote>\n");
192
?>
193
				</td>
194
				<td nowrap="nowrap"></td>
195
				<td nowrap="nowrap">
196
<?php
197
print("<blockquote>\n");
198
print("<h3>Institutions</h3>");
199
{
200
	print("<blockquote>\n");
201
	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
		"http://sweetgum.nybg.org/ih/"));
203
	print("</blockquote>\n");
204
}
205
print("</blockquote>\n");
206
?>
207
				</td>
208
			</tr>
209
		</table>
210
<?php
211
if (ends_with($root, '#')) # URL shortener requires fragment redirect
212
{
213
?>
214
		<script type="text/javascript">
215
var loc = document.location
216
if (loc.hash) document.location = '?'+rm_prefix('#', loc.hash)
217
		</script>
218
<?php
219
}
220
?>
221
		<p>&nbsp;</p>
222
<?php
223
ob_end_flush();
224

    
225
# full directory index
226
fpassthru(fopen(to_dir($_SERVER["SCRIPT_URI"])."/all", "r"));
227
?>
228
	</body>
229
</html>
(27-27/34)