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
|
|
|
|
2007-09-25 21:28:09 +00:00
|
|
|
class taggerTheme extends Themelet {
|
2007-10-23 22:08:22 +00:00
|
|
|
public function build_tagger ($page, $event) {
|
|
|
|
// Initialization code
|
|
|
|
// TODO: AJAX test and fallback.
|
|
|
|
$page->add_block(new Block(null,
|
|
|
|
"<script type='text/javascript'>
|
|
|
|
var query = '".make_link("tagger/tags")."';
|
|
|
|
var image_id = ".$event->get_image()->id.";
|
|
|
|
var tagger_filter_timer = null;
|
|
|
|
var Tagger = new Tagger();
|
|
|
|
Tagger.initialize();
|
|
|
|
</script>","main",1000));
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
// Tagger block
|
2007-09-30 08:53:47 +00:00
|
|
|
$page->add_block( new Block(
|
|
|
|
"Tagger",
|
2007-10-23 22:08:22 +00:00
|
|
|
$this->html($event->get_image()),
|
|
|
|
"main"));
|
2007-09-25 21:28:09 +00:00
|
|
|
}
|
2007-10-23 22:08:22 +00:00
|
|
|
private function html($image) {
|
|
|
|
$i_image_id = int_escape($image->id);
|
|
|
|
$h_source = html_escape($image->source);
|
|
|
|
if(isset($_GET['search'])) {$h_query = "search=".url_escape($_GET['search']);}
|
|
|
|
else {$h_query = "";}
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
$url_form = make_link("tag_edit/set");
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
$html = <<< EOD
|
|
|
|
<div id="tagger_parent" style="display:none;">
|
|
|
|
<div id="tagger_titlebar">Tagger</div>
|
2007-10-02 18:44:29 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
<div id="tagger_toolbar">
|
|
|
|
<input type="text" value="" id="tagger_filter" onkeyup="Tagger.tagSearch(this.value, 500);"></input>
|
|
|
|
<input type="button" value="Add" onclick="Tagger.createTag(byId('tagger_filter').value);"></input>
|
|
|
|
<form action="$url_form" method="POST" onsubmit="Tagger.submit();">
|
|
|
|
<input type='hidden' name='image_id' value='$i_image_id' id="image_id"></input>
|
|
|
|
<input type='hidden' name='query' value='$h_query'></input>
|
|
|
|
<input type='hidden' name='source' value='$h_source'></input>
|
|
|
|
<input type="hidden" name="tags" value="" id="tagger_tags"></input>
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
<input type="submit" value="Set"></input>
|
|
|
|
</form>
|
|
|
|
<!--<ul id="tagger_p-menu"></ul>
|
|
|
|
<br style="clear:both;"/>-->
|
|
|
|
</div>
|
2007-09-30 08:53:47 +00:00
|
|
|
|
2007-10-23 22:08:22 +00:00
|
|
|
<div id="tagger_body">
|
|
|
|
<div id="tagger_p-applied" name="Applied Tags"></div>
|
|
|
|
<div id="tagger_p-search" name="Searched Tags"></div>
|
|
|
|
</div>
|
|
|
|
<div id="tagger_statusbar"></div>
|
|
|
|
</div>
|
|
|
|
EOD;
|
|
|
|
return $html;
|
2007-09-25 21:28:09 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-25 10:16:26 +00:00
|
|
|
?>
|