includes/clientside/tinymce/plugins/inlinepopups/editor_plugin_src.js
changeset 778 57ce13805b6f
parent 543 dffcbfbc4e59
child 1193 e3b94bd055dc
equal deleted inserted replaced
777:488665d49417 778:57ce13805b6f
     1 /**
     1 /**
     2  * $Id: editor_plugin_src.js 809 2008-04-17 14:41:31Z spocke $
     2  * $Id: editor_plugin_src.js 961 2008-11-14 10:31:07Z spocke $
     3  *
     3  *
     4  * @author Moxiecode
     4  * @author Moxiecode
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     6  */
     6  */
     7 
     7 
    33 			var t = this;
    33 			var t = this;
    34 
    34 
    35 			t.parent(ed);
    35 			t.parent(ed);
    36 			t.zIndex = 300000;
    36 			t.zIndex = 300000;
    37 			t.count = 0;
    37 			t.count = 0;
       
    38 			t.windows = {};
    38 		},
    39 		},
    39 
    40 
    40 		open : function(f, p) {
    41 		open : function(f, p) {
    41 			var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;
    42 			var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;
    42 
    43 
   235 					}
   236 					}
   236 				}
   237 				}
   237 			});
   238 			});
   238 
   239 
   239 			// Add window
   240 			// Add window
   240 			t.windows = t.windows || {};
       
   241 			w = t.windows[id] = {
   241 			w = t.windows[id] = {
   242 				id : id,
   242 				id : id,
   243 				mousedown_func : mdf,
   243 				mousedown_func : mdf,
   244 				click_func : clf,
   244 				click_func : clf,
   245 				element : new Element(id, {blocker : 1, container : ed.getContainer()}),
   245 				element : new Element(id, {blocker : 1, container : ed.getContainer()}),
   252 			w.iframeElement.on('focus', function() {
   252 			w.iframeElement.on('focus', function() {
   253 				t.focus(id);
   253 				t.focus(id);
   254 			});
   254 			});
   255 
   255 
   256 			// Setup blocker
   256 			// Setup blocker
   257 			if (t.count == 0 && t.editor.getParam('dialog_type') == 'modal') {
   257 			if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
   258 				DOM.add(DOM.doc.body, 'div', {
   258 				DOM.add(DOM.doc.body, 'div', {
   259 					id : 'mceModalBlocker',
   259 					id : 'mceModalBlocker',
   260 					'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
   260 					'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
   261 					style : {left : vp.x, top : vp.y, zIndex : t.zIndex - 1}
   261 					style : {zIndex : t.zIndex - 1}
   262 				});
   262 				});
   263 
   263 
   264 				DOM.show('mceModalBlocker'); // Reduces flicker in IE
   264 				DOM.show('mceModalBlocker'); // Reduces flicker in IE
   265 			} else
   265 			} else
   266 				DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
   266 				DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
   267 
   267 
       
   268 			if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
       
   269 				DOM.setStyles('mceModalBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2});
       
   270 
   268 			t.focus(id);
   271 			t.focus(id);
   269 			t._fixIELayout(id, 1);
   272 			t._fixIELayout(id, 1);
   270 
   273 
   271 			// Focus ok button
   274 			// Focus ok button
   272 			if (DOM.get(id + '_ok'))
   275 			if (DOM.get(id + '_ok'))
   276 
   279 
   277 			return w;
   280 			return w;
   278 		},
   281 		},
   279 
   282 
   280 		focus : function(id) {
   283 		focus : function(id) {
   281 			var t = this, w = t.windows[id];
   284 			var t = this, w;
   282 
   285 
   283 			w.zIndex = this.zIndex++;
   286 			if (w = t.windows[id]) {
   284 			w.element.setStyle('zIndex', w.zIndex);
   287 				w.zIndex = this.zIndex++;
   285 			w.element.update();
   288 				w.element.setStyle('zIndex', w.zIndex);
   286 
   289 				w.element.update();
   287 			id = id + '_wrapper';
   290 
   288 			DOM.removeClass(t.lastId, 'mceFocus');
   291 				id = id + '_wrapper';
   289 			DOM.addClass(id, 'mceFocus');
   292 				DOM.removeClass(t.lastId, 'mceFocus');
   290 			t.lastId = id;
   293 				DOM.addClass(id, 'mceFocus');
       
   294 				t.lastId = id;
       
   295 			}
   291 		},
   296 		},
   292 
   297 
   293 		_addAll : function(te, ne) {
   298 		_addAll : function(te, ne) {
   294 			var i, n, t = this, dom = tinymce.DOM;
   299 			var i, n, t = this, dom = tinymce.DOM;
   295 
   300 
   347 
   352 
   348 				// Setup event blocker
   353 				// Setup event blocker
   349 				DOM.add(d.body, 'div', {
   354 				DOM.add(d.body, 'div', {
   350 					id : 'mceEventBlocker',
   355 					id : 'mceEventBlocker',
   351 					'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
   356 					'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
   352 					style : {left : vp.x, top : vp.y, zIndex : t.zIndex + 1}
   357 					style : {zIndex : t.zIndex + 1}
   353 				});
   358 				});
       
   359 
       
   360 				if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
       
   361 					DOM.setStyles('mceEventBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2});
       
   362 
   354 				eb = new Element('mceEventBlocker');
   363 				eb = new Element('mceEventBlocker');
   355 				eb.update();
   364 				eb.update();
   356 
   365 
   357 				// Setup placeholder
   366 				// Setup placeholder
   358 				p = we.getXY();
   367 				p = we.getXY();
   468 		close : function(win, id) {
   477 		close : function(win, id) {
   469 			var t = this, w, d = DOM.doc, ix = 0, fw, id;
   478 			var t = this, w, d = DOM.doc, ix = 0, fw, id;
   470 
   479 
   471 			id = t._findId(id || win);
   480 			id = t._findId(id || win);
   472 
   481 
       
   482 			// Probably not inline
       
   483 			if (!t.windows[id]) {
       
   484 				t.parent(win);
       
   485 				return;
       
   486 			}
       
   487 
   473 			t.count--;
   488 			t.count--;
   474 
   489 
   475 			if (t.count == 0)
   490 			if (t.count == 0)
   476 				DOM.remove('mceModalBlocker');
   491 				DOM.remove('mceModalBlocker');
   477 
       
   478 			// Probably not inline
       
   479 			if (!id && win) {
       
   480 				t.parent(win);
       
   481 				return;
       
   482 			}
       
   483 
   492 
   484 			if (w = t.windows[id]) {
   493 			if (w = t.windows[id]) {
   485 				t.onClose.dispatch(t);
   494 				t.onClose.dispatch(t);
   486 				Event.remove(d, 'mousedown', w.mousedownFunc);
   495 				Event.remove(d, 'mousedown', w.mousedownFunc);
   487 				Event.remove(d, 'click', w.clickFunc);
   496 				Event.remove(d, 'click', w.clickFunc);