[Top][All Lists]
[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: |
Fri, 01 Sep 2006 14:44:43 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: addressbook
Changes by: Dave Hall <skwashd> 06/09/01 14:44:43
Modified files:
inc : class.boaddressbook.inc.php
class.uiaddressbook.inc.php
class.uifields.inc.php
templates/base : body_detail.tpl index.tpl tab.tpl view.tpl
Added files:
templates/base/css: base.css
Log message:
major code clean up, should now run with E_ALL (orgs still needs some
work done) and works with CSS, only tested with idots, might looks a little
dodgy on other template sets
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.boaddressbook.inc.php?cvsroot=phpgroupware&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uiaddressbook.inc.php?cvsroot=phpgroupware&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uifields.inc.php?cvsroot=phpgroupware&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/body_detail.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/index.tpl?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/tab.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/view.tpl?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/css/base.css?cvsroot=phpgroupware&rev=1.1
Patches:
Index: inc/class.boaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.boaddressbook.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- inc/class.boaddressbook.inc.php 29 Aug 2006 16:02:42 -0000 1.30
+++ inc/class.boaddressbook.inc.php 1 Sep 2006 14:44:43 -0000 1.31
@@ -17,7 +17,7 @@
* option) any later version. *
\**************************************************************************/
-/* $Id: class.boaddressbook.inc.php,v 1.30 2006/08/29 16:02:42 skwashd Exp $ */
+/* $Id: class.boaddressbook.inc.php,v 1.31 2006/09/01 14:44:43 skwashd Exp $ */
class boaddressbook
{
@@ -34,6 +34,7 @@
var $start;
var $limit;
var $query;
+ var $qfield;
var $sort;
var $order;
var $filter;
@@ -83,6 +84,8 @@
$data =
$GLOBALS['phpgw']->session->appsession('session_data','addressbook');
if($this->debug) { echo '<br />Read:';
_debug_array($data); }
+ if ( is_array($data) && count($data) )
+ {
$this->start = $data['start'];
$this->limit = $data['limit'];
$this->query = $data['query'];
@@ -91,6 +94,7 @@
$this->filter = $data['filter'];
$this->cat_id = $data['cat_id'];
$this->qfield = $data['qfield'];
+ }
if($this->debug) { echo '<br />read_sessiondata();';
$this->_debug_sqsof(); }
}
@@ -196,13 +200,16 @@
{
$entry =
$this->so->get_principal_persons_data($person_id, $get_org);
+ $entry[0]['org_link'] = '';
+ if ( isset($entry[0]['org_id']) && $entry[0]['org_id']
> 0 )
+ {
$entry[0]['org_link'] =
$GLOBALS['phpgw']->link('/index.php',
array
(
'menuaction'
=> 'addressbook.uiaddressbook.view_org',
'ab_id'
=> $entry[0]['org_id']
- )
- );
+ ));
+ }
$entry[0]['tab_cats']['my_cats'] = explode(",",
$entry[0]['cat_id']);
$entry[0]['tab_extra']['per_suffix'] =
$entry[0]['per_suffix'];
@@ -454,21 +461,18 @@
return $data;
}
+ $comm_data = array();
if(is_array($data))
{
foreach($data as $key => $value)
{
$comm_data[$value['comm_contact_id']][$value['comm_description']] =
$value['comm_data'];
- if($value['comm_preferred']=='Y')
+ if ( $value['comm_preferred'] == 'Y' )
{
$comm_data[$value['comm_contact_id']]['preferred'] = $value['comm_description'];
}
}
}
- else
- {
- $comm_data = array();
- }
return $comm_data;
}
Index: inc/class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- inc/class.uiaddressbook.inc.php 29 Aug 2006 16:02:43 -0000 1.67
+++ inc/class.uiaddressbook.inc.php 1 Sep 2006 14:44:43 -0000 1.68
@@ -1,5 +1,5 @@
<?php
- /**************************************************************************\
+/**************************************************************************\
* phpGroupWare - Addressbook *
* http://www.phpgroupware.org *
* Originally Written by Joseph Engo <address@hidden> and *
@@ -12,11 +12,11 @@
* option) any later version. *
\**************************************************************************/
- /* $Id: class.uiaddressbook.inc.php,v 1.67 2006/08/29 16:02:43 skwashd Exp $
*/
+/* $Id: class.uiaddressbook.inc.php,v 1.68 2006/09/01 14:44:43 skwashd Exp $ */
- class uiaddressbook
- {
+class uiaddressbook
+{
var $contacts;
var $bo;
var $cat;
@@ -42,25 +42,42 @@
var $my_orgs_data;
var $comm_v;
- //@param fields_data
- //@discussion Will hold the data to navigate between the tabs
+ /**
+ * @var array $fields_data holds the data to navigate between the tabs
+ */
var $fields_data = array();
var $entry_data;
-// //This are the principal tabs
-// var $tab_main_persons = 'Persons';
-// var $tab_main_organizations = 'Organizations';
+ /**
+ * @var string $action the current modifying action
+ */
+ var $action = '';
+
+ /**
+ * @var string $submit the form submit action, only set to a real value
on POST
+ */
+ var $submit = '';
+
+ /**
+ * @var int $owner the user who will "own" any records created, can be
different to current user
+ * @todo confirm that this is docmented correctly
+ */
+ var $owner;
+
+ // //This are the principal tabs
+ // var $tab_main_persons = 'Persons';
+ // var $tab_main_organizations = 'Organizations';
//This are the tabs for each principal tab
-// var $tab_person_data = 'Person Data';
-// var $tab_org_data = 'Org Data';
-// var $tab_orgs = 'Orgs';
-// var $tab_persons = 'Persons';
-// var $tab_cats = 'Categories';
-// var $tab_comms = 'Communications';
-// var $tab_address = 'Address';
-// var $tab_others = 'Others';
-// var $tab_extra = 'More data';
+ // var $tab_person_data = 'Person Data';
+ // var $tab_org_data = 'Org Data';
+ // var $tab_orgs = 'Orgs';
+ // var $tab_persons = 'Persons';
+ // var $tab_cats = 'Categories';
+ // var $tab_comms = 'Communications';
+ // var $tab_address = 'Address';
+ // var $tab_others = 'Others';
+ // var $tab_extra = 'More data';
//Public functions
var $public_functions = array
@@ -223,7 +240,8 @@
$this->limit = 15;
}
- if(!isset($this->cat_id))
+ $this->cat_id = 0;
+ if(!isset($this->cat_id) &&
isset($this->prefs['default_category']) )
{
$this->cat_id =
$this->prefs['default_category'];
}
@@ -370,10 +388,11 @@
/* set basic vars and parse the header */
//$this->template->set_var('principal_tab',$this->get_principal_tabs($this->section));
-
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.index§ion='.$this->tab_main_persons,
+ $this->get_principal_tabs( array('menuaction' =>
'addressbook.uiaddressbook.index', 'section' => $this->tab_main_persons),
$this->get_class_css($this->tab_main_persons, $this->section),
$this->tab_main_persons);
-
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.index§ion='.$this->tab_main_organizations,
+
+ $this->get_principal_tabs( array('menuaction' =>
'addressbook.uiaddressbook.index', 'section' => $this->tab_main_organizations),
$this->get_class_css($this->tab_main_organizations, $this->section),
$this->tab_main_organizations);
@@ -417,7 +436,7 @@
'menuaction=addressbook.uiaddressbook.index§ion='.$this->section));
/*
$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('lang_addressbook',lang('Address book'));
$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',
@@ -463,13 +482,12 @@
$all_cols_to_display = array_merge($columns_to_display,
$comms_array);
- $i = 0;
+ $tr_class = 'row_off';
foreach($entries as $entry)
{
- ++$i;
$this->template->set_var('columns','');
- $tr_color = $i % 2 ? 'row_on' : 'row_off';
-
$this->template->set_var('row_tr_color',$tr_color);
+ $tr_class =
$GLOBALS['phpgw']->nextmatchs->alternate_row_class($tr_class);
+ $this->template->set_var('row_tr_class',$tr_class);
$myid = $entry['contact_id'];
$myowner = $entry['owner'];
@@ -599,8 +617,8 @@
//set some variables which will be used
$this->mode = 'add';
$this->section = $this->tab_main_persons;
- $this->form_action =
'menuaction=addressbook.uiaddressbook.add_person';
- $this->form_index =
'menuaction=addressbook.uiaddressbook.index§ion='.$this->section;
+ $this->form_action = array('menuaction' =>
'addressbook.uiaddressbook.add_person');
+ $this->form_index = array('menuaction' =>
'addressbook.uiaddressbook.index', 'section' => $this->section);
//get all vars which was send in post or get
$this->get_vars();
@@ -657,8 +675,8 @@
$this->entry = $this->read_tab_session($this->tab);
//start to draw the add window
-// $GLOBALS['phpgw']->common->phpgw_header();
-// echo parse_navbar();
+ //
$GLOBALS['phpgw']->common->phpgw_header();
+ // echo parse_navbar();
//draw the tabs and detail form
$this->entry['old_tab'] = $this->tab;
@@ -666,9 +684,8 @@
}
/**
- * Edit Person Enviromet, this controls all process to edit a
person
+ * Edit a Person entry
*
- * @param
* @return
*/
function edit_person()
@@ -676,26 +693,36 @@
//set some variables which will be used
$this->mode = 'edit';
$this->section = $this->tab_main_persons;
- $this->form_action =
'menuaction=addressbook.uiaddressbook.edit_person';
- $this->form_index =
'menuaction=addressbook.uiaddressbook.index§ion='.$this->section;
+ $this->form_action = array('menuaction' =>
'addressbook.uiaddressbook.edit_person');
+ $this->form_index = array('menuaction' =>
'addressbook.uiaddressbook.index', 'section' => $this->section);
//get all vars which was send in post or get
$this->get_vars();
+ /* First, make sure they have permission to this entry */
+ $this->owner = isset($this->entry['owner']) ?
$this->entry['owner'] : $this->owner;
+ if(!$this->bo->check_edit($this->contact_id, $this->owner))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
$this->form_index);
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
//check if is the first time that get into edit
if($this->firsttime)
{
- $this->entry = '';
+ $this->entry = array();
$this->clear_tab_session();
$this->load_tabs('db');
}
+ else
+ {
+ //save the old tab data
+
$this->save_tab_session(stripslashes($this->entry['old_tab']), $this->entry);
+ }
//validate if add/edit/delete functions would be run
$this->managment_functions($this->action);
- //save the old tab data
-
$this->save_tab_session(stripslashes($this->entry['old_tab']), $this->entry);
-
//if not exist tab selected use as defaul person_data
if(!$this->tab)
{
@@ -712,7 +739,8 @@
$this->bo->edit_person($this->contact_id,
$fields);
- $GLOBALS['phpgw']->redirect_link('/index.php',
array
+ $GLOBALS['phpgw']->redirect_link('/index.php',
+ array
(
'menuaction' =>
'addressbook.uiaddressbook.view_person',
'ab_id' => $this->contact_id,
@@ -723,7 +751,8 @@
$GLOBALS['phpgw']->redirect_link('/index.php',
$this->form_index);
break;
case 'delete':
- $GLOBALS['phpgw']->redirect_link('/index.php',
array
+ $GLOBALS['phpgw']->redirect_link('/index.php',
+ array
(
'menuaction' =>
'addressbook.uiaddressbook.delete_person',
'ab_id' => $this->contact_id
@@ -739,17 +768,7 @@
//read the current tab information
$this->entry = $this->read_tab_session($this->tab);
- /* First, make sure they have permission to this entry
*/
- $this->owner =
$this->entry['owner']?$this->entry['owner']:$this->owner;
- if(!$this->bo->check_edit($this->contact_id,
$this->owner))
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
$this->form_index);
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
- //start to draw the add window
-// $GLOBALS['phpgw']->common->phpgw_header();
-// echo parse_navbar();
//draw the tabs and detail form
$this->entry['old_tab'] = $this->tab;
@@ -759,12 +778,12 @@
/**
* Delete persons from db
*
- * @param
- * @return
+ * @param int $person_id the person to delete from the db
+ * @return nothing? wtf? it should be bool
*/
- function delete_person($person_id='')
+ function delete_person($person_id = 0)
{
- if($person_id=='')
+ if ( $person_id == 0 )
{
$person_id = get_var('ab_id');
}
@@ -816,8 +835,8 @@
//set some variables which will be used
$this->mode = 'add';
$this->section = $this->tab_main_organizations;
- $this->form_action =
'menuaction=addressbook.uiaddressbook.add_org';
- $this->form_index =
'menuaction=addressbook.uiaddressbook.index§ion='.$this->section;
+ $this->form_action = array('menuaction' =>
'addressbook.uiaddressbook.add_org');
+ $this->form_index = array('menuaction' =>
'addressbook.uiaddressbook.index', 'section' => $this->section);
//get all vars which was send in post or get
$this->get_vars();
@@ -870,8 +889,8 @@
$this->entry = $this->read_tab_session($this->tab);
//start to draw the add window
-// $GLOBALS['phpgw']->common->phpgw_header();
-// echo parse_navbar();
+ //
$GLOBALS['phpgw']->common->phpgw_header();
+ // echo parse_navbar();
//draw the tabs and detail form
$this->entry['old_tab'] = $this->tab;
@@ -959,8 +978,8 @@
}
//start to draw the add window
-// $GLOBALS['phpgw']->common->phpgw_header();
-// echo parse_navbar();
+ //
$GLOBALS['phpgw']->common->phpgw_header();
+ // echo parse_navbar();
//draw the tabs and detail form
$this->entry['old_tab'] = $this->tab;
@@ -1025,14 +1044,13 @@
*/
function main_form($fields, $section, $form_tab)
{
- $this->jscal = CreateObject('phpgwapi.jscalendar');
// before phpgw_header() !!!
+ $this->jscal = CreateObject('phpgwapi.jscalendar'); //
before phpgw_header()
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
//print 'fields:<br />';
$js_submit = '';
- $fields['owner'] =
$fields['owner']?$fields['owner']:$this->owner;
+ $fields['owner'] = isset($fields['owner']) ? $fields['owner'] :
$this->owner;
if ($this->bo->check_delete($this->contact_id))
{
$delete = '<input type="submit" name="delete"
value="' . lang('Delete') . '">';
@@ -1050,10 +1068,11 @@
$this->template->set_block('principal_tabs','principal_tab','principal_tab');
$this->template->set_block('principal_tabs',
'principal_button', 'principal_button');
-
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.add_person',
+ $this->get_principal_tabs( array('menuaction' =>
'addressbook.uiaddressbook.add_person'),
$this->get_class_css($this->tab_main_persons, $this->section),
'principal_persons',
$this->tab_main_persons);
-
$this->get_principal_tabs('menuaction=addressbook.uiaddressbook.add_org',
+
+ $this->get_principal_tabs( array('menuaction' =>
'addressbook.uiaddressbook.add_org'),
$this->get_class_css($this->tab_main_organizations, $this->section),
'principal_orgs',
$this->tab_main_organizations);
@@ -1094,29 +1113,12 @@
switch ($section)
{
- case $this->tab_main_persons:
- if (!$form_tab)
- {
- $form_tab=$this->tab_person_data;
- }
-
- $this->template->set_var('action',
$GLOBALS['phpgw']->link('/index.php',
- $this->form_action));
- $this->get_tabs('bname',
$this->tab_person_data, $this->get_class_css($this->tab_person_data,
$form_tab));
- $this->get_tabs('bname', $this->tab_orgs,
$this->get_class_css($this->tab_orgs, $form_tab));
- $this->get_tabs('bname', $this->tab_cats,
$this->get_class_css($this->tab_cats, $form_tab));
- $this->get_tabs('bname', $this->tab_comms,
$this->get_class_css($this->tab_comms, $form_tab));
- $this->get_tabs('bname', $this->tab_address,
$this->get_class_css($this->tab_address, $form_tab));
- $this->get_tabs('bname', $this->tab_others,
$this->get_class_css($this->tab_others, $form_tab));
- $this->get_tabs('bname', $this->tab_extra,
$this->get_class_css($this->tab_extra, $form_tab));
- break;
case $this->tab_main_organizations:
if (!$form_tab)
{
$form_tab=$this->tab_org_data;
}
- $this->template->set_var('action',
$GLOBALS['phpgw']->link('/index.php',
- $this->form_action));
+ $this->template->set_var('action',
$GLOBALS['phpgw']->link('/index.php',$this->form_action));
$this->get_tabs('bname', $this->tab_org_data,
$this->get_class_css($this->tab_org_data, $form_tab));
$this->get_tabs('bname', $this->tab_persons,
$this->get_class_css($this->tab_persons, $form_tab));
$this->get_tabs('bname', $this->tab_cats,
$this->get_class_css($this->tab_cats, $form_tab));
@@ -1124,9 +1126,15 @@
$this->get_tabs('bname', $this->tab_address,
$this->get_class_css($this->tab_address, $form_tab));
$this->get_tabs('bname', $this->tab_others,
$this->get_class_css($this->tab_others, $form_tab));
break;
+
+ case $this->tab_main_persons:
default:
- $this->template->set_var('action',
$GLOBALS['phpgw']->link('/index.php',
- $this->form_action));
+ if (!$form_tab)
+ {
+ $form_tab = $this->tab_person_data;
+ }
+
+ $this->template->set_var('action',
$GLOBALS['phpgw']->link('/index.php', $this->form_action));
$this->get_tabs('bname',
$this->tab_person_data, $this->get_class_css($this->tab_person_data,
$form_tab));
$this->get_tabs('bname', $this->tab_orgs,
$this->get_class_css($this->tab_orgs, $form_tab));
$this->get_tabs('bname', $this->tab_cats,
$this->get_class_css($this->tab_cats, $form_tab));
@@ -1134,6 +1142,7 @@
$this->get_tabs('bname', $this->tab_address,
$this->get_class_css($this->tab_address, $form_tab));
$this->get_tabs('bname', $this->tab_others,
$this->get_class_css($this->tab_others, $form_tab));
$this->get_tabs('bname', $this->tab_extra,
$this->get_class_css($this->tab_extra, $form_tab));
+ break;
}
$this->template->set_var('tab',
$this->template->fp('out', 'tab'));
@@ -1168,7 +1177,15 @@
$defaul_orgs_name='entry[preferred_org]';
$fields_to_search=array('contact_id',
'org_name');
+ if ( isset($fields['my_orgs']) )
+ {
$this->get_orgs($fields_to_search,
$fields['my_orgs']);
+ }
+
+ if ( !isset($fields['preferred_org']) )
+ {
+ $fields['preferred_org'] = 0;
+ }
return
$this->many_actions_form($this->tab_orgs, $all_orgs_name,
$my_orgs_name, $defaul_orgs_name,
'all_orgs_data',
@@ -1180,8 +1197,12 @@
$my_cats_name='entry[my_cats][]';
$all_cats_name='entry[all_cats][]';
//$defaul_cats_name='entry[current_cats]';
+ if ( !isset($fields['my_cats']) )
+ {
+ $fields['my_cats'] = array();
+ }
- $fields_to_search=array('cat_id', 'cat_name');
+ $fields_to_search = array('cat_id', 'cat_name');
$this->get_cats($fields_to_search,
$fields['my_cats']);
return
$this->many_actions_form($this->tab_cats, $all_cats_name,
@@ -1252,13 +1273,12 @@
4 => array('Last Name',
'entry[per_last_name]', $fields['per_last_name']),
5 => array('Title', 'entry[per_title]',
$fields['per_title']),
6 => array('Department',
'entry[per_department]', $fields['per_department']),
- 7 => array('Email', 'entry[email]',
$fields['email']),
- 8 => array('Phone', 'entry[wphone]',
$fields['wphone']),
+ 7 => array('Email', 'entry[email]',
isset($fields['email']) ? $fields['email'] : ''),
+ 8 => array('Phone', 'entry[wphone]',
isset($fields['wphone']) ? $fields['wphone'] : ''),
9 => array('Private', $access_check,
'special'),
10 => array('Birthday', $bday, 'special')
));
- $this->form_end();
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1287,7 +1307,6 @@
2 => array('Phone',
'entry[wphone]', $fields['wphone']),
3 => array('Private',
$access_check, 'special'),
4 =>
array('','','special')));
- $this->form_end();
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1301,30 +1320,27 @@
{
$this->form_start();
- $this->template->set_var('lang_general_data',
lang('Communication Data for').' '.$this->record_name);
+ $this->template->set_var('lang_general_data',
lang('Communication Data for') . ' ' . $this->record_name);
+
+ $types_data = array
+ (
+ 'data1' => array('type' => 'data', 'field' =>
'comm_description'),
+ 'text1' => array('type' => 'text', 'name' =>
'entry[comm_data]', 'field' => 'comm_description', 'value' => 'comm_data'),
+ 'radio1'=> array('type' => 'radio', 'name' =>
'entry[preferred]', 'field' => 'preferred', 'value' => 'comm_description')
+ );
- $types_data = array('data1' => array('type' => 'data',
- 'field' =>
'comm_description'),
- 'text1' => array('type' => 'text',
- 'name' =>
'entry[comm_data]',
- 'field' =>
'comm_description',
- 'value' =>
'comm_data'),
- 'radio1'=> array('type' => 'radio',
- 'name' =>
'entry[preferred]',
- 'field' =>
'preferred',
- 'value' =>
'comm_description'));
foreach($this->comm_descr as $key => $value)
{
- $this->array_data[] = array('comm_description'
=> $value['comm_description'],
- 'comm_data' =>
$fields['comm_data'][$value['comm_description']],
- 'preferred' =>
($fields['preferred'] == $value['comm_description'])?'Y':'N');
+ $this->array_data[] = array
+ (
+ 'comm_description' =>
$value['comm_description'],
+ 'comm_data' =>
isset($fields['comm_data'][$value['comm_description']]) ?
$fields['comm_data'][$value['comm_description']] : '',
+ 'preferred' => $fields['preferred'] ==
$value['comm_description'] ? 'Y' : 'N'
+ );
}
- $this->template->set_var('detail_fields',
$this->get_detail_form('comm',
- array('Description',
'Value','Preferred'),
- 'array_data',
$types_data, 'key_comm_id', False));
+ $this->template->set_var('detail_fields',
$this->get_detail_form('comm', array('Description', 'Value','Preferred'),
'array_data', $types_data, 'key_comm_id', False));
- $this->form_end();
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1336,14 +1352,53 @@
*/
function address_form($fields)
{
+ if ( isset($fields['tmp_data']['addr'])
+ && is_array($fields['tmp_data']['addr'])
+ && isset($fields['tmp_data']['addr']['addr_add1']) )
+ {
+ echo '<pre>' . print_r($fields['tmp_data']['addr'],
true) . '</pre>';
+ $this->set_form_fields(array
+ (
+ 1 => array('Address 1',
'entry[tmp_data][addr][addr_add1]', $fields['tmp_data']['addr']['addr_add1']),
+ 2 => array('Address 2',
'entry[tmp_data][addr][addr_add2]', $fields['tmp_data']['addr']['addr_add2']),
+ 3 => array('City',
'entry[tmp_data][addr][addr_city]', $fields['tmp_data']['addr']['addr_city']),
+ 4 => array('State',
'entry[tmp_data][addr][addr_state]', $fields['tmp_data']['addr']['addr_state']),
+ 5 => array('Postal Code',
'entry[tmp_data][addr][addr_postal_code]',
$fields['tmp_data']['addr']['addr_postal_code']),
+ 6 => array('Country',
'entry[tmp_data][addr][addr_country]',
$fields['tmp_data']['addr']['addr_country']),
+ 7 => array(lang('Type'), $addresstype,
'special'),
+ 8 => array('', $addr_preferred, 'special')
+ ));
+
+ if ( isset($fields['addr_preferred']) &&
isset($this->array_data[$fields['addr_preferred']]) )
+ {
+
$this->array_data[$fields['addr_preferred']]['addr_preferred'] = 'Y';
+ }
+ }
+ else
+ {
+ $fields['tmp_data']['addr'] = array
+ (
+ 'addr_add1' => '',
+ 'addr_add2' => '',
+ 'addr_city' => '',
+ 'addr_state' => '',
+ 'addr_postal_code' => '',
+ 'addr_country' => '',
+ 'addr_type' => '',
+ 'addr_preferred' => false,
+ 'key_addr_id' => 0,
+ 'action' => ''
+ );
+ }
+
$addresstype='<select
name="entry[tmp_data][addr][addr_type]">'
- .
$this->get_addr_type($fields[tmp_data][addr][addr_type]) . '</select>';
+ .
$this->get_addr_type($fields['tmp_data']['addr']['addr_type']) . '</select>';
$addr_preferred = '<input type="hidden"
name="entry[tmp_data][addr][addr_preferred]" value="'
- .$fields[tmp_data][addr][addr_preferred].'">';
+ .$fields['tmp_data']['addr']['addr_preferred'].'">';
- $key_addr_id_name='entry[tmp_data][addr][key_addr_id]';
- $key_addr_id=$fields[tmp_data][addr]['key_addr_id'];
+ $key_addr_id_name = 'entry[tmp_data][addr][key_addr_id]';
+ $key_addr_id = $fields['tmp_data']['addr']['key_addr_id'];
$this->form_start();
@@ -1352,50 +1407,22 @@
$this->template->set_var('current_id_name',
$key_addr_id_name);
$this->template->set_var('current_id', $key_addr_id);
$this->template->set_var('current_action_name',
'entry[tmp_data][addr][action]');
- $this->template->set_var('current_action',
$fields[tmp_data][addr]['action']);
+ $this->template->set_var('current_action',
$fields['tmp_data']['addr']['action']);
- $this->set_form_fields(array
+ $types_data = array
(
- 1 => array('Address 1',
'entry[tmp_data][addr][addr_add1]', $fields['tmp_data']['addr']['addr_add1']),
- 2 => array('Address 2',
'entry[tmp_data][addr][addr_add2]', $fields[tmp_data]['addr']['addr_add2']),
- 3 => array('City',
'entry[tmp_data][addr][addr_city]', $fields[tmp_data]['addr']['addr_city']),
- 4 => array('State',
'entry[tmp_data][addr][addr_state]', $fields[tmp_data]['addr']['addr_state']),
- 5 => array('Postal Code',
'entry[tmp_data][addr][addr_postal_code]',
$fields[tmp_data]['addr']['addr_postal_code']),
- 6 => array('Country',
'entry[tmp_data][addr][addr_country]',
$fields[tmp_data]['addr']['addr_country']),
- 7 => array(lang('Type'), $addresstype,
'special'),
- 8 => array('', $addr_preferred, 'special')
- ));
-
- $types_data = array('data1' => array('type' => 'data',
- 'field' =>
'addr_description'),
- 'data2' => array('type' => 'data',
- 'field' =>
'addr_add1'),
- 'radio1'=> array('type' => 'radio',
- 'name' =>
'entry[addr_preferred]',
- 'field' =>
'addr_preferred',
- 'value' =>
'key_addr_id'),
- 'link1' => array('type' => 'link',
- 'mode' => 'edit',
- 'key' =>
'key_addr_id',
- 'action'=>
'addr_edit_row',
- 'extra' =>
'&owner='.$this->owner.'&ab_id='.$this->contact_id.'&record_name='.$this->record_name),
- 'link2' => array('type' => 'link',
- 'mode' =>
'delete',
- 'key' =>
'key_addr_id',
- 'action'=>
'addr_del_row',
- 'extra' =>
'&owner='.$this->owner.'&ab_id='.$this->contact_id.'&record_name='.$this->record_name));
+ 'data1' => array('type' => 'data', 'field' =>
'addr_description'),
+ 'data2' => array('type' => 'data', 'field' =>
'addr_add1'),
+ 'radio1'=> array('type' => 'radio', 'name' =>
'entry[addr_preferred]', 'field' => 'addr_preferred', 'value' => 'key_addr_id'),
+ 'link1' => array('type' => 'link', 'mode' => 'edit',
'key' => 'key_addr_id', 'action'=> 'addr_edit_row', 'extra' => array('owner'
=> $this->owner, 'ab_id' => $this->contact_id, 'record_name' =>
$this->record_name) ),
+ 'link2' => array('type' => 'link', 'mode' =>
'delete', 'key' => 'key_addr_id', 'action'=> 'addr_del_row', 'extra' =>
array('owner' => $this->owner, 'ab_id' => $this->contact_id, 'record_name' =>
$this->record_name))
+ );
$this->array_data =
$this->read_tab_session('addr_data');
//var_export($fields);
//var_export($this->array_data);
- if(isset($this->array_data[$fields['addr_preferred']]))
- {
-
$this->array_data[$fields['addr_preferred']]['addr_preferred'] = 'Y';
- }
- $this->template->set_var('detail_fields',
$this->get_detail_form('address',
- array('Type',
'Address', 'Preferred', 'Edit','Delete'),
- 'array_data',
$types_data, 'key_addr_id'));
- $this->form_end();
+ $this->template->set_var('detail_fields',
+ $this->get_detail_form('address', array('Type',
'Address', 'Preferred', 'Edit','Delete'), 'array_data', $types_data,
'key_addr_id'));
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1412,14 +1439,14 @@
$other_descr='<input type="text" name="'
. 'entry[tmp_data][others][other_name]'
. '" value="'
- . $fields[tmp_data][others]['other_name'] .
'">';
+ . $fields['tmp_data']['others']['other_name'] . '">';
$other_value='<input type="text" name="'
.'entry[tmp_data][others][other_value]'
.'" value="'
- . $fields[tmp_data][others]['other_value'] .
'">';
+ . $fields['tmp_data']['others']['other_value'] . '">';
-
$key_other_id_name='entry[tmp_data][others][key_other_id]';
- $key_other_id=$fields[tmp_data][others]['key_other_id'];
+ $key_other_id_name = 'entry[tmp_data][others][key_other_id]';
+ $key_other_id = $fields['tmp_data']['others']['key_other_id'];
//start the form
$this->form_start();
@@ -1430,7 +1457,7 @@
$this->template->set_var('current_id_name',
$key_other_id_name);
$this->template->set_var('current_id', $key_other_id);
$this->template->set_var('current_action_name',
'entry[tmp_data][others][action]');
- $this->template->set_var('current_action',
$fields[tmp_data][others]['action']);
+ $this->template->set_var('current_action',
$fields['tmp_data']['others']['action']);
//send to draw the html objects
$this->set_form_fields(array(1 => array('Description',
$other_descr, 'special'),
@@ -1460,9 +1487,10 @@
$this->entry['tmp_data']['others']['other_owner'] =
$GLOBALS['phpgw_info']['server']['addressmaster'];
$this->add_general('others');
}
+
$this->array_data =
$this->read_tab_session('others_data');
- if(is_array($fields['other_value']))
+ if ( isset($fields['other_value']) &&
is_array($fields['other_value']) )
{
foreach($fields['other_value'] as $key => $data)
{
@@ -1476,7 +1504,6 @@
array('Description',
'Value','Delete'),
'array_data',
$types_data, 'key_other_id'));
- $this->form_end();
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1515,7 +1542,6 @@
3 => array('Sound',
$sound, 'special'),
4 => array('Public Key',
$pubkey, 'special')));
- $this->form_end();
return $this->template->fp('out',
'tab_body_general_data');
}
@@ -1592,12 +1618,6 @@
$this->template->set_var('all_opt', $all_data_name);
$this->template->set_var('current_opt',
$defaul_data_name);
- $this->template->set_var('th_bg',
$GLOBALS['phpgw_info']['theme']['th_bg']);
- $this->template->set_var('th_text',
$GLOBALS['phpgw_info']['theme']['th_text']);
- $this->template->set_var('row_on',
$GLOBALS['phpgw_info']['theme']['row_on']);
- $this->template->set_var('row_off',
$GLOBALS['phpgw_info']['theme']['row_off']);
-
$this->template->set_var('row_text',$GLOBALS['phpgw_info']['theme']['row_text']);
-
return $this->template->fp('out', 'many_actions');
}
@@ -1612,7 +1632,7 @@
* @param boolean $button Flag for indicate if you want draw the
Add button
* @return string All the detail form html code in the template
*/
- function get_detail_form($tab, $headers, $array_name,
$objs_data, $idx, $button=True)
+ function get_detail_form($tab, $headers, $array_name, $objs_data, $idx,
$button = true)
{
$this->template->set_file(array('detail_data' =>
'body_detail.tpl'));
$this->template->set_block('detail_data','detail_body','detail_body');
@@ -1623,7 +1643,7 @@
if($button)
{
- $this->template->set_var('caption_detail',
$title);
+ //$this->template->set_var('caption_detail', $title);
$this->template->set_var('add_button',
$add_button);
}
else
@@ -1632,8 +1652,8 @@
$this->template->set_var('add_button', '');
}
- $this->template->set_var('row_bgc',
$GLOBALS['phpgw_info']['theme']['th_bg']);
- $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
+ $this->template->set_var('row_class', 'th');
+ $tr_class = 'th';
$cols='';
foreach($headers as $head)
@@ -1648,16 +1668,15 @@
if (is_array($this->$array_name))
{
+ //wtf is going on here?
foreach($this->$array_name as $k => $v)
{
- $id = $v[$idx];
$this->array_value = $v;
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
- $this->template->set_var('row_bgc',
$tr_color);
+ $tr_class =
$GLOBALS['phpgw']->nextmatchs->alternate_row_class($tr_class);
+ $this->template->set_var('row_class',
$tr_class);
- $cols='';
- reset($objs_data);
+ $cols = '';
foreach($objs_data as $type =>
$properties)
{
$cols .= '<td>' .
$this->get_column_data($properties) . '</td>';
@@ -1670,11 +1689,6 @@
}
}
- $this->template->set_var('th_bg',
$GLOBALS['phpgw_info']['theme']['th_bg']);
- $this->template->set_var('th_text',
$GLOBALS['phpgw_info']['theme']['th_text']);
- $this->template->set_var('row_on',
$GLOBALS['phpgw_info']['theme']['row_on']);
- $this->template->set_var('row_off',
$GLOBALS['phpgw_info']['theme']['row_off']);
-
$this->template->set_var('row_text',$GLOBALS['phpgw_info']['theme']['row_text']);
return $this->template->fp('out', 'detail_body');
}
@@ -1695,25 +1709,11 @@
}
/**
- * This function end the template for draw the tabs windows
- *
- * @param
- * @return
- */
- function form_end()
- {
- $this->template->set_var('th_bg',
$GLOBALS['phpgw_info']['theme']['th_bg']);
- $this->template->set_var('th_text',
$GLOBALS['phpgw_info']['theme']['th_text']);
- $this->template->set_var('row_on',
$GLOBALS['phpgw_info']['theme']['row_on']);
- $this->template->set_var('row_off',
$GLOBALS['phpgw_info']['theme']['row_off']);
-
$this->template->set_var('row_text',$GLOBALS['phpgw_info']['theme']['row_text']);
- }
-
- /**
* Get the principal tabs (Persons and Organizations)
*
- * @param
- * @return
+ * @param array $action link args usually array('menuaction' =>
'app.class'method')
+ * @param string $class_css the css class/es to apply to the tab
+ * @param string $label the label for the tab
*/
function get_principal_tabs($action, $class_css, $value)
{
@@ -1743,12 +1743,8 @@
(
'tab_name' => $tab_name,
'tab_caption' => $tab_caption,
- 'tab_css' => ''
+ 'tab_css' => $class_css
);
- if ( strlen($class_css) )
- {
- $tab['tab_css'] = "class=\"$class_css\"";
- }
$this->template->set_var($tab);
$this->template->parse('buttons', 'button', True);
}
@@ -1772,11 +1768,13 @@
/**
* Strip slashes from all elements of array
*
+ * @todo FIXME this should not be done at the UI level, slashes are a
db level thing, and should be stripped at that level! - skwashd 20060901
* @param array $data The array with all data what you want
* @return array The same array with stripslashes
*/
- function stripslashes_from_array($data=array())
+ function stripslashes_from_array($data = array())
{
+ $record = array();
if(is_array($data))
{
foreach($data as $key => $value)
@@ -1946,6 +1944,7 @@
*/
function read_tab_session($tab)
{
+ $entry = array();
$load_vars =
$GLOBALS['phpgw']->session->appsession('load_vars', 'addressbook');
switch ($tab)
{
@@ -1966,9 +1965,11 @@
$entry =
$this->stripslashes_from_array($entry);
}
$comms =
$this->read_tab_session($this->tab_comms);
- $entry['email'] = $comms['comm_data']['work
email'];
- $entry['wphone'] = $comms['comm_data']['work
phone'];
- //$this->record_name = $entry['per_full_name'];
+ if ( is_array($comms) && count($comms) )
+ {
+ $entry['email'] =
isset($comms['comm_data']['work email']) ? $comms['comm_data']['work email'] :
'';
+ $entry['wphone'] =
isset($comms['comm_data']['work phone']) ? $comms['comm_data']['work phone'] :
'';
+ }
break;
case $this->tab_orgs:
if($load_vars[$this->tab_orgs]=='db')
@@ -1995,13 +1996,16 @@
foreach($data as $key => $value)
{
$entry['comm_data'][$value['comm_description']] = $value['comm_data'];
-
if($value['comm_preferred']=='Y')
+ if ( $value['comm_preferred']
== 'Y' )
{
$entry['preferred'] =
$value['comm_description'];
}
}
$GLOBALS['phpgw']->session->appsession('comm_data','addressbook',$data);
-
$GLOBALS['phpgw']->session->appsession('old_comm','addressbook',$entry['comm_data']);
+ if ( isset($entry['comm_data']) &&
is_array($entry['comm_data']) )
+ {
+
$GLOBALS['phpgw']->session->appsession('old_comm','addressbook',
$entry['comm_data']);
+ }
$load_vars[$this->tab_comms] = 'cache';
}
else
@@ -2100,9 +2104,8 @@
break;
}
$GLOBALS['phpgw']->session->appsession('load_vars','addressbook', $load_vars);
- //$record = $this->htmlentities_from_array($entry);
- $record = $entry;
- return $record;
+ //$entry = $this->htmlentities_from_array($entry);
+ return $entry;
}
/**
@@ -2123,7 +2126,7 @@
$comms =
$this->read_tab_session($this->tab_comms);
$comms['comm_data']['work email'] =
$entry['email'];
$comms['comm_data']['work phone'] =
$entry['wphone'];
- $comms['preferred'] =
$comms['preferred']?$comms['preferred']:'work email';
+ $comms['preferred'] =
isset($comms['preferred']) ? $comms['preferred'] : 'work email';
$this->save_tab_session($this->tab_comms,
$comms);
unset($entry['email']);
@@ -2171,7 +2174,7 @@
break;
case $this->tab_address:
$entry_name = 'tab_address';
- if($entry['addr_preferred'] &&
$entry['addr_preferred']!='')
+ if( isset($entry['addr_preferred']) &&
$entry['addr_preferred'] != '')
{
$this->addr_data =
$this->read_tab_session('addr_data');
$this->addr_data[$entry['addr_preferred']]['addr_preferred'] =
$this->set_addr_preferred('addr_data', 'Y');
@@ -2198,7 +2201,7 @@
//get emain and phone info from comms var
$comms =
$this->read_tab_session($this->tab_comms);
$comms['comm_data']['work phone'] =
$entry['wphone'];
- $comms['preferred'] =
$comms['preferred']?$comms['preferred']:'work email';
+ $comms['preferred'] =
isset($comms['preferred']) ? $comms['preferred'] : 'work email';
$this->save_tab_session($this->tab_comms,
$comms);
unset($entry['wphone']);
@@ -2233,7 +2236,6 @@
$entry_data = $entry;
break;
}
-
$GLOBALS['phpgw']->session->appsession($entry_name,'addressbook', $entry_data);
}
@@ -2244,9 +2246,11 @@
* if you want clear all tabs
* @return mixed The variable what you specified clear or all
tabs variables
*/
- function clear_tab_session($tab='')
+ function clear_tab_session($tab = '')
{
- $tabs_data = array('tab_person_data',
+ $tabs_data = array
+ (
+ 'tab_person_data',
'tab_orgs',
'tab_cats',
'tab_comms',
@@ -2255,18 +2259,16 @@
'tab_extra',
'tab_org_data',
'tab_persons',
-
'others_data',
'addr_data',
'comm_data',
-
'load_vars',
'transactions',
-
'old_my_orgs',
'old_my_person',
'old_comm',
- 'old_others');
+ 'old_others'
+ );
if($tab!='')
{
@@ -2354,6 +2356,7 @@
*/
function save_simple_array($data=array())
{
+ $new_data = array();
foreach($data as $key => $value)
{
if($value!='')
@@ -2436,7 +2439,6 @@
{
if(count($addr_data)>0)
{
- reset($addr_data);
$addr_data[key($addr_data)]['addr_preferred'] = 'Y';
}
}
@@ -2812,7 +2814,7 @@
$contacts['per_birthday'] =
$datetime->convertDate($contacts['per_birthday'], $this->bo->bday_internformat,
$userformat);
}
}
- elseif($contact_type == $this->tab_main_organizations)
+ else if($contact_type == $this->tab_main_organizations)
{
$cat_link_url =
$GLOBALS['phpgw']->link('/index.php',
array
@@ -2873,7 +2875,7 @@
$comms = $this->bo->get_comm_contact_data($contact_id);
- if(is_array($comms[$contact_id]))
+ if ( isset($comms[$contact_id]) &&
is_array($comms[$contact_id]))
{
$contacts = $contacts + $comms[$contact_id];
$comms_media[] =
array_keys($comms[$contact_id]);
@@ -2886,6 +2888,8 @@
$addr = $this->bo->get_addr_contact_data($contact_id,
array('addr_pref_val'=>'Y'));
+ if ( isset($addr) && isset($addr[0]) && is_array($addr[0]) )
+ {
unset($addr[0]['contact_id']);
unset($addr[0]['key_addr_id']);
unset($addr[0]['addr_type']);
@@ -2894,6 +2898,7 @@
unset($addr[0]['addr_contact_id']);
$contacts = array_merge($contacts, $addr[0]);
+ }
$others =
$this->bo->get_others_contact_data($contact_id);
if(is_array($others))
@@ -2910,16 +2915,15 @@
$this->template->set_block('view_t','view_footer','view_footer');
$this->template->set_block('view_t','view_buttons','view_buttons');
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
$this->template->set_var('lang_viewpref',lang('Address
book - view'));
- $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
-
+ $tr_class = '';
+ $row_cnt = 0;
foreach($contacts as $field => $data)
{
- if($field!='org_name')
+ if ( $field != 'org_name' )
{
$data = htmlentities($data);
}
@@ -2927,8 +2931,6 @@
$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]))
{
$this->template->set_var('display_col',lang($field));
@@ -2943,9 +2945,9 @@
}
else
{
- $ref='<a
href="mailto:'.$data.'">';
+ $ref = '<a
href="mailto:'.$data.'">';
}
- $data=$data . '</a>';
+ $data .= '</a>';
}
if($field=='website')
{
@@ -2954,7 +2956,7 @@
$data =
'http://' . $data;
}
$ref='<a
href="'.$data.'" target="_new">';
- $data=$data.'</a>';
+ $data .= '</a>';
}
}
else
@@ -2962,6 +2964,10 @@
$this->template->set_var('display_col',$this->bo->display_name($field));
}
+ $tr_class = $row_cnt % 2 ? 'row_off' : 'row_on';
+ $this->template->set_var('tr_class', $tr_class);
+ ++$row_cnt;
+
$this->template->set_var('ref_data',$ref.$data);
$this->template->parse('cols','view_row',True);
}
@@ -2986,9 +2992,10 @@
. '</a>';
}
}
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
+ $tr_class = $row_cnt % 2 ? 'row_off' : 'row_on';
+ $this->template->set_var('tr_class', $tr_class);
+ ++$row_cnt;
- $this->template->set_var('th_bg',
$tr_color);
$this->template->set_var('display_col',
lang('contacts'));
$this->template->set_var('ref_data',
implode('<br />', $ppl));
@@ -3000,8 +3007,29 @@
$this->template->set_var('view_row','');
/* These are in the footer */
+ if ( $row_cnt % 2 )
+ {
+ $this->template->set_var(array
+ (
+ 'access_class' => 'row_on',
+ 'cat_class' => 'row_off',
+ 'owner_class' => 'row_off'
+ ));
+ }
+ else
+ {
+ $this->template->set_var(array
+ (
+ 'access_class' => 'row_off',
+ 'cat_class' => 'row_on',
+ 'owner_class' => 'row_on'
+ ));
+ }
+ unset($row_cnt);
+
$this->template->set_var('lang_owner',lang('Record
owner'));
- if($owner ==
$GLOBALS['phpgw_info']['server']['addressmaster'])
+ if( isset($GLOBALS['phpgw_info']['server']['addressmaster'])
+ && $owner ==
$GLOBALS['phpgw_info']['server']['addressmaster'])
{
$this->template->set_var('owner',
'addressmaster');
}
@@ -3043,7 +3071,6 @@
$this->template->set_var('done_button',$this->html_1button_form('DoneForm','Done',
$referer ? $referer :
$GLOBALS['phpgw']->link('/index.php',
'menuaction=addressbook.uiaddressbook.index§ion='.$contact_type)));
- $this->template->set_var('access_link',$access_link);
$this->template->pparse('out','view_t');
@@ -3063,7 +3090,7 @@
function html_1button_form($name,$lang,$link)
{
$html = '<form method="POST" action="' . $link . '">'
. "\n";
- $html .= '<input type="submit" name="' . $name .'"
value="' . lang($lang) . '">' . "\n";
+ $html .= '<button type="submit" name="' . $name .'" value="1">'
. lang($lang) . "</button>\n";
$html .= '</form>' . "\n";
return $html;
}
@@ -3078,7 +3105,7 @@
return $this->template->parse('out','add');
}
- function get_column_data($properties=array())
+ function get_column_data( $properties = array() )
{
switch($properties['type'])
{
@@ -3091,7 +3118,7 @@
.'value="' .
$this->array_value[$properties['value']] . '">';
break;
case 'radio':
-
if($this->array_value[$properties['field']]=='Y'){$checked='checked';}
+ $checked =
$this->array_value[$properties['field']] == 'Y' ? 'checked' : '';
$column_data = '<input type="radio" name="' .
$properties['name']
.'" value="' .
htmlentities($this->array_value[$properties['value']]) . '"'. $checked . '>';
break;
@@ -3106,19 +3133,19 @@
function set_form_fields($form_fields)
{
- $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
+ $tr_class = 'row_off';
ksort($form_fields, SORT_NUMERIC);
foreach($form_fields as $key => $row)
{
- $this->template->set_var('row_bgc', $tr_color);
+ $tr_class =
$GLOBALS['phpgw']->nextmatchs->alternate_row_class($tr_class);
+ $this->template->set_var('row_class', $tr_class);
if($row[2] == 'special')
{
if(($key % 2) == 0)
{
$this->set_row_other_input($row[0],$row[1],2);
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
$this->template->fp('input_other_fields_cols', 'other_data', True);
$this->template->fp('other_fields', 'input_other_data');
}
@@ -3132,7 +3159,6 @@
if(($key % 2) == 0)
{
$this->set_row_input($row[0],$row[1],$row[2],2);
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
$this->template->fp('input_fields_cols', 'input_data_col', True);
$this->template->fp('input_fields', 'input_data');
}
@@ -3223,8 +3249,11 @@
function get_cats($fields_to_search, $current_cats)
{
- $cats =
$this->cat->return_array('all',$start,False,$query,$sort,$order,True);
- if ($cats)
+ $this->all_cats_data = '';
+ $this->my_cats_data = '';
+ $cats = $this->cat->return_array('all', 0, false, '', '', '',
true);
+
+ if ( is_array($cats) && count($cats) );
{
foreach ($cats as $k => $v)
{
@@ -3351,37 +3380,37 @@
function css()
{
$tmp = 'input[type="submit"].button_style,
input[type="button"].button_style {
- color: #555;
+color: #555;
margin-left: 1px;
margin-right: 1px;
background-color: #ddd;
- border:1px #888 solid;
+border:1px #888 solid;
border-bottom-width: 0px;
- padding: 1px;
- width: 85px;
+padding: 1px;
+width: 85px;
}
input[type="submit"].button_style_sel,
input[type="button"].button_style_sel {
- color: #555;
+color: #555;
margin-left: 1px;
margin-right: 1px;
/*background-color: #e5e5e5;*/
- border:1px #888 solid;
+border:1px #888 solid;
border-bottom-width: 0px;
- padding: 1px;
- width: 85px;
+padding: 1px;
+width: 85px;
}
input[type="submit"]:hover.button_style,
input[type="button"]:hover.button_style {
background-color: #eee;
- color: #36c;
+color: #36c;
}
input[type="submit"]:active.button_style,
input[type="button"]:active.button_style {
background-color: #eee;
- color: #9ac;
+color: #9ac;
}';
return $tmp;
}
@@ -3404,6 +3433,7 @@
.
$value['comm_description'] . '</option>';
}
}
+
if ($type=='text')
{
return $comm_description;
@@ -3417,11 +3447,12 @@
function get_addr_type($selected, $type='')
{
+ $addr_type = '';
if(is_array($this->addr_type))
{
foreach($this->addr_type as $key => $value)
{
- if ($value['addr_type_id'] == $selected)
+ if ( $value['addr_type_id'] == $selected)
{
$addr_type .= '<option value="'
. $value['addr_type_id'] . '" selected>'
.
$value['addr_description'] . '</option>';
@@ -3433,32 +3464,30 @@
.
$value['addr_description'] . '</option>';
}
}
+
if ($type=='text')
{
return $addr_description;
}
- else
- {
- return $addr_type;
- }
}
+ return $addr_type;
}
function get_my_option_selected($my_opt_array, $selected)
{
- if (is_array($this->$my_opt_array))
+ $my_opt = '';
+ if ( isset($this->$my_opt_array)
+ && is_array($this->$my_opt_array) )
{
foreach($this->$my_opt_array as $key => $value)
{
if ($key == $selected)
{
- $my_opt .= '<option value="' .
$key . '" selected>'
- . $value . '</option>';
+ $my_opt .= "<option value=\"{$key}\"
selected>{$value}</option>";
}
else
{
- $my_opt .= '<option value="' .
$key . '">'
- . $value . '</option>';
+ $my_opt .= "<option
value=\"{$key}\">{$value}</option>";
}
}
}
@@ -3483,5 +3512,5 @@
'referer' => $referer
));
}
- }
+}
?>
Index: inc/class.uifields.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uifields.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- inc/class.uifields.inc.php 15 May 2005 13:34:29 -0000 1.14
+++ inc/class.uifields.inc.php 1 Sep 2006 14:44:43 -0000 1.15
@@ -11,7 +11,7 @@
* option) any later version. *
\**************************************************************************/
- /* $Id: class.uifields.inc.php,v 1.14 2005/05/15 13:34:29 skwashd Exp $ */
+ /* $Id: class.uifields.inc.php,v 1.15 2006/09/01 14:44:43 skwashd Exp $ */
class uifields
{
@@ -400,18 +400,18 @@
if($apply=='person')
{
- $this->per_custom_fields =
$this->config->config_data['custom_fields'];
- $all_custom_fields =
$this->config->config_data['custom_fields'];
+ $this->per_custom_fields =
isset($this->config->config_data['custom_fields']) ?
$this->config->config_data['custom_fields'] : array();
+ $all_custom_fields =
isset($this->config->config_data['custom_fields']) ?
$this->config->config_data['custom_fields'] : array();
}
elseif($apply=='org')
{
- $this->org_custom_fields =
$this->config->config_data['custom_org_fields'];
- $all_custom_fields =
$this->config->config_data['custom_org_fields'];
+ $this->org_custom_fields =
isset($this->config->config_data['custom_org_fields']) ?
$this->config->config_data['custom_org_fields'] : array();
+ $all_custom_fields =
isset($this->config->config_data['custom_org_fields']) ?
$this->config->config_data['custom_org_fields'] : array();
}
elseif($apply=='both')
{
- $this->per_custom_fields =
$this->config->config_data['custom_fields'];
- $this->org_custom_fields =
$this->config->config_data['custom_org_fields'];
+ $this->per_custom_fields =
isset($this->config->config_data['custom_fields']) ?
$this->config->config_data['custom_fields'] : array();
+ $this->org_custom_fields =
isset($this->config->config_data['custom_org_fields']) ?
$this->config->config_data['custom_org_fields'] : array();
if($this->per_custom_fields!='' &&
$this->org_custom_fields!='')
{
@@ -428,29 +428,22 @@
}
//while(list($name,$descr) =
@each($this->config->config_data['custom_fields']))
- while(list($name,$descr) = @each($all_custom_fields))
+ if ( is_array($all_custom_fields) )
{
- $test = @strtolower($name);
- //if($query &&
!strstr($test,strtolower($query)))
- if($query && ($query != $test))
+ foreach ( $all_custom_fields as $name => $descr )
{
- }
- else
+ $test = strtolower($name);
+ //if($query &&
!strstr($test,strtolower($query)))
+ if( !$query || ($query == $test))
{
$fields[$i]['name'] = $name;
$fields[$i]['title'] = $descr;
$fields[$i]['id'] = $i;
$fields[$i]['apply'] =
$this->get_apply($name);
-
- /*
- if($i >= $limit)
- {
- break;
- }
- */
$i++;
}
}
+ }
switch($sort)
{
case 'DESC';
@@ -460,7 +453,6 @@
default:
ksort($fields);
}
- @reset($fields);
return $fields;
}
Index: templates/base/body_detail.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/body_detail.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/body_detail.tpl 31 Dec 2004 04:55:24 -0000 1.2
+++ templates/base/body_detail.tpl 1 Sep 2006 14:44:43 -0000 1.3
@@ -27,7 +27,7 @@
<!-- END input_detail_row -->
<!-- BEGIN input_detail_data -->
-<tr bgcolor="{row_bgc}">
+<tr class="{row_class}">
{input_cols}
</tr>
<!-- END input_detail_data -->
\ No newline at end of file
Index: templates/base/index.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/index.tpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- templates/base/index.tpl 29 Aug 2006 16:02:43 -0000 1.4
+++ templates/base/index.tpl 1 Sep 2006 14:44:43 -0000 1.5
@@ -7,12 +7,12 @@
<table>
<thead>
- <tr bgcolor="{th_bg}">
+ <tr>
{cols}
- <td>{lang_view}</td>
- <td>{lang_vcard}</td>
- <td>{lang_edit}</td>
- <td>{lang_owner}</td>
+ <th>{lang_view}</th>
+ <th>{lang_vcard}</th>
+ <th>{lang_edit}</th>
+ <th>{lang_owner}</th>
</tr>
</thead>
<tbody>
@@ -23,7 +23,7 @@
<!-- END column -->
<!-- BEGIN row -->
- <tr class="{row_tr_color}">
+ <tr class="{row_class}">
{columns}
<td><a href="{row_view_link}">{lang_view}</a></td>
<td><a href="{row_vcard_link}">{lang_vcard}</a></td>
Index: templates/base/tab.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/tab.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/tab.tpl 31 Dec 2004 04:55:24 -0000 1.2
+++ templates/base/tab.tpl 1 Sep 2006 14:44:43 -0000 1.3
@@ -1,17 +1,10 @@
<!-- BEGIN tab -->
-<td>
-<table border="0" cellspacing="0" cellpadding="0">
-
-<tr>
-{buttons}
-</tr>
-
-</table>
-</td>
+<ul id="contacts_section_tabs" class="tabs">
+ {buttons}
+ <li class="tablast"></li>
+</ul>
<!-- END tab -->
<!-- BEGIN button -->
-<td align="left">
-<input class="{class_css}" type="submit" name="{button_name}"
value="{button_caption}">
-</td>
+ <li><input class="{tab_css}" type="submit" name="{tab_name}"
value="{tab_caption}"></li>
<!-- END button -->
\ No newline at end of file
Index: templates/base/view.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/view.tpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- templates/base/view.tpl 15 May 2005 13:34:30 -0000 1.3
+++ templates/base/view.tpl 1 Sep 2006 14:44:43 -0000 1.4
@@ -1,51 +1,33 @@
<!-- BEGIN view_header -->
-<br />
-<table border="0" cellspacing="2" cellpadding="2" width="70%" align="center">
+<table id="contacts_view">
<!-- END view_header -->
<!-- BEGIN view_row -->
- <tr bgcolor="{th_bg}">
- <td align="right" width="30%"><b>{display_col}</b>:</td><td
width="70%">{ref_data}</td>
+ <tr class="{tr_class}">
+ <td class="contacts_v_label">{display_col}</td>
+ <td class="contacts_v_val">{ref_data}</td>
</tr>
<!-- END view_row -->
{cols}
<!-- BEGIN view_footer -->
- <tr>
- <td colspan="4"> </td>
+ <tr class="{owner_class}">
+ <td class="contacts_v_label">{lang_owner}</td>
+ <td class="contacts_v_val">{owner}</td>
+ </tr>
+ <tr class="{access_class}">
+ <td class="contacts_v_label">{lang_access}</td>
+ <td class="contacts_v_val">{access}</td>
+ </tr>
+ <tr class="{cat_class}">
+ <td class="contacts_v_label">{lang_category}</td>
+ <td class="contacts_v_val">{catname}</td>
</tr>
- <tr>
- <td><b>{lang_owner}</b></td>
- <td>{owner}</td>
- </tr>
- <tr>
- <td><b>{lang_access}</b></td>
- <td>{access}</b>
- </td>
- </tr>
- <tr>
- <td><b>{lang_category}</b></td>
- <td>{catname}</b></td>
- </tr>
- </td>
-</td>
</table>
<!-- END view_footer -->
<!-- BEGIN view_buttons -->
-<center>
- <table border="0" cellpadding="1" cellspacing="1">
- <tr>
- <td>
+ <div class="button_group">
{edit_button}
- </td>
- <td>
{copy_button}
- </td>
- <td>
{vcard_button}
- </td>
- <td>
{done_button}
- </td>
- </tr>
- </table>
-</center>
+ </div>
<!-- END view_buttons -->
Index: templates/base/css/base.css
===================================================================
RCS file: templates/base/css/base.css
diff -N templates/base/css/base.css
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/css/base.css 1 Sep 2006 14:44:43 -0000 1.1
@@ -0,0 +1,21 @@
+#contacts_view
+{
+ margin: 0px auto;
+ width: 80%
+}
+
+td.contacts_v_label
+{
+ text-align: right;
+ width: 30%;
+}
+
+td.contacts_v_val
+{
+ width: 70%;
+}
+
+ul.tabs li input
+{
+ padding-top: 3px;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] addressbook inc/class.boaddressbook.inc.php inc...,
Dave Hall <=