This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/contrib/tagger/theme.php
Artanis de599ea131 [Tagger] Update
git-svn-id: file:///home/shish/svn/shimmie2/trunk@492 7f39781d-f577-437e-ae19-be835c7a54ca
2007-09-25 21:28:09 +00:00

30 lines
1.1 KiB
PHP

<?php
class taggerTheme extends Themelet {
public function build ($page, $tags) {
$html = "<div id='tagger_window' style='top:100px;left:800px;'>";
$html .= "<div id='tagger_titlebar' title='Drag to move' onmousedown='dragStart(event,\"tagger_window\");'>";
$html .= "Tagger";
$html .= "</div>";
$html .= "<div id='tagger_body' style='height:300px;'>";
$html .= "<input type='text' id='custTag' value=''></input><input type='button' value='Add' onclick='addTagById(\"custTag\")'></input><br/>";
foreach ($tags as $tag) {
$tag_name = $this->trimTag($tag['tag'],32);
$html .= "<a style='cursor:pointer;' onclick='addTag(\"".$tag['tag']."\");'title='Add \"".$tag['tag']."\" to the tag list'>".$tag_name."</a><br/>";
}
$html .= "</div></div>";
$page->add_block( new Block("Tagger",
"<span style='font-size:.8em;'>Collapse this block to hide Tagger.</span><br/><br/>Use: Click the links to add the tag to the list, when done, press Set to save the tags.".$html,
"left",
0));
}
public function trimTag($s,$len=80) {
if(strlen($s) > $len) {
$s = substr($s, 0,$len-1);
$s = substr($s,0, strrpos($s,'_'))."...";
}
return $s;
}
}
?>