/
annotate.php
executable file
·190 lines (174 loc) · 7.58 KB
/
annotate.php
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
<?php
include('classDefinition.php');
include('settings.php');
include('encode.php');
include('auxiliaryFunctions.php');
include('makeXML.php');
include('makeCSV.php');
include('makeIndex.php');
include('makeSection.php');
include('makeTEI.php');
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Visualisierung historischer Sammlungen</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="jsfunctions.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Visualisierung historischer Sammlungen</h1>
<h2>2. Aufnahme von Metadaten zur Sammlung</h2>
<?php
$test1 = 0;
if($_SESSION['upload'] == 1 and $_SESSION['store'] == 1) {
$test1 = 1;
}
$test2 = 0;
if(isset($_POST['metadataPosted'])) {
$test2 = 1;
}
if($test1 == 0) {
echo '<p>Bitte fangen Sie <a href="load.php">von vorne</a> an.</p>';
}
elseif($test1 == 1 and $test2 == 0) {
$suggestions = array('heading' => '', 'owner' => '', 'ownerGND' => '', 'year' => '', 'fileName' => '', 'title' => '', 'institution' => '', 'shelfmark' => '', 'base' => '', 'description' => '', 'geoBrowserStorageID' => '');
if($_SESSION['catalogueObject'] != NULL) {
$catalogue = unserialize($_SESSION['catalogueObject']);
foreach($catalogue as $key => $value) {
if(isset($suggestions[$key])) {
$suggestions[$key] = $value;
}
}
}
echo '
<form class="form-horizontal" action="annotate.php" method="post">';
echo '
<div class="form-group">
<label class="control-label col-sm-3" for="heading">Name der Sammlung</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="heading" maxlength="140" required placeholder="Beispiel: Bibliothek des Heinrich Bernhard Schrader von Schliestedt" value="'.$suggestions['heading'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="owner">Besitzende Person oder Institution</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="owner" maxlength="140" required placeholder="Beispiel: Schrader von Schliestedt, Heinrich Bernhard" value="'.$suggestions['owner'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="ownerGND">GND der Person oder Institution</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="ownerGND" maxlength="12" pattern="[0-9X-]{4,12}" placeholder="Beispiel: 117024988" value="'.$suggestions['ownerGND'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="year">Datum der Sammlung (Jahr)</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="year" pattern="[0-9]{4}" required placeholder="Erscheinungsjahr des Katalogs oder Stand der Sammlung" value="'.$suggestions['year'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="fileName">Dateiname</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="fileName" pattern="[A-Za-z0-9-_]{4,28}" required placeholder="Beispiel: schliestedt" value="'.$suggestions['fileName'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="title">Titel des Altkatalogs</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="title" maxlength="1000" placeholder="Beispiel: Apparatus librorum Henrici Bernhardi de Schliestedt" value="'.$suggestions['title'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="institution">Besitzende Institution</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="institution" maxlength="100" placeholder="Beispiel: HAB Wolfenbüttel" value="'.$suggestions['institution'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="shelfmark">Signatur</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="shelfmark" maxlength="40" placeholder="Beispiel: M: Bc 1982" value="'.$suggestions['shelfmark'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="base">Basis-URL für Links</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="base" type="url" maxlength="280" placeholder="Beispiel: http://diglib.hab.de/drucke/bc-1982/start.htm?image=" value="'.$suggestions['base'].'">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="description">Abstract</label>
<div class="col-sm-9">
<textarea class="form-control" rows="3" name="description" maxlength="1400" placeholder="Kurzer Einführungstext">'.$suggestions['description'].'</textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-default">Abschicken</button>
</div>
</div>
';
echo '
<input type="hidden" name="metadataPosted">
</form>';
}
elseif($test1 == 1 and $test2 == 1) {
if($_SESSION['catalogueObject'] != NULL) {
$catalogue = unserialize($_SESSION['catalogueObject']);
}
else {
$catalogue = new catalogue();
}
$catalogue->heading = $_POST['heading'];
$catalogue->owner = $_POST['owner'];
$catalogue->ownerGND = $_POST['ownerGND'];
$catalogue->year = $_POST['year'];
$catalogue->fileName = $_POST['fileName'];
$catalogue->title = $_POST['title'];
$catalogue->institution = $_POST['institution'];
$catalogue->shelfmark = $_POST['shelfmark'];
$catalogue->base = $_POST['base'];
$catalogue->description = $_POST['description'];
$_SESSION['annotation'] = 1;
$_SESSION['catalogueObject'] = serialize($catalogue);
$folderName = 'user/'.$catalogue->fileName;
$_SESSION['folderName'] = $folderName;
if(is_dir($folderName) == FALSE) {
mkdir($folderName, 0777);
}
else {
array_map('unlink', glob($folderName.'/*.html'));
}
if($_SESSION['copiedToFolder'] == 0) {
recurse_copy('assets', $folderName.'/assets');
copy ('upload/files/dataPHP-'.$_SESSION['fileNameInternal'], $folderName.'/dataPHP');
unlink('upload/files/dataPHP-'.$_SESSION['fileNameInternal']);
unlink('upload/files/'.$_SESSION['fileNameInternal'].'.'.$_SESSION['extension']);
$_SESSION['copiedToFolder'] = 1;
}
if(file_exists($folderName.'/dataPHP')) {
$_SESSION['folder'] = 1;
$dataString = file_get_contents($folderName.'/dataPHP');
$data = unserialize($dataString);
unset($dataString);
makeCSV($data, $folderName, $catalogue->fileName);
makeTEI($data, $folderName, $catalogue);
echo '<p>Die Metadaten wurden gespeichert.<br />';
echo 'Weiter zur <a href="geodata.php">Geodatenanreicherung</a>.</p>';
}
else {
echo '<p>Es ist ein Fehler aufgetreten. Bitte fangen Sie <a href="load.php">von vorne</a> an.</p>';
}
}
?>
</div>
</body>
</html>