Compare commits
No commits in common. "f82bd7b0651733988319ac1a9c68908e8bfffe58" and "30bc0bb884e633f35123c5f132c989b316568888" have entirely different histories.
f82bd7b065
...
30bc0bb884
@ -30,22 +30,6 @@ class EditAsset extends HTMLController
|
||||
header('Location: ' . $redirectUrl);
|
||||
exit;
|
||||
}
|
||||
else if ((isset($_REQUEST['inc_prio']) || isset($_REQUEST['dec_prio'])) && Session::validateSession('get'))
|
||||
{
|
||||
if (isset($_REQUEST['inc_prio']))
|
||||
$priority = $asset->priority + 1;
|
||||
else
|
||||
$priority = $asset->priority - 1;
|
||||
|
||||
$asset->priority = max(0, min(100, $priority));
|
||||
$asset->save();
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER']))
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
else
|
||||
header('Location: ' . BASEURL . '/' . $asset->getSubdir());
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get a list of available photo albums
|
||||
$allAlbums = [];
|
||||
@ -77,12 +61,10 @@ class EditAsset extends HTMLController
|
||||
// Key info
|
||||
if (isset($_POST['title'], $_POST['slug'], $_POST['date_captured'], $_POST['priority']))
|
||||
{
|
||||
$asset->date_captured = !empty($_POST['date_captured']) ?
|
||||
$date_captured = !empty($_POST['date_captured']) ?
|
||||
new DateTime(str_replace('T', ' ', $_POST['date_captured'])) : null;
|
||||
$asset->slug = Asset::cleanSlug($_POST['slug']);
|
||||
$asset->title = htmlspecialchars($_POST['title']);
|
||||
$asset->priority = intval($_POST['priority']);
|
||||
$asset->save();
|
||||
$slug = Asset::cleanSlug($_POST['slug']);
|
||||
$asset->setKeyData(htmlspecialchars($_POST['title']), $slug, $date_captured, intval($_POST['priority']));
|
||||
}
|
||||
|
||||
// Changing parent album?
|
||||
|
@ -8,17 +8,17 @@
|
||||
|
||||
class Asset
|
||||
{
|
||||
public $id_asset;
|
||||
public $id_user_uploaded;
|
||||
public $subdir;
|
||||
public $filename;
|
||||
public $title;
|
||||
public $slug;
|
||||
public $mimetype;
|
||||
public $image_width;
|
||||
public $image_height;
|
||||
public $date_captured;
|
||||
public $priority;
|
||||
protected $id_asset;
|
||||
protected $id_user_uploaded;
|
||||
protected $subdir;
|
||||
protected $filename;
|
||||
protected $title;
|
||||
protected $slug;
|
||||
protected $mimetype;
|
||||
protected $image_width;
|
||||
protected $image_height;
|
||||
protected $date_captured;
|
||||
protected $priority;
|
||||
|
||||
protected $meta;
|
||||
protected $tags;
|
||||
@ -675,26 +675,26 @@ class Asset
|
||||
FROM assets');
|
||||
}
|
||||
|
||||
public function save()
|
||||
public function setKeyData($title, $slug, DateTime $date_captured = null, $priority)
|
||||
{
|
||||
if (empty($this->id_asset))
|
||||
throw new UnexpectedValueException();
|
||||
$params = [
|
||||
'id_asset' => $this->id_asset,
|
||||
'title' => $title,
|
||||
'slug' => $slug,
|
||||
'priority' => $priority,
|
||||
];
|
||||
|
||||
if (isset($date_captured))
|
||||
$params['date_captured'] = $date_captured->format('Y-m-d H:i:s');
|
||||
|
||||
return Registry::get('db')->query('
|
||||
UPDATE assets
|
||||
SET id_asset = {int:id_asset},
|
||||
id_user_uploaded = {int:id_user_uploaded},
|
||||
subdir = {string:subdir},
|
||||
filename = {string:filename},
|
||||
title = {string:title},
|
||||
slug = {string:slug},
|
||||
mimetype = {string:mimetype},
|
||||
image_width = {int:image_width},
|
||||
image_height = {int:image_height},
|
||||
date_captured = {datetime:date_captured},
|
||||
SET title = {string:title},
|
||||
slug = {string:slug},' . (isset($date_captured) ? '
|
||||
date_captured = {datetime:date_captured},' : '') . '
|
||||
priority = {int:priority}
|
||||
WHERE id_asset = {int:id_asset}',
|
||||
get_object_vars($this));
|
||||
$params);
|
||||
}
|
||||
|
||||
protected function getUrlForAdjacentInSet($prevNext, ?Tag $tag, $activeFilter)
|
||||
|
@ -1,3 +1,27 @@
|
||||
/* Edit icon on tiled grids
|
||||
-----------------------------*/
|
||||
.polaroid {
|
||||
position: relative;
|
||||
}
|
||||
.polaroid a.edit {
|
||||
background: var(--bs-body-bg);
|
||||
border-radius: 3px;
|
||||
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
|
||||
color: var(--bs-body-color);
|
||||
opacity: 0;
|
||||
left: 20px;
|
||||
line-height: 1.5;
|
||||
padding: 5px 10px;
|
||||
position: absolute;
|
||||
transition: 0.25s;
|
||||
top: 20px;
|
||||
z-index: 50;
|
||||
}
|
||||
.polaroid:hover > a.edit {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/* Crop editor
|
||||
----------------*/
|
||||
#crop_editor {
|
||||
|
@ -296,34 +296,6 @@ div.polaroid a {
|
||||
}
|
||||
|
||||
|
||||
/* Edit icon on tiled grids
|
||||
-----------------------------*/
|
||||
.polaroid {
|
||||
position: relative;
|
||||
}
|
||||
.polaroid div.edit {
|
||||
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
|
||||
opacity: 0;
|
||||
left: 20px;
|
||||
position: absolute;
|
||||
transition: 0.25s;
|
||||
top: 20px;
|
||||
z-index: 50;
|
||||
}
|
||||
.polaroid div.edit .dropdown-item {
|
||||
line-height: 1.4;
|
||||
}
|
||||
.polaroid div.edit .dropdown-toggle {
|
||||
line-height: 1.4;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.polaroid div.edit .dropdown-toggle::after {
|
||||
margin-left: 0;
|
||||
}
|
||||
.polaroid:hover > div.edit {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/* Album title boxes
|
||||
----------------------*/
|
||||
|
@ -25,15 +25,7 @@ class PhotoPage extends Template
|
||||
|
||||
echo '
|
||||
<div class="row mt-5">
|
||||
<div class="col-lg">';
|
||||
|
||||
$this->photoMeta();
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<div class="col-lg">
|
||||
<div class="col-lg-9">
|
||||
<div id="sub_photo" class="content-box">';
|
||||
|
||||
$this->userActions();
|
||||
@ -47,6 +39,12 @@ class PhotoPage extends Template
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">';
|
||||
|
||||
$this->photoMeta();
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="', BASEURL, '/js/photonav.js"></script>';
|
||||
}
|
||||
@ -111,12 +109,12 @@ class PhotoPage extends Template
|
||||
private function photoMeta()
|
||||
{
|
||||
echo '
|
||||
<ul class="list-group list-group-horizontal photo_meta">';
|
||||
<ul class="list-group photo_meta">';
|
||||
|
||||
foreach ($this->metaData as $header => $body)
|
||||
{
|
||||
echo '
|
||||
<li class="list-group-item flex-fill">
|
||||
<li class="list-group-item">
|
||||
<h4>', $header, '</h4>
|
||||
', $body, '
|
||||
</li>';
|
||||
|
@ -81,28 +81,6 @@ class PhotosIndex extends Template
|
||||
$this->previous_header = $header;
|
||||
}
|
||||
|
||||
protected function editMenu(Image $image)
|
||||
{
|
||||
echo '
|
||||
<div class="edit dropdown">
|
||||
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '">Edit image</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getDeleteUrl(), '&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'" onclick="return confirm(\'Are you sure you want to delete this image?\');',
|
||||
'">Delete image</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '&inc_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Increase priority</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '&dec_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Decrease priority</a></li>
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
|
||||
protected function photo(Image $image, $className, $width, $height, $crop = true, $fit = true)
|
||||
{
|
||||
// Prefer thumbnail aspect ratio if available, otherwise use image aspect ratio.
|
||||
@ -112,7 +90,8 @@ class PhotosIndex extends Template
|
||||
<div class="polaroid ', $className, '" style="aspect-ratio: ', $aspectRatio, '">';
|
||||
|
||||
if ($this->show_edit_buttons)
|
||||
$this->editMenu($image);
|
||||
echo '
|
||||
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
|
||||
|
||||
echo '
|
||||
<a href="', $image->getPageUrl(), $this->url_suffix, '#photo_frame">';
|
||||
|
Loading…
x
Reference in New Issue
Block a user