* * -------------------------------------------- * * 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 if(!isset($owner)) { $owner = 0; } $grants = $phpgw->acl->get_grants('addressbook'); if(!isset($owner) || !$owner) { $owner = $phpgw_info['user']['account_id']; $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; } else { if($grants[$owner]) { $rights = $grants[$owner]; if (!($rights & PHPGW_ACL_READ)) { $owner = $phpgw_info['user']['account_id']; $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; } } } function cat_option($cat_id) { global $phpgw_info; // Get global and app-specific category listings $cats_link = "'; return $cats_link; } ### SET THE FONT TO DEFAULT IF IT DOESNT EXISTS ### function set_font() { if($phpgw_info["user"]["preferences"]["notes"]["notes_font"] == "") { $font = "Arial"; return $font; } else { $font = $phpgw_info["user"]["preferences"]["notes"]["notes_font"]; return $font; } } ### SET FONT SIZE #### function set_font_size() { if($phpgw_info["user"]["preferences"]["notes"]["notes_font_size"] == "") { $font_size = "3"; return $font_size; } else { $font_size = $phpgw_info["user"]["preferences"]["notes"]["notes_font_size"]; return $font_size; } } // this cleans up the fieldnames for display function display_name($column) { $abc = array( "fn" => "full name", "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" => "prefer", "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" ); while($name = each($abc) ) { if ($column == $name[0]) { return lang($name[1]); } } } function addressbook_read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order,$userid="") { global $this,$rights; $readrights = $rights & PHPGW_ACL_READ; $entries = $this->read($start,$offset,$qcols,$query,$qfilter,$sort,$order,$readrights); return $entries; } function addressbook_read_entry($id,$fields,$userid="") { global $this,$rights; if ($rights & PHPGW_ACL_READ) { $entry = $this->read_single_entry($id,$fields); return $entry; } else { $rtrn = array("No access" => "No access"); return $rtrn; } } function addressbook_read_last_entry($fields) { global $this,$rights; if ($rights & PHPGW_ACL_READ) { $entry = $this->read_last_entry($fields); return $entry; } else { $rtrn = array("No access" => "No access"); return $rtrn; } } function addressbook_add_entry($userid,$fields,$access,$cat_id) { global $this,$rights; if ($rights & PHPGW_ACL_ADD) { $this->add($userid,$fields,$access,$cat_id); } return; } function addressbook_get_lastid() { global $this; $entry = $this->read_last_entry(); $ab_id = $entry[0]["id"]; return $ab_id; } function addressbook_update_entry($id,$userid,$fields,$access,$cat_id) { global $this,$rights; if ($rights & PHPGW_ACL_EDIT) { $this->update($id,$userid,$fields,$access,$cat_id); } return; } // Folowing used for add/edit function addressbook_form($format,$action,$title="",$fields="",$customfields="") { global $phpgw, $phpgw_info; $t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t->set_file(array( "form" => "form.tpl")); $email = $fields["email"]; $emailtype = $fields["email_type"]; $hemail = $fields["email_home"]; $hemailtype = $fields["email_home_type"]; $firstname = $fields["n_given"]; $middle = $fields["n_middle"]; $prefix = $fields["n_prefix"]; $suffix = $fields["n_suffix"]; $lastname = $fields["n_family"]; $title = $fields["title"]; $wphone = $fields["tel_work"]; $hphone = $fields["tel_home"]; $fax = $fields["tel_fax"]; $pager = $fields["tel_pager"]; $mphone = $fields["tel_cell"]; $ophone = $fields["ophone"]; $msgphone = $fields["tel_msg"]; $isdnphone = $fields["tel_isdn"]; $carphone = $fields["tel_car"]; $vidphone = $fields["tel_video"]; $preferred = $fields["tel_prefer"]; $bstreet = $fields["adr_one_street"]; $address2 = $fields["address2"]; $address3 = $fields["address3"]; $bcity = $fields["adr_one_locality"]; $bstate = $fields["adr_one_region"]; $bzip = $fields["adr_one_postalcode"]; $bcountry = $fields["adr_one_countryname"]; $one_dom = $fields["one_dom"]; $one_intl = $fields["one_intl"]; $one_parcel = $fields["one_parcel"]; $one_postal = $fields["one_postal"]; $hstreet = $fields["adr_two_street"]; $hcity = $fields["adr_two_locality"]; $hstate = $fields["adr_two_region"]; $hzip = $fields["adr_two_postalcode"]; $hcountry = $fields["adr_two_countryname"]; $btype = $fields["adr_two_type"]; $two_dom = $fields["two_dom"]; $two_intl = $fields["two_intl"]; $two_parcel = $fields["two_parcel"]; $two_postal = $fields["two_postal"]; $timezone = $fields["tz"]; $bday = $fields["bday"]; $notes = stripslashes($fields["note"]); $label = stripslashes($fields["label"]); $company = $fields["org_name"]; $department = $fields["org_unit"]; $url = $fields["url"]; $pubkey = $fields["pubkey"]; $access = $fields["access"]; $cat_id = $fields["cat_id"]; $cats_link = cat_option($cat_id); if ($access == 'private') { $access_check = ' checked'; } else { $access_check = ''; } if ($customfields) { while(list($name,$value) = each($customfields)) { $custom .= '