phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] addressbook inc/class.boaddressbook.inc.php inc...


From: Dave Hall
Subject: [Phpgroupware-cvs] addressbook inc/class.boaddressbook.inc.php inc...
Date: Tue, 29 Aug 2006 16:02:43 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    addressbook
Changes by:     Dave Hall <skwashd>     06/08/29 16:02:43

Modified files:
        inc            : class.boaddressbook.inc.php 
                         class.soaddressbook.inc.php 
                         class.uiaddressbook.inc.php 
        templates/base : index.tpl principal_tabs.tpl 

Log message:
        lots of fixes for E_ALL, some code cleanup, and move more to CSS, still 
a WIP, might fix things on php5 (but untested)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.boaddressbook.inc.php?cvsroot=phpgroupware&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.soaddressbook.inc.php?cvsroot=phpgroupware&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uiaddressbook.inc.php?cvsroot=phpgroupware&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/index.tpl?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/principal_tabs.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3

Patches:
Index: inc/class.boaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.boaddressbook.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- inc/class.boaddressbook.inc.php     16 Aug 2006 15:00:45 -0000      1.29
+++ inc/class.boaddressbook.inc.php     29 Aug 2006 16:02:42 -0000      1.30
@@ -17,7 +17,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-/* $Id: class.boaddressbook.inc.php,v 1.29 2006/08/16 15:00:45 skwashd Exp $ */
+/* $Id: class.boaddressbook.inc.php,v 1.30 2006/08/29 16:02:42 skwashd Exp $ */
 
        class boaddressbook
        {
@@ -40,8 +40,9 @@
                var $cat_id;
                var $total;
                var $bday_internformat;
-               var $public_functions = array(
-                       'add_vcard' => True  // call from 
addressbook.uivcard.in to import a vcard
+               var $public_functions = array
+               (
+                       'add_vcard' => true  // call from 
addressbook.uivcard.in to import a vcard
                );
 
                function boaddressbook($session=True)
@@ -56,12 +57,12 @@
                        $this->note_type = $this->so->note_type;
                        $this->tab_main_persons = $this->so->tab_main_persons;
                        $this->tab_main_organizations = 
$this->so->tab_main_organizations;
-                       $this->bday_internformat = "Y-m-d"; // use ISO 8601 for 
internal bday represantation
+                       $this->bday_internformat = 'Y-m-d'; // use ISO 8601 for 
internal bday represantation
                        
                        if($session)
                        {
                                $this->read_sessiondata();
-                               $this->use_session = True;
+                               $this->use_session = true;
                        }
                        $this->_set_session_data();
                }
@@ -97,24 +98,27 @@
                {
                        /* _debug_array($GLOBALS['HTTP_POST_VARS']); */
                        /* Might change this to '' at the end---> */
-                       $_start   = get_var('start',Array('GET','POST'));
-                       $_query   = get_var('query',Array('GET','POST'));
-                       $_qfield  = get_var('qfield',Array('GET','POST'));
-                       $_sort    = get_var('sort',Array('GET','POST'));
-                       $_order   = get_var('order',Array('GET','POST'));
-                       $_filter  = get_var('filter',Array('GET','POST'));
-                       $_cat_id  = get_var('cat_id',Array('GET','POST'));
-                       $_fcat_id = get_var('fcat_id',Array('GET','POST'));
+                       $_start         = get_var('start', array('GET','POST'));
+                       $_query         = get_var('query', array('GET','POST'));
+                       $_qfield        = get_var('qfield', 
array('GET','POST'));
+                       $_limit         = get_var('limit', array('GET', 
'POST'));
+                       $_sort          = get_var('sort', array('GET','POST'));
+                       $_order         = get_var('order', array('GET','POST'));
+                       $_filter        = get_var('filter', 
array('GET','POST'));
+                       $_cat_id        = get_var('cat_id', 
array('GET','POST'));
+                       $_fcat_id       = get_var('fcat_id', 
array('GET','POST'));
 
                        if(!empty($_start) || ($_start == '0') || ($_start == 
0))
                        {
                                if($this->debug) { echo '<br />overriding 
$start: "' . $this->start . '" now "' . $_start . '"'; }
                                $this->start = $_start;
                        }
+                       
                        if($_limit)
                        {
                                $this->limit  = $_limit;
                        }
+                       
                        if((empty($_query) && !empty($this->query)) || 
!empty($_query))
                        {
                                if($this->debug) { echo '<br />overriding 
$query: "' . $this->query . '" now "' . urldecode(addslashes($_query)) . '"'; }
@@ -363,8 +367,9 @@
                */
                function get_orgs($fields, $start='', $limit='', $orderby='', 
$sort='', $criteria='', $token_criteria='')
                {
+                       $orgs = array();
                        $entries =  $this->so->get_orgs($fields, $start, 
$limit, $orderby, $sort, $criteria, $token_criteria);
-                       if(is_array($entries))
+                       if ( is_array($entries) && count($entries) )
                        {
                                foreach($entries as $data)
                                {
@@ -508,12 +513,14 @@
                */
                function criteria_contacts($access, $category, $field, 
$pattern, $show_fields)
                {
+                       $fields = array();
                        if($pattern)
                        {
                                switch($field)
                                {
                                case 'person':
-                                       $fields = array(
+                                               $fields = array
+                                               (
                                                'per_full_name',
                                                'per_prefix',
                                                'per_suffix',
@@ -523,7 +530,8 @@
                                                'per_department',
                                                'per_initials',
                                                'per_sound',
-                                               'per_active');
+                                                       'per_active'
+                                               );
                                        break;
                                case 'person_first':
                                        $fields = array('per_first_name');
@@ -542,13 +550,16 @@
                                        $fields['comm_media'] = $comms;
                                        break;
                                case 'location':
-                                       $fields = array('addr_add1',
+                                               $fields = array
+                                               (
+                                                       'addr_add1',
                                                        'addr_add2',
                                                        'addr_add3',
                                                        'addr_city',
                                                        'addr_state',
                                                        'addr_postal_code',
-                                                       'addr_country');
+                                                       'addr_country'
+                                               );
                                        break;
                                case 'other':
                                        $fields = array('other_value');
@@ -556,8 +567,11 @@
                                case 'note':
                                        $fields = array('note_text');
                                        break;
+                                       /*
+                                       not needed 
                                default:
                                        $fields = array();
+                                       */
                                }
                        }
                        return 
$this->so->criteria_contacts($GLOBALS['phpgw_info']['user']['account_id'], 
$access, $category, $fields, $pattern, $show_fields);

Index: inc/class.soaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.soaddressbook.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- inc/class.soaddressbook.inc.php     15 May 2005 13:34:29 -0000      1.20
+++ inc/class.soaddressbook.inc.php     29 Aug 2006 16:02:43 -0000      1.21
@@ -17,11 +17,52 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-/* $Id: class.soaddressbook.inc.php,v 1.20 2005/05/15 13:34:29 skwashd Exp $ */
+/* $Id: class.soaddressbook.inc.php,v 1.21 2006/08/29 16:02:43 skwashd Exp $ */
 
        class soaddressbook
        {
-               function soaddressbook($useacl=True)
+               
+               /**
+               * @var array $addr_type the address types available
+               */ 
+               var $addr_type;
+
+               /**
+               * @var array $comm_descr the high level communication types 
available
+               */
+               var $comm_descr;
+               
+               /**
+               * @var array $comm_type the low level communication types 
available
+               */
+               var $comm_type;
+
+               /**
+               * @var array $contact_type the types of contacts currently 
available
+               */
+               var $contact_type;
+
+               /**
+               * @var array $note_type the available note types
+               */
+               var $note_type;
+
+               /**
+               * @var ??? $tab_main_persons someone document me please but 
this one is used for organizations - think
+               */
+               var $tab_main_organizations;
+
+               /**
+               * @var ??? $tab_main_persons someone document me please
+               */
+               var $tab_main_persons;
+
+               /**
+               * @constructor
+               *
+               * @param bool $useacl respect the access controls - should be 
true unless you know what you are doing
+               */
+               function soaddressbook($useacl = true)
                {
                        $this->contacts = CreateObject('phpgwapi.contacts');
 
@@ -60,6 +101,7 @@
                        $this->contact_type = $this->contacts->contact_type;
                        $this->comm_descr = $this->contacts->comm_descr;
                        $this->comm_type = $this->contacts->comm_type;
+                       $this->note_type = $this->contacts->note_type;
                        $this->addr_type = $this->contacts->addr_type;
                        $this->tab_main_persons = 
$this->contacts->get_person_name();
                        $this->tab_main_organizations = 
$this->contacts->get_org_name();
@@ -1028,24 +1070,34 @@
                        return $this->contacts->check_delete($contact_id, 
$owner_id);
                }
 
-               /*************************************************************\
-               * Preferences functions section                               *
-               \*************************************************************/
-
+               /**
+               * Load a user's prefernces
+               *
+               * @param string $contact_type the current type of contacts 
being used [organization|persons]
+               * @return array list of fields the user wants displayed in 
summary view - empty array for not set
+               */
                function read_preferences($contact_type)
                {
-                       $prefs=$GLOBALS['phpgw']->preferences;
-                       $prefs=$prefs->data['addressbook'];
+                       $prefs =& 
$GLOBALS['phpgw']->preferences->data['addressbook'];
+
                        if($contact_type==$this->tab_main_persons)
                        {
-                               
+                               if ( isset($prefs['person_columns'])
+                                       && strlen($prefs['person_columns']) )
+                               {
                                return unserialize($prefs['person_columns']);
                        }
+                       }
                        elseif($contact_type==$this->tab_main_organizations)
                        {
+                               if ( isset($prefs['org_columns'])
+                                       && strlen($prefs['org_columns']) )
+                               {
                                return unserialize($prefs['org_columns']);
                        }       
                }
+                       return array();//whoops
+               }
 
        }
 ?>

Index: inc/class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- inc/class.uiaddressbook.inc.php     28 Aug 2006 09:48:09 -0000      1.66
+++ inc/class.uiaddressbook.inc.php     29 Aug 2006 16:02:43 -0000      1.67
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.uiaddressbook.inc.php,v 1.66 2006/08/28 09:48:09 skwashd Exp $ 
*/
+  /* $Id: class.uiaddressbook.inc.php,v 1.67 2006/08/29 16:02:43 skwashd Exp $ 
*/
 
 
        class uiaddressbook
@@ -63,29 +63,29 @@
 //             var $tab_extra = 'More data';
                
                //Public functions
-               var $public_functions = array(
-                       'index' => True,
-                       'view' => True,
-                       'add'  => True,
-                       'add_email' => True,
-                       'copy' => True,
-                       'edit' => True,
-                       'delete' => True,
-                       'preferences' => True,
-
-                       'add_person' => True,
-                       'add_org' => True,
-                       'edit_person' => True,
-                       'edit_org' => True,
-                       'view_contact' => True,
-                       'view_person' => True,
-                       'view_org' => True,
-                       'copy_person' => True,
-                       'copy_org' => True,
-                       'delete_person' => True,
-                       'delete_org' => True,
-                       'java_script' => True,
-                       'css' => True
+               var $public_functions = array
+               (
+                       'index'                 => true,
+                       'view'                  => true,
+                       'add'                   => true,
+                       'add_email'             => true,
+                       'copy'                  => true,
+                       'edit'                  => true,
+                       'delete'                => true,
+                       'preferences'   => true,
+                       'add_person'    => true,
+                       'add_org'               => true,
+                       'edit_person'   => true,
+                       'edit_org'              => true,
+                       'view_contact'  => true,
+                       'view_person'   => true,
+                       'view_org'              => true,
+                       'copy_person'   => true,
+                       'copy_org'              => true,
+                       'delete_person' => true,
+                       'delete_org'    => true,
+                       'java_script'   => true,
+                       'css'                   => true
                );
 
                function uiaddressbook()
@@ -137,7 +137,8 @@
 
                function _debug_sqsof()
                {
-                       $data = array(
+                       $data = array
+                       (
                                'start'  => $this->start,
                                'limit'  => $this->limit,
                                'query'  => $this->query,
@@ -154,7 +155,8 @@
                /* Called only by index(), just prior to page footer. */
                function save_sessiondata()
                {
-                       $data = array(
+                       $data = array
+                       (
                                'start'  => $this->start,
                                'limit'  => $this->limit,
                                'query'  => $this->query,
@@ -241,8 +243,8 @@
                        {
                                //Check if both the main column array and the 
comtype subarray
                                //are empty
-                               if((!$columns_to_display && 
!is_array($columns_to_display))
-                                       || 
(count($columns_to_display['comm_types'])<1) && count($columns_to_display) == 1)
+                               if((!$columns_to_display || 
!is_array($columns_to_display))
+                                       || ( 
isset($columns_to_display['comm_types']) && 
count($columns_to_display['comm_types']) < 1 ) && count($columns_to_display) == 
1 )
                                {
                                        $noprefs=lang('Please set your 
preferences for this application');
                                        // FIXME: Default values here! this is 
bad but is something
@@ -277,9 +279,9 @@
                        }
                        elseif ($this->section == $this->tab_main_organizations)
                        {
-                               if(!$columns_to_display && 
!is_array($columns_to_display))
+                               if ( !is_array($columns_to_display) || 
!count($columns_to_display) )
                                {
-                                       $noprefs=lang('Please set your 
preferences for this application');
+                                       $noprefs = lang('Please set your 
preferences for this application');
                                        // FIXME: Default values here! this is 
bad but is something
                                        $columns_to_display = array
                                        (
@@ -303,7 +305,7 @@
                                                          ));
                        }
                        
-                       $comms_array = 
$columns_to_display['comm_types']?$columns_to_display['comm_types']:array();
+                       //$comms_array = 
isset($columns_to_display['comm_types']) ? $columns_to_display['comm_types'] : 
array();
                        unset($columns_to_display['comm_types']);
                        $fields = array_keys($columns_to_display);
 
@@ -370,19 +372,20 @@
                        
//$this->template->set_var('principal_tab',$this->get_principal_tabs($this->section));
                        
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.index&section='.$this->tab_main_persons,
 
                                                  
$this->get_class_css($this->tab_main_persons, $this->section), 
-                                                 'principal_persons', 
$this->tab_main_persons);
+                                                 $this->tab_main_persons);
                        
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.index&section='.$this->tab_main_organizations,
 
                                                  
$this->get_class_css($this->tab_main_organizations, $this->section),
-                                                 'principal_orgs', 
$this->tab_main_organizations);
+                                                 
$this->tab_main_organizations);
 
                        /* global here so nextmatchs accepts our setting of 
$query and $filter */
                        $GLOBALS['query']  = $this->query;
                        $GLOBALS['filter'] = $this->filter;                     
                        
+                       //FIXME make show_tpl stop using theme values
                        $search_filter = $this->nextmatchs->show_tpl(
                                '/index.php', $this->start, $total_all_persons,
                                
'menuaction=addressbook.uiaddressbook.index&section='.$this->section,
-                               '90%', $GLOBALS['phpgw_info']['theme']['th_bg'],
+                               '90%', '',
                                
$search_obj,1,True,array('filter'=>$this->filter,'yours'=>1),$this->cat_id);
                        $query = $filter = '';
                        
@@ -401,13 +404,12 @@
 
                        $this->template->set_var('principal_tabs_inc', 
$this->template->fp('out', 'principal_tab'));
 
-                       
$this->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
                        $this->template->set_var('lang_view',lang('View'));
                        $this->template->set_var('lang_vcard',lang('VCard'));
                        $this->template->set_var('lang_edit',lang('Edit'));
                        $this->template->set_var('lang_owner',lang('Owner'));
 
-                       $this->template->set_var('searchreturn',$noprefs . ' ' 
. $searchreturn);
+                       $this->template->set_var('searchreturn', $noprefs);
                        $this->template->set_var('lang_showing',$lang_showing);
                        
$this->template->set_var('search_filter',$search_filter);
                        $this->template->set_var('cats',lang('Category'));
@@ -416,9 +418,6 @@
                        /* 
$this->template->set_var('cats_link',$this->cat_option($this->cat_id)); */
                        $this->template->set_var('lang_cats',lang('Select'));
 //                     
$this->template->set_var('lang_addressbook',lang('Address book'));
-                       
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-                       
$this->template->set_var('th_font',$GLOBALS['phpgw_info']['theme']['font']);
-                       
$this->template->set_var('th_text',$GLOBALS['phpgw_info']['theme']['th_text']);
                        $this->template->set_var('lang_add',lang('Add'));
                        
$this->template->set_var('lang_cat_cont',lang('Categorize'));
                        $this->template->set_var('cat_cont_url', 
$GLOBALS['phpgw']->link('/index.php',
@@ -433,26 +432,29 @@
                        $this->template->set_var('lang_export',lang('Export 
Contacts'));
                        
$this->template->set_var('export_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiXport.export'));
                        
-                       $export_vars = 
array('get_data_function'=>$get_data_function, 
-                                            'fields'=>$fields, 
-                                            'limit'=>$this->limit, 
-                                            'start'=>$this->start, 
-                                            
'order'=>($this->order?$this->order:''), 
-                                            
'sort'=>($this->sort?$this->sort:''), 
-                                            'criteria'=>$criteria, 
-                                            'fields_comms'=>$fields_comms, 
-                                            
'category_filter'=>$category_filter);
+                       $export_vars = array
+                       (
+                               'get_data_function'     => $get_data_function,
+                               'fields'                        => $fields,
+                               'limit'                         => $this->limit,
+                               'start'                         => $this->start,
+                               'order'                         => $this->order 
? $this->order : '',
+                               'sort'                          => $this->sort 
? $this->sort : '',
+                               'criteria'                      => $criteria,
+                               'fields_comms'          => $fields_comms,
+                               'category_filter'       =>$category_filter
+                       );
                        
$GLOBALS['phpgw']->session->appsession('export_vars','addressbook', 
$export_vars);
 
-                       $this->template->set_var('start',$this->start);
-                       $this->template->set_var('sort',$this->sort);
-                       $this->template->set_var('order',$this->order);
-                       $this->template->set_var('filter',$this->filter);
-                       $this->template->set_var('query',$this->query);
-                       $this->template->set_var('cat_id',$this->cat_id);
+                       $this->template->set_var('start', $this->start);
+                       $this->template->set_var('sort', $this->sort);
+                       $this->template->set_var('order', $this->order);
+                       $this->template->set_var('filter', $this->filter);
+                       $this->template->set_var('query', $this->query);
+                       $this->template->set_var('cat_id', $this->cat_id);
 
-                       $this->template->set_var('qfield',$qfield);
-                       $this->template->set_var('cols',$cols);
+                       $this->template->set_var('qfield', $this->qfield);
+                       $this->template->set_var('cols', $cols);
 
                        $this->template->pparse('out','addressbook_header');
 
@@ -461,41 +463,47 @@
 
                        $all_cols_to_display = array_merge($columns_to_display, 
$comms_array);
                        
+                       $i = 0;
                        foreach($entries as $entry)
                        {
+                               ++$i;
                                $this->template->set_var('columns','');
-                               $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
+                               $tr_color = $i % 2 ? 'row_on' : 'row_off';
                                
$this->template->set_var('row_tr_color',$tr_color);
                                $myid    = $entry['contact_id'];
                                $myowner = $entry['owner'];
 
                                /* each entry column */
-                               @reset($all_cols_to_display);
-                               while ($column = @each(($all_cols_to_display)))
+                               foreach ( $all_cols_to_display as $column )
                                {
-                                       $ref = $data='';
-                                       $coldata = $entry[$column[key]];
+                                       $ref = $data = '';
+                                       $coldata = isset($entry[$column]) ? 
$entry[$column] : '';
                                        // jecinc marker
-                                       if( $column[key]=='org_name' ) 
+                                       if( $column == 'org_name' ) 
                                        {
-                                               if($get_data_function == 
'get_persons')
+                                               if($get_data_function == 
'get_persons' )
                                                {
                                                        $org_data = 
$this->bo->get_orgs_person_data($myid);
+                                                       if ( 
is_array($org_data) && count($org_data) )
+                                                       {
                                                        $ref = '<a href="' . 
$GLOBALS['phpgw']->link("/index.php",
                                                                        
"menuaction=addressbook.uiaddressbook.view_org") . 
                                                                        
"&ab_id=" . $org_data[0]['my_org_id'] . '">' ;
                                                }
                                                else
                                                {
+                                                               $ref = '';
+                                                       }
+                                               }
+                                               else
+                                               {
                                                        $ref = '<a href="' . 
$GLOBALS['phpgw']->link("/index.php",
                                                                        
"menuaction=addressbook.uiaddressbook.view_org") .
                                                                        
"&ab_id=" . $myid . '">' ;
                                                }
-                                               $data =                 
htmlentities($coldata) . '</a>';
+                                               $data =         
htmlspecialchars($coldata) . '</a>';
                                        }
-                                       elseif(in_array($column[key], 
$fields_comms))
-                                       // jecinc marker
-                                       // if(in_array($column[key], 
$fields_comms))
+                                       else if ( in_array($column, 
$fields_comms) )
                                        {
                                                $data = 
$this->get_comm_value($myid, $column[key]);
                                                $data = htmlentities($data);
@@ -1707,14 +1715,19 @@
                * @param 
                * @return
                */
-               function get_principal_tabs($action, $class_css, $name, $value)
+               function get_principal_tabs($action, $class_css, $value)
                {
-
-                       $button = array('principal_action'      => 
$GLOBALS['phpgw']->link('/index.php',$action),
-                                       'principal_class_css'   => $class_css,
-                                       'principal_name'        => $name,
-                                       'principal_value'       => 
lang($value));
-                       $this->template->set_var($button);
+                       $tab = array
+                       (
+                               'principal_action'      => 
$GLOBALS['phpgw']->link('/index.php', $action),
+                               'principal_value'       => lang($value),
+                               'principal_tab_css'     => ''
+                       );
+                       if ( strlen($class_css) )
+                       {
+                               $tab['principal_tab_css'] = 
"class=\"$class_css\"";
+                       }
+                       $this->template->set_var($tab);
                        $this->template->parse('principal_buttons', 
'principal_button', True);
                }
 
@@ -1724,31 +1737,36 @@
                * @param 
                * @return
                */
-               function get_tabs($button_name, $button_caption, $class_css)
+               function get_tabs($tab_name, $tab_caption, $class_css)
                {
-                       $button = array('class_css' => $class_css,
-                                       'button_name'   => $button_name,
-                                       'button_caption'=> $button_caption);
-                       $this->template->set_var($button);
+                       $tab = array
+                       (
+                               'tab_name'              => $tab_name,
+                               'tab_caption'   => $tab_caption,
+                               'tab_css'               => ''
+                       );
+                       if ( strlen($class_css) )
+                       {
+                               $tab['tab_css'] = "class=\"$class_css\"";
+                       }
+                       $this->template->set_var($tab);
                        $this->template->parse('buttons', 'button', True);
                }
 
                /**
                * Get the correct css for the tab
                *
-               * @param 
-               * @return
+               * @param string $tab the tab to test
+               * @param string $current_tab the current section
+               * @return string the clasname
                */
                function get_class_css($tab, $current_tab)
                {
                        if ($tab == $current_tab)
                        {
-                               return 'button_style_sel';
-                       }
-                       else
-                       {
-                               return 'button_style';
+                               return 'activetab';
                        }
+                       return '';
                }
 
                /**
@@ -2571,7 +2589,7 @@
                                {
                                        if($data['other_name'] == 
$add_data['other_name'])
                                        {
-                                               $exist_name = True;
+                                               $exist_name = true;
                                        }
                                }
                                if($exist_name==False)

Index: templates/base/index.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/index.tpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- templates/base/index.tpl    15 May 2005 13:34:30 -0000      1.3
+++ templates/base/index.tpl    29 Aug 2006 16:02:43 -0000      1.4
@@ -1,49 +1,44 @@
 <!-- BEGIN addressbook_header -->
-<center>
-<table width="95%" border="0" cellspacing="1" cellpadding="3">
-<tr>
 {principal_tabs_inc}
-</tr>
-</table>
 
 {lang_showing}
 <br />{searchreturn}
 {search_filter}
 
-<table width="95%" border="0" cellspacing="1" cellpadding="3">
-<tr bgcolor="{th_bg}">
+<table>
+       <thead>
+               <tr bgcolor="{th_bg}">
   {cols}
   <td>{lang_view}</td>
   <td>{lang_vcard}</td>
   <td>{lang_edit}</td>
   <td>{lang_owner}</td>
-</tr>
+               </tr>
+       </thead>
+       <tbody>
 <!-- END addressbook_header -->
 
 <!-- BEGIN column -->
-  <td valign="top">{col_data}&nbsp;</td>
+                       <td>{col_data}&nbsp;</td>
 <!-- END column -->
 
 <!-- BEGIN row -->
-<tr bgcolor="{row_tr_color}">{columns}
-  <td valign="top" width="3%"><a href="{row_view_link}">{lang_view}</a></td>
-  <td valign="top" width="3%"><a href="{row_vcard_link}">{lang_vcard}</a></td>
-  <td valign="top" width="5%">{row_edit}</td>
-  <td valign="top" width="5%">{row_owner}</td>
-</tr>
+               <tr class="{row_tr_color}">
+                       {columns}
+                       <td><a href="{row_view_link}">{lang_view}</a></td>
+                       <td><a href="{row_vcard_link}">{lang_vcard}</a></td>
+                       <td>{row_edit}</td>
+                       <td>{row_owner}</td>
+               </tr>
 <!-- END row -->
 
 <!-- BEGIN addressbook_footer -->
- </table>
- <table width="95%" border="0" cellspacing="0" cellpadding="4">
-   <tr bgcolor="{th_bg}"> 
+       </tbody>
+</table>
      <form action="{add_url}"    method="post"><td width="16%"><input 
type="submit" name="Add"      value="{lang_add}"></td></form>
      <form action="{cat_cont_url}" method="post"><td width="16%"><input 
type="submit" name="Categorize" value="{lang_cat_cont}"></td></form>
      <form action="{vcard_url}"  method="post"><td width="16%"><input 
type="submit" name="AddVcard" value="{lang_addvcard}"></td></form>
      <form action="{import_url}" method="post"><td width="16%"><input 
type="submit" name="Import"   value="{lang_import}"></td></form>
      <form action="{import_alt_url}" method="post"><td width="16%"><input 
type="submit" name="Import" value="{lang_import_alt}"></td></form>
      <form action="{export_url}" method="post"><td width="16%"><input 
type="submit" name="Export"   value="{lang_export}"></td></form>
-   </tr>
- </table>
-</center>
 <!-- END addressbook_footer -->

Index: templates/base/principal_tabs.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/principal_tabs.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/principal_tabs.tpl   31 Dec 2004 04:55:24 -0000      1.2
+++ templates/base/principal_tabs.tpl   29 Aug 2006 16:02:43 -0000      1.3
@@ -1,19 +1,10 @@
 <!-- BEGIN principal_tab -->
-<td>
-<table border="0" cellspacing="0" cellpadding="0">
-
-<tr>
-{principal_buttons}
-</tr>
-
-</table>
-</td>
+       <ul id="contacts_tabs" class="tabs">
+               {principal_buttons}
+               <li class="tablast">&nbsp;</li>
+       </ul>
 <!-- END principal_tab -->
 
 <!-- BEGIN principal_button -->
-<td align="left">
-<form action="{principal_action}" method="post">
-<input class="{principal_class_css}" type="submit" name="{principal_name}" 
value="{principal_value}">
-</form>
-</td>
+               <li {principal_tab_css}><a 
href="{principal_action}">{principal_value}</a>
 <!-- END principal_button -->
\ No newline at end of file




reply via email to

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