*
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
-/* $Id$ */
+ /* $Id$ */
$phpgw_info['flags'] = array(
'currentapp' => 'addressbook',
@@ -27,9 +28,8 @@
$t->set_block('addressbook_list_t','row','row');
$t->set_block('addressbook_list_t','addressbook_footer','addressbook_footer');
- $this = CreateObject('phpgwapi.contacts');
- //$this->delete_all($phpgw_info['user']['account_id']);
- //exit;
+ $contacts = CreateObject('phpgwapi.contacts');
+
$customfields = array();
while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
{
@@ -57,24 +57,24 @@
'address2' => 'address2',
'address3' => 'address3'
);
- $qfields = $this->stock_contact_fields + $extrafields + $customfields;
+ /* $qfields = $contacts->stock_contact_fields + $extrafields + $customfields; */
- // create column list and the top row of the table based on user prefs
- while ($column = each($this->stock_contact_fields))
+ /* create column list and the top row of the table based on user prefs */
+ while ($column = each($contacts->stock_contact_fields))
{
$test = strtolower($column[0]);
if (isset($phpgw_info['user']['preferences']['addressbook'][$test]) &&
$phpgw_info['user']['preferences']['addressbook'][$test])
{
$showcol = display_name($column[0]);
- $cols .= " \n";
+ $cols .= ' | ' . "\n";
$cols .= ' ';
$cols .= $phpgw->nextmatchs->show_sort_order($sort,
$column[0],$order,"/addressbook/index.php",$showcol,"&cat_id=".$cat_id);
$cols .= "\n | ";
$cols .= "\n";
- // To be used when displaying the rows
+ /* To be used when displaying the rows */
$columns_to_display[$column[0]] = True;
}
}
@@ -87,15 +87,15 @@
$phpgw_info['user']['preferences']['addressbook'][$test])
{
$showcol = display_name($column[0]);
- // This must be a custom field
+ /* This must be a custom field */
if (!$showcol) { $showcol = $column[1]; }
- $cols .= " \n";
+ $cols .= ' | ' . "\n";
$cols .= ' ';
$cols .= $showcol;
$cols .= "\n | ";
$cols .= "\n";
- // To be used when displaying the rows
+ /* To be used when displaying the rows */
$columns_to_display[$column[0]] = True;
}
}
@@ -108,11 +108,11 @@
if($phpgw_info['user']['preferences']['common']['maxmatchs'] &&
$phpgw_info['user']['preferences']['common']['maxmatchs'] > 0)
{
- $offset = $phpgw_info['user']['preferences']['common']['maxmatchs'];
+ $limit = $phpgw_info['user']['preferences']['common']['maxmatchs'];
}
else
{
- $offset = 30;
+ $limit = 30;
}
if (!$filter)
@@ -140,7 +140,7 @@
case 'none':
break;
case 'private':
- $qfilter .= ',access=private'; // fall through
+ $qfilter .= ',access=private'; /* fall through */
case 'yours':
$qfilter .= ',owner='.$phpgw_info['user']['account_id'];
break;
@@ -152,7 +152,7 @@
$qfilter .= ',cat_id='.$cat_id;
}
- // Check if prefs were set, if not, create some defaults
+ /* Check if prefs were set, if not, create some defaults */
if (!$columns_to_display )
{
$columns_to_display = array(
@@ -161,13 +161,13 @@
'org_name' => 'org_name'
);
$columns_to_display = $columns_to_display + $customfields;
- // No prefs,. so cols above may have been set to "" or a bunch of |
+ /* No prefs,. so cols above may have been set to "" or a bunch of | */
$cols="";
while ($column = each($columns_to_display))
{
$showcol = display_name($column[0]);
if (!$showcol) { $showcol = $column[1]; }
- $cols .= " \n";
+ $cols .= ' | ' . "\n";
$cols .= ' ';
$cols .= $phpgw->nextmatchs->show_sort_order($sort,
$column[0],$order,"/addressbook/index.php",$showcol,"&cat_id=$cat_id");
@@ -183,42 +183,27 @@
if ($nosearch && !$query)
{
$entries = array();
- $this->total_records = 0;
+ $contacts->total_records = 0;
}
else
{
/* read the entry list */
- $entries = addressbook_read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order,$userid);
+ $entries = addressbook_read_entries($start,$limit,$qcols,$query,$qfilter,$sort,$order,$userid);
}
$search_filter = $phpgw->nextmatchs->show_tpl('/addressbook/index.php',
- $start, $this->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query&cat_id=$cat_id","75%",
+ $start, $contacts->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query&cat_id=$cat_id","75%",
$phpgw_info["theme"]["th_bg"],1,1,1,1);
- if ($this->total_records > $phpgw_info['user']['preferences']['common']['maxmatchs'])
- {
- if ($start + $phpgw_info['user']['preferences']['common']['maxmatchs'] > $this->total_records)
- {
- $end = $this->total_records;
- }
- else
- {
- $end = $start + $phpgw_info['user']['preferences']['common']['maxmatchs'];
- }
- $lang_showing=lang('showing x - x of x',($start + 1),$end,$this->total_records);
- }
- else
- {
- $lang_showing=lang('showing x',$this->total_records);
- }
+ $lang_showing = $phpgw->nextmatchs->show_hits($contacts->total_records,$start);
- // set basic vars and parse the header
+ /* set basic vars and parse the header */
$t->set_var(font,$phpgw_info['theme']['font']);
$t->set_var('lang_view',lang('View'));
$t->set_var('lang_vcard',lang('VCard'));
$t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_owner',lang('Owner'));
-
+
$t->set_var('searchreturn',$noprefs . ' ' . $searchreturn);
$t->set_var('lang_showing',$lang_showing);
$t->set_var('search_filter',$search_filter);
@@ -251,11 +236,12 @@
$t->set_var('start',$start);
$t->set_var('filter',$filter);
$t->set_var('cols',$cols);
-
+
$t->pparse('out','addressbook_header');
- // Show the entries
- for ($i=0;$iset_var('columns','');
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
@@ -263,11 +249,12 @@
$myid = $entries[$i]['id'];
$myowner = $entries[$i]['owner'];
- while ($column = each($columns_to_display)) // each entry column
+ /* each entry column */
+ while ($column = each($columns_to_display))
{
- $ref=$data="";
+ $ref = $data='';
$coldata = $entries[$i][$column[0]];
- // Some fields require special formatting.
+ /* Some fields require special formatting. */
if ($column[0] == 'url')
{
if ( !empty($coldata) && (substr($coldata,0,7) != 'http://') ) { $coldata = 'http://' . $coldata; }
@@ -284,11 +271,11 @@
{
$ref='';
}
- $data=$coldata."";
+ $data=$coldata . '';
}
- else // But these do not
+ else /* But these do not */
{
- $ref=""; $data=$coldata;
+ $ref = ''; $data = $coldata;
}
$t->set_var('col_data',$ref.$data);
$t->parse('columns','column',True);
@@ -305,12 +292,12 @@
$t->set_var('row_view_link','');
$t->set_var('lang_view',lang('Private'));
}
-
+
$t->set_var('row_vcard_link',$phpgw->link('/addressbook/vcardout.php',
"ab_id=$myid&start=$start&sort=$sort&order=$order&filter="
. "$filter&query=$query&sort=$sort&cat_id=$cat_id"));
-// echo ' : ' . $this->grants[$myowner] . ' - ' . $myowner;
- if ($this->check_perms($this->grants[$myowner],PHPGW_ACL_EDIT) || $myowner == $phpgw_info['user']['account_id'])
+/* echo ' : ' . $contacts->grants[$myowner] . ' - ' . $myowner; */
+ if ($contacts->check_perms($contacts->grants[$myowner],PHPGW_ACL_EDIT) || $myowner == $phpgw_info['user']['account_id'])
{
$t->set_var('row_edit','set_var('row_edit',' ');
}
-
+
$t->set_var('row_owner',$phpgw->accounts->id2name($myowner));
-
+
$t->parse('rows','row',True);
$t->pparse('out','row');
- reset($columns_to_display); // If we don't reset it, our inside while won't loop
+ reset($columns_to_display);
}
$t->pparse('out','addressbook_footer');
diff --git a/addressbook/preferences.php b/addressbook/preferences.php
index 64372ab9dc..304b8a460e 100644
--- a/addressbook/preferences.php
+++ b/addressbook/preferences.php
@@ -23,7 +23,7 @@
include('../header.inc.php');
- $this = CreateObject('phpgwapi.contacts');
+ $contacts = CreateObject('phpgwapi.contacts');
$extrafields = array(
'ophone' => 'ophone',
@@ -45,7 +45,7 @@
}
}
- $qfields = $this->stock_contact_fields + $extrafields + $customfields;
+ $qfields = $contacts->stock_contact_fields + $extrafields + $customfields;
if ($submit)
{
diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php
index 0542e0bed1..4198effa06 100755
--- a/addressbook/setup/setup.inc.php
+++ b/addressbook/setup/setup.inc.php
@@ -31,6 +31,6 @@
/* Dependencies for this app to work */
$setup_info['addressbook']['depends'][] = array(
'appname' => 'phpgwapi',
- 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13')
+ 'versions' => Array('0.9.13', '0.9.14')
);
?>
diff --git a/addressbook/templates/default/config.tpl b/addressbook/templates/default/config.tpl
index 56993b56e4..18fab007bd 100644
--- a/addressbook/templates/default/config.tpl
+++ b/addressbook/templates/default/config.tpl
@@ -16,6 +16,9 @@
{lang_Contact_application}: |
|
+
+ {lang_WARNING!!_LDAP_is_valid_only_if_you_are_NOT_using_contacts_for_accounts_storage!} |
+
{lang_Select_where_you_want_to_store}/{lang_retrieve_contacts}. |
diff --git a/addressbook/vcardout.php b/addressbook/vcardout.php
index afa0fca9b9..0fa30056c7 100644
--- a/addressbook/vcardout.php
+++ b/addressbook/vcardout.php
@@ -42,11 +42,11 @@
$phpgw->common->phpgw_exit();
}
- $this = CreateObject('phpgwapi.contacts');
+ $contacts = CreateObject('phpgwapi.contacts');
// First, make sure they have permission to this entry
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
- $perms = $this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_READ);
+ $perms = $contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
{
@@ -56,7 +56,7 @@
}
$extrafields = array('address2' => 'address2');
- $qfields = $this->stock_contact_fields + $extrafields;
+ $qfields = $contacts->stock_contact_fields + $extrafields;
$fieldlist = addressbook_read_entry($ab_id,$qfields);
$fields = $fieldlist[0];
diff --git a/addressbook/view.php b/addressbook/view.php
index 59f8ca9b75..785f6e4d45 100755
--- a/addressbook/view.php
+++ b/addressbook/view.php
@@ -22,11 +22,11 @@
include('../header.inc.php');
- $this = CreateObject("phpgwapi.contacts");
+ $contacts = CreateObject("phpgwapi.contacts");
// First, make sure they have permission to this entry
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
- $perms = $this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_READ);
+ $perms = $contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
{
@@ -63,7 +63,7 @@
}
}
- while ($column = each($this->stock_contact_fields))
+ while ($column = each($contacts->stock_contact_fields))
{
if (isset($phpgw_info['user']['preferences']['addressbook'][$column[0]]) &&
$phpgw_info['user']['preferences']['addressbook'][$column[0]])
@@ -98,7 +98,7 @@
'address2' => 'address2',
'address3' => 'address3'
);
- $qfields = $this->stock_contact_fields + $extrafields + $customfields;
+ $qfields = $contacts->stock_contact_fields + $extrafields + $customfields;
$fields = addressbook_read_entry($ab_id,$qfields);
@@ -137,7 +137,7 @@
$t->set_var('th_bg',$tr_color);
$coldata = $fields[0][$column];
// Some fields require special formatting.
- if ( ($column == "note" || $column == "label" || $column == "pubkey") && $coldata )
+ if ( ($column == 'note' || $column == 'pubkey') && $coldata )
{
$datarray = explode ("\n",$coldata);
if ($datarray[1])
@@ -160,6 +160,10 @@
$data = $coldata;
}
}
+ elseif($column == 'label' && $coldata)
+ {
+ $data .= $contacts->formatted_address($fields[0]['id'],'',False);
+ }
elseif ($column == "url" && $coldata)
{
$ref = '';
@@ -203,11 +207,11 @@
$cats = explode(',',$fields[0]['cat_id']);
if ($cats[1])
{
- while (list($key,$thiscat) = each($cats))
+ while (list($key,$contactscat) = each($cats))
{
- if ($thiscat)
+ if ($contactscat)
{
- $catinfo = $cat->return_single($thiscat);
+ $catinfo = $cat->return_single($contactscat);
$catname .= $catinfo[0]['name'] . '; ';
}
}
@@ -285,7 +289,7 @@
$common_vars = array('sort' => $sort,'order' => $order,'filter' => $filter,'start' => $start); // common vars for all buttons
- if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id']))
+ if (($contacts->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id']))
{
$extra_vars = array('cd' => 16,'query' => $query,'cat_id' => $cat_id);
| |