forked from looma/Looma-II
-
Notifications
You must be signed in to change notification settings - Fork 0
/
looma-import-content.php
executable file
·142 lines (112 loc) · 5.33 KB
/
looma-import-content.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
<?php
//function isLoggedIn() { return (isset($_COOKIE['login']) ? $_COOKIE['login'] : null);};
require_once('includes/looma-isloggedin.php');
// NOTE: this code sending "header" must be before ANY data is sent to client=side
$loggedin = loggedIn(); if (!$loggedin || loginLevel() !== 'exec') header('Location: looma-login.php');
error_log("Starting Import Content session. logged in as: " . $loggedin);
?>
<!doctype html>
<!--
Name: Skip
Owner: VillageTech Solutions (villagetechsolutions.org)
Date: 2017 04
Revision: Looma 2.0.0
File: looma-import-content.php
Description: navigate content folders and import media files into activities collection in the database
derived from looma-library.php
NOTES (2018 03)
- navigates in folders in ../content/
- allows selecting individual files
- allows setting DN and SRC for those files
- backend registers the files in ACTIVITIES collection in Mongo
CHANGES TO MAKE
- SORT the DIRs and FILEs before displaying
- reversed this May 2023 - dont show 'hidden.txt'
-->
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Skip">
<meta name="project" content="Looma">
<meta name="owner" content="villagetechsolutions.org">
<link rel="icon" type="image/png" href="images/favicon-32x32.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <!-- uses latest IE rendering engine-->
<!--[if lt IE 9]> <script src="js/html5shiv.min.js"></script> <![endif]-->
<?php $page_title = 'Looma Import Content';?>
<title> <?php print $page_title; ?> </title>
<?php require_once ('includes/mongo-connect.php');
require_once('includes/looma-utilities.php');
/////////////////////////
////// main code //////
$path = "../content";
$parent = "../content";
if ( isset($_REQUEST["fp"]) ) {
$path = $_REQUEST["fp"];
if (strrpos($path,'/') > -1) {
$parent = substr($parent, 0, strrpos($path,'/'));
if ($parent == '..') $parent = '../content';
}
else $parent = '../content';
}
?>
<html>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/looma.css">
<link rel="stylesheet" type="text/css" href="css/looma-theme-looma.css">
<link rel="stylesheet" type="text/css" href="css/looma-import-content.css">
</head>
<body>
<div id = "main-container">
<div id="header">
<img id="logo" src="images/LoomaLogo.png">
<span class="title">Import Content</span>
<span class='foldername' id='dirname'><?php echo $path ?></span>
<span id="showfolders">Change Folder<select id="folders"><option>......</option></select></span>
</div>
<!-- ******************* -->
<div id= "previewpanel">
<div id="filelist"></div>
<div id="hints">
<p class="hint">This program registers files in the Looma Content folders as Looma Activities </p>
<p class="hint">1. Navigate to a folder </p>
<p class="hint">2. Check the files to be registered</p>
<p class="hint">3. (optional) Enter 'source' in the bottom panel</p>
<p class="hint">4. Click "Import" to import the files</p>
<p class="hint">5. Click "Change folder" to move to another folder</p>
</div>
</div>
<div id = "timeline">
Folder: <span class='foldername' id="fn"></span>
<span class="right">
<button id="check" class="control">Check all</button>
<button id="uncheck" class="control">Uncheck all</button>
</span>
<br>
<br><span>Check files to be registered, edit their Display Names, then click "Register"</span>
<span class="right">
<button id="register" class="control"> Register </button>
<button id="cancel" class="control"> Cancel </button>
</span>
<br> (Optional) select source of these files: <select name='source' id="source">
<option value='' selected></option>
<option value='khan'>Khan</option>
<option value='w4s'>Wikipedia for Schools</option>
<option value='ted'>TED</option>
<option value='CEHRD'>CEHRD</option>
<option value='PhET'>PhET</option>
<option value='flickr'>Flickr</option>
<option value='nasa'>NASA</option>
<option value='unsplash'>UnSplash</option>
<option value='google images'>Google Images</option>
<option value='Dr Dann'>Dr Dann</option>
</select>
</div>
<button class='control-button' id='dismiss' ></button>
</div>
<?php include ('includes/js-includes.php'); ?>
<script src="js/jquery-ui.min.js"> </script>
<script src="js/jquery.hotkeys.js"> </script>
<script src="js/looma-import-content.js"></script>
</body>
</html>