) // Do not remove this notice. class taggerTheme extends Themelet { public function build($event,$tags) { // When overriding this function, take care that all tag attributes are // maintained UNCHANGED. There are no attributes in the HTML code below // that go unused by the javascript. If you fail to do this, // the extension will BREAK! // // Now that that's sunk in, chaniging title attributes is fine. global $config; global $page; // set up data $base_href = $config->get_string('base_href'); $tagme = $config->get_string( 'ext-tagger_clear-tagme','N')=="Y"? "": null; $url_about = make_link("about/tagger"); // build floater tags $h_tags = ""; foreach($tags as $tag) { $h_tags .= $this->tag_to_html($tag); } $html = "
Collapse this block to hide Tagger
About Tagger
". // Tagger Floater "
Tagger
$tagme
View Applied Tags | Refresh Filter
$h_tags
"; $page->add_block( new Block( "Tagger", $html, "left")); $page->add_header( ""); } final public function show_about ($event) { // The about page for Tagger. No override. Feel free to CSS it, though. global $page; global $config; $base_href = $config->get_string('base_href'); $script1 = "$base_href/ext/tagger/script.js"; $script2 = "$base_href/ext/tagger/webtoolkit.drag.js"; $html = str_replace("\"",""",str_replace("\'","'"," ")); $page->set_title("Shimmie - About / Tagger - Advanced Tagging"); $page->set_heading("About / Tagger - Advanced Tagging"); $page->add_block( new Block("Author", "Artanis (Erik Youngren <artanis.00@gmail.com>)","main",0)); $page->add_block( new Block("Use", $html,"main",1)); } function configTagger($page/*,$presets*/) { $presets = array( 'test_set_01' => 'tag set 01', 'test_set_02' => 'tag set 02', 'tsuryuya' => 'tsuryuya hair_green eyes_yellow suzumiya_haruhi_no_yuutsu', 'suzumiya_haruhi' => 'suzumiya_haruhi hair_brown eyes_brown suzumiya_haruhi_no_yuutsu'); $html=""; $html .= ""; foreach($presets as $keyname => $tags) { $html .= ""; } $html .= "
Set NameTags
$keyname$tags
"; $page->set_title("Shimmie / Configure / Tagger"); $page->set_heading("Configure / Tagger"); $page->add_block( new Block("Tag Presets",$html,'main',0)); } final function tag_to_html ($tag) { // Important for script.js, no override. You can CSS this, though. // If you must, remove the 'final' keyword, but MAKE SURE the entire // tag is COPIED TO THE NEW FUNCTION EXACTLY! If you fail to do this, // the extension will BREAK! $tag_name = $tag['tag']; $tag_id = $this->tag_id($tag_name); $stag = $this->trimTag($tag_name,20,"_"); $html = " $stag"; return $html; } // Important for script.js, no override. final function tag_id ($tag) { $tag_id = ""; $m=null; for($i=0; $i < strlen($tag); $i++) { $l = substr($tag,$i,1); $m=null; preg_match("[\pP]",$l,$m); $tag_id .= !isset($m[0]) ? $l:"_"; } return trim(str_replace("__","_",$tag_id)," _"); } function trimTag($s,$len=80,$br=" ") { if(strlen($s) > $len) { $s = substr($s, 0,$len-1); $s = substr($s,0, strrpos($s,$br))."..."; } return $s; } } ?>