-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclientorig.php
More file actions
298 lines (249 loc) · 11.9 KB
/
clientorig.php
File metadata and controls
298 lines (249 loc) · 11.9 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
291
292
293
294
295
296
297
298
<?php
// Dashboard.html: This will be the page that displays all the projects available to the logged-in consultant.
session_start();
if (!isset($_SESSION['email'])) {
header("Location: login.php");
}
$isAdmin = $_SESSION['admin'];
require_once('API/utils/Model.php');
$conn = GetDatabaseConnection();
//display currStory and currProjId, passed from index.php
if (array_key_exists('story', $_GET)) {
$storyId = $_GET['story'];
$storyStmt = PrepareAndExecute($conn,
'SELECT androidId, title FROM Stories, Projects WHERE Projects.id = projectId AND Stories.id = ?',
array($storyId));
if (($row = $storyStmt->fetch(PDO::FETCH_ASSOC))) {
$projectId = $row['androidId'];
$templateTitle = $row['title'];
} else {
RespondWithError(404, 'Story Not Found');
}
} else {
RespondWithError(400, 'No Story Requested');
}
?>
<!doctype html>
<html lang = "en-US">
<head>
<meta charset="utf-8">
<meta https-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png">
<title>ROCC: Client</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat|Abel|Raleway|Roboto|Quicksand|Lora|PT+Serif|Sulphur+Point&display=swap" rel="stylesheet">
<script src="//cdn.quilljs.com/1.3.6/quill.js"></script>
<script src="//cdn.quilljs.com/1.3.6/quill.min.js"></script>
<!-- Theme included stylesheets -->
<link href="//cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<link href="//cdn.quilljs.com/1.3.6/quill.bubble.css" rel="stylesheet">
<!-- Core build with no theme, formatting, non-essential modules -->
<link href="//cdn.quilljs.com/1.3.6/quill.core.css" rel="stylesheet">
<link rel = "stylesheet" href = "css/client.css" type = "text/css"/>
<script>
<?php
$templateRoot = "Files/Templates/$templateTitle";
$storyRoot = "Files/Projects/$projectId/$storyId";
$files = scandir($templateRoot);
$slideFiles = [];
natsort($files);
$slideCount = 0;
//sort files in numeric order instead of alphabetical order
$image_extensions = [];
foreach ($files as $file) {
if (strpos(basename($file), ".jpg") || strpos(basename($file), ".png")) {
$slideFiles[$slideCount] = $file;
$filename = pathinfo($file);
array_push($image_extensions, $filename['extension']);
$slideCount++;
}
}
?>
// Capture vars from PHP
var image_extensions = <?=json_encode($image_extensions)?>;
var slideCount = <?=json_encode($slideCount)?>;
var storyId = <?=json_encode($storyId)?>;
var projectId = <?=json_encode($projectId)?>;
var templateRoot = <?=json_encode($templateRoot)?>;
var websocketPort = <?=json_encode($GLOBALS['websocketPort'])?>;
</script>
</head>
<body>
<div class="content-body">
<div class="header">
<a href="index.php">
<img id="logo" src="images/SP.png" width="60" height="60">
</a>
<!--Get current project number and story title-->
<div class="story-info">
<h1 id="storyTitle">Story Publisher Adv</h1>
</div>
<div class="header-menu">
<a id="admin-link" href="admin.php">Admin</a>
<a href="index.php">Dashboard</a>
<a href="logout.php">Logout</a>
</div>
</div>
<div class="grid-container">
<!--Thumbnail section on left-hand side-->
<div class="slides">
<!--Pull in all .jpg files for the thumbnails -->
<?php foreach ($slideFiles as $file):
//check if file is .JPG
$filename = pathinfo($file);
$name = $filename['filename'];
$numberOfSlide = $name;
$amountOfSlides = count($slideFiles) - 1; // Subtracted 1 to start counting from zero
//Searching for the song audio!!!
$songAudioFile = '/var/www/html/' . $storyRoot . '/' . $amountOfSlides . '.m4a';
if(file_exists($songAudioFile)){
//"Creating" the song slide!!!
if($name == $amountOfSlides){
?>
<script>let songSlideNumber = <?=$name?></script>
<?php
$name = 'Song';
$file = '../../../images/songBackGround.jpg';
}
}else{
?><script>let songSlideNumber = (-1)</script><?php
}
?>
<div class="tn_text" id="thumbnail_text_<?=$name?>">
<div id="tn_slide"><?=$name?></div>
<div id="msgImg<?=$name?>" style="display:none;">
<img src="images/msg.png" width="30px" height="30px">
</div>
<div id="checkImg<?=$name?>" style="display:none;">
<img src="images/cmark.png" width="20px" height="20px">
</div>
</div>
<div class="thumbnail" id="thumbnail <?=$name?>" onclick="changeSlide(parseInt(<?=$numberOfSlide?>), currentSlide)">
<img src="<?=$templateRoot?>/<?=$file?>">
</div>
<?php endforeach; ?>
</div>
<div class="audio">
<!--display current slide-->
<div class="left-audio">
<div id ="lf-t"> Current Slide </div>
<div class="currSlide">
<div style="width=10%">
<button id="prevSlide" onclick="changeSlide(currentSlide - 1, currentSlide)">
<img id ="p-bt" src="images/back.jpg">
</button>
</div>
<div class="currSlideInner" style="width=90%">
<div class="approvedTitle">
<p id="status"></p>
<p> approved status: </p>
<label class="switch">
<input id="approveSwitch"
onclick="approveSwitchChanged(currentSlide, this, event)"
type="checkbox">
<span class="slider round"></span>
</label>
</div>
<div class ="transcripts">
<!--These divs is filled by changeSlide() in client.JS-->
<div id="refText"></div>
<div id="mainText"></div>
</div>
<!--Get audio file and put it inthe player-->
<div class ="theAudioPlayer">
<audio controls id="audioPlayer">
<source id="mainAudio"
src="<?=$storyRoot?>/0.m4a"
type="audio/x-m4a"></source>
</audio>
</div>
</div>
<div style="width=10%">
<button id="fwdSlide" onclick="changeSlide(currentSlide + 1, currentSlide)">
<img id="f-bt" src="images/forward.jpg">
</button>
</div>
</div>
</div>
<div class ="right-audio">
<div id ="rt-t"> Current Slide Notes </div>
<div class ="written-notes">
<form>
<div id ="editor-container"></div>
</form>
</div>
</div>
</div>
<div class="messages">
<div id="m-t"> Messages </div>
<div id="messagesContainer">
</div>
<div class="msg">
<input class="msg-input"
id="sendMessageInput"
onkeypress="sendMessageInputKeyPress(event)"
type="text"
placeholder="Enter a message ...">
<button id="msg-send" onclick="sendMessage()" type="button" value="Send">
<img id ="send-img" src="images/send.png" width="25px" height="25px"></img>
</button>
</div>
</div>
<div class="lookup">
<div class ="w-story">
<div class ="w-trans">
<form id = "ws-form">
<div id ="editor-container2"></div>
</form>
</div>
<div class ="w-audio">
<audio controls id="wholeAudio">
<source id="wholeAudio"
src="<?=$storyRoot?>/wholeStory.m4a"
type="audio/x-m4a">
</audio>
<!-- Removing the save button becuase it is not necessary anymore:::
<button id="saveButton2" onclick="saveWholeNotes()"
type="button"
value="Save">Save Whole Story Notes</button>
-->
</div>
</div>
</div>
<div class ="bible">
<div class="tabHeader">
<button class="tablinks" onclick="openTab(event, 'bible-t')"> Bible Text Lookup </button>
<button class="tablinks" onclick="openTab(event, 'WordLinks')"> WordLinks </button>
</div>
<div id="bible-t" class="tabcontent"><p>Bible text lookup plugin here</p></div>
<div id="WordLinks" class="tabcontent"><p>WordLinks here eventually</p></div>
</div>
</div>
</div>
<script src="client.js"></script>
<script>
//check if admin
var isAdmin = "<?php echo $isAdmin ?>";
console.log(isAdmin);
if(!isAdmin){
var adminLink = document.getElementById("admin-link");
adminLink.style.display = "none";
}
</script>
</body>
</html>