diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index 116e3736e3..d198f8c83a 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -9,7 +9,7 @@ * @copyright (c) 2005/6 by Cornelius Weiss * @package addressbook * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id$ + * @version $Id$ */ require_once(EGW_INCLUDE_ROOT.'/addressbook/inc/class.bocontacts.inc.php'); @@ -31,7 +31,7 @@ class uicontacts extends bocontacts ); /** * use a separate private addressbook (former private flag), for contacts not shareable via regular read acl - * + * * @var boolean */ var $private_addressbook = false; @@ -72,12 +72,12 @@ class uicontacts extends bocontacts } $this->config =& $GLOBALS['egw_info']['server']; } - + /** * List contacts of an addressbook * * @param array $content=null submitted content - * @param string $msg=null message to show + * @param string $msg=null message to show * @param boolean $do_email=false do an email-selection popup or the regular index-page */ function index($content=null,$msg=null,$do_email=false) @@ -243,7 +243,7 @@ class uicontacts extends bocontacts } $sel_options['action'] += array( 'delete' => lang('Delete'), - 'csv' => lang('Export as CSV'), + 'csv' => lang('Export as CSV'), 'vcard' => lang('Export as VCard'), // ToDo: move this to importexport framework 'merge' => lang('Merge into first or account, deletes all other!'), 'cat_add' => lang('Add or delete Categoies'), // add a categirie to multible addresses @@ -272,14 +272,14 @@ class uicontacts extends bocontacts $sel_options['action']['remove_from_list'] = lang('Remove selected contacts from distribution list'); $sel_options['action']['delete_list'] = lang('Delete selected distribution list!'); } - - + + if ($this->prefs['document_dir']) { $sel_options['action'][lang('Insert in document').':'] = $this->get_document_actions(); } if (!array_key_exists('importexport',$GLOBALS['egw_info']['user']['apps'])) unset($sel_options['action']['export']); - + // dont show tid-selection if we have only one content_type if (count($this->content_types) <= 1) { @@ -305,26 +305,26 @@ class uicontacts extends bocontacts foreach(explode('|||',$content['nm']['org_view']) as $part) { list(,$name) = explode(':',$part,2); - if ($name) $org_name[] = $name; + if ($name) $org_name[] = $name; } $org_name = implode(': ',$org_name); $sel_options['org_view'][(string) $content['nm']['org_view']] = $org_name; } $content['nm']['org_view_label'] = $sel_options['org_view'][(string) $content['nm']['org_view']]; - + $this->tmpl->read(/*$do_email ? 'addressbook.email' :*/ 'addressbook.index'); return $this->tmpl->exec($do_email ? 'addressbook.uicontacts.emailpopup' : 'addressbook.uicontacts.index', $content,$sel_options,$readonlys,$preserv,$do_email ? 2 : 0); } - + /** * Email address-selection popup * * @param array $content=null submitted content - * @param string $msg=null message to show + * @param string $msg=null message to show */ function emailpopup($content=null,$msg=null) - { + { if (strpos($GLOBALS['egw_info']['flags']['java_script'],'addEmail') === false) { if ($_GET['compat']) // 1.2 felamimail or old email @@ -342,11 +342,11 @@ class uicontacts extends bocontacts $GLOBALS['egw_info']['flags']['java_script'].= " "; break; - + case 'delete': if($this->action('delete',array($content['id']))) { @@ -1343,7 +1343,7 @@ class uicontacts extends bocontacts } elseif ($GLOBALS['egw_info']['user']['preferences']['common']['country']) { - $content['adr_one_countryname'] = + $content['adr_one_countryname'] = $GLOBALS['egw']->country->get_full_name($GLOBALS['egw_info']['user']['preferences']['common']['country']); } if (isset($_GET['owner']) && $_GET['owner'] !== '') @@ -1417,7 +1417,7 @@ class uicontacts extends bocontacts // how to display addresses $content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']); $content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']); - + $content['disable_change_org'] = $view || !$content['org_name']; //_debug_array($content); $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content); @@ -1447,7 +1447,7 @@ class uicontacts extends bocontacts $readonlys[$this->tabs]['distribution_list'] = !$content['distrib_lists'];#false; $readonlys['button[delete]'] = !$content['id']; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; - + // for editing the own account (by a non-admin), enable only the fields allowed via the "own_account_acl" if (!$content['owner'] && !$this->is_admin($content)) { @@ -1478,7 +1478,7 @@ class uicontacts extends bocontacts if ($content['private']) $content['owner'] .= 'p'; $GLOBALS['egw_info']['flags']['include_xajax'] = true; - + if (!$this->tmpl->read($this->content_types[$content['tid']]['options']['template'])) { $content['msg'] = lang('WARNING: Template "%1" not found, using default template instead.', $this->content_types[$content['tid']]['options']['template'])."\n"; @@ -1487,7 +1487,7 @@ class uicontacts extends bocontacts } return $this->tmpl->exec('addressbook.uicontacts.edit',$content,$sel_options,$readonlys,$content, 2); } - + /** * Set the readonlys for non-admins editing their own account * @@ -1504,9 +1504,9 @@ class uicontacts extends bocontacts $readonlys[$field] = true; switch($field) { - case 'tel_work': - case 'tel_cell': - case 'tel_home': + case 'tel_work': + case 'tel_cell': + case 'tel_home': $readonlys[$field.'2'] = true; break; case 'n_fileas': @@ -1532,7 +1532,7 @@ class uicontacts extends bocontacts $readonlys['link_to'] = true; } } - + function ajax_setFileasOptions($n_prefix,$n_given,$n_middle,$n_family,$n_suffix,$org_name) { $names = array( @@ -1548,7 +1548,7 @@ class uicontacts extends bocontacts return $response->getXML(); } - + /** * resizes the uploaded photo to 60*80 pixel and returns it * @@ -1576,7 +1576,7 @@ class uicontacts extends bocontacts if (!$upload) return null; list($src_w,$src_h) = getimagesize($file['tmp_name']); - + // scale the image to a width of 60 and a height according to the proportion of the source image $photo = imagecreatetruecolor($dst_w = 60,$dst_h = round($src_h * 60 / $src_w)); imagecopyresized($photo,$upload,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h); @@ -1589,10 +1589,10 @@ class uicontacts extends bocontacts imagedestroy($photo); imagedestroy($upload); - + return $jpeg; - } - + } + function view($content=null) { if(is_array($content)) @@ -1630,7 +1630,7 @@ class uicontacts extends bocontacts { $readonlys[$key.'2'] = true; $content[$key.'2'] = $content[$key]; - } + } } $content['view'] = true; $content['link_to'] = array( @@ -1648,7 +1648,7 @@ $readonlys['button[vcard]'] = true; // how to display addresses $content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']); $content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']); - + $sel_options['fileas_type'][$content['fileas_type']] = $this->fileas($content); $sel_options['owner'] = $this->get_addressbooks(); for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i; @@ -1701,7 +1701,7 @@ $readonlys['button[vcard]'] = true; $readonlys[$this->tabs]['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; $readonlys[$this->tabs]['distribution_list'] = !$content['distrib_lists'];#false; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; - + // last and next calendar date list(,$dates) = each($this->read_calendar(array($content['id']),false)); if(is_array($dates)) $content += $dates; @@ -1716,7 +1716,7 @@ $readonlys['button[vcard]'] = true; 'ab_id' => $content['id'] )); } - + /** * convert email-address in compose link * @@ -1754,11 +1754,11 @@ $readonlys['button[vcard]'] = true; { if(!empty($_content)) { $response = new xajaxResponse(); - + $query = $GLOBALS['egw']->session->appsession($do_email ? 'email' : 'index','addressbook'); - + $query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select')))); - foreach ($query['advanced_search'] as $key => $value) + foreach ($query['advanced_search'] as $key => $value) { if(!$value) unset($query['advanced_search'][$key]); } @@ -1769,7 +1769,7 @@ $readonlys['button[vcard]'] = true; // store the advanced search in the session to call it again $GLOBALS['egw']->session->appsession('advanced_search','addressbook',$query['advanced_search']); - + $response->addScript(" var link = opener.location.href; link = link.replace(/#/,''); @@ -1779,21 +1779,21 @@ $readonlys['button[vcard]'] = true; return $response->getXML(); } else { - + } $GLOBALS['egw_info']['flags']['include_xajax'] = true; $GLOBALS['egw_info']['flags']['java_script'] .= ""; $GLOBALS['egw_info']['etemplate']['advanced_search'] = true; - + // initialize etemplate arrays $sel_options = $readonlys = $preserv = array(); $content = $GLOBALS['egw']->session->appsession('advanced_search','addressbook'); - + for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i; $sel_options['tz'] = $tz + array('' => lang('doesn\'t matter')); $sel_options['tid'][] = lang('all'); //foreach($this->content_types as $type => $data) $sel_options['tid'][$type] = $data['name']; - + // configure search options $sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ,lang('all')); $sel_options['operator'] = array( @@ -1822,7 +1822,7 @@ $readonlys['button[vcard]'] = true; $readonlys['button'] = true; // disable not needed tabs $readonlys[$this->tabs]['cats'] = !($content['cat_tab'] = $this->config['cat_tab']); - $readonlys[$this->tabs]['custom'] = !$this->customfields; + $readonlys[$this->tabs]['custom'] = !$this->customfields; $readonlys[$this->tabs]['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; $readonlys[$this->tabs]['links'] = true; $readonlys[$this->tabs]['distribution_list'] = true; @@ -1840,9 +1840,9 @@ $readonlys['button[vcard]'] = true; function photo() { ob_start(); - $contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : + $contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : (isset($_GET['account_id']) ? 'account:'.$_GET['account_id'] : 0); - + if (substr($contact_id,0,8) == 'account:') { $contact_id = $GLOBALS['egw']->accounts->id2name(substr($contact_id,8),'person_id'); @@ -1859,10 +1859,10 @@ $readonlys['button[vcard]'] = true; exit; } } - + /** * returns link to call the given phonenumber - * + * * replaces '%1' with the phonenumber to call, '%u' with the user's account_lid and '%t' with his work-phone-number * * @param string $number phone number @@ -1888,8 +1888,8 @@ $readonlys['button[vcard]'] = true; function js() { return ''; } - + function migrate2ldap() { $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Migration to LDAP'); $GLOBALS['egw']->common->egw_header(); parse_navbar(); - + if (!$this->is_admin()) { echo '

'.lang('Permission denied !!!')."

\n"; @@ -2017,7 +2017,7 @@ $readonlys['button[vcard]'] = true; } $GLOBALS['egw']->common->egw_footer(); } - + /** * Download a document with inserted contact(s) * @@ -2044,7 +2044,7 @@ $readonlys['button[vcard]'] = true; return $document_merge->download($document,$ids); } - + /** * Returning document actions / files from the document_dir * @@ -2062,7 +2062,7 @@ $readonlys['button[vcard]'] = true; foreach($files as $file) { // return only the mime-types we support - if (!($file['mime'] == 'application/rtf' || + if (!($file['mime'] == 'application/rtf' || $file['mime'] == 'application/msword' && !strcasecmp(substr($file['name'],-4),'.rtf') || substr($file['mime'],0,5) == 'text/')) continue; // As browsers not always return the right mime_type, you could use a negative list instead @@ -2075,7 +2075,7 @@ $readonlys['button[vcard]'] = true; } return $actions; } - + /** * Read the next and last event of given contacts * @@ -2086,7 +2086,7 @@ $readonlys['button[vcard]'] = true; function read_calendar($ids,$extra_title=true) { if (!$GLOBALS['egw_info']['user']['apps']['calendar']) return null; - + $uids = array(); foreach($ids as $id) { @@ -2101,7 +2101,7 @@ $readonlys['button[vcard]'] = true; 'enum_recuring' => true, )); if (!$events) return array(); - + //_debug_array($events); $calendars = array(); foreach($events as $event) @@ -2148,7 +2148,7 @@ $readonlys['button[vcard]'] = true; $link['title'] = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],$event['start']); } $calendars[$id]['next_link'] = $link; - } + } } } } @@ -2166,7 +2166,7 @@ $readonlys['button[vcard]'] = true; { if (is_array($content)) { - if ($content['cat_id']) //add categorie + if ($content['cat_id']) //add categorie { if ($content['cat_add']) { @@ -2182,7 +2182,7 @@ $readonlys['button[vcard]'] = true; echo "\n"; $GLOBALS['egw']->common->egw_exit(); } - $content['cat_tab'] = $this->config['cat_tab']; + $content['cat_tab'] = $this->config['cat_tab']; $this->tmpl->read('addressbook.index.cat_add'); return $this->tmpl->exec('addressbook.uicontacts.cat_add',$content,$sel_options,$readonlys,$content, 2);