PhotosIndex: allow setting image as the album cover as well
This commit is contained in:
parent
0487ad16b9
commit
24c2e9cdcf
@ -46,6 +46,18 @@ class EditAsset extends HTMLController
|
||||
header('Location: ' . BASEURL . '/' . $asset->getSubdir());
|
||||
exit;
|
||||
}
|
||||
else if (isset($_REQUEST['album_cover'], $_REQUEST['in']) && Session::validateSession('get'))
|
||||
{
|
||||
$tag = Tag::fromId($_REQUEST['in']);
|
||||
$tag->id_asset_thumb = $asset->getId();
|
||||
$tag->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 = [];
|
||||
|
@ -13,7 +13,9 @@ class PhotosIndex extends Template
|
||||
protected $show_headers;
|
||||
protected $show_labels;
|
||||
protected $previous_header = '';
|
||||
protected $url_suffix;
|
||||
|
||||
protected $edit_url_suffix;
|
||||
protected $photo_url_suffix;
|
||||
|
||||
const PANORAMA_WIDTH = 1256;
|
||||
const PANORAMA_HEIGHT = null;
|
||||
@ -83,20 +85,25 @@ class PhotosIndex extends Template
|
||||
|
||||
protected function editMenu(Image $image)
|
||||
{
|
||||
$edit_url = $image->getEditUrl() . $this->edit_url_suffix;
|
||||
|
||||
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="', $edit_url, '">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&',
|
||||
<li><a class="dropdown-item" href="', $edit_url, '&album_cover&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Make album cover</a></li>
|
||||
<li><a class="dropdown-item" href="', $edit_url, '&inc_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Increase priority</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '&dec_prio&',
|
||||
<li><a class="dropdown-item" href="', $edit_url, '&dec_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Decrease priority</a></li>
|
||||
</ul>
|
||||
@ -115,7 +122,7 @@ class PhotosIndex extends Template
|
||||
$this->editMenu($image);
|
||||
|
||||
echo '
|
||||
<a href="', $image->getPageUrl(), $this->url_suffix, '#photo_frame">';
|
||||
<a href="', $image->getPageUrl(), $this->photo_url_suffix, '#photo_frame">';
|
||||
|
||||
|
||||
foreach (['normal-photo', 'blur-photo'] as $className)
|
||||
@ -342,6 +349,7 @@ class PhotosIndex extends Template
|
||||
|
||||
public function setUrlSuffix($suffix)
|
||||
{
|
||||
$this->url_suffix = $suffix;
|
||||
$this->photo_url_suffix = $suffix;
|
||||
$this->edit_url_suffix = str_replace('?', '&', $suffix);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user