Changes the ConfirmDelete page and updates database code.

The ConfirmDelete page now uses parts of the photopage. The
Confirmation dialog is its own template which is based on Alert.

The database now updates the album thumb to the most recent
addition to the album, when the album thumb asset is being deleted.
When there are no pictures left in the album 0 will be set.
This commit is contained in:
2018-07-08 08:19:37 +00:00
parent e40c05c1f8
commit 16ec547064
12 changed files with 197 additions and 113 deletions

View File

@@ -6,13 +6,11 @@
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
*****************************************************************************/
class ConfirmDeletePage extends SubTemplate
class ConfirmDeletePage extends PhotoPage
{
private $photo;
public function __construct(Image $photo)
{
$this->photo = $photo;
parent::__construct($photo);
}
protected function html_content()
@@ -23,30 +21,15 @@ class ConfirmDeletePage extends SubTemplate
private function confirm()
{
echo '
<div id=confirm_box>
<h1>Confirm deletion</h1>
<p>You are about to permanently delete the following photo.</p>
<a class="btn btn-red" href="', BASEURL, '/confirmdelete?slug=', $this->photo->getSlug(), '&confirmed">Delete</a>
<a class="btn" href="', $this->photo->getPageUrl(), '"> Cancel</a>
</div>';
}
$buttons = [];
$buttons[] = new Button("Delete", BASEURL . '/' . $this->photo->getSlug() . '?delete_confirmed', "btn btn-red");
$buttons[] = new Button("Cancel", $this->photo->getPageUrl(), "btn");
private function photo()
{
echo '
<div id="photo_frame">
<a href="', $this->photo->getUrl(), '">';
if ($this->photo->isPortrait())
echo '
<img src="', $this->photo->getThumbnailUrl(null, 960), '" alt="">';
else
echo '
<img src="', $this->photo->getThumbnailUrl(1280, null), '" alt="">';
echo '
</a>
</div>';
$alert = new WarningDialog(
"Confirm deletion.",
"You are about to permanently delete the following photo.",
$buttons
);
$alert->html_content();
}
}