Tagger: 20070928 1426
git-svn-id: file:///home/shish/svn/shimmie2/trunk@498 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
ef0e4190cc
commit
773b51fce7
@ -30,7 +30,9 @@ class tagger extends Extension {
|
|||||||
|
|
||||||
$base_href = $config->get_string('base_href');
|
$base_href = $config->get_string('base_href');
|
||||||
$tags_min = $config->get_int('ext-tagger_tags-min',2);
|
$tags_min = $config->get_int('ext-tagger_tags-min',2);
|
||||||
$hidden = $config->get_bool('ext-tagger_respect-hidden',true) ? "AND substring(tag,1,1) != '.' " : null;
|
$hidden = $config->get_bool(
|
||||||
|
'ext-tagger_respect-hidden',
|
||||||
|
true) ? "AND substring(tag,1,1) != '.' " : null;
|
||||||
|
|
||||||
$tags = $database->Execute("
|
$tags = $database->Execute("
|
||||||
SELECT tag
|
SELECT tag
|
||||||
@ -51,8 +53,12 @@ class tagger extends Extension {
|
|||||||
if(is_a($event, 'SetupBuildingEvent')) {
|
if(is_a($event, 'SetupBuildingEvent')) {
|
||||||
$sb = new SetupBlock("Tagger - Power Tagging");
|
$sb = new SetupBlock("Tagger - Power Tagging");
|
||||||
$sb->add_bool_option("ext-tagger_show-hidden", "Show Hidden Tags");
|
$sb->add_bool_option("ext-tagger_show-hidden", "Show Hidden Tags");
|
||||||
$sb->add_bool_option("ext-tagger_clear-tagme", "<br/>Remove '<a href='".make_link("post/list/tagme/1")."'>tagme</a>' on use");
|
$sb->add_bool_option(
|
||||||
$sb->add_int_option("ext-tagger_tags-min", "<br/>Ignore tags used fewer than "); $sb->add_label("times.");
|
"ext-tagger_clear-tagme",
|
||||||
|
"<br/>Remove '<a href='".make_link("post/list/tagme/1")."'>tagme</a>' on use");
|
||||||
|
$sb->add_int_option(
|
||||||
|
"ext-tagger_tags-min",
|
||||||
|
"<br/>Ignore tags used fewer than "); $sb->add_label("times.");
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ function taggerResetPos() {
|
|||||||
// In case the drag point goes off screen.
|
// In case the drag point goes off screen.
|
||||||
tagger = byId("tagger_window");
|
tagger = byId("tagger_window");
|
||||||
|
|
||||||
// reset default position (bottom right.)
|
|
||||||
tagger.style.top="";
|
tagger.style.top="";
|
||||||
tagger.style.left="";
|
tagger.style.left="";
|
||||||
tagger.style.right="25px";
|
tagger.style.right="25px";
|
||||||
@ -17,7 +16,6 @@ function taggerResetPos() {
|
|||||||
// get location in (left,top) terms
|
// get location in (left,top) terms
|
||||||
pos = findPos(tagger);
|
pos = findPos(tagger);
|
||||||
|
|
||||||
// set top left and clear bottom right.
|
|
||||||
tagger.style.top = pos[1]+"px";
|
tagger.style.top = pos[1]+"px";
|
||||||
tagger.style.left = pos[0]+"px";
|
tagger.style.left = pos[0]+"px";
|
||||||
tagger.style.right="";
|
tagger.style.right="";
|
||||||
@ -39,8 +37,6 @@ function tagExists(tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleTag(tag,rTagme) {
|
function toggleTag(tag,rTagme) {
|
||||||
|
|
||||||
|
|
||||||
if (!tagExists(tag)) {
|
if (!tagExists(tag)) {
|
||||||
addTag(tag);
|
addTag(tag);
|
||||||
if(rTagme && tag != "tagme") {
|
if(rTagme && tag != "tagme") {
|
||||||
@ -107,7 +103,27 @@ function setTagIndicators() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushSet(form_id) {
|
||||||
|
var set = getSetButton(form_id);
|
||||||
|
if(set) {
|
||||||
|
set.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSetButton(form_id) {
|
||||||
|
var form_nodes = getElementsByTagNames('input',byId(form_id));
|
||||||
|
for (i in form_nodes) {
|
||||||
|
node = form_nodes[i];
|
||||||
|
if (node.value=="Set" && node.type=="submit") {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _f_custTag = false;
|
||||||
function tagger_filter(id) {
|
function tagger_filter(id) {
|
||||||
|
if (_f_custTag) {
|
||||||
var filter = byId(id);
|
var filter = byId(id);
|
||||||
var e;
|
var e;
|
||||||
|
|
||||||
@ -130,6 +146,7 @@ function tagger_filter(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Quirksmode.org //
|
// Quirksmode.org //
|
||||||
// http://www.quirksmode.org/dom/getElementsByTagNames.html //
|
// http://www.quirksmode.org/dom/getElementsByTagNames.html //
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#tagger_window {
|
#tagger_window {
|
||||||
position:fixed;
|
position:fixed;
|
||||||
|
text-align:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tagger_titlebar {
|
#tagger_titlebar {
|
||||||
@ -15,21 +16,32 @@
|
|||||||
top:-0em;
|
top:-0em;
|
||||||
padding:.25em;
|
padding:.25em;
|
||||||
border:2px solid;
|
border:2px solid;
|
||||||
border-bottom:1px solid;
|
-moz-border-radius:1em;
|
||||||
-moz-border-radius:10px 10px 0px 0px;
|
|
||||||
background-image:none;
|
background-image:none;
|
||||||
background-color:white;
|
background-color:#DDDDDD;
|
||||||
|
margin-bottom:.5em;
|
||||||
cursor:move;
|
cursor:move;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tagger_body {
|
#tagger_body, #tagger_filter {
|
||||||
overflow:scroll;
|
overflow:scroll;
|
||||||
padding:1em;
|
padding:1em;
|
||||||
border:2px solid;
|
border:2px solid;
|
||||||
border-top:none;
|
border-top:none;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
}
|
}
|
||||||
|
#tagger_filter {
|
||||||
|
overflow:hidden;
|
||||||
|
-moz-border-radius:1em 1em 0 0;
|
||||||
|
border:2px solid;
|
||||||
|
border-bottom:none;
|
||||||
|
margin-bottom:-1px;
|
||||||
|
text-align:center;
|
||||||
|
padding-bottom:1px;
|
||||||
|
}
|
||||||
|
#tagger_filter input {
|
||||||
|
width:auto;
|
||||||
|
}
|
||||||
|
|
||||||
#tagger_body a {
|
#tagger_body a {
|
||||||
font-size:1.25em;
|
font-size:1.25em;
|
||||||
|
@ -7,37 +7,51 @@ class taggerTheme extends Themelet {
|
|||||||
public function build ($page, $tags) {
|
public function build ($page, $tags) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$tagme = $config->get_string("ext-tagger_clear-tagme","N") == "Y" ? "true":"false";
|
$tagme = $config->get_string(
|
||||||
|
"ext-tagger_clear-tagme","N") == "Y" ?"true":"false";
|
||||||
$base_href = $config->get_string("base_href");
|
$base_href = $config->get_string("base_href");
|
||||||
|
|
||||||
$tag_html = "";
|
$tag_html = "";
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$tag_name = $tag['tag'];
|
$tag_name = $tag['tag'];
|
||||||
$tag_trunc = $this->trimTag($tag_name,20,"_");
|
$tag_trunc = $this->trimTag($tag_name,20,"_");
|
||||||
$tag_html .= "<div id='tagger_tag_".$tag_name."'>"."
|
$tag_html .= "
|
||||||
<a style='cursor:pointer;' onclick='toggleTag("".$tag_name."",".$tagme.");' ".
|
<div id='tagger_tag_".$tag_name."'>
|
||||||
"title='Add "".$tag_name."" to the tag list'>".$tag_trunc."</a>".
|
<a style='cursor:pointer;'
|
||||||
"</div>";
|
onclick='toggleTag("".$tag_name."",".$tagme.");'
|
||||||
|
title='Add "".$tag_name."" to the tag list'>".$tag_trunc."
|
||||||
|
</a>
|
||||||
|
</div>";
|
||||||
}
|
}
|
||||||
$url_more = make_link("about/tagger");
|
$url_more = make_link("about/tagger");
|
||||||
|
|
||||||
$html = <<<EOD
|
$html = <<<EOD
|
||||||
<img style='display:none;' src='$base_href/ext/tagger/onload.gif' onload='setTagIndicators();'/>
|
<img style='display:none;' src='$base_href/ext/tagger/onload.gif'
|
||||||
|
onload='setTagIndicators();'/>
|
||||||
<span style="font-size:.7em;">Collapse this block to hide Tagger.</span>
|
<span style="font-size:.7em;">Collapse this block to hide Tagger.</span>
|
||||||
<br/>
|
<br/>
|
||||||
<a onclick="taggerResetPos();" style="cursor:pointer;">Default Location</a>
|
<a onclick="taggerResetPos();" style="cursor:pointer;">Default Location</a>
|
||||||
<hr/>
|
<hr/>
|
||||||
<a href='$url_more'>About Tagger</a>
|
<a href='$url_more'>About Tagger</a>
|
||||||
<div id="tagger_window" style="bottom:25px;right:25px;">
|
<div id="tagger_window" style="bottom:25px;right:25px;">
|
||||||
<div id="tagger_titlebar" title="Drag to move" onmousedown="dragStart(event,"tagger_window");">
|
<div id="tagger_titlebar" title="Drag to move"
|
||||||
|
onmousedown="dragStart(event,"tagger_window");">
|
||||||
Tagger
|
Tagger
|
||||||
</div>
|
</div>
|
||||||
<div id="tagger_body" style="height:300px;">
|
<div id="tagger_filter">
|
||||||
<input type="text" id="tagger_custTag" value="" onkeyup="tagger_filter("tagger_custTag")" size='12'></input>
|
|
||||||
<input type="button" value="Add" onclick="addTagById("tagger_custTag")"></input>
|
<input type="text" id="tagger_custTag" value="" onfocus="_f_custTag = true;"
|
||||||
|
onblur="_f_custTag = false;"
|
||||||
|
onkeyup="tagger_filter("tagger_custTag")" size='12'>
|
||||||
|
</input>
|
||||||
|
<input type="button" value="Add"
|
||||||
|
onclick="addTagById("tagger_custTag")">
|
||||||
|
</input> <input type="button" onclick="pushSet("imgdata");"
|
||||||
|
value="Set">
|
||||||
|
</input>
|
||||||
<hr/>
|
<hr/>
|
||||||
$tag_html
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="tagger_body" style="height:200px;">$tag_html</div>
|
||||||
</div>
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
$page->add_block( new Block("Tagger - Advanced Tagging",
|
$page->add_block( new Block("Tagger - Advanced Tagging",
|
||||||
@ -63,21 +77,22 @@ EOD;
|
|||||||
more convienient location.
|
more convienient location.
|
||||||
<li>
|
<li>
|
||||||
Click the links to add the tag to the image's tag list, when done, press
|
Click the links to add the tag to the image's tag list, when done, press
|
||||||
Set (by the actual tag list) to save the tags.
|
the Set button to save the tags.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Tagger gets all the tags in use with 2 or more uses, so the list can get
|
<p>Tagger gets all the tags in use with 2 or more uses, so the list can get
|
||||||
quite large. If you are having trouble finding the tag you are looking for,
|
quite large. If you are having trouble finding the tag you are looking for,
|
||||||
you can enter it into the box at the top and as you type, Tagger will remove
|
you can enter it into the box at the top and as you type, Tagger will remove
|
||||||
tags that do not match to aid your search.</p>
|
tags that do not match to aid your search. Usually, you'll only need one
|
||||||
<p>If the tag is not in the list, finish typing out the tag and click "Add" to
|
or two letters to trim the list down to the tag you are looking for.</p>
|
||||||
add the tag to the image's tag list.</p>
|
<p>If the tag is not in the list, finish typing out the tag and click "Add"
|
||||||
|
to add the tag to the image's tag list.</p>
|
||||||
<p>Tags must have two uses to appear in Tagger's list, so you'll have to
|
<p>Tags must have two uses to appear in Tagger's list, so you'll have to
|
||||||
enter the tag for at least one other image for it to show up.</p>
|
enter the tag for at least one other image for it to show up.</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Tagger requires javascript for its functionality. Sorry, but there's no
|
<p>Tagger requires javascript for its functionality. Sorry, but there's
|
||||||
other way to accomplish the tag list modifications.</p>
|
no other way to accomplish the tag list modifications.</p>
|
||||||
<p>If you have javascript completely disabled, you will not be able to use
|
<p>If you have javascript completely disabled, you will not be able to use
|
||||||
Tagger.</p>
|
Tagger.</p>
|
||||||
<p>Due to the manner in which Tagger is constructed, it will hide along with
|
<p>Due to the manner in which Tagger is constructed, it will hide along with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user