only show some admin actions on some pages
This commit is contained in:
parent
faf35cc884
commit
f5a69e8fa9
@ -70,7 +70,7 @@ class Featured extends Extension
|
|||||||
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
|
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
if ($user->can(Permissions::EDIT_FEATURE)) {
|
if ($user->can(Permissions::EDIT_FEATURE) && $event->context == "view") {
|
||||||
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,15 +57,17 @@ class PixelFileHandler extends DataHandlerExtension
|
|||||||
|
|
||||||
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
|
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
|
||||||
{
|
{
|
||||||
$event->add_part("
|
if ($event->context == "view") {
|
||||||
<form>
|
$event->add_part("
|
||||||
<select class='shm-zoomer'>
|
<form>
|
||||||
<option value='full'>Full Size</option>
|
<select class='shm-zoomer'>
|
||||||
<option value='width'>Fit Width</option>
|
<option value='full'>Full Size</option>
|
||||||
<option value='height'>Fit Height</option>
|
<option value='width'>Fit Width</option>
|
||||||
<option value='both'>Fit Both</option>
|
<option value='height'>Fit Height</option>
|
||||||
</select>
|
<option value='both'>Fit Both</option>
|
||||||
</form>
|
</select>
|
||||||
", 20);
|
</form>
|
||||||
|
", 20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class ReportImageTheme extends Themelet
|
|||||||
$reporter_name = html_escape($report['reporter_name']);
|
$reporter_name = html_escape($report['reporter_name']);
|
||||||
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
|
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
|
||||||
|
|
||||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
|
$iabbe = new ImageAdminBlockBuildingEvent($image, $user, "report");
|
||||||
send_event($iabbe);
|
send_event($iabbe);
|
||||||
ksort($iabbe->parts);
|
ksort($iabbe->parts);
|
||||||
$actions = join("<br>", $iabbe->parts);
|
$actions = join("<br>", $iabbe->parts);
|
||||||
|
@ -6,12 +6,14 @@ class ImageAdminBlockBuildingEvent extends Event
|
|||||||
public array $parts = [];
|
public array $parts = [];
|
||||||
public Image $image;
|
public Image $image;
|
||||||
public User $user;
|
public User $user;
|
||||||
|
public string $context;
|
||||||
|
|
||||||
public function __construct(Image $image, User $user)
|
public function __construct(Image $image, User $user, string $context)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->image = $image;
|
$this->image = $image;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->context = $context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_part(string $html, int $position=50)
|
public function add_part(string $html, int $position=50)
|
||||||
|
@ -102,7 +102,7 @@ class ViewImage extends Extension
|
|||||||
ksort($iibbe->parts);
|
ksort($iibbe->parts);
|
||||||
$this->theme->display_page($image, $iibbe->parts);
|
$this->theme->display_page($image, $iibbe->parts);
|
||||||
|
|
||||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
|
$iabbe = new ImageAdminBlockBuildingEvent($image, $user, "view");
|
||||||
send_event($iabbe);
|
send_event($iabbe);
|
||||||
ksort($iabbe->parts);
|
ksort($iabbe->parts);
|
||||||
$this->theme->display_admin_block($page, $iabbe->parts);
|
$this->theme->display_admin_block($page, $iabbe->parts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user