phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: email/inc class.boindex.inc.php,1.21,1.22 class.


From: Angelo Tony Puglisi <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.boindex.inc.php,1.21,1.22 class.bopreferences.inc.php,1.10,1.11 class.mail_msg_base.inc.php,1.63,1.64 class.uipreferences.inc.php,1.10,1.11 hook_preferences.inc.php,1.9,1.10
Date: Wed, 16 Jan 2002 06:53:21 -0500

Update of /cvsroot/phpgroupware//email/inc
In directory subversions:/tmp/cvs-serv591/email/inc

Modified Files:
        class.boindex.inc.php class.bopreferences.inc.php 
        class.mail_msg_base.inc.php class.uipreferences.inc.php 
        hook_preferences.inc.php 
Log Message:
make ui and code for adding unlimited extra email accounts

Index: class.boindex.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.boindex.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.boindex.inc.php       14 Jan 2002 20:51:37 -0000      1.21
--- class.boindex.inc.php       16 Jan 2002 11:53:18 -0000      1.22
***************
*** 414,421 ****
                        // FIXME
                        // multiple account maintenance - not yet implemented
                        $this->xi['accounts_link'] = $GLOBALS['phpgw']->link(
                                                                '/index.php',
!                                                                
'menuaction=email.uipreferences.ex_accounts'
!                                                               .'&acctnum=1');
                        $this->xi['accounts_href'] = '<a 
href="'.$this->xi['accounts_link'].'">'.$this->xi['accounts_txt'].'</a>';
                        
--- 414,424 ----
                        // FIXME
                        // multiple account maintenance - not yet implemented
+                       //$this->xi['accounts_link'] = $GLOBALS['phpgw']->link(
+                       //                                      '/index.php',
+                       //                                       
'menuaction=email.uipreferences.ex_accounts'
+                       //                                      .'&acctnum=1');
                        $this->xi['accounts_link'] = $GLOBALS['phpgw']->link(
                                                                '/index.php',
!                                                                
'menuaction=email.uipreferences.ex_accounts_list');
                        $this->xi['accounts_href'] = '<a 
href="'.$this->xi['accounts_link'].'">'.$this->xi['accounts_txt'].'</a>';
                        

Index: class.bopreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.bopreferences.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.bopreferences.inc.php 10 Jan 2002 10:04:41 -0000      1.10
--- class.bopreferences.inc.php 16 Jan 2002 11:53:18 -0000      1.11
***************
*** 20,24 ****
                        'init_available_prefs' => True,
                        'grab_set_prefs' => True,
!                       'ex_accounts' => True
                );
                var $not_set='-1';
--- 20,26 ----
                        'init_available_prefs' => True,
                        'grab_set_prefs' => True,
!                       'ex_accounts_edit' => True,
!                       'ex_accounts_list' => True,
[...1171 lines suppressed...]
+                       if ( (!isset($prelim_acctnum))
+                       || ($prelim_acctnum == $this->add_new_account_token)
+                       || ($prelim_acctnum == '##NOTHING##')
+                       || ((string)$prelim_acctnum == '')
+                       || ((string)$prelim_acctnum == '0') )
+                       {
+                               // get the next blank acctnum
+                               $final_acctnum = 
$this->get_first_empty_ex_acctnum();
+                       }
+                       else
+                       {
+                               $final_acctnum = $prelim_acctnum;
+                       }
+                       if ($this->debug_set_prefs > 0) { echo 
'email.bopreferences.obtain_ex_acctnum: LEAVING, returning $final_acctnum: 
['.serialize($final_acctnum).'] <br>'; }
+                       return $final_acctnum;
+               }
+ 
+ 
        }
  ?>

Index: class.mail_msg_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_base.inc.php,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -r1.63 -r1.64
*** class.mail_msg_base.inc.php 15 Jan 2002 07:40:36 -0000      1.63
--- class.mail_msg_base.inc.php 16 Jan 2002 11:53:18 -0000      1.64
***************
*** 360,368 ****
                        
                        // *update* "folder" obtains it's value from (1) 
args_array, (2) fldball, (3) msgball, (4) default "INBOX"
!                       'folder'
                        
                        // which email account is the object of this operation
                        // *update* now in fldball
                        //'acctnum',
                        );
                
--- 360,370 ----
                        
                        // *update* "folder" obtains it's value from (1) 
args_array, (2) fldball, (3) msgball, (4) default "INBOX"
!                       'folder',
                        
                        // which email account is the object of this operation
                        // *update* now in fldball
                        //'acctnum',
+                       // all preference handling of extra accounts passes 
this as the account number "ex" = "extra"
+                       'ex_acctnum'
                        );
                
***************
*** 630,637 ****
                        // array_extra_accounts[X]['acctnum'] : integer
                        // array_extra_accounts[X]['status'] string = "enabled" 
| "disabled" | "empty"
-                       // NOTE: WHY does this cause this error *even* WHEN IT 
IS AN ARRAY?:
-                       //      Warning: Variable passed to each() is not an 
array or object in /phpgroupware/email/inc/class.mail_msg_base.inc.php on line 
661
                        //while(list($key,$value) = 
each($tmp_prefs['email']['ex_accounts']))
!                       while(list($key,$value) = 
@each($tmp_prefs['email']['ex_accounts']))
                        {
                                if ($this->debug_logins > 1) { echo 'mail_msg: 
begin_request: inside loop: for each $tmp_prefs[email][ex_accounts] ; $key: 
['.serialize($key).'] $value: ['.serialize($value).']<br>';}
--- 632,637 ----
                        // array_extra_accounts[X]['acctnum'] : integer
                        // array_extra_accounts[X]['status'] string = "enabled" 
| "disabled" | "empty"
                        //while(list($key,$value) = 
each($tmp_prefs['email']['ex_accounts']))
!                       while(list($key,$value) = 
each($tmp_prefs['email']['ex_accounts']))
                        {
                                if ($this->debug_logins > 1) { echo 'mail_msg: 
begin_request: inside loop: for each $tmp_prefs[email][ex_accounts] ; $key: 
['.serialize($key).'] $value: ['.serialize($value).']<br>';}
***************
*** 671,682 ****
                                        // run thru the create prefs function 
requesting this particular acctnum
                                        // fills in certain missing data, and 
does some sanity checks, and any data processing that may be necessary
!                                       $tmp_prefs = array();
                                        // we "fool" create_email_preferences 
into processing extra account info as if it were top level data
                                        // by specifing the secong function arg 
as the integer of this particular enabled account
                                        $this_ex_acctnum = 
$this->extra_accounts[$next_pos]['acctnum'];
                                        if ($this->debug_logins > 1) { echo 
'mail_msg: begin_request: about to call create_email_preferences("", 
$this_ex_acctnum) where $this_ex_acctnum: ['.serialize($this_ex_acctnum).'] 
<br>'; }
!                                       $tmp_prefs = 
$GLOBALS['phpgw']->preferences->create_email_preferences('', $this_ex_acctnum);
                                        // now put these processed prefs in the 
correct location  in our prefs array
!                                       
$this->set_pref_array($tmp_prefs['email'], $this_ex_acctnum);
                                }
                        }
--- 671,682 ----
                                        // run thru the create prefs function 
requesting this particular acctnum
                                        // fills in certain missing data, and 
does some sanity checks, and any data processing that may be necessary
!                                       $sub_tmp_prefs = array();
                                        // we "fool" create_email_preferences 
into processing extra account info as if it were top level data
                                        // by specifing the secong function arg 
as the integer of this particular enabled account
                                        $this_ex_acctnum = 
$this->extra_accounts[$next_pos]['acctnum'];
                                        if ($this->debug_logins > 1) { echo 
'mail_msg: begin_request: about to call create_email_preferences("", 
$this_ex_acctnum) where $this_ex_acctnum: ['.serialize($this_ex_acctnum).'] 
<br>'; }
!                                       $sub_tmp_prefs = 
$GLOBALS['phpgw']->preferences->create_email_preferences('', $this_ex_acctnum);
                                        // now put these processed prefs in the 
correct location  in our prefs array
!                                       
$this->set_pref_array($sub_tmp_prefs['email'], $this_ex_acctnum);
                                }
                        }

Index: class.uipreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.uipreferences.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.uipreferences.inc.php 14 Jan 2002 20:51:38 -0000      1.10
--- class.uipreferences.inc.php 16 Jan 2002 11:53:18 -0000      1.11
***************
*** 18,22 ****
                var $public_functions = array(
                        'preferences' => True,
!                       'ex_accounts' => True
                );
  
--- 18,23 ----
                var $public_functions = array(
                        'preferences' => True,
!                       'ex_accounts_edit' => True,
!                       'ex_accounts_list' => True
                );
  
***************
*** 141,145 ****
                                        // modify the items id in the html form 
so it contains info about thich acctnum it applies to
                                        //$html_pref_id = 
'1['.$this_item['id'].']';
!                                       $html_pref_id = 
'1['.$this_item['id'].']';
                                        
$GLOBALS['phpgw']->template->set_var('pref_id', $html_pref_id);
                                }
--- 142,147 ----
                                        // modify the items id in the html form 
so it contains info about thich acctnum it applies to
                                        //$html_pref_id = 
'1['.$this_item['id'].']';
!                                       //$html_pref_id = 
'1['.$this_item['id'].']';
!                                       $html_pref_id = 
$this->bo->acctnum.'['.$this_item['id'].']';
                                        
$GLOBALS['phpgw']->template->set_var('pref_id', $html_pref_id);
                                }
***************
*** 353,367 ****
                
                /*!
!               @function ex_accounts
                @abstract call this function to display the typical UI html 
page Extra Email Accounts Preferences
                @author Angles, skeeter
                @access Public
                */
!               function ex_accounts()
                {
                        // this tells "create_prefs_block" that we are dealing 
with the extra email accounts
                        $this->bo->account_group = 'extra_accounts';
                        // FIXME: need a real way to determine this
!                       $this->bo->acctnum = 1;
                        
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
--- 355,370 ----
                
                /*!
!               @function ex_accounts_edit
                @abstract call this function to display the typical UI html 
page Extra Email Accounts Preferences
                @author Angles, skeeter
                @access Public
                */
!               function ex_accounts_edit()
                {
                        // this tells "create_prefs_block" that we are dealing 
with the extra email accounts
                        $this->bo->account_group = 'extra_accounts';
                        // FIXME: need a real way to determine this
!                       $acctnum = $this->bo->obtain_ex_acctnum();
!                       $this->bo->acctnum = $acctnum;
                        
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
***************
*** 385,396 ****
                        
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_tr_checkbox','V_tr_checkbox');
                        
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_submit_btn_only','V_submit_btn_only');
!                       
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_submit_and_delete_btns','V_submit_and_delete_btns');
                        
                        $var = Array(
                                'pref_errors'           => '',
!                               'page_title'            => lang('E-Mail 
preferences'),
                                'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',
                                        Array(
!                                               'menuaction'    => 
'email.bopreferences.ex_accounts'
                                        )
                                ),
--- 388,399 ----
                        
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_tr_checkbox','V_tr_checkbox');
                        
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_submit_btn_only','V_submit_btn_only');
!                       
$GLOBALS['phpgw']->template->set_block('T_pref_blocks','B_submit_and_cancel_btns','V_submit_and_cancel_btns');
                        
                        $var = Array(
                                'pref_errors'           => '',
!                               'page_title'            => lang('E-Mail'.' : 
'.lang('Extra Accounts')),
                                'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',
                                        Array(
!                                               'menuaction'    => 
'email.bopreferences.ex_accounts_edit'
                                        )
                                ),
***************
*** 399,407 ****
                                'right_col_width'       => '50%',
                                'checked_flag'          => 'True',
                                // this says we are submitting extra acount 
pref data
                                'btn_submit_name'       => 
$this->bo->submit_token_extra_accounts,
                                'btn_submit_value'      => lang('submit'),
!                               'btn_delete_name'       => 
$this->bo->submit_token_delete_ex_account,
!                               'btn_delete_value'      => lang('delete 
account')
                        );
                        $GLOBALS['phpgw']->template->set_var($var);
--- 402,417 ----
                                'right_col_width'       => '50%',
                                'checked_flag'          => 'True',
+                               'ex_acctnum_varname'    => 'ex_acctnum',
+                               'ex_acctnum_value'      => $this->bo->acctnum,
                                // this says we are submitting extra acount 
pref data
                                'btn_submit_name'       => 
$this->bo->submit_token_extra_accounts,
                                'btn_submit_value'      => lang('submit'),
!                               'btn_cancel_name'       => 'cancel',
!                               'btn_cancel_value'      => lang('cancel'),
!                               'btn_cancel_url'        => 
$GLOBALS['phpgw']->link('/index.php',
!                                       Array(
!                                               'menuaction'    => 
'email.uipreferences.ex_accounts_list'
!                                       )
!                               )
                        );
                        $GLOBALS['phpgw']->template->set_var($var);
***************
*** 442,453 ****
                        $prefs_ui_rows .= 
$this->create_prefs_block($this->bo->std_prefs);
                        
!                       // ---  Custom Prefs are MANDATORY for extra accounts 
---
!                       /*
!                       // instructions: leave anything blank gives the default 
value
!                       $GLOBALS['phpgw']->template->set_var('section_title', 
lang('For these items, fill only what is different from your default E-Mail 
preferences'));
                        
$GLOBALS['phpgw']->template->parse('V_tr_sec_title','B_tr_sec_title');
                        $done_widget = 
$GLOBALS['phpgw']->template->get_var('V_tr_sec_title');  
                        $prefs_ui_rows .= $done_widget;
-                       */
                        // generate Custom Prefs HTML Block
                        $prefs_ui_rows .= 
$this->create_prefs_block($this->bo->cust_prefs);
--- 452,460 ----
                        $prefs_ui_rows .= 
$this->create_prefs_block($this->bo->std_prefs);
                        
!                       // ---  Custom Prefs  ---
!                       $GLOBALS['phpgw']->template->set_var('section_title', 
lang('Custom').' '.lang('E-Mail preferences'));
                        
$GLOBALS['phpgw']->template->parse('V_tr_sec_title','B_tr_sec_title');
                        $done_widget = 
$GLOBALS['phpgw']->template->get_var('V_tr_sec_title');  
                        $prefs_ui_rows .= $done_widget;
                        // generate Custom Prefs HTML Block
                        $prefs_ui_rows .= 
$this->create_prefs_block($this->bo->cust_prefs);
***************
*** 464,469 ****
                        
                        // Submit Button with Delete Account Data button
!                       
$GLOBALS['phpgw']->template->parse('V_submit_and_delete_btns','B_submit_and_delete_btns');
!                       $submit_btn_row = 
$GLOBALS['phpgw']->template->get_var('V_submit_and_delete_btns');     
                        $GLOBALS['phpgw']->template->set_var('submit_btn_row', 
$submit_btn_row);
                        
--- 471,476 ----
                        
                        // Submit Button with Delete Account Data button
!                       
$GLOBALS['phpgw']->template->parse('V_submit_and_cancel_btns','B_submit_and_cancel_btns');
!                       $submit_btn_row = 
$GLOBALS['phpgw']->template->get_var('V_submit_and_cancel_btns');     
                        $GLOBALS['phpgw']->template->set_var('submit_btn_row', 
$submit_btn_row);
                        
***************
*** 472,475 ****
--- 479,561 ----
                }
                
+               
+               function ex_accounts_list()
+               {
+                       unset($GLOBALS['phpgw_info']['flags']['noheader']);
+                       unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       
+                       $GLOBALS['phpgw']->template->set_file(
+                               Array(
+                                       'T_prefs_ex_accounts'   => 
'class_prefs_ex_accounts.tpl'
+                               )
+                       );
+                       
$GLOBALS['phpgw']->template->set_block('T_prefs_ex_accounts','B_accts_list','V_accts_list');
+                       
+                       $var = Array(
+                               'pref_errors'           => '',
+                               'page_title'            => lang('E-Mail Extra 
Accounts').' '.lang('List'),
+                               'font'                          => 
$this->theme['font'],
+                               'tr_titles_color'       => $this->theme['th_bg']
+                       );
+                       $GLOBALS['phpgw']->template->set_var($var);
+                       
+                       $acctount_list = array();
+                       $acctount_list = $this->bo->ex_accounts_list();
+                       
+                       // here's what we get back
+                       //$acctount_list[$X]['acctnum']
+                       //$acctount_list[$X]['status']
+                       //$acctount_list[$X]['display_string']
+                       //$acctount_list[$X]['edit_url']
+                       //$acctount_list[$X]['edit_href']
+                       //$acctount_list[$X]['delete_url']
+                       //$acctount_list[$X]['delete_href']
+                       
+                       if ($this->debug) { echo 'email: 
uipreferences.ex_accounts_list: $acctount_list dump<pre>'; 
print_r($acctount_list); echo '</pre>'; }
+                       
+                       $tr_color = $this->theme['row_off'];
+                       $loops = count($acctount_list);
+                       if ($loops == 0)
+                       {
+                               $nothing = '&nbsp;';
+                               $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
+                               
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
+                               
$GLOBALS['phpgw']->template->set_var('indentity',$nothing);
+                               
$GLOBALS['phpgw']->template->set_var('status',$nothing);
+                               
$GLOBALS['phpgw']->template->set_var('edit_href',$nothing);
+                               
$GLOBALS['phpgw']->template->set_var('delete_href',$nothing);
+                               
$GLOBALS['phpgw']->template->parse('V_accts_list','B_accts_list');
+                       }
+                       else
+                       {
+                               for($i=0; $i < $loops; $i++)
+                               {
+                                       $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
+                                       
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
+                                       
$GLOBALS['phpgw']->template->set_var('indentity',$acctount_list[$i]['display_string']);
+                                       
$GLOBALS['phpgw']->template->set_var('status',$acctount_list[$i]['status']);
+                                       
$GLOBALS['phpgw']->template->set_var('edit_href',$acctount_list[$i]['edit_href']);
+                                       
$GLOBALS['phpgw']->template->set_var('delete_href',$acctount_list[$i]['delete_href']);
+                                       
$GLOBALS['phpgw']->template->parse('V_accts_list','B_accts_list', True);
+                               }
+                       }
+                       $add_new_acct_url = $GLOBALS['phpgw']->link(
+                                                                       
'/index.php',
+                                                                        
'menuaction=email.uipreferences.ex_accounts_edit'
+                                                                       
.'&ex_acctnum='.$this->bo->add_new_account_token);
+                       $add_new_acct_href = '<a 
href="'.$add_new_acct_url.'">'.lang('New Account').'</a>';
+                       
$GLOBALS['phpgw']->template->set_var('add_new_acct_href',$add_new_acct_href);
+                       
+                       $done_url = $GLOBALS['phpgw']->link(
+                                                                       
'/preferences/index.php');
+                       $done_href = '<a 
href="'.$done_url.'">'.lang('Done').'</a>';
+                       
$GLOBALS['phpgw']->template->set_var('done_href',$done_href);
+                       
+                       // output the template
+                       
$GLOBALS['phpgw']->template->pfp('out','T_prefs_ex_accounts');
+               }
        }
  ?>

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/hook_preferences.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** hook_preferences.inc.php    10 Jan 2002 10:04:41 -0000      1.9
--- hook_preferences.inc.php    16 Jan 2002 11:53:18 -0000      1.10
***************
*** 17,21 ****
        $file = Array(
                'E-Mail Preferences'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.preferences'),
!               'Extra E-Mail Accounts' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts')
        );
  //Do not modify below this line
--- 17,21 ----
        $file = Array(
                'E-Mail Preferences'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.preferences'),
!               'Extra E-Mail Accounts' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts_list')
        );
  //Do not modify below this line




reply via email to

[Prev in Thread] Current Thread [Next in Thread]