2007-07-16 14:36:29 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class ViewImageTheme extends Themelet
|
|
|
|
{
|
|
|
|
public function display_meta_headers(Image $image)
|
|
|
|
{
|
|
|
|
global $page;
|
2010-05-28 01:07:33 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$h_metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
|
|
|
|
$page->add_html_header("<meta name=\"keywords\" content=\"$h_metatags\">");
|
|
|
|
$page->add_html_header("<meta property=\"og:title\" content=\"$h_metatags\">");
|
|
|
|
$page->add_html_header("<meta property=\"og:type\" content=\"article\">");
|
|
|
|
$page->add_html_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
|
|
|
|
$page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
|
|
|
|
}
|
2018-11-05 19:17:42 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
/*
|
|
|
|
* Build a page showing $image and some info about it
|
|
|
|
*/
|
|
|
|
public function display_page(Image $image, $editor_parts)
|
|
|
|
{
|
|
|
|
global $page;
|
|
|
|
$page->set_heading(html_escape($image->get_tag_list()));
|
|
|
|
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
|
|
|
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 20));
|
|
|
|
//$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
|
|
|
}
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function display_admin_block(Page $page, $parts)
|
|
|
|
{
|
|
|
|
if (count($parts) > 0) {
|
|
|
|
$page->add_block(new Block("Image Controls", join("<br>", $parts), "left", 50));
|
|
|
|
}
|
|
|
|
}
|
2008-06-14 11:36:19 +00:00
|
|
|
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
protected function build_pin(Image $image)
|
|
|
|
{
|
|
|
|
if (isset($_GET['search'])) {
|
|
|
|
$query = "search=".url_escape($_GET['search']);
|
|
|
|
} else {
|
|
|
|
$query = null;
|
|
|
|
}
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$h_prev = "<a id='prevlink' href='".make_link("post/prev/{$image->id}", $query)."'>Prev</a>";
|
|
|
|
$h_index = "<a href='".make_link()."'>Index</a>";
|
|
|
|
$h_next = "<a id='nextlink' href='".make_link("post/next/{$image->id}", $query)."'>Next</a>";
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
return "$h_prev | $h_index | $h_next";
|
|
|
|
}
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
protected function build_navigation(Image $image): string
|
|
|
|
{
|
|
|
|
$h_pin = $this->build_pin($image);
|
|
|
|
$h_search = "
|
2007-07-26 13:19:39 +00:00
|
|
|
<p><form action='".make_link()."' method='GET'>
|
2010-07-26 10:18:07 +00:00
|
|
|
<input type='hidden' name='q' value='/post/list'>
|
2015-01-06 13:04:39 +00:00
|
|
|
<input type='search' name='search' placeholder='Search' class='autocomplete_tags' autocomplete='off'>
|
2007-07-16 14:36:29 +00:00
|
|
|
<input type='submit' value='Find' style='display: none;'>
|
|
|
|
</form>
|
2012-02-09 14:38:32 +00:00
|
|
|
";
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
return "$h_pin<br>$h_search";
|
|
|
|
}
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
protected function build_info(Image $image, $editor_parts)
|
|
|
|
{
|
|
|
|
global $user;
|
2007-07-16 14:36:29 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
if (count($editor_parts) == 0) {
|
|
|
|
return ($image->is_locked() ? "<br>[Image Locked]" : "");
|
|
|
|
}
|
2008-12-16 05:29:48 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$html = make_form(make_link("post/set"))."
|
2007-11-14 10:11:56 +00:00
|
|
|
<input type='hidden' name='image_id' value='{$image->id}'>
|
2018-07-25 23:27:39 +00:00
|
|
|
<table style='width: 500px; max-width: 100%;' class='image_info form'>
|
2007-11-14 10:11:56 +00:00
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
foreach ($editor_parts as $part) {
|
|
|
|
$html .= $part;
|
|
|
|
}
|
|
|
|
if (
|
2019-07-09 14:10:21 +00:00
|
|
|
(!$image->is_locked() || $user->can(Permissions::EDIT_IMAGE_LOCK)) &&
|
|
|
|
$user->can(Permissions::EDIT_IMAGE_TAG)
|
2019-05-28 16:59:38 +00:00
|
|
|
) {
|
|
|
|
$html .= "
|
2012-02-09 17:03:39 +00:00
|
|
|
<tr><td colspan='4'>
|
|
|
|
<input class='view' type='button' value='Edit' onclick='$(\".view\").hide(); $(\".edit\").show();'>
|
|
|
|
<input class='edit' type='submit' value='Set'>
|
|
|
|
</td></tr>
|
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
$html .= "
|
2008-04-08 16:54:13 +00:00
|
|
|
</table>
|
2008-03-24 04:05:42 +00:00
|
|
|
</form>
|
2007-11-14 10:11:56 +00:00
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
return $html;
|
|
|
|
}
|
2007-07-16 14:36:29 +00:00
|
|
|
}
|