From c98f61496c532646cbb2c64989e20b3362a47f60 Mon Sep 17 00:00:00 2001 From: Artanis Date: Tue, 23 Oct 2007 23:03:41 +0000 Subject: [PATCH] Tagger v2 20071023 1603 - Dragging enabled git-svn-id: file:///home/shish/svn/shimmie2/trunk@563 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/tagger/script.js | 29 +++++++++++++++++++++++++++++ contrib/tagger/style.css | 4 +--- contrib/tagger/theme.php | 6 +++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/contrib/tagger/script.js b/contrib/tagger/script.js index 430875b4..7717d3bf 100644 --- a/contrib/tagger/script.js +++ b/contrib/tagger/script.js @@ -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); diff --git a/contrib/tagger/style.css b/contrib/tagger/style.css index c2c0ecda..c88be8c6 100644 --- a/contrib/tagger/style.css +++ b/contrib/tagger/style.css @@ -10,9 +10,7 @@ #tagger_parent { position:fixed; - top:25px; - right:25px; - max-width:300px; + /*width:250px;*/ } #tagger_parent * { diff --git a/contrib/tagger/theme.php b/contrib/tagger/theme.php index 0b0bbab0..40d5d1ed 100644 --- a/contrib/tagger/theme.php +++ b/contrib/tagger/theme.php @@ -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(""); $page->add_block(new Block(null, "