phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] email view_image.php, 1.17 index.php, 1.91 attach_fil


From: skwashd
Subject: [Phpgroupware-cvs] email view_image.php, 1.17 index.php, 1.91 attach_file.php, 1.29 compose.php, 1.52 addressbook.php, 1.40
Date: Thu, 24 Feb 2005 12:50:29 -0000

Update of email

Modified Files:
     Branch: MAIN
            view_image.php lines: +1 -1
            index.php lines: +1 -1
            attach_file.php lines: +1 -1
            compose.php lines: +1 -1
            addressbook.php lines: +94 -67

Log Message:
merge from 16

====================================================

====================================================

====================================================

====================================================

====================================================
Index: email/addressbook.php
diff -u email/addressbook.php:1.39 email/addressbook.php:1.40
--- email/addressbook.php:1.39  Tue Apr 22 20:26:15 2003
+++ email/addressbook.php       Thu Dec 30 23:13:50 2004
@@ -44,89 +44,98 @@
        
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php'));
        $GLOBALS['phpgw']->template->set_var('lang_select_cats',lang('Select 
category'));

-       if (! $start)
-       {
-               $start = 0;
+       $cat_id = get_var('cat_id',array('get','post'));
+       $filter = get_var('filter',array('get','post'));
+       $start = get_var('start',array('get','post'));
+       $limit = get_var('limit',array('get','post'));
+       $query = get_var('query',array('get','post'));
+       $sort = get_var('sort',array('get','post'));
+       $order = get_var('order',array('get','post'));
+
+       if(!$cat_id)
+       {
+               $cat_id = $prefs['default_category'];
+       }
+
+       switch ($filter)
+       {
+       case 'user_only':
+               $access = PHPGW_CONTACTS_MINE;
+               break;
+       case 'private':
+               $access = PHPGW_CONTACTS_PRIVATE;
+               break;
+       default:
+               $access = PHPGW_CONTACTS_ALL;
        }

-       if (!$filter)
+       if(!$start)
        {
-               $filter = 'none';
+               $start = 0;
        }

-       if (!$cat_id)
+       if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
&&
+          $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
> 0)
        {
-               if ($filter == 'none')
-               {
-                       $qfilter  = 'tid=n';
-               }
-               elseif ($filter == 'private')
-               {
-                       $qfilter  = 
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'];
-               }
-               else
-               {
-                       $qfilter = 'tid=n,owner='.$filter;
-               }
+               $limit = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
        }
        else
        {
-               if ($filter == 'none')
-               {
-                       $qfilter  = 'tid=n,cat_id='.$cat_id;
-               }
-               elseif ($filter == 'private')
-               {
-                       $qfilter  = 
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'].',cat_id='.$cat_id;
-               }
-               else
-               {
-                       $qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id;
-               }
+               $limit = 15;
        }
-
-       if 
(($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
-       ($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 
0))
+
+       if($cat_id && $cat_id!=-1)
        {
-               $offset = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+               $category_filter = $cat_id;
        }
        else
        {
-               $offset = 15;
+               $category_filter = PHPGW_CONTACTS_CATEGORIES_ALL;
        }

        $account_id = $GLOBALS['phpgw_info']['user']['account_id'];

        $cols = array (
-               'n_given'    => 'n_given',
-               'n_family'   => 'n_family',
+               'contact_id' => 'contact_id',
+               'per_first_name'    => 'per_first_name',
+               'per_last_name'   => 'per_last_name',
                'org_name'   => 'org_name',
-               'email'      => 'email',
-               'email_home' => 'email_home'
        );

-       $entries = 
$d->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
+
+       //$entries = 
$d->read($start,$offset,$cols,$query,$qfilter,$sort,$order);
+       $criteria = $d->criteria_for_index($account_id, $access, 
$category_filter, $cols, $query);
+       $total_all_persons = $d->get_count_persons($criteria);
+       $entries = $d->get_persons($cols, $limit, $start, $order, $sort, '', 
$criteria);
+
+       if(is_array($entries))
+       {
+               foreach ($entries as $id)
+               {
+                       $contacts[] = $id['contact_id'];
+               }
+               $entries_comm = $d->get_comm_contact_data($contacts, 
array('work email', 'home email'));
+       }

        //------------------------------------------- nextmatch 
--------------------------------------------
-       $left = 
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
-       $right = 
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
+       $left = 
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$total_all_persons,"&order=$order&filter=$filter&sort=$sort&query=$query");
+       $right = 
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$total_all_persons,"&order=$order&filter=$filter&sort=$sort&query=$query");
        $GLOBALS['phpgw']->template->set_var('left',$left);
        $GLOBALS['phpgw']->template->set_var('right',$right);

-       if ($d->total_records > 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
-       {
-               
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing %1 - %2 of 
%3',($start + 1),($start + 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']),$d->total_records));
-       }
-       else
-       {
-               
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing 
%1',$d->total_records));
-       }
+       //$lang_showing = 
$GLOBALS['phpgw']->nextmatchs->show_hits($total_records,$this->start);
+       $lang_showing = lang('%1 - %2 of %3 ',
+                            ($d->total_records!=0)?$start+1:$start,
+                            $start+$d->total_records,$total_all_persons);
+       $GLOBALS['phpgw']->template->set_var('lang_showing', $lang_showing);
+
+
        // --------------------------------------- end nextmatch 
------------------------------------------

        // ------------------- list header variable template-declaration 
-----------------------
        
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-       
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_given',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
-       
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_family',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
+       
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'per_first_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
+       
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'per_last_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
        
$GLOBALS['phpgw']->template->set_var('sort_company',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'org_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Company')));
        $GLOBALS['phpgw']->template->set_var('lang_email',lang('Select work 
email address'));
        $GLOBALS['phpgw']->template->set_var('lang_hemail',lang('Select home 
email address'));
@@ -142,12 +151,12 @@
        {
                $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
-               $firstname = $entries[$i]['n_given'];
+               $firstname = $entries[$i]['per_first_name'];
                if (!$firstname)
                {
                        $firstname = ' ';
                }
-               $lastname = $entries[$i]['n_family'];
+               $lastname = $entries[$i]['per_last_name'];
                if (!$lastname)
                {
                        $lastname = ' ';
@@ -176,33 +185,35 @@
                }
                $personal_part = $personal_firstname.$personal_lastname;

+               $tmp_email  = get_comm_value($entries[$i]['contact_id'], 'work 
email', $entries_comm);
+               $tmp_hemail = get_comm_value($entries[$i]['contact_id'], 'home 
email', $entries_comm);
                if (($personal_part == '') ||
                        ($include_personal == False))
                {
-                       $id     = $entries[$i]['id'];
-                       $email  = $entries[$i]['email'];
-                       $hemail = $entries[$i]['email_home'];
+                       $id     = $entries[$i]['contact_id'];
+                       $email  = $tmp_email;
+                       $hemail = $tmp_hemail;
                }
                else
                {
-                       $id = $entries[$i]['id'];
-                       if ((isset($entries[$i]['email'])) &&
-                               (trim($entries[$i]['email']) != ''))
+                       $id = $entries[$i]['contact_id'];
+                       if ((isset($tmp_email)) &&
+                               (trim($tmp_email) != ''))
                        {
-                               $email  = '"'.$personal_part.'" 
<'.$entries[$i]['email'].'>';
+                               $email  = '"'.$personal_part.'" 
<'.$tmp_email.'>';
                        }
                        else
                        {
-                               $email  = $entries[$i]['email'];
+                               $email  = $tmp_email;
                        }
-                       if ((isset($entries[$i]['email_home'])) &&
-                       (trim($entries[$i]['email_home']) != ''))
+                       if ((isset($tmp_hemail)) &&
+                       (trim($tmp_hemail) != ''))
                        {
-                               $hemail = '"'.$personal_part.'" 
<'.$entries[$i]['email_home'].'>';
+                               $hemail = '"'.$personal_part.'" 
<'.$tmp_hemail.'>';
                        }
                        else
                        {
-                               $hemail = $entries[$i]['email_home'];
+                               $hemail = $tmp_hemail;
                        }
                }

@@ -226,4 +237,20 @@
        $GLOBALS['phpgw']->template->p('out');

        $GLOBALS['phpgw']->common->phpgw_exit();
+
+       function get_comm_value($contact_id, $column, $entries_comm)
+       {
+               if(!is_array($entries_comm))
+               {
+                       $entries_comm=array();
+               }
+
+               foreach($entries_comm as $comms)
+               {
+                       if($contact_id == $comms['comm_contact_id'] && $column 
== $comms['comm_description'])
+                       {
+                               return $comms['comm_data'];
+                       }
+               }
+       }
 ?>






reply via email to

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