a:19:{s:9:"#provides";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:9:"#resource";s:36:"_editor/plugins/AlwaysShowToolbar.js";s:39:"dijit._editor.plugins.AlwaysShowToolbar";a:7:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:21:"dijit._editor._Plugin";}s:4:"call";a:1:{i:0;s:21:"dijit._editor._Plugin";}}s:7:"summary";s:191:"For auto-expanding editors, this plugin will keep the
editor's toolbar visible even when the top of the editor
has scrolled off the top of the viewport (usually when editing a long
document).";s:11:"description";s:78:"Specify this in extraPlugins (or plugins) parameter and also set
height to "".";s:8:"examples";a:1:{i:0;s:102:"

	<div dojoType="dijit.Editor" height=""
	extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']">";}s:14:"private_parent";b:1;s:9:"classlike";b:1;}s:53:"dijit._editor.plugins.AlwaysShowToolbar._handleScroll";a:6:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:7:"Boolean";s:7:"summary";s:46:"Enables/disables the handler for scroll events";s:7:"private";b:1;s:14:"private_parent";b:1;}s:49:"dijit._editor.plugins.AlwaysShowToolbar.setEditor";a:6:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:963:"dojo.provide("dijit._editor.plugins.AlwaysShowToolbar");


dojo.declare("dijit._editor.plugins.AlwaysShowToolbar", dijit._editor._Plugin,
	{
	// summary:
	//		For auto-expanding editors, this plugin will keep the
	//		editor's toolbar visible even when the top of the editor
	//		has scrolled off the top of the viewport (usually when editing a long
	//		document).
	// description:
	//		Specify this in extraPlugins (or plugins) parameter and also set
	//		height to "".
	// example:
	//	|	<div dojoType="dijit.Editor" height=""
	//	|	extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']">


	// _handleScroll: Boolean
	//		Enables/disables the handler for scroll events
	_handleScroll: true,


	setEditor: function(e){
		// Overrides _Plugin.setEditor().
		if(!e.iframe){
			console.log('Port AlwaysShowToolbar plugin to work with Editor without iframe');
			return;
		}


		this.editor = e;


		e.onLoadDeferred.addCallback(dojo.hitch(this, this.enable));";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:46:"dijit._editor.plugins.AlwaysShowToolbar.enable";a:7:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"d";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:172:"		this._updateHeight();
		this.connect(window, 'onscroll', "globalOnScrollHandler");
		this.connect(this.editor, 'onNormalizedDisplayChanged', "_updateHeight");
		return d;";s:7:"summary";s:61:"Enable plugin.  Called when Editor has finished initializing.";s:4:"tags";s:7:"private";s:14:"private_parent";b:1;}s:53:"dijit._editor.plugins.AlwaysShowToolbar._updateHeight";a:7:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:8:"Function";s:6:"source";s:887:"		var e = this.editor;
		if(!e.isLoaded){ return; }
		if(e.height){ return; }


		var height = dojo.marginBox(e.editNode).h;
		if(dojo.isOpera){
			height = e.editNode.scrollHeight;
		}
		// console.debug('height',height);
		// alert(this.editNode);


		//height maybe zero in some cases even though the content is not empty,
		//we try the height of body instead
		if(!height){
			height = dojo.marginBox(e.document.body).h;
		}


		if(height == 0){
			console.debug("Can not figure out the height of the editing area!");
			return; //prevent setting height to 0
		}
		if(dojo.isIE <= 7 && this.editor.minHeight){
			var min = parseInt(this.editor.minHeight);
			if(height < min){ height = min; }
		}
		if(height != this._lastHeight){
			this._lastHeight = height;
			// this.editorObject.style.height = this._lastHeight + "px";
			dojo.marginBox(e.iframe, { h: this._lastHeight });
		}";s:7:"summary";s:58:"Updates the height of the editor area to fit the contents.";s:7:"returns";s:27:"prevent setting height to 0";s:7:"private";b:1;s:14:"private_parent";b:1;}s:51:"dijit._editor.plugins.AlwaysShowToolbar._lastHeight";a:6:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:7:"Integer";s:7:"summary";s:57:"Height in px of the editor at the last time we did sizing";s:7:"private";b:1;s:14:"private_parent";b:1;}s:61:"dijit._editor.plugins.AlwaysShowToolbar.globalOnScrollHandler";a:6:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:8:"Function";s:6:"source";s:2415:"		var isIE6 = dojo.isIE < 7;
		if(!this._handleScroll){ return; }
		var tdn = this.editor.toolbar.domNode;
		var db = dojo.body;


		if(!this._scrollSetUp){
			this._scrollSetUp = true;
			this._scrollThreshold = dojo._abs(tdn, true).y;
//			console.log("threshold:", this._scrollThreshold);
			//what's this for?? comment out for now
//			if((isIE6)&&(db)&&(dojo.style(db, "backgroundIimage")=="none")){
//				db.style.backgroundImage = "url(" + dojo.uri.moduleUri("dijit", "templates/blank.gif") + ")";
//				db.style.backgroundAttachment = "fixed";
//			}
		}


		var scrollPos = dojo._docScroll().y;
		var s = tdn.style;


		if(scrollPos > this._scrollThreshold && scrollPos < this._scrollThreshold+this._lastHeight){
			// dojo.debug(scrollPos);
			if(!this._fixEnabled){
				var tdnbox = dojo.marginBox(tdn);
				this.editor.iframe.style.marginTop = tdnbox.h+"px";


				if(isIE6){
					s.left = dojo._abs(tdn).x;
					if(tdn.previousSibling){
						this._IEOriginalPos = ['after',tdn.previousSibling];
					}else if(tdn.nextSibling){
						this._IEOriginalPos = ['before',tdn.nextSibling];
					}else{
						this._IEOriginalPos = ['last',tdn.parentNode];
					}
					dojo.body().appendChild(tdn);
					dojo.addClass(tdn,'dijitIEFixedToolbar');
				}else{
					s.position = "fixed";
					s.top = "0px";
				}


				dojo.marginBox(tdn, { w: tdnbox.w });
				s.zIndex = 2000;
				this._fixEnabled = true;
			}
			// if we're showing the floating toolbar, make sure that if
			// we've scrolled past the bottom of the editor that we hide
			// the toolbar for this instance of the editor.


			// TODO: when we get multiple editor toolbar support working
			// correctly, ensure that we check this against the scroll
			// position of the bottom-most editor instance.
			var eHeight = (this.height) ? parseInt(this.editor.height) : this.editor._lastHeight;
			s.display = (scrollPos > this._scrollThreshold+eHeight) ? "none" : "";
		}else if(this._fixEnabled){
			this.editor.iframe.style.marginTop = '';
			s.position = "";
			s.top = "";
			s.zIndex = "";
			s.display = "";
			if(isIE6){
				s.left = "";
				dojo.removeClass(tdn,'dijitIEFixedToolbar');
				if(this._IEOriginalPos){
					dojo.place(tdn, this._IEOriginalPos[1], this._IEOriginalPos[0]);
					this._IEOriginalPos = null;
				}else{
					dojo.place(tdn, this.editor.iframe, 'before');
				}
			}
			s.width = "";
			this._fixEnabled = false;
		}";s:7:"summary";s:57:"Handler for scroll events that bubbled up to &lt;html&gt;";s:4:"tags";s:7:"private";s:14:"private_parent";b:1;}s:47:"dijit._editor.plugins.AlwaysShowToolbar.destroy";a:6:{s:9:"prototype";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:4:"type";s:8:"Function";s:6:"source";s:5310:"dojo.provide("dijit._editor.plugins.AlwaysShowToolbar");


dojo.declare("dijit._editor.plugins.AlwaysShowToolbar", dijit._editor._Plugin,
	{
	// summary:
	//		For auto-expanding editors, this plugin will keep the
	//		editor's toolbar visible even when the top of the editor
	//		has scrolled off the top of the viewport (usually when editing a long
	//		document).
	// description:
	//		Specify this in extraPlugins (or plugins) parameter and also set
	//		height to "".
	// example:
	//	|	<div dojoType="dijit.Editor" height=""
	//	|	extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']">


	// _handleScroll: Boolean
	//		Enables/disables the handler for scroll events
	_handleScroll: true,


	setEditor: function(e){
		// Overrides _Plugin.setEditor().
		if(!e.iframe){
			console.log('Port AlwaysShowToolbar plugin to work with Editor without iframe');
			return;
		}


		this.editor = e;


		e.onLoadDeferred.addCallback(dojo.hitch(this, this.enable));
	},


	enable: function(d){
		// summary:
		//		Enable plugin.  Called when Editor has finished initializing.
		// tags:
		//		private


		this._updateHeight();
		this.connect(window, 'onscroll', "globalOnScrollHandler");
		this.connect(this.editor, 'onNormalizedDisplayChanged', "_updateHeight");
		return d;
	},


	_updateHeight: function(){
		// summary:
		//		Updates the height of the editor area to fit the contents.
		var e = this.editor;
		if(!e.isLoaded){ return; }
		if(e.height){ return; }


		var height = dojo.marginBox(e.editNode).h;
		if(dojo.isOpera){
			height = e.editNode.scrollHeight;
		}
		// console.debug('height',height);
		// alert(this.editNode);


		//height maybe zero in some cases even though the content is not empty,
		//we try the height of body instead
		if(!height){
			height = dojo.marginBox(e.document.body).h;
		}


		if(height == 0){
			console.debug("Can not figure out the height of the editing area!");
			return; //prevent setting height to 0
		}
		if(dojo.isIE <= 7 && this.editor.minHeight){
			var min = parseInt(this.editor.minHeight);
			if(height < min){ height = min; }
		}
		if(height != this._lastHeight){
			this._lastHeight = height;
			// this.editorObject.style.height = this._lastHeight + "px";
			dojo.marginBox(e.iframe, { h: this._lastHeight });
		}
	},


	// _lastHeight: Integer
	//		Height in px of the editor at the last time we did sizing
	_lastHeight: 0,


	globalOnScrollHandler: function(){
		// summary:
		//		Handler for scroll events that bubbled up to <html>
		// tags:
		//		private


		var isIE6 = dojo.isIE < 7;
		if(!this._handleScroll){ return; }
		var tdn = this.editor.toolbar.domNode;
		var db = dojo.body;


		if(!this._scrollSetUp){
			this._scrollSetUp = true;
			this._scrollThreshold = dojo._abs(tdn, true).y;
//			console.log("threshold:", this._scrollThreshold);
			//what's this for?? comment out for now
//			if((isIE6)&&(db)&&(dojo.style(db, "backgroundIimage")=="none")){
//				db.style.backgroundImage = "url(" + dojo.uri.moduleUri("dijit", "templates/blank.gif") + ")";
//				db.style.backgroundAttachment = "fixed";
//			}
		}


		var scrollPos = dojo._docScroll().y;
		var s = tdn.style;


		if(scrollPos > this._scrollThreshold && scrollPos < this._scrollThreshold+this._lastHeight){
			// dojo.debug(scrollPos);
			if(!this._fixEnabled){
				var tdnbox = dojo.marginBox(tdn);
				this.editor.iframe.style.marginTop = tdnbox.h+"px";


				if(isIE6){
					s.left = dojo._abs(tdn).x;
					if(tdn.previousSibling){
						this._IEOriginalPos = ['after',tdn.previousSibling];
					}else if(tdn.nextSibling){
						this._IEOriginalPos = ['before',tdn.nextSibling];
					}else{
						this._IEOriginalPos = ['last',tdn.parentNode];
					}
					dojo.body().appendChild(tdn);
					dojo.addClass(tdn,'dijitIEFixedToolbar');
				}else{
					s.position = "fixed";
					s.top = "0px";
				}


				dojo.marginBox(tdn, { w: tdnbox.w });
				s.zIndex = 2000;
				this._fixEnabled = true;
			}
			// if we're showing the floating toolbar, make sure that if
			// we've scrolled past the bottom of the editor that we hide
			// the toolbar for this instance of the editor.


			// TODO: when we get multiple editor toolbar support working
			// correctly, ensure that we check this against the scroll
			// position of the bottom-most editor instance.
			var eHeight = (this.height) ? parseInt(this.editor.height) : this.editor._lastHeight;
			s.display = (scrollPos > this._scrollThreshold+eHeight) ? "none" : "";
		}else if(this._fixEnabled){
			this.editor.iframe.style.marginTop = '';
			s.position = "";
			s.top = "";
			s.zIndex = "";
			s.display = "";
			if(isIE6){
				s.left = "";
				dojo.removeClass(tdn,'dijitIEFixedToolbar');
				if(this._IEOriginalPos){
					dojo.place(tdn, this._IEOriginalPos[1], this._IEOriginalPos[0]);
					this._IEOriginalPos = null;
				}else{
					dojo.place(tdn, this.editor.iframe, 'before');
				}
			}
			s.width = "";
			this._fixEnabled = false;
		}
	},


	destroy: function(){
	    // Overrides _Plugin.destroy().   TODO: call this.inherited() rather than repeating code.
		this._IEOriginalPos = null;
		this._handleScroll = false;
		dojo.forEach(this._connects, dojo.disconnect);
//		clearInterval(this.scrollInterval);


		if(dojo.isIE < 7){
			dojo.removeClass(this.editor.toolbar.domNode, 'dijitIEFixedToolbar');
		}";s:7:"returns";s:27:"prevent setting height to 0";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:46:"dijit._editor.plugins.AlwaysShowToolbar.editor";a:3:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:52:"dijit._editor.plugins.AlwaysShowToolbar._scrollSetUp";a:4:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:7:"private";b:1;s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:56:"dijit._editor.plugins.AlwaysShowToolbar._scrollThreshold";a:4:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:7:"private";b:1;s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:69:"dijit._editor.plugins.AlwaysShowToolbar.editor.iframe.style.marginTop";a:3:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:54:"dijit._editor.plugins.AlwaysShowToolbar._IEOriginalPos";a:4:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:7:"private";b:1;s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:51:"dijit._editor.plugins.AlwaysShowToolbar._fixEnabled";a:4:{s:8:"instance";s:39:"dijit._editor.plugins.AlwaysShowToolbar";s:7:"private";b:1;s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:21:"dijit._editor.plugins";a:3:{s:4:"type";s:6:"Object";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:13:"dijit._editor";a:3:{s:4:"type";s:6:"Object";s:7:"private";b:1;s:7:"summary";s:0:"";}s:5:"dijit";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}