Tagger v2 20071023 1603 - Dragging enabled

git-svn-id: file:///home/shish/svn/shimmie2/trunk@563 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
Artanis 2007-10-23 23:03:41 +00:00
parent ae947698cd
commit c98f61496c
3 changed files with 35 additions and 4 deletions

View file

@ -22,6 +22,8 @@ function Tagger() {
// methods
this.initialize = initialize;
this.submit = submit;
this.getPosition = function () { return findPos(this.t_parent); };
this.setPosition = setPosition;
this.tagSearch = tagSearch;
this.searchRequest = searchRequest;
this.searchReceive = searchReceive;
@ -33,6 +35,7 @@ function Tagger() {
this.tagsToString = tagsToString;
this.toggleTag = toggleTag;
this.setAlert = setAlert;
// definitions
function initialize () {
@ -49,12 +52,38 @@ function Tagger() {
//this.buildPages();
// initial data
ajaxXML(query+"/"+image_id,tagListReceive);
// reveal
this.t_parent.style.display = "";
// dragging
DragHandler.attach(this.t_title);
// set position
// TODO: Apply cookie-based position saving
var pos = Tagger.getPosition();
setPosition(pos[0],pos[1]);
}
function submit() {
this.t_tags.value = Tagger.tagsToString(Tagger.appliedTags);
}
function setPosition(x,y) {
if(!x || !y) {
with(Tagger.t_parent.style) {
top = "25px";
left = "";
right = "25px";
bottom = "";
}
var pos = Tagger.getPosition();
x = pos[0];
y = pos[1];
}
with(Tagger.t_parent.style) {
top = y+"px";
left = x+"px";
right="";
bottom="";
}
}
function tagSearch(s,ms) {
clearTimeout(tagger_filter_timer);
tagger_filter_timer = setTimeout("Tagger.searchRequest('"+s+"')",ms);

View file

@ -10,9 +10,7 @@
#tagger_parent {
position:fixed;
top:25px;
right:25px;
max-width:300px;
/*width:250px;*/
}
#tagger_parent * {

View file

@ -7,8 +7,11 @@
class taggerTheme extends Themelet {
public function build_tagger ($page, $event) {
global $config;
// Initialization code
$base_href = $config->get_string('base_href');
// TODO: AJAX test and fallback.
$page->add_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null,
"<script type='text/javascript'>
var query = '".make_link("tagger/tags")."';
@ -32,8 +35,9 @@ class taggerTheme extends Themelet {
$url_form = make_link("tag_edit/set");
// TODO: option for initial Tagger window placement.
$html = <<< EOD
<div id="tagger_parent" style="display:none;">
<div id="tagger_parent" style="display:none; top:25px; right:25px;">
<div id="tagger_titlebar">Tagger</div>
<div id="tagger_toolbar">