-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
290 lines (261 loc) · 8.66 KB
/
index.php
File metadata and controls
290 lines (261 loc) · 8.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="nl">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Geonovum specificaties</title>
<link rel='shortcut icon' type='image/x-icon' href='https://tools.geostandaarden.nl/respec/style/logos/Geonovum.ico' />
<!-- TODO: css to external doc and/or use geonovum css file -->
<style>
body {
line-height: 1.5;
font-family: "Open Sans", sans-serif;
color: #5e5e5e;
font-size: .875rem;
line-height: 1.5;
}
.page {
max-width: 88rem;
margin-left: auto;
margin-right: auto;
margin-top: 2rem;
}
h1, h2, h3, h4, h5, h6 {
font-family: Montserrat, "Open Sans", sans-serif;
}
h1 {
margin: 1em 0 2em;
font-size: 1.25rem;
line-height: 4em;
border-bottom: 1px solid rgba(94,94,94,.2);
font-weight: 500;
}
h2 {
font-size: 1.8rem;
font-weight: 500;
/*background-color: #f7f7f7;*/
padding-left: 0.5em;
border-bottom: 4px solid rgb(141, 182, 63);
line-height: 4rem;
width: 34rem;
}
h3 {
margin-left: 1.8em;
font-weight: 500;
}
a {
color: #005a9c;
}
h2 > a {
text-decoration: none;
color: rgb(94,94,94);
}
span.final, span.final a {
font-weight: normal;
color: #005a9c;
}
span.def, span.def a {
color: #005a9c;
/*font-size: 0.85em;*/
}
span.cv, span.cv a {
color: orange;
/*font-size: 0.85em;*/
}
span.vv, span.vv a {
color: green;
/*font-size: 0.85em;*/
}
.warning {
background-color: #ffbb66;
border: 1px solid black;
padding: 1em;
margin: 1em;
}
div.pubDomain {
width: 44rem;
display: inline-grid;
}
span.pubDomainAbbr{
font-size: 0.8rem;
margin-right: 0.5rem;
}
ul.docs {
border-bottom: 1px solid rgba(94, 94, 94, 0.2);
width: 36rem;
padding-bottom: 2rem;
}
</style>
</head>
<body>
<div class="page">
<img class="block-sitebranding__logo" src="https://www.geonovum.nl/logo.svg" alt="Home">
<h1>Standaarden en technische documenten</h1>
<p>Op <a href="https://docs.geostandaarden.nl/">https://docs.geostandaarden.nl/</a> publiceert Geonovum standaarden en technische documenten.</p>
<p class="warning">Deze pagina is slechts een inhoudsopgave van documentatie die wij beheren. Ga naar de <a href="https://www.geonovum.nl">website van Geonovum</a> voor toelichting op de documentatie.</p>
<p>Onderstaande documenten zijn op dit moment beschikbaar:</p>
<?php
$pubDomainListURL = 'pubDomainList.json';
// directories to be ignored. Uppercase
$ignoreList = ['NWBBGT', '.GIT', 'BRTNEXT', 'SFR', 'MEDIA','.WELL-KNOWN','.GITHUB'];
// directories for which all files should be shown (containing PDFs instead of ReSpec docs)
$publishAllList = ['G4W', 'KL', 'MIM', 'OOV','RO','SERV'];
// -------------------------------
// get the list of pubDomains:
$pubDomainsJson = file_get_contents($pubDomainListURL);
$pubDomainsArr = json_decode($pubDomainsJson, true);
$allPubDomains = $pubDomainsArr['Geonovum'];
// -------------------------------
function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
function getPubDomainTitle($pubDomain, $allPubDomains)
{
// default to pubdomain
$title = strtoupper($pubDomain);
foreach ($allPubDomains as $pd) {
if ($pd['pubDomain'] == $pubDomain) {
if (strlen($pd['pubDomainTitle']) > 0) {
$title = $pd['pubDomainTitle'];
}
}
}
$titleFull = "<span class='pubDomainAbbr'>(".strtolower($pubDomain).")</span>".$title;
return $titleFull;
}
function subDirsAsList($subdirs, $pubDomain, $lookintodir, $publishAllList)
{
$ul = False;
$htmlList = "";
// $publishAllList = ['G4W', 'KL', 'MIM', 'OOV','RO','SERV'];
foreach ($subdirs as $subdir) {
$docType="Laatste versie";
$cls="final";
if (startsWith($subdir, "def-")) {
$docType="Definitieve versie";
$cls="def";
} elseif (startsWith($subdir, "cv-")) {
$docType="Consultatie versie";
$cls="cv";
} elseif (startsWith($subdir, "vv-")) {
$docType="Vastgestelde versie";
$cls="vv";
}
// TODO: why only definitieve versie?
// show cv versions too?
// if ($docType=="Laatste versie" or (in_array(strtoupper($pubDomain), $publishAllList) and $docType="Definitieve versie")) {
if ($docType=="Laatste versie" or (in_array(strtoupper($pubDomain), $publishAllList)) or $docType=="Definitieve versie") {
if ($ul == False) {
$htmlList .= "<ul class='docs'>";
$ul = True;
}
$htmlList .= "<li><span class='".$cls."'><a href='".$lookintodir . "/" . $subdir."'>".$docType.": ".$subdir."</a></span></li>";
}
}
if ($ul == True){
$htmlList .= "</ul>";
$ul == False;
}
return $htmlList;
}
$path = '.';
$pubDomains = scandir($path);
foreach ($pubDomains as $pubDomain) {
if ($pubDomain === '.' or $pubDomain === '..') continue;
// reset the arrays for types
$norm = [];
$toelichting = [];
$documentatie = [];
$unknown = [];
if (is_dir($path . '/' . $pubDomain) and !in_array(strtoupper($pubDomain), $ignoreList)) {
echo "<div class='pubDomain'><h2><a href='".$pubDomain."'>".getPubDomainTitle($pubDomain, $allPubDomains)."</a></h2>";
// loop over the folders again to find docs
$lookintodir = $path . "/" . $pubDomain;
$subdirs = scandir($lookintodir);
$lastVersion = [];
$ul = False;
foreach ($subdirs as $subdir) {
if ($subdir === '.' or $subdir === '..') continue;
if (is_dir($lookintodir . "/" . $subdir)) {
// find the specType https://github.com/Geonovum/respec/wiki/specType
// no, st, hr, im, pr, hr, wa
// split on -, get the second patt
// example: def-im-ro2012-20120418
$specType="";
// default: laatste versie?
$specGroup="laatste"; // norm, toelichting, documentatie, laatste
$dirParts = explode("-", $subdir);
if (count($dirParts) > 3) {
$specType=$dirParts[1];
switch ($specType) {
case 'no':
$norm[] = $subdir;
break;
case 'st':
$norm[] = $subdir;
break;
case 'im':
$norm[] = $subdir;
break;
case 'pr':
$toelichting[] = $subdir;
break;
case 'al':
$documentatie[] = $subdir;
break;
case 'bd':
$documentatie[] = $subdir;
break;
case 'hr':
$documentatie[] = $subdir;
break;
case 'wa':
$documentatie[] = $subdir;
break;
default:
$unknown[] = $subdir;
// reset spectype
$specType = "";
}
} else {
$unknown[] = $subdir;
}
}
}
// reorder the types:
// loop over all docs
// TODO: order on types. If no def-, ... ..., then it could be a basedir
// now loop over all arrays with $subdirs
if (count($unknown) > 0) {
echo "<h3>Laatste versies</h3>";
echo subDirsAsList($unknown, $pubDomain, $lookintodir, $publishAllList);
}
if (count($norm) > 0) {
// echo "<h3>Normen</h3>"; edit 20220317 AdB
echo "<h3>Standaarden</h3>";
echo subDirsAsList($norm, $pubDomain, $lookintodir, $publishAllList);
}
if (count($toelichting) > 0) {
echo "<h3>Toelichtingen</h3>";
echo subDirsAsList($toelichting, $pubDomain, $lookintodir, $publishAllList);
}
if (count($documentatie) > 0) {
echo "<h3>Documentatie</h3>";
echo subDirsAsList($documentatie, $pubDomain, $lookintodir, $publishAllList);
}
echo "</div>";
}
}
?>
</div>
</body>