Просмотр исходного кода

Bug Fix Round 1

+ Rewrite part of the  extract to folder code
+ Fixed the xml parse error on firefox
+ Updated the moduel icon and description text
+ The info ui now have an icon using ao_module iconing scheme
+ Added getMessage.php to replace the original ajax get from server side directly
+ Added float window support to progressUI.php
Toby Chui 6 лет назад
Родитель
Сommit
94cf76850a

+ 9 - 11
7-Zip File Manager/CopyNMoveUI.php

@@ -31,31 +31,26 @@ include '../auth.php';
 				<div class="ts form">
 
 					<div class="field">
-						<label>Copy to:</label>
+						<label>Extract to:</label>
 						<div class="ts labeled input" style="width:100%">
 							<div class="ts label">
 								/AOR/
 							</div>
-							<input type="text" id="path" placeholder="Path here">
+							<input type="text" id="path" placeholder="Select a path for unzip.">
 							<button class="ts icon button" onClick="selectFolder();">
 								<i class="folder open icon"></i>
 							</button>
 						</div>
 					</div>
 				</div>
+				<p id="filesshow">Target: </p>
 			</div>
 			
-			<div class="sixteen wide column">
-				<p id="filesshow">
-				Extract to: 
-				</p>
-			</div>
 
 			<div class="eight wide column"></div>
 			<div class="eight wide column">
-				<button class="ts basic button" style="width:45%" onclick="f_ok()">OK</button>
-				    
-				<button class="ts basic button" style="width:45%" onclick="f_close()">Cancel</button>
+				<button class="ts basic small button" style="width:45%" onclick="f_ok()">OK</button>
+				<button class="ts basic small button" style="width:45%" onclick="f_close()">Cancel</button>
 			</div>
 		</div>
 	</div>
@@ -67,6 +62,9 @@ var f_file = "<?php echo $_GET["file"] ?>";
 var f_dir = "<?php echo $_GET["dir"] ?>";
 var f_extractTo = "";
 
+ao_module_setFixedWindowSize();
+ao_module_setWindowSize(650,200);
+
 function f_close(){
 	if(ao_module_virtualDesktop){
 		ao_module_close();
@@ -108,7 +106,7 @@ function updatePath(){
 	if(path.slice(-1) !== "/"){
 		path = path + "/";
 	}
-	$("#filesshow").text("Extract to: /AOR/" + path + f_file.replace(/^.*[\\\/]/, '').replace(".","") + "/" + displayPath);
+	$("#filesshow").text("Target: /AOR/" + path + f_file.replace(/^.*[\\\/]/, '').replace(".","") + "/" + displayPath);
 	f_extractTo = "../" + path;
 }
 

+ 7 - 2
7-Zip File Manager/MainUI.php

@@ -18,6 +18,9 @@ include '../auth.php';
 		-ms-user-select: none; /* IE10+/Edge */
 		user-select: none; /* Standard */
 	}
+	tr{
+	    cursor:pointer;
+	}
 	tr:hover { 
 		background-color: #fafafa;
 	}
@@ -110,6 +113,7 @@ if (ao_module_virtualDesktop){
     //Push up the body section a bit to compensate for the floatWindow offsets
     $("body").css("padding-bottom","20px");
 }
+ao_module_setWindowSize(950,530);
 
 function basename(path){
     path = path.split("\\").join("/");
@@ -292,12 +296,13 @@ function functionbar_extract(){
 function functionbar_info(){
 	//showDialog("infoUI.php?file=" + file,365,475);
 	var displayname = ao_module_codec.decodeUmFilename(basename(file));
-	ao_module_newfw('7-Zip File Manager/' + "infoUI.php?file=" + file,displayname + ' - Properties','file outline','7-ZipProgressUI' + Math.floor(Math.random()*100),365,475,undefined,undefined,true,true);
+	var icon = ao_module_utils.getIconFromExt(displayname.split(".").pop().trim());
+	ao_module_newfw('7-Zip File Manager/' + "infoUI.php?file=" + file,displayname + ' - Properties',icon,'7-ZipProgressUI' + Math.floor(Math.random()*100),365,475,undefined,undefined,true,true);
 }
 
 function showDialog(href,x,y){
 	if(ao_module_virtualDesktop){
-		ao_module_newfw('7-Zip File Manager/' + href,'7-Zip','file outline','7-ZipProgressUI' + Math.floor(Math.random()*100),x,y,undefined,undefined,true,true);
+		ao_module_newfw('7-Zip File Manager/' + href,'Extract Files - 7zip File Manager','external','7-ZipProgressUI' + Math.floor(Math.random()*100),x,y,undefined,undefined,true,true);
 	}else{
 		$.get( href, function( data ) {
 			$( "#modaldata" ).html( data );

+ 61 - 4
7-Zip File Manager/ProgressUI.php

@@ -73,8 +73,29 @@ var f_time = 1;
 var f_totaltime = 1;
 var f_cancel = false;
 
+//Initiate floatWindow events
+ao_module_setWindowTitle("Inflating from compressed file...");
+ao_module_setWindowIcon("loading spinner");
+
 var f_load = setInterval(function(){ 
-	$.get( "./tmp/" + f_rand + "messages", function( data ) {
+
+	$.ajax({
+		url: "getMessage.php?id=" + f_rand + "messages",
+		contentType: "text/plain"
+	}).done(function(data) { 
+		var progress = data.match(/ ([0-9]{0,2}%)/gim);
+		console.log(progress[progress.length - 1]);
+		f_totaltime = Math.floor(f_time / (parseInt(progress[progress.length - 1])/100));
+		$("#bar").attr("style","width: " + progress[progress.length - 1]);
+		$("#time").text(f_convert(f_time));
+		$("#remaining").text(f_convert(f_totaltime - f_time));
+		$("#speed").text(f_filesize(Math.floor(f_size / f_totaltime)) + "/s");
+		$("#totalsize").text(f_filesize(f_size));
+		f_time += 1;
+	});
+	
+	/*
+	$.get("./tmp/" + f_rand + "messages", function( data ) {
 		var progress = data.match(/ ([0-9]{0,2}%)/gim);
 		console.log(progress[progress.length - 1]);
 		f_totaltime = Math.floor(f_time / (parseInt(progress[progress.length - 1])/100));
@@ -85,6 +106,7 @@ var f_load = setInterval(function(){
 		$("#totalsize").text(f_filesize(f_size));
 		f_time += 1;
 	});
+	*/
 }, 1000);
 
 f_load;
@@ -93,6 +115,26 @@ $.get("opr.php?method=" + f_method + "&rand=" + f_rand + "&file=" + f_file + "&d
 		clearInterval(f_load);
 		if(!f_cancel){
 			if(f_destdir.length >0){
+				//console.log('../SystemAOB/functions/file_system/move.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'&to=../../' + f_destdir + f_filenameToFoldername(f_file));
+				
+				$.get( '../SystemAOB/functions/file_system/move.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'&to=../../' + f_destdir + f_filenameToFoldername(f_file), function(data) {
+					if(data !== "DONE"){
+						if(ao_module_virtualDesktop){
+							parent.msgbox(data,'<i class="caution sign icon"></i> 7-Zip File Manager',"");
+							ao_module_close();
+						}else{
+							msgbox(data,"","");
+							setTimeout(function(){ts('#modal').modal('hide')},1500);
+						}
+					}else{
+						f_openFile(true);
+					}
+				});
+				/*
+				console.log('../SystemAOB/functions/file_system/copy_folder.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'/&target=../../' + f_destdir + f_rand + "/");
+				
+				console.log('../SystemAOB/functions/file_system/rename.php?file=../../' + f_destdir + f_rand + '&newFileName=../../' + f_destdir + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"") + '/&hex=false');
+				
 				$.get( '../SystemAOB/functions/file_system/copy_folder.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'/&target=../../' + f_destdir + f_rand + "/", function(data) {
 					if(data !== "DONE"){
 						msgbox(data,"","");
@@ -104,6 +146,7 @@ $.get("opr.php?method=" + f_method + "&rand=" + f_rand + "&file=" + f_file + "&d
 							setTimeout(function(){ts('#modal').modal('hide')},1500);
 						}
 					}
+					
 					$.get( '../SystemAOB/functions/file_system/rename.php?file=../../' + f_destdir + f_rand + '&newFileName=../../' + f_destdir + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"") + '/&hex=false', function(data) {
 						if(data !== "DONE"){
 							$.get( '../SystemAOB/functions/file_system/delete.php?filename=../../' + f_destdir + f_rand, function(data) {
@@ -120,12 +163,26 @@ $.get("opr.php?method=" + f_method + "&rand=" + f_rand + "&file=" + f_file + "&d
 						}
 					});
 				});
+				*/
 			}else{
 				f_openFile(false);
 			}
 		}
 });
 
+function f_filenameToFoldername(path){
+		var filename = path.split("\\").join("/").split("/").pop();
+		var filename = filename.split(".");
+		if (filename.length > 1){
+			filename.pop();
+		}
+		filename = filename.join(".");
+		if (filename.substring(0,5) == "inith"){
+			filename = filename.replace("inith","");
+		}
+		return filename;
+}
+
 function f_openFile(bool){
 	var Folder = "";
 	// bool = true then it have destdir
@@ -134,9 +191,9 @@ function f_openFile(bool){
 		//f_method = e then it is only single file
 		//f_method = x then it is a folder
 		if(f_method == "e"){
-			Folder = f_destdir.substring(3) + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"") + "/" + f_dir.replace(/^.*[\\\/]/, '');
+			Folder = f_destdir.replace("../","") + f_filenameToFoldername(f_file) + "/" + f_dir.replace(/^.*[\\\/]/, '');
 		}else if(f_method == "x"){
-			Folder = f_destdir.substring(3) + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"");
+			Folder = f_destdir.replace("../","") + f_filenameToFoldername(f_file);
 		}
 	}else{
 		//f_method = e then it is only single file
@@ -147,7 +204,7 @@ function f_openFile(bool){
 			Folder = "7-Zip File Manager/tmp/" + f_rand + "/";
 		}
 	}
-	console.log(f_rand + Folder);
+	//console.log(f_rand + Folder);
 	if(ao_module_virtualDesktop){
 		if(f_method == "e"){
 			ao_module_openFile(Folder,"7-Zip Preview");

+ 1 - 1
7-Zip File Manager/description.txt

@@ -1 +1 @@
-For extarcting 7z files.
+7-Zip File Manager for ArOZ Online System

+ 0 - 2
7-Zip File Manager/embedded.php

@@ -1,7 +1,5 @@
 <?php
 include '../auth.php';
-?>
-<?php
 if(isset($_GET["filepath"])){
     header('Location: MainUI.php?file='.$_GET["filepath"]);
 }else{

+ 11 - 0
7-Zip File Manager/getMessage.php

@@ -0,0 +1,11 @@
+<?php
+include_once("../auth.php");
+if (isset($_GET['id'])){
+	if (file_exists("tmp/" . $_GET['id'])){
+		echo file_get_contents("tmp/" . $_GET['id']);
+		exit(0);
+	}
+}else{
+	die("ERROR. unset id value for lookup.");
+}
+?>

BIN
7-Zip File Manager/img/function_icon.png


BIN
7-Zip File Manager/img/small_icon.png