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

This commit is contained in:
Tobias Reich 2014-05-06 19:57:59 +02:00
parent fc97167e1b
commit 61a868980e
4 changed files with 10 additions and 7 deletions

View File

@ -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 one or more lines are too long

View File

@ -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;

View File

@ -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!');