phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: email/inc class.bofilters.inc.php,1.3,1.4 class.


From: Angelo Tony Puglisi <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.bofilters.inc.php,1.3,1.4 class.mail_msg_base.inc.php,1.67,1.68 class.mail_msg_display.inc.php,1.34,1.35 class.mail_msg_wrappers.inc.php,1.26,1.27 class.uifilters.inc.php,1.3,1.4
Date: Wed, 23 Jan 2002 08:22:26 -0500

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

Modified Files:
        class.bofilters.inc.php class.mail_msg_base.inc.php 
        class.mail_msg_display.inc.php class.mail_msg_wrappers.inc.php 
        class.uifilters.inc.php 
Log Message:
first implementation of messages moving between different folders on different 
accounts in a filter logic loop

Index: class.bofilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.bofilters.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bofilters.inc.php     22 Jan 2002 13:16:34 -0000      1.3
--- class.bofilters.inc.php     23 Jan 2002 13:22:23 -0000      1.4
***************
*** 16,20 ****
        {
                var $public_functions = array(
!                       'process_submitted_data'        => True
                );
                
--- 16,21 ----
        {
                var $public_functions = array(
!                       'process_submitted_data'        => True,
!                       'run_single_filter'     => True
                );
                
***************
*** 103,106 ****
--- 104,143 ----
                }
                
+               function just_testing()
+               {
+                       if ((isset($GLOBALS['HTTP_POST_VARS']['filter_test']))
+                       && ((string)$GLOBALS['HTTP_POST_VARS']['filter_test'] 
!= ''))
+                       {
+                               $just_testing = True;
+                       }
+                       elseif 
((isset($GLOBALS['HTTP_GET_VARS']['filter_test']))
+                       && ((string)$GLOBALS['HTTP_GET_VARS']['filter_test'] != 
''))
+                       {
+                               $just_testing = True;
+                       }
+                       else
+                       {
+                               $just_testing = False;
+                       }
+                       return $just_testing;
+               }
+               
+               function filter_exists($feed_filter_num)
+               {
+                       if (count($this->all_filters) == 0)
+                       {
+                               $this->read_filter_data_from_prefs();
+                       }
+                       if ((isset($this->all_filters[$feed_filter_num]))
+                       && 
(isset($this->all_filters[$feed_filter_num]['source_accounts'])))
+                       {
+                               return True;
+                       }
+                       else
+                       {
+                               return False;
+                       }
+               }
+               
                function process_submitted_data()
                {
***************
*** 255,261 ****
                        // $this_filter['matches']      Array
                        // $this_filter['matches'][X]   Array
!                       // $this_filter['matches'][X]['andor']  UNSET for 
$this_filter['matches'][0], SET for all the rest
!                       // $this_filter['matches'][X]['examine']                
known_string
!                       // $this_filter['matches'][X]['comparator']     
known_string
                        // $this_filter['matches'][X]['matchthis']      
user_string
                        for ($i=0; $i < count($this_filter['matches']); $i++)
--- 292,298 ----
                        // $this_filter['matches']      Array
                        // $this_filter['matches'][X]   Array
!                       // $this_filter['matches'][X]['andor']  UNSET for 
$this_filter['matches'][0], SET for all the rest : and | or | ignore_me
!                       // $this_filter['matches'][X]['examine']                
known_string : IMAP search keys
!                       // $this_filter['matches'][X]['comparator']     
known_string : contains | notcontains
                        // $this_filter['matches'][X]['matchthis']      
user_string
                        for ($i=0; $i < count($this_filter['matches']); $i++)
***************
*** 366,376 ****
                }
                
!               function sieve_to_imap_string()
                {
!                       if ($this->debug > 2) { echo 'bofilters: 
sieve_to_imap_string: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
!                       $look_here_sieve = 
$this->filters[0]['matches'][0]['examine'];
!                       $look_here_imap = 
$this->sieve_to_imap_fields[$look_here_sieve];
!                       $for_this = 
$this->filters[0]['matches'][0]['matchthis'];
                        
                        $conv_error = '';
                        if ((!isset($look_here_sieve))
--- 403,625 ----
                }
                
!               
!               
!               function run_single_filter()
!               {
!                       if ($this->debug > 0) { echo 
'bofilters.run_single_filter: ENTERING<br>'; }
!                       if (count($this->all_filters) == 0)
!                       {
!                               $this->read_filter_data_from_prefs();
!                       }
!                       $filter_num = $this->obtain_filer_num();
!                       $filter_exists = $this->filter_exists($filter_num);
!                       if (!$filter_exists)
!                       {
!                               if ($this->debug > 0) { echo 
'bofilters.run_single_filter: LEAVING with ERROR, filter data for $filter_num 
['.$filter_num.'] does not exist, return False<br>'; }
!                               return False;
!                       }
!                       $this_filter = $this->all_filters[$filter_num];
!                       if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $filter_num ['.$filter_num.'] ; $this_filter 
DUMP:<pre>'; print_r($this_filter); echo "</pre>\r\n"; }
!                       
!                       // make the imap search string
!                       $search_str = $this->make_imap_search_str($this_filter);
!                       if ($this->debug > 1) { echo 
'bofilters.run_single_filter: loop ['.$i.'] ; 
$this->make_imap_search_str($this_filter) returns ['.$search_str.'] <br>'; }
!                       
!                       // WE NEED TO DO THIS FOR EVERY SOURCE ACCOUNT
!                       $all_accounts_result_set = array();
!                       $msgball_list = array();
!                       for ($i=0; $i < count($this_filter['source_accounts']); 
$i++)
!                       {
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: source_accounts loop ['.$i.']<br>'; }
!                               
!                               // ACCOUNT TO SEARCH (always filter source is 
INBOX)
!                               $fake_fldball = array();
!                               $fake_fldball['acctnum'] = 
$this_filter['source_accounts'][$i]['acctnum'];
!                               $fake_fldball['folder'] = 
$this_filter['source_accounts'][$i]['folder'];
!                               
!                               // FINAL DATA
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: will feed phpgw_search this $fake_fldball 
[<code>'.serialize($fake_fldball).'</code>] <br>'; }
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter:  will feed phpgw_search this $search_str 
['.$search_str.'] <br>'; }
!                               
!                               $initial_result_set = Array();
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: about to call 
$GLOBALS[phpgw]->msg->phpgw_search($fake_fldball, $search_str)<br>'; }
!                               $initial_result_set = 
$GLOBALS['phpgw']->msg->phpgw_search($fake_fldball, $search_str);
!                               // sanity check on 1 returned hit, is it for 
real?
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: server_last_error (if any) was: 
"'.$GLOBALS['phpgw']->msg->phpgw_server_last_error((int)$fake_fldball['acctnum']).'"<br>'."\r\n";
 }
!                       
!                               if (($initial_result_set == False)
!                               || (count($initial_result_set) == 0))
!                               {
!                                       if ($this->debug > 1) { echo 
'bofilters.run_single_filter: no hits or possible search error<br>'."\r\n"; }
!                                       if ($this->debug > 1) { echo 
'bofilters.run_single_filter: server_last_error (if any) was: 
"'.$GLOBALS['phpgw']->msg->phpgw_server_last_error((int)$fake_fldball['acctnum']).'"<br>'."\r\n";
 }
!                                       // we leave this->result_set_mlist an 
an empty array, as it was initialized on class creation
!                               }
!                               else
!                               {
!                                       if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $initial_result_set DUMP:<pre>'; 
print_r($initial_result_set); echo "</pre>\r\n"; }
!                                       // accumulate the results for all 
accounts
!                                       for ($x=0; $x < 
count($initial_result_set); $x++)
!                                       {
!                                               $next_pos = 
count($all_accounts_result_set);
!                                               
$all_accounts_result_set[$next_pos] = $initial_result_set[$x];
!                                               // and this has the essential 
data we'll need to move msgs around
                                                
$msgball_list[$next_pos]['acctnum'] = $fake_fldball['acctnum'];
!                                               
$msgball_list[$next_pos]['folder'] = $fake_fldball['folder'];
!                                               
$msgball_list[$next_pos]['msgnum'] = $initial_result_set[$x];
!                                               $msgball_list[$next_pos]['uri'] 
= 
!                                                        
'msgball[msgnum]='.$msgball_list[$next_pos]['msgnum']
!                                                       
.'&msgball[folder]='.$msgball_list[$next_pos]['folder']
!                                                       
.'&msgball[acctnum]='.$msgball_list[$next_pos]['acctnum'];
!                                       }
!                               }
!                       }
!                       
!                       
!                       if ((count($all_accounts_result_set > 0))
!                       && (isset($all_accounts_result_set[0]))
!                       && ((string)$all_accounts_result_set[0] != '')
!                       && ($this->just_testing()))
!                       {
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: Filter Test Run<br>'; }
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: number of matches $all_accounts_result_set = ' 
.count($all_accounts_result_set).'<br>'."\r\n"; }
!                               // make a "fake" folder_info array to make 
things simple for get_msg_list_display
!                               $this->fake_folder_info['is_imap'] = True;
!                               $this->fake_folder_info['folder_checked'] = 
'INBOX';
!                               $this->fake_folder_info['alert_string'] = 'you 
have search results';
!                               $this->fake_folder_info['number_new'] = 
count($all_accounts_result_set);
!                               $this->fake_folder_info['number_all'] = 
count($all_accounts_result_set);
!                               if ($this->debug > 2) { echo 
'bofilters.run_single_filter:  $msgball_list DUMP:<pre>'; 
print_r($msgball_list); echo "</pre>\r\n"; }
!                               // retrieve user displayable data for each 
message in the result set
!                               $this->result_set_mlist = 
$GLOBALS['phpgw']->msg->get_msg_list_display($this->fake_folder_info,$msgball_list);
!                               $html_list = $this->make_mlist_box();
!                               echo 
'<html><table>'.$html_list.'</table></html>';
!                       }
!                       elseif ((count($all_accounts_result_set > 0))
!                       && (isset($all_accounts_result_set[0]))
!                       && ((string)$all_accounts_result_set[0] != ''))
!                       {
!                               // NOT A TEST - APPLY THE ACTION(S)
!                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: NOT a Test, *Apply* the Action(s) ; 
$this_filter[actions][0][judgement] : 
['.$this_filter['actions'][0]['judgement'].']<br>'; }
!                               if ($this_filter['actions'][0]['judgement'] == 
'fileinto')
!                               {
!                                       
parse_str($this_filter['actions'][0]['folder'], $target_folder);
!                                       $target_folder['folder'] = 
urlencode($target_folder['folder']);
!                                       //if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $target_folder DUMP:<pre>'; 
print_r($target_folder); echo "</pre>\r\n"; }
!                                       $to_fldball = array();
!                                       $to_fldball['folder'] = 
$target_folder['folder'];
!                                       $to_fldball['acctnum'] = 
(int)$target_folder['acctnum'];
!                                       if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $to_fldball DUMP:<pre>'; print_r($to_fldball); 
echo "</pre>\r\n"; }
!                                       $tm = count($msgball_list);
!                                       for ($i = 0; $i < count($msgball_list); 
$i++)
!                                       {
!                                               if ($this->debug > 2) { echo 
'bofilters.run_single_filter: in mail move loop ['.(string)($i+1).'] of 
['.$tm.']<br>'; }
!                                               $mov_msgball = 
$msgball_list[$i];
!                                               if ($this->debug > 1) { echo 
'bofilters.run_single_filter: pre-move info: $mov_msgball 
[<code>'.serialize($mov_msgball).'</code>]<br>'; }
!                                               $good_to_go = 
$GLOBALS['phpgw']->msg->industrial_interacct_mail_move($mov_msgball, 
$to_fldball);
!                                               if (!$good_to_go)
!                                               {
!                                                       // ERROR
!                                                       if ($this->debug > 1) { 
echo 'bofilters.run_single_filter: ERROR: industrial_interacct_mail_move 
returns FALSE<br>'; }
!                                                       break;
!                                               }
!                                       }
!                               }
!                               else
!                               {
!                                       // not yet coded action
!                                       if ($this->debug > 1) { echo 
'bofilters.run_single_filter: action not yet coded: 
$this_filter[actions][0][judgement] : 
['.$this_filter['actions'][0]['judgement'].']<br>'; }
!                               }
!                       }
!                       else
!                       {
!                               // NO MATCHES
!                       }
!                       
!                       
!                       if ($this->debug > 1) { echo 
'bofilters.run_single_filter: calling end_request<br>'; }
!                       $GLOBALS['phpgw']->msg->end_request();
!                       if ($this->debug > 0) { echo 
'bofilters.run_single_filter: LEAVING<br>'; }
!                       $take_me_to_url = $GLOBALS['phpgw']->link(
!                                                                               
'/index.php',
!                                                                               
'menuaction=email.uifilters.filters_list');
!                                                                               
!                       $take_me_to_href = '<a href="'.$take_me_to_url.'"> Go 
Back </a>';
!                       //Header('Location: ' . $take_me_to_url);
!                       echo '<p>&nbsp;</p><br><p>'.$take_me_to_href.'</p>';
!               }
!               
!               
!               
!               function make_imap_search_str($feed_filter)
                {
!                       if ($this->debug > 0) { echo 
'bofilters.make_imap_search_str: ENTERING<br>'; }
!                       if ($this->debug > 2) { echo 
'bofilters.make_imap_search_str: $feed_filter DUMP:<pre>'; 
print_r($feed_filter); echo "</pre>\r\n"; }
!                       /*
!                       examples of how to construct IMAP search strings
!                       From a google search in a "turnpike" newsgroup:
!                       
!                       IMAP's [AND] OR and NOT are all prefix operators, i.e. 
there is no 
!                       precedence or hierarchy (I put the [AND] in brackets as 
it is implied, 
!                       there is no AND keyword).
! 
!                       [AND] and OR operate on the next two search-keys.
!                       NOT operates on the next search-key.
!                       
!                       Parentheses can be used to group an expression of 
search-keys into a 
!                       single search-key.
!                       
!                       Some examples translated into infix notation with "not" 
"and" "or" as 
!                       infix operators, k1, k2 .. are search-keys.  These 
infix operators are 
!                       purely for explanation, they are not part of IMAP.      
                
!                       
!                       k1 k2 k3                means (k1 and k2) and k3
!                       OR k1 k2 k3             means (k1 or k2) and k3
!                       OR (OR k1 k2) k3        means (k1 or k2) or k3
!                       NOT k1 k2               means (not k1) and k2
!                       NOT OR k1 k2            means not (k1 or k2)
!                       OR NOT k1 k2            means (not k1) or k2
!                       NOT k1 NOT k2           means (not k1) and (not k2)
!                       */
!                       
!                       if ($this->debug > 2) { echo 'bofilters: 
make_imap_search_str: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
                        
+                       // do we have one search or two, or more
+                       $num_search_criteria = count($feed_filter['matches']);
+                       if ($this->debug > 1) { echo 
'bofilters.make_imap_search_str: $num_search_criteria: 
['.$num_search_criteria.']<br>'; }
+                       // 1st search criteria
+                       // convert form submitted data into usable IMAP search 
keys
+                       $search_key_sieve = 
$feed_filter['matches'][0]['examine'];
+                       $search_key_imap = 
$this->sieve_to_imap_fields[$search_key_sieve];
+                       // what to learch for
+                       $search_for = $feed_filter['matches'][0]['matchthis'];
+                       // does or does not contain
+                       $comparator = $feed_filter['matches'][0]['comparator'];
+                       // DOES NOT CONTAIN - BROKEN - FIXME
+                       $search_str_1_criteria = $search_key_imap.' 
"'.$search_for.'"';
+                       
+                       // 2nd Line 
+                       if ($num_search_criteria == 1)
+                       {
+                               // no seconnd line, our string is complete
+                               $final_search_str = $search_str_1_criteria;
+                       }
+                       else
+                       {
+                               // convert form submitted data into usable IMAP 
search keys
+                               $search_key_sieve = 
$feed_filter['matches'][1]['examine'];
+                               $search_key_imap = 
$this->sieve_to_imap_fields[$search_key_sieve];
+                               // what to learch for
+                               $search_for = 
$feed_filter['matches'][1]['matchthis'];
+                               // does or does not contain
+                               $comparator = 
$feed_filter['matches'][1]['comparator'];
+                               // DOES NOT CONTAIN - BROKEN - FIXME
+                               $search_str_2_criteria = $search_key_imap.' 
"'.$search_for.'"';
+                               // preliminary  compound search string
+                               $final_search_str = $search_str_1_criteria .' 
'.$search_str_2_criteria;
+                               // final syntax of this limited 2 line search
+                               $andor = $feed_filter['matches'][1]['andor'];
+                               // ANDOR - BROKEN - FIXME
+                       }
+                       
+                       /*
                        $conv_error = '';
                        if ((!isset($look_here_sieve))
***************
*** 379,383 ****
                        {
                                $conv_error = 'invalid or no examine data';
!                               if ($this->debug > 0) { echo '<b> *** 
error</b>: bofilters: sieve_to_imap_string: error: '.$conv_error."<br> \r\n"; }
                                return '';
                        }
--- 628,632 ----
                        {
                                $conv_error = 'invalid or no examine data';
!                               if ($this->debug > 1) { echo '<b> *** 
error</b>: bofilters.make_imap_search_str: error: '.$conv_error."<br> \r\n"; }
                                return '';
                        }
***************
*** 386,405 ****
                        {
                                $conv_error = 'invalid or no search string 
data';
!                               if ($this->debug > 0) { echo '<b> *** 
error</b>: bofilters: sieve_to_imap_string: error: '.$conv_error."<br> \r\n"; }
                                return '';
                        }
-                       
                        $imap_str = $look_here_imap.' "'.$for_this.'"';
!                       if ($this->debug > 0) { echo 'bofilters: 
sieve_to_imap_string: string is: '.$imap_str."<br>\r\n"; }
!                       return $imap_str;
                }
  
!               
                function do_imap_search()
                {
!                       $imap_search_str = $this->sieve_to_imap_string();
                        if (!$imap_search_str)
                        {
!                               if ($this->debug > 0) { echo '<b> *** 
error</b>: bofilters: do_imap_search: sieve_to_imap_string returned 
empty<br>'."\r\n"; }
                                return array();
                        }
--- 635,654 ----
                        {
                                $conv_error = 'invalid or no search string 
data';
!                               if ($this->debug > 1) { echo '<b> *** 
error</b>: bofilters.make_imap_search_str: error: '.$conv_error."<br> \r\n"; }
                                return '';
                        }
                        $imap_str = $look_here_imap.' "'.$for_this.'"';
!                       */
!                       if ($this->debug > 0) { echo 
'bofilters.make_imap_search_str: LEAVING, returning search string: 
<code>'.$final_search_str.'</code><br>'."\r\n"; }
!                       return $final_search_str;
                }
  
!               // DEPRECIATED
                function do_imap_search()
                {
!                       $imap_search_str = $this->make_imap_search_str();
                        if (!$imap_search_str)
                        {
!                               if ($this->debug > 0) { echo '<b> *** 
error</b>: bofilters: do_imap_search: make_imap_search_str returned 
empty<br>'."\r\n"; }
                                return array();
                        }
***************
*** 572,575 ****
--- 821,826 ----
                                
                                $this->submit_mlist_to_class_form = 
$this->template->get_var('V_mlist_submit_form');
+                               
+                               return $this->finished_mlist;
                        }
                        

Index: class.mail_msg_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_base.inc.php,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -r1.67 -r1.68
*** class.mail_msg_base.inc.php 21 Jan 2002 05:28:05 -0000      1.67
--- class.mail_msg_base.inc.php 23 Jan 2002 13:22:23 -0000      1.68
***************
*** 1208,1212 ****
  
    // ----  Various Functions Used To Support Email   -----
!       function prep_folder_in($feed_folder)
        {
                // ----  Ensure a Folder Variable exists, if not, set to INBOX 
(typical practice)   -----
--- 1208,1212 ----
  
    // ----  Various Functions Used To Support Email   -----
!       function prep_folder_in($feed_folder, $acctnum='')
        {
                // ----  Ensure a Folder Variable exists, if not, set to INBOX 
(typical practice)   -----
***************
*** 1217,1224 ****
                }
                
                // FILESYSTEM imap server "dot_slash" CHECK
                if ((strstr(urldecode($feed_folder), './'))
!               &&      ((($this->get_pref_value('imap_server_type') == 
'UW-Maildir')
!                       || ($this->get_pref_value('imap_server_type') == 
'UWash'))) )
                {
                        // UWash and UW-Maildir IMAP servers are filesystem 
based,
--- 1217,1230 ----
                }
                
+               if ((!isset($acctnum))
+               || ((string)$acctnum == ''))
+               {
+                       $acctnum = $this->get_acctnum();
+               }
+               
                // FILESYSTEM imap server "dot_slash" CHECK
                if ((strstr(urldecode($feed_folder), './'))
!               &&      ((($this->get_pref_value('imap_server_type', $acctnum) 
== 'UW-Maildir')
!                       || ($this->get_pref_value('imap_server_type', $acctnum) 
== 'UWash'))) )
                {
                        // UWash and UW-Maildir IMAP servers are filesystem 
based,
***************
*** 1235,1239 ****
                // particularly if the folder has spaces and is included in the 
URI, then a + will be where the speces are
                $feed_folder = urldecode($feed_folder);
!               return $this->folder_lookup('', $feed_folder);
        }
  
--- 1241,1245 ----
                // particularly if the folder has spaces and is included in the 
URI, then a + will be where the speces are
                $feed_folder = urldecode($feed_folder);
!               return $this->folder_lookup('', $feed_folder, $acctnum);
        }
  
***************
*** 2064,2077 ****
          *  if False, an empty string is returned
          * * * * * * *  * * * */
!       function folder_lookup($mailsvr_stream, $folder_needle='INBOX')
        {
!               if ((!$mailsvr_stream)
!               || ($mailsvr_stream == ''))
                {
!                       $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream');
                }
                
!               //$folder_list = $this->get_folder_list($mailsvr_stream);
!               $folder_list = $this->get_folder_list();
                
                //$debug_folder_lookup = True;
--- 2070,2082 ----
          *  if False, an empty string is returned
          * * * * * * *  * * * */
!       function folder_lookup($mailsvr_stream, $folder_needle='INBOX', 
$acctnum='')
        {
!               if ((!isset($acctnum))
!               || ((string)$acctnum == ''))
                {
!                       $acctnum = $this->get_acctnum();
                }
                
!               $folder_list = $this->get_folder_list($acctnum);
                
                //$debug_folder_lookup = True;

Index: class.mail_msg_display.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_display.inc.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** class.mail_msg_display.inc.php      22 Jan 2002 13:16:34 -0000      1.34
--- class.mail_msg_display.inc.php      23 Jan 2002 13:22:23 -0000      1.35
***************
*** 326,330 ****
                                        // this logic determines if the 
combobox should be initialized with certain folder already selected
                                        // we use "folder short" as the 
comparator because that way at least we know we are comparing syntatic-ally 
similar items
!                                       if (($folder_short == 
$this->get_folder_short($local_args['pre_select_folder']))
                                        && ($folder_acctnum == 
$local_args['pre_select_folder_acctnum']))
                                        {
--- 326,330 ----
                                        // this logic determines if the 
combobox should be initialized with certain folder already selected
                                        // we use "folder short" as the 
comparator because that way at least we know we are comparing syntatic-ally 
similar items
!                                       if (($folder_short == 
$this->get_folder_short($local_args['pre_select_folder'], 
$local_args['pre_select_folder_acctnum']))
                                        && ($folder_acctnum == 
$local_args['pre_select_folder_acctnum']))
                                        {
***************
*** 601,605 ****
                                if ($debug_widget) { echo '* b: feed_args: 
key=['.$key.'] value=['.(string)$feed_args[$key].']<br>'; }
                                if ((isset($feed_args[$key]))
!                               && ($feed_args[$key] != $value))
                                {
                                        // we have a specified arg that should 
replace the default value
--- 601,606 ----
                                if ($debug_widget) { echo '* b: feed_args: 
key=['.$key.'] value=['.(string)$feed_args[$key].']<br>'; }
                                if ((isset($feed_args[$key]))
!                               //&& ($feed_args[$key] != $value))
!                               && ((string)$feed_args[$key] != (string)$value))
                                {
                                        // we have a specified arg that should 
replace the default value
***************
*** 643,648 ****
                                        $sel = ' selected';
                                }
!                               elseif (($local_args['is_multiple'])
!                               && (strstr($local_args['pre_select_multi'], 
(string)$this_acctnum)))
                                {
                                        $sel = ' selected';
--- 644,652 ----
                                        $sel = ' selected';
                                }
!                               elseif ( ($local_args['is_multiple'])
!                               && (    
(strstr((string)$local_args['pre_select_multi'], (string)$this_acctnum))
!                                               || 
($local_args['pre_select_multi'] == $this_acctnum)
!                                       )
!                               )
                                {
                                        $sel = ' selected';
***************
*** 2039,2047 ****
                        $totaltodisplay = $folder_info['number_all'];
                }
! 
                // keep track of how many loops we've done, for the return 
array, will be advanced to 0 before it's used
                $x = -1;
!               for ($i=$this->get_arg_value('start'); $i < $totaltodisplay; 
$i++)
                {
                        // we use $x to sequentially fill the $msg_list_display 
array
                        $x++;
--- 2043,2060 ----
                        $totaltodisplay = $folder_info['number_all'];
                }
!               
!               if ($this->get_isset_arg('start'))
!               {
!                       $start = $this->get_arg_value('start');
!               }
!               else
!               {
!                       $start = 0;
!               }
                // keep track of how many loops we've done, for the return 
array, will be advanced to 0 before it's used
                $x = -1;
!               for ($i=$start; $i < $totaltodisplay; $i++)
                {
+                       if ($debug_msg_list_display > 2) { echo 'mail_msg: 
get_msg_list_display: $msgball_list['.$i.'] dump:<pre>'; 
print_r($msgball_list[$i]); echo '</pre>'; }
                        // we use $x to sequentially fill the $msg_list_display 
array
                        $x++;

Index: class.mail_msg_wrappers.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_wrappers.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** class.mail_msg_wrappers.inc.php     21 Jan 2002 05:28:05 -0000      1.26
--- class.mail_msg_wrappers.inc.php     23 Jan 2002 13:22:23 -0000      1.27
***************
*** 70,78 ****
                        $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
                        
!                       //$tmp_a = $this->a[$this->acctnum];
!                       //$retval = 
$tmp_a['dcom']->fetchstructure($mailsvr_stream, $msgball['msgnum']);
!                       $retval = 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->fetchstructure($mailsvr_stream, 
$msgball['msgnum']);
!                       //$this->a[$this->acctnum] = $tmp_a;
!                       return $retval;
                }
                
--- 70,74 ----
                        $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
                        
!                       return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->fetchstructure($mailsvr_stream, 
$msgball['msgnum']);
                }
                
***************
*** 300,306 ****
                
                // ALIAS for get_folder_status_info() , for backward 
compatibility
!               function new_message_check()
                {
!                       return $this->get_folder_status_info();
                }
                
--- 296,302 ----
                
                // ALIAS for get_folder_status_info() , for backward 
compatibility
!               function new_message_check($fldball='')
                {
!                       return $this->get_folder_status_info($fldball='');
                }
                
***************
*** 429,436 ****
                }
  
!               function phpgw_server_last_error()
                {
!                       $retval = 
$GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->server_last_error();
!                       return $retval;
                }
                
--- 425,436 ----
                }
  
!               function phpgw_server_last_error($acctnum='')
                {
!                       if ((!isset($acctnum))
!                       || ((string)$acctnum == ''))
!                       {
!                               $acctnum = $this->get_acctnum();
!                       }
!                       return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->server_last_error();
                }
                
***************
*** 447,454 ****
                }
                
!               function phpgw_search($criteria,$flags='')
                {
!                       $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream');
!                       return 
$GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->i_search($mailsvr_stream,$criteria,$flags);
                }
                
--- 447,476 ----
                }
                
!               function phpgw_search($fldball='', $criteria='', $flags='')
                {
!                       $acctnum = (int)$fldball['acctnum'];
!                       if ((!isset($acctnum))
!                       || ((string)$acctnum == ''))
!                       {
!                               $acctnum = $this->get_acctnum();
!                       }
!                       $folder = $fldball['folder'];
!                       // if folder is blank, we *should* assume INBOX because 
filters always search the INBOX
!                       if ((!isset($folder))
!                       || ((string)$folder == ''))
!                       {
!                               $folder = 'INBOX';
!                       }
!                       // Make Sure Stream Exists
!                       // multiple accounts means one stream may be open but 
another may not
!                       // "ensure_stream_and_folder" will verify for us, 
!                       $fake_fldball = array();
!                       $fake_fldball['acctnum'] = $acctnum;
!                       $fake_fldball['folder'] = $folder;
!                       $this->ensure_stream_and_folder($fake_fldball, 
'phpgw_search');
!                       $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
!                       
!                       // now we have the stream and the desired folder open
!                       return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->i_search($mailsvr_stream,$criteria,$flags);
                }
                
***************
*** 500,508 ****
                }
                
!               function phpgw_append($folder = "Sent", $message, $flags=0)
                {
                        //$debug_append = True;
                        $debug_append = False;
!               
                        if ($debug_append) { echo 'append: folder: 
'.$folder.'<br>'; }
                        
--- 522,530 ----
                }
                
!               function phpgw_append($folder="Sent", $message, $flags=0)
                {
                        //$debug_append = True;
                        $debug_append = False;
!                       
                        if ($debug_append) { echo 'append: folder: 
'.$folder.'<br>'; }
                        
***************
*** 568,573 ****
                        $this->expire_session_cache_item('msgball_list');
                        
!                       $retval = 
$GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->mail_move($this->get_arg_value('mailsvr_stream'),
 $msg_list, $mailbox);
!                       return $retval;
                }
                
--- 590,594 ----
                        $this->expire_session_cache_item('msgball_list');
                        
!                       return 
$GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->mail_move($this->get_arg_value('mailsvr_stream'),
 $msg_list, $mailbox);
                }
                
***************
*** 597,601 ****
                        return $retval;
                }
!               
                function phpgw_expunge($acctnum='')
                {
--- 618,690 ----
                        return $retval;
                }
! 
!               function industrial_interacct_mail_move($mov_msgball='', 
$to_fldball='')
!               {
!                       // this needs A LOT of work!!! do not rely on this yet
!                       $good_to_go = False;
!                       // delete session msg array data thAt is now stale
!                       $this->expire_session_cache_item('msgball_list');
!                       
!                       // Note: Only call this function with ONE msgball at a 
time, i.e. NOT a list of msgballs
!                       $mov_msgball['acctnum'] = (int)$mov_msgball['acctnum'];
!                       if (!(isset($mov_msgball['acctnum']))
!                       || ((string)$mov_msgball['acctnum'] == ''))
!                       {
!                               $mov_msgball['acctnum'] = $this->get_acctnum();
!                       }
!                       //$from_folder = 
$this->prep_folder_in($mov_msgball['folder'], $from_acctnum);
!                       $mov_msgball['folder'] = 
urldecode($mov_msgball['folder']);
!                       // Make Sure Stream Exists
!                       // multiple accounts means one stream may be open but 
another may not
!                       // "ensure_stream_and_folder" will verify for us, 
!                       $this->ensure_stream_and_folder($mov_msgball, 
'industrial_interacct_mail_move');
!                       // GET THE MESSAGE
!                       // part_no 0 only used to get the headers
!                       $mov_msgball['part_no'] = 0;
!                       // (a)  the headers, specify part_no 0
!                       $moving_message = 
$GLOBALS['phpgw']->msg->phpgw_fetchbody($mov_msgball);
!                       // (b) the body, plus a CRLF, reuse headers_msgball b/c 
"phpgw_body" cares not about part_no
!                       $moving_message .= 
$GLOBALS['phpgw']->msg->phpgw_body($mov_msgball)."\r\n";
!                       $good_to_go = (strlen($moving_message) > 3);
!                       if (!$good_to_go)
!                       {
!                               return False;
!                       }
!                       
!                       // APPEND TO TARGET FOLDER
!                       $to_fldball['acctnum'] = (int)$to_fldball['acctnum'];
!                       if (!(isset($to_fldball['acctnum']))
!                       || ((string)$to_fldball['acctnum'] == ''))
!                       {
!                               $to_fldball['acctnum'] = $this->get_acctnum();
!                       }                       
!                       $to_fldball['folder'] = 
urldecode($to_fldball['folder']);
!                       // TEMP (MUST add this back!!!) append does NOT require 
we open the target folder, only requires a stream
!                       $remember_to_fldball = $to_fldball['folder'];
!                       $to_fldball['folder'] = '';
!                       $this->ensure_stream_and_folder($to_fldball, 
'industrial_interacct_mail_move');
!                       $mailsvr_callstr = 
$this->get_arg_value('mailsvr_callstr', $to_fldball['acctnum']);
!                       $to_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $to_fldball['acctnum']);
!                       $to_fldball['folder'] = $remember_to_fldball;
!                       $good_to_go = 
$GLOBALS['phpgw_dcom_'.$to_fldball['acctnum']]->dcom->append($to_mailsvr_stream,
 $mailsvr_callstr.$to_fldball['folder'], $moving_message, '');
!                       if (!$good_to_go)
!                       {
!                               return False;
!                       }
!                       // DELETE and EXPUNGE from FROM FOLDER
!                       $from_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $mov_msgball['acctnum']);
!                       $good_to_go = 
$GLOBALS['phpgw_dcom_'.$mov_msgball['acctnum']]->dcom->delete($from_mailsvr_stream,
 $mov_msgball['msgnum']);
!                       if (!$good_to_go)
!                       {
!                               return False;
!                       }
!                       $good_to_go = 
$GLOBALS['phpgw']->msg->phpgw_expunge($mov_msgball['acctnum']);
!                       if (!$good_to_go)
!                       {
!                               return False;
!                       }
!                       return True;
!               }
! 
                function phpgw_expunge($acctnum='')
                {

Index: class.uifilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.uifilters.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uifilters.inc.php     22 Jan 2002 13:16:34 -0000      1.3
--- class.uifilters.inc.php     23 Jan 2002 13:22:23 -0000      1.4
***************
*** 97,100 ****
--- 97,112 ----
                        
                        
+                       // make the filters object
+                       $this->bo = CreateObject("email.bofilters");
+                       // get all filters
+                       $this->bo->read_filter_data_from_prefs();
+                       
+                       // ---- Filter Number  ----
+                       // what filter are we supposed to edit
+                       $filter_num = $this->bo->obtain_filer_num();
+                       
$GLOBALS['phpgw']->template->set_var('filter_num',$filter_num);
+                       
+                       if ($this->debug > 2) { echo 'uifilters.filters: 
$this->bo->obtain_filer_num(): ['.$this->bo->obtain_filer_num().'] ; 
$this->bo->all_filters DUMP<pre>'; print_r($this->bo->all_filters); echo 
'</pre>'."\r\n"; }
+                       
                        // setup some form vars
                        //$form_edit_filter_action = $GLOBALS['phpgw']->link(
***************
*** 109,125 ****
                                                                
'menuaction=email.uifilters.filters_list');
                        
!                       // make the filters object
!                       $this->bo = CreateObject("email.bofilters");
!                       // get all filters
!                       $this->bo->read_filter_data_from_prefs();
                        
!                       // ---- Filter Number  ----
!                       // what filter are we supposed to edit
!                       $filter_num = $this->bo->obtain_filer_num();
!                       
$GLOBALS['phpgw']->template->set_var('filter_num',$filter_num);
                        
-                       if ($this->debug > 2) { echo 'uifilters.filters: 
$this->bo->obtain_filer_num(): ['.$this->bo->obtain_filer_num().'] ; 
$this->bo->all_filters DUMP<pre>'; print_r($this->bo->all_filters); echo 
'</pre>'."\r\n"; }
                        
                        // does the data exist or is this a new filter
                        if ((isset($this->bo->all_filters[$filter_num]))
                        && 
(isset($this->bo->all_filters[$filter_num]['source_accounts'])))
--- 121,139 ----
                                                                
'menuaction=email.uifilters.filters_list');
                        
!                       $apply_this_filter_url = $GLOBALS['phpgw']->link(
!                                                               '/index.php',
!                                                               
'menuaction=email.bofilters.run_single_filter'
!                                                               
.'&filter_num='.$filter_num);
!                       $apply_this_filter_href = '<a 
href="'.$apply_this_filter_url.'"><b>*APPLY*</b> This Filter</a>';
                        
!                       $test_this_filter_url = 
$apply_this_filter_url.'&filter_test=1';
!                       $test_this_filter_href = '<a 
href="'.$test_this_filter_url.'">Test Run This Filter</a>';
!                       
!                       
$GLOBALS['phpgw']->template->set_var('apply_this_filter_href',$apply_this_filter_href);
!                       
$GLOBALS['phpgw']->template->set_var('test_this_filter_href',$test_this_filter_href);
                        
                        
                        // does the data exist or is this a new filter
+                       /*
                        if ((isset($this->bo->all_filters[$filter_num]))
                        && 
(isset($this->bo->all_filters[$filter_num]['source_accounts'])))
***************
*** 131,134 ****
--- 145,150 ----
                                $filter_exists = False;
                        }
+                       */
+                       $filter_exists = $this->bo->filter_exists($filter_num);
                        
                        // ----  Filter Name  ----
***************
*** 154,157 ****
--- 170,174 ----
                                        $this_acct =  
$this->bo->all_filters[$filter_num]['source_accounts'][$i]['acctnum'];
                                        // make a comma sep string of all 
source accounts, so we can make them selected
+                                       //$pre_select_multi .= 
(string)$this_acct.', ';
                                        if ($pre_select_multi == '')
                                        {
***************
*** 172,177 ****
                        // ---  many email apps offer 2 matches options rows  
---
                        // ---  others offer 1 match options row with the 
option of more ---
!                       // ---  for now we will offer 4 rows ---
!                       $num_matchrow_pairs = 4;
                        for ($i=0; $i < $num_matchrow_pairs; $i++)
                        {
--- 189,195 ----
                        // ---  many email apps offer 2 matches options rows  
---
                        // ---  others offer 1 match options row with the 
option of more ---
!                       // ---  for now we will offer 2 rows ---
!                       // because the IMAP search string for 2 items is not as 
comlicated as for 3 or 4
!                       $num_matchrow_pairs = 2;
                        for ($i=0; $i < $num_matchrow_pairs; $i++)
                        {




reply via email to

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