diff --git a/controllers/ViewPhoto.php b/controllers/ViewPhoto.php index 61518e8..528c2d8 100644 --- a/controllers/ViewPhoto.php +++ b/controllers/ViewPhoto.php @@ -43,6 +43,11 @@ class ViewPhoto extends HTMLController if ($next_url) $page->setNextPhotoUrl($next_url); + $user = Registry::get('user'); + $author = $photo->getAuthor(); + if ($user->isAdmin() || $user->getUserId() === $author->getUserId()) + $page->setIsAssetOwner(true); + $this->page->adopt($page); $this->page->setCanonicalUrl($photo->getPageUrl()); diff --git a/public/css/default.css b/public/css/default.css index f677f5f..736b974 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -619,6 +619,16 @@ a#previous_photo:hover, a#next_photo:hover { margin: 0; } +#user_actions_box { + background: #fff; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); + margin: 25px 0 25px 0; + overflow: auto; + padding: 2%; + float: right; + width: 20%; +} + /* Responsive: smartphone in portrait ---------------------------------------*/ diff --git a/templates/PhotoPage.php b/templates/PhotoPage.php index 7820d54..ea3917c 100644 --- a/templates/PhotoPage.php +++ b/templates/PhotoPage.php @@ -12,6 +12,7 @@ class PhotoPage extends SubTemplate private $exif; private $previous_photo_url = ''; private $next_photo_url = ''; + private $is_asset_owner = false; public function __construct(Image $photo) { @@ -28,6 +29,10 @@ class PhotoPage extends SubTemplate $this->next_photo_url = $url; } + public function setIsAssetOwner($flag) { + $this->is_asset_owner = $flag; + } + protected function html_content() { $this->photoNav(); @@ -45,6 +50,10 @@ class PhotoPage extends SubTemplate $this->photoMeta(); + if($this->is_asset_owner) { + $this->addUserActions(); + } + echo ' '; } @@ -183,4 +192,13 @@ class PhotoPage extends SubTemplate { $this->exif = $exif; } + + public function addUserActions() + { + echo ' +