Changeset 389 for trunk/expressoMail1_2


Ignore:
Timestamp:
08/14/08 11:15:07 (16 years ago)
Author:
niltonneto
Message:

Ver Tickets no Trac #286 e #287.
Inclusão de template de assinatura padrão.
Assinatura também disponível em formato de texto rico.
Inclusão da biblioteca FCKEditor.

Location:
trunk/expressoMail1_2
Files:
460 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/common_functions.js

    r381 r389  
    455455 
    456456function preferences_mail(){ 
    457         connector.loadScript("preferences"); 
    458         prefe.showList(); 
     457        if(preferences.type_signature && preferences.type_signature == 'html') { 
     458                location.href="preferences.php"; 
     459        } 
     460        else { 
     461                connector.loadScript("preferences"); 
     462                prefe.showList(); 
     463        } 
    459464} 
    460465 
  • trunk/expressoMail1_2/js/main.js

    r352 r389  
    509509                data.date_hour = Element('date_hour_' + border_ID).value; 
    510510        } 
    511          
     511        var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>"); 
    512512        switch(type){ 
    513513                case "reply_without_history":                    
     
    519519                        // Insert the signature automaticaly at message body if use_signature preference is set 
    520520                        if (preferences.use_signature == "1"){  
    521                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>"); 
     521                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); 
    522522                        } 
    523523                        else{  
     
    548548                        // Insert the signature automaticaly at message body if use_signature preference is set 
    549549                        if (preferences.use_signature == "1") { 
    550                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>" + block_quoted_body + "</body></html>"); 
     550                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>"); 
    551551                        } 
    552552                        else { 
     
    593593                        // Insert the signature automaticaly at message body if use_signature preference is set 
    594594                        if (preferences.use_signature == "1") { 
    595                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>"); 
     595                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); 
    596596                        } 
    597597                        else { 
     
    638638                        // Insert the signature automaticaly at message body if use_signature preference is set 
    639639                        if (preferences.use_signature == "1") { 
    640                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>" + block_quoted_body + "</body></html>"); 
     640                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>"); 
    641641                        } 
    642642                        else { 
     
    686686                        // Insert the signature automaticaly at message body if use_signature preference is set 
    687687                        if (preferences.use_signature == "1") { 
    688                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>" + make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc) + "</body></html>"); 
     688                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc) + "</body></html>"); 
    689689                        } 
    690690                        else { 
     
    719719                        // Insert the signature automaticaly at message body if use_signature preference is set 
    720720                        if (preferences.use_signature == "1") { 
    721                                 body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + preferences.signature.replace(/\n/g, "<br>") + "</body></html>"); 
     721                                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); 
    722722                        } 
    723723                        else { 
  • trunk/expressoMail1_2/js/rich_text_editor.js

    r351 r389  
    207207                var mainField = document.getElementById(this.editor).contentWindow; 
    208208                mainField.focus(); 
     209                var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>"); 
    209210                if (command == 'signature'){ 
    210211                        if (is_ie){ 
     
    214215                                    var rng = sel.createRange(); 
    215216                                    if (rng!=null) 
    216                                 rng.pasteHTML(preferences.signature.replace(/\n/g, "<br>")); 
     217                                        rng.pasteHTML(signature); 
    217218                                } 
    218219                        } 
    219220                        else{ 
    220                                 mainField.document.execCommand('inserthtml', false, preferences.signature.replace(/\n/g, "<br>")); 
     221                                mainField.document.execCommand('inserthtml', false, signature); 
    221222                        } 
    222223                } 
  • trunk/expressoMail1_2/preferences.php

    r385 r389  
    99        ); 
    1010 
     11         
    1112        include('../header.inc.php'); 
    12         include('inc/class.imap_functions.inc.php'); 
     13        include('inc/class.imap_functions.inc.php');     
     14        include_once("inc/fckeditor.php"); 
    1315         
    1416        if (!$_POST['try_saved']) 
     
    6971                else 
    7072                        $GLOBALS['phpgw']->template->set_var('text_signature',''); 
    71  
     73                 
     74                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature']){ 
     75                        $GLOBALS['phpgw']->template->set_var('type_signature_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'].'_selected','selected'); 
     76                        $GLOBALS['phpgw']->template->set_var('type_signature_td_'.($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'] == 'html' ? 'text' : 'html'),'display:none'); 
     77                } 
     78                else{ 
     79                        $GLOBALS['phpgw']->template->set_var('type_signature_option_text_selected','selected'); 
     80                        $GLOBALS['phpgw']->template->set_var('type_signature_td_html','display:none'); 
     81                } 
     82 
     83                // BEGIN FCKEDITOR 
     84                $oFCKeditor = new FCKeditor('html_signature') ; 
     85                $oFCKeditor->BasePath   = 'js/fckeditor/'; 
     86                $oFCKeditor->ToolbarSet = 'ExpressoLivre'; 
     87                if(is_array($GLOBALS['phpgw_info']['user']['preferences']['expressoMail'])) { 
     88                        $oFCKeditor->Value      = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature']; 
     89                } 
     90                // First Time: The user has no preferences. If the template file exists, then it loads a default signature. 
     91                // See signature_example.tpl 
     92                elseif(file_exists($GLOBALS['phpgw']->template->root.'/signature.tpl')){ 
     93                        $filein = fopen($GLOBALS['phpgw']->template->root.'/signature.tpl',"r"); 
     94                        while (!feof ($filein)) 
     95                                $oFCKeditor->Value .= fgets($filein, 1024);  
     96                } 
     97                $oFCKeditor->Value = str_replace("{full_name}",$phpgw_info['user']['fullname'],$oFCKeditor->Value); 
     98                $oFCKeditor->Value = str_replace("{first_name}",$phpgw_info['user']['firstname'],$oFCKeditor->Value); 
     99                 
     100                $GLOBALS['phpgw']->template->set_var('rtf_signature',$oFCKeditor->Create()); 
     101                $GLOBALS['phpgw']->template->set_var('text_signature',strip_tags($oFCKeditor->Value)); 
     102                // END FCKEDITOR 
    72103                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders']) 
    73104                        $GLOBALS['phpgw']->template->set_var('checked_menu','checked'); 
     
    138169                else 
    139170                        $GLOBALS['phpgw']->preferences->add('expressoMail','signature',$_POST['signature']); 
     171 
     172                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature']) 
     173                        $GLOBALS['phpgw']->preferences->change('expressoMail','type_signature',$_POST['type_signature']); 
     174                else 
     175                        $GLOBALS['phpgw']->preferences->add('expressoMail','type_signature',$_POST['type_signature']); 
    140176 
    141177                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders']) 
     
    196232        $GLOBALS['phpgw']->template->set_var('medium',lang('Medium')); 
    197233        $GLOBALS['phpgw']->template->set_var('normal',lang('Normal')); 
     234        $GLOBALS['phpgw']->template->set_var('simple_text',lang('Simple Text')); 
     235        $GLOBALS['phpgw']->template->set_var('html_text',lang('Rich Text')); 
     236        $GLOBALS['phpgw']->template->set_var('lang_config_signature',lang('Signature Configuration')); 
     237        $GLOBALS['phpgw']->template->set_var('lang_type_signature',lang('Signature type')); 
    198238        $GLOBALS['phpgw']->template->set_var('big',lang('Big')); 
    199239        $GLOBALS['phpgw']->template->set_var('lang_use_signature',lang('Insert signature automatically in new messages?')); 
    200         $GLOBALS['phpgw']->template->set_var('lang_signature',lang('Signature')); 
    201240 
    202241        $boemailadmin   = CreateObject('emailadmin.bo'); 
  • trunk/expressoMail1_2/templates/default/preferences.tpl

    r325 r389  
    22<center> 
    33 
    4 <table width="50%" border="0" cellspacing="2" cellpadding="2"> 
     4<table width="65%" border="0" cellspacing="2" cellpadding="2"> 
    55 
    6 <form method="POST" action="{save_action}"> 
     6<form  method="POST" action="{save_action}" onSubmit="selectValues()"> 
    77<input type="hidden" name="try_saved" value="false"> 
    8  
    98    <tr bgcolor="{th_bg}"> 
    109        <td colspan="2" align="center">{lang_config_expressoMail}</td> 
     
    9998    </tr> 
    10099 
    101     <tr bgcolor="{tr_color1}"> 
     100    <tr bgcolor="{tr_color2}"> 
    102101        <td> 
    103102                        {lang_auto_save_draft} 
     
    107106                </td> 
    108107    </tr> 
    109  
     108    <tr bgcolor="{th_bg}"> 
     109        <td colspan="2" align="center">{lang_config_signature}</td> 
     110    </tr> 
    110111     <tr bgcolor="{tr_color1}"> 
    111112        <td> 
     
    116117                </td> 
    117118    </tr> 
    118  
    119119    <tr bgcolor="{tr_color2}"> 
    120         <td colspan='2'> 
    121                         {lang_signature}<BR> 
    122                         <textarea name="signature" rows=4 cols=50>{text_signature}</textarea> 
     120        <td valign="center"> 
     121                        {lang_type_signature} 
     122        </td> 
     123        <td align="center"> 
     124                        <select id="type_signature" name="type_signature" onChange="javascript:changeTypeSignature(this.value)"> 
     125                                <option {type_signature_option_text_selected} value="text">{simple_text}</option> 
     126                                <option {type_signature_option_html_selected} value="html">{html_text}</option> 
     127                        </select> 
     128                </td> 
     129    </tr> 
     130    <tr bgcolor="{tr_color2}"> 
     131        <td colspan='2' valign="center" id="td_html_signature" style="{type_signature_td_html}"> 
     132                        {rtf_signature} 
    123133        </td> 
    124134    </tr> 
    125  
     135     <tr bgcolor="{tr_color2}"> 
     136        <td colspan='2' align="center" id="td_text_signature"  style="{type_signature_td_text}"> 
     137                        <textarea name='text_signature' rows='4' cols='70'>{text_signature}</textarea> 
     138        </td> 
     139    </tr> 
    126140    <tr bgcolor="{th_bg}"> 
    127141        <td colspan="2" > 
     
    140154</table> 
    141155</center> 
     156<script language="JavaScript" type="text/javascript"> 
     157        var form =      document.forms[0]; 
     158 
     159        function selectValues(){ 
     160                var signature = eval("form."+form.type_signature.value+"_signature"); 
     161                signature.name = "signature"; 
     162                return true; 
     163        }        
     164 
     165        function changeTypeSignature(value){ 
     166                var html_signature = FCKeditorAPI.GetInstance("html_signature"); 
     167 
     168                if(value == 'text'){ 
     169                        form.text_signature.value = html_signature.GetHTML(); 
     170                        document.getElementById("td_text_signature").style.display = ''; 
     171                        document.getElementById("td_html_signature").style.display = 'none'; 
     172                } 
     173                else if(value == 'html'){ 
     174                        html_signature.SetHTML(form.text_signature.value); 
     175                        document.getElementById("td_text_signature").style.display = 'none'; 
     176                        document.getElementById("td_html_signature").style.display  = ''; 
     177                } 
     178                 
     179        } 
     180</script>   
Note: See TracChangeset for help on using the changeset viewer.