Browse Source

Improved sorting by takestamp and reset for older version (#152)

Tobias Reich 10 years ago
parent
commit
61a868980e
4 changed files with 8 additions and 5 deletions
  1. 3 4
      assets/js/settings.js
  2. 0 0
      assets/min/main.js
  3. 4 0
      php/database/update_020500.php
  4. 1 1
      php/modules/Settings.php

+ 3 - 4
assets/js/settings.js

@@ -218,7 +218,7 @@ var settings = {
 			"Sort photos by \
 				<select id='settings_type'> \
 					<option value='id'>Upload Time</option> \
-					<option value='take'>Take Date</option> \
+					<option value='takestamp'>Take Date</option> \
 					<option value='title'>Title</option> \
 					<option value='description'>Description</option> \
 					<option value='public'>Public</option> \
@@ -234,13 +234,12 @@ var settings = {
 			", buttons);
 
 		if (lychee.sorting!=="") {
-			sorting = lychee.sorting.replace("ORDER BY ", "").split(" ");
 
-			// Special parsing
-			if (sorting[0]==='UNIX_TIMESTAMP(STR_TO_DATE(CONCAT(takedate,"-",taketime),"%d.%m.%Y-%H:%i:%S"))') sorting[0] = "take";
+			sorting = lychee.sorting.replace("ORDER BY ", "").split(" ");
 
 			$("select#settings_type").val(sorting[0]);
 			$("select#settings_order").val(sorting[1]);
+
 		}
 
 	},

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


+ 4 - 0
php/database/update_020500.php

@@ -83,6 +83,10 @@ if (!$result) return false;
 $result = $database->query("ALTER TABLE `lychee_photos` CHANGE `make` `make` VARCHAR(50);");
 if (!$result) return false;
 
+# Reset sorting
+$result = $database->query("UPDATE lychee_settings SET value = 'ORDER BY takestamp DESC' WHERE `key` = 'sorting' AND `value` LIKE '%UNIX_TIMESTAMP%';");
+if (!$result) return false;
+
 # Set version
 $result = $database->query("UPDATE lychee_settings SET value = '020500' WHERE `key` = 'version';");
 if (!$result) return false;

+ 1 - 1
php/modules/Settings.php

@@ -138,7 +138,7 @@ class Settings extends Module {
 			case 'star':		$sorting .= 'star';
 								break;
 
-			case 'take':		$sorting .= 'takestamp';
+			case 'takestamp':	$sorting .= 'takestamp';
 								break;
 
 			default:			exit('Error: Unknown type for sorting!');

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