2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
2001-07-08 15:54:40 +02:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - addressbook *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Joseph Engo <jengo@mail.com> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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$ */
|
|
|
|
|
|
|
|
/* I don't think this is needed anymore */
|
|
|
|
/* Perform acl check, set $rights */
|
2001-02-18 14:41:24 +01:00
|
|
|
if(!isset($owner)) { $owner = 0; }
|
2001-02-10 13:56:49 +01:00
|
|
|
|
2001-02-18 14:41:24 +01:00
|
|
|
$grants = $phpgw->acl->get_grants('addressbook');
|
2001-03-24 22:54:31 +01:00
|
|
|
|
2001-05-06 18:43:45 +02:00
|
|
|
if(!isset($owner) || !$owner)
|
|
|
|
{
|
2001-02-18 14:41:24 +01:00
|
|
|
$owner = $phpgw_info['user']['account_id'];
|
|
|
|
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
2001-05-06 18:43:45 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if($grants[$owner])
|
|
|
|
{
|
2001-02-18 14:41:24 +01:00
|
|
|
$rights = $grants[$owner];
|
2001-05-06 18:43:45 +02:00
|
|
|
if (!($rights & PHPGW_ACL_READ))
|
|
|
|
{
|
2001-02-18 14:41:24 +01:00
|
|
|
$owner = $phpgw_info['user']['account_id'];
|
|
|
|
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-24 03:30:37 +02:00
|
|
|
function formatted_list($name,$list,$id='',$default=False,$java=False)
|
|
|
|
{
|
|
|
|
if ($java)
|
|
|
|
{
|
|
|
|
$jselect = ' onChange="this.form.submit();"';
|
|
|
|
}
|
|
|
|
|
|
|
|
$select = "\n" .'<select name="' . $name . '"' . $jselect . ">\n";
|
|
|
|
if($default)
|
|
|
|
{
|
|
|
|
$select .= '<option value="">' . lang('Please Select') . '</option>'."\n";
|
|
|
|
}
|
|
|
|
while (list($key,$val) = each($list))
|
|
|
|
{
|
|
|
|
$select .= '<option value="' . $key . '"';
|
|
|
|
if ($key == $id && $id != '')
|
|
|
|
{
|
|
|
|
$select .= ' selected';
|
|
|
|
}
|
|
|
|
$select .= '>' . $val . '</option>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$select .= '</select>'."\n";
|
|
|
|
$select .= '<noscript><input type="submit" name="' . $name . '_select" value="True"></noscript>' . "\n";
|
|
|
|
|
|
|
|
return $select;
|
|
|
|
}
|
|
|
|
|
2001-07-03 09:17:13 +02:00
|
|
|
/* Return a select form element with the categories option dialog in it */
|
|
|
|
function cat_option($cat_id='',$notall=False,$java=True,$multiple=False)
|
|
|
|
{
|
2001-07-08 15:54:40 +02:00
|
|
|
global $phpgw;
|
|
|
|
|
2001-05-06 18:43:45 +02:00
|
|
|
if ($java)
|
|
|
|
{
|
2001-04-17 11:30:08 +02:00
|
|
|
$jselect = ' onChange="this.form.submit();"';
|
2001-03-28 14:53:39 +02:00
|
|
|
}
|
2001-07-08 15:54:40 +02:00
|
|
|
/* Setup all and none first */
|
2001-05-23 22:16:19 +02:00
|
|
|
$cats_link = "\n" .'<select name="cat_id'.($multiple?'[]':'').'"' .$jselect . ($multiple ? 'multiple size="3"' : '') . ">\n";
|
2001-05-06 18:43:45 +02:00
|
|
|
if (!$notall)
|
|
|
|
{
|
2001-04-17 11:30:08 +02:00
|
|
|
$cats_link .= '<option value=""';
|
2001-05-06 18:43:45 +02:00
|
|
|
if ($cat_id=="all")
|
|
|
|
{
|
2001-04-17 11:30:08 +02:00
|
|
|
$cats_link .= ' selected';
|
2001-03-25 08:07:00 +02:00
|
|
|
}
|
2001-04-17 11:30:08 +02:00
|
|
|
$cats_link .= '>'.lang("all").'</option>'."\n";
|
2001-03-25 08:02:52 +02:00
|
|
|
}
|
|
|
|
|
2001-07-03 09:17:13 +02:00
|
|
|
/* Get global and app-specific category listings */
|
2001-07-08 15:54:40 +02:00
|
|
|
$cats_link .= $phpgw->categories->formated_list('select','all',$cat_id,True);
|
2001-03-29 17:40:10 +02:00
|
|
|
$cats_link .= '</select>'."\n";
|
2001-03-25 07:41:06 +02:00
|
|
|
return $cats_link;
|
|
|
|
}
|
|
|
|
|
2001-07-08 15:54:40 +02:00
|
|
|
/* this cleans up the fieldnames for preferences */
|
2001-05-06 18:43:45 +02:00
|
|
|
function display_name($column)
|
|
|
|
{
|
2001-02-18 14:41:24 +01:00
|
|
|
$abc = array(
|
2001-05-06 18:43:45 +02:00
|
|
|
'fn' => 'full name',
|
|
|
|
'sound' => 'Sound',
|
|
|
|
'org_name' => 'company name',
|
|
|
|
'org_unit' => 'department',
|
|
|
|
'title' => 'title',
|
|
|
|
'n_prefix' => 'prefix',
|
|
|
|
'n_given' => 'first name',
|
|
|
|
'n_middle' => 'middle name',
|
|
|
|
'n_family' => 'last name',
|
|
|
|
'n_suffix' => 'suffix',
|
|
|
|
'label' => 'label',
|
|
|
|
'adr_one_street' => 'business street',
|
|
|
|
'adr_one_locality' => 'business city',
|
|
|
|
'adr_one_region' => 'business state',
|
|
|
|
'adr_one_postalcode' => 'business zip code',
|
|
|
|
'adr_one_countryname' => 'business country',
|
|
|
|
'adr_one_type' => 'business address type',
|
|
|
|
'adr_two_street' => 'home street',
|
|
|
|
'adr_two_locality' => 'home city',
|
|
|
|
'adr_two_region' => 'home state',
|
|
|
|
'adr_two_postalcode' => 'home zip code',
|
|
|
|
'adr_two_countryname' => 'home country',
|
|
|
|
'adr_two_type' => 'home address type',
|
|
|
|
'tz' => 'time zone',
|
|
|
|
'geo' => 'geo',
|
|
|
|
'tel_work' => 'business phone',
|
|
|
|
'tel_home' => 'home phone',
|
|
|
|
'tel_voice' => 'voice phone',
|
|
|
|
'tel_msg' => 'message phone',
|
|
|
|
'tel_fax' => 'fax',
|
|
|
|
'tel_pager' => 'pager',
|
|
|
|
'tel_cell' => 'mobile phone',
|
|
|
|
'tel_bbs' => 'bbs phone',
|
|
|
|
'tel_modem' => 'modem phone',
|
|
|
|
'tel_isdn' => 'isdn phone',
|
|
|
|
'tel_car' => 'car phone',
|
|
|
|
'tel_video' => 'video phone',
|
|
|
|
'tel_prefer' => 'preferred phone',
|
|
|
|
'email' => 'business email',
|
|
|
|
'email_type' => 'business email type',
|
|
|
|
'email_home' => 'home email',
|
|
|
|
'email_home_type' => 'home email type',
|
|
|
|
'address2' => 'address line 2',
|
|
|
|
'address3' => 'address line 3',
|
|
|
|
'ophone' => 'Other Phone',
|
|
|
|
'bday' => 'birthday',
|
|
|
|
'url' => 'url',
|
|
|
|
'pubkey' => 'public key',
|
|
|
|
'note' => 'notes'
|
2001-02-18 14:41:24 +01:00
|
|
|
);
|
2001-07-08 15:54:40 +02:00
|
|
|
|
2001-05-06 18:43:45 +02:00
|
|
|
if ($abc[$column])
|
|
|
|
{
|
|
|
|
return lang($abc[$column]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
|
|
|
}
|
2001-02-14 01:56:07 +01:00
|
|
|
|
2000-09-28 02:19:04 +02:00
|
|
|
?>
|