Merge branch 'recent'

Conflicts:
	assets/min/main.js
This commit is contained in:
Tobias Reich 2014-07-05 00:41:36 +02:00
commit 4f272c4ba4
11 changed files with 65 additions and 10 deletions

View File

@ -176,6 +176,10 @@
.photo .badge.icon-share {
padding: 12px 6px 3px 8px;
}
.album .badge.icon-time,
.photo .badge.icon-time {
padding: 12px 8px 3px 9px;
}
.album .badge::after,
.photo .badge::after {
content: "";
@ -198,6 +202,10 @@
.photo .badge.icon-share::after {
margin-left: -31px;
}
.album .badge.icon-time::after,
.photo .badge.icon-time::after {
margin-left: -29px;
}
.album .badge.icon-reorder::after {
margin-left: -30px;
}

View File

@ -53,6 +53,16 @@ albums = {
thumb2: data.publicThumb2
};
data.recentAlbum = {
id: "r",
title: "Recent",
sysdate: data.recentNum + " photos",
recent: 1,
thumb0: data.recentThumb0,
thumb1: data.recentThumb1,
thumb2: data.recentThumb2
};
albums.json = data;
durationTime = (new Date().getTime() - startTime);

View File

@ -54,9 +54,10 @@ build = {
album += "<a>" + albumJSON.sysdate + "</a>";
album += "</div>";
if(!lychee.publicMode&&albumJSON.star==1) album += "<a class='badge red icon-star'></a>";
if(!lychee.publicMode&&albumJSON.public==1) album += "<a class='badge red icon-share'></a>";
if(!lychee.publicMode&&albumJSON.unsorted==1) album += "<a class='badge red icon-reorder'></a>";
if(!lychee.publicMode&&albumJSON.star===1) album += "<a class='badge red icon-star'></a>";
if(!lychee.publicMode&&albumJSON.public===1) album += "<a class='badge red icon-share'></a>";
if(!lychee.publicMode&&albumJSON.unsorted===1) album += "<a class='badge red icon-reorder'></a>";
if(!lychee.publicMode&&albumJSON.recent===1) album += "<a class='badge red icon-time'></a>";
album += "</div>";

View File

@ -114,7 +114,7 @@ contextMenu = {
mouse_y = e.pageY - $(document).scrollTop(),
items;
if (albumID==="0"||albumID==="f"||albumID==="s") return false;
if (albumID==="0"||albumID==="f"||albumID==="s"||albumID==="r") return false;
contextMenu.fns = [
function() { album.setTitle([albumID]) },

View File

@ -135,7 +135,7 @@ multiselect = {
id = $(this).data('id');
if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!==null&id!==undefined) {
if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!=='r'&&id!==null&id!==undefined) {
ids.push(id);
$(this).addClass('active');

View File

@ -64,7 +64,7 @@ view = {
$("#tools_albums, #tools_photo").hide();
$("#tools_album").show();
album.json.content === false ? $("#button_archive").hide() : $("#button_archive").show();
if (albumID==="s"||albumID==="f") {
if (albumID==="s"||albumID==="f"||albumID==="r") {
$("#button_info_album, #button_trash_album, #button_share_album").hide();
} else if (albumID==="0") {
$("#button_info_album, #button_share_album").hide();
@ -130,7 +130,8 @@ view = {
albums.parse(albums.json.unsortedAlbum);
albums.parse(albums.json.publicAlbum);
albums.parse(albums.json.starredAlbum);
if (!lychee.publicMode) smartData = build.divider("Smart Albums") + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum);
albums.parse(albums.json.recentAlbum);
if (!lychee.publicMode) smartData = build.divider("Smart Albums") + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum) + build.album(albums.json.recentAlbum);
/* Albums */
if (albums.json.content) {
@ -216,6 +217,9 @@ view = {
case "s":
lychee.setTitle("Public", false);
break;
case "r":
lychee.setTitle("Recent", false);
break;
case "0":
lychee.setTitle("Unsorted", false);
break;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -61,7 +61,7 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
# Validate parameters
if (isset($_POST['albumIDs'])&&preg_match('/^[0-9\,]{1,}$/', $_POST['albumIDs'])!==1) exit('Error: Wrong parameter type for albumIDs!');
if (isset($_POST['photoIDs'])&&preg_match('/^[0-9\,]{1,}$/', $_POST['photoIDs'])!==1) exit('Error: Wrong parameter type for photoIDs!');
if (isset($_POST['albumID'])&&preg_match('/^[0-9sf]{1,}$/', $_POST['albumID'])!==1) exit('Error: Wrong parameter type for albumID!');
if (isset($_POST['albumID'])&&preg_match('/^[0-9sfr]{1,}$/', $_POST['albumID'])!==1) exit('Error: Wrong parameter type for albumID!');
if (isset($_POST['photoID'])&&preg_match('/^[0-9]{14}$/', $_POST['photoID'])!==1) exit('Error: Wrong parameter type for photoID!');
# Function for switch statement

View File

@ -71,6 +71,10 @@ class Album extends Module {
$query = "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM lychee_photos WHERE public = 1 " . $this->settings['sorting'];
break;
case 'r': $return['public'] = false;
$query = "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM lychee_photos WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting'];
break;
case '0': $return['public'] = false;
$query = "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM lychee_photos WHERE album = 0 " . $this->settings['sorting'];
break;
@ -230,6 +234,17 @@ class Album extends Module {
}
$return['starredNum'] = $starred->num_rows;
# Recent
$recent = $this->database->query("SELECT thumbUrl FROM lychee_photos WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting']);
$i = 0;
while($row3 = $recent->fetch_object()) {
if ($i<3) {
$return["recentThumb$i"] = $row3->thumbUrl;
$i++;
} else break;
}
$return['recentNum'] = $recent->num_rows;
return $return;
}
@ -258,6 +273,10 @@ class Album extends Module {
$photos = "SELECT title, url FROM lychee_photos WHERE star = '1';";
$zipTitle = 'Starred';
break;
case 'r':
$photos = "SELECT title, url FROM lychee_photos WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY));";
$zipTitle = 'Recent';
break;
default:
$photos = "SELECT title, url FROM lychee_photos WHERE album = '$this->albumIDs';";
$zipTitle = 'Unsorted';

View File

@ -68,6 +68,13 @@ class Photo extends Module {
$albumID = 0;
break;
case 'r':
# r for recent
$public = 0;
$star = 0;
$albumID = 0;
break;
default:
$star = 0;
$public = 0;