Ticket #1176: XinhaDialogOptions.patch
| File XinhaDialogOptions.patch, 3.1 kB (added by guest, 3 months ago) |
|---|
-
XinhaDialog.js
27 27 * @param html string 28 28 * @param localizer string the "context" parameter for Xinha._lc(), typically the name of the plugin 29 29 * @param size object with two possible properties of the size: width & height as int, where height is optional 30 * @param options dictionary with optional boolean attributes 'modal', 'closable', 'resizable', and 'centered', as well as integer attribute 'layer' 30 31 */ 31 32 Xinha.Dialog = function(editor, html, localizer, size, options) 32 33 { … … 38 39 this.size = size; 39 40 this.modal = (options && options.modal === false) ? false : true; 40 41 this.closable = (options && options.closable === false) ? false : true; 42 this.resizable = (options && options.resizable === false) ? false : true; 41 43 this.layer = (options && options.layer) ? options.layer : 0; 44 this.centered = (options && options.centered === true) ? true : false; 42 45 43 46 /* Check global config to see if we should override any of the above options 47 If a global option is set, it will apply to all dialogs, regardless of their 48 individual settings (i.e., it will override them). If the global option is 49 undefined, the options passed in above will be used. 50 */ 51 globalOptions = editor.config.dialogOptions 52 if (globalOptions) { 53 if (typeof(globalOptions.centered) != 'undefined') { 54 this.centered = globalOptions.centered; 55 } 56 if (typeof(globalOptions.resizable) != 'undefined') { 57 this.resizable = globalOptions.resizable; 58 } 59 if (typeof(globalOptions.closable) != 'undefined') { 60 this.closable = globalOptions.closable; 61 } 62 if (typeof(globalOptions.modal) != 'undefined') { 63 this.modal = globalOptions.modal; 64 } 65 } 66 44 67 if (Xinha.is_ie) 45 68 { // IE6 needs the iframe to hide select boxes 46 69 var backG = document.createElement("iframe"); … … 204 227 } 205 228 } 206 229 207 this.resizer = document.createElement('div'); 208 this.resizer.className = "resizeHandle"; 209 with (this.resizer.style) 230 this.resizer = null; 231 if (this.resizable) 210 232 { 211 position = "absolute"; 212 bottom = "0px"; 213 right= "0px"; 233 this.resizer = document.createElement('div'); 234 this.resizer.className = "resizeHandle"; 235 with (this.resizer.style) 236 { 237 position = "absolute"; 238 bottom = "0px"; 239 right= "0px"; 240 } 241 Xinha._addEvent(this.resizer, 'mousedown', function(ev) { dialog.resizeStart(ev); }); 242 rootElem.appendChild(this.resizer); 214 243 } 215 Xinha._addEvent(this.resizer, 'mousedown', function(ev) { dialog.resizeStart(ev); }); 216 rootElem.appendChild(this.resizer); 217 244 218 245 this.rootElem = rootElem; 219 246 this.captionBar = captionBar; 220 247 this.main = main; … … 314 341 rootElemStyle.top = parseInt(this.size.top,10) + 'px'; 315 342 rootElemStyle.left = parseInt(this.size.left,10) + 'px'; 316 343 } 317 else if (this.editor.btnClickEvent )344 else if (this.editor.btnClickEvent && !this.centered) 318 345 { 319 346 var btnClickEvent = this.editor.btnClickEvent; 320 347 if (rootElemStyle.position == 'absolute')
