Adds a Confirm Delete page and actually delete the assets.

This commit is contained in:
2018-07-07 12:21:12 +00:00
parent 344db6e4c5
commit e40c05c1f8
7 changed files with 114 additions and 2 deletions

View File

@@ -0,0 +1,52 @@
<?php
/*****************************************************************************
* ConfirmDeletePage.php
* Contains the confirm delete page template.
*
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
*****************************************************************************/
class ConfirmDeletePage extends SubTemplate
{
private $photo;
public function __construct(Image $photo)
{
$this->photo = $photo;
}
protected function html_content()
{
$this->confirm();
$this->photo();
}
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>';
}
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>';
}
}

View File

@@ -23,7 +23,7 @@ class EditAssetForm extends SubTemplate
<form id="asset_form" action="" method="post" enctype="multipart/form-data">
<div class="boxed_content" style="margin-bottom: 2%">
<div style="float: right">
<a class="btn btn-red" href="', BASEURL, '/editasset/?id=', $this->asset->getId(), '&delete">Delete asset</a>
<a class="btn btn-red" href="', BASEURL, '/confirmdelete?slug=', $this->asset->getSlug(), '>Delete asset</a>
<input type="submit" value="Save asset data">
</div>
<h2>Edit asset \'', $this->asset->getTitle(), '\' (', $this->asset->getFilename(), ')</h2>

View File

@@ -198,7 +198,7 @@ class PhotoPage extends SubTemplate
echo '
<div id=user_actions_box>
<h3>Actions</h3>
<a class="btn btn-red" href="', BASEURL, '/editasset/?id=', $this->photo->getId(), '&delete">Delete asset</a>
<a class="btn btn-red" href="', BASEURL, '/confirmdelete?slug=', $this->photo->getSlug(), '">Delete</a>
</div>';
}
}