Procházet zdrojové kódy

Upload files to 'Video'

Yeung Alan před 5 roky
rodič
revize
a3d314b440
1 změnil soubory, kde provedl 48 přidání a 27 odebrání
  1. 48 27
      Video/manager.php

+ 48 - 27
Video/manager.php

@@ -9,7 +9,7 @@ if(isset($_GET["bkend"])){
 				preg_match('/playlist\/([^\/]*)/', $intdir, $out_playlist);
 				$tmp = [];
 				$tmp["name"] = "Internal - ".hex2bin($out_playlist[1]);
-				$tmp["dir"] = $intdir;
+				$tmp["dir"] = "../../../Video/".$intdir."/";
 				$tmp["drive"] = "internal";
 				$tmp["playlist"] = $out_playlist[1];
 				array_push($IntDirWInfo,$tmp);
@@ -25,7 +25,7 @@ if(isset($_GET["bkend"])){
 						preg_match('/Video\/([^\/]*)/', $extdir, $out_playlist);
 						$tmp = [];
 						$tmp["name"] = $out_storage[1]." - ".hex2bin($out_playlist[1]);
-						$tmp["dir"] = $extdir;
+						$tmp["dir"] = $extdir."/";
 						$tmp["drive"] = $out_storage[1];
 						$tmp["playlist"] = $out_playlist[1];
 						array_push($ExtDirWInfo,$tmp);
@@ -43,7 +43,7 @@ if(isset($_GET["bkend"])){
 			$IntDirWInfo = [];
 			foreach ($intdirs as &$intdir) {
 				$tmp = [];
-				$tmp["dir"] = $intdir;
+				$tmp["dir"] = "../../../Video/".$intdir;
 				$tmp["drive"] = "internal";
 				array_push($IntDirWInfo,$tmp);
 			}
@@ -80,9 +80,6 @@ if(isset($_GET["bkend"])){
 	<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;
@@ -104,7 +101,7 @@ if(isset($_GET["bkend"])){
 </nav>
 <br>
 <div class="ts container">
-<div class="ts inverted segment">
+<div class="ts inverted info segment">
 	<p>Batch moving :
 	<select class="ts basic dropdown" name="batchfolderdropdown">
 		<option>Select</option>
@@ -147,7 +144,6 @@ if(isset($_GET["bkend"])){
 		</div>
 	</dialog>
 </div>
-<br><br><br><br>
 <div class="ts bottom right snackbar">
     <div class="content"></div>
 </div>
@@ -169,13 +165,6 @@ $.ajax({url: "manager.php?bkend=true&query=unsort", success: function(result){
 	step2();
 }});
 
-//Bind enter key to the input bar
-$("#playlistname").on("keydown",function(e){
-	if (e.keyCode == 13){
-		submit();
-	}
-});
-
 function step2(){
 	$.ajax({url: "manager.php?bkend=true&query=playlist", success: function(result){
 		var resultArr = JSON.parse(result);
@@ -208,13 +197,28 @@ function step3(){
 
 function step4(){
 	$( "select[name='batchfolderdropdown']" ).change(function() {
+		var Arr = $(this).attr("file").split(",");
 		var DOM = $(this);
-		$.post( "mover.php", { opr: 1, files: $(this).attr("file"), dir: $(this).val() },function( data ) {
-			if(data == "DONE"){
-				$("#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.");
+		$.each(Arr, function( index, value ) {
+			if(value!== ""){
+				$.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"){
+									$("#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("Success");
+									clearInterval(timer);
+								}else if(data[0][1] == "error"){
+									clearInterval(timer);
+								}
+							});
+						}, 3000);
+					}else{
+						msgbox(UUID);
+					}
+				});
 			}
 		});
 	});
@@ -222,15 +226,31 @@ function step4(){
 	$( "select[name='folderdropdown']" ).change(function() {
 		if($(this).val()!==""){
 			var DOM = $(this);
-			//Try to replace this with the new File System fsexec.php?
-			/*
-			Usage: 
-			$.get( "fsexec.php?opr=move&from=" + {source(From file_system folder or realpath)} + "&target=" + {target(From file_system folder or realpath)}, function(data) {
+			$.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>');
+									}
+								});
+								msgbox("Success");
+								clearInterval(timer);
+							}else if(data[0][1] == "error"){
+								clearInterval(timer);
+							}
+						});
+					}, 3000);
+				}else{
+					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() {
@@ -244,6 +264,7 @@ function step4(){
 					msgbox("Error.");
 				}
 			});
+			*/
 		}
 	});