| [ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - Addressbook * 4 * http://www.egroupware.org * 5 * Written by Joseph Engo <jengo@phpgroupware.org> and * 6 * Miles Lott <milos@groupwhere.org> * 7 * -------------------------------------------- * 8 * This program is free software; you can redistribute it and/or modify it * 9 * under the terms of the GNU General Public License as published by the * 10 * Free Software Foundation; either version 2 of the License, or (at your * 11 * option) any later version. * 12 \**************************************************************************/ 13 14 /* $Id: class.uiaddressbook.inc.php 20401 2006-03-04 12:47:31Z ralfbecker $ */ 15 16 class uiaddressbook 17 { 18 var $contacts; 19 var $bo; 20 var $cat; 21 var $company; 22 var $prefs; 23 24 var $debug = False; 25 26 var $start; 27 var $limit; 28 var $query; 29 var $sort; 30 var $order; 31 var $filter; 32 var $cat_id; 33 34 var $public_functions = array( 35 'index' => True, 36 'view' => True, 37 'add' => True, 38 'add_email' => True, 39 'copy' => True, 40 'edit' => True, 41 'delete' => True, 42 'preferences' => True 43 ); 44 45 var $extrafields = array( 46 'ophone' => 'ophone', 47 'address2' => 'address2', 48 'address3' => 'address3' 49 ); 50 51 var $contact_types = array( 52 'n' => 'People', 53 'c' => 'Companies' 54 ); 55 var $contact_type = array( 56 'n' => 'Person', 57 'c' => 'Company' 58 ); 59 60 function uiaddressbook() 61 { 62 $GLOBALS['egw']->country = CreateObject('phpgwapi.country'); 63 $GLOBALS['egw']->browser = CreateObject('phpgwapi.browser'); 64 $GLOBALS['egw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); 65 $this->fields = CreateObject('addressbook.bofields'); 66 67 $this->bo = CreateObject('addressbook.boaddressbook',True); 68 $this->cat = CreateObject('phpgwapi.categories'); 69 // $this->company = CreateObject('phpgwapi.categories','addressbook_company'); 70 $this->prefs = $GLOBALS['egw_info']['user']['preferences']['addressbook']; 71 72 $this->_set_sessiondata(); 73 } 74 75 function _set_sessiondata() 76 { 77 $this->start = $this->bo->start; 78 $this->limit = $this->bo->limit; 79 $this->query = $this->bo->query; 80 $this->cquery = $this->bo->cquery; 81 $this->sort = $this->bo->sort; 82 $this->order = $this->bo->order; 83 $this->filter = $this->bo->filter; 84 $this->cat_id = $this->bo->cat_id; 85 $this->typeid = $this->bo->typeid; 86 if($this->debug) { $this->_debug_sqsof(); } 87 } 88 89 function _debug_sqsof() 90 { 91 $data = array( 92 'start' => $this->start, 93 'limit' => $this->limit, 94 'query' => $this->query, 95 'cquery' => $this->cquery, 96 'sort' => $this->sort, 97 'order' => $this->order, 98 'filter' => $this->filter, 99 'cat_id' => $this->cat_id, 100 'typeid' => $this->typeid 101 ); 102 echo '<br>UI:'; 103 _debug_array($data); 104 } 105 106 /* Called only by index(), just prior to page footer. */ 107 function save_sessiondata() 108 { 109 $data = array( 110 'start' => $this->start, 111 'limit' => $this->limit, 112 'query' => $this->query, 113 'cquery' => $this->cquery, 114 'sort' => $this->sort, 115 'order' => $this->order, 116 'filter' => $this->filter, 117 'cat_id' => $this->cat_id, 118 'typeid' => $this->typeid 119 ); 120 $this->bo->save_sessiondata($data); 121 } 122 123 function formatted_list($name,$list,$id='',$default=False,$java=False) 124 { 125 if($java) 126 { 127 $jselect = ' onChange="this.form.submit();"'; 128 } 129 130 $select = "\n" .'<select name="' . $name . '"' . $jselect . ">\n"; 131 if($default) 132 { 133 $select .= '<option value="">' . lang('Please Select') . '</option>'."\n"; 134 } 135 settype($list,'array'); 136 foreach($list as $key => $val) 137 { 138 $select .= '<option value="' . $key . '"'; 139 if($key == $id && $id != '') 140 { 141 $select .= ' selected'; 142 } 143 $select .= '>' . $val . '</option>'."\n"; 144 } 145 146 $select .= '</select>'."\n"; 147 $select .= '<noscript><input type="submit" name="' . $name . '_select" value="' 148 . lang('Submit') . '"></noscript>' . "\n"; 149 150 return $select; 151 } 152 153 /* Return a select form element with the categories option dialog in it */ 154 function cat_option($cat_id='',$notall=False,$java=True,$multiple=False) 155 { 156 if($java) 157 { 158 $jselect = ' onChange="this.form.submit();"'; 159 } 160 /* Setup all and none first */ 161 $cats_link = "\n" .'<select name="fcat_id'.($multiple?'[]':'').'"' .$jselect . ($multiple ? 'multiple ' : '') . ">\n"; 162 if(!$notall) 163 { 164 $cats_link .= '<option value=""'; 165 if($cat_id == 'all') 166 { 167 $cats_link .= ' selected'; 168 } 169 $cats_link .= '>'.lang("all").'</option>'."\n"; 170 } 171 172 /* Get global and app-specific category listings */ 173 $cats_link .= $this->cat->formated_list('select','all',$cat_id,True); 174 $cats_link .= '</select>'."\n"; 175 return $cats_link; 176 } 177 178 /* this cleans up the fieldnames for display */ 179 function display_name($column) 180 { 181 $abc = array( 182 'fn' => 'full name', 183 'sound' => 'Sound', 184 'org_name' => 'company name', 185 'org_unit' => 'department', 186 'title' => 'title', 187 'n_prefix' => 'prefix', 188 'n_given' => 'first name', 189 'n_middle' => 'middle name', 190 'n_family' => 'last name', 191 'n_suffix' => 'suffix', 192 'label' => 'label', 193 'adr_one_street' => 'business street', 194 'adr_one_locality' => 'business city', 195 'adr_one_region' => 'business state', 196 'adr_one_postalcode' => 'business zip code', 197 'adr_one_countryname' => 'business country', 198 'adr_one_type' => 'business address type', 199 'adr_two_street' => 'home street', 200 'adr_two_locality' => 'home city', 201 'adr_two_region' => 'home state', 202 'adr_two_postalcode' => 'home zip code', 203 'adr_two_countryname' => 'home country', 204 'adr_two_type' => 'home address type', 205 'tz' => 'time zone', 206 'geo' => 'geo', 207 'tel_work' => 'business phone', 208 'tel_home' => 'home phone', 209 'tel_voice' => 'voice phone', 210 'tel_msg' => 'message phone', 211 'tel_fax' => 'fax', 212 'tel_pager' => 'pager', 213 'tel_cell' => 'mobile phone', 214 'tel_bbs' => 'bbs phone', 215 'tel_modem' => 'modem phone', 216 'tel_isdn' => 'isdn phone', 217 'tel_car' => 'car phone', 218 'tel_video' => 'video phone', 219 'tel_prefer' => 'preferred phone', 220 'email' => 'business email', 221 'email_type' => 'business email type', 222 'email_home' => 'home email', 223 'email_home_type' => 'home email type', 224 'address2' => 'address line 2', 225 'address3' => 'address line 3', 226 'ophone' => 'Other Phone', 227 'bday' => 'birthday', 228 'url' => 'url', 229 'pubkey' => 'public key', 230 'note' => 'notes' 231 ); 232 233 if($abc[$column]) 234 { 235 return lang($abc[$column]); 236 } 237 return; 238 } 239 240 function index() 241 { 242 $GLOBALS['egw']->common->phpgw_header(); 243 echo parse_navbar(); 244 245 $GLOBALS['egw']->template->set_file(array('addressbook_list_t' => 'index.tpl')); 246 $GLOBALS['egw']->template->set_block('addressbook_list_t','addressbook_header','addressbook_header'); 247 $GLOBALS['egw']->template->set_block('addressbook_list_t','column','column'); 248 $GLOBALS['egw']->template->set_block('addressbook_list_t','row','row'); 249 $GLOBALS['egw']->template->set_block('addressbook_list_t','delete_block','delete_block'); 250 $GLOBALS['egw']->template->set_block('addressbook_list_t','addressbook_footer','addressbook_footer'); 251 $GLOBALS['egw']->template->set_block('addressbook_list_t','addressbook_alpha','addressbook_alpha'); 252 253 /* Setup query for 1st char of fullname, company, lastname using user lang */ 254 $chars = lang('alphabet'); 255 if($chars == 'alphabet*') 256 { 257 $chars = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'; 258 } 259 $aar = explode(',', $chars); 260 unset($chars); 261 $aar[] = 'all'; 262 foreach($aar as $char) 263 { 264 $GLOBALS['egw']->template->set_var('charclass',$this->cquery == $char || 265 $char == 'all' && !$this->cquery ? 'letter_box_active' : 'letter_box'); 266 267 if($char == 'all') 268 { 269 $GLOBALS['egw']->template->set_var('charlink', 270 $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index&cquery=') 271 ); 272 } 273 else 274 { 275 $GLOBALS['egw']->template->set_var('charlink', 276 $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index&cquery=' . $char) 277 ); 278 } 279 $GLOBALS['egw']->template->set_var('char',$char != 'all' ? strtoupper($char) : lang('all')); 280 $GLOBALS['egw']->template->fp('alphalinks','addressbook_alpha',True); 281 } 282 unset($aar); 283 unset($char); 284 285 $custom = $this->fields->_read(); 286 $customfields = array(); 287 // while(list($x,$y) = @each($custom)) 288 foreach($custom as $x => $y) 289 { 290 $customfields[$y['name']] = $y['name']; 291 $namedfields[$y['name']] = $y['title']; 292 } 293 294 if($this->cat_id == -1) 295 { 296 $this->cat_id = $this->prefs['default_category']; 297 } 298 299 if($this->prefs['autosave_category']) 300 { 301 $GLOBALS['egw']->preferences->read_repository(); 302 $GLOBALS['egw']->preferences->delete('addressbook','default_category'); 303 $GLOBALS['egw']->preferences->add('addressbook','default_category',$this->cat_id); 304 $GLOBALS['egw']->preferences->save_repository(); 305 } 306 307 /* global here so nextmatchs accepts our setting of $query and $filter - may be changed again below */ 308 $GLOBALS['query'] = $this->query; 309 $GLOBALS['filter'] = $this->filter; 310 311 /* $qfields = $contacts->stock_contact_fields + $extrafields + $customfields; */ 312 /* create column list and the top row of the table based on user prefs */ 313 foreach($this->bo->stock_contact_fields as $column => $db_name) 314 { 315 $test = strtolower($column); 316 if(isset($this->prefs[$test]) && $this->prefs[$test]) 317 { 318 $showcol = $this->display_name($column); 319 $cols .= ' <td height="21">' . "\n"; 320 $cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">'; 321 $cols .= $GLOBALS['egw']->nextmatchs->show_sort_order($this->sort, 322 $column,$this->order,'/index.php',$showcol,'&menuaction=addressbook.uiaddressbook.index' 323 ); 324 $cols .= "</font>\n </td>"; 325 $cols .= "\n"; 326 327 /* To be used when displaying the rows */ 328 $columns_to_display[$column] = True; 329 } 330 } 331 /* Setup the columns for non-standard fields, since we don't allow sorting */ 332 $nonstd = $this->extrafields + $customfields; 333 foreach($nonstd as $column) 334 { 335 if(isset($this->prefs[$column]) && $this->prefs[$column]) 336 { 337 $showcol = $this->display_name($column); 338 /* This must be a custom field */ 339 if(!$showcol) 340 { 341 $showcol = $namedfields[$column]; 342 } 343 $cols .= ' <td height="21">' . "\n"; 344 $cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">'; 345 $cols .= $showcol; 346 $cols .= "</font>\n </td>"; 347 $cols .= "\n"; 348 349 /* To be used when displaying the rows */ 350 $columns_to_display[$column] = True; 351 } 352 } 353 354 /* Check if prefs were set, if not, create some defaults */ 355 if(!$columns_to_display) 356 { 357 /* No prefs,. so cols above may have been set to '' or a bunch of <td></td> */ 358 $cols=''; 359 $columns_to_display = array( 360 'fn' => True, 361 'org_name' => True, 362 'adr_one_locality' => True, 363 'tel_work' => True, 364 'tel_cell' => True, 365 'email' => True 366 ); 367 foreach($columns_to_display as $col => $nul) 368 { 369 $showcol = $this->display_name($col); 370 $cols .= ' <td height="21">' . "\n"; 371 $cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">'; 372 $cols .= $GLOBALS['egw']->nextmatchs->show_sort_order( 373 $this->sort,$col,$this->order, 374 "/index.php",$showcol, 375 '&menuaction=addressbook.uiaddressbook.index&cat_id=' . $this->cat_id . '&cquery=' . $this->cquery 376 ); 377 $cols .= "</font>\n </td>"; 378 $cols .= "\n"; 379 380 $prefs[$col] = 'on'; 381 } 382 $this->bo->save_preferences($prefs,'',$columns_to_display,''); 383 } 384 385 if(!$this->start) 386 { 387 $this->start = 0; 388 } 389 390 if($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] && 391 $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 0) 392 { 393 $this->limit = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']; 394 } 395 else 396 { 397 $this->limit = 15; 398 } 399 400 /*global $filter; */ 401 if(empty($this->filter) || !isset($this->filter)) 402 { 403 if($this->prefs['default_filter']) 404 { 405 $this->filter = $this->prefs['default_filter']; 406 $this->query = ''; 407 } 408 else 409 { 410 $this->filter = 'none'; 411 } 412 } 413 414 /* 415 Set qfilter to display entries where tid=n (normal contact entry), 416 else they may be accounts, etc. 417 */ 418 $qfilter = 'tid=' . (string)$this->typeid; 419 switch($this->filter) 420 { 421 case 'blank': 422 $nosearch = True; 423 break; 424 case 'none': 425 break; 426 case 'private': 427 $qfilter .= ',access=private'; /* fall through */ 428 case 'yours': 429 $qfilter .= ',owner=' . $GLOBALS['egw_info']['user']['account_id']; 430 break; 431 default: 432 $qfilter .= ',owner=' . $this->filter; 433 } 434 if($this->cat_id) 435 { 436 $qfilter .= ',cat_id='.$this->cat_id; 437 } 438 439 if(!$userid) 440 { 441 $userid = $GLOBALS['egw_info']['user']['account_id']; 442 } 443 444 if($nosearch && !$this->query) 445 { 446 $entries = array(); 447 $total_records = 0; 448 } 449 else 450 { 451 /* read the entry list */ 452 $entries = $this->bo->read_entries(array( 453 'start' => $this->start, 454 'limit' => $this->limit, 455 'fields' => $columns_to_display, 456 'filter' => $qfilter, 457 'query' => $this->query, 458 'cquery' => $this->cquery, 459 'sort' => $this->sort, 460 'order' => $this->order 461 )); 462 $total_records = $this->bo->total; 463 } 464 465 /* global here so nextmatchs accepts our setting of $query and $filter */ 466 $GLOBALS['query'] = $this->query; 467 $GLOBALS['filter'] = $this->filter; 468 469 $search_filter = $GLOBALS['egw']->nextmatchs->show_tpl('/index.php', 470 $this->start, $total_records, 471 '&menuaction=addressbook.uiaddressbook.index&fcat_id=' . $this->cat_id . '&cquery=' . $this->cquery,'95%', 472 $GLOBALS['egw_info']['theme']['th_bg'],1,1,1,array('filter' => $this->filter,'yours' => 1), 473 $this->cat_id 474 ); 475 $query = $filter = ''; 476 477 $lang_showing = $GLOBALS['egw']->nextmatchs->show_hits($total_records,$this->start); 478 479 /* set basic vars and parse the header */ 480 $GLOBALS['egw']->template->set_var('font',$GLOBALS['egw_info']['theme']['font']); 481 $GLOBALS['egw']->template->set_var('lang_actions',lang('Actions')); 482 $GLOBALS['egw']->template->set_var('check',$GLOBALS['egw']->common->image('phpgwapi','transparent')); 483 $GLOBALS['egw']->template->set_var('select_all',''); 484 if(count($entries)) 485 { 486 $GLOBALS['egw']->template->set_var('check', $GLOBALS['egw']->common->image('addressbook','check')); 487 $GLOBALS['egw']->template->set_var('select_all',lang('Select all')); 488 } 489 490 $GLOBALS['egw']->template->set_var('searchreturn',$noprefs . ' ' . $searchreturn); 491 $GLOBALS['egw']->template->set_var('lang_showing',$lang_showing); 492 $GLOBALS['egw']->template->set_var('search_filter',$search_filter); 493 /* 494 $GLOBALS['egw']->template->set_var('lang_show',lang('Show') . ':'); 495 $GLOBALS['egw']->template->set_var('contact_type_list',$this->formatted_list('typeid',$this->contact_types,$this->typeid,False,True)); 496 $GLOBALS['egw']->template->set_var('self_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 497 */ 498 $GLOBALS['egw']->template->set_var('lang_show',''); 499 $GLOBALS['egw']->template->set_var('contact_type_list',''); 500 $GLOBALS['egw']->template->set_var('self_url',''); 501 502 $GLOBALS['egw']->template->set_var('cats',lang('Category')); 503 $GLOBALS['egw']->template->set_var('cats_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 504 /* $GLOBALS['egw']->template->set_var('cats_link',$this->cat_option($this->cat_id)); */ 505 $GLOBALS['egw']->template->set_var('lang_cats',lang('Select')); 506 // $GLOBALS['egw']->template->set_var('lang_addressbook',lang('Address book')); 507 $GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']); 508 $GLOBALS['egw']->template->set_var('th_font',$GLOBALS['egw_info']['theme']['font']); 509 $GLOBALS['egw']->template->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']); 510 $GLOBALS['egw']->template->set_var('action_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.delete')); 511 $GLOBALS['egw']->template->set_var('lang_add',lang('Add')); 512 $add_link = $GLOBALS['egw']->link('/index.php?menuaction=addressbook.uicontacts.edit'); 513 $GLOBALS['egw']->template->set_var('add_url',$add_link); 514 $GLOBALS['egw']->template->set_var('add_onclick',"window.open('$add_link','_blank','dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;"); 515 $GLOBALS['egw']->template->set_var('lang_addvcard',lang('AddVCard')); 516 $GLOBALS['egw']->template->set_var('vcard_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uivcard.in')); 517 $GLOBALS['egw']->template->set_var('lang_import',lang('Import Contacts')); 518 $GLOBALS['egw']->template->set_var('import_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.import')); 519 $GLOBALS['egw']->template->set_var('lang_import_alt',lang('Alt. CSV Import')); 520 $GLOBALS['egw']->template->set_var('import_alt_url',$GLOBALS['egw']->link('/addressbook/csv_import.php')); 521 $GLOBALS['egw']->template->set_var('lang_export',lang('Export Contacts')); 522 $GLOBALS['egw']->template->set_var('export_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.export')); 523 $GLOBALS['egw']->template->set_var('lang_delete',lang('Delete')); 524 $GLOBALS['egw']->template->set_var('column_count',count($columns_to_display)); 525 $GLOBALS['egw']->template->set_var('lang_sure',lang('Are you sure you want to delete these entries ?')); 526 527 $GLOBALS['egw']->template->set_var('start',$this->start); 528 $GLOBALS['egw']->template->set_var('sort',$this->sort); 529 $GLOBALS['egw']->template->set_var('order',$this->order); 530 $GLOBALS['egw']->template->set_var('filter',$this->filter); 531 $GLOBALS['egw']->template->set_var('query',$this->query); 532 $GLOBALS['egw']->template->set_var('cat_id',$this->cat_id); 533 534 $GLOBALS['egw']->template->set_var('qfield',$qfield); 535 $GLOBALS['egw']->template->set_var('cols',$cols); 536 537 $GLOBALS['egw']->template->pparse('out','addressbook_header'); 538 539 /* Show the entries */ 540 /* each entry */ 541 for($i=0;$i<count($entries);$i++) 542 { 543 $GLOBALS['egw']->template->set_var('columns',''); 544 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 545 $GLOBALS['egw']->template->set_var('row_tr_color',$tr_color); 546 $myid = $entries[$i]['id']; 547 $myowner = $entries[$i]['owner']; 548 549 /* each entry column */ 550 foreach($columns_to_display as $column => $nul) 551 { 552 $ref = $data=''; 553 $coldata = $entries[$i][$column]; 554 /* echo '<br>coldata="' . $coldata . '"'; */ 555 /* Some fields require special formatting. */ 556 if($column == 'url') 557 { 558 if(!empty($coldata) && (substr($coldata,0,7) != 'http://')) 559 { 560 $coldata = 'http://' . $coldata; 561 } 562 $ref='<a href="'.$coldata.'" target="_blank">'; 563 $data=$coldata.'</a>'; 564 } 565 elseif(($column == 'email' || $column == 'email_home') && strstr($coldata,'@')) 566 { 567 $link = $this->email2link($coldata); 568 if (is_array($link)) $link = $GLOBALS['egw']->link('/index.php',$link); 569 570 $ref = '<a href="'.htmlspecialchars($link).'" target="_blank">'; 571 $data = $coldata.'</a>'; 572 } 573 else /* But these do not */ 574 { 575 $ref = ''; $data = $coldata; 576 } 577 $GLOBALS['egw']->template->set_var('col_data',$ref.$data); 578 $GLOBALS['egw']->template->parse('columns','column',True); 579 } 580 581 $actions = '<a href="' 582 . $GLOBALS['egw']->link('/index.php',array( 583 'menuaction' => 'addressbook.uicontacts.view', 584 'contact_id' => $entries[$i]['id'], 585 )) 586 . '"><img src="' 587 . $GLOBALS['egw']->common->image('addressbook','view') 588 . '" border="0" title="'.lang('View').'"></a> '; 589 590 if($this->bo->check_perms($entries[$i],PHPGW_ACL_EDIT)) 591 { 592 $actions .= '<a href="' 593 . $GLOBALS['egw']->link('/index.php',array( 594 'menuaction' => 'addressbook.uicontacts.edit', 595 'contact_id' => $entries[$i]['id'], 596 )). '" onClick="window.open(this,this.target,\'dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false;">'. 597 '<img src="'. $GLOBALS['egw']->common->image('addressbook','edit') 598 . '" border="0" title="' . lang('Edit') . '"></a>'; 599 } 600 601 if($this->bo->check_perms($entries[$i],PHPGW_ACL_DELETE)) 602 { 603 $actions .= '<a href="' 604 . $GLOBALS['egw']->link('/index.php',array( 605 'menuaction' => 'addressbook.uiaddressbook.delete', 606 'ab_id' => $entries[$i]['id'] 607 )) 608 . '" onclick="return confirm(\''.lang('Are you sure you want to delete this entry ?').'\');"><img src="' 609 . $GLOBALS['egw']->common->image('addressbook','delete') 610 . '" border="0" title="'.lang('Delete').'"></a>'; 611 } 612 $actions .= '<input type="checkbox" name="select[' . $entries[$i]['id'] . ']">'; 613 $GLOBALS['egw']->template->set_var('actions',$actions); 614 615 $GLOBALS['egw']->template->parse('rows','row',True); 616 $GLOBALS['egw']->template->pparse('out','row'); 617 reset($columns_to_display); 618 } 619 620 $GLOBALS['egw']->template->set_var('delete_button',''); 621 if(count($entries)) 622 { 623 $GLOBALS['egw']->template->fp('delete_button','delete_block'); 624 } 625 $GLOBALS['egw']->template->pfp('out','addressbook_footer'); 626 $this->save_sessiondata(); 627 /* $GLOBALS['egw']->common->phpgw_footer(); */ 628 } 629 630 /** 631 * convert email-address in compose link 632 * 633 * @param string $email email-addresse 634 * @return array/string array with get-params or mailto:$email, or '' or no mail addresse 635 */ 636 function email2link($email) 637 { 638 if (!strstr($email,'@')) return ''; 639 640 if($GLOBALS['egw_info']['user']['apps']['felamimail']) 641 { 642 return array( 643 'menuaction' => 'felamimail.uicompose.compose', 644 'send_to' => base64_encode($email) 645 ); 646 } 647 if($GLOBALS['egw_info']['user']['apps']['email']) 648 { 649 return array( 650 'menuaction' => 'email.uicompose.compose', 651 'to' => $email, 652 ); 653 } 654 return 'mailto:' . $email; 655 } 656 657 function add_email() 658 { 659 $name = $_POST['name'] ? $_POST['name'] : $_GET['name']; 660 $referer = $_POST['referer'] ? $_POST['referer'] : $_GET['referer']; 661 $add_email = $_POST['add_email'] ? $_POST['add_email'] : $_GET['add_email']; 662 663 $named = explode(' ', $name); 664 for($i=count($named);$i>=0;$i--) 665 { 666 $names[$i] = $named[$i]; 667 } 668 if($names[2]) 669 { 670 $fields['n_given'] = $names[0]; 671 $fields['n_middle'] = $names[1]; 672 $fields['n_family'] = $names[2]; 673 } 674 else 675 { 676 $fields['n_given'] = $names[0]; 677 $fields['n_family'] = $names[1]; 678 } 679 680 $GLOBALS['egw']->redirect_link('/index.php', array( 681 'menuaction' => 'addressbook.uicontacts.edit', 682 'presets[n_given]' => $fields['n_given'] ? $fields['n_given'] : ' ', 683 'presets[n_middle]' => $fields['n_middle'] ? $fields['n_middle'] : '', 684 'presets[n_family]' => $fields['n_family'] ? $fields['n_family'] : ' ', 685 'presets[email]' => $add_email, 686 )); 687 } 688 689 function copy() 690 { 691 $custom = $this->fields->_read(); 692 $customfields = array(); 693 // while(list($x,$y) = @each($custom)) 694 foreach($custom as $x => $y) 695 { 696 $customfields[$y['name']] = $y['title']; 697 } 698 699 list($addnew) = $this->bo->read_entry(array( 700 'id' => (int) $_GET['ab_id'], 701 'fields' => $this->bo->stock_contact_fields + $this->extrafields + $customfields 702 )); 703 704 $addnew['note'] .= "\n".lang("Copied by %1, from record #%2.",$GLOBALS['egw']->accounts->id2name($addnew['owner']),$addnew['id']); 705 $addnew['owner'] = $GLOBALS['egw_info']['user']['account_id']; 706 unset($addnew['rights']); 707 unset($addnew['id']); 708 709 $ab_id = $this->bo->add_entry($addnew); 710 711 $GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.edit&ab_id=' . $ab_id); 712 } 713 714 function add() 715 { 716 if($_POST['save'] || $_POST['apply']) 717 { 718 $fields = $this->get_form(); 719 720 $referer = urlencode($fields['referer']); 721 unset($fields['referer']); 722 $fields['owner'] = $GLOBALS['egw_info']['user']['account_id']; 723 724 $ab_id = $this->bo->add_entry($fields); 725 if(@is_array($ab_id) || !$ab_id) 726 { 727 /* Errors encountered during validation */ 728 $errors = $ab_id; 729 } 730 // $ab_id = $this->bo->get_lastid(); 731 732 if(!$errors && $_POST['save']) 733 { 734 Header('Location: ' 735 . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id . '&referer=' . $referer)); 736 $GLOBALS['egw']->common->phpgw_exit(); 737 } 738 } 739 740 $GLOBALS['egw']->template->set_file(array('add' => 'add.tpl')); 741 742 $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Add'); 743 $GLOBALS['egw']->common->phpgw_header(); 744 echo parse_navbar(); 745 746 $custom = $this->fields->_read(); 747 foreach($custom as $x => $y) 748 { 749 $customfields[$y['name']] = $y['title']; 750 } 751 752 $this->addressbook_form('','menuaction=addressbook.uiaddressbook.add','Add','',$customfields,$this->cat_id); 753 754 $GLOBALS['egw']->template->set_var('errors',''); 755 if(@is_array($errors)) 756 { 757 $GLOBALS['egw']->template->set_var('errors',implode(',',$errors)); 758 } 759 $GLOBALS['egw']->template->set_var('lang_save',lang('Save')); 760 $GLOBALS['egw']->template->set_var('lang_apply',lang('Apply')); 761 $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); 762 $GLOBALS['egw']->template->set_var('cancel_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 763 $GLOBALS['egw']->template->parse('out','add'); 764 $GLOBALS['egw']->template->pparse('out','add'); 765 } 766 767 function edit() 768 { 769 if($_POST['save'] || $_POST['apply']) 770 { 771 $_fields = $this->get_form(); 772 /* _debug_array($_fields);exit; */ 773 $check = $this->bo->read_entry(array('id' => $_fields['ab_id'], 'fields' => array('owner' => 'owner','tid' => 'tid'))); 774 775 if($this->bo->check_perms($check[0],PHPGW_ACL_EDIT)) 776 { 777 $userid = $check[0]['owner']; 778 } 779 else 780 { 781 $userid = $GLOBALS['egw_info']['user']['account_id']; 782 } 783 $_fields['owner'] = $userid; 784 $referer = urlencode($_fields['referer']); 785 unset($_fields['referer']); 786 787 $this->bo->update_entry($_fields); 788 789 if($_POST['save']) 790 { 791 Header('Location: ' 792 . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $_fields['ab_id'] . '&referer=' . $referer) 793 ); 794 $GLOBALS['egw']->common->phpgw_exit(); 795 } 796 } 797 798 /* First, make sure they have permission to this entry */ 799 $check = $this->bo->read_entry(array('id' => (int) $_GET['ab_id'], 'fields' => array('owner' => 'owner','tid' => 'tid'))); 800 801 if(!$this->bo->check_perms($check[0],PHPGW_ACL_EDIT)) 802 { 803 Header('Location: ' . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 804 $GLOBALS['egw']->common->phpgw_exit(); 805 } 806 807 $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Edit'); 808 $GLOBALS['egw']->common->phpgw_header(); 809 echo parse_navbar(); 810 811 /* Read in user custom fields, if any */ 812 $custom = $this->fields->_read(); 813 $customfields = array(); 814 // while(list($x,$y) = @each($custom)) 815 foreach($custom as $x => $y) 816 { 817 $customfields[$y['name']] = $y['title']; 818 } 819 820 /* merge in extra fields */ 821 $qfields = $this->bo->stock_contact_fields + $this->extrafields + $customfields; 822 $fields = $this->bo->read_entry(array('id' => (int) $_GET['ab_id'], 'fields' => $qfields)); 823 824 $this->addressbook_form('edit','menuaction=addressbook.uiaddressbook.edit',lang('Edit'),$fields[0],$customfields); 825 826 $GLOBALS['egw']->template->set_file(array('edit' => 'edit.tpl')); 827 828 $GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']); 829 $GLOBALS['egw']->template->set_var('ab_id',(int) $_GET['ab_id']); 830 $GLOBALS['egw']->template->set_var('tid',$check[0]['tid']); 831 $GLOBALS['egw']->template->set_var('referer',$referer); 832 $GLOBALS['egw']->template->set_var('lang_save',lang('Save')); 833 $GLOBALS['egw']->template->set_var('lang_apply',lang('Apply')); 834 $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); 835 $GLOBALS['egw']->template->set_var('cancel_link','<form method="POST" action="' 836 . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index') . '">'); 837 838 if(($this->bo->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $GLOBALS['egw_info']['user']['account_id']) 839 { 840 $GLOBALS['egw']->template->set_var('delete_link','<form method="POST" action="'.$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.delete') . '">'); 841 $GLOBALS['egw']->template->set_var('delete_button','<input type="submit" name="delete" value="' . lang('Delete') . '">'); 842 } 843 844 $GLOBALS['egw']->template->pfp('out','edit'); 845 } 846 847 function delete() 848 { 849 $ab_id = $_POST['entry']['ab_id'] ? $_POST['entry']['ab_id'] : $_POST['ab_id']; 850 $select = $_POST['select']; 851 if(@is_array($select)) 852 { 853 /* The original values are sent as select[number] = on */ 854 $select = array_keys($select); 855 } 856 elseif(is_string($select)) 857 { 858 /* This is imploded below and sent along with the form if the answer is yes */ 859 $select = explode(',',$select); 860 } 861 862 if(!$ab_id) 863 { 864 $ab_id = (int) $_GET['ab_id']; // else plain Link in delete does not work 865 } 866 if((!$ab_id && !$select) || $_POST['no']) 867 { 868 Header('Location: ' . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 869 } 870 871 if(!@is_array($select)) 872 { 873 $select[] = $ab_id; 874 } 875 foreach($select as $_id) 876 { 877 if(!(int)$_id) 878 { 879 continue; 880 } 881 $check = $this->bo->read_entry(array('id' => $_id, 'fields' => array('owner' => 'owner','tid' => 'tid'))); 882 883 if(!(($this->bo->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $GLOBALS['egw_info']['user']['account_id'])) 884 { 885 Header('Location: ' . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 886 $GLOBALS['egw']->common->phpgw_exit(); 887 } 888 } 889 /* done via javascript confirmation 890 $GLOBALS['egw']->template->set_file(array('delete' => 'delete.tpl')); 891 892 if(!$_POST['yes']) 893 { 894 $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Delete'); 895 $GLOBALS['egw']->common->phpgw_header(); 896 echo parse_navbar(); 897 898 if(count($select) == 1) 899 { 900 $GLOBALS['egw']->template->set_var('lang_sure',lang('Are you sure you want to delete this entry ?')); 901 } 902 else 903 { 904 $GLOBALS['egw']->template->set_var('lang_sure',lang('Are you sure you want to delete these entries ?')); 905 } 906 $GLOBALS['egw']->template->set_var('no_link',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 907 $GLOBALS['egw']->template->set_var('lang_no',lang('NO')); 908 $GLOBALS['egw']->template->set_var('yes_link',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.delete&ab_id=' . $ab_id . '&confirm=true')); 909 $GLOBALS['egw']->template->set_var('select',implode(',',$select)); 910 $GLOBALS['egw']->template->set_var('lang_yes',lang('YES')); 911 $GLOBALS['egw']->template->pparse('out','delete'); 912 } 913 else 914 */ 915 { 916 if(!@is_array($select)) 917 { 918 $select[] = $ab_id; 919 } 920 foreach($select as $null => $_id) 921 { 922 $this->bo->delete_entry(array('id' => $_id)); 923 } 924 @Header('Location: ' . $GLOBALS['egw']->link('/addressbook/index.php','menuaction=addressbook.uiaddressbook.index')); 925 } 926 } 927 928 function rebuild_referer($val) 929 { 930 $val = urldecode($val); 931 $vars = split('&',$val); 932 $i = 0; 933 foreach($vars as $key => $var) 934 { 935 $pair = split('=',$var); 936 if($pair[0] == 'sq') 937 { 938 $pair[1] = $GLOBALS['egw']->session->sq; 939 } 940 $vars[$i] = implode('=',$pair); 941 $i++; 942 } 943 $val = implode('&',$vars); 944 return $val; 945 } 946 947 function view() 948 { 949 $ab_id = (int) $_GET['ab_id']; 950 $save = $_POST['save']; 951 $apply = $_POST['apply']; 952 $referer = $this->rebuild_referer($_GET['referer']); 953 954 /* First, make sure they have permission to this entry */ 955 if(!$ab_id || !$this->bo->check_perms($ab_id,PHPGW_ACL_READ)) 956 { 957 Header('Location: ' . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); 958 $GLOBALS['egw']->common->phpgw_exit(); 959 } 960 elseif(!($save || $apply) && $ab_id) 961 { 962 $GLOBALS['egw_info']['flags']['app_header'] = lang('Address book - view'); 963 $GLOBALS['egw']->common->phpgw_header(); 964 echo parse_navbar(); 965 } 966 967 $GLOBALS['egw']->template->set_file(array('view_t' => 'view.tpl')); 968 $GLOBALS['egw']->template->set_block('view_t','view_header','view_header'); 969 $GLOBALS['egw']->template->set_block('view_t','view_row','view_row'); 970 $GLOBALS['egw']->template->set_block('view_t','view_footer','view_footer'); 971 $GLOBALS['egw']->template->set_block('view_t','view_buttons','view_buttons'); 972 973 $custom = $this->fields->_read(); 974 $customfields = array(); 975 // while(list($x,$y) = @each($custom)) 976 foreach($custom as $x => $y) 977 { 978 $customfields[$y['name']] = $y['title']; 979 } 980 981 /* _debug_array($this->prefs); */ 982 // while(list($column,$x) = each($this->bo->stock_contact_fields)) 983 foreach($this->bo->stock_contact_fields as $column => $x) 984 { 985 if(isset($this->prefs[$column]) && $this->prefs[$column]) 986 { 987 $columns_to_display[$column] = True; 988 $colname[$column] = $column; 989 } 990 } 991 992 /* merge in extra fields */ 993 $qfields = $this->bo->stock_contact_fields + $this->extrafields + $customfields; 994 995 $fields = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $qfields)); 996 997 $record_owner = $fields[0]['owner']; 998 999 if($fields[0]['access'] == 'private') 1000 { 1001 $access_check = lang('private'); 1002 } 1003 else 1004 { 1005 $access_check = lang('public'); 1006 } 1007 1008 unset($qfields['email_type']); // noone is useing that any more 1009 unset($qfields['email_home_type']); 1010 1011 // @reset($qfields); 1012 // while(list($column,$null) = @each($qfields)) 1013 foreach($qfields as $column => $nul) 1014 { 1015 if($this->display_name($colname[$column])) 1016 { 1017 $GLOBALS['egw']->template->set_var('display_col',$this->display_name($colname[$column])); 1018 } 1019 elseif($this->display_name($column)) 1020 { 1021 $GLOBALS['egw']->template->set_var('display_col',$this->display_name($column)); 1022 } 1023 else 1024 { 1025 $GLOBALS['egw']->template->set_var('display_col',ucfirst($column)); 1026 } 1027 $ref = $data = ''; 1028 if($fields[0][$column]) 1029 { 1030 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1031 $GLOBALS['egw']->template->set_var('th_bg',$tr_color); 1032 $coldata = $fields[0][$column]; 1033 /* Some fields require special formatting. */ 1034 if(($column == 'note' || $column == 'pubkey') && $coldata) 1035 { 1036 $datarray = explode("\n",$coldata); 1037 if($datarray[1]) 1038 { 1039 // while(list($key,$info) = each($datarray)) 1040 foreach($datarray as $key => $info) 1041 { 1042 if($key) 1043 { 1044 $data .= '</td></tr><tr bgcolor="'.$tr_color.'"><td width="30%"> </td><td width="70%">' .$info; 1045 } 1046 else 1047 { 1048 /* First row, don't close td/tr */ 1049 $data .= $info; 1050 } 1051 } 1052 $data .= '</tr>'; 1053 } 1054 else 1055 { 1056 $data = $coldata; 1057 } 1058 } 1059 elseif($column == 'url' && $coldata) 1060 { 1061 $ref = '<a href="' . $coldata . '" target="_new">'; 1062 $data = $coldata . '</a>'; 1063 } 1064 elseif((($column == 'email') || ($column == 'email_home')) && $coldata) 1065 { 1066 if($GLOBALS['egw_info']['user']['apps']['email']) 1067 { 1068 $ref='<a href="' . $GLOBALS['egw']->link('/email/compose.php','to=' 1069 . urlencode($coldata)) . '" target="_new">'; 1070 } 1071 else 1072 { 1073 $ref = '<a href="mailto:'.$coldata.'">'; 1074 } 1075 $data = $coldata.'</a>'; 1076 } 1077 elseif($column == 'bday') 1078 { 1079 list($month,$day,$year) = explode('/',$coldata); 1080 $data = $GLOBALS['egw']->common->dateformatorder($year,$month,$day,True); 1081 } 1082 else 1083 { 1084 /* But these do not */ 1085 $ref = ''; $data = $coldata; 1086 } 1087 1088 if(!$data) 1089 { 1090 $GLOBALS['egw']->template->set_var('ref_data',' '); 1091 } 1092 else 1093 { 1094 $GLOBALS['egw']->template->set_var('ref_data',$ref . $data); 1095 } 1096 $GLOBALS['egw']->template->parse('cols','view_row',True); 1097 } 1098 } 1099 /* Following cleans up view_row, since we were only using it to fill {cols} */ 1100 //$GLOBALS['egw']->template->set_var('view_row',''); 1101 1102 $fields['cat_id'] = is_array($this->cat_id) ? implode(',',$this->cat_id) : $this->cat_id; 1103 1104 $cats = explode(',',$fields[0]['cat_id']); 1105 $catnames = array(); 1106 foreach($cats as $cat) 1107 { 1108 if ($cat) 1109 { 1110 $cat = $this->cat->return_single((int)$cat); 1111 $catnames[] = stripslashes($cat[0]['name']); 1112 } 1113 } 1114 $catname = implode('; ',$catnames); 1115 if (!$this->cat_id) 1116 { 1117 $this->cat_id = count($cats) > 1 ? $cats[1] : $cats[0]; 1118 } 1119 1120 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1121 $GLOBALS['egw']->template->set_var(array( 1122 'ref_data' => $GLOBALS['egw']->common->grab_owner_name($record_owner), 1123 'display_col' => lang('Record owner'), 1124 'th_bg' => $tr_color 1125 )); 1126 $GLOBALS['egw']->template->parse('cols','view_row',True); 1127 1128 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1129 $GLOBALS['egw']->template->set_var(array( 1130 'ref_data' => $access_check, 1131 'display_col' => lang('Record access'), 1132 'th_bg' => $tr_color 1133 )); 1134 $GLOBALS['egw']->template->parse('cols','view_row',True); 1135 1136 if($catname) 1137 { 1138 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1139 $GLOBALS['egw']->template->set_var(array( 1140 'ref_data' => $catname, 1141 'display_col' => lang('Category'), 1142 'th_bg' => $tr_color 1143 )); 1144 $GLOBALS['egw']->template->parse('cols','view_row',True); 1145 } 1146 1147 if(($this->bo->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $GLOBALS['egw_info']['user']['account_id'])) 1148 { 1149 $extra_vars = array('cd' => 16,'query' => $this->query,'cat_id' => $this->cat_id); 1150 1151 if($referer) 1152 { 1153 $extra_vars += array('referer' => urlencode($referer)); 1154 } 1155 1156 $GLOBALS['egw']->template->set_var('edit_button',$this->html_1button_form('edit','Edit', 1157 $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.edit&ab_id=' .$ab_id),'window.open(\''.$GLOBALS['egw']->link('/index.php?menuaction=addressbook.uicontacts.edit') . '&contact_id='.$ab_id. 1158 '\',\'\',\'dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\');return false;')); 1159 } 1160 $GLOBALS['egw']->template->set_var('copy_button',$this->html_1button_form('submit','copy', 1161 $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.copy&ab_id=' . $fields[0]['id']))); 1162 1163 if($fields[0]['n_family'] && $fields[0]['n_given']) 1164 { 1165 $GLOBALS['egw']->template->set_var('vcard_button',$this->html_1button_form('VCardForm','VCard', 1166 $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$ab_id))); 1167 } 1168 else 1169 { 1170 $GLOBALS['egw']->template->set_var('vcard_button',lang('no vcard')); 1171 } 1172 1173 $GLOBALS['egw']->template->set_var('done_button',$this->html_1button_form('DoneForm','Done', 1174 $referer ? $referer : $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index'))); 1175 $GLOBALS['egw']->template->set_var('access_link',$access_link); 1176 1177 $GLOBALS['egw']->template->set_var('view_row',''); // cleanup to avoid showing categories twice 1178 $GLOBALS['egw']->template->pfp('phpgw_body','view_t'); 1179 1180 $GLOBALS['egw']->hooks->process(array( 1181 'location' => 'addressbook_view', 1182 'ab_id' => $ab_id 1183 )); 1184 } 1185 1186 function html_1button_form($name,$lang,$link,$onclick='') 1187 { 1188 $html = '<form method="POST" action="' . $link . '">' . "\n"; 1189 $html .= '<input type="submit" name="' . $name .'" value="' . lang($lang) . '" onclick="'. $onclick.'">' . "\n"; 1190 $html .= '</form>' . "\n"; 1191 return $html; 1192 } 1193 1194 function preferences() 1195 { 1196 $prefs = $_POST['prefs']; 1197 $other = $_POST['other']; 1198 $fcat_id = (int)$_POST['fcat_id']; 1199 1200 $custom = $this->fields->_read(); 1201 $customfields = array(); 1202 // while(list($x,$y) = @each($custom)) 1203 foreach($custom as $x => $y) 1204 { 1205 $customfields[$y['name']] = $y['title']; 1206 } 1207 1208 $qfields = $this->bo->stock_contact_fields + $this->extrafields + $customfields; 1209 1210 if($_POST['cancel']) 1211 { 1212 $GLOBALS['egw']->redirect_link('/preferences/index.php'); 1213 } 1214 1215 if($_POST['save'] || $_POST['apply']) 1216 { 1217 $totalerrors = 0; 1218 if(!count($prefs)) 1219 { 1220 $errors[$totalerrors++] = lang('You must select at least 1 column to display'); 1221 } 1222 if(!$totalerrors) 1223 { 1224 @reset($qfields); 1225 $this->bo->save_preferences($prefs,$other,$qfields,$fcat_id); 1226 if($_POST['save']) 1227 { 1228 $GLOBALS['egw']->redirect_link('/preferences/index.php'); 1229 } 1230 if($_POST['apply']) 1231 { 1232 $GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.preferences'); 1233 } 1234 } 1235 } 1236 1237 $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' '.lang('Preferences'); 1238 $GLOBALS['egw']->common->phpgw_header(); 1239 echo parse_navbar(); 1240 1241 if($totalerrors) 1242 { 1243 echo '<p><center>' . $GLOBALS['egw']->common->error_list($errors) . '</center>'; 1244 } 1245 1246 $GLOBALS['egw']->template->set_file(array('preferences' => 'preferences.tpl')); 1247 1248 $GLOBALS['egw']->template->set_var('action_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.preferences')); 1249 1250 $i = 0; $j = 0; 1251 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1252 1253 // while(list($col, $descr) = each($qfields)) 1254 foreach($qfields as $col => $descr) 1255 { 1256 /* echo '<br>test: $col - $i $j - ' . count($abc); */ 1257 $i++; $j++; 1258 $showcol = $this->display_name($col); 1259 if(!$showcol) { $showcol = $col; } 1260 /* yank the *'s prior to testing for a valid column description */ 1261 $coltest = ereg_replace('\*','',$showcol); 1262 if($coltest) 1263 { 1264 $GLOBALS['egw']->template->set_var($col,$showcol); 1265 if($GLOBALS['egw_info']['user']['preferences']['addressbook'][$col]) 1266 { 1267 $GLOBALS['egw']->template->set_var($col.'_checked',' checked'); 1268 } 1269 else 1270 { 1271 $GLOBALS['egw']->template->set_var($col.'_checked',''); 1272 } 1273 } 1274 } 1275 1276 if($customfields) 1277 { 1278 $custom_var = ' 1279 <tr> 1280 <td bgcolor="'.$tr_color.'" colspan="6"><font color="#000000" face="">'.lang('Custom Fields').':</font></td> 1281 </tr> 1282 '; 1283 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1284 $i = 0; 1285 foreach($customfields as $name => $title) 1286 { 1287 if(!($i % 6)) 1288 { 1289 $custom_var .= "\n <tr bgcolor='$tr_color'>\n"; 1290 } 1291 $custom_var .= ' <td><input type="checkbox" name="prefs['.htmlspecialchars($name).']"' 1292 . ($this->prefs[$name] ? ' checked' : ''). ' />' . htmlspecialchars($title) . '</td>' . "\n"; 1293 1294 if(!(++$i % 6)) 1295 { 1296 echo "</tr>\n"; 1297 } 1298 } 1299 if($i = 6 - ($i % 6)) 1300 { 1301 $custom_var .= " <td colspan=$i> </td>\n </tr>\n"; 1302 } 1303 $GLOBALS['egw']->template->set_var('custom_fields',$custom_var); 1304 } 1305 else 1306 { 1307 $GLOBALS['egw']->template->set_var('custom_fields',''); 1308 } 1309 1310 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 1311 $GLOBALS['egw']->template->set_var(tr_color,$tr_color); 1312 $GLOBALS['egw']->template->set_var('lang_showbirthday',lang('show birthday reminders on main screen')); 1313 1314 if($this->prefs['mainscreen_showbirthdays']) 1315 { 1316 $GLOBALS['egw']->template->set_var('show_birthday',' checked'); 1317 } 1318 else 1319 { 1320 $GLOBALS['egw']->template->set_var('show_birthday',''); 1321 } 1322 1323 $list = array( 1324 'none' => lang('Show all'), 1325 'yours' => lang('Only yours'), 1326 'private' => lang('Private') /*, 1327 'blank' => lang('Blank') */ 1328 ); 1329 $GLOBALS['egw']->template->set_var('lang_default_filter',lang('Default Filter')); 1330 $GLOBALS['egw']->template->set_var('filter_select',$this->formatted_list('other[default_filter]',$list,$this->prefs['default_filter'])); 1331 1332 $GLOBALS['egw']->template->set_var('lang_autosave',lang('Autosave default category')); 1333 if($this->prefs['autosave_category']) 1334 { 1335 $GLOBALS['egw']->template->set_var('autosave',' checked'); 1336 } 1337 else 1338 { 1339 $GLOBALS['egw']->template->set_var('autosave',''); 1340 } 1341 $GLOBALS['egw']->template->set_var('lang_defaultcat',lang('Default Category')); 1342 $GLOBALS['egw']->template->set_var('cat_select',$this->cat_option($this->prefs['default_category'], false, false)); 1343 $GLOBALS['egw']->template->set_var('lang_fields',lang('Fields to show in address list')); 1344 $GLOBALS['egw']->template->set_var('lang_personal',lang('Personal')); 1345 $GLOBALS['egw']->template->set_var('lang_business',lang('Business')); 1346 $GLOBALS['egw']->template->set_var('lang_home',lang('Home')); 1347 $GLOBALS['egw']->template->set_var('lang_phones',lang('Extra').' '.lang('Phone Numbers')); 1348 $GLOBALS['egw']->template->set_var('lang_other',lang('Other').' '.lang('Fields')); 1349 $GLOBALS['egw']->template->set_var('lang_otherprefs',lang('Other').' '.lang('Preferences')); 1350 $GLOBALS['egw']->template->set_var('lang_save',lang('Save')); 1351 $GLOBALS['egw']->template->set_var('lang_apply',lang('Apply')); 1352 $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); 1353 $GLOBALS['egw']->template->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']); 1354 $GLOBALS['egw']->template->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']); 1355 $GLOBALS['egw']->template->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']); 1356 $GLOBALS['egw']->template->set_var('row_off',$GLOBALS['egw_info']['theme']['row_off']); 1357 1358 $GLOBALS['egw']->template->pparse('out','preferences'); 1359 } 1360 1361 function get_form() 1362 { 1363 $entry = $_POST['entry']; 1364 $fcat_id = $_POST['fcat_id']; 1365 $referer = $entry['referer'] ? $entry['referer'] : $_GET['referer']; 1366 $referer = $referer ? $referer : $_POST['referer']; 1367 1368 $test = @unserialize(rawurldecode($entry)); 1369 if($test && ($test != $entry)) 1370 { 1371 $entry = $test; 1372 } 1373 /* _debug_array($entry); exit; */ 1374 1375 if(!$entry['bday_month'] && !$entry['bday_day'] && !$entry['bday_year']) 1376 { 1377 $fields['bday'] = ''; 1378 } 1379 else 1380 { 1381 $bday_day = $entry['bday_day']; 1382 if(strlen($bday_day) == 1) 1383 { 1384 $bday_day = '0' . $entry['bday_day']; 1385 } 1386 $fields['bday'] = $entry['bday_month'] . '/' . $bday_day . '/' . $entry['bday_year']; 1387 } 1388 1389 $fields['url'] = $entry['url'] == 'http://' ? '' : $entry['url']; 1390 1391 1392 $fields['lid'] = $entry['lid']; 1393 $fields['org_name'] = $entry['company']; 1394 $fields['org_unit'] = $entry['department']; 1395 $fields['n_given'] = $entry['firstname']; 1396 $fields['n_family'] = $entry['lastname']; 1397 $fields['n_middle'] = $entry['middle']; 1398 $fields['n_prefix'] = $entry['prefix']; 1399 $fields['n_suffix'] = $entry['suffix']; 1400 if($entry['prefix']) { $pspc = ' '; } 1401 if($entry['middle']) { $mspc = ' '; } else { $nspc = ' '; } 1402 if($entry['suffix']) { $sspc = ' '; } 1403 $fields['fn'] = $entry['prefix'].$pspc.$entry['firstname'].$nspc.$mspc.$entry['middle'].$mspc.$entry['lastname'].$sspc.$entry['suffix']; 1404 $fields['email'] = $entry['email']; 1405 $fields['email_type'] = $entry['email_type']; 1406 $fields['email_home'] = $entry['hemail']; 1407 $fields['email_home_type'] = $entry['hemail_type']; 1408 $fields['title'] = $entry['title']; 1409 $fields['tel_work'] = $entry['wphone']; 1410 $fields['tel_home'] = $entry['hphone']; 1411 $fields['tel_fax'] = $entry['fax']; 1412 $fields['tel_pager'] = $entry['pager']; 1413 $fields['tel_cell'] = $entry['mphone']; 1414 $fields['tel_msg'] = $entry['msgphone']; 1415 $fields['tel_car'] = $entry['carphone']; 1416 $fields['tel_video'] = $entry['vidphone']; 1417 $fields['tel_isdn'] = $entry['isdnphone']; 1418 $fields['adr_one_street'] = $entry['bstreet']; 1419 $fields['adr_one_locality'] = $entry['bcity']; 1420 $fields['adr_one_region'] = $entry['bstate']; 1421 $fields['adr_one_postalcode'] = $entry['bzip']; 1422 $fields['adr_one_countryname'] = $entry['bcountry']; 1423 1424 if($entry['one_dom']) 1425 { 1426 $typea .= 'dom;'; 1427 } 1428 if($entry['one_intl']) 1429 { 1430 $typea .= 'intl;'; 1431 } 1432 if($entry['one_parcel']) 1433 { 1434 $typea .= 'parcel;'; 1435 } 1436 if($entry['one_postal']) 1437 { 1438 $typea .= 'postal;'; 1439 } 1440 $fields['adr_one_type'] = substr($typea,0,-1); 1441 1442 $fields['address2'] = $entry['address2']; 1443 $fields['address3'] = $entry['address3']; 1444 1445 $fields['adr_two_street'] = $entry['hstreet']; 1446 $fields['adr_two_locality'] = $entry['hcity']; 1447 $fields['adr_two_region'] = $entry['hstate']; 1448 $fields['adr_two_postalcode'] = $entry['hzip']; 1449 $fields['adr_two_countryname'] = $entry['hcountry']; 1450 1451 if($entry['two_dom']) 1452 { 1453 $typeb .= 'dom;'; 1454 } 1455 if($entry['two_intl']) 1456 { 1457 $typeb .= 'intl;'; 1458 } 1459 if($entry['two_parcel']) 1460 { 1461 $typeb .= 'parcel;'; 1462 } 1463 if($entry['two_postal']) 1464 { 1465 $typeb .= 'postal;'; 1466 } 1467 $fields['adr_two_type'] = substr($typeb,0,-1); 1468 1469 $custom = $this->fields->_read(); 1470 foreach($custom as $name => $val) 1471 { 1472 $fields[$val['name']] = $entry[$val['name']]; 1473 } 1474 1475 $fields['ophone'] = $entry['ophone']; 1476 $fields['tz'] = $entry['timezone']; 1477 $fields['pubkey'] = $entry['pubkey']; 1478 $fields['note'] = $entry['notes']; 1479 $fields['label'] = $entry['label']; 1480 1481 if($entry['access'] == 'True') 1482 { 1483 $fields['access'] = 'private'; 1484 } 1485 else 1486 { 1487 $fields['access'] = 'public'; 1488 } 1489 1490 if(is_array($fcat_id)) 1491 { 1492 $fields['cat_id'] = count($fcat_id) > 1 ? ','.implode(',',$fcat_id).',' : (int)$fcat_id[0]; 1493 } 1494 else 1495 { 1496 $fields['cat_id'] = (int)$fcat_id; 1497 } 1498 1499 $fields['ab_id'] = $entry['ab_id']; 1500 $fields['tid'] = $entry['tid']; 1501 if(!$fields['tid']) 1502 { 1503 $fields['tid'] = 'n'; 1504 } 1505 1506 $fields['referer'] = $referer; 1507 /* _debug_array($fields);exit; */ 1508 return $fields; 1509 } /* end get_form() */ 1510 1511 /* Following used for add/edit */ 1512 function addressbook_form($format,$action,$title='',$fields='',$customfields='',$cat_id='') 1513 { 1514 $referer = $_GET['referer'] ? $_GET['referer'] : $_POST['referer']; 1515 1516 $GLOBALS['egw']->template->set_file(array('form' => 'form.tpl')); 1517 1518 if(($GLOBALS['egw_info']['server']['countrylist'] == 'user_choice' && 1519 $GLOBALS['egw_info']['user']['preferences']['common']['countrylist'] == 'use_select') || 1520 ($GLOBALS['egw_info']['server']['countrylist'] == 'force_select')) 1521 { 1522 $countrylist = True; 1523 } 1524 1525 $email = $fields['email']; 1526 $emailtype = $fields['email_type']; 1527 $hemail = $fields['email_home']; 1528 $hemailtype = $fields['email_home_type']; 1529 $firstname = $fields['n_given']; 1530 $middle = $fields['n_middle']; 1531 $prefix = $fields['n_prefix']; 1532 $suffix = $fields['n_suffix']; 1533 $lastname = $fields['n_family']; 1534 $title = $fields['title']; 1535 $wphone = $fields['tel_work']; 1536 $hphone = $fields['tel_home']; 1537 $fax = $fields['tel_fax']; 1538 $pager = $fields['tel_pager']; 1539 $mphone = $fields['tel_cell']; 1540 $ophone = $fields['ophone']; 1541 $msgphone = $fields['tel_msg']; 1542 $isdnphone = $fields['tel_isdn']; 1543 $carphone = $fields['tel_car']; 1544 $vidphone = $fields['tel_video']; 1545 $preferred = $fields['tel_prefer']; 1546 1547 $bstreet = $fields['adr_one_street']; 1548 $address2 = $fields['address2']; 1549 $address3 = $fields['address3']; 1550 $bcity = $fields['adr_one_locality']; 1551 $bstate = $fields['adr_one_region']; 1552 $bzip = $fields['adr_one_postalcode']; 1553 $bcountry = $fields['adr_one_countryname']; 1554 $one_dom = $fields['one_dom']; 1555 $one_intl = $fields['one_intl']; 1556 $one_parcel = $fields['one_parcel']; 1557 $one_postal = $fields['one_postal']; 1558 1559 $hstreet = $fields['adr_two_street']; 1560 $hcity = $fields['adr_two_locality']; 1561 $hstate = $fields['adr_two_region']; 1562 $hzip = $fields['adr_two_postalcode']; 1563 $hcountry = $fields['adr_two_countryname']; 1564 $btype = $fields['adr_two_type']; 1565 $two_dom = $fields['two_dom']; 1566 $two_intl = $fields['two_intl']; 1567 $two_parcel = $fields['two_parcel']; 1568 $two_postal = $fields['two_postal']; 1569 1570 $timezone = $fields['tz']; 1571 $bday = $fields['bday']; 1572 $notes = stripslashes($fields['note']); 1573 $label = stripslashes($fields['label']); 1574 $company = $fields['org_name']; 1575 $department = $fields['org_unit']; 1576 $url = $fields['url']; 1577 $pubkey = $fields['pubkey']; 1578 $access = $fields['access']; 1579 if(!$cat_id) 1580 { 1581 $cat_id = $fields['cat_id']; 1582 } 1583 $cats_link = $this->cat_option($cat_id,True,False,True); 1584 1585 if($access == 'private') 1586 { 1587 $access_check = ' checked'; 1588 } 1589 else 1590 { 1591 $access_check = ''; 1592 } 1593 1594 if($customfields) 1595 { 1596 // while(list($name,$value) = each($customfields)) 1597 foreach($customfields as $name => $value) 1598 { 1599 $value = str_replace('_',' ',$value); 1600 $custom .= ' 1601 <tr bgcolor="' . $GLOBALS['egw_info']['theme']['row_off'] . '"> 1602 <td> </td> 1603 <td><font color="' . $GLOBALS['egw_info']['theme']['th_text'] . '" face="" size="-1">'.$value.':</font></td> 1604 <td colspan="3"><INPUT size="30" name="entry[' . $name . ']" value="' . $fields[$name] . '"></td> 1605 </tr> 1606 '; 1607 } 1608 } 1609 1610 if($format != "view") 1611 { 1612 /* Preferred phone number radio buttons */ 1613 $pref[0] = '<font size="-2">'; 1614 $pref[1] = '(' . lang('pref') . ')</font>'; 1615 // while(list($name,$val) = each($this->bo->tel_types)) 1616 foreach($this->bo->tel_types as $name => $val) 1617 { 1618 $str[$name] = "\n".' <input type="radio" name="entry[tel_prefer]" value="'.$name.'"'; 1619 if($name == $preferred) 1620 { 1621 $str[$name] .= ' checked'; 1622 } 1623 $str[$name] .= '>'; 1624 $str[$name] = $pref[0].$str[$name].$pref[1]; 1625 $GLOBALS['egw']->template->set_var("pref_".$name,$str[$name]); 1626 } 1627 1628 if(strlen($bday) > 2) 1629 { 1630 list($month, $day, $year) = split('/', $bday); 1631 $temp_month[$month] = ' selected'; 1632 $bday_month = '<select name="entry[bday_month]">' 1633 . '<option value=""' . $temp_month[0] . '>' . '</option>' 1634 . '<option value="1"' . $temp_month[1] . '>' . lang('january') . '</option>' 1635 . '<option value="2"' . $temp_month[2] . '>' . lang('february') . '</option>' 1636 . '<option value="3"' . $temp_month[3] . '>' . lang('march') . '</option>' 1637 . '<option value="4"' . $temp_month[4] . '>' . lang('april') . '</option>' 1638 . '<option value="5"' . $temp_month[5] . '>' . lang('may') . '</option>' 1639 . '<option value="6"' . $temp_month[6] . '>' . lang('june') . '</option>' 1640 . '<option value="7"' . $temp_month[7] . '>' . lang('july') . '</option>' 1641 . '<option value="8"' . $temp_month[8] . '>' . lang('august') . '</option>' 1642 . '<option value="9"' . $temp_month[9] . '>' . lang('september') . '</option>' 1643 . '<option value="10"' . $temp_month[10] . '>' . lang('october') . '</option>' 1644 . '<option value="11"' . $temp_month[11] . '>' . lang('november') . '</option>' 1645 . '<option value="12"' . $temp_month[12] . '>' . lang('december') . '</option>' 1646 . '</select>'; 1647 $bday_day = '<input type="text" maxlength="2" name="entry[bday_day]" value="' . $day . '" size="2">'; 1648 $bday_year = '<input type="text" maxlength="4" name="entry[bday_year]" value="' . $year . '" size="4">'; 1649 } 1650 else 1651 { 1652 $bday_month = '<select name="entry[bday_month]">' 1653 . '<option value="" selected> </option>' 1654 . '<option value="1">' . lang('january') . '</option>' 1655 . '<option value="2">' . lang('february') . '</option>' 1656 . '<option value="3">' . lang('march') . '</option>' 1657 . '<option value="4">' . lang('april') . '</option>' 1658 . '<option value="5">' . lang('may') . '</option>' 1659 . '<option value="6">' . lang('june') . '</option>' 1660 . '<option value="7">' . lang('july') . '</option>' 1661 . '<option value="8">' . lang('august') . '</option>' 1662 . '<option value="9">' . lang('september') . '</option>' 1663 . '<option value="10">' . lang('october') . '</option>' 1664 . '<option value="11">' . lang('november') . '</option>' 1665 . '<option value="12">' . lang('december') . '</option>' 1666 . '</select>'; 1667 $bday_day = '<input type="text" name="entry[bday_day]" size="2" maxlength="2">'; 1668 $bday_year = '<input type="text" name="entry[bday_year]" size="4" maxlength="4">'; 1669 } 1670 1671 $time_zone = '<select name="entry[timezone]">' . "\n"; 1672 for($i = -23; $i<24; $i++) 1673 { 1674 $time_zone .= '<option value="' . $i . '"'; 1675 if($i == $timezone) 1676 { 1677 $time_zone .= ' selected'; 1678 } 1679 if($i < 1) 1680 { 1681 $time_zone .= '>' . $i . '</option>' . "\n"; 1682 } 1683 else 1684 { 1685 $time_zone .= '>+' . $i . '</option>' . "\n"; 1686 } 1687 } 1688 $time_zone .= '</select>' . "\n"; 1689 1690 $email_type = '<select name=entry[email_type]>'; 1691 // while($type = each($this->bo->email_types)) 1692 foreach($this->bo->email_types as $type => $name) 1693 { 1694 $email_type .= '<option value="' . $type . '"'; 1695 if($type == $emailtype) 1696 { 1697 $email_type .= ' selected'; 1698 } 1699 $email_type .= '>' . $name . '</option>'; 1700 } 1701 $email_type .= '</select>'; 1702 1703 // reset($this->bo->email_types); 1704 $hemail_type = '<select name=entry[hemail_type]>'; 1705 // while($type = each($this->bo->email_types)) 1706 foreach($this->bo->email_types as $type => $name) 1707 { 1708 $hemail_type .= '<option value="' . $type . '"'; 1709 if($type == $hemailtype) 1710 { 1711 $hemail_type .= ' selected'; 1712 } 1713 $hemail_type .= '>' . $name . '</option>'; 1714 } 1715 $hemail_type .= '</select>'; 1716 1717 // reset($this->bo->adr_types); 1718 // while(list($type,$val) = each($this->bo->adr_types)) 1719 foreach($this->bo->adr_types as $type => $val) 1720 { 1721 $badrtype .= "\n".'<INPUT type="checkbox" name="entry[one_'.$type.']"'; 1722 $ot = 'one_'.$type; 1723 eval(" 1724 if(\$$ot=='on') { 1725 \$badrtype .= ' value=\"on\" checked'; 1726 } 1727 "); 1728 $badrtype .= '>'.$val; 1729 } 1730 1731 // reset($this->bo->adr_types); 1732 // while(list($type,$val) = each($this->bo->adr_types)) 1733 foreach($this->bo->adr_types as $type => $val) 1734 { 1735 $hadrtype .= "\n".'<INPUT type="checkbox" name="entry[two_'.$type.']"'; 1736 $tt = 'two_'.$type; 1737 eval(" 1738 if(\$$tt=='on') { 1739 \$hadrtype .= ' value=\"on\" checked'; 1740 } 1741 "); 1742 $hadrtype .= '>'.$val; 1743 } 1744 1745 $notes = '<TEXTAREA cols="60" name="entry[notes]" rows="4">' . $notes . '</TEXTAREA>'; 1746 $label = '<TEXTAREA cols="60" name="entry[label]" rows="6">' . $label . '</TEXTAREA>'; 1747 $pubkey = '<TEXTAREA cols="60" name="entry[pubkey]" rows="6">' . $pubkey . '</TEXTAREA>'; 1748 } 1749 else 1750 { 1751 $notes = '<form><TEXTAREA cols="60" name="entry[notes]" rows="4">' 1752 . $notes . '</TEXTAREA></form>'; 1753 if($bday == '//') 1754 { 1755 $bday = ''; 1756 } 1757 } 1758 1759 if($action) 1760 { 1761 echo '<FORM action="' . $GLOBALS['egw']->link('/index.php', $action . '&referer='.urlencode($referer)).'" method="post">'; 1762 } 1763 1764 if(!ereg('^http://',$url)) 1765 { 1766 $url = 'http://' . $url; 1767 } 1768 1769 $birthday = $GLOBALS['egw']->common->dateformatorder($bday_year,$bday_month,$bday_day) 1770 . '<font face="'.$theme["font"].'" size="-2">'.lang('(e.g. 1969)').'</font>'; 1771 if($format == 'edit') 1772 { 1773 $create .= '<tr bgcolor="' . $GLOBALS['egw_info']['theme']['th_bg'] . '"><td colspan="2"><font size="-1">' . lang("Created by") . ':</font></td>' 1774 . '<td colspan="3"><font size="-1">' 1775 . $GLOBALS['egw']->common->grab_owner_name($fields["owner"]); 1776 } 1777 else 1778 { 1779 $create .= ''; 1780 } 1781 1782 $GLOBALS['egw']->template->set_var('lang_home',lang('Home')); 1783 $GLOBALS['egw']->template->set_var('lang_business',lang('Business')); 1784 $GLOBALS['egw']->template->set_var('lang_personal',lang('Personal')); 1785 1786 $GLOBALS['egw']->template->set_var('lang_lastname',lang('Last Name')); 1787 $GLOBALS['egw']->template->set_var('lastname',$lastname); 1788 $GLOBALS['egw']->template->set_var('lang_firstname',lang('First Name')); 1789 $GLOBALS['egw']->template->set_var('firstname',$firstname); 1790 $GLOBALS['egw']->template->set_var('lang_middle',lang('Middle Name')); 1791 $GLOBALS['egw']->template->set_var('middle',$middle); 1792 $GLOBALS['egw']->template->set_var('lang_prefix',lang('Prefix')); 1793 $GLOBALS['egw']->template->set_var('prefix',$prefix); 1794 $GLOBALS['egw']->template->set_var('lang_suffix',lang('Suffix')); 1795 $GLOBALS['egw']->template->set_var('suffix',$suffix); 1796 $GLOBALS['egw']->template->set_var('lang_birthday',lang('Birthday')); 1797 $GLOBALS['egw']->template->set_var('birthday',$birthday); 1798 1799 $GLOBALS['egw']->template->set_var('lang_company',lang('Company Name')); 1800 $GLOBALS['egw']->template->set_var('company',$company); 1801 $GLOBALS['egw']->template->set_var('lang_department',lang('Department')); 1802 $GLOBALS['egw']->template->set_var('department',$department); 1803 $GLOBALS['egw']->template->set_var('lang_title',lang('Title')); 1804 $GLOBALS['egw']->template->set_var('title',$title); 1805 $GLOBALS['egw']->template->set_var('lang_email',lang('Business Email')); 1806 $GLOBALS['egw']->template->set_var('email',$email); 1807 $GLOBALS['egw']->template->set_var('lang_email_type',lang('Business EMail Type')); 1808 $GLOBALS['egw']->template->set_var('email_type',$email_type); 1809 $GLOBALS['egw']->template->set_var('lang_url',lang('URL')); 1810 $GLOBALS['egw']->template->set_var('url',$url); 1811 $GLOBALS['egw']->template->set_var('lang_timezone',lang('time zone offset')); 1812 $GLOBALS['egw']->template->set_var('timezone',$time_zone); 1813 $GLOBALS['egw']->template->set_var('lang_fax',lang('Business Fax')); 1814 $GLOBALS['egw']->template->set_var('fax',$fax); 1815 $GLOBALS['egw']->template->set_var('lang_wphone',lang('Business Phone')); 1816 $GLOBALS['egw']->template->set_var('wphone',$wphone); 1817 $GLOBALS['egw']->template->set_var('lang_pager',lang('Pager')); 1818 $GLOBALS['egw']->template->set_var('pager',$pager); 1819 $GLOBALS['egw']->template->set_var('lang_mphone',lang('Cell Phone')); 1820 $GLOBALS['egw']->template->set_var('mphone',$mphone); 1821 $GLOBALS['egw']->template->set_var('lang_msgphone',lang('Message Phone')); 1822 $GLOBALS['egw']->template->set_var('msgphone',$msgphone); 1823 $GLOBALS['egw']->template->set_var('lang_isdnphone',lang('ISDN Phone')); 1824 $GLOBALS['egw']->template->set_var('isdnphone',$isdnphone); 1825 $GLOBALS['egw']->template->set_var('lang_carphone',lang('Car Phone')); 1826 $GLOBALS['egw']->template->set_var('carphone',$carphone); 1827 $GLOBALS['egw']->template->set_var('lang_vidphone',lang('Video Phone')); 1828 $GLOBALS['egw']->template->set_var('vidphone',$vidphone); 1829 1830 $GLOBALS['egw']->template->set_var('lang_ophone',lang('Other Number')); 1831 $GLOBALS['egw']->template->set_var('ophone',$ophone); 1832 $GLOBALS['egw']->template->set_var('lang_bstreet',lang('Business Street')); 1833 $GLOBALS['egw']->template->set_var('bstreet',$bstreet); 1834 $GLOBALS['egw']->template->set_var('lang_address2',lang('Address Line 2')); 1835 $GLOBALS['egw']->template->set_var('address2',$address2); 1836 $GLOBALS['egw']->template->set_var('lang_address3',lang('Address Line 3')); 1837 $GLOBALS['egw']->template->set_var('address3',$address3); 1838 $GLOBALS['egw']->template->set_var('lang_bcity',lang('Business City')); 1839 $GLOBALS['egw']->template->set_var('bcity',$bcity); 1840 $GLOBALS['egw']->template->set_var('lang_bstate',lang('Business State')); 1841 $GLOBALS['egw']->template->set_var('bstate',$bstate); 1842 $GLOBALS['egw']->template->set_var('lang_bzip',lang('Business Zip Code')); 1843 $GLOBALS['egw']->template->set_var('bzip',$bzip); 1844 $GLOBALS['egw']->template->set_var('lang_bcountry',lang('Business Country')); 1845 $GLOBALS['egw']->template->set_var('bcountry',$bcountry); 1846 if($countrylist) 1847 { 1848 $GLOBALS['egw']->template->set_var('bcountry',$GLOBALS['egw']->country->form_select($bcountry,'entry[bcountry]')); 1849 } 1850 else 1851 { 1852 $GLOBALS['egw']->template->set_var('bcountry','<input type="text" name="entry[bcountry]" value="' . $bcountry . '">'); 1853 } 1854 $GLOBALS['egw']->template->set_var('lang_badrtype',lang('Address Type')); 1855 $GLOBALS['egw']->template->set_var('badrtype',$badrtype); 1856 1857 $GLOBALS['egw']->template->set_var('lang_hphone',lang('Home Phone')); 1858 $GLOBALS['egw']->template->set_var('hphone',$hphone); 1859 $GLOBALS['egw']->template->set_var('lang_hemail',lang('Home Email')); 1860 $GLOBALS['egw']->template->set_var('hemail',$hemail); 1861 $GLOBALS['egw']->template->set_var('lang_hemail_type',lang('Home EMail Type')); 1862 $GLOBALS['egw']->template->set_var('hemail_type',$hemail_type); 1863 $GLOBALS['egw']->template->set_var('lang_hstreet',lang('Home Street')); 1864 $GLOBALS['egw']->template->set_var('hstreet',$hstreet); 1865 $GLOBALS['egw']->template->set_var('lang_hcity',lang('Home City')); 1866 $GLOBALS['egw']->template->set_var('hcity',$hcity); 1867 $GLOBALS['egw']->template->set_var('lang_hstate',lang('Home State')); 1868 $GLOBALS['egw']->template->set_var('hstate',$hstate); 1869 $GLOBALS['egw']->template->set_var('lang_hzip',lang('Home Zip Code')); 1870 $GLOBALS['egw']->template->set_var('hzip',$hzip); 1871 $GLOBALS['egw']->template->set_var('lang_hcountry',lang('Home Country')); 1872 if($countrylist) 1873 { 1874 $GLOBALS['egw']->template->set_var('hcountry',$GLOBALS['egw']->country->form_select($hcountry,'entry[hcountry]')); 1875 } 1876 else 1877 { 1878 $GLOBALS['egw']->template->set_var('hcountry','<input type="text" name="entry[hcountry]" value="' . $hcountry . '">'); 1879 } 1880 $GLOBALS['egw']->template->set_var('lang_hadrtype',lang('Address Type')); 1881 $GLOBALS['egw']->template->set_var('hadrtype',$hadrtype); 1882 1883 $GLOBALS['egw']->template->set_var('create',$create); 1884 $GLOBALS['egw']->template->set_var('lang_notes',lang('notes')); 1885 $GLOBALS['egw']->template->set_var('notes',$notes); 1886 $GLOBALS['egw']->template->set_var('lang_label',lang('label')); 1887 $GLOBALS['egw']->template->set_var('label',$label); 1888 $GLOBALS['egw']->template->set_var('lang_pubkey',lang('Public Key')); 1889 $GLOBALS['egw']->template->set_var('pubkey',$pubkey); 1890 $GLOBALS['egw']->template->set_var('access_check',$access_check); 1891 1892 $GLOBALS['egw']->template->set_var('lang_private',lang('Private')); 1893 1894 $GLOBALS['egw']->template->set_var('lang_cats',lang('Category')); 1895 $GLOBALS['egw']->template->set_var('cats_link',$cats_link); 1896 if($customfields) 1897 { 1898 $GLOBALS['egw']->template->set_var('lang_custom',lang('Custom Fields').':'); 1899 $GLOBALS['egw']->template->set_var('custom',$custom); 1900 } 1901 else 1902 { 1903 $GLOBALS['egw']->template->set_var('lang_custom',''); 1904 $GLOBALS['egw']->template->set_var('custom',''); 1905 } 1906 $GLOBALS['egw']->template->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']); 1907 $GLOBALS['egw']->template->set_var('th_text', $GLOBALS['egw_info']['theme']['th_text']); 1908 $GLOBALS['egw']->template->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']); 1909 $GLOBALS['egw']->template->set_var('row_off', $GLOBALS['egw_info']['theme']['row_off']); 1910 $GLOBALS['egw']->template->set_var('row_text',$GLOBALS['egw_info']['theme']['row_text']); 1911 1912 $GLOBALS['egw']->template->pfp('out','form'); 1913 } /* end form function */ 1914 } 1915 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |