mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 00:43:20 +01:00
converted addressbook to use new api
This commit is contained in:
parent
b86a5d469c
commit
248fde6fef
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Business object for addressbook
|
* Business object for addressbook
|
||||||
@ -126,7 +127,7 @@ class addressbook_bo extends Api\Contacts
|
|||||||
$result = self::get_pgp_keyserver($missing, $result);
|
$result = self::get_pgp_keyserver($missing, $result);
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__."(".array2string($recipients).") returning ".array2string($result));
|
//error_log(__METHOD__."(".array2string($recipients).") returning ".array2string($result));
|
||||||
egw_json_response::get()->data($result);
|
Api\Json\Response::get()->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,7 +192,7 @@ class addressbook_bo extends Api\Contacts
|
|||||||
{
|
{
|
||||||
$contact['pubkey'] = preg_replace(self::$pgp_key_regexp, $key, $contact['pubkey']);
|
$contact['pubkey'] = preg_replace(self::$pgp_key_regexp, $key, $contact['pubkey']);
|
||||||
}
|
}
|
||||||
if ($this->check_perms(EGW_ACL_EDIT, $contact) && $this->save($contact))
|
if ($this->check_perms(Acl::EDIT, $contact) && $this->save($contact))
|
||||||
{
|
{
|
||||||
++$updated;
|
++$updated;
|
||||||
}
|
}
|
||||||
@ -209,7 +210,7 @@ class addressbook_bo extends Api\Contacts
|
|||||||
$message .= "\n".lang('%1 key(s) added to public keyserver "%2".',
|
$message .= "\n".lang('%1 key(s) added to public keyserver "%2".',
|
||||||
self::set_pgp_keyserver($keys), PARSE_URL(self::KEYSERVER_ADD, PHP_URL_HOST));
|
self::set_pgp_keyserver($keys), PARSE_URL(self::KEYSERVER_ADD, PHP_URL_HOST));
|
||||||
|
|
||||||
egw_json_response::get()->data($message);
|
Api\Json\Response::get()->data($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Link;
|
||||||
|
use EGroupware\Api\Vfs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiteMgr contact form for the addressbook
|
* SiteMgr contact form for the addressbook
|
||||||
@ -92,9 +94,9 @@ class addressbook_contactform
|
|||||||
// the anonymous user to have run rights for addressbook AND
|
// the anonymous user to have run rights for addressbook AND
|
||||||
// edit rights for the addressbook used to store the new entry,
|
// edit rights for the addressbook used to store the new entry,
|
||||||
// which is clearly not wanted securitywise
|
// which is clearly not wanted securitywise
|
||||||
Api\Vfs::$is_root = true;
|
Vfs::$is_root = true;
|
||||||
egw_link::link('addressbook',$id,egw_link::VFS_APPNAME,$value,$name);
|
Link::link('addressbook',$id,Link::VFS_APPNAME,$value,$name);
|
||||||
Api\Vfs::$is_root = false;
|
Vfs::$is_root = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,26 +10,15 @@
|
|||||||
* @version $Id: class.addressbook_display.inc.php 24099 2008-02-18 16:29:06Z stefanbecker $
|
* @version $Id: class.addressbook_display.inc.php 24099 2008-02-18 16:29:06Z stefanbecker $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiteMgr Display form for the addressbook
|
* SiteMgr Display form for the addressbook
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class addressbook_display extends addressbook_ui
|
class addressbook_display extends addressbook_ui
|
||||||
{
|
{
|
||||||
/**
|
function get_rows(&$query,&$rows,&$readonlys)
|
||||||
* Shows the Addressbook Entry and stores the submitted data
|
|
||||||
*
|
|
||||||
* @param array $content=null submitted eTemplate content
|
|
||||||
* @param int $addressbook=null int owner-id of addressbook to save contacts too
|
|
||||||
* @param array $fields=null field-names to show
|
|
||||||
* @param string $msg=null message to show after submitting the form
|
|
||||||
* @param string $email=null comma-separated email addresses
|
|
||||||
* @param string $tpl_name=null custom etemplate to use
|
|
||||||
* @param string $subject=null subject for email
|
|
||||||
* @return string html content
|
|
||||||
*/
|
|
||||||
//
|
|
||||||
function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
|
|
||||||
{
|
{
|
||||||
$query['sitemgr_display'] = ($readonlys['sitemgr_display'] ?$readonlys['sitemgr_display']:'addressbook.display');
|
$query['sitemgr_display'] = ($readonlys['sitemgr_display'] ?$readonlys['sitemgr_display']:'addressbook.display');
|
||||||
$total = parent::get_rows($query,$rows,$readonlys);
|
$total = parent::get_rows($query,$rows,$readonlys);
|
||||||
@ -44,6 +33,18 @@ function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the Addressbook Entry and stores the submitted data
|
||||||
|
*
|
||||||
|
* @param array $content =null submitted eTemplate content
|
||||||
|
* @param int $addressbook =null int owner-id of addressbook to save contacts too
|
||||||
|
* @param array $fields =null field-names to show
|
||||||
|
* @param string $msg =null message to show after submitting the form
|
||||||
|
* @param string $email =null comma-separated email addresses
|
||||||
|
* @param string $tpl_name =null custom etemplate to use
|
||||||
|
* @param string $subject =null subject for email
|
||||||
|
* @return string html content
|
||||||
|
*/
|
||||||
function display($content=null,$addressbook=null,$fields=null,$msg=null,$email=null,$tpl_name=null,$subject=null)
|
function display($content=null,$addressbook=null,$fields=null,$msg=null,$email=null,$tpl_name=null,$subject=null)
|
||||||
{
|
{
|
||||||
$tpl_name=($tpl_name ? $tpl_name : 'addressbook.display');
|
$tpl_name=($tpl_name ? $tpl_name : 'addressbook.display');
|
||||||
@ -52,7 +53,7 @@ function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
|
|||||||
$content = array(
|
$content = array(
|
||||||
'msg' => $msg ? $msg : $_GET['msg'],
|
'msg' => $msg ? $msg : $_GET['msg'],
|
||||||
);
|
);
|
||||||
$content['nm1'] = $GLOBALS['egw']->session->appsession(($tpl_name ? $tpl_name : 'index'),'addressbook');
|
$content['nm1'] = Api\Cache::getSession('addressbook', ($tpl_name ? $tpl_name : 'index'));
|
||||||
$readonlys['sitemgr_display']=$tpl_name;
|
$readonlys['sitemgr_display']=$tpl_name;
|
||||||
if (!is_array($content['nm1']))
|
if (!is_array($content['nm1']))
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class addressbook_egw_record
|
* class addressbook_egw_record
|
||||||
* compability layer for iface_egw_record needed for importexport
|
* compability layer for iface_egw_record needed for importexport
|
||||||
@ -44,7 +47,7 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
|||||||
*/
|
*/
|
||||||
public function __construct( $_identifier='' ){
|
public function __construct( $_identifier='' ){
|
||||||
$this->identifier = $_identifier;
|
$this->identifier = $_identifier;
|
||||||
$this->bocontacts = new addressbook_bo();
|
$this->bocontacts = new Api\Contacts();
|
||||||
if($_identifier) {
|
if($_identifier) {
|
||||||
$this->contact = $this->bocontacts->read($this->identifier);
|
$this->contact = $this->bocontacts->read($this->identifier);
|
||||||
}
|
}
|
||||||
@ -123,7 +126,7 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
|||||||
$ui->type_icon($this->owner, $this->private, $this->tid, $icon, $label);
|
$ui->type_icon($this->owner, $this->private, $this->tid, $icon, $label);
|
||||||
|
|
||||||
// Specific photo
|
// Specific photo
|
||||||
return $this->jpegphoto ? egw_framework::link('/index.php',$ui->photo_src($this->identifier,$this->jpegphoto)):$icon;
|
return $this->jpegphoto ? Framework::link('/index.php',$ui->photo_src($this->identifier,$this->jpegphoto)):$icon;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* saves record into backend
|
* saves record into backend
|
||||||
@ -171,5 +174,4 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
|||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
unset ($this->bocontacts);
|
unset ($this->bocontacts);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // end of egw_addressbook_record
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* eGroupWare
|
* EGroupware - addressbook
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
@ -11,12 +11,14 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* export plugin of addressbook
|
* export plugin of addressbook
|
||||||
*/
|
*/
|
||||||
class addressbook_export_contacts_csv implements importexport_iface_export_plugin {
|
class addressbook_export_contacts_csv implements importexport_iface_export_plugin
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants used for exploding categories & multi-selectboxes into seperate fields
|
* Constants used for exploding categories & multi-selectboxes into seperate fields
|
||||||
*/
|
*/
|
||||||
@ -44,8 +46,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
$selection = array();
|
$selection = array();
|
||||||
|
|
||||||
// Addressbook defines its own export imits
|
// Addressbook defines its own export imits
|
||||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
|
||||||
$export_limit = bo_merge::getExportLimit($app='addressbook');
|
$export_limit = Api\Storage\Merge::getExportLimit($app='addressbook');
|
||||||
if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all
|
if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all
|
||||||
if($export_limit == 'no' && !$limit_exception) {
|
if($export_limit == 'no' && !$limit_exception) {
|
||||||
return;
|
return;
|
||||||
@ -57,11 +59,12 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
|
|
||||||
if ($options['selection'] == 'search') {
|
if ($options['selection'] == 'search') {
|
||||||
// uicontacts selection with checkbox 'use_all'
|
// uicontacts selection with checkbox 'use_all'
|
||||||
$query = $GLOBALS['egw']->session->appsession('index','addressbook');
|
$query = Api\Cache::getSession('addressbook', 'index');
|
||||||
$query['num_rows'] = -1; // all
|
$query['num_rows'] = -1; // all
|
||||||
$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
||||||
$query['order'] = 'contact_id';
|
$query['order'] = 'contact_id';
|
||||||
if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id'];
|
if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
$readonlys = null;
|
||||||
$this->ui->get_rows($query,$selection,$readonlys, true); // only return the ids
|
$this->ui->get_rows($query,$selection,$readonlys, true); // only return the ids
|
||||||
}
|
}
|
||||||
elseif ( $options['selection'] == 'all' ) {
|
elseif ( $options['selection'] == 'all' ) {
|
||||||
@ -73,9 +76,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
}
|
}
|
||||||
elseif ($options['selection'] == 'filter')
|
elseif ($options['selection'] == 'filter')
|
||||||
{
|
{
|
||||||
$fields = importexport_helper_functions::get_filter_fields($_definition->application, $this);
|
|
||||||
$filter = $_definition->filter;
|
$filter = $_definition->filter;
|
||||||
$known_fields = $this->ui->get_fields('supported');
|
|
||||||
$query = array();
|
$query = array();
|
||||||
|
|
||||||
// Handle ranges
|
// Handle ranges
|
||||||
@ -125,14 +126,14 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
}
|
}
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
|
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
|
||||||
|
|
||||||
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
|
if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
|
||||||
$selection = array_slice($selection, 0, $export_limit);
|
$selection = array_slice($selection, 0, $export_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($options['explode_multiselects']) {
|
if($options['explode_multiselects']) {
|
||||||
$customfields = config::get_customfields('addressbook');
|
$customfields = Api\Storage\Customfields::get('addressbook');
|
||||||
$additional_fields = array();
|
$additional_fields = array();
|
||||||
$cat_obj = new categories('', 'addressbook');
|
$cat_obj = new Api\Categories('', 'addressbook');
|
||||||
foreach($options['explode_multiselects'] as $field => $explode) {
|
foreach($options['explode_multiselects'] as $field => $explode) {
|
||||||
switch($explode['explode']) {
|
switch($explode['explode']) {
|
||||||
case self::MAIN_CATS:
|
case self::MAIN_CATS:
|
||||||
@ -439,7 +440,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'rows' => 5,
|
'rows' => 5,
|
||||||
'tags' => true,
|
'tags' => true,
|
||||||
'values' => $this->ui->get_addressbooks(EGW_ACL_READ)
|
'values' => $this->ui->get_addressbooks(Acl::READ)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* vCard export plugin for importexport framework
|
* EGroupware addressbook: vCard export plugin for importexport framework
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
@ -11,6 +11,8 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* export addressbook contacts as vcard
|
* export addressbook contacts as vcard
|
||||||
*/
|
*/
|
||||||
@ -29,9 +31,8 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
|||||||
$this->selection = array();
|
$this->selection = array();
|
||||||
|
|
||||||
// Addressbook defines its own export imits
|
// Addressbook defines its own export imits
|
||||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
|
||||||
$export_limit = bo_merge::getExportLimit($app='addressbook');
|
$export_limit = Api\Storage\Merge::getExportLimit($app='addressbook');
|
||||||
if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all
|
|
||||||
if($export_limit == 'no' && !$limit_exception) {
|
if($export_limit == 'no' && !$limit_exception) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -42,10 +43,11 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
|||||||
|
|
||||||
if ($options['selection'] == 'search') {
|
if ($options['selection'] == 'search') {
|
||||||
// uicontacts selection with checkbox 'use_all'
|
// uicontacts selection with checkbox 'use_all'
|
||||||
$query = $GLOBALS['egw']->session->appsession('index','addressbook');
|
$query = Api\Cache::getSession('addressbook', 'index');
|
||||||
$query['num_rows'] = -1; // all
|
$query['num_rows'] = -1; // all
|
||||||
$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
||||||
if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id'];
|
if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
$readonlys = null;
|
||||||
$this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids
|
$this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids
|
||||||
}
|
}
|
||||||
elseif ( $options['selection'] == 'all' ) {
|
elseif ( $options['selection'] == 'all' ) {
|
||||||
@ -59,7 +61,7 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
|||||||
}
|
}
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
|
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
|
||||||
|
|
||||||
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
|
if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
|
||||||
$this->selection = array_slice($this->selection, 0, $export_limit);
|
$this->selection = array_slice($this->selection, 0, $export_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CalDAV/CardDAV/GroupDAV access: Addressbook handler
|
* CalDAV/CardDAV/GroupDAV access: Addressbook handler
|
||||||
@ -237,7 +238,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
unset($requested_multiget_ids[$k]);
|
unset($requested_multiget_ids[$k]);
|
||||||
}
|
}
|
||||||
// sync-collection report: deleted entry need to be reported without properties
|
// sync-collection report: deleted entry need to be reported without properties
|
||||||
if ($contact['tid'] == addressbook_bo::DELETED_TYPE)
|
if ($contact['tid'] == Api\Contacts::DELETED_TYPE)
|
||||||
{
|
{
|
||||||
$files[] = array('path' => $path.urldecode($this->get_path($contact)));
|
$files[] = array('path' => $path.urldecode($this->get_path($contact)));
|
||||||
continue;
|
continue;
|
||||||
@ -311,7 +312,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
}
|
}
|
||||||
$props = array(
|
$props = array(
|
||||||
'getcontenttype' => Api\CalDAV::mkprop('getcontenttype', 'text/vcard'),
|
'getcontenttype' => Api\CalDAV::mkprop('getcontenttype', 'text/vcard'),
|
||||||
'getlastmodified' => egw_time::to($list['list_modified'],'ts'),
|
'getlastmodified' => Api\DateTime::to($list['list_modified'],'ts'),
|
||||||
'displayname' => $list['list_name'],
|
'displayname' => $list['list_name'],
|
||||||
'getetag' => '"'.$etag.'"',
|
'getetag' => '"'.$etag.'"',
|
||||||
);
|
);
|
||||||
@ -415,7 +416,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
{
|
{
|
||||||
case 'i;unicode-casemap':
|
case 'i;unicode-casemap':
|
||||||
default:
|
default:
|
||||||
$comp = ' '.$GLOBALS['egw']->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' ';
|
$comp = ' '.$GLOBALS['egw']->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$column = $this->filter_prop2cal[strtoupper($prop_filter)];
|
$column = $this->filter_prop2cal[strtoupper($prop_filter)];
|
||||||
@ -618,7 +619,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
$is_group = $contact['##X-ADDRESSBOOKSERVER-KIND'] == 'group';
|
$is_group = $contact['##X-ADDRESSBOOKSERVER-KIND'] == 'group';
|
||||||
if ($oldContact && $is_group !== isset($oldContact['list_id']))
|
if ($oldContact && $is_group !== isset($oldContact['list_id']))
|
||||||
{
|
{
|
||||||
throw new egw_exception_assertion_failed(__METHOD__."(,'$id',$user,'$prefix') can contact into group or visa-versa!");
|
throw new Api\Exception\AssertionFailed(__METHOD__."(,'$id',$user,'$prefix') can contact into group or visa-versa!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$is_group && is_array($contact['cat_id']))
|
if (!$is_group && is_array($contact['cat_id']))
|
||||||
@ -651,7 +652,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
{
|
{
|
||||||
$contact['owner'] = $user;
|
$contact['owner'] = $user;
|
||||||
}
|
}
|
||||||
// check if default addressbook is synced and not accounts, if not use (always synced) personal addressbook
|
// check if default addressbook is synced and not Api\Accounts, if not use (always synced) personal addressbook
|
||||||
elseif(!$this->bo->default_addressbook || !in_array($this->bo->default_addressbook,$this->home_set_pref))
|
elseif(!$this->bo->default_addressbook || !in_array($this->bo->default_addressbook,$this->home_set_pref))
|
||||||
{
|
{
|
||||||
$contact['owner'] = $GLOBALS['egw_info']['user']['account_id'];
|
$contact['owner'] = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
@ -663,7 +664,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
}
|
}
|
||||||
// check if user has add rights for addressbook
|
// check if user has add rights for addressbook
|
||||||
// done here again, as _common_get_put_delete knows nothing about default addressbooks...
|
// done here again, as _common_get_put_delete knows nothing about default addressbooks...
|
||||||
if (!($this->bo->grants[$contact['owner']] & EGW_ACL_ADD))
|
if (!($this->bo->grants[$contact['owner']] & Acl::ADD))
|
||||||
{
|
{
|
||||||
if ($this->debug) error_log(__METHOD__."(,'$id', $user, '$prefix') returning '403 Forbidden'");
|
if ($this->debug) error_log(__METHOD__."(,'$id', $user, '$prefix') returning '403 Forbidden'");
|
||||||
return '403 Forbidden';
|
return '403 Forbidden';
|
||||||
@ -689,7 +690,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
{
|
{
|
||||||
if (($contact = $this->bo->read_list($save_ok)))
|
if (($contact = $this->bo->read_list($save_ok)))
|
||||||
{
|
{
|
||||||
$contact = egw_db::strip_array_keys($contact, 'list_');
|
$contact = Api\Db::strip_array_keys($contact, 'list_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -835,7 +836,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
* </D:supported-report-set>
|
* </D:supported-report-set>
|
||||||
* @link http://www.mail-archive.com/calendarserver-users@lists.macosforge.org/msg01156.html
|
* @link http://www.mail-archive.com/calendarserver-users@lists.macosforge.org/msg01156.html
|
||||||
*
|
*
|
||||||
* @param array $props =array() regular props by the groupdav handler
|
* @param array $props =array() regular props by the Api\CalDAV handler
|
||||||
* @param string $displayname
|
* @param string $displayname
|
||||||
* @param string $base_uri =null base url of handler
|
* @param string $base_uri =null base url of handler
|
||||||
* @param int $user =null account_id of owner of collection
|
* @param int $user =null account_id of owner of collection
|
||||||
@ -1021,7 +1022,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
/**
|
/**
|
||||||
* Check if user has the neccessary rights on a contact
|
* Check if user has the neccessary rights on a contact
|
||||||
*
|
*
|
||||||
* @param int $acl EGW_ACL_READ, EGW_ACL_EDIT or EGW_ACL_DELETE
|
* @param int $acl Acl::READ, Acl::EDIT or Acl::DELETE
|
||||||
* @param array|int $contact contact-array or id
|
* @param array|int $contact contact-array or id
|
||||||
* @return boolean null if entry does not exist, false if no access, true if access permitted
|
* @return boolean null if entry does not exist, false if no access, true if access permitted
|
||||||
*/
|
*/
|
||||||
@ -1073,7 +1074,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
$this->home_set_pref[$key] = $id;
|
$this->home_set_pref[$key] = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach(array_keys($this->bo->get_addressbooks(EGW_ACL_READ)) as $id)
|
foreach(array_keys($this->bo->get_addressbooks(Acl::READ)) as $id)
|
||||||
{
|
{
|
||||||
if (($id || !$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) &&
|
if (($id || !$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) &&
|
||||||
$GLOBALS['egw_info']['user']['account_id'] != $id && // no current user and no accounts, if disabled in ab prefs
|
$GLOBALS['egw_info']['user']['account_id'] != $id && // no current user and no accounts, if disabled in ab prefs
|
||||||
@ -1125,8 +1126,8 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
|||||||
if (!isset($hook_data['setup']) && in_array($hook_data['type'], array('user', 'group')))
|
if (!isset($hook_data['setup']) && in_array($hook_data['type'], array('user', 'group')))
|
||||||
{
|
{
|
||||||
$user = $hook_data['account_id'];
|
$user = $hook_data['account_id'];
|
||||||
$addressbook_bo = new addressbook_bo();
|
$addressbook_bo = new Api\Contacts();
|
||||||
$addressbooks += $addressbook_bo->get_addressbooks(EGW_ACL_READ, null, $user);
|
$addressbooks += $addressbook_bo->get_addressbooks(Acl::READ, null, $user);
|
||||||
if ($user > 0) unset($addressbooks[$user]); // allways synced
|
if ($user > 0) unset($addressbooks[$user]); // allways synced
|
||||||
unset($addressbooks[$user.'p']);// ignore (optional) private addressbook for now
|
unset($addressbooks[$user.'p']);// ignore (optional) private addressbook for now
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Addressbook - admin, preferences and sidebox-menus and other hooks
|
* EGroupware Addressbook - admin, preferences and sidebox-menus and other hooks
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
@ -11,6 +11,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Link;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
use EGroupware\Api\Egw;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class containing admin, preferences and sidebox-menus and other hooks
|
* Class containing admin, preferences and sidebox-menus and other hooks
|
||||||
@ -43,21 +47,21 @@ class addressbook_hooks
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
// Magic etemplate2 favorites menu (from nextmatch widget)
|
// Magic etemplate2 favorites menu (from nextmatch widget)
|
||||||
display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list('addressbook'));
|
display_sidebox($appname, lang('Favorites'), Framework\Favorites::list_favorites('addressbook'));
|
||||||
|
|
||||||
$file = array(
|
$file = array(
|
||||||
'Addressbook list' => egw::link('/index.php',array(
|
'Addressbook list' => Egw::link('/index.php',array(
|
||||||
'menuaction' => 'addressbook.addressbook_ui.index',
|
'menuaction' => 'addressbook.addressbook_ui.index',
|
||||||
'ajax' => 'true')),
|
'ajax' => 'true')),
|
||||||
array(
|
array(
|
||||||
'text' => lang('Add %1',lang(egw_link::get_registry($appname, 'entry'))),
|
'text' => lang('Add %1',lang(Link::get_registry($appname, 'entry'))),
|
||||||
'no_lang' => true,
|
'no_lang' => true,
|
||||||
'link' => "javascript:egw.open('','$appname','add')"
|
'link' => "javascript:egw.open('','$appname','add')"
|
||||||
),
|
),
|
||||||
'Advanced search' => "javascript:egw_openWindowCentered2('".
|
'Advanced search' => "javascript:egw_openWindowCentered2('".
|
||||||
egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.search'),false).
|
Egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.search'),false).
|
||||||
"','_blank',870,480,'yes')",
|
"','_blank',870,480,'yes')",
|
||||||
'Placeholders' => egw::link('/index.php','menuaction=api.EGroupware\\Api\\Contacts\\Merge.show_replacements')
|
'Placeholders' => Egw::link('/index.php','menuaction=api.EGroupware\\Api\\Contacts\\Merge.show_replacements')
|
||||||
);
|
);
|
||||||
display_sidebox($appname,lang('Addressbook menu'),$file);
|
display_sidebox($appname,lang('Addressbook menu'),$file);
|
||||||
}
|
}
|
||||||
@ -65,11 +69,11 @@ class addressbook_hooks
|
|||||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
||||||
{
|
{
|
||||||
$file = Array(
|
$file = Array(
|
||||||
'Site configuration' => egw::link('/index.php',array(
|
'Site configuration' => Egw::link('/index.php',array(
|
||||||
'menuaction' => 'admin.uiconfig.index',
|
'menuaction' => 'admin.uiconfig.index',
|
||||||
'appname' => $appname,
|
'appname' => $appname,
|
||||||
)),
|
)),
|
||||||
'Global Categories' => egw::link('/index.php',array(
|
'Global Categories' => Egw::link('/index.php',array(
|
||||||
'menuaction' => 'admin.admin_categories.index',
|
'menuaction' => 'admin.admin_categories.index',
|
||||||
'appname' => $appname,
|
'appname' => $appname,
|
||||||
'global_cats'=> True,
|
'global_cats'=> True,
|
||||||
@ -78,7 +82,7 @@ class addressbook_hooks
|
|||||||
// custom fields are not availible in LDAP
|
// custom fields are not availible in LDAP
|
||||||
if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
|
if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
|
||||||
{
|
{
|
||||||
$file['Custom fields'] = egw::link('/index.php',array(
|
$file['Custom fields'] = Egw::link('/index.php',array(
|
||||||
'menuaction' => 'admin.customfields.index',
|
'menuaction' => 'admin.customfields.index',
|
||||||
'appname' => $appname,
|
'appname' => $appname,
|
||||||
'use_private'=> 1,
|
'use_private'=> 1,
|
||||||
@ -97,7 +101,7 @@ class addressbook_hooks
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populates $settings for the preferences
|
* populates $settings for the Api\Preferences
|
||||||
*
|
*
|
||||||
* @param array|string $hook_data
|
* @param array|string $hook_data
|
||||||
* @return array
|
* @return array
|
||||||
@ -118,7 +122,7 @@ class addressbook_hooks
|
|||||||
'label' => 'Default addressbook for adding contacts',
|
'label' => 'Default addressbook for adding contacts',
|
||||||
'name' => 'add_default',
|
'name' => 'add_default',
|
||||||
'help' => 'Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.',
|
'help' => 'Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.',
|
||||||
'values' => !$hook_data['setup'] ? ExecMethod('addressbook.addressbook_ui.get_addressbooks',EGW_ACL_ADD) : array(),
|
'values' => !$hook_data['setup'] ? ExecMethod('addressbook.addressbook_ui.get_addressbooks',Acl::ADD) : array(),
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
);
|
);
|
||||||
@ -159,7 +163,7 @@ class addressbook_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Add a customfield to link title',
|
'label' => 'Add a customfield to link title',
|
||||||
'name' => 'link_title_cf',
|
'name' => 'link_title_cf',
|
||||||
'values' => addressbook_bo::cf_options(),
|
'values' => Api\Contacts::cf_options(),
|
||||||
'help' => 'Add customfield to links of addressbook, which displays in other applications. The default value is none customfield.',
|
'help' => 'Add customfield to links of addressbook, which displays in other applications. The default value is none customfield.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -223,7 +227,7 @@ class addressbook_hooks
|
|||||||
'name' => 'default_document',
|
'name' => 'default_document',
|
||||||
'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('addressbook')).' '.
|
'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('addressbook')).' '.
|
||||||
lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','n_fn').' '.
|
lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','n_fn').' '.
|
||||||
lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()),
|
lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()),
|
||||||
'run_lang' => false,
|
'run_lang' => false,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
@ -235,7 +239,7 @@ class addressbook_hooks
|
|||||||
'name' => 'document_dir',
|
'name' => 'document_dir',
|
||||||
'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('addressbook')).' '.
|
'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('addressbook')).' '.
|
||||||
lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','n_fn').' '.
|
lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','n_fn').' '.
|
||||||
lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()),
|
lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()),
|
||||||
'run_lang' => false,
|
'run_lang' => false,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
@ -301,7 +305,7 @@ class addressbook_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Charset for the vCard import and export',
|
'label' => 'Charset for the vCard import and export',
|
||||||
'name' => 'vcard_charset',
|
'name' => 'vcard_charset',
|
||||||
'values' => translation::get_installed_charsets(),
|
'values' => Api\Translation::get_installed_charsets(),
|
||||||
'help' => 'Which charset should be used for the vCard import and export.',
|
'help' => 'Which charset should be used for the vCard import and export.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -425,18 +429,18 @@ class addressbook_hooks
|
|||||||
/**
|
/**
|
||||||
* ACL rights and labels used
|
* ACL rights and labels used
|
||||||
*
|
*
|
||||||
* @param string|array string with location or array with parameters incl. "location", specially "owner" for selected acl owner
|
* @param string|array string with location or array with parameters incl. "location", specially "owner" for selected Acl owner
|
||||||
* @return array acl::(READ|ADD|EDIT|DELETE|PRIVAT|CUSTOM(1|2|3)) => $label pairs
|
* @return array Acl::(READ|ADD|EDIT|DELETE|PRIVAT|CUSTOM(1|2|3)) => $label pairs
|
||||||
*/
|
*/
|
||||||
public static function acl_rights($params)
|
public static function acl_rights($params)
|
||||||
{
|
{
|
||||||
unset($params); // not used, but required by function signature
|
unset($params); // not used, but required by function signature
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
acl::READ => 'read',
|
Acl::READ => 'read',
|
||||||
acl::EDIT => 'edit',
|
Acl::EDIT => 'edit',
|
||||||
acl::ADD => 'add',
|
Acl::ADD => 'add',
|
||||||
acl::DELETE => 'delete',
|
Acl::DELETE => 'delete',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
$this->errors[$import_csv->get_current_position()] = lang(
|
$this->errors[$import_csv->get_current_position()] = lang(
|
||||||
'Unable to convert "%1" to account ID. Using plugin setting (%2) for owner.',
|
'Unable to convert "%1" to account ID. Using plugin setting (%2) for owner.',
|
||||||
$record->owner,
|
$record->owner,
|
||||||
common::grab_owner_name($this->user)
|
Api\Accounts::username($this->user)
|
||||||
);
|
);
|
||||||
$record->owner = $this->user;
|
$record->owner = $this->user;
|
||||||
} else {
|
} else {
|
||||||
@ -113,8 +113,8 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
if(!array_key_exists($record->owner, $this->bocontacts->get_addressbooks()))
|
if(!array_key_exists($record->owner, $this->bocontacts->get_addressbooks()))
|
||||||
{
|
{
|
||||||
$this->errors[$import_csv->get_current_position()] = lang("Unable to import into %1, using %2",
|
$this->errors[$import_csv->get_current_position()] = lang("Unable to import into %1, using %2",
|
||||||
common::grab_owner_name($record->owner),
|
Api\Accounts::username($record->owner),
|
||||||
common::grab_owner_name($this->user)
|
Api\Accounts::username($this->user)
|
||||||
);
|
);
|
||||||
$record->owner = $this->user;
|
$record->owner = $this->user;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
// Format birthday as backend requires - converter should give timestamp
|
// Format birthday as backend requires - converter should give timestamp
|
||||||
if($record->bday && is_numeric($record->bday))
|
if($record->bday && is_numeric($record->bday))
|
||||||
{
|
{
|
||||||
$time = new egw_time($record->bday);
|
$time = new Api\DateTime($record->bday);
|
||||||
$record->bday = $time->format('Y-m-d');
|
$record->bday = $time->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new egw_exception('Unsupported action: '. $_action);
|
throw new Api\Exception('Unsupported action: '. $_action);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,4 +415,4 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
public function get_results() {
|
public function get_results() {
|
||||||
return $this->results;
|
return $this->results;
|
||||||
}
|
}
|
||||||
} // end of iface_export_plugin
|
}
|
||||||
|
@ -157,6 +157,7 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
*/
|
*/
|
||||||
public function _vcard($_vcard, $owner)
|
public function _vcard($_vcard, $owner)
|
||||||
{
|
{
|
||||||
|
// ToDo: Nathan: $_definition is not defined
|
||||||
$charset = $_definition->plugin_options['charset'];
|
$charset = $_definition->plugin_options['charset'];
|
||||||
if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'];
|
if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'];
|
||||||
$record = $this->bocontacts->vcardtoegw($_vcard,$charset);
|
$record = $this->bocontacts->vcardtoegw($_vcard,$charset);
|
||||||
@ -202,8 +203,12 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
// Only update if there are changes
|
// Only update if there are changes
|
||||||
$old = $this->bocontacts->read($_data['id']);
|
$old = $this->bocontacts->read($_data['id']);
|
||||||
// if we get countrycodes as countryname, try to translate them -> the rest should be handled by bo classes.
|
// if we get countrycodes as countryname, try to translate them -> the rest should be handled by bo classes.
|
||||||
foreach(array('adr_one_', 'adr_two_') as $c_prefix) {
|
foreach(array('adr_one_', 'adr_two_') as $c_prefix)
|
||||||
if (strlen(trim($_data[$c_prefix.'countryname']))==2) $_data[$c_prefix.'countryname'] = $GLOBALS['egw']->country->get_full_name(trim($_data[$c_prefix.'countryname']),$translated=true);
|
{
|
||||||
|
if (strlen(trim($_data[$c_prefix.'countryname']))==2)
|
||||||
|
{
|
||||||
|
$_data[$c_prefix.'countryname'] = Api\Country::get_full_name(trim($_data[$c_prefix.'countryname']), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Don't change a user account into a contact
|
// Don't change a user account into a contact
|
||||||
if($old['owner'] == 0) {
|
if($old['owner'] == 0) {
|
||||||
@ -270,13 +275,13 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
|
|
||||||
$record_class = get_class($this->preview_records[0]);
|
$record_class = get_class($this->preview_records[0]);
|
||||||
|
|
||||||
foreach($this->preview_records as $i => $record)
|
foreach($this->preview_records as $record)
|
||||||
{
|
{
|
||||||
// Convert to human-friendly
|
// Convert to human-friendly
|
||||||
importexport_export_csv::convert($record,$record_class::$types,$_definition->application);
|
importexport_export_csv::convert($record,$record_class::$types,$_definition->application);
|
||||||
$record = $record->get_record_array();
|
$record = $record->get_record_array();
|
||||||
$row = array();
|
$row = array();
|
||||||
foreach($labels as $field => $label)
|
foreach(array_keys($labels) as $field)
|
||||||
{
|
{
|
||||||
$row[$field] = $record[$field];
|
$row[$field] = $record[$field];
|
||||||
|
|
||||||
@ -380,4 +385,4 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
public function get_results() {
|
public function get_results() {
|
||||||
return $this->results;
|
return $this->results;
|
||||||
}
|
}
|
||||||
} // end of iface_export_plugin
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -13,11 +13,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addressbook - vCard parser
|
* Addressbook - vCard parser
|
||||||
*/
|
*/
|
||||||
class addressbook_vcal extends addressbook_bo
|
class addressbook_vcal extends Api\Contacts
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* product manufacturer from setSupportedFields (lowercase!)
|
* product manufacturer from setSupportedFields (lowercase!)
|
||||||
@ -32,11 +33,11 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
*/
|
*/
|
||||||
var $productName;
|
var $productName;
|
||||||
/**
|
/**
|
||||||
* supported fields for vCard file and groupdav import/export
|
* supported fields for vCard file and CardDAV import/export
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $databaseFields = array( // all entries e.g. for groupdav
|
var $databaseFields = array( // all entries e.g. for CardDAV
|
||||||
'ADR;WORK' => array('','adr_one_street2','adr_one_street','adr_one_locality','adr_one_region',
|
'ADR;WORK' => array('','adr_one_street2','adr_one_street','adr_one_locality','adr_one_region',
|
||||||
'adr_one_postalcode','adr_one_countryname'),
|
'adr_one_postalcode','adr_one_countryname'),
|
||||||
'ADR;HOME' => array('','adr_two_street2','adr_two_street','adr_two_locality','adr_two_region',
|
'ADR;HOME' => array('','adr_two_street2','adr_two_street','adr_two_locality','adr_two_region',
|
||||||
@ -205,7 +206,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['phpgwapi']['version'].'//'.
|
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['phpgwapi']['version'].'//'.
|
||||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
||||||
|
|
||||||
$sysCharSet = translation::charset();
|
$sysCharSet = Api\Translation::charset();
|
||||||
|
|
||||||
// KAddressbook and Funambol4BlackBerry always requires non-ascii chars to be qprint encoded.
|
// KAddressbook and Funambol4BlackBerry always requires non-ascii chars to be qprint encoded.
|
||||||
if ($this->productName == 'kde' ||
|
if ($this->productName == 'kde' ||
|
||||||
@ -280,7 +281,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
switch ($databaseField)
|
switch ($databaseField)
|
||||||
{
|
{
|
||||||
case 'modified':
|
case 'modified':
|
||||||
$value = gmdate("Y-m-d\TH:i:s\Z",egw_time::user2server($value));
|
$value = gmdate("Y-m-d\TH:i:s\Z",Api\DateTime::user2server($value));
|
||||||
$hasdata++;
|
$hasdata++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -332,7 +333,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
case 'cat_id':
|
case 'cat_id':
|
||||||
if (!empty($value) && ($values = /*str_replace(',','\\,',*/$this->get_categories($value)))//)
|
if (!empty($value) && ($values = /*str_replace(',','\\,',*/$this->get_categories($value)))//)
|
||||||
{
|
{
|
||||||
$values = (array) translation::convert($values, $sysCharSet, $_charset);
|
$values = (array) Api\Translation::convert($values, $sysCharSet, $_charset);
|
||||||
$value = implode(',', $values); // just for the CHARSET recognition
|
$value = implode(',', $values); // just for the CHARSET recognition
|
||||||
if (($size > 0) && strlen($value) > $size)
|
if (($size > 0) && strlen($value) > $size)
|
||||||
{
|
{
|
||||||
@ -428,7 +429,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
|| in_array($vcardField,array('FN','ORG','N'))
|
|| in_array($vcardField,array('FN','ORG','N'))
|
||||||
|| ($size >= 0 && !$noTruncate))
|
|| ($size >= 0 && !$noTruncate))
|
||||||
{
|
{
|
||||||
$value = translation::convert(trim($value), $sysCharSet, $_charset);
|
$value = Api\Translation::convert(trim($value), $sysCharSet, $_charset);
|
||||||
$values[] = $value;
|
$values[] = $value;
|
||||||
if (preg_match('/[^\x20-\x7F]/', $value))
|
if (preg_match('/[^\x20-\x7F]/', $value))
|
||||||
{
|
{
|
||||||
@ -1030,8 +1031,8 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
{
|
{
|
||||||
if (!$file)
|
if (!$file)
|
||||||
{
|
{
|
||||||
$filename = count($ids) == 1 ? egw_link::title('addressbook',$ids[0]): 'egw_addressbook_'.date('Y-m-d');
|
$filename = count($ids) == 1 ? Link::title('addressbook',$ids[0]): 'egw_addressbook_'.date('Y-m-d');
|
||||||
html::content_header(($filename ? $filename : 'addressbook').'.vcf','text/x-vcard');
|
Api\Header\Content::type(($filename ? $filename : 'addressbook').'.vcf','text/x-vcard');
|
||||||
}
|
}
|
||||||
if (!($fp = fopen($file ? $file : 'php://output','w')))
|
if (!($fp = fopen($file ? $file : 'php://output','w')))
|
||||||
{
|
{
|
||||||
@ -1053,7 +1054,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
|
|
||||||
if (!$file)
|
if (!$file)
|
||||||
{
|
{
|
||||||
common::egw_exit();
|
exit();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1079,7 +1080,7 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
{
|
{
|
||||||
$vCard->setAttribute('X-ADDRESSBOOKSERVER-MEMBER','urn:uuid:'.$uid);
|
$vCard->setAttribute('X-ADDRESSBOOKSERVER-MEMBER','urn:uuid:'.$uid);
|
||||||
}
|
}
|
||||||
$vCard->setAttribute('REV',egw_time::to($list['list_modified'],'Y-m-d\TH:i:s\Z'));
|
$vCard->setAttribute('REV',Api\DateTime::to($list['list_modified'],'Y-m-d\TH:i:s\Z'));
|
||||||
$vCard->setAttribute('UID',$list['list_uid']);
|
$vCard->setAttribute('UID',$list['list_uid']);
|
||||||
|
|
||||||
return $vCard->exportvCalendar();
|
return $vCard->exportvCalendar();
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* eGroupWare - Wizard for Adressbook CSV export
|
* EGroupware - Wizard for Adressbook CSV export
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Nathan Gray
|
* @author Nathan Gray
|
||||||
* @version $Id: $
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_export_csv
|
class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_export_csv
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
@ -18,7 +20,7 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
|||||||
$this->step_templates['wizard_step50'] = 'addressbook.export_explode_fields';
|
$this->step_templates['wizard_step50'] = 'addressbook.export_explode_fields';
|
||||||
|
|
||||||
// Field mapping
|
// Field mapping
|
||||||
$bocontacts = new addressbook_bo();
|
$bocontacts = new Api\Contacts();
|
||||||
$this->export_fields = $bocontacts->contact_fields;
|
$this->export_fields = $bocontacts->contact_fields;
|
||||||
foreach($bocontacts->customfields as $name => $data) {
|
foreach($bocontacts->customfields as $name => $data) {
|
||||||
$this->export_fields['#'.$name] = $data['label'];
|
$this->export_fields['#'.$name] = $data['label'];
|
||||||
@ -51,7 +53,7 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choose how to export multi-selects (includes categories)
|
* Choose how to export multi-selects (includes Api\Categories)
|
||||||
*/
|
*/
|
||||||
function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
|
function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||||
{
|
{
|
||||||
@ -97,7 +99,7 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
|||||||
|
|
||||||
$cat_options = array(
|
$cat_options = array(
|
||||||
addressbook_export_contacts_csv::NO_EXPLODE => lang('All in one field'),
|
addressbook_export_contacts_csv::NO_EXPLODE => lang('All in one field'),
|
||||||
addressbook_export_contacts_csv::MAIN_CATS => lang('Main categories in their own field'),
|
addressbook_export_contacts_csv::MAIN_CATS => lang('Main Api\Categories in their own field'),
|
||||||
addressbook_export_contacts_csv::EACH_CAT => lang('Each category in its own field'),
|
addressbook_export_contacts_csv::EACH_CAT => lang('Each category in its own field'),
|
||||||
);
|
);
|
||||||
$multi_options = array(
|
$multi_options = array(
|
||||||
@ -139,9 +141,9 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add any multi-select custom fields
|
// Add any multi-select custom fields
|
||||||
$custom = config::get_customfields('addressbook');
|
$custom = Api\Storage\Customfields::get('addressbook');
|
||||||
foreach($custom as $name => $c_field) {
|
foreach($custom as $name => $c_field) {
|
||||||
if($c_field['type'] = 'select' && $c_field['rows'] > 1 && in_array('#'.$name, array_keys($content['mapping']))) {
|
if($c_field['type'] == 'select' && $c_field['rows'] > 1 && in_array('#'.$name, array_keys($content['mapping']))) {
|
||||||
$field_list['#'.$name] = $c_field['label'];
|
$field_list['#'.$name] = $c_field['label'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
* @author Nathan Gray
|
* @author Nathan Gray
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We need to allow choosing of charset, so we'll just use the standard one from CSV
|
* We need to allow choosing of charset, so we'll just use the standard one from CSV
|
||||||
*/
|
*/
|
||||||
@ -22,7 +24,6 @@ class addressbook_wizard_export_vcard
|
|||||||
$this->step_templates = array(
|
$this->step_templates = array(
|
||||||
'wizard_step40' => 'addressbook.importexport_wizard_vcard_charset'
|
'wizard_step40' => 'addressbook.importexport_wizard_vcard_charset'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,14 +60,14 @@ class addressbook_wizard_export_vcard
|
|||||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||||
$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
|
$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
|
||||||
}
|
}
|
||||||
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
$sel_options['charset'] = Api\Translation::get_installed_charsets()+
|
||||||
array(
|
array(
|
||||||
'user' => lang('User preference'),
|
'user' => lang('User preference'),
|
||||||
);
|
);
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
|
|
||||||
// Add in extra allowed charsets
|
// Add in extra allowed charsets
|
||||||
$config = config::read('importexport');
|
$config = Api\Config::read('importexport');
|
||||||
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
||||||
if($extra_charsets)
|
if($extra_charsets)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
* @version $Id: $
|
* @version $Id: $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_import_csv
|
class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_import_csv
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -25,16 +28,16 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Field mapping
|
// Field mapping
|
||||||
$bocontacts = new addressbook_bo();
|
$bocontacts = new Api\Contacts();
|
||||||
$this->mapping_fields = $bocontacts->contact_fields;
|
$this->mapping_fields = $bocontacts->contact_fields;
|
||||||
|
|
||||||
$categories = new categories('','addressbook');
|
$categories = new Api\Categories('','addressbook');
|
||||||
$cat_list = array();
|
$cat_list = array();
|
||||||
foreach((array)$categories->return_sorted_array(0,False,'','','',true,0,true) as $cat)
|
foreach((array)$categories->return_sorted_array(0,False,'','','',true,0,true) as $cat)
|
||||||
{
|
{
|
||||||
$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
|
$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
|
||||||
|
|
||||||
if (categories::is_global($cat))
|
if (Api\Categories::is_global($cat))
|
||||||
{
|
{
|
||||||
$s .= ' ♦';
|
$s .= ' ♦';
|
||||||
}
|
}
|
||||||
@ -115,8 +118,8 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
|||||||
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$bocontacts = new addressbook_bo();
|
$bocontacts = new Api\Contacts();
|
||||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
|
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
|
||||||
if(!in_array('owner', $content['field_mapping'])) {
|
if(!in_array('owner', $content['field_mapping'])) {
|
||||||
$content['no_owner_map'] = true;
|
$content['no_owner_map'] = true;
|
||||||
}
|
}
|
||||||
@ -125,6 +128,5 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
|||||||
unset ($preserv['button']);
|
unset ($preserv['button']);
|
||||||
return 'addressbook.importexport_wizard_chooseowner';
|
return 'addressbook.importexport_wizard_chooseowner';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,20 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->steps = array(
|
$this->steps = array(
|
||||||
'wizard_step40' => lang('Choose charset'),
|
'wizard_step40' => lang('Choose charset'),
|
||||||
'wizard_step60' => lang('Choose owner of imported data'),
|
'wizard_step60' => lang('Choose owner of imported data'),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
|
function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||||
@ -52,13 +52,13 @@ class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
|||||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||||
$content['charset'] = $content['plugin_options']['charset'];
|
$content['charset'] = $content['plugin_options']['charset'];
|
||||||
}
|
}
|
||||||
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
$sel_options['charset'] = Api\Translation::get_installed_charsets()+
|
||||||
array(
|
array(
|
||||||
'user' => lang('User preference'),
|
'user' => lang('User preference'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add in extra allowed charsets
|
// Add in extra allowed charsets
|
||||||
$config = config::read('importexport');
|
$config = Api\Config::read('importexport');
|
||||||
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
||||||
if($extra_charsets)
|
if($extra_charsets)
|
||||||
{
|
{
|
||||||
@ -102,13 +102,12 @@ class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
|||||||
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$bocontacts = new addressbook_bo();
|
$bocontacts = new Api\Contacts();
|
||||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
|
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
|
||||||
|
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
unset ($preserv['button']);
|
unset ($preserv['button']);
|
||||||
return 'addressbook.importexport_wizard_vcard_chooseowner';
|
return 'addressbook.importexport_wizard_vcard_chooseowner';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addressbook activesync plugin
|
* Addressbook activesync plugin
|
||||||
*/
|
*/
|
||||||
@ -25,7 +28,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
/**
|
/**
|
||||||
* Instance of addressbook_bo
|
* Instance of addressbook_bo
|
||||||
*
|
*
|
||||||
* @var addressbook_bo
|
* @var Api\Contacts
|
||||||
*/
|
*/
|
||||||
private $addressbook;
|
private $addressbook;
|
||||||
|
|
||||||
@ -134,11 +137,11 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
translation::add_app('addressbook'); // we need the addressbook translations
|
Api\Translation::add_app('addressbook'); // we need the addressbook translations
|
||||||
|
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
// error_log(print_r($this->addressbook->get_addressbooks(EGW_ACL_READ),true));
|
// error_log(print_r($this->addressbook->get_addressbooks(Acl::READ),true));
|
||||||
$pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs'];
|
$pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs'];
|
||||||
$pref_abs = (string)$pref !== '' ? explode(',',$pref) : array();
|
$pref_abs = (string)$pref !== '' ? explode(',',$pref) : array();
|
||||||
|
|
||||||
@ -172,7 +175,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
*/
|
*/
|
||||||
public function GetFolderList()
|
public function GetFolderList()
|
||||||
{
|
{
|
||||||
// error_log(print_r($this->addressbook->get_addressbooks(EGW_ACL_READ),true));
|
// error_log(print_r($this->addressbook->get_addressbooks(Acl::READ),true));
|
||||||
$folderlist = array();
|
$folderlist = array();
|
||||||
foreach ($this->get_addressbooks() as $account => $label)
|
foreach ($this->get_addressbooks() as $account => $label)
|
||||||
{
|
{
|
||||||
@ -278,7 +281,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
function GetMessageList($id, $cutoffdate=NULL)
|
function GetMessageList($id, $cutoffdate=NULL)
|
||||||
{
|
{
|
||||||
unset($cutoffdate); // not used, but required by function signature
|
unset($cutoffdate); // not used, but required by function signature
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
$type = $user = null;
|
$type = $user = null;
|
||||||
$this->backend->splitID($id,$type,$user);
|
$this->backend->splitID($id,$type,$user);
|
||||||
@ -329,7 +332,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
*/
|
*/
|
||||||
public function GetMessage($folderid, $id, $contentparameters)
|
public function GetMessage($folderid, $id, $contentparameters)
|
||||||
{
|
{
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
//$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
|
//$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
|
||||||
//$mimesupport = $contentparameters->GetMimeSupport();
|
//$mimesupport = $contentparameters->GetMimeSupport();
|
||||||
@ -386,7 +389,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
$message->$key = array();
|
$message->$key = array();
|
||||||
foreach($contact[$attr] ? explode(',',$contact[$attr]) : array() as $cat_id)
|
foreach($contact[$attr] ? explode(',',$contact[$attr]) : array() as $cat_id)
|
||||||
{
|
{
|
||||||
$message->categories[] = categories::id2name($cat_id);
|
$message->categories[] = Api\Categories::id2name($cat_id);
|
||||||
}
|
}
|
||||||
// for all addressbooks in one, add addressbook name itself as category
|
// for all addressbooks in one, add addressbook name itself as category
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
|
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
|
||||||
@ -437,7 +440,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
public function StatMessage($folderid, $contact)
|
public function StatMessage($folderid, $contact)
|
||||||
{
|
{
|
||||||
unset($folderid); // not used (contact_id is global), but required by function signaure
|
unset($folderid); // not used (contact_id is global), but required by function signaure
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
if (!is_array($contact)) $contact = $this->addressbook->read($contact);
|
if (!is_array($contact)) $contact = $this->addressbook->read($contact);
|
||||||
|
|
||||||
@ -511,7 +514,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
public function ChangeMessage($folderid, $id, $message, $contentParameters)
|
public function ChangeMessage($folderid, $id, $message, $contentParameters)
|
||||||
{
|
{
|
||||||
unset($contentParameters); // not used, but required by function signature
|
unset($contentParameters); // not used, but required by function signature
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
$type = $account = null;
|
$type = $account = null;
|
||||||
$this->backend->splitID($folderid, $type, $account);
|
$this->backend->splitID($folderid, $type, $account);
|
||||||
@ -528,13 +531,13 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
debugLog(__METHOD__." Folder wrong or contact not existing");
|
debugLog(__METHOD__." Folder wrong or contact not existing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($account == 0) // as a precausion, we currently do NOT allow to change accounts
|
if ($account == 0) // as a precausion, we currently do NOT allow to change Api\Accounts
|
||||||
{
|
{
|
||||||
debugLog(__METHOD__." Changing of accounts denied!");
|
debugLog(__METHOD__." Changing of Api\Accounts denied!");
|
||||||
return false; //no changing of accounts
|
return false; //no changing of Api\Accounts
|
||||||
}
|
}
|
||||||
$contact = array();
|
$contact = array();
|
||||||
if (empty($id) && ($this->addressbook->grants[$account] & EGW_ACL_EDIT) || ($contact = $this->addressbook->read($id)) && $this->addressbook->check_perms(EGW_ACL_EDIT, $contact))
|
if (empty($id) && ($this->addressbook->grants[$account] & Acl::EDIT) || ($contact = $this->addressbook->read($id)) && $this->addressbook->check_perms(Acl::EDIT, $contact))
|
||||||
{
|
{
|
||||||
// remove all fields supported by AS, leaving all unsupported fields unchanged
|
// remove all fields supported by AS, leaving all unsupported fields unchanged
|
||||||
$contact = array_diff_key($contact, array_flip(self::$mapping));
|
$contact = array_diff_key($contact, array_flip(self::$mapping));
|
||||||
@ -601,7 +604,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for all-in-one addressbook, account is meaningless and wrong!
|
// for all-in-one addressbook, account is meaningless and wrong!
|
||||||
// addressbook_bo::save() keeps the owner or sets an appropriate one if none given
|
// Api\Contacts::save() keeps the owner or sets an appropriate one if none given
|
||||||
if (!isset($contact['private'])) $contact['private'] = (int)$is_private;
|
if (!isset($contact['private'])) $contact['private'] = (int)$is_private;
|
||||||
if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
|
if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
|
||||||
{
|
{
|
||||||
@ -670,7 +673,8 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
*/
|
*/
|
||||||
public function DeleteMessage($folderid, $id, $contentParameters)
|
public function DeleteMessage($folderid, $id, $contentParameters)
|
||||||
{
|
{
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
unset($contentParameters); // not used, but required by function signature
|
||||||
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
$ret = $this->addressbook->delete($id);
|
$ret = $this->addressbook->delete($id);
|
||||||
debugLog(__METHOD__."('$folderid', $id) delete($id) returned ".array2string($ret));
|
debugLog(__METHOD__."('$folderid', $id) delete($id) returned ".array2string($ret));
|
||||||
@ -732,7 +736,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
|
|
||||||
if ($type != 'addressbook') return false;
|
if ($type != 'addressbook') return false;
|
||||||
|
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
|
|
||||||
// handle all-in-one addressbook
|
// handle all-in-one addressbook
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] &&
|
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] &&
|
||||||
@ -783,7 +787,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
*/
|
*/
|
||||||
function getSearchResultsGAL($searchquery)
|
function getSearchResultsGAL($searchquery)
|
||||||
{
|
{
|
||||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||||
//error_log(__METHOD__.'('.array2string($searchquery).')');
|
//error_log(__METHOD__.'('.array2string($searchquery).')');
|
||||||
|
|
||||||
// only return items in given range, eg. "0-50"
|
// only return items in given range, eg. "0-50"
|
||||||
@ -841,8 +845,8 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
|||||||
if (!isset($hook_data['setup']) && in_array($hook_data['type'], array('user', 'group')))
|
if (!isset($hook_data['setup']) && in_array($hook_data['type'], array('user', 'group')))
|
||||||
{
|
{
|
||||||
$user = $hook_data['account_id'];
|
$user = $hook_data['account_id'];
|
||||||
$addressbook_bo = new addressbook_bo();
|
$addressbook_bo = new Api\Contacts();
|
||||||
$addressbooks = $addressbook_bo->get_addressbooks(EGW_ACL_READ, null, $user);
|
$addressbooks = $addressbook_bo->get_addressbooks(Acl::READ, null, $user);
|
||||||
if ($user > 0)
|
if ($user > 0)
|
||||||
{
|
{
|
||||||
unset($addressbooks[$user]); // personal addressbook is allways synced
|
unset($addressbooks[$user]); // personal addressbook is allways synced
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = array(
|
$GLOBALS['egw_info'] = array(
|
||||||
'flags' => array(
|
'flags' => array(
|
||||||
'currentapp' => 'addressbook',
|
'currentapp' => 'addressbook',
|
||||||
@ -17,10 +19,10 @@ $GLOBALS['egw_info'] = array(
|
|||||||
include('../header.inc.php');
|
include('../header.inc.php');
|
||||||
|
|
||||||
// check if we have an advanced search and reset it in case
|
// check if we have an advanced search and reset it in case
|
||||||
$old_state = $GLOBALS['egw']->session->appsession('index','addressbook');
|
$old_state = Api\Cache::getSession('addressbook', 'index');
|
||||||
if ($old_state['advanced_search'])
|
if ($old_state['advanced_search'])
|
||||||
{
|
{
|
||||||
unset($old_state['advanced_search']);
|
unset($old_state['advanced_search']);
|
||||||
$GLOBALS['egw']->session->appsession('index','addressbook',$old_state);
|
Api\Cache::setSession('addressbook', 'index', $old_state);
|
||||||
}
|
}
|
||||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.addressbook_ui.index');
|
Api\Egw::redirect_link('/index.php','menuaction=addressbook.addressbook_ui.index');
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
/* Basic information about this app */
|
/* Basic information about this app */
|
||||||
$setup_info['addressbook']['name'] = 'addressbook';
|
$setup_info['addressbook']['name'] = 'addressbook';
|
||||||
$setup_info['addressbook']['title'] = 'Addressbook';
|
$setup_info['addressbook']['title'] = 'Addressbook';
|
||||||
$setup_info['addressbook']['version'] = '14.1';
|
$setup_info['addressbook']['version'] = '16.1';
|
||||||
$setup_info['addressbook']['app_order'] = 4;
|
$setup_info['addressbook']['app_order'] = 4;
|
||||||
$setup_info['addressbook']['enable'] = 1;
|
$setup_info['addressbook']['enable'] = 1;
|
||||||
$setup_info['addressbook']['index'] = 'addressbook.addressbook_ui.index&ajax=true';
|
$setup_info['addressbook']['index'] = 'addressbook.addressbook_ui.index&ajax=true';
|
||||||
@ -51,12 +51,8 @@ $setup_info['addressbook']['hooks']['groupdav_root_props'] = 'addressbook_groupd
|
|||||||
|
|
||||||
/* Dependencies for this app to work */
|
/* Dependencies for this app to work */
|
||||||
$setup_info['addressbook']['depends'][] = array(
|
$setup_info['addressbook']['depends'][] = array(
|
||||||
'appname' => 'phpgwapi',
|
'appname' => 'api',
|
||||||
'versions' => Array('14.1')
|
'versions' => Array('16.1')
|
||||||
);
|
|
||||||
$setup_info['addressbook']['depends'][] = array(
|
|
||||||
'appname' => 'etemplate',
|
|
||||||
'versions' => Array('14.1')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// installation checks for addresbook
|
// installation checks for addresbook
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiteMgr contact form for the addressbook
|
* SiteMgr contact form for the addressbook
|
||||||
*
|
*
|
||||||
@ -38,7 +41,7 @@ class module_addressbook_contactform extends sitemgr_module
|
|||||||
*/
|
*/
|
||||||
function get_user_interface()
|
function get_user_interface()
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->translation->add_app('addressbook');
|
Api\Translation::add_app('addressbook');
|
||||||
|
|
||||||
$uicontacts = new addressbook_ui();
|
$uicontacts = new addressbook_ui();
|
||||||
|
|
||||||
@ -76,7 +79,7 @@ class module_addressbook_contactform extends sitemgr_module
|
|||||||
'label' => lang('Addressbook the contact should be saved to').' ('.lang('The anonymous user needs add rights for it!').')',
|
'label' => lang('Addressbook the contact should be saved to').' ('.lang('The anonymous user needs add rights for it!').')',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'' => lang('None'),
|
'' => lang('None'),
|
||||||
)+$uicontacts->get_addressbooks(EGW_ACL_ADD) // add to not show the accounts!
|
)+$uicontacts->get_addressbooks(Acl::ADD) // add to not show the accounts!
|
||||||
),
|
),
|
||||||
'arg4' => array(
|
'arg4' => array(
|
||||||
'type' => 'textfield',
|
'type' => 'textfield',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/***
|
||||||
* Addressbook - Sitemgr contact form
|
* Addressbook - Sitemgr contact form
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
@ -10,6 +10,9 @@
|
|||||||
* @version $Id: class.module_addressbook_display.inc.php 24028 2008-02-18 09:04:36Z stefanbecker $
|
* @version $Id: class.module_addressbook_display.inc.php 24028 2008-02-18 09:04:36Z stefanbecker $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Acl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiteMgr contact form for the addressbook
|
* SiteMgr contact form for the addressbook
|
||||||
*/
|
*/
|
||||||
@ -36,7 +39,7 @@ class module_addressbook_display extends sitemgr_module
|
|||||||
*/
|
*/
|
||||||
function get_user_interface()
|
function get_user_interface()
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->translation->add_app('addressbook');
|
Api\Translation::add_app('addressbook');
|
||||||
|
|
||||||
$uicontacts = new addressbook_ui();
|
$uicontacts = new addressbook_ui();
|
||||||
|
|
||||||
@ -68,7 +71,7 @@ class module_addressbook_display extends sitemgr_module
|
|||||||
'label' => lang('Addressbook the contact should be shown').' ('.lang('The anonymous user needs read it!').')',
|
'label' => lang('Addressbook the contact should be shown').' ('.lang('The anonymous user needs read it!').')',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'' => lang('All'),
|
'' => lang('All'),
|
||||||
)+$uicontacts->get_addressbooks(EGW_ACL_ADD) // add to not show the accounts!
|
)+$uicontacts->get_addressbooks(Acl::ADD) // add to not show the accounts!
|
||||||
),
|
),
|
||||||
'arg2' => array(
|
'arg2' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
Loading…
Reference in New Issue
Block a user