Changeset 1044

Show
Ignore:
Timestamp:
10/02/08 12:07:26 (2 months ago)
Author:
douglas
Message:

FIXED Ticket #1176 Merging new dialogs branch back to trunk.

Location:
trunk
Files:
18 added
4 removed
27 modified

Legend:

Unmodified
Added
Removed
  • trunk/Xinha.css

    r980 r1044  
    114114.dialog { 
    115115  color: ButtonText; 
    116   background: ButtonFace; 
    117 } 
    118  
     116  background: ButtonFace;  
     117  border: 1px outset;  
     118  border-color: WindowFrame; 
     119} 
     120div.dialog { 
     121  padding-bottom:10px; 
     122} 
     123.xinha_dialog_background { 
     124  filter: alpha(opacity=0); 
     125  -moz-opacity: 0; 
     126  opacity: 0; 
     127  border:none; 
     128} 
     129.xinha_dialog_background.modal.greyout { 
     130  background-color:#666; 
     131  filter: alpha(opacity=70) !IMPORTANT; 
     132  -moz-opacity: 0.7; 
     133  opacity: 0.7; 
     134} 
     135.xinha_dialog_background.modal { 
     136  filter: alpha(opacity=0) !IMPORTANT; 
     137  -moz-opacity: 0; 
     138  opacity: 0; 
     139  border:none; 
     140} 
     141body.xinha_dialog_background.modal.greyout { 
     142  filter: alpha(opacity=100) !IMPORTANT; 
     143} 
     144body.xinha_dialog_background.modal { 
     145  filter: alpha(opacity=0); 
     146} 
    119147.dialog .content { padding: 2px; } 
    120148 
     
    127155.dialog .title, .dialog h1 
    128156{ 
    129   background: #008; 
    130   color: #ff8; 
     157  background: ActiveCaption; 
     158  color: CaptionText; 
    131159  border-bottom: 1px solid #000; 
    132160  padding: 1px 0px 2px 5px; 
     
    134162  font-weight: bold; 
    135163  cursor: default; 
    136 } 
    137 .dialog h1 { margin:0px;} 
     164  letter-spacing: 0.01em; 
     165} 
     166.dialog h1 { margin:0;} 
    138167.dialog .title .button { 
    139168  float: right; 
     
    148177 
    149178.dialog button { 
    150   width: 5em; 
     179  width: 5.5em; 
    151180  padding: 0px; 
    152181} 
    153  
     182.dialog .closeButton { 
     183  padding: 0px; 
     184  cursor: default; 
     185  border: 1px solid; 
     186  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; 
     187  height : 11px; 
     188  width : 11px; 
     189  vertical-align : top; 
     190  position : absolute; 
     191  top : 3px; 
     192  right : 2px; 
     193  background-color: ButtonFace; 
     194  color: ButtonText; 
     195  font-size: 13px; 
     196  font-family: Tahoma,Verdana,sans-serif; 
     197  text-align:center; 
     198  letter-spacing:0; 
     199  overflow:hidden; 
     200} 
    154201.dialog .buttonColor { 
    155202  width :1em; 
     
    179226.dialog .label { text-align: right; width: 6em; } 
    180227.dialog .value input { width: 100%; } 
    181 .dialog .buttons { text-align: right; padding: 2px 4px 0px 4px; } 
    182228 
    183229.dialog legend { font-weight: bold; } 
    184230.dialog fieldset table { margin: 2px 0px; } 
    185  
     231  
     232.dialog  .buttons { 
     233 
     234      padding: 1em;  
     235      text-align: center; 
     236} 
     237.dialog .resizeHandle { 
     238    -moz-appearance : resizer; 
     239    width: 12px; 
     240    height: 12px; 
     241    border-bottom: 2px solid #000; 
     242    border-right: 2px solid #000; 
     243    cursor : nw-resize; 
     244} 
    186245.popupwin { 
    187246  padding: 0px; 
     
    229288 
    230289.htmlarea .panel h1 { 
    231   background: ButtonFace; 
    232   border: 1px solid; 
    233   border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; 
    234   margin:   0px; 
    235   padding:  0px; 
    236   font-size:100%; 
    237   font-weight:bold; 
    238   padding: 2px; 
    239290  clear:left; 
    240    
    241 } 
    242  
    243 .htmlarea .panel { overflow:hidden; } 
     291  font-size:0.9em; 
     292} 
     293 
     294.htmlarea .panel {  
     295  overflow:hidden;  
     296  background-color:white; 
     297  padding-bottom:0 !IMPORTANT; 
     298  border: none !IMPORTANT; 
     299} 
    244300.htmlarea .panels.left  .panel { border-right:none; border-left:none; } 
    245301.htmlarea .panels.left  h1     { border-right:none;  } 
  • trunk/XinhaCore.js

    r1032 r1044  
    977977    "Formatted": "pre" 
    978978  }; 
     979   
     980  this.dialogOptions = 
     981  {  
     982    'centered' : true, //true: dialog is shown in the center the screen, false dialog is shown near the clicked toolbar button 
     983    'greyout':true, //true: when showing modal dialogs, the page behind the dialoge is greyed-out 
     984    'closeOnEscape':true 
     985  }; 
     986 
    979987  /** ?? 
    980988   * Default: <code>{}</code> 
     
    17821790        function(ev) 
    17831791        { 
    1784           ev = Xinha.is_ie ? window.event : ev; 
    1785           editor.btnClickEvent = ev; 
     1792          ev = ev || window.event; 
     1793          editor.btnClickEvent = {clientX : ev.clientX, clientY : ev.clientY}; 
    17861794          if ( obj.enabled ) 
    17871795          { 
     
    21002108  } 
    21012109 
    2102   if ( typeof Xinha.Dialog == 'undefined' &&  !Xinha._loadback( _editor_url + 'modules/Dialogs/inline-dialog.js' , this.generate, this ) ) 
     2110  if ( typeof Xinha.Dialog == 'undefined' &&  !Xinha._loadback( _editor_url + 'modules/Dialogs/XinhaDialog.js' , this.generate, this ) ) 
    21032111  {     
    21042112    return false; 
     
    22592267  fw.table.appendChild(fw.tbody); 
    22602268 
    2261   var xinha = this._framework.table; 
     2269  var xinha = fw.table; 
    22622270  this._htmlArea = xinha; 
    22632271  Xinha.freeLater(this, '_htmlArea'); 
     
    22652273 
    22662274    // create the toolbar and put in the area 
    2267   this._framework.tb_cell.appendChild( this._createToolbar() ); 
     2275  fw.tb_cell.appendChild( this._createToolbar() ); 
    22682276 
    22692277    // create the IFRAME & add to container 
     
    22712279  iframe.src = this.popupURL(editor.config.URIs.blank); 
    22722280  iframe.id = "XinhaIFrame_" + this._textArea.id; 
    2273   this._framework.ed_cell.appendChild(iframe); 
     2281  fw.ed_cell.appendChild(iframe); 
    22742282  this._iframe = iframe; 
    22752283  this._iframe.className = 'xinha_iframe'; 
     
    22782286    // creates & appends the status bar 
    22792287  var statusbar = this._createStatusBar(); 
    2280   this._framework.sb_cell.appendChild(statusbar); 
     2288  fw.sb_cell.appendChild(statusbar); 
    22812289 
    22822290  // insert Xinha before the textarea. 
     
    22872295  // extract the textarea and insert it into the xinha framework 
    22882296  Xinha.removeFromParent(textarea); 
    2289   this._framework.ed_cell.appendChild(textarea); 
     2297  fw.ed_cell.appendChild(textarea); 
    22902298 
    22912299  // if another editor is activated while this one is in text mode, toolbar is disabled    
     
    24692477  this._risizing = true; 
    24702478   
     2479  var framework = this._framework; 
     2480   
    24712481  this.notifyOf('before_resize', {width:width, height:height}); 
    24722482  this.firePluginEvent('onBeforeResize', width, height); 
     
    25802590//  } 
    25812591 
    2582   this._framework.tb_cell.colSpan = col_span; 
    2583   this._framework.tp_cell.colSpan = col_span; 
    2584   this._framework.bp_cell.colSpan = col_span; 
    2585   this._framework.sb_cell.colSpan = col_span; 
     2592  framework.tb_cell.colSpan = col_span; 
     2593  framework.tp_cell.colSpan = col_span; 
     2594  framework.bp_cell.colSpan = col_span; 
     2595  framework.sb_cell.colSpan = col_span; 
    25862596 
    25872597  // Put in the panel rows, top panel goes above editor row 
    2588   if ( !this._framework.tp_row.childNodes.length ) 
    2589   { 
    2590     Xinha.removeFromParent(this._framework.tp_row); 
     2598  if ( !framework.tp_row.childNodes.length ) 
     2599  { 
     2600    Xinha.removeFromParent(framework.tp_row); 
    25912601  } 
    25922602  else 
    25932603  { 
    2594     if ( !Xinha.hasParentNode(this._framework.tp_row) ) 
    2595     { 
    2596       this._framework.tbody.insertBefore(this._framework.tp_row, this._framework.ler_row); 
     2604    if ( !Xinha.hasParentNode(framework.tp_row) ) 
     2605    { 
     2606      framework.tbody.insertBefore(framework.tp_row, framework.ler_row); 
    25972607    } 
    25982608  } 
    25992609 
    26002610  // bp goes after the editor 
    2601   if ( !this._framework.bp_row.childNodes.length ) 
    2602   { 
    2603     Xinha.removeFromParent(this._framework.bp_row); 
     2611  if ( !framework.bp_row.childNodes.length ) 
     2612  { 
     2613    Xinha.removeFromParent(framework.bp_row); 
    26042614  } 
    26052615  else 
    26062616  { 
    2607     if ( !Xinha.hasParentNode(this._framework.bp_row) ) 
    2608     { 
    2609       this._framework.tbody.insertBefore(this._framework.bp_row, this._framework.ler_row.nextSibling); 
     2617    if ( !Xinha.hasParentNode(framework.bp_row) ) 
     2618    { 
     2619      framework.tbody.insertBefore(framework.bp_row, framework.ler_row.nextSibling); 
    26102620    } 
    26112621  } 
     
    26142624  if ( !this.config.statusBar ) 
    26152625  { 
    2616     Xinha.removeFromParent(this._framework.sb_row); 
     2626    Xinha.removeFromParent(framework.sb_row); 
    26172627  } 
    26182628  else 
    26192629  { 
    2620     if ( !Xinha.hasParentNode(this._framework.sb_row) ) 
    2621     { 
    2622       this._framework.table.appendChild(this._framework.sb_row); 
     2630    if ( !Xinha.hasParentNode(framework.sb_row) ) 
     2631    { 
     2632      framework.table.appendChild(framework.sb_row); 
    26232633    } 
    26242634  } 
    26252635 
    26262636  // Size and set colspans, link up the framework 
    2627   this._framework.lp_cell.style.width  = this.config.panel_dimensions.left; 
    2628   this._framework.rp_cell.style.width  = this.config.panel_dimensions.right; 
    2629   this._framework.tp_cell.style.height = this.config.panel_dimensions.top; 
    2630   this._framework.bp_cell.style.height = this.config.panel_dimensions.bottom; 
    2631   this._framework.tb_cell.style.height = this._toolBar.offsetHeight + 'px'; 
    2632   this._framework.sb_cell.style.height = this._statusBar.offsetHeight + 'px'; 
     2637  framework.lp_cell.style.width  = this.config.panel_dimensions.left; 
     2638  framework.rp_cell.style.width  = this.config.panel_dimensions.right; 
     2639  framework.tp_cell.style.height = this.config.panel_dimensions.top; 
     2640  framework.bp_cell.style.height = this.config.panel_dimensions.bottom; 
     2641  framework.tb_cell.style.height = this._toolBar.offsetHeight + 'px'; 
     2642  framework.sb_cell.style.height = this._statusBar.offsetHeight + 'px'; 
    26332643 
    26342644  var edcellheight = height - this._toolBar.offsetHeight - this._statusBar.offsetHeight; 
     
    39443954Xinha.prototype.updateToolbar = function(noStatus) 
    39453955{ 
     3956  if (this.suspendUpdateToolbar) return; 
     3957   
    39463958  var doc = this._doc; 
    39473959  var text = (this._editMode == "textmode"); 
     
    47144726    } 
    47154727  } 
     4728 
     4729  /* If this.currentModal is not null, then there's a modal dialog  
     4730  /* on screen, and we kill the event. This eliminates the possibility 
     4731  /* of a user 'tabbing' out of a modal dialog and re-activating the editor. 
     4732  /* This fixes the bug reported in ticket #1259 
     4733  /* http://xinha.webfactional.com/ticket/1259 */ 
     4734  if (this.currentModal) 
     4735  { 
     4736    return false; 
     4737  } 
     4738 
    47164739  // update the toolbar state after some time 
    47174740  if ( editor._timerToolbar ) 
     
    47194742    clearTimeout(editor._timerToolbar); 
    47204743  } 
     4744  if (!this.suspendUpdateToolbar) 
     4745  { 
    47214746  editor._timerToolbar = setTimeout( 
    47224747    function() 
     
    47264751    }, 
    47274752    250); 
     4753  } 
    47284754}; 
    47294755 
     
    54855511}; 
    54865512 
     5513Xinha.getEvent = function(ev) 
     5514{ 
     5515  return ev || window.event; 
     5516} 
    54875517/** 
    54885518 * Prepares an element to receive more than one DOM-0 event handler 
     
    61796209        s += prop + ' = ' + o[prop] + '\n'; 
    61806210      } 
    6181  
    61826211    } 
    61836212    if (s)  
     
    67896818  scope = (scope) ? scope : window; 
    67906819  var x,y; 
    6791   if (scope.pageYOffset) // all except Explorer 
     6820  if (typeof scope.pageYOffset != 'undefined') // all except Explorer 
    67926821  { 
    67936822    x = scope.pageXOffset; 
    67946823    y = scope.pageYOffset; 
    67956824  } 
    6796   else if (scope.document.documentElement && document.documentElement.scrollTop) 
     6825  else if (scope.document.documentElement && typeof document.documentElement.scrollTop != 'undefined') 
    67976826    // Explorer 6 Strict 
    67986827  { 
  • trunk/modules/ColorPicker/ColorPicker.js

    r1024 r1044  
    372372          this.table.style.position = 'fixed'; 
    373373        } 
    374         top+=e.offsetTop - e.scrollTop; 
    375         left+=e.offsetLeft - e.scrollLeft; 
     374        top += e.offsetTop - e.scrollTop; 
     375        left += e.offsetLeft - e.scrollLeft; 
    376376 
    377377        e = e.offsetParent; 
  • trunk/modules/CreateLink/link.js

    r1001 r1044  
    1  
    21  /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 
    32    --  Xinha (is not htmlArea) - http://xinha.org 
     
    1615    --  which provides the functionality to insert a hyperlink in the editor. 
    1716    -- 
    18     --  he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. 
     17    --  The file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. 
    1918    -- 
    2019    -- 
     
    2423    --  $LastChangedBy:ray $ 
    2524    --------------------------------------------------------------------------*/ 
     25 
     26function CreateLink(editor) { 
     27        this.editor = editor; 
     28        var cfg = editor.config; 
     29        var self = this; 
     30 
     31   editor.config.btnList.createlink[3] = function() { self.show(self._getSelectedAnchor()); } 
     32} 
     33 
    2634CreateLink._pluginInfo = { 
    2735  name          : "CreateLink", 
    2836  origin        : "Xinha Core", 
    29   version       : "$LastChangedRevision:990 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'), 
     37  version       : "$LastChangedRevision$".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'), 
    3038  developer     : "The Xinha Core Developer Team", 
    31   developer_url : "$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'), 
     39  developer_url : "$HeadURL$".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'), 
    3240  sponsor       : "", 
    3341  sponsor_url   : "", 
     
    3543}; 
    3644 
    37 function CreateLink(editor) { 
    38 }                                                        
     45CreateLink.prototype._lc = function(string) { 
     46        return Xinha._lc(string, 'Xinha'); 
     47}; 
    3948 
    40 Xinha.prototype._createLink = function(link) 
     49 
     50CreateLink.prototype.onGenerateOnce = function() 
    4151{ 
    42   var editor = this; 
    43   var outparam = null; 
    44   if ( typeof link == "undefined" ) 
    45   { 
    46     link = this.getParentElement(); 
    47     if ( link ) 
    48     { 
    49       while (link && !/^a$/i.test(link.tagName)) 
    50       { 
    51         link = link.parentNode; 
    52       } 
    53     } 
    54   } 
    55   if ( !link ) 
    56   { 
    57     var sel = editor.getSelection(); 
    58     var range = editor.createRange(sel); 
    59     var compare = 0; 
    60     if ( Xinha.is_ie ) 
    61     { 
    62       if ( sel.type == "Control" ) 
    63       { 
    64         compare = range.length; 
    65       } 
    66       else 
    67       { 
    68         compare = range.compareEndPoints("StartToEnd", range); 
    69       } 
    70     } 
    71     else 
    72     { 
    73       compare = range.compareBoundaryPoints(range.START_TO_END, range); 
    74     } 
    75     if ( compare === 0 ) 
    76     { 
    77       alert(Xinha._lc("You need to select some text before creating a link")); 
    78       return; 
    79     } 
    80     outparam = 
    81     { 
    82       f_href : '', 
    83       f_title : '', 
    84       f_target : '', 
    85       f_usetarget : editor.config.makeLinkShowsTarget 
    86     }; 
    87   } 
    88   else 
    89   { 
    90     outparam = 
    91     { 
    92       f_href   : Xinha.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), 
    93       f_title  : link.title, 
    94       f_target : link.target, 
    95       f_usetarget : editor.config.makeLinkShowsTarget 
    96     }; 
    97   } 
    98   Dialog( 
    99     editor.config.URIs.link, 
    100     function(param) 
    101     { 
    102       if ( !param ) 
    103       { 
    104         return false; 
    105       } 
    106       var a = link; 
    107       if ( !a ) 
    108       { 
    109         try 
    110         { 
    111           var tmp = Xinha.uniq('http://www.example.com/Link'); 
    112           editor._doc.execCommand('createlink', false, tmp); 
     52  CreateLink.loadAssets(); 
     53}; 
    11354 
    114           // Fix them up 
    115           var anchors = editor._doc.getElementsByTagName('a'); 
    116           for(var i = 0; i < anchors.length; i++) 
    117           { 
    118             var anchor = anchors[i]; 
    119             if(anchor.href == tmp) 
    120             { 
    121               // Found one. 
    122               if (!a) a = anchor; 
    123               anchor.href =  param.f_href; 
    124               if (param.f_target) anchor.target =  param.f_target; 
    125               if (param.f_title)  anchor.title =  param.f_title; 
    126             } 
    127           } 
    128         } catch(ex) {} 
    129       } 
    130       else 
    131       { 
    132         var href = param.f_href.trim(); 
    133         editor.selectNodeContents(a); 
    134         if ( href === '' ) 
    135         { 
    136           editor._doc.execCommand("unlink", false, null); 
    137           editor.updateToolbar(); 
    138           return false; 
    139         } 
    140         else 
    141         { 
    142           a.href = href; 
    143         } 
    144       } 
    145       if ( ! ( a && a.tagName.toLowerCase() == 'a' ) ) 
    146       { 
    147         return false; 
    148       } 
    149       a.target = param.f_target.trim(); 
    150       a.title = param.f_title.trim(); 
    151       editor.selectNodeContents(a); 
    152       editor.updateToolbar(); 
    153     }, 
    154     outparam); 
     55CreateLink.loadAssets = function() 
     56{ 
     57        var self = CreateLink; 
     58        if (self.loading) return; 
     59        self.loading = true; 
     60        Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     61        Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
     62} 
     63 
     64CreateLink.prototype.onUpdateToolbar = function() 
     65{  
     66        if (!(CreateLink.dialogReady && CreateLink.methodsReady)) 
     67        { 
     68                this.editor._toolbarObjects.createlink.state("enabled", false); 
     69        } 
     70        else this.onUpdateToolbar = null; 
    15571}; 
     72 
     73CreateLink.prototype.prepareDialog = function() 
     74{ 
     75        var self = this; 
     76        var editor = this.editor; 
     77 
     78        var dialog = this.dialog = new Xinha.Dialog(editor, CreateLink.html, 'Xinha',{width:400}) 
     79        // Connect the OK and Cancel buttons 
     80        dialog.getElementById('ok').onclick = function() {self.apply();} 
     81 
     82        dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 
     83 
     84        if (!editor.config.makeLinkShowsTarget) 
     85        { 
     86                dialog.getElementById("f_target_label").style.visibility = "hidden"; 
     87                dialog.getElementById("f_target").style.visibility = "hidden"; 
     88                dialog.getElementById("f_other_target").style.visibility = "hidden"; 
     89        } 
     90 
     91        dialog.getElementById('f_target').onchange= function()  
     92        { 
     93                var f = dialog.getElementById("f_other_target"); 
     94                if (this.value == "_other") { 
     95                        f.style.visibility = "visible"; 
     96                        f.select(); 
     97                        f.focus(); 
     98                } else f.style.visibility = "hidden"; 
     99        }; 
     100 
     101         
     102        this.dialogReady = true; 
     103}; 
  • trunk/modules/Gecko/Gecko.js

    <
    r1001 r1044  
    576576Xinha.prototype.restoreSelection = function(savedSelection) 
    577577{ 
     578  try  
     579  { 
    578580  var sel = this.getSelection(); 
    579581  sel.removeAllRanges(); 
    580582  sel.addRange(savedSelection); 
     583  } 
     584  catch (e) {} 
    581585} 
    582586/** 
     
    585589 * 
    586590 * @param node DomNode  
    587  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    588  */ 
    589   
    590 Xinha.prototype.selectNodeContents = function(node, pos) 
     591 * @param collapseToStart A boolean that, when supplied, says to collapse the selection. True collapses to the start, and false to the end.