Browse Source

User can set the import-path #187

Tobias Reich 9 years ago
parent
commit
d991eef2c9
3 changed files with 13 additions and 8 deletions
  1. 11 6
      assets/js/upload.js
  2. 0 0
      assets/min/main.js
  3. 2 2
      php/access/Admin.php

+ 11 - 6
assets/js/upload.js

@@ -198,7 +198,7 @@ upload = {
 						}
 
 						upload.show("Importing URL", files, function() {
-							$(".upload_message .rows .row:nth-child(1) .status").html("Importing");
+							$(".upload_message .rows .row .status").html("Importing");
 						});
 
 						params = "importUrl&url=" + escape(encodeURI(link)) + "&albumID=" + albumID;
@@ -229,21 +229,26 @@ upload = {
 			var albumID = album.getID(),
 				params,
 				buttons,
-				files = [];
+				files = [],
+				path;
 
 			if (albumID===false) albumID = 0;
 
 			buttons = [
 				["Import", function() {
 
+					path = $(".message input.text").val();
+
 					files[0] = {
-						name: "uploads/import/",
+						name: path,
 						supported: true
 					};
 
-					upload.show("Importing from server", files);
+					upload.show("Importing from server", files, function() {
+						$(".upload_message .rows .row .status").html("Importing");
+					});
 
-					params = "importServer&albumID=" + albumID;
+					params = "importServer&albumID=" + albumID + "&path=" + escape(encodeURI(path));
 					lychee.api(params, function(data) {
 
 						upload.close();
@@ -266,7 +271,7 @@ upload = {
 				["Cancel", function() {}]
 			];
 
-			modal.show("Import from Server", "This action will import all photos and albums which are located in <b>'uploads/import/'</b> of your Lychee installation.", buttons);
+			modal.show("Import from Server", "This action will import all photos and albums which are located in the following directory: <input class='text' type='text' maxlength='100' placeholder='Absolute path to directory' value='" + lychee.location + "uploads/import/'>", buttons);
 
 		},
 

File diff suppressed because it is too large
+ 0 - 0
assets/min/main.js


+ 2 - 2
php/access/Admin.php

@@ -208,8 +208,8 @@ class Admin extends Access {
 
 	private function importServer() {
 
-		Module::dependencies(isset($_POST['albumID']));
-		echo Import::server($_POST['albumID'], null);
+		Module::dependencies(isset($_POST['albumID'], $_POST['path']));
+		echo Import::server($_POST['albumID'], $_POST['path']);
 
 	}
 

Some files were not shown because too many files changed in this diff