source: trunk/expressoMail1_2/inc/hook_settings.inc.php @ 1330

Revision 1330, 16.2 KB checked in by niltonneto, 15 years ago (diff)

Ticket #605 - Opção de mostrar pastas compartilhadas por nome (CN) ou login (uid).

  • 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");
22$type = $_GET['type']; // FIX ME
23
24//if ($type == 'user' || $type == ''){
25create_html_code("script", '<script language="JavaScript" type="text/javascript">
26function exibir_ocultar()
27{
28    var type = ("'.$type.'" == "") ? "user" : "'.$type.'";
29    var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0];
30    var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'";
31
32    if (use_signature_digital_cripto)
33    {
34        var element_signature_digital = document.getElementById(type+"[use_signature_digital]");
35        var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]");
36
37        switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){
38
39            case "1":
40                element_signature_digital.style.display="";
41                element_signature_cripto.style.display="";
42                break;
43            case "0":
44                element_signature_digital.style.display="none";
45                element_signature_cripto.style.display="none";
46                break;
47            case "":
48                if (default_signature_digital_cripto){
49                    element_signature_digital.style.display="";
50                    element_signature_cripto.style.display="";
51                 }
52                 else
53                 {
54                    element_signature_digital.style.display="none";
55                    element_signature_cripto.style.display="none";
56                 }
57
58        }
59
60    }
61
62}',
63
64'</script>');
65//}
66
67$default = false;
68create_check_box('Do you want to show common name instead of UID?','uid2cn',$default,
69        'Do you want to show common name instead of UID?');
70
71$default = array(
72        '25'    => '25',
73        '50'    => '50',
74        '75'    => '75',
75        '100'   => '100'
76);
77
78create_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');
79create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder');
80$default = array(
81        '1'    => lang('1 day'),
82        '2'    => lang('2 days'),
83        '3'    => lang('3 days'),
84        '4'   => lang('4 days'),
85        '5'   => lang('5 days')
86);
87
88create_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');
89create_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');
90create_check_box('Would you like to keep archived messages?','keep_archived_messages','After store email in your local computer delete it from server');
91create_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');
92create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed');
93create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page');
94create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages');
95create_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');
96
97//Use user folders from email
98if ($type != "" && $type != "user"){
99        $trash = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'];
100        $drafts = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'];
101        $spam = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'];
102        $sent = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'];
103        $default = Array(
104                'INBOX' =>      lang('INBOX'),
105                'INBOX/'.$trash => $trash, 
106                'INBOX/'.$drafts => $drafts,
107                'INBOX/'.$spam => $spam,
108                'INBOX/'.$sent => $sent
109        );
110}
111else
112{
113        require_once('class.imap_functions.inc.php');
114        $boemailadmin = CreateObject('emailadmin.bo');
115        $emailadmin_profile = $boemailadmin->getProfileList();
116        $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
117        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
118        $e_server = $_SESSION['phpgw_info']['expressomail']['email_server'];
119        $imap = CreateObject('expressoMail1_2.imap_functions');
120        $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'];
121
122        // Load Special Folders (Sent, Trash, Draft, Spam) from EmailAdmin (if exists, else get_lang)
123        $specialFolders = array ("Trash" => lang("Trash"), "Drafts" => lang("Drafts"), "Spam" => lang("Spam"), "Sent" => lang("Sent"));
124        foreach ($specialFolders as $key => $value){
125                if($e_server['imapDefault'.$key.'Folder'])
126                        $specialFolders[$key] = $e_server['imapDefault'.$key.'Folder'];
127        }
128        unset($default);
129        $default[-1] = lang('Select on send');
130        foreach($imap -> get_folders_list() as $id => $folder){
131                if (!(is_numeric($id) || strstr($folder['folder_id'],"user".$e_server['imapDelimiter'])))
132                        continue;
133                else{
134                        // Translate INBOX (root folder)
135                        if (strtolower($folder['folder_name']) == "inbox")
136                                $folder['folder_name'] = lang("Inbox");
137                        // Translate Special Folders
138                        elseif (($keyFolder = array_search($folder['folder_name'], $specialFolders)) !== false)
139                                $folder['folder_name'] = lang($keyFolder);
140                        // Identation for subfolders
141                        $folder_id = explode($e_server['imapDelimiter'],$folder['folder_id']);       
142                        $level = count($folder_id);
143                        $ident = '';
144                        for($i = 2; $level > 2 && $i < $level;$i++)
145                                $ident .= ' - ';
146                        $default[$folder['folder_id']] = $ident.$folder['folder_name'];
147                }
148        }
149}
150create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder');
151create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution');
152
153$default = array(
154        '20' => lang('normal'),
155        '30' => lang('medium'),
156        '40' => lang('big')
157);
158
159create_select_box('What is the height of the lines in the list of messages?','line_height',$default,'');
160$default = array(
161        '10' => lang('small'),
162        '11' => lang('normal'),
163        '15' => lang('big')
164);
165
166create_select_box('What the font size in the list of messages?','font_size',$default,'');
167create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts');
168create_check_box('Use shortcuts?','use_shortcuts','');
169create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing');
170$default = array(
171        '65536' => lang('unlimited'),
172        '640' => '640',
173        '768' => '768',
174        '800' => '800',
175        '1024' => '1024',
176        '1080' => '1080'
177);
178
179create_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');
180
181if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar'])
182{
183    create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"');
184    if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'])
185    {
186        create_check_box('Always sign message digitally?','use_signature_digital','');
187        create_check_box('Always cipher message digitally?','use_signature_cripto','');
188    }
189    else
190    {
191        create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False);
192        create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False);
193    }
194}
195
196$default = array(
197        'text' => lang('simple text'),
198        'html' => lang('rich text')
199);
200create_check_box('Insert signature automatically in new messages?','use_signature','');
201create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);" onload="javascript:alert(this.value);"');
202
203if ($type == 'user' || $type == ''){
204        $oFCKeditor = new FCKeditor('html_signature');
205        $oFCKeditor->BasePath   = '../expressoMail1_2/js/fckeditor/';
206        $oFCKeditor->ToolbarSet = 'ExpressoLivre';
207
208        $vars = $GLOBALS['phpgw']->preferences->user[$appname];
209
210        create_html_code("signature","<div id='text_signature'>
211                <textarea rows='5' cols='50' id='user_signature' name='user[signature]'>","</textarea></div>
212                <div style='display:none;' id='html_signature'>".$oFCKeditor->Create()."</div>
213                <script language='javascript'>
214document.getElementById('user_signature').value  = '".$vars['signature']."';
215function changeType(value){
216        var html_signature = FCKeditorAPI.GetInstance(\"html_signature\");
217        if(value == 'text'){
218                document.getElementById('user_signature').value = html_signature.GetHTML();
219                document.getElementById(\"text_signature\").style.display = '';
220                document.getElementById(\"html_signature\").style.display = 'none';
221        }
222        else if(value == 'html'){
223                html_signature.SetHTML(document.getElementById('user_signature').value);
224                document.getElementById(\"text_signature\").style.display = 'none';
225                document.getElementById(\"html_signature\").style.display  = '';
226        }
227}
228function get_html_translation_table(table, quote_style) {
229    // http://kevin.vanzonneveld.net
230    var entities = {}, hash_map = {}, decimal = 0, symbol = '';
231    var constMappingTable = {}, constMappingQuoteStyle = {};
232    var useTable = {}, useQuoteStyle = {};
233    // Translate arguments
234    constMappingTable[0]      = 'HTML_SPECIALCHARS';
235    constMappingTable[1]      = 'HTML_ENTITIES';
236    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
237    constMappingQuoteStyle[2] = 'ENT_COMPAT';
238    constMappingQuoteStyle[3] = 'ENT_QUOTES';
239 
240    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
241    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
242 
243    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
244        throw new Error(\"Table: \"+useTable+' not supported');
245        // return false;
246    }
247 
248    entities['38'] = '&amp;';
249    if (useTable === 'HTML_ENTITIES') {
250        entities['160'] = '&nbsp;';
251        entities['161'] = '&iexcl;';
252        entities['162'] = '&cent;';
253        entities['163'] = '&pound;';
254        entities['164'] = '&curren;';
255        entities['165'] = '&yen;';
256        entities['166'] = '&brvbar;';
257        entities['167'] = '&sect;';
258        entities['168'] = '&uml;';
259        entities['169'] = '&copy;';
260        entities['170'] = '&ordf;';
261        entities['171'] = '&laquo;';
262        entities['172'] = '&not;';
263        entities['173'] = '&shy;';
264        entities['174'] = '&reg;';
265        entities['175'] = '&macr;';
266        entities['176'] = '&deg;';
267        entities['177'] = '&plusmn;';
268        entities['178'] = '&sup2;';
269        entities['179'] = '&sup3;';
270        entities['180'] = '&acute;';
271        entities['181'] = '&micro;';
272        entities['182'] = '&para;';
273        entities['183'] = '&middot;';
274        entities['184'] = '&cedil;';
275        entities['185'] = '&sup1;';
276        entities['186'] = '&ordm;';
277        entities['187'] = '&raquo;';
278        entities['188'] = '&frac14;';
279        entities['189'] = '&frac12;';
280        entities['190'] = '&frac34;';
281        entities['191'] = '&iquest;';
282        entities['192'] = '&Agrave;';
283        entities['193'] = '&Aacute;';
284        entities['194'] = '&Acirc;';
285        entities['195'] = '&Atilde;';
286        entities['196'] = '&Auml;';
287        entities['197'] = '&Aring;';
288        entities['198'] = '&AElig;';
289        entities['199'] = '&Ccedil;';
290        entities['200'] = '&Egrave;';
291        entities['201'] = '&Eacute;';
292        entities['202'] = '&Ecirc;';
293        entities['203'] = '&Euml;';
294        entities['204'] = '&Igrave;';
295        entities['205'] = '&Iacute;';
296        entities['206'] = '&Icirc;';
297        entities['207'] = '&Iuml;';
298        entities['208'] = '&ETH;';
299        entities['209'] = '&Ntilde;';
300        entities['210'] = '&Ograve;';
301        entities['211'] = '&Oacute;';
302        entities['212'] = '&Ocirc;';
303        entities['213'] = '&Otilde;';
304        entities['214'] = '&Ouml;';
305        entities['215'] = '&times;';
306        entities['216'] = '&Oslash;';
307        entities['217'] = '&Ugrave;';
308        entities['218'] = '&Uacute;';
309        entities['219'] = '&Ucirc;';
310        entities['220'] = '&Uuml;';
311        entities['221'] = '&Yacute;';
312        entities['222'] = '&THORN;';
313        entities['223'] = '&szlig;';
314        entities['224'] = '&agrave;';
315        entities['225'] = '&aacute;';
316        entities['226'] = '&acirc;';
317        entities['227'] = '&atilde;';
318        entities['228'] = '&auml;';
319        entities['229'] = '&aring;';
320        entities['230'] = '&aelig;';
321        entities['231'] = '&ccedil;';
322        entities['232'] = '&egrave;';
323        entities['233'] = '&eacute;';
324        entities['234'] = '&ecirc;';
325        entities['235'] = '&euml;';
326        entities['236'] = '&igrave;';
327        entities['237'] = '&iacute;';
328        entities['238'] = '&icirc;';
329        entities['239'] = '&iuml;';
330        entities['240'] = '&eth;';
331        entities['241'] = '&ntilde;';
332        entities['242'] = '&ograve;';
333        entities['243'] = '&oacute;';
334        entities['244'] = '&ocirc;';
335        entities['245'] = '&otilde;';
336        entities['246'] = '&ouml;';
337        entities['247'] = '&divide;';
338        entities['248'] = '&oslash;';
339        entities['249'] = '&ugrave;';
340        entities['250'] = '&uacute;';
341        entities['251'] = '&ucirc;';
342        entities['252'] = '&uuml;';
343        entities['253'] = '&yacute;';
344        entities['254'] = '&thorn;';
345        entities['255'] = '&yuml;';
346    }
347    if (useQuoteStyle !== 'ENT_NOQUOTES') {
348        entities['34'] = '&quot;';
349    }
350    if (useQuoteStyle === 'ENT_QUOTES') {
351        entities['39'] = '&#39;';
352    }
353    entities['60'] = '&lt;';
354    entities['62'] = '&gt;';
355 
356    // ascii decimals to real symbols
357    for (decimal in entities) {
358        symbol = String.fromCharCode(decimal);
359        hash_map[symbol] = entities[decimal];
360    }
361    return hash_map;
362}
363function html_entity_decode( string, quote_style ) {
364    // http://kevin.vanzonneveld.net
365    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
366    tmp_str = string.toString();
367    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
368        return false;
369    }
370    for (symbol in hash_map) {
371        entity = hash_map[symbol];
372        tmp_str = tmp_str.split(entity).join(symbol);
373    }
374    tmp_str = tmp_str.split('&#039;').join(\"'\");
375    return tmp_str;
376}
377
378function config_form(pObj,pHandler)
379{
380        pObj.onclick=function () { if (document.getElementsByName(\"user[type_signature]\")[0].value == \"html\") return pHandler(\"text\") };
381}
382document.getElementById('user_signature').value=html_entity_decode(document.getElementById('user_signature').innerHTML);
383
384setTimeout('config_form(document.getElementsByName(\'submit\')[0],changeType);changeType(document.getElementsByName(\'user[type_signature]\')[0].value==\'html\'?\'html\':\'\')',2000);
385</script>");
386}
387?>
Note: See TracBrowser for help on using the repository browser.