Tagger 20070926 0240

git-svn-id: file:///home/shish/svn/shimmie2/trunk@494 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
Artanis 2007-09-26 09:40:51 +00:00
parent aa2d6537de
commit 27473f272a
3 changed files with 54 additions and 28 deletions

View File

@ -16,11 +16,23 @@ function tagExists(tag) {
return false;
}
function addTag(tag) {
function toggleTag(tag) {
var tags = byId("tags");
var tag_link = byId("tagger_tag_"+tag);
if (!tagExists(tag)) {
// append tag to tag box.
var tags = byId("tags");
tags.value = tags.value +" "+ tag;
// set indicator
if(tag_link) {
tag_link.style.fontWeight = "bold";
}
} else {
// remove tag
tags.value=tags.value.replace(" "+tag,"");
// set indicator
if(tag_link) {
tag_link.style.fontWeight = "";
}
}
}
@ -29,6 +41,23 @@ function addTagById(id) {
addTag(tag.value);
}
function setTagIndicators(id) {
tagger = byId(id);
tagger.onclick = null;
tags = byId("tags");
tags = tags.value.split(" ");
for (x in tags) {
tag = tags[x];
obj = byId("tagger_tag_"+tag);
if(obj) {
obj.style.fontWeight="bold";
}
}
}
function tagger_filter(id) {
var filter = byId(id);
var e;

View File

@ -25,3 +25,7 @@
border-top:none;
background-color:white;
}
#tagger_body a {
font-size:1.5em;
}

View File

@ -1,37 +1,31 @@
<?php
class taggerTheme extends Themelet {
public function build ($page, $tags) {
$tag_html = "";
foreach ($tags as $tag) {
$tag_name = $tag['tag'];
$tag_trunc = $this->trimTag($tag_name,32);
$tag_trunc = $this->trimTag($tag_name,16);
$tag_html .= "<div id='tagger_tag_".$tag_name."'>"."
<a style='cursor:pointer;' onclick='addTag(&quot;".$tag_name."&quot;);' ".
<a style='cursor:pointer;' onclick='toggleTag(&quot;".$tag_name."&quot;);' ".
"title='Add &quot;".$tag_name."&quot; to the tag list'>".$tag_trunc."</a>".
"</div>";
}
$url_more = make_link("about/tagger");
$html = <<<EOD
<span style="font-size:.7em;">Collapse this block to hide Tagger.</span>
<br/>
<h4>Use</h4>
<ul>
<li>Click the links to add the tag to the list, when done, press Set to save the tags.</li>
<li>Type in the filter box to remove tags you aren&#39;t looking for.</li>
<li>Enter tags not on the list in the second box. Tags must have 2 uses to display in the list.</li>
<li><a href='$url_more'>More</a></li>
</ul>
<div id="tagger_window" style="top:100px;left:800px;">
<a href='$url_more'>About Tagger</a>
<div id="tagger_window" style="top:100px;left:100px;" onmousedown="setTagIndicators(&quot;tagger_window&quot;);">
<div id="tagger_titlebar" title="'Drag to move" onmousedown="dragStart(event,&quot;tagger_window&quot;);">
Tagger
</div>
<div id="tagger_body" style="height:300px;">
<input type="text" id="tagger_filter" onkeyup="tagger_filter(&quot;tagger_filter&quot;)" size="12"></input>
<input type="text" id="tagger_custTag" value="" onkeyup="tagger_filter(&quot;tagger_custTag&quot;)" size='12'></input>
<input type="button" value="Add" onclick="addTagById(&quot;tagger_custTag&quot;)"></input>
<hr/>
<input type="text" id="custTag" value="" size='12'></input>
<input type="button" value="Add" onclick="addTagById(&quot;custTag&quot;)"></input>
<hr/>
$tag_html
$tag_html
</div>
</div>
EOD;
@ -52,21 +46,20 @@ EOD;
public function show_about ($event) {
global $page;
$html = <<<EOD
<h4>Author</h4>
Erik Youngren (Artanis) artanis.00@gmail.com
<h4>Use</h4>
<ul>
<li>Click the links to add the tag to the image&#39;s tag list, when done, press Set to save the tags.</li>
<li>Type in the filter box to remove tags you aren&#39;t looking for.<ul>
<li>Single letter filters will only match the first letter of the tags.</li>
<li>2 or more will match that letter combination anywhere in the tag. Starting a
filter with a space (' ') will prevent this behaviour.</li>
</ul></li>
<li>Enter tags not on the list in the second box. Tags must have 2 uses to display in the list.</li>
<li>
If you are having trouble finding the tag you are looking for, enter it into the box at the top.<br/>
As you type, Tagger will remove tags that do not match to aid your search.<br/>
If it is not in the list, click Add to add the tag to the image&#39;s tag list.<br/>
Tags must have two uses to appear in Tagger&#39;s list, so you'll have to enter the tag at least once more.
</li>
</ul>
EOD;
$page->add_block( new Block("About Tagger", $html,"main"));
$page->set_title("About Extension: Tagger");
$page->set_heading("About Extension: Tagger");
$page->add_block( new Block("Author","Erik Youngren (Artanis) artanis.00@gmail.com","main",0));
$page->add_block( new Block("Use", $html,"main",1));
}
}
?>