Changeset 4be86f3 in github


Ignore:
Timestamp:
Mar 9, 2012 8:23:24 AM (15 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
Children:
8d67c7b
Parents:
84d6e27
Message:
  • Unified (single) spellchecker button
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rfe3a1d6 r4be86f3  
    22=========================== 
    33 
     4- Unified (single) spellchecker button 
    45- Fix encoding of attachment with comma in name (#1488389) 
    56- Scroll long lists on drag&drop (#1485946) 
  • program/js/app.js

    r54dfd15 r4be86f3  
    262262 
    263263          if (this.env.spellcheck) { 
    264             this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); }; 
     264            this.env.spellcheck.spelling_state_observer = function(s) { ref.spellcheck_state(); }; 
    265265            this.env.compose_commands.push('spellcheck') 
    266             this.set_spellcheck_state('ready'); 
    267             if ($("input[name='_is_html']").val() == '1') 
    268               this.display_spellcheck_controls(false); 
     266            this.enable_command('spellcheck', true); 
    269267          } 
    270268 
     
    899897 
    900898      case 'spellcheck': 
    901         if (window.tinyMCE && tinyMCE.get(this.env.composebody)) { 
    902           tinyMCE.execCommand('mceSpellCheck', true); 
    903         } 
    904         else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) { 
    905           this.env.spellcheck.spellCheck(); 
    906           this.set_spellcheck_state('checking'); 
    907         } 
     899        if (this.spellcheck_state()) { 
     900          this.stop_spellchecking(); 
     901        } 
     902        else { 
     903          if (window.tinyMCE && tinyMCE.get(this.env.composebody)) { 
     904            tinyMCE.execCommand('mceSpellCheck', true); 
     905          } 
     906          else if (this.env.spellcheck && this.env.spellcheck.spellCheck) { 
     907            this.env.spellcheck.spellCheck(); 
     908          } 
     909        } 
     910        this.spellcheck_state(); 
    908911        break; 
    909912 
     
    31173120  this.toggle_editor = function(props) 
    31183121  { 
     3122    this.stop_spellchecking(); 
     3123 
    31193124    if (props.mode == 'html') { 
    3120       this.display_spellcheck_controls(false); 
    31213125      this.plain2html($('#'+props.id).val(), props.id); 
    31223126      tinyMCE.execCommand('mceAddControl', false, props.id); 
     
    31293133    else { 
    31303134      var thisMCE = tinyMCE.get(props.id), existingHtml; 
    3131       if (thisMCE.plugins.spellchecker && thisMCE.plugins.spellchecker.active) 
    3132         thisMCE.execCommand('mceSpellCheck', false); 
    31333135 
    31343136      if (existingHtml = thisMCE.getContent()) { 
     
    31393141      } 
    31403142      tinyMCE.execCommand('mceRemoveControl', false, props.id); 
    3141       this.display_spellcheck_controls(true); 
    31423143    } 
    31433144 
     
    31483149  { 
    31493150    var ed; 
     3151 
    31503152    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody))) { 
    31513153      if (ed.plugins.spellchecker && ed.plugins.spellchecker.active) 
    31523154        ed.execCommand('mceSpellCheck'); 
    31533155    } 
    3154     else if ((ed = this.env.spellcheck) && !this.spellcheck_ready) { 
    3155       $(ed.spell_span).trigger('click'); 
    3156       this.set_spellcheck_state('ready'); 
    3157     } 
    3158   }; 
    3159  
    3160   this.display_spellcheck_controls = function(vis) 
    3161   { 
    3162     if (this.env.spellcheck) { 
    3163       // stop spellchecking process 
    3164       if (!vis) 
    3165         this.stop_spellchecking(); 
    3166  
    3167       $(this.env.spellcheck.spell_container)[vis ? 'show' : 'hide'](); 
    3168     } 
    3169   }; 
    3170  
    3171   this.set_spellcheck_state = function(s) 
    3172   { 
    3173     this.spellcheck_ready = (s == 'ready' || s == 'no_error_found'); 
    3174     this.enable_command('spellcheck', this.spellcheck_ready); 
     3156    else if (ed = this.env.spellcheck) { 
     3157      if (ed.state && ed.state != 'ready' && ed.state != 'no_error_found') 
     3158        $(ed.spell_span).trigger('click'); 
     3159    } 
     3160 
     3161    this.spellcheck_state(); 
     3162  }; 
     3163 
     3164  this.spellcheck_state = function() 
     3165  { 
     3166    var ed, active; 
     3167 
     3168    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) 
     3169      active = ed.plugins.spellchecker.active; 
     3170    else if ((ed = this.env.spellcheck) && ed.state) 
     3171      active = ed.state != 'ready' && ed.state != 'no_error_found'; 
     3172 
     3173    $('#'+rcmail.buttons.spellcheck[0].id)[active ? 'addClass' : 'removeClass']('selected'); 
     3174 
     3175    return active; 
    31753176  }; 
    31763177 
     
    31793180  { 
    31803181    var ed; 
    3181     if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) { 
     3182 
     3183    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) 
    31823184      return ed.plugins.spellchecker.selectedLang; 
    3183     } 
    3184     else if (this.env.spellcheck) { 
     3185    else if (this.env.spellcheck) 
    31853186      return GOOGIE_CUR_LANG; 
    3186     } 
     3187  }; 
     3188 
     3189  this.spellcheck_lang_set = function(lang) 
     3190  { 
     3191    var editor; 
     3192 
     3193    if (window.tinyMCE && (editor = tinyMCE.get(this.env.composebody))) 
     3194      editor.plugins.spellchecker.selectedLang = lang; 
     3195    else if (this.env.spellcheck) 
     3196      this.env.spellcheck.setCurrentLanguage(lang); 
    31873197  }; 
    31883198 
     
    32033213      sp.processData(data); 
    32043214    } 
     3215 
     3216    this.spellcheck_state(); 
    32053217  } 
    32063218 
  • program/js/editor.js

    r7fe3811 r4be86f3  
    4545      theme_advanced_buttons2: ',fontselect,fontsizeselect' 
    4646    }); 
    47   else // mail compose 
     47  else { // mail compose 
    4848    $.extend(conf, { 
    4949      plugins: 'paste,emotions,media,nonbreaking,table,searchreplace,visualchars,directionality,tabfocus' + (config.spellcheck ? ',spellchecker' : ''), 
    5050      theme_advanced_buttons1: 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,ltr,rtl,blockquote,|,forecolor,backcolor,fontselect,fontsizeselect', 
    51       theme_advanced_buttons2: 'link,unlink,table,|,emotions,charmap,image,media,|,code,search' + (config.spellcheck ? ',spellchecker' : '') + ',undo,redo', 
     51      theme_advanced_buttons2: 'link,unlink,table,|,emotions,charmap,image,media,|,code,search,undo,redo', 
    5252      spellchecker_languages: (rcmail.env.spellcheck_langs ? rcmail.env.spellcheck_langs : 'Dansk=da,Deutsch=de,+English=en,Espanol=es,Francais=fr,Italiano=it,Nederlands=nl,Polski=pl,Portugues=pt,Suomi=fi,Svenska=sv'), 
    5353      spellchecker_rpc_url: '?_task=utils&_action=spell_html', 
     
    5656      oninit: 'rcmail_editor_callback' 
    5757    }); 
     58 
     59    // add handler for spellcheck button state update 
     60    conf.setup = function(ed) { 
     61      ed.onSetProgressState.add(function(ed, active) { 
     62        if (!active) 
     63          rcmail.spellcheck_state(); 
     64      }); 
     65    } 
     66  } 
    5867 
    5968  // support external configuration settings e.g. from skin 
  • program/steps/mail/compose.inc

    r6357223 r4be86f3  
    814814      $lang = 'en'; 
    815815 
     816    $OUTPUT->set_env('spell_langs', $spellcheck_langs); 
     817    $OUTPUT->set_env('spell_lang', $lang); 
     818 
    816819    $editor_lang_set = array(); 
    817820    foreach ($spellcheck_langs as $key => $name) { 
     
    831834      "googie.setLanguages(%s);\n". 
    832835      "googie.setCurrentLanguage('%s');\n". 
    833       "googie.setSpellContainer('spellcheck-control');\n". 
     836      "googie.setDecoration(false);\n". 
    834837      "googie.decorateTextarea('%s');\n". 
    835838      "%s.set_env('spellcheck', googie);", 
  • skins/default/common.css

    r3cbdbd9 r4be86f3  
    496496  text-decoration: none; 
    497497  min-height: 14px; 
     498  background: transparent; 
    498499} 
    499500 
     
    505506} 
    506507 
    507 .popupmenu li a.active:hover 
     508.popupmenu li a.active:hover, 
     509.popupmenu.selectable li a.selected:hover 
    508510{ 
    509511  color: #fff; 
     
    514516{ 
    515517  float: left; 
     518} 
     519 
     520.popupmenu.selectable li a.selected 
     521{ 
     522  background: url(images/messageicons.png) 2px -372px no-repeat; 
     523} 
     524 
     525.popupmenu.selectable li a 
     526{ 
     527  padding-left: 20px; 
    516528} 
    517529 
  • skins/default/functions.js

    re97f010 r4be86f3  
    103103    mailboxmenu:    {id:'mailboxoptionsmenu', above:1}, 
    104104    composemenu:    {id:'composeoptionsmenu', editable:1, overlap:1}, 
     105    spellmenu:      {id:'spellmenu'}, 
    105106    // toggle: #1486823, #1486930 
    106107    uploadmenu:     {id:'attachment-form', editable:1, above:1, toggle:!bw.ie&&!bw.linux }, 
     
    352353}, 
    353354 
     355spellmenu: function(show) 
     356{ 
     357  var link, li, 
     358    lang = rcmail.spellcheck_lang(), 
     359    menu = this.popups.spellmenu.obj, 
     360    ul = $('ul', menu); 
     361 
     362  if (!ul.length) { 
     363    ul = $('<ul>'); 
     364 
     365    for (i in rcmail.env.spell_langs) { 
     366      li = $('<li>'); 
     367      link = $('<a href="#">').text(rcmail.env.spell_langs[i]) 
     368        .addClass('active').data('lang', i) 
     369        .click(function() { 
     370          rcmail.spellcheck_lang_set($(this).data('lang')); 
     371        }); 
     372 
     373      link.appendTo(li); 
     374      li.appendTo(ul); 
     375    } 
     376 
     377    ul.appendTo(menu); 
     378  } 
     379 
     380  // select current language 
     381  $('li', ul).each(function() { 
     382    var el = $('a', this); 
     383    if (el.data('lang') == lang) 
     384      el.addClass('selected'); 
     385    else if (el.hasClass('selected')) 
     386      el.removeClass('selected'); 
     387  }); 
     388 
     389  this.show_popupmenu('spellmenu', show); 
     390}, 
     391 
    354392body_mouseup: function(evt, p) 
    355393{ 
  • skins/default/mail.css

    raa2013b r4be86f3  
    3737#messagetoolbar a.buttonPas { 
    3838  opacity: 0.35; 
     39} 
     40 
     41#messagetoolbar a.button.selected { 
     42  background-color: #ddd; 
     43  margin-left: 4px; 
     44  margin-right: 4px; 
     45  margin-top: -1px; 
     46  border: 1px solid #ccc; 
     47  border-radius: 3px; 
     48  -moz-border-radius: 3px; 
     49  -webkit-border-radius: 3px; 
    3950} 
    4051 
  • skins/default/templates/compose.html

    r1de8f4e r4be86f3  
    44<title><roundcube:object name="productname" /> :: <roundcube:label name="compose" /></title> 
    55<roundcube:include file="/includes/links.html" /> 
     6<roundcube:if condition="config:enable_spellcheck" /> 
    67<link rel="stylesheet" type="text/css" href="/googiespell.css" /> 
     8<roundcube:endif /> 
    79<script type="text/javascript" src="/functions.js"></script> 
    810<script type="text/javascript" src="/splitter.js"></script> 
     
    2426    <roundcube:button command="list" type="link" class="button back" classAct="button back" classSel="button backSel" title="backtolist" content=" " /> 
    2527    <roundcube:button command="send" type="link" class="buttonPas send" classAct="button send" classSel="button sendSel" title="sendmessage" content=" " /> 
    26     <roundcube:button command="spellcheck" type="link" class="buttonPas spellcheck" classAct="button spellcheck" classSel="button spellcheckSel" title="checkspelling" content=" " /> 
     28<roundcube:if condition="config:enable_spellcheck" /> 
     29    <span class="dropbutton"> 
     30        <roundcube:button command="spellcheck" type="link" class="buttonPas spellcheck" classAct="button spellcheck" classSel="button spellcheckSel" title="checkspelling" content=" " /> 
     31        <span id="spellmenulink" onclick="rcmail_ui.show_popup('spellmenu');return false"></span> 
     32    </span> 
     33<roundcube:endif /> 
    2734    <roundcube:button name="addattachment" type="link" class="button attach" classAct="button attach" classSel="button attachSel" title="addattachment" onclick="rcmail_ui.show_popup('uploadmenu', true);return false" content=" " /> 
    2835    <roundcube:button command="insert-sig" type="link" class="buttonPas insertsig" classAct="button insertsig" classSel="button insertsigSel" title="insertsignature" content=" " /> 
     
    112119            </div> 
    113120            <div id="compose-editorfooter"> 
    114                 <span id="spellcheck-control" style="margin-right:10px"></span> 
    115121                <roundcube:if condition="!in_array('htmleditor', (array)config:dont_override)" /> 
    116122                <span> 
     
    144150</div> 
    145151 
     152<div id="spellmenu" class="popupmenu selectable"></div> 
     153 
    146154</form> 
    147155 
  • skins/larry/mail.css

    refaf2e0 r4be86f3  
    11671167#composebody { 
    11681168        position: absolute; 
    1169         top: 24px; 
     1169        top: 1px; 
    11701170        left: 0; 
    11711171        bottom: 0; 
    11721172        width: 99%; 
    11731173        border: 0; 
     1174        border-radius: 0; 
    11741175        padding: 8px 0 8px 8px; 
    11751176        box-shadow: none; 
     
    11961197} 
    11971198 
    1198 #spellcheck-control { 
    1199         margin: 6px 8px; 
    1200         text-align: right; 
    1201 } 
    1202  
    12031199.defaultSkin table.mceLayout, 
    12041200.defaultSkin table.mceLayout tr.mceLast td { 
  • skins/larry/styles.css

    ra1f855e r4be86f3  
    13911391 
    13921392.toolbar a.button.spellcheck { 
    1393         background-position: center -930px; 
     1393        min-width: 64px; 
     1394        background-position: left -930px; 
    13941395} 
    13951396 
     
    15751576} 
    15761577 
    1577 ul.toolbarmenu.iconized li a { 
     1578ul.toolbarmenu.iconized li a, 
     1579ul.toolbarmenu.selectable li a { 
    15781580        padding-left: 30px; 
     1581} 
     1582 
     1583ul.toolbarmenu.selectable li a.selected { 
     1584        background: url(images/messages.png) 4px -27px no-repeat; 
    15791585} 
    15801586 
  • skins/larry/templates/compose.html

    r6357223 r4be86f3  
    44<title><roundcube:object name="pagetitle" /></title> 
    55<roundcube:include file="/includes/links.html" /> 
     6<roundcube:if condition="config:enable_spellcheck" /> 
    67<link rel="stylesheet" type="text/css" href="/googiespell.css" /> 
     8<roundcube:endif /> 
    79</head> 
    810<body class="noscroll"> 
     
    3941<div id="messagetoolbar" class="fullwidth"> 
    4042<div id="mailtoolbar" class="toolbar"> 
    41         <roundcube:button command="spellcheck" type="link" class="button spellcheck disabled" classAct="button spellcheck" classSel="button spellcheck pressed" label="spellcheck" title="checkspelling" /> 
     43        <roundcube:if condition="config:enable_spellcheck" /> 
     44        <span class="dropbutton"> 
     45                <roundcube:button command="spellcheck" type="link" class="button spellcheck disabled" classAct="button spellcheck" classSel="button spellcheck pressed" label="spellcheck" title="checkspelling" /> 
     46                <span class="dropbuttontip" id="spellmenulink" onclick="UI.show_popup('spellmenu');return false"></span> 
     47        </span> 
     48        <roundcube:endif /> 
    4249        <roundcube:button name="addattachment" type="link" class="button attach" classAct="button attach" classSel="button attach pressed" label="attach" title="addattachment" onclick="UI.show_uploadform();return false" /> 
    4350        <roundcube:button command="insert-sig" type="link" class="button insertsig disabled" classAct="button insertsig" classSel="button insertsig pressed" label="signature" title="insertsignature" /> 
     
    143150<div id="composeview-bottom"> 
    144151        <div id="composebodycontainer"> 
    145                 <div id="spellcheck-control"></div> 
    146152                <roundcube:object name="composeBody" id="composebody" form="form" cols="70" rows="20" tabindex="9" /> 
    147153        </div> 
     
    172178</div> 
    173179 
     180<div id="spellmenu" class="popupmenu"></div> 
     181 
    174182<roundcube:include file="/includes/footer.html" /> 
    175183 
  • skins/larry/ui.js

    refaf2e0 r4be86f3  
    2525    mailboxmenu:        { above:1 }, 
    2626    composeoptionsmenu: { editable:1, overlap:1 }, 
     27    spellmenu:          { callback: spellmenu }, 
    2728    // toggle: #1486823, #1486930 
    2829    'attachment-form':  { editable:1, above:1, toggle:!bw.ie&&!bw.linux }, 
     
    339340    bottom.css('height', (form.height() - bottom.position().top) + 'px'); 
    340341 
    341     w = body.parent().width() - 6; 
    342     h = body.parent().height() - 36; 
     342    w = body.parent().width() - 5; 
     343    h = body.parent().height() - 16; 
    343344    body.width(w).height(h); 
    344345 
    345346    if (window.tinyMCE && tinyMCE.get('composebody')) { 
    346       $('#composebody_tbl').width((w+10)+'px').height('').css('margin-top', '1px'); 
    347       $('#composebody_ifr').width((w+10)+'px').height((h-22)+'px'); 
     347      $('#composebody_tbl').width((w+8)+'px').height('').css('margin-top', '1px'); 
     348      $('#composebody_ifr').width((w+8)+'px').height((h-40)+'px'); 
    348349    } 
    349350    else { 
     
    426427      $('select', obj).css('visibility', 'inherit'); 
    427428    } 
    428      
     429 
    429430    return show; 
    430431  } 
     
    552553      } 
    553554    } 
     555  } 
     556 
     557 
     558  function spellmenu(show) 
     559  { 
     560    var link, li, 
     561      lang = rcmail.spellcheck_lang(), 
     562      menu = popups.spellmenu, 
     563      ul = $('ul', menu); 
     564 
     565    if (!ul.length) { 
     566      ul = $('<ul class="toolbarmenu selectable">'); 
     567 
     568      for (i in rcmail.env.spell_langs) { 
     569        li = $('<li>'); 
     570        link = $('<a href="#">').text(rcmail.env.spell_langs[i]) 
     571          .addClass('active').data('lang', i) 
     572          .click(function() { 
     573            rcmail.spellcheck_lang_set($(this).data('lang')); 
     574          }); 
     575 
     576        link.appendTo(li); 
     577        li.appendTo(ul); 
     578      } 
     579 
     580      ul.appendTo(menu); 
     581    } 
     582 
     583    // select current language 
     584    $('li', ul).each(function() { 
     585      var el = $('a', this); 
     586      if (el.data('lang') == lang) 
     587        el.addClass('selected'); 
     588      else if (el.hasClass('selected')) 
     589        el.removeClass('selected'); 
     590    }); 
    554591  } 
    555592 
Note: See TracChangeset for help on using the changeset viewer.