2007-09-25 21:28:09 +00:00
|
|
|
<?php
|
2007-10-23 22:08:22 +00:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Tagger - Advanced Tagging v2 *
|
|
|
|
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
|
|
|
* Do not remove this notice. *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
2007-09-28 05:10:44 +00:00
|
|
|
|
2019-09-29 16:37:03 +00:00
|
|
|
class TaggerTheme extends Themelet
|
2019-05-28 16:59:38 +00:00
|
|
|
{
|
|
|
|
public function build_tagger(Page $page, $event)
|
|
|
|
{
|
|
|
|
// Initialization code
|
|
|
|
$base_href = get_base_href();
|
|
|
|
// TODO: AJAX test and fallback.
|
2014-04-25 02:13:00 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
|
|
|
|
$page->add_block(new Block(
|
|
|
|
null,
|
|
|
|
"<script type='text/javascript'>
|
2014-04-25 02:13:00 +00:00
|
|
|
$( document ).ready(function() {
|
|
|
|
Tagger.initialize(".$event->get_image()->id.");
|
|
|
|
});
|
2019-05-28 16:59:38 +00:00
|
|
|
</script>",
|
|
|
|
"main",
|
|
|
|
1000
|
|
|
|
));
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
// Tagger block
|
|
|
|
$page->add_block(new Block(
|
|
|
|
null,
|
|
|
|
$this->html($event->get_image()),
|
|
|
|
"main"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
private function html(Image $image)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
$i_image_id = int_escape($image->id);
|
|
|
|
$h_source = html_escape($image->source);
|
|
|
|
$h_query = isset($_GET['search'])? $h_query= "search=".url_escape($_GET['search']) : "";
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$delay = $config->get_string("ext_tagger_search_delay", "250");
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$url_form = make_link("tag_edit/set");
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
// TODO: option for initial Tagger window placement.
|
|
|
|
$html = <<< EOD
|
2007-10-23 23:03:41 +00:00
|
|
|
<div id="tagger_parent" style="display:none; top:25px; right:25px;">
|
2007-10-23 22:08:22 +00:00
|
|
|
<div id="tagger_titlebar">Tagger</div>
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
<div id="tagger_toolbar">
|
2019-05-29 17:23:29 +00:00
|
|
|
<input type="text" value="" id="tagger_filter" onkeyup="Tagger.tag.search(this.value, $delay);" />
|
|
|
|
<input type="button" value="Add" onclick="Tagger.tag.create(byId('tagger_filter').value);" />
|
2007-10-31 21:30:41 +00:00
|
|
|
<form action="$url_form" method="POST" onsubmit="Tagger.tag.submit();">
|
2019-05-29 17:23:29 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image_id' id="image_id" />
|
|
|
|
<input type='hidden' name='query' value='$h_query' />
|
|
|
|
<input type='hidden' name='source' value='$h_source' />
|
|
|
|
<input type="hidden" name="tags" value="" id="tagger_tags" />
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2019-05-29 17:23:29 +00:00
|
|
|
<input type="submit" value="Set" />
|
2007-10-23 22:08:22 +00:00
|
|
|
</form>
|
|
|
|
<!--<ul id="tagger_p-menu"></ul>
|
|
|
|
<br style="clear:both;"/>-->
|
|
|
|
</div>
|
2009-01-04 19:18:37 +00:00
|
|
|
|
|
|
|
<div id="tagger_body">
|
2007-10-23 22:08:22 +00:00
|
|
|
<div id="tagger_p-search" name="Searched Tags"></div>
|
2007-10-31 21:30:41 +00:00
|
|
|
<div id="tagger_p-applied" name="Applied Tags"></div>
|
2007-10-23 22:08:22 +00:00
|
|
|
</div>
|
|
|
|
<div id="tagger_statusbar"></div>
|
|
|
|
</div>
|
|
|
|
EOD;
|
2019-05-28 16:59:38 +00:00
|
|
|
return $html;
|
|
|
|
}
|
2007-09-25 21:28:09 +00:00
|
|
|
}
|