phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: felamimail/inc class.bocaching.inc.php,1.1.1.1.2


From: Lars Kneschke <address@hidden>
Subject: [Phpgroupware-cvs] CVS: felamimail/inc class.bocaching.inc.php,1.1.1.1.2.1,1.1.1.1.2.2 class.bocompose.inc.php,1.1.1.1.2.4,1.1.1.1.2.5 class.bofelamimail.inc.php,1.2.2.4,1.2.2.5 class.bopreferences.inc.php,1.1.1.1.2.3,1.1.1.1.2.4 class.socaching.inc.php,1.1.1.1.2.2,1.1.1.1.2.3 class.uicompose.inc.php,1.1.1.1.2.3,1.1.1.1.2.4 class.uifelamimail.inc.php,1.2.2.3,1.2.2.4
Date: Tue, 04 Jun 2002 08:15:27 -0400

Update of /cvsroot/phpgroupware/felamimail/inc
In directory subversions:/tmp/cvs-serv14909/inc

Modified Files:
      Tag: Version-0_9_14-branch
        class.bocaching.inc.php class.bocompose.inc.php 
        class.bofelamimail.inc.php class.bopreferences.inc.php 
        class.socaching.inc.php class.uicompose.inc.php 
        class.uifelamimail.inc.php 
Log Message:
- you can now filter messages
  so far only for senderaddress, sendername and subject
  
- updated the way, felamimail find its options. it was broken

- when you have ldap account storage enabled, felamimail trys to
  read the users email address from ldap


Index: class.bocaching.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bocaching.inc.php,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** class.bocaching.inc.php     25 Feb 2002 23:58:37 -0000      1.1.1.1.2.1
--- class.bocaching.inc.php     4 Jun 2002 12:15:23 -0000       1.1.1.1.2.2
***************
*** 76,82 ****
                }
                
!               function getHeaders($_firstMessage='', $_numberOfMessages='' 
,$_sort='')
                {
!                       return $this->socaching->getHeaders($_firstMessage, 
$_numberOfMessages, $_sort);
                }
                
--- 76,82 ----
                }
                
!               function getHeaders($_firstMessage='', $_numberOfMessages='' 
,$_sort='', $_filter='')
                {
!                       return $this->socaching->getHeaders($_firstMessage, 
$_numberOfMessages, $_sort, $_filter);
                }
                
***************
*** 94,97 ****
--- 94,104 ----
                        return $retValue;
  
+               }
+               
+               // return the numbers of messages in cache currently
+               // but use the use filter
+               function getMessageCounter($_filter)
+               {
+                       return $this->socaching->getMessageCounter($_filter);
                }
  

Index: class.bocompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bocompose.inc.php,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** class.bocompose.inc.php     5 May 2002 20:57:12 -0000       1.1.1.1.2.4
--- class.bocompose.inc.php     4 Jun 2002 12:15:23 -0000       1.1.1.1.2.5
***************
*** 232,236 ****
                                                        continue;
                                                }
!                                               print 
$val->mailbox.'@'.$val->host."<br>";
                                                
if(!empty($this->sessionData['to'])) $this->sessionData['to'] .= ", ";
                                                if(!empty($val->personal))
--- 232,236 ----
                                                        continue;
                                                }
!                                               #print 
$val->mailbox.'@'.$val->host."<br>";
                                                
if(!empty($this->sessionData['to'])) $this->sessionData['to'] .= ", ";
                                                if(!empty($val->personal))
***************
*** 303,306 ****
--- 303,313 ----
                {
                        return $this->sessionData;
+               }
+ 
+               // get the user name, will will use for the FROM field
+               function getUserName()
+               {
+                       $retData = sprintf("%s 
<%s>",$this->preferences['realname'],$this->preferences['emailAddress']);
+                       return $retData;
                }
                

Index: class.bofelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bofelamimail.inc.php,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -C2 -r1.2.2.4 -r1.2.2.5
*** class.bofelamimail.inc.php  5 May 2002 20:02:49 -0000       1.2.2.4
--- class.bofelamimail.inc.php  4 Jun 2002 12:15:23 -0000       1.2.2.5
***************
*** 49,52 ****
--- 49,54 ----
                        $this->mbox = imap_open ($mailboxString, 
                                        $this->mailPreferences['username'], 
$this->mailPreferences['key']);
+                       
+                       $this->restoreSessionData();
                }
                
***************
*** 393,397 ****
                        }
  
!                       $displayHeaders = $caching->getHeaders($_startMessage, 
$_numberOfMessages, $_sort);
  
                        $count=0;
--- 395,401 ----
                        }
  
!                       // now lets gets the important messages
!                       $filter = $this->sessionData['filter'];
!                       $displayHeaders = $caching->getHeaders($_startMessage, 
$_numberOfMessages, $_sort, $filter);
  
                        $count=0;
***************
*** 461,465 ****
                        if(is_array($retValue['header']))
                        {
!                               $retValue['info']['total']      = 
$status->messages;
                                $retValue['info']['first']      = 
$_startMessage;
                                $retValue['info']['last']       = 
$_startMessage + $count - 1 ;
--- 465,469 ----
                        if(is_array($retValue['header']))
                        {
!                               $retValue['info']['total']      = 
$caching->getMessageCounter($filter);
                                $retValue['info']['first']      = 
$_startMessage;
                                $retValue['info']['last']       = 
$_startMessage + $count - 1 ;
***************
*** 603,607 ****
--- 607,630 ----
                        return $ret;
                }
+               
+               function restoreSessionData()
+               {
+                       $this->sessionData = 
$GLOBALS['phpgw']->session->appsession('session_data');
+               }
+               
+               function saveFilter($_formData)
+               {
+                       if(!empty($_formData['from']))
+                               $data['from']   = $_formData['from'];
+                       if(!empty($_formData['subject']))
+                               $data['subject']= $_formData['subject'];
  
+                       $this->sessionData['filter'] = $data;
+                       $this->saveSessionData();
+               }
+               function saveSessionData()
+               {
+                       
$GLOBALS['phpgw']->session->appsession('session_data','',$this->sessionData);
+               }
        }
  

Index: class.bopreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bopreferences.inc.php,v
retrieving revision 1.1.1.1.2.3
retrieving revision 1.1.1.1.2.4
diff -C2 -r1.1.1.1.2.3 -r1.1.1.1.2.4
*** class.bopreferences.inc.php 22 Apr 2002 13:20:20 -0000      1.1.1.1.2.3
--- class.bopreferences.inc.php 4 Jun 2002 12:15:23 -0000       1.1.1.1.2.4
***************
*** 29,33 ****
                function getPreferences()
                {
! /*                    while(list($key,$value) = 
each($GLOBALS['phpgw_info']['user']['preferences']) )
                        {
                                print ". $key: $value<br>";
--- 29,33 ----
                function getPreferences()
                {
! /*                    while(list($key,$value) = 
each($GLOBALS['phpgw_info']['server']) )
                        {
                                print ". $key: $value<br>";
***************
*** 40,66 ****
                                }
                        }
! */
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['email']['use_custom_settings'] 
== 'True')
!                       {
!                               $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server'];
  
!                               $data['key']                    = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'];
!                               $data['username']               = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
!                               $data['emailAddress']           = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
!                               
!                               $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']);
!                       }
!                       else
!                       {
!                               $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['server']['mail_server'];
! 
!                               $data['key']                    = 
$GLOBALS['phpgw_info']['user']['passwd'];
!                               $data['username']               = 
$GLOBALS['phpgw_info']['user']['userid'];
!                               $data['emailAddress']           = 
$GLOBALS['phpgw_info']['user']['userid']."@".$GLOBALS['phpgw_info']['server']['mail_suffix'];
! 
!                               $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']["server"]["address"]);
!                       }
                        
!                       // global settings
                        $data['realname']               = 
$GLOBALS['phpgw_info']['user']['fullname'];
                        $data['defaultDomainname']      = 
$GLOBALS['phpgw_info']["server"]["mail_suffix"];
--- 40,59 ----
                                }
                        }
! */                    
  
!                       $config = CreateObject('phpgwapi.config','felamimail');
!                       $config->read_repository();
!                       $felamimailConfig = $config->config_data;
!                       unset($config);
!                       
!                       #_debug_array($felamimailConfig);
!                       #print "<hr>";
                        
!                       // set values to the global values
!                       $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['server']['mail_server'];
!                       $data['key']                    = 
$GLOBALS['phpgw_info']['user']['passwd'];
!                       $data['username']               = 
$GLOBALS['phpgw_info']['user']['userid'];
!                       $data['emailAddress']           = 
$GLOBALS['phpgw_info']['user']['userid']."@".$GLOBALS['phpgw_info']['server']['mail_suffix'];
!                       $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']["server"]["imap_server_type"]);
                        $data['realname']               = 
$GLOBALS['phpgw_info']['user']['fullname'];
                        $data['defaultDomainname']      = 
$GLOBALS['phpgw_info']["server"]["mail_suffix"];
***************
*** 70,73 ****
--- 63,121 ----
  
                        $data['imapPort']               = 143;
+                       
+                       // check for felamimail specific settings
+                       if(!empty($felamimailConfig['imapServer']))
+                               $data['imapServerAddress']      = 
$felamimailConfig['imapServer'];
+ 
+                       if(!empty($felamimailConfig['smtpServer']))
+                               $data['smtpServerAddress']      = 
$felamimailConfig['smtpServer'];
+                       
+                       if(!empty($felamimailConfig['smtpServer']))
+                               $data['smtpPort']               = 
$felamimailConfig['smtpPort'];
+ 
+                       if(!empty($felamimailConfig['mailSuffix']))
+                               $data['defaultDomainname']      = 
$felamimailConfig['mailSuffix'];
+                       
+                       
if($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap')
+                       {
+                               // do a ldap lookup to fetch users email address
+                               $ldap = 
$GLOBALS['phpgw']->common->ldapConnect();
+                               $filter = 
sprintf("(&(uid=%s)(objectclass=posixAccount))",$GLOBALS['phpgw_info']['user']['userid']);
+                               
+                               $sri = 
@ldap_search($ldap,$GLOBALS['phpgw_info']['server']['ldap_context'],$filter);
+                               if ($sri)
+                               {
+                                       $allValues = ldap_get_entries($ldap, 
$sri);
+ 
+ 
+                                       
if(isset($allValues[0]['emailaddress'][0]))
+                                       {
+                                               $data['emailAddress']           
= $allValues[0]['emailaddress'][0];
+                                       }
+                                       
elseif(isset($allValues[0]['maillocaladdress'][0]))
+                                       {
+                                               $data['emailAddress']           
= $allValues[0]['maillocaladdress'][0];
+                                       }
+                               }
+                       }
+                       
+                       // check for user specific settings
+                       if 
($GLOBALS['phpgw_info']['user']['preferences']['email']['use_custom_settings'] 
== 'True')
+                       {
+                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['userid']))
+                                       $data['username']               = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
+ 
+                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['key']))
+                                       $data['key']                    = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'];
+ 
+                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['address']))
+                                       $data['emailAddress']           = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
+ 
+                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server']))
+                                       $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server'];
+ 
+                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']))
+                                       $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']);
+                       }
                        
                        // preferences

Index: class.socaching.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.socaching.inc.php,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** class.socaching.inc.php     31 Mar 2002 10:18:41 -0000      1.1.1.1.2.2
--- class.socaching.inc.php     4 Jun 2002 12:15:23 -0000       1.1.1.1.2.3
***************
*** 48,52 ****
                }
                
!               function getHeaders($_firstMessage='', $_numberOfMessages='', 
$_sort='')
                {
                        switch($_sort)
--- 48,52 ----
                }
                
!               function getHeaders($_firstMessage='', $_numberOfMessages='', 
$_sort='', $_filter='')
                {
                        switch($_sort)
***************
*** 74,81 ****
                        }
                        
                        $query = sprintf("select uid, date, subject, 
sender_name, sender_address, to_name, to_address, size, attachments from 
phpgw_felamimail_cache ".
!                                        "where accountid='%s' and 
hostname='%s' and foldername = '%s' and accountname='%s' $sort",
                                         $this->accountid, 
addslashes($this->hostname),
!                                        addslashes($this->foldername), 
addslashes($this->accountname));
                        #print "$query<br>";
                        
--- 74,95 ----
                        }
                        
+                       while(list($key,$value) = @each($_filter))
+                       {
+                               switch($key)
+                               {
+                                       case "from":
+                                               $filter .= " and (sender_name 
like '%$value%' or sender_address like '%$value%') ";
+                                               break;
+                                       case "subject":
+                                               $filter .= " and subject like 
'%$value%' ";
+                                               break;
+                               }
+                       }
+                       
                        $query = sprintf("select uid, date, subject, 
sender_name, sender_address, to_name, to_address, size, attachments from 
phpgw_felamimail_cache ".
!                                        "where accountid='%s' and 
hostname='%s' and foldername = '%s' and accountname='%s' %s $sort",
                                         $this->accountid, 
addslashes($this->hostname),
!                                        addslashes($this->foldername), 
addslashes($this->accountname),
!                                        $filter);
                        #print "$query<br>";
                        
***************
*** 136,139 ****
--- 150,184 ----
                                return 0;
                        }
+               }
+               
+               // return the numbers of messages in cache currently
+               // but use the use filter
+               function getMessageCounter($_filter)
+               {
+                       while(list($key,$value) = @each($_filter))
+                       {
+                               switch($key)
+                               {
+                                       case "from":
+                                               $filter .= " and (sender_name 
like '%$value%' or sender_address like '%$value%') ";
+                                               break;
+                                       case "subject":
+                                               $filter .= " and subject like 
'%$value%' ";
+                                               break;
+                               }
+                       }
+                       
+                       $query = sprintf("select count(*) as count from 
phpgw_felamimail_cache ".
+                                        "where accountid='%s' and 
hostname='%s' and foldername = '%s' and accountname='%s' %s",
+                                        $this->accountid, 
addslashes($this->hostname),
+                                        addslashes($this->foldername), 
addslashes($this->accountname),
+                                        $filter);
+                       #print "$query<br>";
+                       
+                       $this->db->query("$query",__LINE__,__FILE__);
+                       
+                       $this->db->next_record();
+                       
+                       return $this->db->f("count");
                }
                

Index: class.uicompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uicompose.inc.php,v
retrieving revision 1.1.1.1.2.3
retrieving revision 1.1.1.1.2.4
diff -C2 -r1.1.1.1.2.3 -r1.1.1.1.2.4
*** class.uicompose.inc.php     5 May 2002 20:02:49 -0000       1.1.1.1.2.3
--- class.uicompose.inc.php     4 Jun 2002 12:15:23 -0000       1.1.1.1.2.4
***************
*** 155,158 ****
--- 155,159 ----
  
                        // header
+                       
$this->t->set_var("from",htmlentities($this->bocompose->getUserName()));
                        $this->t->set_var("to",$sessionData['to']);
                        $this->t->set_var("cc",$sessionData['cc']);
***************
*** 242,245 ****
--- 243,247 ----
                        $this->t->set_var("lang_cc",lang('cc'));
                        $this->t->set_var("lang_bcc",lang('bcc'));
+                       $this->t->set_var("lang_from",lang('from'));
                        $this->t->set_var("lang_reply_to",lang('reply to'));
                        $this->t->set_var("lang_subject",lang('subject'));

Index: class.uifelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uifelamimail.inc.php,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -C2 -r1.2.2.3 -r1.2.2.4
*** class.uifelamimail.inc.php  5 May 2002 20:02:49 -0000       1.2.2.3
--- class.uifelamimail.inc.php  4 Jun 2002 12:15:23 -0000       1.2.2.4
***************
*** 551,554 ****
--- 551,563 ----
                        $linkData = array
                        (
+                               'menuaction'    => 
'felamimail.uifilter.mainScreen',
+                               'mailbox'       => $urlMailbox,
+                               'startMessage'  => $this->startMessage,
+                               'sort'          => $this->sort,
+                       );
+                       
$this->t->set_var('url_filter',$GLOBALS['phpgw']->link('/index.php',$linkData));
+ 
+                       $linkData = array
+                       (
                                'menuaction'    => 
'felamimail.uifelamimail.handleButtons'
                        );
***************
*** 596,600 ****
  
                        $this->t->set_var('lang_compose',lang('compose'));
!                       $this->t->set_var('lang_search',lang('search'));
                        $this->t->set_var('lang_move_selected_to',lang('move 
selected to'));
                        $this->t->set_var('lang_doit',lang('do it!'));
--- 605,609 ----
  
                        $this->t->set_var('lang_compose',lang('compose'));
!                       $this->t->set_var('lang_edit_filter',lang('edit 
filter'));
                        $this->t->set_var('lang_move_selected_to',lang('move 
selected to'));
                        $this->t->set_var('lang_doit',lang('do it!'));




reply via email to

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