[Tagger] Update
git-svn-id: file:///home/shish/svn/shimmie2/trunk@492 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
b9b36f3205
commit
de599ea131
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
// author: Erik Youngren
|
||||
// email: artanis.00@gmail.com
|
||||
class tagger extends Extension {
|
||||
var $theme;
|
||||
|
||||
@ -15,12 +13,12 @@ class tagger extends Extension {
|
||||
$tags = $database->Execute("
|
||||
SELECT tag
|
||||
FROM `tags`
|
||||
WHERE count > 1
|
||||
WHERE count > 1 AND substring(tag,1,1) != '.'
|
||||
ORDER BY tag");
|
||||
|
||||
$this->theme->build($page, $tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_event_listener(new tagger());
|
||||
add_event_listener( new tagger());
|
||||
?>
|
||||
|
@ -24,6 +24,11 @@ function addTag(tag) {
|
||||
}
|
||||
}
|
||||
|
||||
function addTagById(id) {
|
||||
tag = byId(id);
|
||||
addTag(tag.value);
|
||||
}
|
||||
|
||||
// Drag Code //
|
||||
//*****************************************************************************
|
||||
// Do not remove this notice.
|
||||
|
27
contrib/tagger/style.css
Normal file
27
contrib/tagger/style.css
Normal file
@ -0,0 +1,27 @@
|
||||
/* Tagger Cascading Style Sheet *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#tagger_window {
|
||||
position:fixed;
|
||||
}
|
||||
|
||||
#tagger_titlebar {
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
position:relative;
|
||||
top:-0em;
|
||||
padding:.25em;
|
||||
border:2px solid;
|
||||
border-bottom:1px solid;
|
||||
-moz-border-radius:10px 10px 0px 0px;
|
||||
background-color:white;
|
||||
cursor:move;
|
||||
}
|
||||
|
||||
#tagger_body {
|
||||
overflow:scroll;
|
||||
padding:1em;
|
||||
border:2px solid;
|
||||
border-top:none;
|
||||
background-color:white;
|
||||
}
|
@ -1,16 +1,30 @@
|
||||
<?php
|
||||
class taggerTheme extends Themelet {
|
||||
public function build ($page, $tags) {
|
||||
$html = "<div onmousedown='dragStart(event);' style='position:fixed;top:100px;left:800px;height:400px;overflow:scroll;padding:1em;border:2px solid;background-color:white;'>";
|
||||
foreach ($tags as $tag) {
|
||||
$html .= "<input type='button' style='width:10em;' onclick='javascript:addTag(\"".$tag['tag']."\");' value='".$tag['tag']."'></input><br/>";
|
||||
}
|
||||
$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(null,
|
||||
$html,
|
||||
"main",
|
||||
1000));
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user