1 | <?php |
---|
2 | if(!isset($GLOBALS['phpgw_info'])){ |
---|
3 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
4 | 'currentapp' => 'expressoMail1_2', |
---|
5 | 'nonavbar' => true, |
---|
6 | 'noheader' => true |
---|
7 | ); |
---|
8 | } |
---|
9 | require_once '../header.inc.php'; |
---|
10 | |
---|
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 | |
---|
22 | $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME |
---|
23 | |
---|
24 | //if ($type == 'user' || $type == ''){ |
---|
25 | create_script('function exibir_ocultar() |
---|
26 | { |
---|
27 | var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; |
---|
28 | var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; |
---|
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 | |
---|
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 | } |
---|
289 | }'); |
---|
290 | //} |
---|
291 | |
---|
292 | $default = array( |
---|
293 | '25' => '25', |
---|
294 | '50' => '50', |
---|
295 | '75' => '75', |
---|
296 | '100' => '100' |
---|
297 | ); |
---|
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 | |
---|
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'); |
---|
303 | create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder'); |
---|
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 | |
---|
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'); |
---|
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'); |
---|
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'); |
---|
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'); |
---|
320 | |
---|
321 | //Use user folders from email |
---|
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 | { |
---|
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'); |
---|
345 | $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; |
---|
346 | |
---|
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'); |
---|
356 | |
---|
357 | foreach($imap -> get_folders_list(array('noSharedFolders' => true)) as $id => $folder){ |
---|
358 | if(!is_numeric($id)) |
---|
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); |
---|
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 .= ' - '; |
---|
373 | |
---|
374 | $default[$folder['folder_id']] = $ident.$folder['folder_name']; |
---|
375 | } |
---|
376 | } |
---|
377 | |
---|
378 | } |
---|
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'); |
---|
381 | |
---|
382 | $default = array( |
---|
383 | '1' => lang('unlimited'), |
---|
384 | '2' => '2', |
---|
385 | '3' => '3', |
---|
386 | '4' => '4', |
---|
387 | '5' => '5' |
---|
388 | ); |
---|
389 | |
---|
390 | 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'); |
---|
391 | |
---|
392 | $default = array( |
---|
393 | '20' => lang('normal'), |
---|
394 | '30' => lang('medium'), |
---|
395 | '40' => lang('big') |
---|
396 | ); |
---|
397 | |
---|
398 | create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); |
---|
399 | create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts'); |
---|
400 | create_check_box('Use shortcuts?','use_shortcuts',''); |
---|
401 | create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); |
---|
402 | $default = array( |
---|
403 | '65536' => lang('unlimited'), |
---|
404 | '640' => '640', |
---|
405 | '768' => '768', |
---|
406 | '800' => '800', |
---|
407 | '1024' => '1024', |
---|
408 | '1080' => '1080' |
---|
409 | ); |
---|
410 | |
---|
411 | 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'); |
---|
412 | |
---|
413 | if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) |
---|
414 | { |
---|
415 | create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"'); |
---|
416 | if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) |
---|
417 | { |
---|
418 | create_check_box('Always sign message digitally?','use_signature_digital',''); |
---|
419 | create_check_box('Always cipher message digitally?','use_signature_cripto',''); |
---|
420 | } |
---|
421 | else |
---|
422 | { |
---|
423 | create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False); |
---|
424 | create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False); |
---|
425 | } |
---|
426 | } |
---|
427 | |
---|
428 | $default = array( |
---|
429 | 'text' => lang('simple text'), |
---|
430 | 'html' => lang('rich text') |
---|
431 | ); |
---|
432 | create_check_box('Insert signature automatically in new messages?','use_signature',''); |
---|
433 | |
---|
434 | if ($type == 'user' || $type == ''){ |
---|
435 | |
---|
436 | global $prefs; |
---|
437 | // create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);"'); |
---|
438 | |
---|
439 | $vars = $GLOBALS['phpgw']->preferences->user['expressoMail']; |
---|
440 | |
---|
441 | 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> |
---|
442 | <input type='hidden' id='counter' value='0'> |
---|
443 | <input type='hidden' id='signatures' name='user[signatures]' value='". $vars['signatures']."'> |
---|
444 | <input type='hidden' id='signature_default' name='user[signature_default]' value='".$vars['signature_default']."'> |
---|
445 | <input type='hidden' id='type_signature' name='user[type_signature]' value='".$vars['type_signature']."'> |
---|
446 | <input type='hidden' id='signature' name='user[signature]' value='","' > |
---|
447 | <input type='hidden' id='signature_types' name='user[signature_types]' value='".$vars['signature_types']."'> |
---|
448 | |
---|
449 | <div id='_signature' name='signature' style='display: none;'> |
---|
450 | <div id='options_signature'> |
---|
451 | <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> |
---|
452 | </div><br/> |
---|
453 | <div id='text_signature'> |
---|
454 | <textarea rows='5' cols='50' id='user_signature' class='editor'></textarea></div> |
---|
455 | </div> |
---|
456 | |
---|
457 | <script language='javascript'> |
---|
458 | |
---|
459 | $(document).ready(function(){ |
---|
460 | |
---|
461 | loadSignature(); |
---|
462 | |
---|
463 | }); |
---|
464 | |
---|
465 | function changeType(value, target){ |
---|
466 | |
---|
467 | tinyMCE.execCommand( 'mceToggleEditor', false, 'user_signature' + target ); |
---|
468 | } |
---|
469 | |
---|
470 | // var counter = 0; |
---|
471 | |
---|
472 | function addSignature( simple ) |
---|
473 | { |
---|
474 | var sig = document.getElementById('_signature').cloneNode( true ); |
---|
475 | var counter = document.getElementById( 'counter' ).value; |
---|
476 | |
---|
477 | sig.innerHTML = sig.innerHTML.replace( /_signature/g, '_signature' + counter ); |
---|
478 | |
---|
479 | sig.id = '_signature' + counter; |
---|
480 | sig.style.display = ''; |
---|
481 | |
---|
482 | $( '#add_signature' ).before( sig ); |
---|
483 | |
---|
484 | if( !simple ) |
---|
485 | $( '#user_signature' + counter ).tinymce({ |
---|
486 | plugins : 'paste', |
---|
487 | theme_advanced_toolbar_location : 'top', |
---|
488 | theme_advanced_toolbar_align : 'center', |
---|
489 | entities: '', |
---|
490 | entity_encoding: 'raw', |
---|
491 | theme: 'advanced', |
---|
492 | add_form_submit_trigger : false |
---|
493 | }); |
---|
494 | else |
---|
495 | document.getElementById('edit_signature' + counter ).checked = ''; |
---|
496 | |
---|
497 | document.getElementById( 'counter' ).value = ++counter; |
---|
498 | } |
---|
499 | |
---|
500 | function removeSignature( el ) |
---|
501 | { |
---|
502 | counter = el.id.replace( /[^0-9]*/gi, \"\" ); |
---|
503 | |
---|
504 | el = document.getElementById( '_signature' + counter ); |
---|
505 | el.parentNode.removeChild( el ); |
---|
506 | |
---|
507 | return( false ); |
---|
508 | } |
---|
509 | </script> |
---|
510 | <input id='add_signature' type='button' onclick='addSignature();' value='Adicionar Assinatura'> |
---|
511 | "); |
---|
512 | }else{ |
---|
513 | create_select_box('Signature Type','type_signature',$default,'','','',''); |
---|
514 | |
---|
515 | } |
---|
516 | ?> |
---|