Changeset 1010


Ignore:
Timestamp:
05/24/08 16:45:43 (6 years ago)
Author:
ray
Message:

further updates to new dialogs

Location:
branches/new-dialogs-merge
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs-merge/Xinha.css

    r1007 r1010  
    122122} 
    123123.xinha_dialog_background { 
     124  filter: alpha(opacity = 0); 
     125  -moz-opacity: 0; 
     126  opacity: 0; 
     127  border:none; 
     128} 
     129.xinha_dialog_background.modal { 
    124130  background-color:#666; 
    125131  filter: alpha(opacity = 70); 
     
    127133  opacity: 0.7; 
    128134  border:none; 
     135} 
     136body.xinha_dialog_background.modal { 
     137  filter: alpha(opacity = 100); 
    129138} 
    130139.dialog .content { padding: 2px; } 
  • branches/new-dialogs-merge/XinhaCore.js

    r1009 r1010  
    22052205    'lp_cell': this._panels.left.container,  // left panel 
    22062206    'ed_cell': document.createElement('td'), // editor 
    2207     'iframe_cover' : document.createElement('div'), //the editor iframe has to be covered when draging a dialog over it 
    22082207    'rp_cell': this._panels.right.container, // right panel 
    22092208 
     
    22762275  this._iframe.className = 'xinha_iframe'; 
    22772276  Xinha.freeLater(this, '_iframe'); 
    2278    
    2279   fw.iframe_cover.style.display = 'none'; 
    2280   fw.iframe_cover.style.position = 'absolute'; 
    2281    
    2282   fw.ed_cell.appendChild(fw.iframe_cover); 
    22832277   
    22842278    // creates & appends the status bar 
     
    26652659  this._textArea.style.height = this._iframe.style.height; 
    26662660  this._textArea.style.width  = this._iframe.style.width; 
    2667    
    2668   var iframePos = Xinha.getElementTopLeft(this._iframe); 
    2669   framework.iframe_cover.style.top = iframePos.top; 
    2670   framework.iframe_cover.style.left = iframePos.left; 
    2671   framework.iframe_cover.style.height = this._iframe.style.height; 
    2672   framework.iframe_cover.style.width = this._iframe.style.width; 
    2673    
     2661 
    26742662  this.notifyOf('resize', {width:this._htmlArea.offsetWidth, height:this._htmlArea.offsetHeight}); 
    26752663  this.firePluginEvent('onResize',this._htmlArea.offsetWidth, this._htmlArea.offsetWidth); 
     
    55045492}; 
    55055493 
     5494Xinha.getEvent = function(ev) 
     5495{ 
     5496  return ev || window.event; 
     5497} 
    55065498/** 
    55075499 * Prepares an element to receive more than one DOM-0 event handler 
  • branches/new-dialogs-merge/modules/Dialogs/XinhaDialog.js

    r1009 r1010  
    1414    --  This is the new all-in-one implementation of dialogs for Xinha 
    1515    -- 
    16  
    1716    -- 
    1817    --  $HeadURL:http://svn.xinha.webfactional.com/trunk/modules/Dialogs/inline-dialog.js $ 
     
    4342   
    4443   
    45   if (Xinha.is_ie && Xinha.ie_version < 7) 
     44  if (Xinha.is_ie) 
    4645  { // IE6 needs the iframe to hide select boxes 
    4746    var backG = document.createElement("iframe"); 
     
    5049    { 
    5150      var doc = window.event.srcElement.contentWindow.document; 
    52       if (doc && doc.body) 
    53       { 
    54         doc.body.style.backgroundColor = "#666666"; 
     51      if (this.readyState == 'complete' && doc && doc.body) 
     52      { 
     53        var div = doc.createElement('div'); 
     54        //insert styles to make background color skinable 
     55        var styles, stylesheets = document.styleSheets; 
     56        for (var i=0;i<stylesheets.length;i++) 
     57        { 
     58          if (stylesheets[i].id.indexOf('Xinha') != -1 && stylesheets[i].cssText)  
     59            styles += stylesheets[i].cssText; 
     60        } 
     61        div.innerHTML = '<br><style type="text/css">\ņ'+styles+'\n</style>'; // strange way, but didn't work otherwise 
     62        doc.getElementsByTagName('body')[0].appendChild(div); 
     63        doc.body.className = 'xinha_dialog_background'; 
     64        if (dialog.modal) doc.body.className += ' modal'; 
    5565      } 
    5666    } 
     
    6272  } 
    6373  backG.className = "xinha_dialog_background"; 
     74  if (this.modal) backG.className += ' modal'; 
    6475  with (backG.style) 
    6576  { 
     
    125136   
    126137  captionBar.style.MozUserSelect = "none"; 
    127    
     138  captionBar.style.WebkitUserSelect = "none"; //seems to have no effect 
     139  captionBar.unselectable = "on"; 
     140  captionBar.onselectstart = function() {return false;}; 
     141 
    128142  this.buttons = document.createElement('div'); 
    129143  with (this.buttons.style) 
     
    141155    this.closer.className= 'closeButton';  
    142156       
    143     this.closer.onmousedown = function(ev) { this.className = "closeButton buttonClick"; Xinha._stopEvent((ev) ? ev : window.event); return false;}; 
    144     this.closer.onmouseout = function(ev) { this.className = "closeButton"; Xinha._stopEvent((ev) ? ev : window.event); return false;}; 
     157    this.closer.onmousedown = function(ev) { this.className = "closeButton buttonClick"; Xinha._stopEvent(Xinha.getEvent(ev)); return false;}; 
     158    this.closer.onmouseout = function(ev) { this.className = "closeButton"; Xinha._stopEvent(Xinha.getEvent(ev)); return false;}; 
    145159    this.closer.onmouseup = function() { this.className = "closeButton"; dialog.hide(); return false;}; 
    146160   
     
    153167   
    154168    butX.appendChild(document.createTextNode('\u00D7')); // cross 
     169    //below different symbols for future use 
    155170    //butX.appendChild(document.createTextNode('\u25AC')); //bar 
    156171    //butX.appendChild(document.createTextNode('\u25BA')); //triangle right 
     
    242257  } 
    243258     
    244   if ( modal ) 
    245   { 
    246     this.posBackground({top:0, left:0});  
    247   } 
    248   
    249259  // We need to preserve the selection 
    250260  // if this is called before some editor has been activated, it activates the editor 
    251261  if (Xinha._someEditorHasBeenActivated) 
    252262  { 
    253      this._lastRange = this.editor.saveSelection(); 
     263    this._lastRange = this.editor.saveSelection(); 
    254264      
    255265    if (Xinha.is_ie && !modal) 
     
    272282  if ( !this.attached ) 
    273283  { 
    274     this.showBackground(); 
    275     var viewport = Xinha.viewportSize(); 
    276284    if ( modal ) 
    277285    { 
    278       var pageSize = Xinha.pageSize(); 
    279       this.resizeBackground({width:pageSize.x + "px",height:pageSize.y + "px"}); 
    280     } 
    281     var viewportHeight = viewport.y; 
    282     var viewportWidth = viewport.x; 
     286      this.showBackground() 
     287      this.posBackground({top:0, left:0});  
     288      this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 
     289    } 
     290    else this.background.style.display = ''; 
     291 
    283292    //this.onResizeWin = function () {dialog.sizeBackground()}; 
    284293    //Xinha._addEvent(window, 'resize', this.onResizeWin ); 
     
    288297    var dialogHeight = rootElem.offsetHeight; 
    289298    var dialogWidth = rootElem.offsetWidth; 
    290  
     299    var viewport = Xinha.viewportSize(); 
     300    var viewportHeight = viewport.y; 
     301    var viewportWidth = viewport.x; 
     302     
    291303    if (dialogHeight >  viewportHeight) 
    292304    { 
     
    449461  if (!this.modal) 
    450462  { 
    451     Xinha.Dialog.coverIframes(); 
    452   } 
    453   ev = ev || window.event; 
     463    this.posBackground({top:0, left:0});  
     464    this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 
     465  } 
     466  ev = Xinha.getEvent(ev); 
    454467   
    455468  this.editor.suspendUpdateToolbar = true; 
     
    467480  dialog.mouseMove = function(ev) { dialog.dragIt(ev); }; 
    468481  Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 
    469  
     482  if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mousemove", dialog.mouseMove ); 
     483   
    470484  dialog.mouseUp = function (ev) { dialog.dragEnd(ev); }; 
    471485  Xinha._addEvent(document,"mouseup",  dialog.mouseUp); 
    472  
     486  if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mouseup",  dialog.mouseUp); 
    473487}; 
    474488 
     
    498512   
    499513  dialog.posDialog(newPos); 
    500    
    501   if (!dialog.modal) 
    502   { 
    503     dialog.posBackground(newPos); 
    504   } 
    505514}; 
    506515 
     
    509518  var dialog = this; 
    510519  this.editor.suspendUpdateToolbar = false; 
    511    
    512   if (!this.modal) 
    513   { 
    514     Xinha.Dialog.unCoverIframes(); 
    515   } 
    516    
     520 
    517521  if (!dialog.dragging)  
    518522  { 
     
    522526 
    523527  Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 
    524   Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 
    525   Xinha._removeEvent(document, "mouseup",  dialog.mouseUp); 
    526  
     528  if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mousemove", dialog.mouseMove ); 
     529  Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 
     530  if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup",  dialog.mouseUp); 
     531 
     532  var rootElemStyle = dialog.rootElem.style; 
     533   
    527534  dialog.size.top  = dialog.rootElem.style.top; 
    528535  dialog.size.left = dialog.rootElem.style.left; 
    529 }; 
    530  
     536   
     537  if (!this.modal) 
     538  { 
     539    this.sizeBgToDialog(); 
     540  } 
     541 
     542}; 
    531543 
    532544Xinha.Dialog.prototype.resizeStart = function (ev) { 
     
    540552  if (!this.modal) 
    541553  { 
    542     Xinha.Dialog.coverIframes(); 
     554    this.posBackground({top:0, left:0});  
     555    this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 
    543556  } 
    544557  dialog.scrollPos = dialog.editor.scrollPos(); 
     
    552565  dialog.mouseMove = function(ev) { dialog.resizeIt(ev); }; 
    553566  Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 
     567  if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mousemove", dialog.mouseMove ); 
    554568  dialog.mouseUp = function (ev) { dialog.resizeEnd(ev); }; 
    555569  Xinha._addEvent(document,"mouseup",  dialog.mouseUp);  
     570  if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mouseup", dialog.mouseUp ); 
    556571}; 
    557572 
     
    584599  dialog.sizeDialog(newSize); 
    585600   
    586   if (!this.modal) 
    587   { 
    588     dialog.resizeBackground(newSize); 
    589   } 
    590601   
    591602  dialog.width = dialog.rootElem.offsetWidth; 
     
    600611  dialog.resizing = false; 
    601612  this.editor.suspendUpdateToolbar = false; 
    602   if (!this.modal) 
    603   { 
    604     Xinha.Dialog.unCoverIframes(); 
    605   } 
     613 
    606614  Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 
     615  if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup",  dialog.mouseUp); 
    607616  Xinha._removeEvent(document, "mouseup",  dialog.mouseUp); 
     617  if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup",  dialog.mouseUp); 
    608618   
    609619  dialog.size.width  = dialog.rootElem.offsetWidth; 
    610620  dialog.size.height = dialog.rootElem.offsetHeight; 
     621 
     622  if (!this.modal)  
     623  { 
     624    this.sizeBgToDialog(); 
     625  }   
    611626}; 
    612627 
     
    619634  this.attached = true; 
    620635  this.rootElem.side = side; 
    621   this.captionBar.ondblclick = function(ev) { dialog.detachFromPanel(ev ? ev :window.event); }; 
     636  this.captionBar.ondblclick = function(ev) { dialog.detachFromPanel(Xinha.getEvent(ev)); }; 
    622637   
    623638  rootElem.style.position = "static"; 
    624639  rootElem.parentNode.removeChild(rootElem); 
     640   
     641  this.background.style.display = 'none'; 
    625642   
    626643  this.captionBar.style.paddingLeft = "3px"; 
     
    648665  var dialog = this; 
    649666  var rootElem = dialog.rootElem; 
     667  var rootElemStyle = rootElem.style; 
    650668  var editor = dialog.editor; 
    651669   
    652670  dialog.attached = false; 
     671   
     672  this.background.style.display = ''; 
     673  this.sizeBgToDialog(); 
     674   
    653675  var pos = Xinha.getElementTopLeft(rootElem); 
    654   rootElem.style.position = "absolute"; 
    655   rootElem.style.top = pos.top + "px"; 
    656   rootElem.style.left = pos.left + "px"; 
     676  rootElemStyle.position = "absolute"; 
     677  rootElemStyle.top = pos.top + "px"; 
     678  rootElemStyle.left = pos.left + "px"; 
    657679   
    658680  dialog.captionBar.style.paddingLeft = "22px"; 
     
    661683  dialog.icon.style.display = ''; 
    662684   
    663    
    664685  if ( dialog.size.width ) rootElem.style.width  = dialog.size.width + 'px'; 
    665686 
     
    672693}; 
    673694 
     695Xinha.Dialog.calcFullBgSize = function() 
     696{ 
     697  var page = Xinha.pageSize(); 
     698  var viewport = Xinha.viewportSize(); 
     699  return {width:(page.x > viewport.x  ? page.x : viewport.x )  + "px",height:(page.x > viewport.y ? page.y : viewport.y ) + "px"}; 
     700} 
     701 
     702Xinha.Dialog.prototype.sizeBgToDialog = function() 
     703{ 
     704  var rootElemStyle = this.rootElem.style; 
     705  var bgStyle = this.background.style; 
     706  bgStyle.top = rootElemStyle.top; 
     707  bgStyle.left = rootElemStyle.left; 
     708  bgStyle.width = rootElemStyle.width; 
     709  bgStyle.height = rootElemStyle.height; 
     710} 
    674711Xinha.Dialog.prototype.hideBackground = function() 
    675712{ 
     
    10461083    } 
    10471084} 
    1048 Xinha.Dialog.coverIframes = function() 
    1049 { 
    1050     for (var i=0;i<__xinhas.length;i++) 
    1051     { 
    1052       __xinhas[i]._framework.iframe_cover.style.display = ''; 
    1053     } 
    1054 } 
    1055 Xinha.Dialog.unCoverIframes = function() 
    1056 { 
    1057     for (var i=0;i<__xinhas.length;i++) 
    1058     { 
    1059       __xinhas[i]._framework.iframe_cover.style.display = 'none'; 
    1060     } 
    1061 } 
Note: See TracChangeset for help on using the changeset viewer.