Compare commits
2 Commits
5f3ae13111
...
ae56066281
Author | SHA1 | Date | |
---|---|---|---|
ae56066281 | |||
12e19d5416 |
|
@ -186,7 +186,7 @@ class Image implements JsonSerializable {
|
||||||
public static function getImagesForAlbum($albumid = 0) {
|
public static function getImagesForAlbum($albumid = 0) {
|
||||||
global $globaldbh;
|
global $globaldbh;
|
||||||
|
|
||||||
$query = "SELECT id FROM " . AppDB::TABLE_IMAGES . " WHERE album_id=:album_id ORDER BY title";
|
$query = "SELECT id FROM " . AppDB::TABLE_IMAGES . " WHERE album_id=:album_id ORDER BY filename";
|
||||||
$sth = $globaldbh->prepare($query);
|
$sth = $globaldbh->prepare($query);
|
||||||
$sth->bindValue(":album_id", (int) $albumid, PDO::PARAM_INT);
|
$sth->bindValue(":album_id", (int) $albumid, PDO::PARAM_INT);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
@ -238,7 +238,7 @@ class Image implements JsonSerializable {
|
||||||
public static function getList() {
|
public static function getList() {
|
||||||
global $globaldbh;
|
global $globaldbh;
|
||||||
|
|
||||||
$query = "SELECT id FROM " . AppDB::TABLE_IMAGES . " ORDER BY album_id, title";
|
$query = "SELECT id FROM " . AppDB::TABLE_IMAGES . " ORDER BY album_id, filename";
|
||||||
$sth = $globaldbh->prepare($query);
|
$sth = $globaldbh->prepare($query);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$thelist = array();
|
$thelist = array();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
var lightboxImages = [];
|
var lightboxImages = [];
|
||||||
var editAlbumID = 0;
|
var editAlbumID = 0;
|
||||||
var editImageID = 0;
|
var editImageID = 0;
|
||||||
|
var currentAlbum = 0;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#edit_album").dialog({
|
$("#edit_album").dialog({
|
||||||
|
@ -49,6 +50,7 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
$("#btn_refresh").click(function() { refreshAlbums() });
|
$("#btn_refresh").click(function() { refreshAlbums() });
|
||||||
$("#btn_album_0").click(function() { showAlbum($(this)) });
|
$("#btn_album_0").click(function() { showAlbum($(this)) });
|
||||||
|
$(".albuminfo_label").click(function() { editAlbum(currentAlbum); });
|
||||||
getAlbumInfo();
|
getAlbumInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,6 +62,7 @@ function refreshAlbums() {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data, stat, jqo) {
|
success: function(data, stat, jqo) {
|
||||||
toastr.success("Album list refreshed", "Refresh");
|
toastr.success("Album list refreshed", "Refresh");
|
||||||
|
getAlbumInfo();
|
||||||
},
|
},
|
||||||
error: function(jqp, status, error) {
|
error: function(jqp, status, error) {
|
||||||
toastr.error("Error refreshing album list!\n" + error, "Server Error");
|
toastr.error("Error refreshing album list!\n" + error, "Server Error");
|
||||||
|
@ -104,14 +107,14 @@ function getAlbumInfo() {
|
||||||
showImage($(this));
|
showImage($(this));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
currentAlbum = data.currentalbum;
|
||||||
$(".griditem_title").click(function() {
|
$(".griditem_title").click(function() {
|
||||||
if ( data.currentalbum == 0 ) {
|
if ( data.currentalbum == 0 ) {
|
||||||
editAlbum($(this));
|
editAlbum($(this).attr("id").substring($(this).attr("id").lastIndexOf("_") + 1));
|
||||||
} else {
|
} else {
|
||||||
editImage($(this));
|
editImage($(this).attr("id").substring($(this).attr("id").lastIndexOf("_") + 1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(lightboxImages);
|
|
||||||
},
|
},
|
||||||
error: function(jqp, status, error) {
|
error: function(jqp, status, error) {
|
||||||
toastr.error("Error retrieving album info!\n" + error, "Server Error");
|
toastr.error("Error retrieving album info!\n" + error, "Server Error");
|
||||||
|
@ -204,6 +207,10 @@ function saveAlbumInfo() {
|
||||||
if ( data.success ) {
|
if ( data.success ) {
|
||||||
$("#edit_album").dialog("close");
|
$("#edit_album").dialog("close");
|
||||||
$("#title_"+data.album.id).text(data.album.title);
|
$("#title_"+data.album.id).text(data.album.title);
|
||||||
|
if ( currentAlbum != 0 ) {
|
||||||
|
$("#albumtitle").text(data.album.title);
|
||||||
|
$("#albumdescription").text(data.album.description);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Could not get album information!", "Album Data Error");
|
toastr.error("Could not get album information!", "Album Data Error");
|
||||||
}
|
}
|
||||||
|
@ -214,8 +221,7 @@ function saveAlbumInfo() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function editAlbum(clickedElement) {
|
function editAlbum(albumid) {
|
||||||
var albumid = clickedElement.attr("id").substring(clickedElement.attr("id").lastIndexOf("_") + 1);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: 'ajax/getalbum.php',
|
url: 'ajax/getalbum.php',
|
||||||
|
@ -239,8 +245,7 @@ function editAlbum(clickedElement) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function editImage(clickedElement) {
|
function editImage(imageid) {
|
||||||
var imageid = clickedElement.attr("id").substring(clickedElement.attr("id").lastIndexOf("_") + 1);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: 'ajax/getimage.php',
|
url: 'ajax/getimage.php',
|
||||||
|
|
|
@ -14,8 +14,8 @@ if ( $currentuser->isLoggedIn() ) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="albumdetails hidden" id="albumdetails">
|
<div class="albumdetails hidden" id="albumdetails">
|
||||||
<div><span class="albuminfo_label">Album Title:</span> <span class="albuminfo" id="albumtitle"></span></div>
|
<div><span class="albuminfo_label textlink">Album Title:</span> <span class="albuminfo" id="albumtitle"></span></div>
|
||||||
<div class="albuminfo_label">Album Description:</div>
|
<div class="albuminfo_label textlink">Album Description:</div>
|
||||||
<div class="albuminfo spacebelow_small" id="albumdescription"></div>
|
<div class="albuminfo spacebelow_small" id="albumdescription"></div>
|
||||||
<div id="albumdescription"></div>
|
<div id="albumdescription"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user