source: companies/serpro/expressoMail1_2/preferences.php @ 903

Revision 903, 23.7 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1<?php
2        /**************************************************************************/
3       
4        $GLOBALS['phpgw_info']['flags'] = array(
5                'currentapp' => 'expressoMail1_2',
6                'noheader'   => True,
7                'nonavbar'   => True,
8                'enable_nextmatchs_class' => True
9        );
10
11       
12        include('../header.inc.php');
13        include('inc/class.imap_functions.inc.php');   
14        include_once("inc/fckeditor.php");
15       
16        if (!$_POST['try_saved'])
17        {
18                // Read Config and get default values;
19               
20                $GLOBALS['phpgw']->preferences->read_repository();
21                // Loading Admin Config Module
22        $c = CreateObject('phpgwapi.config','expressoMail1_2');
23        $c->read_repository();
24        $current_config = $c->config_data; 
25               
26                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'])
27                        $GLOBALS['phpgw']->template->set_var('option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'].'_selected','selected');
28                else
29                $GLOBALS['phpgw']->template->set_var('option_50_selected','selected');         
30
31                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_deleted_msg'])         
32                        $GLOBALS['phpgw']->template->set_var('checked_save_deleted_msg','checked');
33                else
34                        $GLOBALS['phpgw']->template->set_var('checked_save_deleted_msg','');
35
36                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_trash_messages_after_n_days'])
37                        $GLOBALS['phpgw']->template->set_var('delete_trash_messages_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_trash_messages_after_n_days'].'_selected','selected');
38                else
39                        $GLOBALS['phpgw']->template->set_var('delete_trash_messages_option_0_selected','selected');             
40               
41                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_and_show_previous_message'])         
42                        $GLOBALS['phpgw']->template->set_var('checked_delete_and_show_previous_message','checked');
43                else
44                        $GLOBALS['phpgw']->template->set_var('checked_delete_and_show_previous_message','');
45
46                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_new_msg'])             
47                        $GLOBALS['phpgw']->template->set_var('checked_alert_new_msg','checked');
48                else
49                        $GLOBALS['phpgw']->template->set_var('checked_alert_new_msg','');
50
51                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['mainscreen_showmail'])
52                        $GLOBALS['phpgw']->template->set_var('checked_mainscreen_showmail','checked');
53                else
54                        $GLOBALS['phpgw']->template->set_var('checked_mainscreen_showmail','');
55
56                if (!is_numeric($current_config['expressoMail_Number_of_dynamic_contacts']))
57                {                                                                               
58                        $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','');
59                        $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','disabled');
60                }
61                else
62                {
63                        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'])
64                                $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','checked');
65                        else
66                                $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','');
67                }
68
69                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'])
70                        $GLOBALS['phpgw']->template->set_var('checked_shortcuts','checked');
71                else
72                        $GLOBALS['phpgw']->template->set_var('checked_shortcuts','');
73
74                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'])
75                        $GLOBALS['phpgw']->template->set_var('checked_auto_save_draft','checked');
76                else
77                        $GLOBALS['phpgw']->template->set_var('checked_auto_save_draft','');
78                       
79                       
80                if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar'])
81                {
82                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'])
83                        {
84                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital_cripto','checked');
85                        $GLOBALS['phpgw']->template->set_var('display_digital','');
86                        $GLOBALS['phpgw']->template->set_var('display_cripto','');
87                        }
88                else
89                        {
90                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital','');
91                        $GLOBALS['phpgw']->template->set_var('display_digital','style="display: none;"');
92                        $GLOBALS['phpgw']->template->set_var('display_cripto','style="display: none;"');               
93                        }
94                       
95                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'])
96                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital','checked');
97                else
98                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital','');
99                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'])
100                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_cripto','checked');
101                else
102                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_cripto','');                       
103                }       
104                else
105                {
106                        $GLOBALS['phpgw']->template->set_var('display_digital','style="display: none;"');
107                        $GLOBALS['phpgw']->template->set_var('display_cripto','style="display: none;"');
108                        $GLOBALS['phpgw']->template->set_var('display_digital_cripto','style="display: none;"');
109                }
110               
111               
112                // Insert new expressoMail preference use_signature: defines if the signature will be automatically inserted
113                // at the e-mail body
114                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature'])
115                        $GLOBALS['phpgw']->template->set_var('checked_use_signature','checked');
116                else
117                        $GLOBALS['phpgw']->template->set_var('checked_use_signature','');
118
119                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature'])
120                        $GLOBALS['phpgw']->template->set_var('text_signature',$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature']);
121                else
122                        $GLOBALS['phpgw']->template->set_var('text_signature','');
123               
124                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature']){
125                        $GLOBALS['phpgw']->template->set_var('type_signature_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'].'_selected','selected');
126                        $GLOBALS['phpgw']->template->set_var('type_signature_td_'.($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'] == 'html' ? 'text' : 'html'),'display:none');
127                }
128                else{
129                        $GLOBALS['phpgw']->template->set_var('type_signature_option_text_selected','selected');
130                        $GLOBALS['phpgw']->template->set_var('type_signature_td_html','display:none');
131                }
132
133                // BEGIN FCKEDITOR
134                $oFCKeditor = new FCKeditor('html_signature') ;
135                $oFCKeditor->BasePath   = 'js/fckeditor/';
136                $oFCKeditor->ToolbarSet = 'ExpressoLivre';
137                if(is_array($GLOBALS['phpgw_info']['user']['preferences']['expressoMail'])) {
138                        $oFCKeditor->Value      = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature'];
139                }
140                // First Time: The user has no preferences. If the template file exists, then it loads a default signature.
141                // See signature_example.tpl
142                elseif(file_exists($GLOBALS['phpgw']->template->root.'/signature.tpl')){
143                        $filein = fopen($GLOBALS['phpgw']->template->root.'/signature.tpl',"r");
144                        while (!feof ($filein))
145                                $oFCKeditor->Value .= fgets($filein, 1024);
146                }
147                $oFCKeditor->Value = str_replace("{full_name}",$phpgw_info['user']['fullname'],$oFCKeditor->Value);
148                $oFCKeditor->Value = str_replace("{first_name}",$phpgw_info['user']['firstname'],$oFCKeditor->Value);
149               
150                $GLOBALS['phpgw']->template->set_var('rtf_signature',$oFCKeditor->Create());
151                $GLOBALS['phpgw']->template->set_var('text_signature',strip_tags($oFCKeditor->Value));
152                // END FCKEDITOR
153                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders'])
154                        $GLOBALS['phpgw']->template->set_var('checked_menu','checked');
155                else
156                        $GLOBALS['phpgw']->template->set_var('checked_menu','');
157
158                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['line_height'])
159                        $GLOBALS['phpgw']->template->set_var('line_height_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['line_height'].'_selected','selected');
160                else
161                        $GLOBALS['phpgw']->template->set_var('line_height_option_20_selected','selected');
162               
163                if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['font_size'])
164                        $GLOBALS['phpgw']->template->set_var('font_size_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['font_size'].'_selected','selected');
165                else
166                        $GLOBALS['phpgw']->template->set_var('font_size_option_11_selected','selected');
167               
168                if($current_config['enable_local_messages']!='True') {
169                        $GLOBALS['phpgw']->template->set_var('open_comment_local_messages_config',"<!--");
170                        $GLOBALS['phpgw']->template->set_var('close_comment_local_messages_config',"-->");
171                }
172                else {
173                        $GLOBALS['phpgw']->template->set_var('open_comment_local_messages_config'," ");
174                        $GLOBALS['phpgw']->template->set_var('close_comment_local_messages_config'," ");
175                }
176               
177                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
178                        $GLOBALS['phpgw']->template->set_var('use_local_messages_option_Yes_selected','selected');
179                else {
180                        $GLOBALS['phpgw']->template->set_var('use_local_messages_option_No_selected','');
181                        $GLOBALS['phpgw']->template->set_var('use_local_messages_option_Yes_selected','');
182                }
183               
184                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'])
185                        $GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_Yes_selected','selected');
186                else {
187                        $GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_No_selected','');
188                        $GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_Yes_selected','');
189                }               
190               
191        }
192        else //Save Config
193        {
194                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'])
195                        $GLOBALS['phpgw']->preferences->change('expressoMail','max_email_per_page',$_POST['max_emails_per_page']);
196                else
197                        $GLOBALS['phpgw']->preferences->add('expressoMail','max_email_per_page',$_POST['max_emails_per_page']);
198               
199                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_deleted_msg'])
200                        $GLOBALS['phpgw']->preferences->change('expressoMail','save_deleted_msg',$_POST['save_deleted_msg']);
201                else
202                        $GLOBALS['phpgw']->preferences->add('expressoMail','save_deleted_msg',$_POST['save_deleted_msg']);
203
204                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_trash_messages_after_n_days'])
205                        $GLOBALS['phpgw']->preferences->change('expressoMail','delete_trash_messages_after_n_days',$_POST['delete_trash_messages_after_n_days']);
206                else
207                        $GLOBALS['phpgw']->preferences->add('expressoMail','delete_trash_messages_after_n_days',$_POST['delete_trash_messages_after_n_days']);
208
209                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_and_show_previous_message'])
210                        $GLOBALS['phpgw']->preferences->change('expressoMail','delete_and_show_previous_message',$_POST['delete_and_show_previous_message']);
211                else
212                        $GLOBALS['phpgw']->preferences->add('expressoMail','delete_and_show_previous_message',$_POST['delete_and_show_previous_message']);
213               
214                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_new_msg'])
215                        $GLOBALS['phpgw']->preferences->change('expressoMail','alert_new_msg',$_POST['alert_new_msg']);
216                else
217                        $GLOBALS['phpgw']->preferences->add('expressoMail','alert_new_msg',$_POST['alert_new_msg']);
218
219                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['mainscreen_showmail'])
220                        $GLOBALS['phpgw']->preferences->change('expressoMail','mainscreen_showmail',$_POST['mainscreen_showmail']);
221                else
222                        $GLOBALS['phpgw']->preferences->add('expressoMail','mainscreen_showmail',$_POST['mainscreen_showmail']);
223
224                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] == "0")
225                {                                                                               
226                        $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','');
227                        $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','disabled');
228                }
229                else
230                {
231                        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'])
232                        {
233                                $GLOBALS['phpgw']->preferences->change('expressoMail','use_dynamic_contacts',$_POST['use_dynamic_contacts']);
234                                if($_POST['use_dynamic_contacts'] == '')
235                                {
236                                        $contacts = CreateObject('expressoMail1_2.dynamic_contacts');
237                                        $contacts->delete_dynamic_contacts();
238                                }
239                        }
240                        else
241                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_dynamic_contacts',$_POST['use_dynamic_contacts']);
242                }
243
244                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'])
245                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_shortcuts',$_POST['use_shortcuts']);
246                else
247                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_shortcuts',$_POST['use_shortcuts']);
248                       
249                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'])
250                        $GLOBALS['phpgw']->preferences->change('expressoMail','auto_save_draft',$_POST['auto_save_draft']);
251                else
252                        $GLOBALS['phpgw']->preferences->add('expressoMail','auto_save_draft',$_POST['auto_save_draft']);       
253
254                if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar'])
255                {
256                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'])
257                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_digital_cripto',$_POST['use_signature_digital_cripto']);
258                else
259                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_digital_cripto',$_POST['use_signature_digital_cripto']);
260                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'])
261                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_digital',$_POST['use_signature_digital']);
262                else
263                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_digital',$_POST['use_signature_digital']);
264                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'])
265                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_cripto',$_POST['use_signature_cripto']);
266                else
267                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_cripto',$_POST['use_signature_cripto']);                     
268                }       
269                // Insert new expressoMail preference use_signature: defines if the signature will be automatically inserted
270                // at the e-mail body
271                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature'])
272                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature',$_POST['use_signature']);
273                else
274                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature',$_POST['use_signature']);
275
276                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature'])
277                        $GLOBALS['phpgw']->preferences->change('expressoMail','signature',$_POST['signature']);
278                else
279                        $GLOBALS['phpgw']->preferences->add('expressoMail','signature',$_POST['signature']);
280
281                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'])
282                        $GLOBALS['phpgw']->preferences->change('expressoMail','type_signature',$_POST['type_signature']);
283                else
284                        $GLOBALS['phpgw']->preferences->add('expressoMail','type_signature',$_POST['type_signature']);
285
286                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders'])
287                        $GLOBALS['phpgw']->preferences->change('expressoMail','hide_folders',$_POST['check_menu']);
288                else
289                        $GLOBALS['phpgw']->preferences->add('expressoMail','hide_folders',$_POST['check_menu']);
290                       
291                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'])
292                        $GLOBALS['phpgw']->preferences->change('expressoMail','save_in_folder',$_POST['save_in_folder']);
293                else
294                        $GLOBALS['phpgw']->preferences->add('expressoMail','save_in_folder',$_POST['save_in_folder']);
295
296                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['line_height'])
297                        $GLOBALS['phpgw']->preferences->change('expressoMail','line_height',$_POST['line_height']);
298                else
299                        $GLOBALS['phpgw']->preferences->add('expressoMail','line_height',$_POST['line_height']);
300               
301                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['font_size'])
302                        $GLOBALS['phpgw']->preferences->change('expressoMail','font_size',$_POST['font_size']);
303                else
304                        $GLOBALS['phpgw']->preferences->add('expressoMail','font_size',$_POST['font_size']);           
305                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
306                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_local_messages',$_POST['use_local_messages']);
307                else
308                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_local_messages',$_POST['use_local_messages']);
309                       
310                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'])
311                        $GLOBALS['phpgw']->preferences->change('expressoMail','keep_archived_messages',$_POST['keep_archived_messages']);
312                else
313                        $GLOBALS['phpgw']->preferences->add('expressoMail','keep_archived_messages',$_POST['keep_archived_messages']);                 
314
315                $GLOBALS['phpgw']->preferences->save_repository();
316               
317                // Back to preferences.
318                $url = ($GLOBALS['phpgw']->link('/'.'expressoMail1_2'.'/index.php'));
319                $GLOBALS['phpgw']->redirect($url);
320        }
321       
322        $GLOBALS['phpgw']->common->phpgw_header();
323        print parse_navbar();
324
325        $GLOBALS['phpgw']->template->set_file(array(
326                'expressoMail_prefs' => 'preferences.tpl'
327        ));
328
329        $GLOBALS['phpgw']->template->set_var('lang_config_expressoMail',lang('Config for ExpressoMail'));
330        $GLOBALS['phpgw']->template->set_var('lang_max_emails_per_page',lang('What is the maximum number of messages per page?'));
331        $GLOBALS['phpgw']->template->set_var('lang_save_deleted_msg',lang('Save deleted messages in trash folder?'));
332        $GLOBALS['phpgw']->template->set_var('lang_delete_trash_messages_after_n_days',lang('Delete trash messages after how many days?'));
333        $GLOBALS['phpgw']->template->set_var('lang_delete_and_show_previous_message',lang('Show previous message, after delete actual message?'));
334        $GLOBALS['phpgw']->template->set_var('lang_alert_new_msg',lang('Do you wanna receive an alert for new messages?'));
335        $GLOBALS['phpgw']->template->set_var('lang_hook_home',lang('Show default view on main screen?'));
336        $GLOBALS['phpgw']->template->set_var('lang_save_in_folder',lang('Save sent messages in folder'));
337        $GLOBALS['phpgw']->template->set_var('lang_hide_menu',lang('Hide menu folders?'));
338        $GLOBALS['phpgw']->template->set_var('lang_line_height',lang('What is the height of the lines in the list of messages?'));
339        $GLOBALS['phpgw']->template->set_var('lang_font_size',lang('What the font size in the list of messages?'));
340        $GLOBALS['phpgw']->template->set_var('lang_use_dynamic_contacts',lang('Use dynamic contacts?'));
341        $GLOBALS['phpgw']->template->set_var('lang_use_shortcuts',lang('Use shortcuts?'));
342        $GLOBALS['phpgw']->template->set_var('lang_auto_save_draft',lang('Auto save draft'));
343        $GLOBALS['phpgw']->template->set_var('lang_signature',lang('Signature'));
344        $GLOBALS['phpgw']->template->set_var('lang_none',lang('None'));
345        $GLOBALS['phpgw']->template->set_var('one_day',lang('1 Day'));
346        $GLOBALS['phpgw']->template->set_var('two_days',lang('2 Days'));
347        $GLOBALS['phpgw']->template->set_var('three_days',lang('3 Days'));
348        $GLOBALS['phpgw']->template->set_var('four_days',lang('4 Days'));
349        $GLOBALS['phpgw']->template->set_var('five_days',lang('5 Day'));
350        $GLOBALS['phpgw']->template->set_var('small',lang('Small'));
351        $GLOBALS['phpgw']->template->set_var('medium',lang('Medium'));
352        $GLOBALS['phpgw']->template->set_var('normal',lang('Normal'));
353        $GLOBALS['phpgw']->template->set_var('simple_text',lang('Simple Text'));
354        $GLOBALS['phpgw']->template->set_var('html_text',lang('Rich Text'));
355        $GLOBALS['phpgw']->template->set_var('lang_config_signature',lang('Signature Configuration'));
356        $GLOBALS['phpgw']->template->set_var('lang_type_signature',lang('Signature type'));
357        $GLOBALS['phpgw']->template->set_var('big',lang('Big'));
358        //$GLOBALS['phpgw']->template->set_var('lang_use_signature_digital_cripto',lang('Possibilitar <b>assinar/criptografar</b> digitalmente a mensagem?'));
359        $GLOBALS['phpgw']->template->set_var('lang_use_signature_digital_cripto',lang('Enable digitally sign/cipher the message?'));
360        $GLOBALS['phpgw']->template->set_var('lang_use_signature_digital',lang('Always sign message digitally?'));
361        $GLOBALS['phpgw']->template->set_var('lang_use_signature_cripto',lang('Always cipher message digitally?'));
362        $GLOBALS['phpgw']->template->set_var('lang_use_signature',lang('Insert signature automatically in new messages?'));     
363        $GLOBALS['phpgw']->template->set_var('lang_signature',lang('Signature'));
364        $GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_keep_archived_messages_?',lang('Would you like to keep archived messages?'));
365        $GLOBALS['phpgw']->template->set_var('lang_Yes',lang('Yes'));
366        $GLOBALS['phpgw']->template->set_var('lang_No',lang('No'));
367        $GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_use_local_messages_?',lang('Would you like to use local messages?'));
368
369        $boemailadmin   = CreateObject('emailadmin.bo');
370        $emailadmin_profile = $boemailadmin->getProfileList();
371        $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
372        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
373        $e_server = $_SESSION['phpgw_info']['expressomail']['email_server'];
374        $imap = CreateObject('expressoMail1_2.imap_functions');
375        $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'];     
376        // Load Special Folders (Sent, Trash, Draft, Spam) from EmailAdmin (if exists, else get_lang)
377        $specialFolders = array ("Trash" => "Trash", "Drafts" => "Drafts", "Spam" => "Spam", "Sent" => "Sent");
378        foreach ($specialFolders as $key => $value){
379                if($e_server['imapDefault'.$key.'Folder'])
380                        $specialFolders[$key] = $e_server['imapDefault'.$key.'Folder'];
381        }       
382        // First access on ExpressoMail, load default preferences...
383        if(!$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']) {
384                $GLOBALS['phpgw']->template->set_var('checked_save_deleted_msg','checked');
385                $GLOBALS['phpgw']->template->set_var('checked_delete_and_show_previous_message','checked');
386                $GLOBALS['phpgw']->template->set_var('checked_alert_new_msg','checked');
387                $GLOBALS['phpgw']->template->set_var('checked_dynamic_contacts','checked');
388                $GLOBALS['phpgw']->template->set_var('checked_use_signature','checked');
389                $GLOBALS['phpgw']->template->set_var('checked_mainscreen_showmail','checked');
390                $save_in_folder_selected = "INBOX".$e_server['imapDelimiter'].$specialFolders["Sent"];
391        }
392        $o_folders = "<option value='-1' ".(!$save_in_folder_selected ? 'selected' : '' ).">".lang("Select on send")."</option>";       
393        foreach($imap -> get_folders_list() as $id => $folder){
394                // Ignores numeric indexes and shared folders....
395                if(!is_numeric($id) || (strstr($folder['folder_id'],"user".$e_server['imapDelimiter'])))
396                        continue;
397                // Translate INBOX (root folder)
398                elseif (strtolower($folder['folder_name']) == "inbox")
399                        $folder['folder_name'] = lang("Inbox");
400                // Translate Special Folders
401                elseif (($keyFolder = array_search($folder['folder_name'], $specialFolders)) !== false)
402                        $folder['folder_name'] = lang($keyFolder);
403                // Identation for subfolders
404                $folder_id = explode($e_server['imapDelimiter'],$folder['folder_id']);         
405                $level = count($folder_id);
406                $ident = '';
407                for($i = 2; $level > 2 && $i < $level;$i++)
408                        $ident .= ' - ';
409                $o_folders.= "<option value='".$folder['folder_id']."' ".($save_in_folder_selected == $folder['folder_id'] ? 'selected' : '' ).">".$ident.$folder['folder_name']."</option>";                   
410        }
411
412        $GLOBALS['phpgw']->template->set_var('value_save_in_folder',$o_folders);
413        $GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
414        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
415       
416        $GLOBALS['phpgw']->template->set_var('save_action',$GLOBALS['phpgw']->link('/'.'expressoMail1_2'.'/preferences.php'));
417        $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']["theme"][th_bg]);
418
419        $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
420        $GLOBALS['phpgw']->template->set_var('tr_color1',$GLOBALS['phpgw_info']['theme']['row_on']);
421        $GLOBALS['phpgw']->template->set_var('tr_color2',$GLOBALS['phpgw_info']['theme']['row_off']);
422
423        $GLOBALS['phpgw']->template->parse('out','expressoMail_prefs',True);
424        $GLOBALS['phpgw']->template->p('out');
425        // Com o Mï¿œdulo do IM habilitado, ocorre um erro no IE
426        //$GLOBALS['phpgw']->common->phpgw_footer();
427?>
Note: See TracBrowser for help on using the repository browser.