Changeset 3bd94b1 in github


Ignore:
Timestamp:
Sep 14, 2008 4:34:11 AM (5 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
108d3b0
Parents:
14c5b8e
Message:
Location:
program
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    ra980cb8 r3bd94b1  
    36493649    { 
    36503650    var ischecked = checkbox.checked; 
     3651    var composeElement = document.getElementById(textAreaId); 
     3652     
    36513653    if (ischecked) 
    36523654      { 
    3653         tinyMCE.execCommand('mceAddControl', true, textAreaId); 
     3655      var existingPlainText = composeElement.value; 
     3656      var htmlText = "<pre>" + existingPlainText + "</pre>"; 
     3657      composeElement.value = htmlText; 
     3658      tinyMCE.execCommand('mceAddControl', true, textAreaId); 
    36543659      } 
    36553660    else 
    36563661      { 
    3657         tinyMCE.execCommand('mceRemoveControl', true, textAreaId); 
     3662      var thisMCE = tinyMCE.get(textAreaId); 
     3663      var existingHtml = thisMCE.getContent(); 
     3664      this.html2plain(existingHtml, textAreaId); 
     3665      tinyMCE.execCommand('mceRemoveControl', true, textAreaId); 
    36583666      } 
    36593667    }; 
     
    37153723    this.gui_objects.all_headers_row.style.display = 'none'; 
    37163724    elem.onclick = function() { rcmail.load_headers(elem); } 
     3725    } 
     3726 
     3727 
     3728  /********************************************************/ 
     3729  /*********  html to text conversion functions   *********/ 
     3730  /********************************************************/ 
     3731 
     3732  this.html2plain = function(htmlText, id) 
     3733    { 
     3734    var http_request = new rcube_http_request(); 
     3735    var url = this.env.bin_path+'html2text.php'; 
     3736    var rcmail = this; 
     3737 
     3738    this.set_busy(true, 'converting'); 
     3739    console.log('HTTP POST: '+url); 
     3740 
     3741    http_request.onerror = function(o) { rcmail.http_error(o); }; 
     3742    http_request.oncomplete = function(o) { rcmail.set_text_value(o, id); }; 
     3743    http_request.POST(url, htmlText, 'application/octet-stream'); 
     3744    } 
     3745 
     3746  this.set_text_value = function(httpRequest, id) 
     3747    { 
     3748    this.set_busy(false); 
     3749    document.getElementById(id).value = httpRequest.get_text(); 
     3750    console.log(httpRequest.get_text()); 
     3751    } 
     3752 
     3753  this.handle_conv_error = function(httpRequest) 
     3754    { 
     3755    alert('html2text request returned with error ' + httpRequest.xmlhttp.status); 
    37173756    } 
    37183757 
  • program/js/editor.js

    r4ca10b8 r3bd94b1  
    5656 
    5757  // do the appropriate conversion 
    58  
    59   var composeElement = document.getElementById('compose-body'); 
    60  
    6158  if (selectedEditor == 'html') 
    6259    { 
    63     var existingPlainText = composeElement.value; 
    64     var htmlText = "<pre>" + existingPlainText + "</pre>"; 
     60    var composeElement = document.getElementById('compose-body'); 
     61    var htmlText = "<pre>" + composeElement.value + "</pre>"; 
    6562    composeElement.value = htmlText; 
    6663    tinyMCE.execCommand('mceAddControl', true, 'compose-body'); 
     
    7067  else 
    7168    { 
    72     rcmail.set_busy(true, 'converting'); 
    7369    var thisMCE = tinyMCE.get('compose-body'); 
    7470    var existingHtml = thisMCE.getContent(); 
    75     rcmail_html2plain(existingHtml); 
     71    rcmail.html2plain(existingHtml, 'compose-body'); 
    7672    tinyMCE.execCommand('mceRemoveControl', true, 'compose-body'); 
    7773    htmlFlag.value = "0"; 
     
    7975    } 
    8076  } 
    81  
    82 function rcmail_html2plain(htmlText) 
    83   { 
    84   var http_request = new rcube_http_request(); 
    85  
    86   http_request.onerror = function(o) { rcmail_handle_toggle_error(o); }; 
    87   http_request.oncomplete = function(o) { rcmail_set_text_value(o); }; 
    88   var url = rcmail.env.bin_path+'html2text.php'; 
    89   //console.log('HTTP request: ' + url); 
    90   http_request.POST(url, htmlText, 'application/octet-stream'); 
    91   } 
    92  
    93 function rcmail_set_text_value(httpRequest) 
    94   { 
    95   rcmail.set_busy(false); 
    96   var composeElement = document.getElementById('compose-body'); 
    97   composeElement.value = httpRequest.get_text(); 
    98   } 
    99  
    100 function rcmail_handle_toggle_error(httpRequest) 
    101   { 
    102   alert('html2text request returned with error ' + httpRequest.xmlhttp.status); 
    103   } 
  • program/localization/en_GB/messages.inc

    r9a5762a r3bd94b1  
    6767$messages['folderdeleted'] = 'Folder successfully deleted'; 
    6868$messages['deletedsuccessfully'] = 'Successfully deleted'; 
    69 $messages['converting'] = 'Removing formatting from message...'; 
     69$messages['converting'] = 'Removing formatting...'; 
    7070$messages['messageopenerror'] = 'Could not load message from server'; 
    7171$messages['fileuploaderror'] = 'File upload failed'; 
  • program/localization/en_US/messages.inc

    red132ed r3bd94b1  
    6767$messages['folderdeleted'] = 'Folder successfully deleted'; 
    6868$messages['deletedsuccessfully'] = "Successfully deleted"; 
    69 $messages['converting'] = 'Removing formatting from message...'; 
     69$messages['converting'] = 'Removing formatting...'; 
    7070$messages['messageopenerror'] = 'Could not load message from server'; 
    7171$messages['fileuploaderror'] = 'File upload failed'; 
  • program/localization/pl_PL/messages.inc

    r2a61274 r3bd94b1  
    9090$messages['folderdeleted'] = 'Folder został pomyślnie usunięty.'; 
    9191$messages['deletedsuccessfully'] = 'Usunięto'; 
    92 $messages['converting'] = 'Konwertowanie wiadomości...'; 
     92$messages['converting'] = 'Konwertowanie tekstu...'; 
    9393$messages['messageopenerror'] = 'Nie moÅŒna załadować wiadomości z serwera'; 
    9494$messages['fileuploaderror'] = 'ZałĠ
  • program/steps/settings/edit_identity.inc

    r000bb9a r3bd94b1  
    6161 
    6262  // add some labels to client 
    63   rcube_add_label('noemailwarning', 'nonamewarning'); 
     63  $OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting'); 
    6464 
    6565 
Note: See TracChangeset for help on using the changeset viewer.