[873] | 1 | <?php |
---|
[1037] | 2 | if(!isset($GLOBALS['phpgw_info'])){ |
---|
[1036] | 3 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 4 | 'currentapp' => 'expressoMail1_2', |
---|
| 5 | 'nonavbar' => true, |
---|
| 6 | 'noheader' => true |
---|
| 7 | ); |
---|
[1037] | 8 | } |
---|
[1040] | 9 | require_once '../header.inc.php'; |
---|
[1036] | 10 | |
---|
[873] | 11 | /**************************************************************************\ |
---|
| 12 | * eGroupWare - ExpressoMail Preferences * |
---|
| 13 | * http://www.expressolivre.org * |
---|
| 14 | * Modified by Alexandre Felipe Muller de Souza <amuller@celepar.pr.gov.br> * |
---|
| 15 | * -------------------------------------------- * |
---|
| 16 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 17 | * under the terms of the GNU General Public License as published by the * |
---|
| 18 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 19 | * option) any later version. * |
---|
| 20 | \**************************************************************************/ |
---|
| 21 | |
---|
[4828] | 22 | $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME |
---|
| 23 | |
---|
[1035] | 24 | //if ($type == 'user' || $type == ''){ |
---|
[1405] | 25 | create_script('function exibir_ocultar() |
---|
[1035] | 26 | { |
---|
| 27 | var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; |
---|
[4828] | 28 | var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; |
---|
[1035] | 29 | var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'"; |
---|
| 30 | |
---|
| 31 | if (use_signature_digital_cripto) |
---|
| 32 | { |
---|
| 33 | var element_signature_digital = document.getElementById(type+"[use_signature_digital]"); |
---|
| 34 | var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]"); |
---|
| 35 | |
---|
| 36 | switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){ |
---|
| 37 | |
---|
| 38 | case "1": |
---|
| 39 | element_signature_digital.style.display=""; |
---|
| 40 | element_signature_cripto.style.display=""; |
---|
| 41 | break; |
---|
| 42 | case "0": |
---|
| 43 | element_signature_digital.style.display="none"; |
---|
| 44 | element_signature_cripto.style.display="none"; |
---|
| 45 | break; |
---|
| 46 | case "": |
---|
| 47 | if (default_signature_digital_cripto){ |
---|
| 48 | element_signature_digital.style.display=""; |
---|
| 49 | element_signature_cripto.style.display=""; |
---|
| 50 | } |
---|
| 51 | else |
---|
| 52 | { |
---|
| 53 | element_signature_digital.style.display="none"; |
---|
| 54 | element_signature_cripto.style.display="none"; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | |
---|
[4828] | 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 | } |
---|
[1405] | 289 | }'); |
---|
[1035] | 290 | //} |
---|
[4828] | 291 | |
---|
[873] | 292 | $default = array( |
---|
| 293 | '25' => '25', |
---|
| 294 | '50' => '50', |
---|
| 295 | '75' => '75', |
---|
| 296 | '100' => '100' |
---|
| 297 | ); |
---|
| 298 | |
---|
[4828] | 299 | // Cria nova opção nas preferências do ExpressoMail |
---|
[4231] | 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 | |
---|
[4828] | 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'); |
---|
[1285] | 303 | create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder'); |
---|
[873] | 304 | $default = array( |
---|
| 305 | '1' => lang('1 day'), |
---|
| 306 | '2' => lang('2 days'), |
---|
| 307 | '3' => lang('3 days'), |
---|
| 308 | '4' => lang('4 days'), |
---|
| 309 | '5' => lang('5 days') |
---|
| 310 | ); |
---|
| 311 | |
---|
[1285] | 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'); |
---|
| 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'); |
---|
[4828] | 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'); |
---|
[1285] | 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'); |
---|
| 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'); |
---|
| 317 | create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page'); |
---|
| 318 | create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages'); |
---|
[1291] | 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'); |
---|
[4828] | 320 | |
---|
[1281] | 321 | //Use user folders from email |
---|
[1285] | 322 | if ($type != "" && $type != "user"){ |
---|
[4828] | 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']; |
---|
[4726] | 327 | $delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']; |
---|
[1283] | 328 | $default = Array( |
---|
| 329 | 'INBOX' => lang('INBOX'), |
---|
[4828] | 330 | 'INBOX'.$delimiter.$trash => $trash, |
---|
| 331 | 'INBOX'.$delimiter.$drafts => $drafts, |
---|
| 332 | 'INBOX'.$delimiter.$spam => $spam, |
---|
| 333 | 'INBOX'.$delimiter.$sent => $sent |
---|
[1283] | 334 | ); |
---|
| 335 | } |
---|
[1285] | 336 | else |
---|
| 337 | { |
---|
[4828] | 338 | require_once('class.imap_functions.inc.php'); |
---|
| 339 | $boemailadmin = CreateObject('emailadmin.bo'); |
---|
| 340 | $emailadmin_profile = $boemailadmin->getProfileList(); |
---|
| 341 | $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); |
---|
| 342 | $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; |
---|
| 343 | $e_server = $_SESSION['phpgw_info']['expressomail']['email_server']; |
---|
| 344 | $imap = CreateObject('expressoMail1_2.imap_functions'); |
---|
[1378] | 345 | $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; |
---|
[1281] | 346 | |
---|
[1378] | 347 | // Load Special Folders (Sent, Trash, Draft, Spam) from EmailAdmin (if exists, else get_lang) |
---|
| 348 | $specialFolders = array ("Trash" => lang("Trash"), "Drafts" => lang("Drafts"), "Spam" => lang("Spam"), "Sent" => lang("Sent")); |
---|
| 349 | |
---|
| 350 | foreach ($specialFolders as $key => $value){ |
---|
| 351 | if($e_server['imapDefault'.$key.'Folder']) |
---|
| 352 | $specialFolders[$key] = $e_server['imapDefault'.$key.'Folder']; |
---|
| 353 | } |
---|
| 354 | unset($default); |
---|
| 355 | $default[-1] = lang('Select on send'); |
---|
[1373] | 356 | |
---|
[1375] | 357 | foreach($imap -> get_folders_list(array('noSharedFolders' => true)) as $id => $folder){ |
---|
| 358 | if(!is_numeric($id)) |
---|
[1283] | 359 | continue; |
---|
| 360 | else{ |
---|
| 361 | // Translate INBOX (root folder) |
---|
| 362 | if (strtolower($folder['folder_name']) == "inbox") |
---|
| 363 | $folder['folder_name'] = lang("Inbox"); |
---|
| 364 | // Translate Special Folders |
---|
| 365 | elseif (($keyFolder = array_search($folder['folder_name'], $specialFolders)) !== false) |
---|
| 366 | $folder['folder_name'] = lang($keyFolder); |
---|
[1289] | 367 | // Identation for subfolders |
---|
| 368 | $folder_id = explode($e_server['imapDelimiter'],$folder['folder_id']); |
---|
| 369 | $level = count($folder_id); |
---|
| 370 | $ident = ''; |
---|
| 371 | for($i = 2; $level > 2 && $i < $level;$i++) |
---|
| 372 | $ident .= ' - '; |
---|
[1373] | 373 | |
---|
[1289] | 374 | $default[$folder['folder_id']] = $ident.$folder['folder_name']; |
---|
[1373] | 375 | } |
---|
[1281] | 376 | } |
---|
[1378] | 377 | |
---|
[1281] | 378 | } |
---|
[1285] | 379 | create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder'); |
---|
| 380 | create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution'); |
---|
[873] | 381 | |
---|
[4828] | 382 | $default = array( |
---|
| 383 | '20' => lang('normal'), |
---|
| 384 | '30' => lang('medium'), |
---|
| 385 | '40' => lang('big') |
---|
[1608] | 386 | ); |
---|
| 387 | |
---|
[1035] | 388 | create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); |
---|
[1285] | 389 | create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts'); |
---|
[4828] | 390 | create_check_box('Use shortcuts?','use_shortcuts',''); |
---|
[1285] | 391 | create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); |
---|
[1005] | 392 | $default = array( |
---|
| 393 | '65536' => lang('unlimited'), |
---|
| 394 | '640' => '640', |
---|
| 395 | '768' => '768', |
---|
| 396 | '800' => '800', |
---|
| 397 | '1024' => '1024', |
---|
| 398 | '1080' => '1080' |
---|
| 399 | ); |
---|
[873] | 400 | |
---|
[1285] | 401 | create_select_box('What is the maximum size of embedded images?','image_size',$default,'When user send an email with image in body message, it changes the size'); |
---|
[1005] | 402 | |
---|
[1035] | 403 | if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) |
---|
| 404 | { |
---|
| 405 | create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"'); |
---|
| 406 | if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) |
---|
| 407 | { |
---|
| 408 | create_check_box('Always sign message digitally?','use_signature_digital',''); |
---|
| 409 | create_check_box('Always cipher message digitally?','use_signature_cripto',''); |
---|
| 410 | } |
---|
| 411 | else |
---|
| 412 | { |
---|
| 413 | create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False); |
---|
| 414 | create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False); |
---|
| 415 | } |
---|
| 416 | } |
---|
| 417 | |
---|
[873] | 418 | $default = array( |
---|
| 419 | 'text' => lang('simple text'), |
---|
| 420 | 'html' => lang('rich text') |
---|
| 421 | ); |
---|
[1288] | 422 | create_check_box('Insert signature automatically in new messages?','use_signature',''); |
---|
[873] | 423 | |
---|
[874] | 424 | if ($type == 'user' || $type == ''){ |
---|
[873] | 425 | |
---|
[4828] | 426 | global $prefs; |
---|
| 427 | // create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);"'); |
---|
[873] | 428 | |
---|
[4828] | 429 | $vars = $GLOBALS['phpgw']->preferences->user['expressoMail']; |
---|
[1244] | 430 | |
---|
[4828] | 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']."'> |
---|
[1873] | 438 | |
---|
[4828] | 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 ); |
---|
[1873] | 458 | } |
---|
[1544] | 459 | |
---|
[4828] | 460 | // var counter = 0; |
---|
| 461 | |
---|
| 462 | function addSignature( simple ) |
---|
[1244] | 463 | { |
---|
[4828] | 464 | var sig = document.getElementById('_signature').cloneNode( true ); |
---|
| 465 | var counter = document.getElementById( 'counter' ).value; |
---|
[1544] | 466 | |
---|
[4828] | 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; |
---|
[1244] | 488 | } |
---|
| 489 | |
---|
[4828] | 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 ); |
---|
[1544] | 498 | } |
---|
[4828] | 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,'','','',''); |
---|
[1544] | 504 | |
---|
[873] | 505 | } |
---|
| 506 | ?> |
---|