phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [19092] improve addressbook usability - there is a li


From: Dave Hall
Subject: [Phpgroupware-cvs] [19092] improve addressbook usability - there is a link to jump to associated orgs /persons
Date: Sun, 22 Feb 2009 00:12:19 +0000

Revision: 19092
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19092
Author:   skwashd
Date:     2009-02-22 00:12:18 +0000 (Sun, 22 Feb 2009)

Log Message:
-----------
improve addressbook usability - there is a link to jump to associated 
orgs/persons

Modified Paths:
--------------
    branches/Version-0_9_16-branch/addressbook/inc/class.boaddressbook.inc.php
    branches/Version-0_9_16-branch/addressbook/inc/class.uiaddressbook.inc.php
    branches/Version-0_9_16-branch/addressbook/templates/default/view.tpl
    branches/Version-0_9_16-branch/addressbook/templates/probusiness/view.tpl
    branches/Version-0_9_16-branch/phpgwapi/inc/class.contacts_sql.inc.php

Modified: 
branches/Version-0_9_16-branch/addressbook/inc/class.boaddressbook.inc.php
===================================================================
--- branches/Version-0_9_16-branch/addressbook/inc/class.boaddressbook.inc.php  
2009-02-21 12:44:53 UTC (rev 19091)
+++ branches/Version-0_9_16-branch/addressbook/inc/class.boaddressbook.inc.php  
2009-02-22 00:12:18 UTC (rev 19092)
@@ -195,13 +195,11 @@
                        $entry[0]['tab_cats']['my_cats'] = explode(",", 
$entry[0]['cat_id']);
                        $entry[0]['tab_extra']['per_suffix'] = 
$entry[0]['per_suffix'];
                        $entry[0]['tab_extra']['per_sound'] = 
$entry[0]['per_sound'];
-                       $entry[0]['tab_extra']['per_initials'] = 
$entry[0]['per_initials'];
                        $entry[0]['tab_extra']['per_pubkey'] = 
$entry[0]['per_pubkey'];
                        
                        unset($entry[0]['cat_id']);
                        unset($entry[0]['per_suffix']);
                        unset($entry[0]['per_sound']);
-                       unset($entry[0]['per_initials']);
                        unset($entry[0]['per_pubkey']);
                        
                        return $entry[0];

Modified: 
branches/Version-0_9_16-branch/addressbook/inc/class.uiaddressbook.inc.php
===================================================================
--- branches/Version-0_9_16-branch/addressbook/inc/class.uiaddressbook.inc.php  
2009-02-21 12:44:53 UTC (rev 19091)
+++ branches/Version-0_9_16-branch/addressbook/inc/class.uiaddressbook.inc.php  
2009-02-22 00:12:18 UTC (rev 19092)
@@ -2842,6 +2842,8 @@
                        $this->template->set_file(array('view_t' => 
'view.tpl'));
                        
$this->template->set_block('view_t','view_header','view_header');
                        
$this->template->set_block('view_t','view_row','view_row');
+                       
$this->template->set_block('view_t','person_entry','person_entries');
+                       
$this->template->set_block('view_t','org_person','org_persons');
                        
$this->template->set_block('view_t','view_footer','view_footer');
                        
$this->template->set_block('view_t','view_buttons','view_buttons');
 
@@ -2852,54 +2854,108 @@
                        
                        $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
 
+                       $org_id = $contacts['org_id'];
+                       unset($contacts['org_id'], $contacts['per_active'], 
$contacts['org_active']);
+                       
                        foreach($contacts as $field => $data)
                        {
-                               $data = htmlentities($data);
+                               if ( is_numeric($field) || !$data )
+                               {
+                                       continue;
+                               }
+                       
+                               $data = htmlentities($data, ENT_QUOTES);
                                $ref='';
-                               if(!is_numeric($field) && $data!='')
+                               $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
+                               $this->template->set_var('th_bg',$tr_color);
+                               if(in_array($field, $comms_media[0]))
                                {
-                                       $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
-                                       
$this->template->set_var('th_bg',$tr_color);
-                                       if(in_array($field, $comms_media[0]))
+                                       
$this->template->set_var('display_col',lang($field));
+                                       if ( preg_match('/email/', $field) )
                                        {
-                                               
$this->template->set_var('display_col',lang($field));
-                                               if(strpos($field, 'email'))
+                                               if 
($GLOBALS['phpgw_info']['user']['apps']['email'])
                                                {
-                                                       if 
($GLOBALS['phpgw_info']['user']['apps']['email'])
-                                                       {
-                                                               $ref='<a 
href="'.$GLOBALS['phpgw']->link(
-                                                                       
"/email/compose.php","to=" 
-                                                                       . 
urlencode($data))
-                                                                       .'" 
target="_new">';
-                                                       }
-                                                       else
-                                                       {
-                                                               $ref='<a 
href="mailto:'.$data.'">';
-                                                       }
-                                                       $data=$data . '</a>';
+                                                       $ref='<a 
href="'.$GLOBALS['phpgw']->link(
+                                                               
"/email/compose.php","to=" 
+                                                               . 
urlencode($data))
+                                                               .'" 
target="_new">';
                                                }
-                                               if($field=='website')
+                                               else
                                                {
-                                                       if ( !empty($data) && 
(substr($data,0,7) != 'http://') ) 
-                                                       { 
-                                                               $data = 
'http://' . $data; 
-                                                       }
-                                                       $ref='<a 
href="'.$data.'" target="_new">';
-                                                       $data=$data.'</a>';
+                                                       $ref='<a 
href="mailto:'.$data.'">';
                                                }
+                                               $data .= '</a>';
                                        }
-                                       else
+                                       else if( $field == 'website' )
                                        {
-                                               
$this->template->set_var('display_col',$this->bo->display_name($field));
+                                               if ( !preg_match('/http[s]?/', 
$data) ) 
+                                               { 
+                                                       $data = 
"http://{$data}";; 
+                                               }
+                                               $ref = "<a href=\"{$data}\" 
target=\"_blank\">";
+                                               $data .= '</a>';
                                        }
-                                       
-                                       
$this->template->set_var('ref_data',$ref.$data);
-                                       
$this->template->parse('cols','view_row',True);
                                }
+                               else
+                               {
+                                       if (  $contact_type != 'Organizations' 
+                                               && $field == 'org_name' )
+                                       {
+                                               $link = 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array
+                                                       (
+                                                               'menuaction' => 
'addressbook.uiaddressbook.view_org',
+                                                               'ab_id' => 
$org_id
+                                                       ));
+
+                                               $ref = "<a href=\"{$link}\">";
+                                               $data .= '</a>';
+                                       }
+
+                                       
$this->template->set_var('display_col',$this->bo->display_name($field));
+                               }
+                               
+                               $this->template->set_var('ref_data', 
$ref.$data);
+                               $this->template->parse('cols','view_row',True);
                        }
                        /* Following cleans up view_row, since we were only 
using it to fill {cols} */
                        $this->template->set_var('view_row','');
 
+                       if ( $contact_type == 'Organizations' )
+                       {
+                               $this->template->set_var('lang_persons', 
lang('associated people'));
+
+                               $fields = array('contact_id', 'org_name', 
'per_full_name');
+                               $persons = $this->bo->get_persons($fields, 0, 
0, 'last_name', 'ASC', array('org_id' => $contact_id));
+
+                               if ( count($persons) )
+                               {
+                                       foreach ( $persons as $person )
+                                       {
+                                               $link = 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array
+                                                       (
+                                                               'menuaction' => 
'addressbook.uiaddressbook.view_person',
+                                                               'ab_id' => 
$person['contact_id']
+                                                       ));
+
+                                               
$this->template->set_var(array('per_link' => $link, 'per_name' => 
$person['per_full_name']));
+                                               
$this->template->parse('person_entries', 'person_entry', true);
+                                       }
+                                       $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
+                                       
$this->template->set_var('tr_bg',$tr_color);
+                               }
+                               else
+                               {
+                                       
$this->template->set_var('person_entries', lang('none'));
+                               }
+                               $this->template->parse('org_persons', 
'org_person');
+                       }
+                       else
+                       {
+                               $this->template->set_var('org_persons', '');
+                       }
+
                        /* These are in the footer */
                        $this->template->set_var('lang_owner',lang('Record 
owner'));
                        if($owner == 
$GLOBALS['phpgw_info']['server']['addressmaster'])
@@ -3283,4 +3339,3 @@
                                . $contact_id . '&referer=' . $referer));
                }
        }
-?>

Modified: branches/Version-0_9_16-branch/addressbook/templates/default/view.tpl
===================================================================
--- branches/Version-0_9_16-branch/addressbook/templates/default/view.tpl       
2009-02-21 12:44:53 UTC (rev 19091)
+++ branches/Version-0_9_16-branch/addressbook/templates/default/view.tpl       
2009-02-22 00:12:18 UTC (rev 19092)
@@ -8,6 +8,18 @@
   </tr>
 <!-- END view_row -->
 {cols}
+<!-- BEGIN org_person -->
+<tr bgcolor="{tr_bg}">
+       <td><b>{lang_persons}</b></td>
+       <td>
+               <ul>
+                       <!-- BEGIN person_entry -->
+                       <li><a href="{per_link}">{per_name}</a></li>
+                       <!-- END person_entry -->
+               </ul>
+       </td>
+</tr>
+<!-- END org_person -->
 <!-- BEGIN view_footer -->
   <tr>
     <td colspan="4">&nbsp;</td>

Modified: 
branches/Version-0_9_16-branch/addressbook/templates/probusiness/view.tpl
===================================================================
--- branches/Version-0_9_16-branch/addressbook/templates/probusiness/view.tpl   
2009-02-21 12:44:53 UTC (rev 19091)
+++ branches/Version-0_9_16-branch/addressbook/templates/probusiness/view.tpl   
2009-02-22 00:12:18 UTC (rev 19092)
@@ -7,6 +7,18 @@
     <tr class="bg_view"><td width="30%"><b>{display_col}</b>:</td><td 
width="70%">{ref_data}</td></tr>
 <!-- END view_row -->
     {cols}
+<!-- BEGIN org_person -->
+<tr bgcolor="{tr_bg}">
+        <td><b>{lang_persons}</b></td>
+        <td>
+                <ul>
+                        <!-- BEGIN person_entry -->
+                        <li><a href="{per_link}">{per_name}</a></li>
+                        <!-- END person_entry -->
+                </ul>
+        </td>
+</tr>
+<!-- END org_person -->
 <!-- BEGIN view_footer -->
     <tr><td colspan="4">&nbsp;</td></tr>
     <tr>

Modified: branches/Version-0_9_16-branch/phpgwapi/inc/class.contacts_sql.inc.php
===================================================================
--- branches/Version-0_9_16-branch/phpgwapi/inc/class.contacts_sql.inc.php      
2009-02-21 12:44:53 UTC (rev 19091)
+++ branches/Version-0_9_16-branch/phpgwapi/inc/class.contacts_sql.inc.php      
2009-02-22 00:12:18 UTC (rev 19092)
@@ -1130,7 +1130,7 @@
                        $this->criteria(array('contact_id' => $contact_id));
                        if($get_org==True)
                        {
-                               $this->request(array('org_name', 'people'));
+                               $this->request(array('org_name', 'org_id', 
'people'));
                                $this->criteria(array('my_preferred' => 'Y'));
                        }
                        return $this->get_query($action, __LINE__, __FILE__);






reply via email to

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