Changeset 4828 for trunk/expressoMail1_2
- Timestamp:
- 07/19/11 16:54:27 (13 years ago)
- Location:
- trunk/expressoMail1_2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/fckeditor.php
r1059 r4828 72 72 73 73 if ( $this->ToolbarSet != '' ) 74 $Link .= "& amp;Toolbar={$this->ToolbarSet}" ;74 $Link .= "&Toolbar={$this->ToolbarSet}" ; 75 75 76 76 // Render the linked hidden field. … … 105 105 function IsCompatible() 106 106 { 107 global $HTTP_USER_AGENT ; 108 109 if ( isset( $HTTP_USER_AGENT ) ) 110 $sAgent = $HTTP_USER_AGENT ; 111 else 112 $sAgent = $_SERVER['HTTP_USER_AGENT'] ; 113 114 if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false ) 115 { 116 $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ; 117 return ($iVersion >= 5.5) ; 118 } 119 else if ( strpos($sAgent, 'Gecko/') !== false ) 120 { 121 $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ; 122 return ($iVersion >= 20030210) ; 123 } 124 else 125 return false ; 107 // global $HTTP_USER_AGENT ; 108 // 109 // if ( isset( $HTTP_USER_AGENT ) ) 110 // $sAgent = $HTTP_USER_AGENT ; 111 // else 112 // $sAgent = $_SERVER['HTTP_USER_AGENT'] ; 113 // 114 // if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false ) 115 // { 116 // $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ; 117 // return ($iVersion >= 5.5) ; 118 // } 119 // else if ( strpos($sAgent, 'Gecko/') !== false ) 120 // { 121 // $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ; 122 // return ($iVersion >= 20030210) ; 123 // } 124 // else 125 // return false ; 126 return( true ); 126 127 } 127 128 … … 149 150 } 150 151 152 // function getConfigFieldString() 153 // { 154 // $sParams = array(); 155 // 156 // foreach( $this->Config as $sKey => $sValue ) 157 // $sParams[] = $this->EncodeConfig( $sKey ).'='.$this->EncodeConfig( $sValue ); 158 // 159 // return implode( '&', $sParams ); 160 // } 161 162 151 163 function EncodeConfig( $valueToEncode ) 152 164 { -
trunk/expressoMail1_2/inc/hook_settings.inc.php
r4726 r4828 19 19 * option) any later version. * 20 20 \**************************************************************************/ 21 include_once("fckeditor.php"); 22 include_once("class.functions.inc.php"); 23 $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME 21 22 $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME 24 23 25 24 //if ($type == 'user' || $type == ''){ … … 27 26 { 28 27 var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; 29 var use_signature_digital_cripto = null; 30 31 if (document.all) 32 { 33 // is_ie 34 use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[1]; 35 } 36 else 37 { 38 // not_ie 39 use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; 40 } 41 28 var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; 42 29 var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'"; 43 30 … … 72 59 } 73 60 61 } 62 function validateSignature() 63 { 64 var sigs_len = parseInt( document.getElementById("counter").value ); 65 66 var signatures = {}, types = {}, noSig = true; 67 68 var default_signature = "", errors = false; 69 70 for( var i = 0; i < sigs_len; i++ ) 71 { 72 if( !document.getElementById( "_signature" + i ) ) continue; 73 74 var key = document.getElementById( "title_signature" + i ).value; 75 var edit = !!document.getElementById( "edit_signature" + i ).checked; 76 77 var value = edit ? tinyMCE.get( "user_signature" + i ).getContent() : 78 document.getElementById( "user_signature" + i ).value; 79 80 if( !value ) 81 continue; 82 83 if( !key ) 84 { 85 alert( "Titulo da assinatura nao pode ser em branco." ); 86 return( false ); 87 } 88 89 var openTags = value.match(/<[a-z][^&>]*>/g); 90 var closedTags = value.match(/<[/][^&>]*>/g); 91 var oclosedTags = value.match(/[a-z]*[^&<>]* [/]>/g); 92 93 if( ( openTags || [] ).length !== (( closedTags || [] ).length + ( oclosedTags || [] ).length )) 94 { 95 errors = errors || []; 96 errors.push( key ); 97 } 98 99 if( errors ) 100 continue; 101 102 if( document.getElementById( "default_signature" + i ).checked ) 103 default_signature = key; 104 105 signatures[key] = value; 106 107 if( edit ) 108 types[key] = edit; 109 110 if( noSig ) 111 noSig = false; 112 } 113 114 if( errors ){ 115 116 alert( "Há erros de html na(s) assinatura(s) \'" + errors.join("\',\'") + "\'.\\nRevise a informação inserida (somente no modo Texto Simples ou visulização do Código-Fonte, no modo Texto Rico).\\nPossivelmente você copiou e colou sua assinatura de outro software. Para evitar erros, recomendamos utilizar apenas o editor Texto Rico do Expresso." ); 117 return( false ); 118 } 119 120 if( !default_signature ){ 121 122 if( !noSig ) 123 { 124 alert( "Favor selecionar uma assinatura padrao." ); 125 return( false ); 126 } 127 128 document.getElementById( "signature_default" ).value = ""; 129 document.getElementById( "signature" ).value = ""; 130 } 131 else 132 { 133 document.getElementById( "signature_default" ).value = default_signature; 134 document.getElementById( "signature" ).value = types[key] ? signatures[default_signature] : 135 signatures[default_signature].replace( /\\n/g, "<br>" ); 136 } 137 138 document.getElementById( "signatures" ).value = toJSON( signatures ); 139 document.getElementById( "signature_types" ).value = toJSON( types ); 140 141 return( true ); 142 } 143 function fromJSON( value ) 144 { 145 return (new Function( "return " + decode64( value )))(); 146 } 147 148 function toJSON( value ) 149 { 150 var json = []; 151 152 for( var key in value ) 153 json.push( \'"\' + key + \'":"\' + escape( value[key] ) + \'"\' ); 154 155 return encode64( "{" + json.join( "," ) + "}" ); 156 } 157 158 // This code was written by Tyler Akins and has been placed in the 159 // public domain. It would be nice if you left this header intact. 160 // Base64 code from Tyler Akins -- http://rumkin.com 161 162 var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 163 164 function encode64(input) { 165 var output = new StringMaker(); 166 var chr1, chr2, chr3; 167 var enc1, enc2, enc3, enc4; 168 var i = 0; 169 170 while (i < input.length) { 171 chr1 = input.charCodeAt(i++); 172 chr2 = input.charCodeAt(i++); 173 chr3 = input.charCodeAt(i++); 174 175 enc1 = chr1 >> 2; 176 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 177 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); 178 enc4 = chr3 & 63; 179 180 if (isNaN(chr2)) { 181 enc3 = enc4 = 64; 182 } else if (isNaN(chr3)) { 183 enc4 = 64; 184 } 185 186 output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)); 187 } 188 189 return output.toString(); 190 } 191 var ua = navigator.userAgent.toLowerCase(); 192 if (ua.indexOf(" chrome/") >= 0 || ua.indexOf(" firefox/") >= 0 || ua.indexOf(" gecko/") >= 0) { 193 var StringMaker = function () { 194 this.str = ""; 195 this.length = 0; 196 this.append = function (s) { 197 this.str += s; 198 this.length += s.length; 199 } 200 this.prepend = function (s) { 201 this.str = s + this.str; 202 this.length += s.length; 203 } 204 this.toString = function () { 205 return this.str; 206 } 207 } 208 } else { 209 var StringMaker = function () { 210 this.parts = []; 211 this.length = 0; 212 this.append = function (s) { 213 this.parts.push(s); 214 this.length += s.length; 215 } 216 this.prepend = function (s) { 217 this.parts.unshift(s); 218 this.length += s.length; 219 } 220 this.toString = function () { 221 return this.parts.join(""); 222 } 223 } 224 } 225 function decode64(input) { 226 var output = new StringMaker(); 227 var chr1, chr2, chr3; 228 var enc1, enc2, enc3, enc4; 229 var i = 0; 230 231 // remove all characters that are not A-Z, a-z, 0-9, +, /, or = 232 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 233 234 while (i < input.length) { 235 enc1 = keyStr.indexOf(input.charAt(i++)); 236 enc2 = keyStr.indexOf(input.charAt(i++)); 237 enc3 = keyStr.indexOf(input.charAt(i++)); 238 enc4 = keyStr.indexOf(input.charAt(i++)); 239 240 chr1 = (enc1 << 2) | (enc2 >> 4); 241 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 242 chr3 = ((enc3 & 3) << 6) | enc4; 243 244 output.append(String.fromCharCode(chr1)); 245 246 if (enc3 != 64) { 247 output.append(String.fromCharCode(chr2)); 248 } 249 if (enc4 != 64) { 250 output.append(String.fromCharCode(chr3)); 251 } 252 } 253 254 return output.toString(); 255 } 256 function loadSignature() 257 { 258 var types = fromJSON( document.getElementById( "signature_types" ).value ); 259 var signatures = fromJSON( document.getElementById( "signatures" ).value ); 260 var old_signature = document.getElementById( "signature" ).value; 261 var def = document.getElementById( "signature_default" ).value; 262 263 var counter = 0, ids = [], def_signature = "", noSig = true; 264 265 for( key in signatures ) 266 { 267 addSignature( !types || !types[key] ); 268 269 var value = unescape( signatures[key] ); 270 271 document.getElementById( "title_signature" + counter ).value = key; 272 document.getElementById( "user_signature" + counter ).value = value; 273 274 if( def === key ) 275 def_signature = counter; 276 277 if( noSig ) noSig = false; 278 279 counter++; 280 } 281 282 if( def_signature !== "" ) 283 document.getElementById( "default_signature" + def_signature ).checked = true; 284 else if( noSig && old_signature ) 285 { 286 addSignature( document.getElementById("type_signature").value !== "html" ); 287 document.getElementById( "user_signature" + counter ).value = old_signature; 288 } 74 289 }'); 75 290 //} 76 $default = false; 77 create_check_box('Do you want to show common name instead of UID?','uid2cn',$default, 78 'Do you want to show common name instead of UID?'); 79 create_check_box('Do you want to automatically display the message header?','show_head_msg_full',$default,''); 291 80 292 $default = array( 81 293 '25' => '25', … … 85 297 ); 86 298 299 // Cria nova opção nas preferências do ExpressoMail 300 create_check_box('View the user name in the header of the messages printed?', 'show_name_print_messages', 'Displays the user name in the header print email'); 301 87 302 create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default,'This is the number of messages shown in your mailbox per page'); 88 89 create_check_box('View the user name in the header of the messages printed?', 'show_name_print_messages', 'Displays the user name in the header print email');90 91 //$default = 0;92 create_check_box('Preview message text within subject column','preview_msg_subject','this exhibits a sample of message within the message subject column');93 94 //$default = 0;95 create_check_box('Preview message text within a tool-tip box','preview_msg_tip','this exhibits a sample of message within a tool-tip box');96 97 create_check_box('View extended information about users','extended_info','This exhibits employeenumber and ou from LDAP in searchs');98 99 303 create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder'); 100 304 $default = array( … … 106 310 ); 107 311 108 $arquived_messages = array(true => lang("Copy"), false => lang("Move"));109 110 312 create_select_box('Delete trash messages after how many days?','delete_trash_messages_after_n_days',$default,'Delete automatically the messages in trash folder in how many days'); 111 313 create_check_box('Would you like to use local messages?','use_local_messages','Enabling this options you will be able to store messages in your local computer'); 112 create_select_box('Desired action to archive messages to local folders','keep_archived_messages',$arquived_messages,'After store email in your local computer delete it from server'); 113 create_check_box('Automaticaly create Default local folders?','auto_create_local','Enable this option if you want to automaticaly create the Inbox, Draft, Trash and Sent folders'); 314 create_check_box('Would you like to keep archived messages?','keep_archived_messages','After store email in your local computer delete it from server'); 114 315 create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message','Enable this option if you want to read the next message everytime you delete a message'); 115 316 create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed'); … … 117 318 create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages'); 118 319 create_check_box('Do you want to use important flag in email editor?','use_important_flag','It allow you to send emails with important flag, but you can receive unwanted messages with important flag'); 119 create_check_box('Do you want to use SpellChecker in email editor?','use_SpellChecker','It allow you to check the spelling of your emails'); 320 120 321 //Use user folders from email 121 322 if ($type != "" && $type != "user"){ 323 $trash = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']; 324 $drafts = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; 325 $spam = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']; 326 $sent = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']; 327 $delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']; 328 $default = Array( 329 'INBOX' => lang('INBOX'), 330 'INBOX'.$delimiter.$trash => $trash, 331 'INBOX'.$delimiter.$drafts => $drafts, 332 'INBOX'.$delimiter.$spam => $spam, 333 'INBOX'.$delimiter.$sent => $sent 334 ); 335 } 336 else 337 { 122 338 require_once('class.imap_functions.inc.php'); 123 339 $boemailadmin = CreateObject('emailadmin.bo'); … … 127 343 $e_server = $_SESSION['phpgw_info']['expressomail']['email_server']; 128 344 $imap = CreateObject('expressoMail1_2.imap_functions'); 129 130 if ($type != "" && $type != "user"){131 132 $trash = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'];133 $drafts = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'];134 $spam = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'];135 $sent = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'];136 $delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'];137 $default = Array(138 'INBOX' => lang('INBOX'),139 'INBOX' . $imap->imap_delimiter . $drafts => lang($drafts),140 'INBOX' . $imap->imap_delimiter . $spam => lang($spam),141 'INBOX' . $imap->imap_delimiter . $trash => lang($trash),142 'INBOX' . $imap->imap_delimiter . $sent => lang($sent)143 );144 }145 else146 {147 345 $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; 148 346 … … 180 378 } 181 379 create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder'); 182 create_check_box('Show TO: in place of FROM: only in Automatic SEND folder','from_to_sent','Show TO: in place of FROM: only in Automatic SEND folder');183 184 185 380 create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution'); 186 381 187 188 $default = array( 189 '50' => '50', 190 '100' => '100', 191 '150' => '150', 192 '200' => '200', 193 '300' => '300', 194 '400' => '400', 195 '65536' => lang('unlimited') 382 $default = array( 383 '20' => lang('normal'), 384 '30' => lang('medium'), 385 '40' => lang('big') 196 386 ); 197 387 198 create_select_box('What is the maximum number of results in an e-mail search?','search_result_number',$default,'');199 200 $default = array(201 '1' => lang('unlimited'),202 '2' => '2',203 '3' => '3',204 '4' => '4',205 '5' => '5'206 );207 208 create_select_box('What is the minimum number of characters in searching contacts?','search_characters_number',$default,'what is the minimum number of characters in searching contacts');209 210 $default = array(211 '20' => lang('normal'),212 '30' => lang('medium'),213 '40' => lang('big')214 );215 216 217 388 create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); 218 create_check_box('Increases th maximum size of show messages?','max_msg_size','Increases the maximum size of show emails from 100kb to 1mb');219 389 create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts'); 220 create_check_box('Use shortcuts?','use_shortcuts',' n key (Open new message)<br>ESC key (Close tab)<br>i key (print)<br>e key (forward)<br>r key (reply)<br>DELETE key (delete the current message)<br>Ctrl + up (go to previous message)<br>Ctrl + down (go to next message)<br>Shift + up or down (select multiple messages)<br>F9 key (search at catalog)<br>');390 create_check_box('Use shortcuts?','use_shortcuts',''); 221 391 create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); 222 create_check_box('Send messages with return recipient option by default','return_recipient_deafault','With this option every new email will get the return recipient option marked');223 224 unset($default);225 $functions = new functions();226 $zones = $functions->getTimezones();227 $default = array(sprintf("%s", array_search('America/Sao_Paulo', $zones)) => 'America/Sao_Paulo');228 create_select_box('What is your timezone?', 'timezone', $zones, 'The Timezone you\'re in.', $default);229 230 $default = array(231 '1' => lang('contacts'),232 '2' => lang('email')233 );234 235 create_select_box('Where should the quick search be performed by default?','quick_search_default',$default,'It is where the keyword should be searched when the user executes a quick search.');236 237 392 $default = array( 238 393 '65536' => lang('unlimited'), … … 265 420 'html' => lang('rich text') 266 421 ); 267 create_check_box('Auto close the first tab on reaching the maximum number of tabs?','auto_close_first_tab','');268 422 create_check_box('Insert signature automatically in new messages?','use_signature',''); 269 create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);" onload="javascript:alert(this.value);"');270 423 271 424 if ($type == 'user' || $type == ''){ 272 $oFCKeditor = new FCKeditor('html_signature'); 273 $oFCKeditor->BasePath = '../expressoMail1_2/js/fckeditor/'; 274 $oFCKeditor->ToolbarSet = 'ExpressoLivre'; 275 276 $vars = $GLOBALS['phpgw']->preferences->user[$appname]; 277 278 create_html_code("signature","<div id='text_signature'> 279 <textarea rows='5' cols='50' id='user_signature' name='user[signature]'>","</textarea></div> 280 <div style='display:none;' id='html_signature'>".$oFCKeditor->Create()."</div> 281 <script language='javascript'> 282 //document.getElementById('user_signature').value = '".$vars['signature']."'; 283 function changeType(value){ 284 var html_signature = FCKeditorAPI.GetInstance(\"html_signature\"); 285 value=value.replace('d',''); 286 if(value == 'text'){ 287 document.getElementById('user_signature').value = html_signature.GetHTML(); 288 document.getElementById(\"text_signature\").style.display = ''; 289 document.getElementById(\"html_signature\").style.display = 'none'; 425 426 global $prefs; 427 // create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);"'); 428 429 $vars = $GLOBALS['phpgw']->preferences->user['expressoMail']; 430 431 create_html_code("signature","<script src='../library/jquery/jquery-1.6.1.min.js' language='javascript'></script><script src='../library/tiny_mce/jquery.tinymce.js' language='javascript'></script><script src='../library/tiny_mce/tiny_mce.js' language='javascript'></script> 432 <input type='hidden' id='counter' value='0'> 433 <input type='hidden' id='signatures' name='user[signatures]' value='". $vars['signatures']."'> 434 <input type='hidden' id='signature_default' name='user[signature_default]' value='".$vars['signature_default']."'> 435 <input type='hidden' id='type_signature' name='user[type_signature]' value='".$vars['type_signature']."'> 436 <input type='hidden' id='signature' name='user[signature]' value='","' > 437 <input type='hidden' id='signature_types' name='user[signature_types]' value='".$vars['signature_types']."'> 438 439 <div id='_signature' name='signature' style='display: none;'> 440 <div id='options_signature'> 441 <input id='edit_signature' type='checkbox' name='isEditor' onclick='changeType( \"\", this.id.replace( /[^0-9]*/gi, \"\" ) );' checked='checked'><label for='isEditor'>Editor de texto</label> titulo da assinatura <input type='text' id='title_signature'> <input type='radio' id='default_signature' name='signature_default'><label>Usar como padrao</label><a href='#' onclick='javascript: return removeSignature( this );' id='remove_signature'> remover</a> 442 </div><br/> 443 <div id='text_signature'> 444 <textarea rows='5' cols='50' id='user_signature' class='editor'></textarea></div> 445 </div> 446 447 <script language='javascript'> 448 449 $(document).ready(function(){ 450 451 loadSignature(); 452 453 }); 454 455 function changeType(value, target){ 456 457 tinyMCE.execCommand( 'mceToggleEditor', false, 'user_signature' + target ); 290 458 } 291 else if(value == 'html'){ 292 html_signature.SetHTML(document.getElementById('user_signature').value); 293 document.getElementById(\"text_signature\").style.display = 'none'; 294 document.getElementById(\"html_signature\").style.display = ''; 295 } 296 } 297 function get_html_translation_table(table, quote_style) { 298 // http://kevin.vanzonneveld.net 299 var entities = {}, hash_map = {}, decimal = 0, symbol = ''; 300 var constMappingTable = {}, constMappingQuoteStyle = {}; 301 var useTable = {}, useQuoteStyle = {}; 302 // Translate arguments 303 constMappingTable[0] = 'HTML_SPECIALCHARS'; 304 constMappingTable[1] = 'HTML_ENTITIES'; 305 constMappingQuoteStyle[0] = 'ENT_NOQUOTES'; 306 constMappingQuoteStyle[2] = 'ENT_COMPAT'; 307 constMappingQuoteStyle[3] = 'ENT_QUOTES'; 308 309 useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS'; 310 useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; 311 312 if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') { 313 throw new Error(\"Table: \"+useTable+' not supported'); 314 // return false; 315 } 316 317 entities['38'] = '&'; 318 if (useTable === 'HTML_ENTITIES') { 319 entities['160'] = ' '; 320 entities['161'] = '¡'; 321 entities['162'] = '¢'; 322 entities['163'] = '£'; 323 entities['164'] = '¤'; 324 entities['165'] = '¥'; 325 entities['166'] = '¦'; 326 entities['167'] = '§'; 327 entities['168'] = '¨'; 328 entities['169'] = '©'; 329 entities['170'] = 'ª'; 330 entities['171'] = '«'; 331 entities['172'] = '¬'; 332 entities['173'] = '­'; 333 entities['174'] = '®'; 334 entities['175'] = '¯'; 335 entities['176'] = '°'; 336 entities['177'] = '±'; 337 entities['178'] = '²'; 338 entities['179'] = '³'; 339 entities['180'] = '´'; 340 entities['181'] = 'µ'; 341 entities['182'] = '¶'; 342 entities['183'] = '·'; 343 entities['184'] = '¸'; 344 entities['185'] = '¹'; 345 entities['186'] = 'º'; 346 entities['187'] = '»'; 347 entities['188'] = '¼'; 348 entities['189'] = '½'; 349 entities['190'] = '¾'; 350 entities['191'] = '¿'; 351 entities['192'] = 'À'; 352 entities['193'] = 'Á'; 353 entities['194'] = 'Â'; 354 entities['195'] = 'Ã'; 355 entities['196'] = 'Ä'; 356 entities['197'] = 'Å'; 357 entities['198'] = 'Æ'; 358 entities['199'] = 'Ç'; 359 entities['200'] = 'È'; 360 entities['201'] = 'É'; 361 entities['202'] = 'Ê'; 362 entities['203'] = 'Ë'; 363 entities['204'] = 'Ì'; 364 entities['205'] = 'Í'; 365 entities['206'] = 'Î'; 366 entities['207'] = 'Ï'; 367 entities['208'] = 'Ð'; 368 entities['209'] = 'Ñ'; 369 entities['210'] = 'Ò'; 370 entities['211'] = 'Ó'; 371 entities['212'] = 'Ô'; 372 entities['213'] = 'Õ'; 373 entities['214'] = 'Ö'; 374 entities['215'] = '×'; 375 entities['216'] = 'Ø'; 376 entities['217'] = 'Ù'; 377 entities['218'] = 'Ú'; 378 entities['219'] = 'Û'; 379 entities['220'] = 'Ü'; 380 entities['221'] = 'Ý'; 381 entities['222'] = 'Þ'; 382 entities['223'] = 'ß'; 383 entities['224'] = 'à'; 384 entities['225'] = 'á'; 385 entities['226'] = 'â'; 386 entities['227'] = 'ã'; 387 entities['228'] = 'ä'; 388 entities['229'] = 'å'; 389 entities['230'] = 'æ'; 390 entities['231'] = 'ç'; 391 entities['232'] = 'è'; 392 entities['233'] = 'é'; 393 entities['234'] = 'ê'; 394 entities['235'] = 'ë'; 395 entities['236'] = 'ì'; 396 entities['237'] = 'í'; 397 entities['238'] = 'î'; 398 entities['239'] = 'ï'; 399 entities['240'] = 'ð'; 400 entities['241'] = 'ñ'; 401 entities['242'] = 'ò'; 402 entities['243'] = 'ó'; 403 entities['244'] = 'ô'; 404 entities['245'] = 'õ'; 405 entities['246'] = 'ö'; 406 entities['247'] = '÷'; 407 entities['248'] = 'ø'; 408 entities['249'] = 'ù'; 409 entities['250'] = 'ú'; 410 entities['251'] = 'û'; 411 entities['252'] = 'ü'; 412 entities['253'] = 'ý'; 413 entities['254'] = 'þ'; 414 entities['255'] = 'ÿ'; 415 } 416 if (useQuoteStyle !== 'ENT_NOQUOTES') { 417 entities['34'] = '"'; 418 } 419 if (useQuoteStyle === 'ENT_QUOTES') { 420 entities['39'] = '''; 421 } 422 entities['60'] = '<'; 423 entities['62'] = '>'; 424 425 // ascii decimals to real symbols 426 for (decimal in entities) { 427 symbol = String.fromCharCode(decimal); 428 hash_map[symbol] = entities[decimal]; 429 } 430 return hash_map; 431 } 432 function html_entity_decode( string, quote_style ) { 433 // http://kevin.vanzonneveld.net 434 var hash_map = {}, symbol = '', tmp_str = '', entity = ''; 435 tmp_str = string.toString(); 436 if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) { 437 return false; 438 } 439 for (symbol in hash_map) { 440 entity = hash_map[symbol]; 441 tmp_str = tmp_str.split(entity).join(symbol); 442 } 443 tmp_str = tmp_str.split(''').join(\"'\"); 444 return tmp_str; 445 } 446 447 function getTypeSignature() { 448 var elementoSelects = document.getElementsByTagName('select'); 449 450 if ( elementoSelects[18].name == \"user[type_signature]\" ) { 451 return elementoSelects[18]; 452 } 453 454 for(i=0;i<elementoSelects.length;i++){ 455 if( elementoSelects[i].name == \"user[type_signature]\" ){ 456 return elementoSelects[i]; 457 } 458 } 459 return null; 460 } 461 462 function config_form(pObj,pHandler) 463 { 464 pObj.onclick=function () { 465 if (getTypeSignature().value == \"html\" || getTypeSignature().value == \"htmld\") { 466 return pHandler(\"text\"); 467 } 468 }; 469 470 } 471 document.getElementById('user_signature').value=html_entity_decode(document.getElementById('user_signature').innerHTML); 472 473 function setDefaultTypeSignature() { 474 if(getTypeSignature()){ 475 getTypeSignature().options[0].value = '".$GLOBALS['phpgw']->preferences->default['expressoMail']['type_signature']."d'; 476 if(getTypeSignature().value.indexOf('html')!=-1){ 477 changeType(getTypeSignature().value); 478 } 479 }else{ 480 changeType('".$GLOBALS['phpgw']->preferences->forced['expressoMail']['type_signature']."'); 481 } 482 } 483 484 setTimeout('setDefaultTypeSignature();config_form(document.getElementsByName(\'submit\')[0],changeType);',2000); 485 </script>"); 459 460 // var counter = 0; 461 462 function addSignature( simple ) 463 { 464 var sig = document.getElementById('_signature').cloneNode( true ); 465 var counter = document.getElementById( 'counter' ).value; 466 467 sig.innerHTML = sig.innerHTML.replace( /_signature/g, '_signature' + counter ); 468 469 sig.id = '_signature' + counter; 470 sig.style.display = ''; 471 472 $( '#add_signature' ).before( sig ); 473 474 if( !simple ) 475 $( '#user_signature' + counter ).tinymce({ 476 plugins : 'paste', 477 theme_advanced_toolbar_location : 'top', 478 theme_advanced_toolbar_align : 'center', 479 entities: '', 480 entity_encoding: 'raw', 481 theme: 'advanced', 482 add_form_submit_trigger : false 483 }); 484 else 485 document.getElementById('edit_signature' + counter ).checked = ''; 486 487 document.getElementById( 'counter' ).value = ++counter; 488 } 489 490 function removeSignature( el ) 491 { 492 counter = el.id.replace( /[^0-9]*/gi, \"\" ); 493 494 el = document.getElementById( '_signature' + counter ); 495 el.parentNode.removeChild( el ); 496 497 return( false ); 498 } 499 </script> 500 <input id='add_signature' type='button' onclick='addSignature();' value='Adicionar Assinatura'> 501 "); 502 }else{ 503 create_select_box('Signature Type','type_signature',$default,'','','',''); 504 486 505 } 487 506 ?> -
trunk/expressoMail1_2/js/rich_text_editor.js
r4801 r4828 6 6 this.buildEditor(); 7 7 this.saveFlag = 0; 8 } 9 10 // This code was written by Tyler Akins and has been placed in the 11 // public domain. It would be nice if you left this header intact. 12 // Base64 code from Tyler Akins -- http://rumkin.com 13 14 var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 15 16 var ua = navigator.userAgent.toLowerCase(); 17 if (ua.indexOf(" chrome/") >= 0 || ua.indexOf(" firefox/") >= 0 || ua.indexOf(' gecko/') >= 0) { 18 var StringMaker = function () { 19 this.str = ""; 20 this.length = 0; 21 this.append = function (s) { 22 this.str += s; 23 this.length += s.length; 24 } 25 this.prepend = function (s) { 26 this.str = s + this.str; 27 this.length += s.length; 28 } 29 this.toString = function () { 30 return this.str; 31 } 32 } 33 } else { 34 var StringMaker = function () { 35 this.parts = []; 36 this.length = 0; 37 this.append = function (s) { 38 this.parts.push(s); 39 this.length += s.length; 40 } 41 this.prepend = function (s) { 42 this.parts.unshift(s); 43 this.length += s.length; 44 } 45 this.toString = function () { 46 return this.parts.join(''); 47 } 48 } 49 } 50 51 function fromJSON( value ) 52 { 53 return (new Function( "return " + decode64( value )))(); 54 } 55 56 57 function decode64(input) { 58 59 if( typeof input === "undefined" ) return; 60 61 var output = new StringMaker(); 62 var chr1, chr2, chr3; 63 var enc1, enc2, enc3, enc4; 64 var i = 0; 65 66 // remove all characters that are not A-Z, a-z, 0-9, +, /, or = 67 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 68 69 while (i < input.length) { 70 enc1 = keyStr.indexOf(input.charAt(i++)); 71 enc2 = keyStr.indexOf(input.charAt(i++)); 72 enc3 = keyStr.indexOf(input.charAt(i++)); 73 enc4 = keyStr.indexOf(input.charAt(i++)); 74 75 chr1 = (enc1 << 2) | (enc2 >> 4); 76 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 77 chr3 = ((enc3 & 3) << 6) | enc4; 78 79 output.append(String.fromCharCode(chr1)); 80 81 if (enc3 != 64) { 82 output.append(String.fromCharCode(chr2)); 83 } 84 if (enc4 != 64) { 85 output.append(String.fromCharCode(chr3)); 86 } 87 } 88 89 return output.toString(); 90 91 8 92 } 9 93 … … 220 304 221 305 222 306 cRichTextEditor.prototype.buildSelect = function( selectId, label, options, decode ) { 307 308 var selectBox = document.createElement("SELECT"); 309 selectBox.id = selectId; 310 selectBox.setAttribute("tabIndex","-1"); 311 selectBox.onchange = function () {RichTextEditor.Select( selectId );}; 312 selectBox.className = 'select_richtext'; 313 selectBox.length = 0; 314 315 selectBox.options[0] = new Option( get_lang(label), label ); 316 317 for( var key in options ) 318 selectBox.options[ selectBox.length ] = new Option( key, unescape( options[key] ) ); 319 320 return selectBox; 321 } 223 322 224 323 cRichTextEditor.prototype.buildEditor = function() { … … 232 331 var div_button_rt = document.createElement("DIV"); 233 332 234 selectBox=document.createElement("SELECT"); 235 selectBox.id="fontname"; 236 selectBox.setAttribute("tabIndex","-1"); 237 selectBox.onchange = function () {RichTextEditor.Select("fontname");}; 238 selectBox.className = 'select_richtext'; 239 var option1 = new Option(get_lang('Font'), 'Font'); 240 var option2 = new Option('Arial', 'Arial'); 241 var option3 = new Option('Courier', 'Courier'); 242 var option4 = new Option('Times New Roman', 'Times'); 243 if (is_ie){ 244 selectBox.add(option1); 245 selectBox.add(option2); 246 selectBox.add(option3); 247 selectBox.add(option4); 248 } 249 else{ 250 selectBox.add(option1, null); 251 selectBox.add(option2, null); 252 selectBox.add(option3, null); 253 selectBox.add(option4, null); 254 } 255 div_button_rt.appendChild(selectBox); 256 257 selectBox=document.createElement("SELECT"); 258 selectBox.id="fontsize"; 259 selectBox.setAttribute("tabIndex","-1"); 260 selectBox.setAttribute("unselectable","on"); 261 selectBox.className = 'select_richtext'; 262 selectBox.onchange = function () {RichTextEditor.Select("fontsize");}; 263 var option1 = new Option(get_lang('Size'), 'Size'); 264 var option2 = new Option('1 (8 pt)','1' ); 265 var option3 = new Option('2 (10 pt)','2'); 266 var option4 = new Option('3 (12 pt)','3'); 267 var option5 = new Option('4 (14 pt)','4'); 268 var option6 = new Option('5 (18 pt)','5'); 269 var option7 = new Option('6 (24 pt)','6'); 270 var option8 = new Option('7 (36 pt)','7'); 271 if (is_ie){ 272 selectBox.add(option1); 273 selectBox.add(option2); 274 selectBox.add(option3); 275 selectBox.add(option4); 276 selectBox.add(option5); 277 selectBox.add(option6); 278 selectBox.add(option7); 279 selectBox.add(option8); 280 } 281 else{ 282 selectBox.add(option1, null); 283 selectBox.add(option2, null); 284 selectBox.add(option3, null); 285 selectBox.add(option4, null); 286 selectBox.add(option5, null); 287 selectBox.add(option6, null); 288 selectBox.add(option7, null); 289 selectBox.add(option8, null); 290 } 291 div_button_rt.appendChild(selectBox); 333 334 selectBox = this.buildSelect( "fontname", 'Font', { 'Arial' : 'Arial', 335 'Courier' : 'Courier', 336 'Times New Roman' : 'Times' }); 337 338 div_button_rt.appendChild( selectBox ); 339 340 selectBox = this.buildSelect( "fontsize", 'Size', { '1 (8 pt)': '1', 341 '2 (10 pt)': '2', 342 '3 (12 pt)': '3', 343 '4 (14 pt)': '4', 344 '5 (18 pt)': '5', 345 '6 (24 pt)': '6', 346 '7 (36 pt)': '7' }); 347 348 div_button_rt.appendChild( selectBox ); 292 349 293 350 var buttons = ['bold', 'italic', 'underline', 'forecolor', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', … … 355 412 } 356 413 414 preferences.signatures = fromJSON( preferences.signatures ); 415 preferences.signature_types = fromJSON( preferences.signature_types ); 416 417 for( key in preferences.signatures ) 418 if( !preferences.signature_types[key] ) 419 preferences.signatures[key] = preferences.signatures[key].replace( /\n/g, "<br>" ); 420 421 selectBox = this.buildSelect( "inserthtml", 'Signature', preferences.signatures ); 422 div_button_rt.appendChild( selectBox ); 357 423 358 424 td.appendChild(div_button_rt); … … 366 432 var mainField = document.getElementById(this.editor).contentWindow; 367 433 mainField.focus(); 368 var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>"); 434 var signature = preferences.signature; 435 if( !preferences.signatures ) 436 signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>"); 369 437 if (command == 'signature'){ 370 438 if (is_ie){
Note: See TracChangeset
for help on using the changeset viewer.