Browse Source

Upload files to 'Photo'

Yeung Alan 5 years ago
parent
commit
04edd0301d
1 changed files with 60 additions and 53 deletions
  1. 60 53
      Photo/Image_manager.php

+ 60 - 53
Photo/Image_manager.php

@@ -6,28 +6,28 @@ if(isset($_GET["bkend"])){
 			$intdirs = array_filter(glob("storage/" . "*"), 'is_dir');
 			$IntDirWInfo = [];
 			foreach ($intdirs as &$intdir) {
-				preg_match('/storage\/([^\/]*)/', $intdir, $out_storage);
+				preg_match('/storage\/([^\/]*)/', $intdir, $out_playlist);
 				$tmp = [];
-				$tmp["name"] = "Internal - ".$out_storage[1];
-				$tmp["dir"] = "../../../Photo/".$intdir."/";
+				$tmp["name"] = "Internal - ".hex2bin($out_playlist[1]);
+				$tmp["dir"] = "../../../Video/".$intdir."/";
 				$tmp["drive"] = "internal";
-				$tmp["storage"] = $out_storage[1];
+				$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/*/Photo/*"), 'is_dir');
+					$extdirs = array_filter(glob("/media/*/Video/*"), 'is_dir');
 					$ExtDirWInfo = [];
 					foreach ($extdirs as &$extdir) {
 						preg_match('/\/media\/([^\/]*)\//', $extdir, $out_storage);
-						preg_match('/Photo\/([^\/]*)/', $extdir, $out_storage);
+						preg_match('/Video\/([^\/]*)/', $extdir, $out_playlist);
 						$tmp = [];
-						$tmp["name"] = $out_storage[1]." - ".$out_storage[1];
+						$tmp["name"] = $out_storage[1]." - ".hex2bin($out_playlist[1]);
 						$tmp["dir"] = $extdir."/";
 						$tmp["drive"] = $out_storage[1];
-						$tmp["storage"] = $out_storage[1];
+						$tmp["playlist"] = $out_playlist[1];
 						array_push($ExtDirWInfo,$tmp);
 					}
 				}
@@ -95,7 +95,7 @@ if(isset($_GET["bkend"])){
 <body>
 <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 Photo</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>
@@ -110,6 +110,7 @@ if(isset($_GET["bkend"])){
 		<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>
 
@@ -209,52 +210,56 @@ function step3(){
 
 function step4(){
 	$( "button[name='batchfolderbutton']" ).click(function() {
-		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();
+		if($(this).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);
 									}
-									msgbox("Error moving " + value.replace(/^.*[\\\/]/, ''));
-									clearInterval(timer);
-								}
-							});
-						}, 3000);
-					}else{
-						failed += 1;
-						if((success + failed) == length){
-							location.reload();
+								});
+							}, 3000);
+						}else{
+							failed += 1;
+							if((success + failed) == length){
+								location.reload();
+							}
+							msgbox(UUID);
 						}
-						msgbox(UUID);
-					}
-				});
-			}
-		});
+					});
+				}
+			});
+		}else{
+			msgbox("Nothing selected");
+		}
 	});
 	
 	$( "select[name='folderdropdown']" ).change(function() {
@@ -304,6 +309,8 @@ function step4(){
 				}
 			});
 			*/
+		}else{
+			msgbox("Nothing selected");
 		}
 	});