source: sandbox/2.2.0.2/expressoMail1_2/inc/hook_settings.inc.php @ 4465

Revision 4465, 20.2 KB checked in by airton, 13 years ago (diff)

Ticket #1820 - Erro na visualizacao da lista de emails no Internet Explorer - r4424

  • Property svn:executable set to *
Line 
1<?php
2if(!isset($GLOBALS['phpgw_info'])){
3        $GLOBALS['phpgw_info']['flags'] = array(
4                'currentapp' => 'expressoMail1_2',
5                'nonavbar'   => true,
6                'noheader'   => true
7        );
8}
9require_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        \**************************************************************************/
21include_once("fckeditor.php");
22include_once("class.functions.inc.php");
23$type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME
24
25//if ($type == 'user' || $type == ''){
26create_script('function exibir_ocultar()
27{
28    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
42    var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'";
43
44    if (use_signature_digital_cripto)
45    {
46        var element_signature_digital = document.getElementById(type+"[use_signature_digital]");
47        var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]");
48
49        switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){
50
51            case "1":
52                element_signature_digital.style.display="";
53                element_signature_cripto.style.display="";
54                break;
55            case "0":
56                element_signature_digital.style.display="none";
57                element_signature_cripto.style.display="none";
58                break;
59            case "":
60                if (default_signature_digital_cripto){
61                    element_signature_digital.style.display="";
62                    element_signature_cripto.style.display="";
63                 }
64                 else
65                 {
66                    element_signature_digital.style.display="none";
67                    element_signature_cripto.style.display="none";
68                 }
69
70        }
71
72    }
73
74}');
75//}
76$default = false;
77create_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?');
79create_check_box('Do you want to automatically display the message header?','show_head_msg_full',$default,'');
80$default = array(
81        '25'    => '25',
82        '50'    => '50',
83        '75'    => '75',
84        '100'   => '100'
85);
86
87create_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
89create_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;
92create_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;
95create_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
97create_check_box('View extended information about users','extended_info','This exhibits employeenumber and ou from LDAP in searchs');
98
99create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder');
100$default = array(
101        '1'    => lang('1 day'),
102        '2'    => lang('2 days'),
103        '3'    => lang('3 days'),
104        '4'   => lang('4 days'),
105        '5'   => lang('5 days')
106);
107
108$arquived_messages = array(true => lang("Copy"), false => lang("Move"));
109
110create_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');
111create_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');
112create_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');
113create_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');
114create_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');
115create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed');
116create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page');
117create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages');
118create_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');
119create_check_box('Do you want to use SpellChecker in email editor?','use_SpellChecker','It allow you to check the spelling of your emails');
120//Use user folders from email
121
122require_once('class.imap_functions.inc.php');
123$boemailadmin = CreateObject('emailadmin.bo');
124$emailadmin_profile = $boemailadmin->getProfileList();
125$_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
126$_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
127$e_server = $_SESSION['phpgw_info']['expressomail']['email_server'];
128$imap = CreateObject('expressoMail1_2.imap_functions');
129
130if ($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        $default = Array(
137                'INBOX' =>      lang('INBOX'),
138                'INBOX' . $imap->imap_delimiter . $drafts => lang($drafts),
139                'INBOX' . $imap->imap_delimiter . $spam => lang($spam),
140                'INBOX' . $imap->imap_delimiter . $trash => lang($trash), 
141                'INBOX' . $imap->imap_delimiter . $sent => lang($sent)
142        );
143}
144else
145{
146$save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'];
147
148// Load Special Folders (Sent, Trash, Draft, Spam) from EmailAdmin (if exists, else get_lang)
149$specialFolders = array ("Trash" => lang("Trash"), "Drafts" => lang("Drafts"), "Spam" => lang("Spam"), "Sent" => lang("Sent"));
150
151foreach ($specialFolders as $key => $value){
152        if($e_server['imapDefault'.$key.'Folder'])
153                $specialFolders[$key] = $e_server['imapDefault'.$key.'Folder'];
154}
155unset($default);
156$default[-1] = lang('Select on send');
157       
158        foreach($imap -> get_folders_list(array('noSharedFolders' => true)) as $id => $folder){
159                if(!is_numeric($id))
160                        continue;
161                else{
162                        // Translate INBOX (root folder)
163                        if (strtolower($folder['folder_name']) == "inbox")
164                                $folder['folder_name'] = lang("Inbox");
165                        // Translate Special Folders
166                        elseif (($keyFolder = array_search($folder['folder_name'], $specialFolders)) !== false)
167                                $folder['folder_name'] = lang($keyFolder);
168                        // Identation for subfolders
169                        $folder_id = explode($e_server['imapDelimiter'],$folder['folder_id']);       
170                        $level = count($folder_id);
171                        $ident = '';
172                        for($i = 2; $level > 2 && $i < $level;$i++)
173                                $ident .= ' - ';
174                       
175                        $default[$folder['folder_id']] = $ident.$folder['folder_name'];
176                }               
177        }
178
179}
180create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder');
181create_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');
182
183
184create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution');
185
186
187$default =  array(
188    '50'    => '50',
189    '100'   => '100',
190    '150'   => '150',
191    '200'   => '200',
192    '300'   => '300',
193    '400'   => '400',
194    '65536' => lang('unlimited')
195);
196
197create_select_box('What is the maximum number of results in an e-mail search?','search_result_number',$default,'');
198
199$default =  array(
200    '1' => lang('unlimited'),
201    '2'     => '2',
202    '3'     => '3',
203    '4'     => '4',
204    '5'     => '5'
205);
206
207create_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');
208
209        $default = array(
210                '20' => lang('normal'),
211                '30' => lang('medium'),
212                '40' => lang('big')
213        );
214
215
216create_select_box('What is the height of the lines in the list of messages?','line_height',$default,'');
217create_check_box('Increases th maximum size of show messages?','max_msg_size','Increases the maximum size of show emails from 100kb to 1mb');
218create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts');
219create_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>');
220create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing');
221create_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');
222
223unset($default);
224$functions = new functions();
225$zones = $functions->getTimezones();
226$default = array(sprintf("%s", array_search('America/Sao_Paulo', $zones)) => 'America/Sao_Paulo');
227create_select_box('What is your timezone?', 'timezone', $zones, 'The Timezone you\'re in.', $default);
228
229$default =  array(
230    '1' => lang('contacts'),
231    '2' => lang('email')
232);
233
234create_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.');
235
236$default = array(
237        '65536' => lang('unlimited'),
238        '640' => '640',
239        '768' => '768',
240        '800' => '800',
241        '1024' => '1024',
242        '1080' => '1080'
243);
244
245create_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');
246
247if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar'])
248{
249    create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"');
250    if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'])
251    {
252        create_check_box('Always sign message digitally?','use_signature_digital','');
253        create_check_box('Always cipher message digitally?','use_signature_cripto','');
254    }
255    else
256    {
257        create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False);
258        create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False);
259    }
260}
261
262$default = array(
263        'text' => lang('simple text'),
264        'html' => lang('rich text')
265);
266create_check_box('Auto close the first tab on reaching the maximum number of tabs?','auto_close_first_tab','');
267create_check_box('Insert signature automatically in new messages?','use_signature','');
268create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);" onload="javascript:alert(this.value);"');
269
270if ($type == 'user' || $type == ''){
271        $oFCKeditor = new FCKeditor('html_signature');
272        $oFCKeditor->BasePath   = '../expressoMail1_2/js/fckeditor/';
273        $oFCKeditor->ToolbarSet = 'ExpressoLivre';
274
275        $vars = $GLOBALS['phpgw']->preferences->user[$appname];
276
277        create_html_code("signature","<div id='text_signature'>
278                <textarea rows='5' cols='50' id='user_signature' name='user[signature]'>","</textarea></div>
279                <div style='display:none;' id='html_signature'>".$oFCKeditor->Create()."</div>
280                <script language='javascript'>
281//document.getElementById('user_signature').value  = '".$vars['signature']."';
282function changeType(value){
283        var html_signature = FCKeditorAPI.GetInstance(\"html_signature\");
284        value=value.replace('d','');
285        if(value == 'text'){
286                document.getElementById('user_signature').value = html_signature.GetHTML();
287                document.getElementById(\"text_signature\").style.display = '';
288                document.getElementById(\"html_signature\").style.display = 'none';
289        }
290        else if(value == 'html'){
291                html_signature.SetHTML(document.getElementById('user_signature').value);
292                document.getElementById(\"text_signature\").style.display = 'none';
293                document.getElementById(\"html_signature\").style.display  = '';
294        }
295}
296function get_html_translation_table(table, quote_style) {
297    // http://kevin.vanzonneveld.net
298    var entities = {}, hash_map = {}, decimal = 0, symbol = '';
299    var constMappingTable = {}, constMappingQuoteStyle = {};
300    var useTable = {}, useQuoteStyle = {};
301    // Translate arguments
302    constMappingTable[0]      = 'HTML_SPECIALCHARS';
303    constMappingTable[1]      = 'HTML_ENTITIES';
304    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
305    constMappingQuoteStyle[2] = 'ENT_COMPAT';
306    constMappingQuoteStyle[3] = 'ENT_QUOTES';
307 
308    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
309    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
310 
311    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
312        throw new Error(\"Table: \"+useTable+' not supported');
313        // return false;
314    }
315 
316    entities['38'] = '&amp;';
317    if (useTable === 'HTML_ENTITIES') {
318        entities['160'] = '&nbsp;';
319        entities['161'] = '&iexcl;';
320        entities['162'] = '&cent;';
321        entities['163'] = '&pound;';
322        entities['164'] = '&curren;';
323        entities['165'] = '&yen;';
324        entities['166'] = '&brvbar;';
325        entities['167'] = '&sect;';
326        entities['168'] = '&uml;';
327        entities['169'] = '&copy;';
328        entities['170'] = '&ordf;';
329        entities['171'] = '&laquo;';
330        entities['172'] = '&not;';
331        entities['173'] = '&shy;';
332        entities['174'] = '&reg;';
333        entities['175'] = '&macr;';
334        entities['176'] = '&deg;';
335        entities['177'] = '&plusmn;';
336        entities['178'] = '&sup2;';
337        entities['179'] = '&sup3;';
338        entities['180'] = '&acute;';
339        entities['181'] = '&micro;';
340        entities['182'] = '&para;';
341        entities['183'] = '&middot;';
342        entities['184'] = '&cedil;';
343        entities['185'] = '&sup1;';
344        entities['186'] = '&ordm;';
345        entities['187'] = '&raquo;';
346        entities['188'] = '&frac14;';
347        entities['189'] = '&frac12;';
348        entities['190'] = '&frac34;';
349        entities['191'] = '&iquest;';
350        entities['192'] = '&Agrave;';
351        entities['193'] = '&Aacute;';
352        entities['194'] = '&Acirc;';
353        entities['195'] = '&Atilde;';
354        entities['196'] = '&Auml;';
355        entities['197'] = '&Aring;';
356        entities['198'] = '&AElig;';
357        entities['199'] = '&Ccedil;';
358        entities['200'] = '&Egrave;';
359        entities['201'] = '&Eacute;';
360        entities['202'] = '&Ecirc;';
361        entities['203'] = '&Euml;';
362        entities['204'] = '&Igrave;';
363        entities['205'] = '&Iacute;';
364        entities['206'] = '&Icirc;';
365        entities['207'] = '&Iuml;';
366        entities['208'] = '&ETH;';
367        entities['209'] = '&Ntilde;';
368        entities['210'] = '&Ograve;';
369        entities['211'] = '&Oacute;';
370        entities['212'] = '&Ocirc;';
371        entities['213'] = '&Otilde;';
372        entities['214'] = '&Ouml;';
373        entities['215'] = '&times;';
374        entities['216'] = '&Oslash;';
375        entities['217'] = '&Ugrave;';
376        entities['218'] = '&Uacute;';
377        entities['219'] = '&Ucirc;';
378        entities['220'] = '&Uuml;';
379        entities['221'] = '&Yacute;';
380        entities['222'] = '&THORN;';
381        entities['223'] = '&szlig;';
382        entities['224'] = '&agrave;';
383        entities['225'] = '&aacute;';
384        entities['226'] = '&acirc;';
385        entities['227'] = '&atilde;';
386        entities['228'] = '&auml;';
387        entities['229'] = '&aring;';
388        entities['230'] = '&aelig;';
389        entities['231'] = '&ccedil;';
390        entities['232'] = '&egrave;';
391        entities['233'] = '&eacute;';
392        entities['234'] = '&ecirc;';
393        entities['235'] = '&euml;';
394        entities['236'] = '&igrave;';
395        entities['237'] = '&iacute;';
396        entities['238'] = '&icirc;';
397        entities['239'] = '&iuml;';
398        entities['240'] = '&eth;';
399        entities['241'] = '&ntilde;';
400        entities['242'] = '&ograve;';
401        entities['243'] = '&oacute;';
402        entities['244'] = '&ocirc;';
403        entities['245'] = '&otilde;';
404        entities['246'] = '&ouml;';
405        entities['247'] = '&divide;';
406        entities['248'] = '&oslash;';
407        entities['249'] = '&ugrave;';
408        entities['250'] = '&uacute;';
409        entities['251'] = '&ucirc;';
410        entities['252'] = '&uuml;';
411        entities['253'] = '&yacute;';
412        entities['254'] = '&thorn;';
413        entities['255'] = '&yuml;';
414    }
415    if (useQuoteStyle !== 'ENT_NOQUOTES') {
416        entities['34'] = '&quot;';
417    }
418    if (useQuoteStyle === 'ENT_QUOTES') {
419        entities['39'] = '&#39;';
420    }
421    entities['60'] = '&lt;';
422    entities['62'] = '&gt;';
423 
424    // ascii decimals to real symbols
425    for (decimal in entities) {
426        symbol = String.fromCharCode(decimal);
427        hash_map[symbol] = entities[decimal];
428    }
429    return hash_map;
430}
431function html_entity_decode( string, quote_style ) {
432    // http://kevin.vanzonneveld.net
433    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
434    tmp_str = string.toString();
435    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
436        return false;
437    }
438    for (symbol in hash_map) {
439        entity = hash_map[symbol];
440        tmp_str = tmp_str.split(entity).join(symbol);
441    }
442    tmp_str = tmp_str.split('&#039;').join(\"'\");
443    return tmp_str;
444}
445
446function getTypeSignature() {
447   var elementoSelects  = document.getElementsByTagName('select');
448
449   if ( elementoSelects[18].name == \"user[type_signature]\" ) {
450        return elementoSelects[18];
451   }
452   
453   for(i=0;i<elementoSelects.length;i++){
454        if( elementoSelects[i].name == \"user[type_signature]\" ){
455                 return elementoSelects[i];
456        }
457    }
458    return null;
459}
460
461function config_form(pObj,pHandler)
462{
463        pObj.onclick=function () {
464                if (getTypeSignature().value == \"html\" || getTypeSignature().value == \"htmld\") {
465                        return pHandler(\"text\");
466                }
467        };
468
469}
470document.getElementById('user_signature').value=html_entity_decode(document.getElementById('user_signature').innerHTML);
471
472function setDefaultTypeSignature() {
473        if(getTypeSignature()){
474                getTypeSignature().options[0].value = '".$GLOBALS['phpgw']->preferences->default['expressoMail']['type_signature']."d';
475                if(getTypeSignature().value.indexOf('html')!=-1){
476                   changeType(getTypeSignature().value);
477            }
478        }else{
479                 changeType('".$GLOBALS['phpgw']->preferences->forced['expressoMail']['type_signature']."');
480        }
481}
482
483setTimeout('setDefaultTypeSignature();config_form(document.getElementsByName(\'submit\')[0],changeType);',2000);
484</script>");
485}
486?>
Note: See TracBrowser for help on using the repository browser.