Changeset 1017


Ignore:
Timestamp:
08/14/08 17:45:05 (11 years ago)
Author:
nicholasbs
Message:

Code from dialog configuration patches in ticket #1176

  • New dialog options 'centered' and 'resizable'
  • Added support for global options that override individual dialog settings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs/modules/Dialogs/XinhaDialog.js

    r1010 r1017  
    2828 * @param localizer string the "context" parameter for Xinha._lc(), typically the name of the plugin 
    2929 * @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' 
    3031 */ 
    3132Xinha.Dialog = function(editor, html, localizer, size, options) 
     
    3940  this.modal = (options && options.modal === false) ? false : true; 
    4041  this.closable = (options && options.closable === false) ? false : true; 
     42  this.resizable = (options && options.resizable === false) ? false : true; 
    4143  this.layer = (options && options.layer) ? options.layer : 0; 
    42    
    43    
     44  this.centered = (options && options.centered === true) ? true : false; 
     45   
     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 
    4467  if (Xinha.is_ie) 
    4568  { // IE6 needs the iframe to hide select boxes 
     
    205228  } 
    206229 
    207   this.resizer = document.createElement('div'); 
    208   this.resizer.className = "resizeHandle"; 
    209   with (this.resizer.style) 
    210   { 
    211     position = "absolute"; 
    212     bottom = "0px"; 
    213     right= "0px"; 
    214   } 
    215   Xinha._addEvent(this.resizer, 'mousedown', function(ev) { dialog.resizeStart(ev); }); 
    216   rootElem.appendChild(this.resizer); 
    217    
     230  this.resizer = null; 
     231  if (this.resizable) 
     232  { 
     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); 
     243  } 
     244 
    218245  this.rootElem = rootElem; 
    219246  this.captionBar = captionBar; 
     
    315342      rootElemStyle.left = parseInt(this.size.left,10) + 'px'; 
    316343    } 
    317     else if (this.editor.btnClickEvent) 
     344    else if (this.editor.btnClickEvent && !this.centered) 
    318345    { 
    319346      var btnClickEvent = this.editor.btnClickEvent; 
Note: See TracChangeset for help on using the changeset viewer.