source: sandbox/expressoMail1_2/corretor_ortografico/preferences.php @ 1121

Revision 1121, 25.0 KB checked in by eduardoalex, 15 years ago (diff)

Ticket #548 - Implementação do Expresso (Mail) Offline

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