Compare commits
No commits in common. "5f3ae1311153910a164b1504fb37c521a18dc44c" and "65652f92de431915be415edf81851c658ad3a64a" have entirely different histories.
5f3ae13111
...
65652f92de
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require '../header.php';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data["success"] = false;
|
|
||||||
|
|
||||||
if ( !isset($_REQUEST['albumid']) ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$album = new Album($_REQUEST['albumid']);
|
|
||||||
if ( $album->getID() == 0 ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data["success"] = true;
|
|
||||||
$data["album"] = $album;
|
|
||||||
|
|
||||||
sendResponse($data);
|
|
||||||
|
|
||||||
function sendResponse($data) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode($data);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
// vim: set ts=4:sw=4
|
|
|
@ -25,7 +25,7 @@ if ( $_SESSION['currentalbum'] == 0 ) {
|
||||||
foreach ( $griditems as $griditem ) {
|
foreach ( $griditems as $griditem ) {
|
||||||
$data["albumcontents"] .= "<div class=\"thumbnail_grid\">";
|
$data["albumcontents"] .= "<div class=\"thumbnail_grid\">";
|
||||||
$data["albumcontents"] .= "<img class=\"thumbnail_grid_image albumthumbnail\" id=\"griditem_{$griditem->getID()}\" src=\"{$griditem->getThumbnail(URLSAFE)}\" />";
|
$data["albumcontents"] .= "<img class=\"thumbnail_grid_image albumthumbnail\" id=\"griditem_{$griditem->getID()}\" src=\"{$griditem->getThumbnail(URLSAFE)}\" />";
|
||||||
$data["albumcontents"] .= "<div class=\"thumbnail_grid_title textlink griditem_title\" id=\"title_{$griditem->getID()}\">{$griditem->getTitle(HTMLSAFE)}</div>";
|
$data["albumcontents"] .= "<div class=\"thumbnail_grid_title\">{$griditem->getTitle(HTMLSAFE)}</div>";
|
||||||
$data["albumcontents"] .= "</div>\n";
|
$data["albumcontents"] .= "</div>\n";
|
||||||
}
|
}
|
||||||
$data["currentalbum"] = $_SESSION['currentalbum'];
|
$data["currentalbum"] = $_SESSION['currentalbum'];
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require '../header.php';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data["success"] = false;
|
|
||||||
|
|
||||||
if ( !isset($_REQUEST['imageid']) ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$image = new Image($_REQUEST['imageid']);
|
|
||||||
if ( $image->getID() == 0 ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data["image"] = $image;
|
|
||||||
|
|
||||||
$data["success"] = true;
|
|
||||||
sendResponse($data);
|
|
||||||
|
|
||||||
function sendResponse($data) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode($data);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
// vim: set ts=4:sw=4
|
|
|
@ -1,33 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require '../header.php';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data["success"] = false;
|
|
||||||
|
|
||||||
if ( !isset($_REQUEST['albumid']) || !isset($_REQUEST['title']) || ($_REQUEST['title'] == "") ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$album = new Album($_REQUEST['albumid']);
|
|
||||||
if ( $album->getID() == 0 ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$album->setTitle($_REQUEST['title']);
|
|
||||||
$album->setDescription($_REQUEST['description']);
|
|
||||||
$album->save();
|
|
||||||
$data["success"] = true;
|
|
||||||
$data["album"] = $album;
|
|
||||||
|
|
||||||
sendResponse($data);
|
|
||||||
|
|
||||||
function sendResponse($data) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode($data);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
// vim: set ts=4:sw=4
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require '../header.php';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data["success"] = false;
|
|
||||||
|
|
||||||
if ( !isset($_REQUEST['imageid']) || !isset($_REQUEST['title']) || ($_REQUEST['title'] == "") ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$image = new Image($_REQUEST['imageid']);
|
|
||||||
if ( $image->getID() == 0 ) {
|
|
||||||
sendResponse($data);
|
|
||||||
}
|
|
||||||
$album = new Album($image->getAlbumID());
|
|
||||||
|
|
||||||
$image->setTitle($_REQUEST['title']);
|
|
||||||
$image->setDescription($_REQUEST['description']);
|
|
||||||
$image->save();
|
|
||||||
$data["success"] = true;
|
|
||||||
$data["image"] = $image;
|
|
||||||
|
|
||||||
sendResponse($data);
|
|
||||||
|
|
||||||
function sendResponse($data) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode($data);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
// vim: set ts=4:sw=4
|
|
|
@ -278,7 +278,7 @@ class Image implements JsonSerializable {
|
||||||
|
|
||||||
$query = "INSERT INTO " . AppDB::TABLE_IMAGES . " ";
|
$query = "INSERT INTO " . AppDB::TABLE_IMAGES . " ";
|
||||||
$query .= "(id, album_id, filename, title, description, createtime) ";
|
$query .= "(id, album_id, filename, title, description, createtime) ";
|
||||||
$query .= "VALUES(:id, :album_id, :filename, :title, :description, NOW()) ";
|
$query .= "VALUES(NULL, :album_id, :filename, :title, :description, NOW()) ";
|
||||||
$query .= "ON DUPLICATE KEY UPDATE ";
|
$query .= "ON DUPLICATE KEY UPDATE ";
|
||||||
$query .= "album_id=:album_id, filename=:filename, title=:title, description=:description";
|
$query .= "album_id=:album_id, filename=:filename, title=:title, description=:description";
|
||||||
$sth = $globaldbh->prepare($query);
|
$sth = $globaldbh->prepare($query);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB |
7
core/jquery-ui.min.css
vendored
7
core/jquery-ui.min.css
vendored
File diff suppressed because one or more lines are too long
6
core/jquery-ui.min.js
vendored
6
core/jquery-ui.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,8 +7,6 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Include jQuery before anything else -->
|
<!-- Include jQuery before anything else -->
|
||||||
<script type="text/javascript" src="core/jquery-3.6.0.min.js"></script>
|
<script type="text/javascript" src="core/jquery-3.6.0.min.js"></script>
|
||||||
<!-- Followed immediately by jQueryUI -->
|
|
||||||
<script type="text/javascript" src="core/jquery-ui.min.js"></script>
|
|
||||||
<!-- Toastr library -->
|
<!-- Toastr library -->
|
||||||
<script type="text/javascript" src="core/toastr.min.js"></script>
|
<script type="text/javascript" src="core/toastr.min.js"></script>
|
||||||
<!-- simpleLightbox library -->
|
<!-- simpleLightbox library -->
|
||||||
|
|
|
@ -6,11 +6,8 @@
|
||||||
<meta name="description" content="Big Wood's World" />
|
<meta name="description" content="Big Wood's World" />
|
||||||
<meta name="keywords" content="The ramblings of an old man." />
|
<meta name="keywords" content="The ramblings of an old man." />
|
||||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252" />
|
<meta http-equiv="content-type" content="text/html; charset=windows-1252" />
|
||||||
<!-- jQueryUI CSS -->
|
|
||||||
<link rel="stylesheet" type="text/css" href="core/jquery-ui.min.css" />
|
|
||||||
<!-- Toastr CSS -->
|
<!-- Toastr CSS -->
|
||||||
<link rel="stylesheet" type="text/css" href="core/toastr.min.css" />
|
<link rel="stylesheet" type="text/css" href="core/toastr.min.css" />
|
||||||
<!-- simpleLightbox CSS -->
|
|
||||||
<link rel="stylesheet" type="text/css" href="core/simpleLightbox.min.css" />
|
<link rel="stylesheet" type="text/css" href="core/simpleLightbox.min.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="style/style.css" title="style" />
|
<link rel="stylesheet" type="text/css" href="style/style.css" title="style" />
|
||||||
<link rel="shortcut icon" href="graphics/oldman_head.gif">
|
<link rel="shortcut icon" href="graphics/oldman_head.gif">
|
||||||
|
|
|
@ -1,52 +1,6 @@
|
||||||
var lightboxImages = [];
|
var lightboxImages = [];
|
||||||
var editAlbumID = 0;
|
|
||||||
var editImageID = 0;
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#edit_album").dialog({
|
|
||||||
autoOpen: false,
|
|
||||||
height: 250,
|
|
||||||
width: 350,
|
|
||||||
closeOnEscape: true,
|
|
||||||
draggable: false,
|
|
||||||
close: function() {
|
|
||||||
editAlbumID = 0;
|
|
||||||
$("#edit_album_title").val("");
|
|
||||||
$("#edit_album_description").val("");
|
|
||||||
},
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: "Save",
|
|
||||||
click: function() { saveAlbumInfo(); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Cancel",
|
|
||||||
click: function() { $(this).dialog("close"); }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
$("#edit_image").dialog({
|
|
||||||
autoOpen: false,
|
|
||||||
height: 250,
|
|
||||||
width: 350,
|
|
||||||
closeOnEscape: true,
|
|
||||||
draggable: false,
|
|
||||||
close: function() {
|
|
||||||
editImageID = 0;
|
|
||||||
$("#edit_image_title").val("");
|
|
||||||
$("#edit_image_description").val("");
|
|
||||||
},
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: "Save",
|
|
||||||
click: function() { saveImageInfo(); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Cancel",
|
|
||||||
click: function() { $(this).dialog("close"); }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
$("#btn_refresh").click(function() { refreshAlbums() });
|
$("#btn_refresh").click(function() { refreshAlbums() });
|
||||||
$("#btn_album_0").click(function() { showAlbum($(this)) });
|
$("#btn_album_0").click(function() { showAlbum($(this)) });
|
||||||
getAlbumInfo();
|
getAlbumInfo();
|
||||||
|
@ -67,20 +21,6 @@ function refreshAlbums() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLightboxImages() {
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: 'ajax/getalbuminfo.php',
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data, stat, jqo) {
|
|
||||||
lightboxImages = data.images;
|
|
||||||
lightboxImages.forEach(function(image, index) {
|
|
||||||
$("#title_"+image.id).text(image.title);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAlbumInfo() {
|
function getAlbumInfo() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
@ -104,13 +44,6 @@ function getAlbumInfo() {
|
||||||
showImage($(this));
|
showImage($(this));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(".griditem_title").click(function() {
|
|
||||||
if ( data.currentalbum == 0 ) {
|
|
||||||
editAlbum($(this));
|
|
||||||
} else {
|
|
||||||
editImage($(this));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
console.log(lightboxImages);
|
console.log(lightboxImages);
|
||||||
},
|
},
|
||||||
error: function(jqp, status, error) {
|
error: function(jqp, status, error) {
|
||||||
|
@ -129,6 +62,11 @@ function showImage(clickedElement) {
|
||||||
images.push(image.imageurl);
|
images.push(image.imageurl);
|
||||||
captions.push(image.description);
|
captions.push(image.description);
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
|
images.forEach(function(image, index) {
|
||||||
|
if ( basename(image, "/") == basename(clickedElement.attr("src"), "/") ) startIndex = index;
|
||||||
|
});
|
||||||
|
*/
|
||||||
SimpleLightbox.open({
|
SimpleLightbox.open({
|
||||||
items: images,
|
items: images,
|
||||||
captions: captions,
|
captions: captions,
|
||||||
|
@ -155,113 +93,4 @@ function showAlbum(clickedElement) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveImageInfo() {
|
|
||||||
if ( editImageID == 0 ) return;
|
|
||||||
if ( $("#edit_image_title").val() == "" ) {
|
|
||||||
toastr.error("Image title cannot be blank!", "Image Title Error");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: 'ajax/saveimage.php',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
imageid: editImageID,
|
|
||||||
title: $("#edit_image_title").val(),
|
|
||||||
description: $("#edit_image_description").val()
|
|
||||||
},
|
|
||||||
success: function(data, stat, jqo) {
|
|
||||||
if ( data.success ) {
|
|
||||||
$("#edit_image").dialog("close");
|
|
||||||
$("#title_"+data.image.id).text(data.image.title);
|
|
||||||
updateLightboxImages();
|
|
||||||
} else {
|
|
||||||
toastr.error("Could not get image information!", "Image Data Error");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(jqp, status, error) {
|
|
||||||
toastr.error("Error saving image!\n" + error, "Server Error");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveAlbumInfo() {
|
|
||||||
if ( editAlbumID == 0 ) return;
|
|
||||||
if ( $("#edit_album_title").val() == "" ) {
|
|
||||||
toastr.error("Album title cannot be blank!", "Album Title Error");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: 'ajax/savealbum.php',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
albumid: editAlbumID,
|
|
||||||
title: $("#edit_album_title").val(),
|
|
||||||
description: $("#edit_album_description").val()
|
|
||||||
},
|
|
||||||
success: function(data, stat, jqo) {
|
|
||||||
if ( data.success ) {
|
|
||||||
$("#edit_album").dialog("close");
|
|
||||||
$("#title_"+data.album.id).text(data.album.title);
|
|
||||||
} else {
|
|
||||||
toastr.error("Could not get album information!", "Album Data Error");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(jqp, status, error) {
|
|
||||||
toastr.error("Error saving album!\n" + error, "Server Error");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function editAlbum(clickedElement) {
|
|
||||||
var albumid = clickedElement.attr("id").substring(clickedElement.attr("id").lastIndexOf("_") + 1);
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: 'ajax/getalbum.php',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
albumid: albumid
|
|
||||||
},
|
|
||||||
success: function(data, stat, jqo) {
|
|
||||||
if ( data.success ) {
|
|
||||||
editAlbumID = data.album.id;
|
|
||||||
$("#edit_album_title").val(data.album.title);
|
|
||||||
$("#edit_album_description").val(data.album.description);
|
|
||||||
$("#edit_album").dialog("open");
|
|
||||||
} else {
|
|
||||||
toastr.error("Could not get album information!", "Album Data Error");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(jqp, status, error) {
|
|
||||||
toastr.error("Error getting album!\n" + error, "Server Error");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function editImage(clickedElement) {
|
|
||||||
var imageid = clickedElement.attr("id").substring(clickedElement.attr("id").lastIndexOf("_") + 1);
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: 'ajax/getimage.php',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
imageid: imageid
|
|
||||||
},
|
|
||||||
success: function(data, stat, jqo) {
|
|
||||||
if ( data.success ) {
|
|
||||||
editImageID = data.image.id;
|
|
||||||
$("#edit_image_title").val(data.image.title);
|
|
||||||
$("#edit_image_description").val(data.image.description);
|
|
||||||
$("#edit_image").dialog("open");
|
|
||||||
} else {
|
|
||||||
toastr.error("Could not get image information!", "Image Data Error");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(jqp, status, error) {
|
|
||||||
toastr.error("Error getting image!\n" + error, "Server Error");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: ts=4:sw=4
|
// vim: ts=4:sw=4
|
||||||
|
|
|
@ -21,30 +21,6 @@ if ( $currentuser->isLoggedIn() ) {
|
||||||
</div>
|
</div>
|
||||||
<div id="albumcontents">
|
<div id="albumcontents">
|
||||||
</div>
|
</div>
|
||||||
<!-- jQueryUI Dialog for editing album info -->
|
|
||||||
<div id="edit_album" title="Edit Album Properties" class="hidden">
|
|
||||||
<div>
|
|
||||||
<label for="edit_album_title"><b>Title</b></label>
|
|
||||||
<input placeholder="Enter Title" name="edit_album_title" id="edit_album_title" size="40" required>
|
|
||||||
</div>
|
|
||||||
<p />
|
|
||||||
<div>
|
|
||||||
<label for="edit_album_description"><b>Description</b></label>
|
|
||||||
<textarea placeholder="Enter Description" name="edit_album_description" id="edit_album_description" rows="5" cols="40"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- jQueryUI Dialog for editing image info -->
|
|
||||||
<div id="edit_image" title="Edit Image Properties" class="hidden">
|
|
||||||
<div>
|
|
||||||
<label for="edit_image_title"><b>Title</b></label>
|
|
||||||
<input placeholder="Enter Title" name="edit_image_title" id="edit_image_title" size="40" required>
|
|
||||||
</div>
|
|
||||||
<p />
|
|
||||||
<div>
|
|
||||||
<label for="edit_image_description"><b>Description</b></label>
|
|
||||||
<textarea placeholder="Enter Description" name="edit_image_description" id="edit_image_description" rows="5" cols="40"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
includeHTMLFooter("scalemodels.js");
|
includeHTMLFooter("scalemodels.js");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user