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:
		
							parent
							
								
									ae947698cd
								
							
						
					
					
						commit
						c98f61496c
					
				| @ -22,6 +22,8 @@ function Tagger() { | |||||||
| // methods
 | // methods
 | ||||||
| 	this.initialize     = initialize; | 	this.initialize     = initialize; | ||||||
| 	this.submit         = submit; | 	this.submit         = submit; | ||||||
|  | 	this.getPosition    = function () { return findPos(this.t_parent); }; | ||||||
|  | 	this.setPosition    = setPosition; | ||||||
| 	this.tagSearch      = tagSearch; | 	this.tagSearch      = tagSearch; | ||||||
| 	this.searchRequest  = searchRequest; | 	this.searchRequest  = searchRequest; | ||||||
| 	this.searchReceive  = searchReceive; | 	this.searchReceive  = searchReceive; | ||||||
| @ -34,6 +36,7 @@ function Tagger() { | |||||||
| 	this.toggleTag      = toggleTag; | 	this.toggleTag      = toggleTag; | ||||||
| 	this.setAlert       = setAlert; | 	this.setAlert       = setAlert; | ||||||
| 
 | 
 | ||||||
|  | 	 | ||||||
| // definitions
 | // definitions
 | ||||||
| 	function initialize () { | 	function initialize () { | ||||||
| 	// components
 | 	// components
 | ||||||
| @ -49,12 +52,38 @@ function Tagger() { | |||||||
| 		//this.buildPages();
 | 		//this.buildPages();
 | ||||||
| 	// initial data
 | 	// initial data
 | ||||||
| 		ajaxXML(query+"/"+image_id,tagListReceive); | 		ajaxXML(query+"/"+image_id,tagListReceive); | ||||||
|  | 
 | ||||||
| 	// reveal
 | 	// reveal
 | ||||||
| 		this.t_parent.style.display = ""; | 		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() { | 	function submit() { | ||||||
| 		this.t_tags.value = Tagger.tagsToString(Tagger.appliedTags); | 		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) { | 	function tagSearch(s,ms) { | ||||||
| 		clearTimeout(tagger_filter_timer); | 		clearTimeout(tagger_filter_timer); | ||||||
| 		tagger_filter_timer = setTimeout("Tagger.searchRequest('"+s+"')",ms); | 		tagger_filter_timer = setTimeout("Tagger.searchRequest('"+s+"')",ms); | ||||||
|  | |||||||
| @ -10,9 +10,7 @@ | |||||||
| 
 | 
 | ||||||
| #tagger_parent { | #tagger_parent { | ||||||
| 	position:fixed; | 	position:fixed; | ||||||
| 	top:25px; | 	/*width:250px;*/ | ||||||
| 	right:25px; |  | ||||||
| 	max-width:300px; |  | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| #tagger_parent * { | #tagger_parent * { | ||||||
|  | |||||||
| @ -7,8 +7,11 @@ | |||||||
| 
 | 
 | ||||||
| class taggerTheme extends Themelet { | class taggerTheme extends Themelet { | ||||||
| 	public function build_tagger ($page, $event) { | 	public function build_tagger ($page, $event) { | ||||||
|  | 		global $config; | ||||||
| 		// Initialization code
 | 		// Initialization code
 | ||||||
|  | 		$base_href = $config->get_string('base_href'); | ||||||
| 		// TODO: AJAX test and fallback.
 | 		// 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, | 		$page->add_block(new Block(null, | ||||||
| 			"<script type='text/javascript'>
 | 			"<script type='text/javascript'>
 | ||||||
| 				var query = '".make_link("tagger/tags")."'; | 				var query = '".make_link("tagger/tags")."'; | ||||||
| @ -32,8 +35,9 @@ class taggerTheme extends Themelet { | |||||||
| 		 | 		 | ||||||
| 		$url_form = make_link("tag_edit/set"); | 		$url_form = make_link("tag_edit/set"); | ||||||
| 		 | 		 | ||||||
|  | 		// TODO: option for initial Tagger window placement.
 | ||||||
| 		$html = <<< EOD | 		$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_titlebar">Tagger</div> | ||||||
| 	 | 	 | ||||||
| 	<div id="tagger_toolbar"> | 	<div id="tagger_toolbar"> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user