info as part of view ext
This commit is contained in:
parent
804fc038bf
commit
49e4c3f9c7
@ -17,6 +17,7 @@ abstract class ImageConfig
|
|||||||
const ILINK = 'image_ilink';
|
const ILINK = 'image_ilink';
|
||||||
const TLINK = 'image_tlink';
|
const TLINK = 'image_tlink';
|
||||||
const TIP = 'image_tip';
|
const TIP = 'image_tip';
|
||||||
|
const INFO = 'image_info';
|
||||||
const EXPIRES = 'image_expires';
|
const EXPIRES = 'image_expires';
|
||||||
const UPLOAD_COLLISION_HANDLER = 'upload_collision_handler';
|
const UPLOAD_COLLISION_HANDLER = 'upload_collision_handler';
|
||||||
|
|
||||||
|
@ -46,12 +46,6 @@ class Rule34 extends Extension
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$event->add_part($html, 90);
|
$event->add_part($html, 90);
|
||||||
|
|
||||||
$html = (string)TR(
|
|
||||||
TH("Info"),
|
|
||||||
TD($event->image->parse_link_template('$size // $filesize // $ext'))
|
|
||||||
);
|
|
||||||
$event->add_part($html, 90);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onAdminBuilding(AdminBuildingEvent $event)
|
public function onAdminBuilding(AdminBuildingEvent $event)
|
||||||
|
@ -5,6 +5,9 @@ require_once "events/image_info_box_building_event.php";
|
|||||||
require_once "events/image_info_set_event.php";
|
require_once "events/image_info_set_event.php";
|
||||||
require_once "events/image_admin_block_building_event.php";
|
require_once "events/image_admin_block_building_event.php";
|
||||||
|
|
||||||
|
use function MicroHTML\TR;
|
||||||
|
use function MicroHTML\TH;
|
||||||
|
use function MicroHTML\TD;
|
||||||
|
|
||||||
class ViewImage extends Extension
|
class ViewImage extends Extension
|
||||||
{
|
{
|
||||||
@ -98,4 +101,17 @@ class ViewImage extends Extension
|
|||||||
ksort($iabbe->parts);
|
ksort($iabbe->parts);
|
||||||
$this->theme->display_admin_block($page, $iabbe->parts);
|
$this->theme->display_admin_block($page, $iabbe->parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$image_info = $config->get_string(ImageConfig::INFO);
|
||||||
|
if ($image_info) {
|
||||||
|
$html = (string)TR(
|
||||||
|
TH("Info"),
|
||||||
|
TD($event->image->parse_link_template($image_info))
|
||||||
|
);
|
||||||
|
$event->add_part($html, 85);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,18 @@ class ViewImageTest extends ShimmiePHPUnitTestCase
|
|||||||
$this->assert_title("Image $image_id_1: test");
|
$this->assert_title("Image $image_id_1: test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testViewInfo()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||||
|
|
||||||
|
$config->set_string(ImageConfig::INFO, '$size // $filesize // $ext');
|
||||||
|
$this->get_page("post/view/$image_id_1");
|
||||||
|
$this->assert_text("640x480 // 19.3KB // jpg");
|
||||||
|
}
|
||||||
|
|
||||||
public function testPrevNext()
|
public function testPrevNext()
|
||||||
{
|
{
|
||||||
$this->log_in_as_user();
|
$this->log_in_as_user();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user