forked from elabftw/elabftw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
624 lines (576 loc) · 27.7 KB
/
admin.php
File metadata and controls
624 lines (576 loc) · 27.7 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<?php
/********************************************************************************
* *
* Copyright 2012 Nicolas CARPi (nicolas.carpi@gmail.com) *
* http://www.elabftw.net/ *
* *
********************************************************************************/
/********************************************************************************
* This file is part of eLabFTW. *
* *
* eLabFTW is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* eLabFTW is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
* PURPOSE. See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public *
* License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
/* admin.php - for administration of the elab */
require_once 'inc/common.php';
// only admin can use this
if ($_SESSION['is_admin'] != 1) {
die(_('This section is out of your reach.'));
}
$formKey = new \Elabftw\Elabftw\FormKey();
$crypto = new \Elabftw\Elabftw\Crypto();
$page_title = _('Admin panel');
$selected_menu = null;
require_once 'inc/head.php';
require_once 'inc/info_box.php';
?>
<script src="js/tinymce/tinymce.min.js"></script>
<script src="js/raphael/raphael-min.js"></script>
<script src="js/colorwheel/colorwheel.js"></script>
<?php
if (strlen(get_config('mail_from')) == 0) {
$message = sprintf(_('Please finalize install : %slink to documentation%s.'), "<a href='https://github.com/elabftw/elabftw/wiki/finalizing'>", "</a>");
display_message('error', $message);
}
// MAIN SQL FOR USERS
$sql = "SELECT * FROM users WHERE validated = :validated AND team = :team";
$user_req = $pdo->prepare($sql);
$user_req->bindValue(':validated', 0);
$user_req->bindValue(':team', $_SESSION['team_id']);
$user_req->execute();
$count = $user_req->rowCount();
// only show the frame if there is some users to validate and there is an email config
if ($count > 0 && strlen(get_config('mail_from')) > 0) {
$message = _('There are users waiting for validation of their account:');
$message .= "<form method='post' action='app/admin-exec.php'>";
$message .= "<ul>";
while ($data = $user_req->fetch()) {
$message .= "<li><label>
<input type='checkbox' name='validate[]'
value='".$data['userid'] . "'> " . $data['firstname'] . " " . $data['lastname'] . " (" . $data['email'] . ")
</label></li>";
}
$message .= "</ul><div class='center'>
<button class='button' type='submit'>"._('Submit') . "</button></div>";
display_message('error', $message);
// as this will 'echo', we need to call it at the right moment. It will not go smoothly into $message.
$formKey->outputFormkey();
echo "</form>";
}
?>
<menu>
<ul>
<li class='tabhandle' id='tab1'><?php echo _('Team'); ?></li>
<li class='tabhandle' id='tab2'><?php echo _('Users'); ?></li>
<li class='tabhandle' id='tab3'><?php echo _('Status'); ?></li>
<li class='tabhandle' id='tab4'><?php echo _('Types of items'); ?></li>
<li class='tabhandle' id='tab5'><?php echo _('Experiments template'); ?></li>
<li class='tabhandle' id='tab6'><?php echo _('Import CSV'); ?></li>
<li class='tabhandle' id='tab7'><?php echo _('Import ZIP'); ?></li>
</ul>
</menu>
<!-- TABS 1 -->
<div class='divhandle' id='tab1div'>
<h3><?php echo _('Configure your team'); ?></h3>
<form method='post' action='app/admin-exec.php'>
<p>
<label for='deletable_xp'><?php echo _('Users can delete experiments:'); ?></label>
<select name='deletable_xp' id='deletable_xp'>
<option value='1'<?php
if (get_team_config('deletable_xp') == 1) { echo " selected='selected'"; } ?>
><?php echo _('Yes'); ?></option>
<option value='0'<?php
if (get_team_config('deletable_xp') == 0) { echo " selected='selected'"; } ?>
><?php echo _('No'); ?></option>
</select>
</p>
<p>
<label for='link_name'><?php echo _('Name of the link in the top menu:'); ?></label>
<input type='text' value='<?php echo get_team_config('link_name'); ?>' name='link_name' id='link_name' />
</p>
<p>
<label for='link_href'><?php echo _('Address where this link should point:'); ?></label>
<input type='url' value='<?php echo get_team_config('link_href'); ?>' name='link_href' id='link_href' />
</p>
<p>
<label for='stampprovider'><?php echo _('URL for external timestamping service:'); ?></label>
<input type='url' value='<?php echo get_team_config('stampprovider'); ?>' name='stampprovider' id='stampprovider' />
<span class='smallgray'><?php echo _('This should be the URL used for <a href="https://tools.ietf.org/html/rfc3161">RFC 3161</a>-compliant timestamping requests.'); ?></span>
</p>
<p>
<label for='stampcert'><?php echo _('Chain of certificates of the external timestamping service:'); ?></label>
<input type='text' placeholder='vendor/universign-tsa-root.pem' value='<?php echo get_team_config('stampcert'); ?>' name='stampcert' id='stampcert' />
<span class='smallgray'><?php echo _('This should point to the chain of certificates used by your external timestamping provider to sign the timestamps.<br /> Local path relative to eLabFTW installation directory. The file needs to be in <a href="https://en.wikipedia.org/wiki/Privacy-enhanced_Electronic_Mail">PEM-encoded (ASCII)</a> format!'); ?></span>
</p>
<label for='stamplogin'><?php echo _('Login for external timestamping service:'); ?></label>
<input type='text' value='<?php echo get_team_config('stamplogin'); ?>' name='stamplogin' id='stamplogin' />
<span class='smallgray'><?php echo _('This should be the login associated with your timestamping service provider'); ?></span>
</p>
<p>
<label for='stamppass'><?php echo _('Password for external timestamping service:'); ?></label>
<input type='password' value='<?php echo $crypto->decrypt(get_team_config('stamppass')); ?>' name='stamppass' id='stamppass' />
<span class='smallgray'><?php echo _('Your timestamping service provider password'); ?></span>
</p>
<div class='center'>
<button type='submit' name='submit_config' class='submit button'>Save</button>
</div>
</form>
</div>
<!-- TABS 2 USERS -->
<div class='divhandle' id='tab2div'>
<h3><?php echo _('Edit users'); ?></h3>
<ul class='list-group'>
<?php
// we show only the validated users here
$user_req->bindValue(':validated', 1);
$user_req->execute();
while ($users = $user_req->fetch()) {
?>
<li class='list-group-item'>
<a class='trigger_users_<?php echo $users['userid']; ?>'><?php echo $users['firstname'] . " " . $users['lastname']; ?></a>
<div class='toggle_users_<?php echo $users['userid']; ?>'>
<br>
<form method='post' action='app/admin-exec.php' id='admin_user_form'>
<input type='hidden' value='<?php echo $users['userid']; ?>' name='userid' />
<label class='block' for='edituser_firstname'><?php echo _('Firstname'); ?></label>
<input id='edituser_firstname' type='text' value='<?php echo $users['firstname']; ?>' name='firstname' />
<label class='block' for='edituser_lastname'><?php echo _('Lastname'); ?></label>
<input id='edituser_lastname' type='text' value='<?php echo $users['lastname']; ?>' name='lastname' />
<label class='block' for='edituser_username'><?php echo _('Username'); ?></label>
<input id='edituser_username' type='text' value='<?php echo $users['username']; ?>' name='username' />
<label class='block' for='edituser_email'><?php echo _('Email'); ?></label>
<input id='edituser_email' type='email' value='<?php echo $users['email']; ?>' name='email' /><br>
<br>
<label for='validated'><?php echo _('Has an active account?'); ?></label>
<select name='validated' id='validated'>
<option value='1'<?php
if ($users['validated'] == 1) { echo " selected='selected'"; } ?>
><?php echo _('Yes'); ?></option>
<option value='0'<?php
if ($users['validated'] == 0) { echo " selected='selected'"; } ?>
><?php echo _('No'); ?></option>
</select>
<br>
<label for='usergroup'><?php echo _('Group:'); ?></label>
<select name='usergroup' id='usergroup'>
<?php
if ($_SESSION['is_sysadmin'] == 1) {
?>
<option value='1'<?php
if ($users['usergroup'] == 1) { echo " selected='selected'"; } ?>
>Sysadmins</option>
<?php
}
?>
<option value='2'<?php
if ($users['usergroup'] == 2) { echo " selected='selected'"; } ?>
>Admins</option>
<option value='3'<?php
if ($users['usergroup'] == 3) { echo " selected='selected'"; } ?>
>Admin + Lock power</option>
<option value='4'<?php
if ($users['usergroup'] == 4) { echo " selected='selected'"; } ?>
>Users</option>
</select>
<br>
<label for='users_reset_password'><?php echo _('Reset user password:'); ?></label>
<input id='users_reset_password' type='password' value='' name='new_password' />
<br>
<label for='users_reset_cpassword'><?php echo _('Repeat new password:'); ?></label>
<input id='users_reset_cpassword' type='password' value='' name='confirm_new_password' />
<br>
<br>
<div class='center'>
<button type='submit' class='button'><?php echo _('Edit this user'); ?></button>
</div>
</form>
<script>
$(".toggle_users_<?php echo $users['userid']; ?>").hide();
$("a.trigger_users_<?php echo $users['userid']; ?>").click(function(){
$('div.toggle_users_<?php echo $users['userid']; ?>').slideToggle(1);
});
</script>
</div>
</li>
<?php
}
?>
<!-- DELETE USER -->
<ul class='list-group'>
<li class='list-group-item' style='border-color:red;background-color:#FFC1B7;'>
<h3><?php echo _('DANGER ZONE'); ?></h3>
<h4><strong><?php echo _('Delete an account'); ?></strong></h4>
<form action='app/admin-exec.php' method='post'>
<!-- form key -->
<?php $formKey->outputFormkey(); ?>
<label for='delete_user'><?php echo _('Type EMAIL ADDRESS of a member to delete this user and all his experiments/files forever:'); ?></label>
<input type='email' name='delete_user' id='delete_user' />
<br>
<br>
<label for='delete_user_confpass'><?php echo _('Type your password:'); ?></label>
<input type='password' name='delete_user_confpass' id='delete_user_confpass' />
<div class='center'>
<button type='submit' class='button submit'><?php echo _('Delete this user!'); ?></button>
</div>
</form>
</li>
</ul>
</div>
<!-- TAB 3 STATUS -->
<div class='divhandle' id='tab3div'>
<h3><?php echo _('Edit an existing status'); ?></h3>
<ul class='sortable_status list-group'>
<?php
// SQL to get all status
$sql = "SELECT * from status WHERE team = :team_id ORDER BY ordering ASC";
$req = $pdo->prepare($sql);
$req->bindParam(':team_id', $_SESSION['team_id'], PDO::PARAM_INT);
$req->execute();
while ($status = $req->fetch()) {
// count the experiments with this status
// don't allow deletion if experiments with this status exist
// but instead display a message to explain
$count_exp_sql = "SELECT COUNT(id) FROM experiments WHERE status = :status AND team = :team";
$count_exp_req = $pdo->prepare($count_exp_sql);
$count_exp_req->bindParam(':status', $status['id'], PDO::PARAM_INT);
$count_exp_req->bindParam(':team', $_SESSION['team_id'], PDO::PARAM_INT);
$count_exp_req->execute();
$count = $count_exp_req->fetchColumn();
?>
<li id='status_<?php echo $status['id']; ?>' class='list-group-item'>
<a class='trigger_status_<?php echo $status['id']; ?>'><?php echo $status['name']; ?></a>
<div class='toggle_container_status_<?php echo $status['id']; ?>'>
<?php
if ($count == 0) {
?>
<img class='align_right' src='img/small-trash.png' title='delete' alt='delete' onClick="deleteThis('<?php echo $status['id']; ?>','status', 'admin.php')" />
<?php
} else {
?>
<img class='align_right' src='img/small-trash.png' title='delete' alt='delete' onClick="alert('<?php echo _('Remove all experiments with this status before deleting this status.'); ?>')" />
<?php
}
?>
<form action='app/admin-exec.php' method='post'>
<input type='text' name='status_name' value='<?php echo stripslashes($status['name']); ?>' />
<label for='default_checkbox'><?php echo _('Default status'); ?></label>
<input type='checkbox' name='status_is_default' id='default_checkbox'
<?php
// check the box if the status is already default
if ($status['is_default'] == 1) {
echo " checked";
}
?>>
<div id='colorwheel_div_edit_status_<?php echo $status['id']; ?>'>
<div class='colorwheel inline'></div>
<input type='text' name='status_color' value='#<?php echo $status['color']; ?>' />
</div>
<input type='hidden' name='status_id' value='<?php echo $status['id']; ?>' />
<br>
<div class='center'>
<button type='submit' class='button'><?php echo _('Edit') . ' ' . stripslashes($status['name']); ?></button><br>
</div>
</form>
<script>$(document).ready(function() {
$(".toggle_container_status_<?php echo $status['id']; ?>").hide();
$("a.trigger_status_<?php echo $status['id']; ?>").click(function(){
$('div.toggle_container_status_<?php echo $status['id']; ?>').slideToggle(100);
// disable sortable behavior
$('.sortable_status').sortable("disable");
});
color_wheel('#colorwheel_div_edit_status_<?php echo $status['id']; ?>')
});</script></div></li>
<?php
}
?>
</ul>
<!-- ADD NEW STATUS -->
<ul class='list-group'>
<li class='list-group-item'>
<form action='app/admin-exec.php' method='post'>
<label for='new_status_name'><?php echo _('Add a new status'); ?></label>
<input type='text' id='new_status_name' name='new_status_name' required />
<div id='colorwheel_div_new_status'>
<div class='colorwheel inline'></div>
<input type='text' name='new_status_color' value='#000000' />
</div>
<div class='center'>
<button type='submit' class='submit button'><?php echo _('Save'); ?></button>
</div>
<br>
</form>
</li>
</ul>
</div>
<!-- TAB 4 ITEMS TYPES-->
<div class='divhandle' id='tab4div'>
<h3><?php echo _('Database items types'); ?></h3>
<ul class='sortable_itemstypes list-group'>
<?php
// SQL to get all items type
$sql = "SELECT * from items_types WHERE team = :team ORDER BY ordering ASC";
$req = $pdo->prepare($sql);
$req->execute(array(
'team' => $_SESSION['team_id']
));
while ($items_types = $req->fetch()) {
?>
<li id='itemstypes_<?php echo $items_types['id']; ?>' class='list-group-item'>
<a class='trigger_<?php echo $items_types['id']; ?>'><?php echo _('Edit') . ' ' . $items_types['name']; ?></a>
<div class='toggle_container_<?php echo $items_types['id']; ?>'>
<?php
// count the items with this type
// don't allow deletion if items with this type exist
// but instead display a message to explain
$count_db_sql = "SELECT COUNT(id) FROM items WHERE type = :type";
$count_db_req = $pdo->prepare($count_db_sql);
$count_db_req->bindParam(':type', $items_types['id'], PDO::PARAM_INT);
$count_db_req->execute();
$count = $count_db_req->fetchColumn();
if ($count == 0) {
?>
<img class='align_right' src='img/small-trash.png' title='delete' alt='delete' onClick="deleteThis('<?php echo $items_types['id']; ?>','item_type', 'admin.php')" />
<?php
} else {
?>
<img class='align_right' src='img/small-trash.png' title='delete' alt='delete' onClick="alert('<?php echo _('Remove all database items with this type before deleting this type.'); ?>')" />
<?php
}
?>
<form action='app/admin-exec.php' method='post'>
<label><?php echo _('Edit name'); ?></label>
<input required type='text' name='item_type_name' value='<?php echo stripslashes($items_types['name']); ?>' />
<input type='hidden' name='item_type_id' value='<?php echo $items_types['id']; ?>' />
<div id='colorwheel_div_<?php echo $items_types['id']; ?>'>
<div class='colorwheel inline'></div>
<input type='text' name='item_type_bgcolor' value='#<?php echo $items_types['bgcolor']; ?>'/>
</div><br><br><br>
<textarea class='mceditable' name='item_type_template' /><?php echo stripslashes($items_types['template']); ?></textarea><br>
<div class='center'>
<button type='submit' class='button'><?php echo _('Edit') . ' ' . stripslashes($items_types['name']); ?></button><br>
</div>
</form>
<script>$(document).ready(function() {
$(".toggle_container_<?php echo $items_types['id']; ?>").hide();
$("a.trigger_<?php echo $items_types['id']; ?>").click(function(){
$('div.toggle_container_<?php echo $items_types['id']; ?>').slideToggle(100);
// disable sortable behavior
$('.sortable_itemstypes').sortable("disable");
});
color_wheel('#colorwheel_div_<?php echo $items_types['id']; ?>')
});</script>
</div>
</li>
<?php
} // end generation of items_types
?>
</ul>
<!-- ADD NEW TYPE OF ITEM -->
<ul class='list-group'>
<li class='list-group-item'>
<form action='app/admin-exec.php' method='post'>
<label for='new_item_type_name'><?php echo _('Add a new type of item:'); ?></label>
<input required type='text' id='new_item_type_name' name='new_item_type_name' />
<input type='hidden' name='new_item_type' value='1' />
<div id='colorwheel_div_new'>
<div class='colorwheel inline'></div>
<input type='text' name='new_item_type_bgcolor' value='#000000' />
</div><br><br><br><br>
<textarea class='mceditable' name='new_item_type_template' /></textarea>
<div class='center submitButtonDiv'>
<button type='submit' class='button'><?php echo _('Save'); ?></button>
</div>
</form>
</li>
</ul>
</div>
<!-- TABS 5 -->
<div class='divhandle' id='tab5div'>
<h3><?php echo _('Common experiment template'); ?></h3>
<?php
// get what is the default experiment template
$sql = "SELECT body FROM experiments_templates WHERE userid = 0 AND team = :team LIMIT 1";
$req = $pdo->prepare($sql);
$req->bindParam(':team', $_SESSION['team_id'], PDO::PARAM_INT);
$req->execute();
$exp_tpl = $req->fetch();
?>
<p><?php echo _('This is the default text when someone creates an experiment.'); ?></p>
<form action='app/admin-exec.php' method='post'>
<input type='hidden' name='default_exp_tpl' value='1' />
<textarea class='mceditable' name='default_exp_tpl' />
<?php
echo $exp_tpl['body'];
?></textarea>
<div class='center submitButtonDiv'>
<button type='submit' class='button'><?php echo _('Edit'); ?></button>
</div>
</form>
</div>
<!-- TABS 6 -->
<div class='divhandle' id='tab6div'>
<h3><?php echo _('Import a CSV file'); ?></h3>
<?php
// file upload block
// show select of type
// SQL to get items names
$sql = "SELECT * FROM items_types WHERE team = :team_id";
$req = $pdo->prepare($sql);
$req->bindParam(':team_id', $_SESSION['team_id'], PDO::PARAM_INT);
$req->execute();
?>
<p style='text-align:justify'><?php echo _("This page will allow you to import a .csv (Excel spreadsheet) file into the database.<br>First you need to open your .xls/.xlsx file in Excel or Libreoffice and save it as .csv.<br>In order to have a good import, the first row should be the column's field names. You can make a tiny import of 3 lines to see if everything works before you import a big file."); ?>
<span class='strong'><?php echo _('You should make a backup of your database before importing thousands of items!'); ?></span></p>
<label for='item_selector'><?php echo _('1. Select a type of item to import to:'); ?></label>
<select id='item_selector' onchange='goNext(this.value)'><option value=''>--------</option>
<?php
while ($items_types = $req->fetch()) {
echo "<option value='" . $items_types['id'] . "' name='type' ";
echo ">" . $items_types['name'] . "</option>";
}
?>
</select><br>
<div class='import_block'>
<form enctype="multipart/form-data" action="app/import.php" method="POST">
<label for='uploader'><?php echo _('2. Select a CSV file to import:'); ?></label>
<input id='uploader' name="csvfile" type="file" />
<input name='type' type='hidden' value='csv' />
<div class='center'>
<button type="submit" class='button' value="Upload"><?php echo _('Import CSV'); ?></button>
</div>
</form>
</div>
</div>
<!-- TABS 7 -->
<div class='divhandle' id='tab7div'>
<h3><?php echo _('Import a ZIP file'); ?></h3>
<?php
// file upload block
// show select of type
// SQL to get items names
$sql = "SELECT * FROM items_types WHERE team = :team_id";
$req = $pdo->prepare($sql);
$req->bindParam(':team_id', $_SESSION['team_id'], PDO::PARAM_INT);
$req->execute();
?>
<p style='text-align:justify'><?php echo _("This page will allow you to import a .elabftw.zip archive."); ?>
<br><span class='strong'><?php echo _('You should make a backup of your database before importing thousands of items!'); ?></span></p>
<label for='item_selector'><?php echo _('1. Select a type of item to import to:'); ?></label>
<select id='item_selector' onchange='goNext(this.value)'><option value=''>--------</option>
<?php
while ($items_types = $req->fetch()) {
echo "<option value='" . $items_types['id'] . "' name='type' ";
echo ">" . $items_types['name'] . "</option>";
}
?>
</select><br>
<div class='import_block'>
<form enctype="multipart/form-data" action="app/import.php" method="POST">
<label for='uploader'><?php echo _('2. Select a ZIP file to import:'); ?></label>
<input id='uploader' name="zipfile" type="file" accept='.elabftw.zip' />
<input name='type' type='hidden' value='zip' />
<div class='center'>
<button type="submit" class='button' value="Upload"><?php echo _('Import ZIP'); ?></button>
</div>
</form>
</div>
</div>
<script>
// used on import csv/zip to go to next step
function goNext(x) {
if(x == '') {
return;
}
document.cookie = 'itemType='+x;
$('.import_block').show();
}
// color wheel
function color_wheel(div_name) {
var cw = Raphael.colorwheel($(div_name)[0], 80);
cw.input($(div_name+" input" )[0]);
}
$(document).ready(function() {
// SORTABLE for STATUS
$('.sortable_status').sortable({
// limit to horizontal dragging
axis : 'y',
helper : 'clone',
// do ajax request to update db with new order
update: function(event, ui) {
// send the orders as an array
var ordering = $(".sortable_status").sortable("toArray");
$.post("app/order.php", {
'ordering_status' : ordering
});
}
});
// SORTABLE for ITEMS TYPES
$('.sortable_itemstypes').sortable({
// limit to horizontal dragging
axis : 'y',
helper : 'clone',
// do ajax request to update db with new order
update: function(event, ui) {
// send the orders as an array
var ordering = $(".sortable_itemstypes").sortable("toArray");
$.post("app/order.php", {
'ordering_itemstypes' : ordering
});
}
});
// IMPORT
$('.import_block').hide();
// TABS
// get the tab=X parameter in the url
var params = getGetParameters();
var tab = parseInt(params['tab']);
if (!isInt(tab)) {
var tab = 1;
}
var initdiv = '#tab' + tab + 'div';
var inittab = '#tab' + tab;
// init
$(".divhandle").hide();
$(initdiv).show();
$(inittab).addClass('selected');
$(".tabhandle" ).click(function(event) {
var tabhandle = '#' + event.target.id;
var divhandle = '#' + event.target.id + 'div';
$(".divhandle").hide();
$(divhandle).show();
$(".tabhandle").removeClass('selected');
$(tabhandle).addClass('selected');
});
// END TABS
// TOGGLE
$(".toggle_users_<?php echo $users['userid']; ?>").hide();
$("a.trigger_users_<?php echo $users['userid']; ?>").click(function(){
$('div.toggle_users_<?php echo $users['userid']; ?>').slideToggle(1);
});
// COLOR WHEEL
color_wheel('#colorwheel_div_new');
color_wheel('#colorwheel_div_new_status');
// EDITOR
tinymce.init({
mode : "specific_textareas",
editor_selector : "mceditable",
content_css : "css/tinymce.css",
plugins : "table textcolor searchreplace code fullscreen insertdatetime paste charmap save image link",
toolbar1: "undo redo | bold italic underline | fontsizeselect | alignleft aligncenter alignright alignjustify | superscript subscript | bullist numlist outdent indent | forecolor backcolor | charmap | link",
removed_menuitems : "newdocument",
language : '<?php echo $_SESSION['prefs']['lang']; ?>'
});
});
</script>
<?php require_once 'inc/footer.php';