浏览代码

Major update

+ Video module manager
+ Photo module manager
+ System Settings
+ User PReference and supports for user dir preference editing
Toby Chui 5 年之前
父节点
当前提交
8d0782c8ef
共有 36 个文件被更改,包括 935 次插入448 次删除
  1. 二进制
      src/Desktop/img/bg/dark/5.jpg
  2. 二进制
      src/Desktop/img/bg/dark/6.jpg
  3. 二进制
      src/Desktop/img/bg/nature/7.jpg
  4. 388 195
      src/Photo/Image_manager.php
  5. 4 2
      src/Photo/Image_mover.php
  6. 二进制
      src/Photo/img/pwa/launch-1125x2436.png
  7. 二进制
      src/Photo/img/pwa/launch-1242x2148.png
  8. 二进制
      src/Photo/img/pwa/launch-1536x2048.png
  9. 二进制
      src/Photo/img/pwa/launch-1668x2224.png
  10. 二进制
      src/Photo/img/pwa/launch-2048x2332.png
  11. 二进制
      src/Photo/img/pwa/launch-640x1136.png
  12. 二进制
      src/Photo/img/pwa/launch-750x1294.png
  13. 1 1
      src/Photo/index.js
  14. 10 2
      src/Photo/index.php
  15. 1 1
      src/Photo/new_folder.php
  16. 1 0
      src/System Settings/menus/theme.csv
  17. 1 1
      src/System Settings/navi.php
  18. 1 0
      src/SystemAOB/functions/file_system/default/7z.csv
  19. 1 0
      src/SystemAOB/functions/file_system/default/md.csv
  20. 1 1
      src/SystemAOB/functions/file_system/default/txt.csv
  21. 1 0
      src/SystemAOB/functions/file_system/default/zip.csv
  22. 1 0
      src/SystemAOB/functions/file_system/fileoprProgress.php
  23. 8 3
      src/SystemAOB/functions/personalization/autoConfig.php
  24. 15 1
      src/SystemAOB/functions/personalization/configIO.php
  25. 4 13
      src/SystemAOB/functions/personalization/defaults/function_bar.config
  26. 10 3
      src/SystemAOB/functions/personalization/settingModifyHandler.php
  27. 63 0
      src/SystemAOB/functions/personalization/userConfigUI.php
  28. 0 1
      src/SystemAOB/system/jwt/tokenDB/189f862f386c954aeda39f45b1e931fe40100d8f7f34d0c79587e0c2779943f2be31e8cd903d01df868c7628fe6339bfb7ed06aef4e629e79f669b01de0e6fb3.atok
  29. 387 198
      src/Video/manager.php
  30. 10 2
      src/Video/mover.php
  31. 2 2
      src/Video/new_folder.php
  32. 1 0
      src/Video/playlist/.nomedia
  33. 1 1
      src/Video/vidPlay.php
  34. 14 8
      src/function_bar.php
  35. 0 11
      src/header_std.php
  36. 9 2
      src/index.php

二进制
src/Desktop/img/bg/dark/5.jpg


二进制
src/Desktop/img/bg/dark/6.jpg


二进制
src/Desktop/img/bg/nature/7.jpg


+ 388 - 195
src/Photo/Image_manager.php

@@ -1,5 +1,85 @@
 <?php
 include '../auth.php';
+if(isset($_GET["bkend"])){
+	if(isset($_GET["query"])){
+		if($_GET["query"] == "playlist"){
+			$intdirs = array_filter(glob("storage/" . "*"), 'is_dir');
+			$IntDirWInfo = [];
+			foreach ($intdirs as &$intdir) {
+				preg_match('/storage\/([^\/]*)/', $intdir, $out_playlist);
+				$tmp = [];
+				if(ctype_xdigit($out_playlist[1])){
+					$tmp["name"] = "Internal - ".hex2bin($out_playlist[1]);
+				}else{
+					$tmp["name"] = "Internal - ".$out_playlist[1];
+				}
+				$tmp["dir"] = "../../../Video/".$intdir."/";
+				$tmp["drive"] = "internal";
+				$tmp["playlist"] = $out_playlist[1];
+				array_push($IntDirWInfo,$tmp);
+			}
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$ExtDirWInfo = []; //TODO: add ext support
+			}else{
+				if (file_exists("/media/")){
+					$extdirs = array_filter(glob("/media/*/Video/*"), 'is_dir');
+					$ExtDirWInfo = [];
+					foreach ($extdirs as &$extdir) {
+						preg_match('/\/media\/([^\/]*)\//', $extdir, $out_storage);
+						preg_match('/Video\/([^\/]*)/', $extdir, $out_playlist);
+						$tmp = [];
+						if(ctype_xdigit($out_playlist[1])){
+							$tmp["name"] = $out_storage[1]." - ".hex2bin($out_playlist[1]);
+						}else{
+							$tmp["name"] = $out_storage[1]." - ".$out_playlist[1];
+						}
+						$tmp["dir"] = $extdir."/";
+						$tmp["drive"] = $out_storage[1];
+						$tmp["playlist"] = $out_playlist[1];
+						array_push($ExtDirWInfo,$tmp);
+					}
+				}
+			}
+			$dirs = array_merge($IntDirWInfo,$ExtDirWInfo);
+			echo json_encode($dirs);
+		}else if($_GET["query"] == "storage"){
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$extdirs = [];
+			}else{
+				$extdirs = array_filter(glob("/media/*"), 'is_dir');
+			}
+			$dirs = array_merge($extdirs,["internal"]);
+			echo json_encode($dirs);
+		}else if($_GET["query"] == "unsort"){
+			$intdirs = glob('uploads/*.{jpg,jpeg,png,gif}', GLOB_BRACE);
+			$IntDirWInfo = [];
+			foreach ($intdirs as &$intdir) {
+				$tmp = [];
+				$tmp["dir"] = "../../../Photo/".$intdir;
+				$tmp["drive"] = "internal";
+				array_push($IntDirWInfo,$tmp);
+			}
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$ExtDirWInfo = []; //TODO: add ext support
+			}else{
+				if (file_exists("/media/")){
+					$extdirs = glob("/media/*/Photo/*.{jpg,jpeg,png,gif}");
+					$ExtDirWInfo = [];
+					foreach ($extdirs as &$extdir) {
+						preg_match('/\/media\/([^\/]*)\//', $extdir, $out_storage);
+						$tmp = [];
+						$tmp["dir"] = $extdir;
+						$tmp["drive"] = $out_storage[1];
+						array_push($ExtDirWInfo,$tmp);
+					}
+				}
+			}
+			$dirs = array_merge($IntDirWInfo,$ExtDirWInfo);
+			echo json_encode($dirs);
+		}
+	}
+	die();
+}
 ?>
 <!DOCTYPE html>
 <html>
@@ -9,216 +89,329 @@ include '../auth.php';
     <link rel="stylesheet" href="../script/tocas/tocas.css">
 	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
 	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 	<title>ArOZ Onlineβ</title>
+	<style>
+		body{
+			background:rgba(245,245,245,0.8);
+		}
+		@media (max-width: 767px){
+			.ts.bottom.right.snackbar.active{
+				width: 100% !important;
+				bottom: 0px !important;
+				right: 0px !important;
+			}
+		}
+	</style>
 </head>
 <body>
-    <nav id="topbar" class="ts attached inverted borderless normal menu">
-        <div class="ts narrow container">
-            <a href="../" class="item">ArOZ Onlineβ</a>
-        </div>
-    </nav>
-	<br>
-
-    <div class="ts fluid container">
-
-        <div class="ts breadcrumb">
-			<a href="index.php" class="section"><i class="arrow left icon"></i>Back</a>
-            <div class="divider">/</div>
-            <div class="section"><i class="folder icon"></i>Photo Station File Management System</div>
-            <div class="divider">/</div> 
-            
-        </div>
-
-		<div align="center"><i class="chevron right icon"></i><i class="chevron right icon"></i><i class="chevron right icon"></i><i class="chevron right icon"></i></div>
-
-        <div class="ts grid">
-			<!-- Left file browsing zone -->
-	
-            <div class="six wide column">
-				<div id="imagelist" class="ts form">
-					 <div class="ts selection segmented list">
-					 <?php
-						$leftTemplate='<div class="item" style="overflow: hide;">
-											<div class="ts checkbox">
-												<input id="%FILE_ID%" name="box2check" type="checkbox" onClick="showPreview('."'"."%FILE_ID%"."'".')">
-												<label for="%FILE_ID%"><i class="image icon"></i>%FILE_NAME%</label>
-												<div id="%FILE_ID%-ext" style="display:none;">%FILE_EXTENSION%</div>
-												<div id="%FILE_ID%-ofn" style="display:none;">%ORIGINAL_FILENAME%</div>
-												<div id="%FILE_ID%-rfp" style="display:none;">%FILE_PATH%</div>
-												<div id="%FILE_ID%-size" style="display:none;">%FILE_SIZE%</div>
-											</div>
-										</div>';
-						$files = glob('uploads/*.{jpg,jpeg,png,gif}', GLOB_BRACE);
-						foreach($files as $file){
-							$filename = basename($file);
-							$ext = pathinfo($file, PATHINFO_EXTENSION);
-							$orgfilename = str_replace("." . $ext,"",str_replace("inith","",basename($file)));
-							$orgfilename = hex2bin($orgfilename);
-							$lbox = str_replace("%FILE_ID%",str_replace(".","-dot-",str_replace(" ","-space-",$orgfilename)),$leftTemplate);
-							$lbox = str_replace("%FILE_NAME%",$filename,$lbox);
-							$lbox = str_replace("%ORIGINAL_FILENAME%",$orgfilename,$lbox);
-							$lbox = str_replace("%FILE_PATH%",$file,$lbox);
-							$lbox = str_replace("%FILE_EXTENSION%",$ext,$lbox);
-							$lbox = str_replace("%FILE_SIZE%",filesize($file),$lbox);
-							echo $lbox;
-						}
-					?>
-					</div>	
-				</div>	
-			</div>
-			
-
-			<!-- Center file browsing zone -->
-            <div class="four wide column">
-                <div class="ts card">
-					<!-- Image preview -->
-                    <div class="secondary very padded extra content">
-                        <div class="ts icon header">
-                            <img id="previewWindow" class="ts medium image" src="img/Photo_manager.png"></img>
-                        </div>
-                    </div>
-
-
-					<!-- File Information -->
-                    <div class="extra content">
-                        <div class="header" id="ImageName">Photo Station File Management System</div>
-                    </div>
-					<div align="center">
-						<div class="ts icon buttons">
-							<button id="btn1" class="ts button" onclick="TogglePreview()"><i class="mouse pointer icon"></i><i class="eye icon"></i></button>
-							<button id="btn2" class="ts button" onClick="MoveFile(1);"><i class="checkmark box icon"></i><i class="arrow right center icon"></i></button>
-							<button id="btn3" class="ts button" onClick="MoveFile(2);"><i class="folder outline icon"></i><i class="arrow right center icon"></i></button>
-							<button id="btn4" class="ts negative button" onClick="MoveFile(3)"><i class="checkmark box icon"></i><i class="trash outline icon"></i></button>
-						</div>
-					</div>
-
-                    <div class="extra content">
-                        <div class="ts list">
-
-                            <div class="item">
-                                <i class="file image outline icon"></i>
-                                <div class="content">
-                                    <div class="header">File Extension</div>
-                                    <div id="fileext" class="description">/</div>
-                                </div>
-                            </div>
-
-
-
-                            <div class="item">
-                                <i class="terminal icon"></i>
-                                <div class="content">
-                                    <div class="header">Storage Name</div>
-                                    <div id="storagename" class="description">/</div>
-                                </div>
-                            </div>
- 
-
-
-                            <div class="item">
-                                <i class="image icon"></i>
-                                <div class="content">
-                                    <div class="header">Image Size</div>
-                                    <div id="imgsize" class="description">/</div>
-                                </div>
-                            </div>
-
-							
-							
-							<div class="item">
-                                <i class="folder icon"></i>
-                                <div class="content">
-                                    <div class="header">Target Folder</div>
-                                    <div id="targetdir" class="description">/</div>
-                                </div>
-                            </div>
-							
-                        </div>
-                    </div>
-					<!-- Functional Butons -->
-					<div align="center">
-					<div class="ts icon buttons">
-						<button class="ts button" OnClick="toggle();"><i class="checkmark box icon"></i>All</button>
-						<button class="ts button" OnClick="toggleFalse();"><i class="square outline icon"></i>All</button>
-						<button class="ts button" OnClick="newfolder()"><i class="folder outline icon"></i>New</button>
-						<button class="ts button" OnClick="done();"><i class="checkmark icon"></i>DONE</button>
-					</div>
-					</div>
-                </div>
-                <div class="ts horizontal right floated middoted link list">
-                    <div class="item">CopyRight IMUS Laboratory</div>
-                </div>
-            </div>
-			
-			<!-- Right file browsing zone -->
-            <div class="six wide column">
-                <div class="ts selection segmented list">
-					<div id="filenamer" class="item" style="display:none;">
-						<div class="ts fluid borderless icon input">
-							<input id="fileNameInput" type="text" placeholder="New Folder">
-							<i class="folder outline icon"></i>
-						</div>
-					</div>
-					<?php
-					$storagedir = "storage/";
-					echo '<a class="item">
-								<i class="folder open icon"></i>
-								storage/
-								</a>';
-					$rightTemplate=' <a id="%FOLDER_ID%" class="item" onClick="%FUNCTION_CALL%">
-								&nbsp&nbsp&nbsp
-								<i class="folder icon"></i>
-								%FOLDER_NAME%
-								</a>';
-					$dirs = array_filter(glob($storagedir . "*"), 'is_dir');
-					foreach($dirs as $dir){
-						$foldername = str_replace($storagedir,"",$dir);
-						$rbox = str_replace("%FUNCTION_CALL%","selectFolder('$foldername')",$rightTemplate);
-						$rbox = str_replace("%FOLDER_NAME%",$foldername,$rbox);
-						$rbox = str_replace("%FOLDER_ID%",$foldername,$rbox);
-						echo $rbox;
-					}
-					
-					?>
-                    
-                </div>
-
+<nav class="ts attached borderless small menu">
+            <a id="rtiBtn" href="index.php" class="item"><i class="angle left icon"></i></a>
+            <a href="index.php" class="item">ArOZ Photo</a>
+            <div class="right menu">
+				<a onclick="ts('#AddstorageModal').modal('show')" class="item"><i class="add outline icon"></i></a>
+		    	<a href="../Upload Manager/upload_interface.php?target=Photo&filetype=jpg,jpeg,png,gif" class="item"><i class="upload icon"></i></a>
+			    <a href="Image_manager.php" class="item"><i class="folder open outline icon"></i></a>
             </div>
+</nav>
+<br>
+<div class="ts container">
+<div class="ts inverted segment">
+	<p>Batch moving :
+	<select class="ts basic dropdown" name="batchfolderdropdown">
+		<option>Select</option>
+	</select>
+	<button name="batchfolderbutton" class="ts button"><i class="move icon"></i>Move</button>
+	<button onclick="ts('#AddstorageModal').modal('show')" class="ts right floated button"><i class="add icon"></i>New folder</button>
+	</p>
+</div>
 
-        </div>
+	<div class="ts stackable grid" id="unsortlist">
 
-    </div>
-	<!-- Notifier Div-->
-	<div id="nfb" class="ts active bottom right snackbar" style="display:none;">
-		<div id="nfbtxt" class="content">
-			Loading...
-		</div>
-		<a class="primary action" onclick="$('#nfb').fadeOut('slow');">Close</a>
 	</div>
-	<!-- Action Confirm div-->
-	<dialog id="confirmbox" class="ts basic fullscreen modal" style="display:none; background:rgba(0,0,0,0.7);position:fixed;top:100px;" open>
-		<div class="ts icon header">
-			<i class="exchange icon"></i>File Operation Confirmation
+</div>
+
+<div class="ts modals dimmer">
+	<dialog id="AddstorageModal" class="ts fullscreen modal" open>
+		<div class="header">
+			Create new storage
 		</div>
-		<div id="confirminfo" class="content">
-			<p></p>
+		<div class="content">
+			<div class="ts form">
+			    <div class="field">
+					<label>Storage</label>
+					<select name="storagedropdown">
+						<option>Select</option>
+					</select>
+				</div>
+				<div class="field">
+					<label>New storage name</label>
+					<input type="text" id="storagename">
+					<small></small>
+				</div>
+			</div>
 		</div>
 		<div class="actions">
-			<button class="ts inverted basic deny button" onClick="$('#confirmbox').fadeOut('slow');">
+			<button class="ts deny button">
 				Cancel
 			</button>
-			<button class="ts inverted basic positive button" OnClick="ConfirmAction();">
+			<button class="ts positive button" onclick="submit()">
 				Confirm
 			</button>
 		</div>
 	</dialog>
-	<script>
-		var VDI = ao_module_virtualDesktop;
-		if (VDI){
-			$("#topbar").hide();
-			$("body").css("background","rgba(255,255,255,0.7)").css("padding","20px");
+</div>
+<br><br><br><br>
+<div class="ts bottom right snackbar">
+    <div class="content"></div>
+</div>
+<script>
+//Bind enter key to the input bar
+$("#storagename").on("keydown",function(e){
+	if (e.keyCode == 13){
+		submit();
+	}
+});
+
+//first script to run
+$.ajax({url: "Image_manager.php?bkend=true&query=unsort", success: function(result){
+	var resultArr = JSON.parse(result);
+	var allfile = "";
+	$.each(resultArr, function( index, value ) {
+		if(value["drive"] !== "internal"){
+			var drivename = '<div class="ts horizontal right floated label"><i class="usb icon"></i>' + value["drive"] + '</div>';
+		}else{
+			var drivename = '';
+		}
+		$("#unsortlist").append('<div class="four wide column" id="' + value["dir"] + '"><div class="ts card" style="height:100%"><div class="image"><img src="AOB' + value["dir"] + '"><div class="header"><div class="sub header">' + ao_module_codec.decodeUmFilename(value["dir"].replace(/^.*[\\\/]/, '')) + drivename + '</div></div></div><div class="content"><p><i class="move icon"></i>Move to <select class="ts basic dropdown" name="folderdropdown" file="' + value["dir"] + '" storage="' + value["drive"] + '"><option>Select</option></select></p><button name="deletefile"  file="' + value["dir"] + '" class="ts mini very compact negative button"><i class="delete icon"></i>Delete</button></div></div></div>');
+		allfile += value["dir"] + ",";
+	});
+	$("select[name='batchfolderdropdown']").attr("file",allfile.substr(0,allfile.length -1));
+	step2();
+}});
+
+function step2(){
+	$.ajax({url: "Image_manager.php?bkend=true&query=playlist", success: function(result){
+		var resultArr = JSON.parse(result);
+		$("select[name='folderdropdown']").html("");
+		$("select[name='folderdropdown']").append(new Option("Select",""));
+		
+		$("select[name='batchfolderdropdown']").html("");
+		$("select[name='batchfolderdropdown']").append(new Option("Select",""));		
+		$.each(resultArr, function( index, value ) {
+			$("select[name='folderdropdown'][storage='" + value["drive"] + "']").append(new Option(value["name"],value["dir"]));
+			$("select[name='batchfolderdropdown']").append(new Option(value["name"],value["dir"]));
+		});
+		
+		step3();
+	}});
+}
+
+function step3(){
+	$.ajax({url: "Image_manager.php?bkend=true&query=storage", success: function(result){
+		var resultArr = JSON.parse(result);
+		$("select[name='storagedropdown']").html("");
+		$("select[name='storagedropdown']").append(new Option("Select",""));
+		$.each(resultArr, function( index, value ) {
+			$("select[name='storagedropdown']").append(new Option(value,value));
+		});
+	}});
+	
+	step4();
+}
+
+function step4(){
+	$( "button[name='batchfolderbutton']" ).click(function() {
+		if($("select[name='batchfolderdropdown']").val()!==""){
+			var Arr = $("select[name='batchfolderdropdown']").attr("file").split(",");
+			var DOM = $("select[name='batchfolderdropdown']");
+			
+			var length = Arr.length;
+			var success = 0;
+			var failed = 0;
+			
+			$.each(Arr, function( index, value ) {
+				if(value!== ""){
+					$(DOM).parent().parent().parent().append('<div class="ts active inverted dimmer"><div class="ts text loader" id="processingtext">Processing...</div></div>');
+					$.get( "../SystemAOB/functions/file_system/fsexec.php?opr=move&from=" + value + "&target=" + $(DOM).val() + value.replace(/^.*[\\\/]/, ''), function(UUID) {
+						//Return an UUID, can call fsexec.php?listen={uuid} to see the file moving progress
+						if(!UUID.includes("ERROR")){
+							var timer = setInterval(function(){ 
+								$.get( '../SystemAOB/functions/file_system/fsexec.php?listen=["' + UUID + '"]', function(data) {
+									if(data[0][1] == "done"){
+										success += 1;
+										if(success == length){
+											$("#unsortlist").html('<div class="ts card"><div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div></div>');
+											$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+										}
+										if((success + failed) == length){
+											location.reload();
+										}
+										msgbox("Moved " + value.replace(/^.*[\\\/]/, ''));
+										clearInterval(timer);
+									}else if(data[0][1] == "error"){
+										failed += 1;
+										if((success + failed) == length){
+											location.reload();
+										}
+										msgbox("Error moving " + value.replace(/^.*[\\\/]/, ''));
+										clearInterval(timer);
+									}
+								});
+							}, 3000);
+						}else{
+							failed += 1;
+							if((success + failed) == length){
+								location.reload();
+							}
+							msgbox(UUID);
+						}
+					});
+				}
+			});
+		}else{
+			msgbox("Nothing selected");
+		}
+	});
+	
+	$( "select[name='folderdropdown']" ).change(function() {
+		if($(this).val()!==""){
+			var DOM = $(this);
+			$(DOM).parent().parent().parent().append('<div class="ts active inverted dimmer"><div class="ts text loader">Processing...</div></div>');
+			$.get( "../SystemAOB/functions/file_system/fsexec.php?opr=move&from=" + $(this).attr("file") + "&target=" + $(this).val() + $(this).attr("file").replace(/^.*[\\\/]/, ''), function(UUID) {
+				//Return an UUID, can call fsexec.php?listen={uuid} to see the file moving progress
+				if(!UUID.includes("ERROR")){
+					var timer = setInterval(function(){ 
+						$.get( '../SystemAOB/functions/file_system/fsexec.php?listen=["' + UUID + '"]', function(data) {
+							if(data[0][1] == "done"){
+								$(DOM).parent().parent().parent().parent().fadeOut( "slow", function() {
+									$(DOM).parent().parent().parent().parent().remove();
+									if($.trim($("#unsortlist").html()) == ""){
+										$("#unsortlist").html('<div class="ts card"><div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div></div>');
+									}
+								});
+								$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+								msgbox("Success moving " + $(DOM).attr("file").replace(/^.*[\\\/]/, ''));
+								clearInterval(timer);
+							}else if(data[0][1] == "error"){
+								$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+								msgbox("Error moving " + $(DOM).attr("file").replace(/^.*[\\\/]/, ''));
+								clearInterval(timer);
+							}
+						});
+					}, 3000);
+				}else{
+					$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+					msgbox(UUID);
+				}
+			});
+			
+			/*
+			$.post( "mover.php", { opr: 1, files: $(this).attr("file"), dir: $(this).val() },function( data ) {
+				if(data == "DONE"){
+					$(DOM).parent().parent().parent().parent().parent().fadeOut( "slow", function() {
+						$(DOM).parent().parent().parent().parent().parent().remove();
+						if($.trim($("#unsortlist").html()) == ""){
+							$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+						}
+					});
+					msgbox("Finished.");
+				}else{
+					msgbox("Error.");
+				}
+			});
+			*/
+		}else{
+			msgbox("Nothing selected");
+		}
+	});
+
+	$( "button[name='deletefile']" ).click(function() {
+		var DOM = $(this);
+		$.post( "mover.php", { opr: 3, files: $(this).attr("file")},function( data ) {
+			if(data == "DONE"){
+				$(DOM).parent().parent().parent().parent().parent().fadeOut( "slow", function() {
+					$(DOM).parent().parent().parent().parent().parent().remove();
+					if($.trim($("#unsortlist").html()) == ""){
+						$("#unsortlist").html('<div class="ts card"><div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div></div>');
+					}
+				});
+				msgbox("Finished.");
+			}else{
+				msgbox("Error.");
+			}
+		});
+	});
+
+	$( "details" ).click(function() {
+		$("details[open='']").not(this).removeAttr('open');
+	});
+
+	$( ".ts.accordion.item" ).hover(function() {
+		$(".ts.accordion.item").not(this).removeAttr('style');
+		$(this).attr('style',"background-color:#f7f7f7");
+	});
+	
+	if($.trim($("#unsortlist").html()) == ""){
+		$("#unsortlist").html('<div class="ts card"><div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div></div>');
+	}
+}
+
+/*
+    var OldArr = [];
+    var firstInitOldArr = true;
+	setInterval(function(){ 
+		var notmatch = false;
+		$.ajax({url: "Image_manager.php?bkend=true&query=unsort", success: function(result){
+			var resultArr = JSON.parse(result);
+    		if(resultArr.length !== OldArr.length){
+    			 notmatch = true;
+    		}else{
+        		for (var i = 0; resultArr.length < i; i++) {
+        			if (resultArr[i] !== oldArr[i]){
+        				notmatch = true;
+        			}
+        		}
+    		}
+    		if(firstInitOldArr){
+    		    firstInitOldArr = false;
+    		    notmatch = false;
+    		}
+    		if(notmatch){
+    		   	location.reload();
+    		 }
+    		 OldArr = resultArr;
+		}
+		});
+	}, 3000);
+*/
+	
+function submit(){
+	if(storage = $("select[name='storagedropdown']").val() !== ""){
+		var storage = $("select[name='storagedropdown']").val() + "/";
+		if(storage == "internal/"){
+			storage = "storage/";
+		}
+		$.post( "new_folder.php", { storage: storage, name : $("#storagename").val() },function( data ) {
+			if(data == "DONE"){
+				msgbox("Finished.");
+				location.reload();
+			}
+		});
+	}else{
+		msgbox("You must select the directory.");
+	}
+}
+
+function msgbox(content,bgcolor,fontcolor){
+	$(".snackbar").attr("style",'background-color: ' + bgcolor + ';color:' + fontcolor);
+	ts('.snackbar').snackbar({
+		content: content,
+		onAction: () => {
+			$(".snackbar").removeAttr("style");
 		}
-	</script>
-<script src="Image_manager.js"></script>
+	});
+}
+</script>
 </body>
-</html>
+</html>

+ 4 - 2
src/Photo/Image_mover.php

@@ -3,14 +3,16 @@ include '../auth.php';
 ?>
 <?php
 //Image Processing System
-$storage = "storage/";
+if(!isset($_POST["dir"]) || !isset($_POST["files"])){
+	die('FAILED');
+}
 $files = explode(",",$_POST['files']);
 $target = $_POST['dir'];
 $opr = $_POST['opr'];
 foreach ($files as $file){
 	if ($opr == 1 || $opr == 2){
 	//No idea why php rename does the moving job =w=
-		rename($file, str_replace('uploads','storage/' .$target,$file));	
+		rename($file, str_replace(pathinfo($file)['dirname'],$target,$file));	
 	}
 	if ($opr == 3){
 		unlink($file);

二进制
src/Photo/img/pwa/launch-1125x2436.png


二进制
src/Photo/img/pwa/launch-1242x2148.png


二进制
src/Photo/img/pwa/launch-1536x2048.png


二进制
src/Photo/img/pwa/launch-1668x2224.png


二进制
src/Photo/img/pwa/launch-2048x2332.png


二进制
src/Photo/img/pwa/launch-640x1136.png


二进制
src/Photo/img/pwa/launch-750x1294.png


+ 1 - 1
src/Photo/index.js

@@ -34,7 +34,7 @@
 		  }
 		  //Update the folder path shown on file explorer (?
 		  if (folder_path != ""){
-				$('#folderdir').html(folder_path);
+				$('#folderdir').html(ao_module_codec.decodeHexFoldername(folder_path));
 		  }else{
 				$('#folderdir').html('Unsorted');
 		  }

+ 10 - 2
src/Photo/index.php

@@ -119,9 +119,17 @@ include '../auth.php';
 				foreach ($dirs as $folder){
 						$folder = str_replace("storage/","",$folder);
 						if ($folderpath == $folder){
-							echo "<a class='active item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".$folder.'</a>';	
+							if(ctype_xdigit($folder)){
+								echo "<a class='active item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".hex2bin($folder).'</a>';
+							}else{
+								echo "<a class='active item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".$folder.'</a>';
+							}
 						}else{
-							echo "<a class='item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".$folder.'</a>';
+							if(ctype_xdigit($folder)){
+								echo "<a class='item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".hex2bin($folder).'</a>';
+							}else{
+								echo "<a class='item' Onclick='changeFolderView(".'"' . $folder . '"'.")'>".$folder.'</a>';
+							}
 						}
 				}
 			?>

+ 1 - 1
src/Photo/new_folder.php

@@ -7,7 +7,7 @@ $foldername = $_POST['name'];
 $storage = "storage/";
 
 if (file_exists($storage . $foldername . "/") == false){
-	mkdir($storage . $foldername . "/");
+	mkdir($storage . bin2hex($foldername) . "/", 0777);
 	echo 'DONE';
 }
 ?>

+ 1 - 0
src/System Settings/menus/theme.csv

@@ -1,3 +1,4 @@
 paint brush,Personalization
 plgeneral,Desktop Module,SystemAOB/functions/personalization/desktop.php
+usrprefer,User Preference,SystemAOB/functions/personalization/userconfigUI.php
 advconfig,Advanced Configuration,SystemAOB/functions/personalization/sysconfigUI.php

+ 1 - 1
src/System Settings/navi.php

@@ -143,7 +143,7 @@ setContentWidth();
 updateiFrameHeight();
 
 if (isFunctionBar){
-    $("#toggleSideBar").css("bottom","30px");
+    //$("#toggleSideBar").css("bottom","30px");
 }
 
 $( window ).resize(function() {

+ 1 - 0
src/SystemAOB/functions/file_system/default/7z.csv

@@ -0,0 +1 @@
+7-Zip File Manager,embedded,file,,,1,0

+ 1 - 0
src/SystemAOB/functions/file_system/default/md.csv

@@ -0,0 +1 @@
+WriterA,embedded,file,,,1,0

+ 1 - 1
src/SystemAOB/functions/file_system/default/txt.csv

@@ -1 +1 @@
-NotepadA,embedded,file,,,1,0
+WriterA,embedded,file,,,1,0

+ 1 - 0
src/SystemAOB/functions/file_system/default/zip.csv

@@ -0,0 +1 @@
+7-Zip File Manager,embedded,file,,,1,0

+ 1 - 0
src/SystemAOB/functions/file_system/fileoprProgress.php

@@ -232,6 +232,7 @@ if (isset($_GET['download'])){
                        
                         //Check if the generated file is larger than 2GB or not. If larger, use redirect instead of blob
                         $.get("filesize.php?file=" + url + "&raw",function(size){
+                            
                             if (size > 16000000000){ //Larger than 2GB
                                 $("#topBarTitle").text("File Ready!");
                                 $(".oprIcon").attr("src","icon/file_opr/done.png");

+ 8 - 3
src/SystemAOB/functions/personalization/autoConfig.php

@@ -4,13 +4,18 @@ include_once("../../../auth.php");
 //Do not use this for configuration of user settings.
 if (isset($_GET['configName']) && $_GET['configName'] != ""){
     //Generate configuration according to config name
-    //include_once($rootPath . "SystemAOB/functions/user/userIsolation.php");
+    include_once("../user/userIsolation.php");
     //$configPath =  $userConfigDirectory . "SystemAOB/functions/personalization/" . $_GET['configName'] . ".config";
     $configPath =  "sysconf/" . $_GET['configName'] . ".config";
     if (file_exists($configPath)){
-        //Config found in user directory. Go ahead and create UI for it.
+        //Config found in global config directory
         $configContent = file_get_contents($configPath);
-        $config = json_decode($configContent);
+        $config = json_decode($configContent,true);
+	}else if (file_exists($userConfigDirectory . "SystemAOB/sysconf/" . $_GET['configName'] . ".config")){
+		//Config found in user directory. Go ahead and create UI for it.
+		$configPath = $userConfigDirectory . "SystemAOB/sysconf/" . $_GET['configName'] . ".config";
+		$configContent = file_get_contents($configPath);
+		$config = json_decode($configContent,true);
     }else{
         die("ERROR. Config cannot be found.");
     }

+ 15 - 1
src/SystemAOB/functions/personalization/configIO.php

@@ -10,7 +10,7 @@ if (session_status() == PHP_SESSION_NONE) {
     include_once($rootPath . "SystemAOB/functions/user/userIsolation.php");
 }
 //define the config storage path. In normal case, it should be at /etc/AOB/users/{username}/SystemAOB/functions/personalization/
-$configPath =  $userConfigDirectory . "SystemAOB/functions/personalization/";
+$configPath =  $userConfigDirectory . "SystemAOB/sysconf/";
 if (!file_exists($configPath)){
     mkdir($configPath,0777,true);
 }
@@ -57,6 +57,20 @@ function getConfig($configName, $global = false){
     
 }
 
+function listConfig($global = false){
+    //if global is true, search for config inside sysconf instead of the user's private path.
+    global $configPath;
+    global $rootPath;
+    if ($global == true){
+		//Public configs
+        return glob($rootPath . "SystemAOB/functions/personalization/sysconf/*.config");
+    }else{
+        //Private config
+       return glob($configPath . "*.config");
+    }
+    	
+}
+
 
 //functions for Javascript access through GET request
 if (isset($_GET['list']) && $_GET['list'] != ""){

+ 4 - 13
src/SystemAOB/functions/personalization/defaults/function_bar.config

@@ -1,14 +1,5 @@
-{
-  "Function Bar": {
-    "background-color": "#333",
-    "background": "rgba(48,48,48,0.7)"
-  },
-  "Notification Bar": {
-    "background": "rgba(48,48,48,0.7)",
-    "color": "white"
-  },
-  "Resize Indicator": {
-    "color": "white",
-    "background-image": "url(\"img/sys/scalable.png\")"
-  }
+{"fbcolor":["Function Bar Color","Functional menu bar background color in RGBA format, e.g. rgba(48,48,48,0.7)","text","rgba(48,48,48,0.7)"],
+  "nbcolor":["Notification Bar Color","Notification Sidebar color in RGBA format  e.g. rgba(48,48,48,0.7)","text","rgba(48,48,48,0.7)"],
+  "nbfontcolor":["Notification Bar Default Font Color","The default font color for pop-up notification. Default white.","text","white"],
+  "resizeInd":["Resize Indicator Icon","Filepath for the indicator image file.","file","img/sys/scalable.png"]
 }

+ 10 - 3
src/SystemAOB/functions/personalization/settingModifyHandler.php

@@ -1,10 +1,17 @@
 <?php
 include_once("../../../auth.php");
+include_once("../user/userIsolation.php");
 $configName = $_POST["autoConfigBaseConfigurationFilename"];
-if (!file_exists("sysconf/" . $configName . ".config")){
+$configFile = "sysconf/" . $configName . ".config";
+if (file_exists($configFile)){
+	
+}else if (file_exists($userConfigDirectory . "SystemAOB/sysconf/" . $configName . ".config")){
+	$configFile = $userConfigDirectory . "SystemAOB/sysconf/" . $configName . ".config";
+}else{
 	die("ERROR. Required config file not found in default config setting directory.");
 }
-$config = file_get_contents("sysconf/" . $configName . ".config");
+
+$config = file_get_contents($configFile);
 $config = json_decode($config,true);
 //As checkbox will not pass through values, default values for all boolean should be false.
 foreach ($config as $key => $value) {
@@ -24,7 +31,7 @@ foreach ($_POST as $key => $value) {
 	}
 }
 
-file_put_contents("sysconf/" . $configName . ".config",json_encode($config));
+file_put_contents($configFile,json_encode($config));
 header("Location: autoConfig.php?configName=" . $configName . "&update=" . time());
 exit(0);
 

+ 63 - 0
src/SystemAOB/functions/personalization/userConfigUI.php

@@ -0,0 +1,63 @@
+<?php
+include_once("../../../auth.php");
+include_once("configIO.php");
+?>
+<html>
+    <head>
+        <title>User Preference</title>
+        <meta charset="UTF-8">
+        <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+        <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+        <script src="../../../script/jquery.min.js"></script>
+         <script src="../../../script/ao_module.js"></script>
+        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    </head>
+    <body>
+        <br><br>
+	    <div class="ts container">
+			<div class="ts segment">
+				<div class="ts header">
+					<i class="paint brush icon"></i>User Preference and Customization
+					<div class="sub header">Change the system preference to your own needs.</div>
+				</div>
+			</div>
+			<div class="ts inverted info segment">
+                <p><i class="caution sign icon"></i>WARNING! The configuration listed in the table below might be critical to system operations. Invalid settings might lead to system corruption or data lost. Please make sure you know what you are doing when trying to edit any of the settings below and edit at your own risk.</p>
+            </div>
+			<div class="ts segment">
+			    <table class="ts table">
+                    <thead>
+                        <tr>
+                            <th>Config Name</th>
+                            <th>Launch Edit Window</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <?php
+        				    $configs = listConfig(false);
+        				    foreach ($configs as $config){
+        				        echo '<tr>
+                                        <td>' . basename($config) . '</td>
+                                        <td><button class="ts icon basic button configEditor" configName="' .basename($config,".config") .'"><i class="external icon"></i></button></td>
+                                    </tr>';
+        				    }
+        				
+        				?>
+                    </tbody>
+                </table>
+			</div>
+		</div>
+		<script>
+		    $(".configEditor").on("click",function(){
+		        var configName = $(this).attr("configName");
+		        if (ao_module_virtualDesktop){
+		            //Launch in floatWindow
+		             ao_module_newfw("SystemAOB/functions/personalization/autoConfig.php?configName=" + configName,configName.toUpperCase() + "  - AutoConfig", "setting", ao_module_utils.getRandomUID(),600,780);
+		        }else{
+		            //launch with new window / tab
+		           window.open("autoConfig.php?configName=" + configName);
+		        }
+		    });
+		</script>
+	</body>
+</html>

+ 0 - 1
src/SystemAOB/system/jwt/tokenDB/189f862f386c954aeda39f45b1e931fe40100d8f7f34d0c79587e0c2779943f2be31e8cd903d01df868c7628fe6339bfb7ed06aef4e629e79f669b01de0e6fb3.atok

@@ -1 +0,0 @@
-["189f862f386c954aeda39f45b1e931fe40100d8f7f34d0c79587e0c2779943f2be31e8cd903d01df868c7628fe6339bfb7ed06aef4e629e79f669b01de0e6fb3",1564647127,3600]

+ 387 - 198
src/Video/manager.php

@@ -1,5 +1,85 @@
 <?php
 include '../auth.php';
+if(isset($_GET["bkend"])){
+	if(isset($_GET["query"])){
+		if($_GET["query"] == "playlist"){
+			$intdirs = array_filter(glob("playlist/" . "*"), 'is_dir');
+			$IntDirWInfo = [];
+			foreach ($intdirs as &$intdir) {
+				preg_match('/playlist\/([^\/]*)/', $intdir, $out_playlist);
+				$tmp = [];
+				if(ctype_xdigit($out_playlist[1])){
+					$tmp["name"] = "Internal - ".hex2bin($out_playlist[1]);
+				}else{
+					$tmp["name"] = "Internal - ".$out_playlist[1];
+				}
+				$tmp["dir"] = "../../../Video/".$intdir."/";
+				$tmp["drive"] = "internal";
+				$tmp["playlist"] = $out_playlist[1];
+				array_push($IntDirWInfo,$tmp);
+			}
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$ExtDirWInfo = []; //TODO: add ext support
+			}else{
+				if (file_exists("/media/")){
+					$extdirs = array_filter(glob("/media/*/Video/*"), 'is_dir');
+					$ExtDirWInfo = [];
+					foreach ($extdirs as &$extdir) {
+						preg_match('/\/media\/([^\/]*)\//', $extdir, $out_storage);
+						preg_match('/Video\/([^\/]*)/', $extdir, $out_playlist);
+						$tmp = [];
+						if(ctype_xdigit($out_playlist[1])){
+							$tmp["name"] = $out_storage[1]." - ".hex2bin($out_playlist[1]);
+						}else{
+							$tmp["name"] = $out_storage[1]." - ".$out_playlist[1];
+						}
+						$tmp["dir"] = $extdir."/";
+						$tmp["drive"] = $out_storage[1];
+						$tmp["playlist"] = $out_playlist[1];
+						array_push($ExtDirWInfo,$tmp);
+					}
+				}
+			}
+			$dirs = array_merge($IntDirWInfo,$ExtDirWInfo);
+			echo json_encode($dirs);
+		}else if($_GET["query"] == "storage"){
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$extdirs = [];
+			}else{
+				$extdirs = array_filter(glob("/media/*"), 'is_dir');
+			}
+			$dirs = array_merge($extdirs,["internal"]);
+			echo json_encode($dirs);
+		}else if($_GET["query"] == "unsort"){
+			$intdirs = glob('uploads/*.mp4', GLOB_BRACE);
+			$IntDirWInfo = [];
+			foreach ($intdirs as &$intdir) {
+				$tmp = [];
+				$tmp["dir"] = "../../../Video/".$intdir;
+				$tmp["drive"] = "internal";
+				array_push($IntDirWInfo,$tmp);
+			}
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$ExtDirWInfo = []; //TODO: add ext support
+			}else{
+				if (file_exists("/media/")){
+					$extdirs = glob("/media/*/Video/*.mp4");
+					$ExtDirWInfo = [];
+					foreach ($extdirs as &$extdir) {
+						preg_match('/\/media\/([^\/]*)\//', $extdir, $out_storage);
+						$tmp = [];
+						$tmp["dir"] = $extdir;
+						$tmp["drive"] = $out_storage[1];
+						array_push($ExtDirWInfo,$tmp);
+					}
+				}
+			}
+			$dirs = array_merge($IntDirWInfo,$ExtDirWInfo);
+			echo json_encode($dirs);
+		}
+	}
+	die();
+}
 ?>
 <!DOCTYPE html>
 <html>
@@ -8,219 +88,328 @@ include '../auth.php';
 	<script src="../script/jquery.min.js"></script>
     <link rel="stylesheet" href="../script/tocas/tocas.css">
 	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
+	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 	<title>ArOZ Onlineβ</title>
+	<style>
+		body{
+			background:rgba(245,245,245,0.8);
+		}
+		@media (max-width: 767px){
+			.ts.bottom.right.snackbar.active{
+				width: 100% !important;
+				bottom: 0px !important;
+				right: 0px !important;
+			}
+		}
+	</style>
 </head>
 <body>
-<?php
-function formatBytes($size, $precision = 2)
-			{
-				$base = log($size, 1024);
-				$suffixes = array('Byte', 'KB', 'MB', 'GB', 'TB');   
-
-				return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
-			}
-?>
-    <nav class="ts attached inverted borderless normal menu">
-        <div class="ts narrow container">
-            <a href="../" class="item">ArOZ Onlineβ</a>
-        </div>
-    </nav>
-	<br>
-
-    <div class="ts fluid container">
-
-        <div class="ts breadcrumb">
-			<a href="index.php" class="section"><i class="arrow left icon"></i>Back</a>
-            <div class="divider">/</div>
-            <div class="section"><i class="folder icon"></i>Video Bank File Management System</div>
-            <div class="divider">/</div> 
-            
-        </div>
-
-		<div align="center"><i class="chevron right icon"></i><i class="chevron right icon"></i><i class="chevron right icon"></i><i class="chevron right icon"></i></div>
-
-        <div class="ts grid">
-			<!-- Left file browsing zone -->
-	
-            <div class="six wide column" style="overflow:hidden;">
-				<div id="imagelist" class="ts form">
-					 <div class="ts selection segmented list">
-					 <?php
-						$leftTemplate='<div class="item" style="overflow: hide;">
-											<div class="ts checkbox">
-												<input id="%FILE_ID%" name="box2check" type="checkbox" onClick="showPreview('."'"."%FILE_ID%"."'".')">
-												<label for="%FILE_ID%">%FILE_NAME%</label>
-												<div id="%FILE_ID%-ext" style="display:none;">%FILE_EXTENSION%</div>
-												<div id="%FILE_ID%-ofn" style="display:none;">%ORIGINAL_FILENAME%</div>
-												<div id="%FILE_ID%-rfp" style="display:none;">%FILE_PATH%</div>
-												<div id="%FILE_ID%-size" style="display:none;">%FILE_SIZE%</div>
-											</div>
-										</div>';
-						$files = glob('uploads/*.mp4', GLOB_BRACE);
-						foreach($files as $file){
-							$filename = basename($file);
-							$ext = pathinfo($file, PATHINFO_EXTENSION);
-							$orgfilename = str_replace("." . $ext,"",str_replace("inith","",basename($file)));
-							$orgfilename = hex2bin($orgfilename);
-							$lbox = str_replace("%FILE_ID%",str_replace(".","-dot-",str_replace("/","-slash-",$file)),$leftTemplate);
-							$lbox = str_replace("%FILE_NAME%",$filename,$lbox);
-							$lbox = str_replace("%ORIGINAL_FILENAME%",$orgfilename,$lbox);
-							$lbox = str_replace("%FILE_PATH%",$file,$lbox);
-							$lbox = str_replace("%FILE_EXTENSION%",$ext,$lbox);
-							$lbox = str_replace("%FILE_SIZE%",formatBytes(filesize($file)),$lbox);
-							echo $lbox;
-						}
-					?>
-					</div>	
-				</div>	
-			</div>
-			
-
-			<!-- Center file browsing zone -->
-            <div class="four wide column">
-                <div class="ts card">
-					<!-- Image preview -->
-                    <div class="secondary very padded extra content">
-                        <div class="ts icon header">
-                            <img id="previewWindow" class="ts medium image" src="img/function_icon.png"></img>
-                        </div>
-                    </div>
-
-
-					<!-- File Information -->
-                    <div class="extra content">
-                        <div class="header" id="ImageName">Video Bank File Management System</div>
-                    </div>
-					<div align="center">
-						<div class="ts icon buttons">
-							<button id="btn1" class="ts button" onclick="TogglePreview()"><i class="mouse pointer icon"></i><i class="eye icon"></i></button>
-							<button id="btn2" class="ts button" onClick="MoveFile(1);"><i class="checkmark box icon"></i><i class="arrow right center icon"></i></button>
-							<button id="btn3" class="ts button" onClick="MoveFile(2);"><i class="folder outline icon"></i><i class="arrow right center icon"></i></button>
-							<button id="btn4" class="ts negative button" onClick="MoveFile(3)"><i class="checkmark box icon"></i><i class="trash outline icon"></i></button>
-						</div>
-					</div>
-
-                    <div class="extra content">
-                        <div class="ts list">
-
-                            <div class="item">
-                                <i class="file outline icon"></i>
-                                <div class="content">
-                                    <div class="header">File Extension</div>
-                                    <div id="fileext" class="description">/</div>
-                                </div>
-                            </div>
-
-
-
-                            <div class="item">
-                                <i class="terminal icon"></i>
-                                <div class="content">
-                                    <div class="header">Storage Name</div>
-                                    <div id="storagename" class="description">/</div>
-                                </div>
-                            </div>
- 
-
-
-                            <div class="item">
-                                <i class="image icon"></i>
-                                <div class="content">
-                                    <div class="header">File Size</div>
-                                    <div id="imgsize" class="description">/</div>
-                                </div>
-                            </div>
-
-							
-							
-							<div class="item">
-                                <i class="folder icon"></i>
-                                <div class="content">
-                                    <div class="header">Target Folder</div>
-                                    <div id="targetdir" class="description">/</div>
-                                </div>
-                            </div>
-							
-                        </div>
-                    </div>
-					<!-- Functional Butons -->
-					<div align="center">
-					<div class="ts icon buttons">
-						<button class="ts button" OnClick="toggle();"><i class="checkmark box icon"></i>All</button>
-						<button class="ts button" OnClick="toggleFalse();"><i class="square outline icon"></i>All</button>
-						<button class="ts button" OnClick="newfolder()"><i class="folder outline icon"></i>New</button>
-						<button class="ts button" OnClick="done();"><i class="checkmark icon"></i>DONE</button>
-					</div>
-					</div>
-                </div>
-                <div class="ts horizontal right floated middoted link list">
-                    <div class="item">CopyRight IMUS Laboratory</div>
-                </div>
-            </div>
-			
-			<!-- Right file browsing zone -->
-            <div class="six wide column">
-                <div class="ts selection segmented list">
-					<div id="filenamer" class="item" style="display:none;">
-						<div class="ts fluid borderless icon input">
-							<input id="fileNameInput" type="text" placeholder="New Folder">
-							<i class="folder outline icon"></i>
-						</div>
-					</div>
-					<?php
-					$storagedir = "playlist/";
-					echo '<a class="item">
-								<i class="folder open icon"></i>
-								playlist/
-								</a>';
-					$rightTemplate=' <a id="%FOLDER_ID%" class="item" onClick="%FUNCTION_CALL%">
-								&nbsp&nbsp&nbsp
-								<i class="folder icon"></i>
-								%FOLDER_NAME%
-								</a>';
-					$dirs = array_filter(glob($storagedir . "*"), 'is_dir');
-					foreach($dirs as $dir){
-						$foldername = str_replace($storagedir,"",$dir);
-						$rbox = str_replace("%FUNCTION_CALL%","selectFolder('$foldername')",$rightTemplate);
-						$rbox = str_replace("%FOLDER_NAME%",hex2bin($foldername),$rbox);
-						$rbox = str_replace("%FOLDER_ID%",$foldername,$rbox);
-						echo $rbox;
-					}
-					
-					?>
-                    
-                </div>
-
+<nav class="ts attached borderless small menu">
+            <a id="rtiBtn" href="index.php" class="item"><i class="angle left icon"></i></a>
+            <a href="" class="item">ArOZ Video</a>
+            <div class="right menu">
+				<a onclick="ts('#AddPlaylistModal').modal('show')" class="item"><i class="add outline icon"></i></a>
+		    	<a href="../Upload Manager/upload_interface.php?target=Video&filetype=mp4" class="item"><i class="upload icon"></i></a>
+			    <a href="manager.php" class="item"><i class="folder open outline icon"></i></a>
             </div>
+</nav>
+<br>
+<div class="ts container">
+<div class="ts inverted segment">
+	<p>Batch moving :
+	<select class="ts basic dropdown" name="batchfolderdropdown">
+		<option>Select</option>
+	</select>
+	<button name="batchfolderbutton" class="ts button"><i class="move icon"></i>Move</button>
+	<button onclick="ts('#AddPlaylistModal').modal('show')" class="ts right floated button"><i class="add icon"></i>New folder</button>
+	</p>
+</div>
 
-        </div>
+	<div class="ts segmented list" id="unsortlist">
 
-    </div>
-	<!-- Notifier Div-->
-	<div id="nfb" class="ts active bottom right snackbar" style="display:none;">
-		<div id="nfbtxt" class="content">
-			Loading...
-		</div>
-		<a class="primary action" onclick="$('#nfb').fadeOut('slow');">Close</a>
 	</div>
-	<!-- Action Confirm div-->
-	<dialog id="confirmbox" class="ts basic fullscreen modal" style="display:none; background:rgba(0,0,0,0.7);position:fixed;top:100px;height:60%" open>
-		<div class="ts icon header">
-			<i class="exchange icon"></i>File Operation Confirmation
+</div>
+
+<div class="ts modals dimmer">
+	<dialog id="AddPlaylistModal" class="ts fullscreen modal" open>
+		<div class="header">
+			Create new playlist
 		</div>
-		<div id="confirminfo" class="content" style="overflow-y: scroll;min-height:60%">
-			<p></p>
+		<div class="content">
+			<div class="ts form">
+			    <div class="field">
+					<label>Storage</label>
+					<select name="storagedropdown">
+						<option>Select</option>
+					</select>
+				</div>
+				<div class="field">
+					<label>New playlist name</label>
+					<input type="text" id="playlistname">
+					<small></small>
+				</div>
+			</div>
 		</div>
 		<div class="actions">
-			<button class="ts inverted basic deny button" onClick="$('#confirmbox').fadeOut('slow');">
+			<button class="ts deny button">
 				Cancel
 			</button>
-			<button class="ts inverted basic positive button" OnClick="ConfirmAction();">
+			<button class="ts positive button" onclick="submit()">
 				Confirm
 			</button>
 		</div>
 	</dialog>
+</div>
+<br><br><br><br>
+<div class="ts bottom right snackbar">
+    <div class="content"></div>
+</div>
+<script>
+//Bind enter key to the input bar
+$("#playlistname").on("keydown",function(e){
+	if (e.keyCode == 13){
+		submit();
+	}
+});
+
+//first script to run
+$.ajax({url: "manager.php?bkend=true&query=unsort", success: function(result){
+	var resultArr = JSON.parse(result);
+	var allfile = "";
+	$.each(resultArr, function( index, value ) {
+		if(value["drive"] !== "internal"){
+			var drivename = '<div class="ts horizontal right floated label"><i class="usb icon"></i>' + value["drive"] + '</div>';
+		}else{
+			var drivename = '';
+		}
+		$("#unsortlist").append('<details class="ts accordion item" id="' + value["dir"] + '"><summary><i class="dropdown icon"></i>' + ao_module_codec.decodeUmFilename(value["dir"].replace(/^.*[\\\/]/, '')) + drivename + '</summary><div class="content"><div class="ts segmented list" style="padding: 10px;"><div class="ts item"><p><i class="move icon"></i>Move to  <select class="ts basic dropdown" name="folderdropdown" file="' + value["dir"] + '" storage="' + value["drive"] + '"><option>Select</option></select></p></div><div class="ts item"><button name="deletefile"  file="' + value["dir"] + '" class="ts mini very compact negative button"><i class="delete icon"></i>Delete</button></div></div></div></details>');
+		allfile += value["dir"] + ",";
+	});
+	$("select[name='batchfolderdropdown']").attr("file",allfile.substr(0,allfile.length -1));
+	step2();
+}});
+
+function step2(){
+	$.ajax({url: "manager.php?bkend=true&query=playlist", success: function(result){
+		var resultArr = JSON.parse(result);
+		$("select[name='folderdropdown']").html("");
+		$("select[name='folderdropdown']").append(new Option("Select",""));
+		
+		$("select[name='batchfolderdropdown']").html("");
+		$("select[name='batchfolderdropdown']").append(new Option("Select",""));		
+		$.each(resultArr, function( index, value ) {
+			$("select[name='folderdropdown'][storage='" + value["drive"] + "']").append(new Option(value["name"],value["dir"]));
+			$("select[name='batchfolderdropdown']").append(new Option(value["name"],value["dir"]));
+		});
+		
+		step3();
+	}});
+}
+
+function step3(){
+	$.ajax({url: "manager.php?bkend=true&query=storage", success: function(result){
+		var resultArr = JSON.parse(result);
+		$("select[name='storagedropdown']").html("");
+		$("select[name='storagedropdown']").append(new Option("Select",""));
+		$.each(resultArr, function( index, value ) {
+			$("select[name='storagedropdown']").append(new Option(value,value));
+		});
+	}});
 	
-<script src="manager.js"></script>
+	step4();
+}
+
+function step4(){
+	$( "button[name='batchfolderbutton']" ).click(function() {
+		if($("select[name='batchfolderdropdown']").val()!==""){
+			var Arr = $("select[name='batchfolderdropdown']").attr("file").split(",");
+			var DOM = $("select[name='batchfolderdropdown']");
+			
+			var length = Arr.length;
+			var success = 0;
+			var failed = 0;
+			
+			$.each(Arr, function( index, value ) {
+				if(value!== ""){
+					$(DOM).parent().parent().parent().append('<div class="ts active inverted dimmer"><div class="ts text loader" id="processingtext">Processing...</div></div>');
+					$.get( "../SystemAOB/functions/file_system/fsexec.php?opr=move&from=" + value + "&target=" + $(DOM).val() + value.replace(/^.*[\\\/]/, ''), function(UUID) {
+						//Return an UUID, can call fsexec.php?listen={uuid} to see the file moving progress
+						if(!UUID.includes("ERROR")){
+							var timer = setInterval(function(){ 
+								$.get( '../SystemAOB/functions/file_system/fsexec.php?listen=["' + UUID + '"]', function(data) {
+									if(data[0][1] == "done"){
+										success += 1;
+										if(success == length){
+											$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+											$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+										}
+										if((success + failed) == length){
+											location.reload();
+										}
+										msgbox("Moved " + value.replace(/^.*[\\\/]/, ''));
+										clearInterval(timer);
+									}else if(data[0][1] == "error"){
+										failed += 1;
+										if((success + failed) == length){
+											location.reload();
+										}
+										msgbox("Error moving " + value.replace(/^.*[\\\/]/, ''));
+										clearInterval(timer);
+									}
+								});
+							}, 3000);
+						}else{
+							failed += 1;
+							if((success + failed) == length){
+								location.reload();
+							}
+							msgbox(UUID);
+						}
+					});
+				}
+			});
+		}else{
+			msgbox("Nothing selected");
+		}
+	});
+	
+	$( "select[name='folderdropdown']" ).change(function() {
+		if($(this).val()!==""){
+			var DOM = $(this);
+			$(DOM).parent().parent().parent().append('<div class="ts active inverted dimmer"><div class="ts text loader">Processing...</div></div>');
+			$.get( "../SystemAOB/functions/file_system/fsexec.php?opr=move&from=" + $(this).attr("file") + "&target=" + $(this).val() + $(this).attr("file").replace(/^.*[\\\/]/, ''), function(UUID) {
+				//Return an UUID, can call fsexec.php?listen={uuid} to see the file moving progress
+				if(!UUID.includes("ERROR")){
+					var timer = setInterval(function(){ 
+						$.get( '../SystemAOB/functions/file_system/fsexec.php?listen=["' + UUID + '"]', function(data) {
+							if(data[0][1] == "done"){
+								$(DOM).parent().parent().parent().parent().parent().fadeOut( "slow", function() {
+									$(DOM).parent().parent().parent().parent().parent().remove();
+									if($.trim($("#unsortlist").html()) == ""){
+										$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+									}
+								});
+								$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+								msgbox("Success moving " + value.replace(/^.*[\\\/]/, ''));
+								clearInterval(timer);
+							}else if(data[0][1] == "error"){
+								$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+								msgbox("Error moving " + value.replace(/^.*[\\\/]/, ''));
+								clearInterval(timer);
+							}
+						});
+					}, 3000);
+				}else{
+					$(DOM).parent().parent().parent().find(".ts.active.inverted.dimmer").remove();
+					msgbox(UUID);
+				}
+			});
+			
+			/*
+			$.post( "mover.php", { opr: 1, files: $(this).attr("file"), dir: $(this).val() },function( data ) {
+				if(data == "DONE"){
+					$(DOM).parent().parent().parent().parent().parent().fadeOut( "slow", function() {
+						$(DOM).parent().parent().parent().parent().parent().remove();
+						if($.trim($("#unsortlist").html()) == ""){
+							$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+						}
+					});
+					msgbox("Finished.");
+				}else{
+					msgbox("Error.");
+				}
+			});
+			*/
+		}
+	});
+
+	$( "button[name='deletefile']" ).click(function() {
+		var DOM = $(this);
+		$.post( "mover.php", { opr: 3, files: $(this).attr("file")},function( data ) {
+			if(data == "DONE"){
+				$(DOM).parent().parent().parent().parent().parent().fadeOut( "slow", function() {
+					$(DOM).parent().parent().parent().parent().parent().remove();
+					if($.trim($("#unsortlist").html()) == ""){
+						$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+					}
+				});
+				msgbox("Finished.");
+			}else{
+				msgbox("Error.");
+			}
+		});
+	});
+
+	$( "details" ).click(function() {
+		$("details[open='']").not(this).removeAttr('open');
+	});
+
+	$( ".ts.accordion.item" ).hover(function() {
+		$(".ts.accordion.item").not(this).removeAttr('style');
+		$(this).attr('style',"background-color:#f7f7f7");
+	});
+	
+	if($.trim($("#unsortlist").html()) == ""){
+		$("#unsortlist").html('<div class="ts slate accordion item"><i class="notice circle icon"></i><span class="header">No file unsorted</span><span class="description">Upload some files to here :)</span></div>');
+	}
+}
+
+/*
+    var OldArr = [];
+    var firstInitOldArr = true;
+	setInterval(function(){ 
+		var notmatch = false;
+		$.ajax({url: "manager.php?bkend=true&query=unsort", success: function(result){
+			var resultArr = JSON.parse(result);
+    		if(resultArr.length !== OldArr.length){
+    			 notmatch = true;
+    		}else{
+        		for (var i = 0; resultArr.length < i; i++) {
+        			if (resultArr[i] !== oldArr[i]){
+        				notmatch = true;
+        			}
+        		}
+    		}
+    		if(firstInitOldArr){
+    		    firstInitOldArr = false;
+    		    notmatch = false;
+    		}
+    		if(notmatch){
+    		   	location.reload();
+    		 }
+    		 OldArr = resultArr;
+		}
+		});
+	}, 3000);
+*/
+	
+function submit(){
+	if(storage = $("select[name='storagedropdown']").val() !== ""){
+		var storage = $("select[name='storagedropdown']").val() + "/";
+		if(storage == "internal/"){
+			storage = "playlist/";
+		}
+		$.post( "new_folder.php", { storage: storage, name : $("#playlistname").val() },function( data ) {
+			if(data == "DONE"){
+				msgbox("Finished.");
+				location.reload();
+			}
+		});
+	}else{
+		msgbox("You must select the directory.");
+	}
+}
+
+function msgbox(content,bgcolor,fontcolor){
+	$(".snackbar").attr("style",'background-color: ' + bgcolor + ';color:' + fontcolor);
+	ts('.snackbar').snackbar({
+		content: content,
+		onAction: () => {
+			$(".snackbar").removeAttr("style");
+		}
+	});
+}
+</script>
 </body>
-</html>
+</html>

+ 10 - 2
src/Video/mover.php

@@ -2,15 +2,23 @@
 include '../auth.php';
 ?>
 <?php
+/*
+In 2019/8/18 21:36PDT, opr == 2 has been deprecated and reduced to 2 opr only
+keeping opr == 2 only for unexpected
+1 = move
+3 = delete
+*/
 //Video Processing System
-$storage = "playlist/";
+if(!isset($_POST["dir"]) || !isset($_POST["files"])){
+	die('FAILED');
+}
 $files = explode(",",$_POST['files']);
 $target = $_POST['dir'];
 $opr = $_POST['opr'];
 foreach ($files as $file){
 	if ($opr == 1 || $opr == 2){
 	//No idea why php rename does the moving job =w=
-		rename($file, str_replace('uploads',$storage .$target,$file));	
+		rename($file, str_replace(pathinfo($file)['dirname'],$target,$file));	
 	}
 	if ($opr == 3){
 		unlink($file);

+ 2 - 2
src/Video/new_folder.php

@@ -4,10 +4,10 @@ include '../auth.php';
 <?php
 //New Folder Creation PHP
 $foldername = $_POST['name'];
-$storage = "playlist/";
+$storage = $_POST['storage'];
 
 if (file_exists($storage . $foldername . "/") == false){
-	mkdir($storage . bin2hex($foldername) . "/");
+	mkdir($storage . bin2hex($foldername) . "/", 0777);
 	echo 'DONE';
 }
 ?>

+ 1 - 0
src/Video/playlist/.nomedia

@@ -0,0 +1 @@
+ 

+ 1 - 1
src/Video/vidPlay.php

@@ -15,8 +15,8 @@ include_once '../auth.php';
     <meta charset="UTF-8">
 	<script src="../script/jquery.min.js"></script>
     <link rel="stylesheet" href="../script/tocas/tocas.css">
+    <script type='text/javascript' src="../script/ao_module.js"></script>
 	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
-	<script type='text/javascript' src="../script/ao_module.js"></script>
 	<title>ArOZ Onlineβ</title>
 	<style>
 	    body{

+ 14 - 8
src/function_bar.php

@@ -2,10 +2,17 @@
 include_once 'auth.php';
 ?>
 <html>
+<!DOCTYPE HTML>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=0.7, shrink-to-fit=no">
+<title>ArOZ Onlineβ</title>
+<link rel="stylesheet" href="script/tocas/tocas.css">
+<script src="script/tocas/tocas.js"></script>
+<script src="script/jquery.min.js"></script>
+</head>
 <?php
-include_once("header_std.php");
 include_once("SystemAOB/functions/personalization/configIO.php");
-$theme = (getConfig("function_bar"));
+$theme = (getConfig("function_bar",false));
 ?>
 <link rel="stylesheet" type="text/css" href="script/jsCalendar/jsCalendar.css">
 <link rel="stylesheet" type="text/css" href="script/jsCalendar/jsCalendar.clean.min.css">
@@ -20,12 +27,12 @@ body{
 }
 #menuBar{
 	overflow: hidden;
-	background-color: <?php echo $theme["Function Bar"]["background-color"];?>;
 	position: fixed;
 	bottom: 0;
 	width: 100%;
 	z-index:110;
-	background:<?php echo $theme["Function Bar"]["background"];?>;
+	color: #333;
+	background:<?php echo $theme["fbcolor"][3];?>;
 	
 }
 .notificationbar{
@@ -35,12 +42,12 @@ body{
 	height: auto;
 	width:350px;
 	bottom: 34px;
-	background:<?php echo $theme["Notification Bar"]["background"];?>;
+	background:<?php echo $theme["nbcolor"][3];?>;
 	right:0px;
 	border-left: 1px solid #4c4c4c;
 	padding: 20px;
 	padding-left: 25px;
-	color: <?php echo $theme["Notification Bar"]["color"];?>;
+	color: <?php echo $theme["nbfontcolor"][3];?>;
 }
 
 .messagebox{
@@ -77,9 +84,8 @@ body{
 	bottom:0;
 	width:20px;
 	height:15px;
-	color:<?php echo $theme["Resize Indicator"]["color"];?>;
 	cursor: nw-resize;
-	background-image:<?php echo $theme["Resize Indicator"]["background-image"];?>;
+	background-image:url(<?php echo $theme["resizeInd"][3];?>);
 }
 
 .selectable{

+ 0 - 11
src/header_std.php

@@ -1,11 +0,0 @@
-<?php
-//include 'auth.php';
-?>
-<!DOCTYPE HTML>
-<head>
-<meta name="viewport" content="width=device-width, initial-scale=0.7, shrink-to-fit=no">
-<title>ArOZ Onlineβ</title>
-<link rel="stylesheet" href="script/tocas/tocas.css">
-<script src="script/tocas/tocas.js"></script>
-<script src="script/jquery.min.js"></script>
-</head>

+ 9 - 2
src/index.php

@@ -1,9 +1,16 @@
 <?php
-include 'auth.php';
+include_once 'auth.php';
 ?>
 <html>
+<!DOCTYPE HTML>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=0.7, shrink-to-fit=no">
+<title>ArOZ Onlineβ</title>
+<link rel="stylesheet" href="script/tocas/tocas.css">
+<script src="script/tocas/tocas.js"></script>
+<script src="script/jquery.min.js"></script>
+</head>
 <?php
-include_once("header_std.php");
 include_once("SystemAOB/functions/personalization/configIO.php");
 $indexConfig = getConfig("index",true);
 //Folders that exclude in the function arranging process.