forked from extern/egroupware
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\Acl;
|
||||
|
||||
/**
|
||||
* Business object for addressbook
|
||||
@ -126,7 +127,7 @@ class addressbook_bo extends Api\Contacts
|
||||
$result = self::get_pgp_keyserver($missing, $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']);
|
||||
}
|
||||
if ($this->check_perms(EGW_ACL_EDIT, $contact) && $this->save($contact))
|
||||
if ($this->check_perms(Acl::EDIT, $contact) && $this->save($contact))
|
||||
{
|
||||
++$updated;
|
||||
}
|
||||
@ -209,7 +210,7 @@ class addressbook_bo extends Api\Contacts
|
||||
$message .= "\n".lang('%1 key(s) added to public keyserver "%2".',
|
||||
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\Link;
|
||||
use EGroupware\Api\Vfs;
|
||||
|
||||
/**
|
||||
* SiteMgr contact form for the addressbook
|
||||
@ -92,9 +94,9 @@ class addressbook_contactform
|
||||
// the anonymous user to have run rights for addressbook AND
|
||||
// edit rights for the addressbook used to store the new entry,
|
||||
// which is clearly not wanted securitywise
|
||||
Api\Vfs::$is_root = true;
|
||||
egw_link::link('addressbook',$id,egw_link::VFS_APPNAME,$value,$name);
|
||||
Api\Vfs::$is_root = false;
|
||||
Vfs::$is_root = true;
|
||||
Link::link('addressbook',$id,Link::VFS_APPNAME,$value,$name);
|
||||
Vfs::$is_root = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,26 +10,15 @@
|
||||
* @version $Id: class.addressbook_display.inc.php 24099 2008-02-18 16:29:06Z stefanbecker $
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* SiteMgr Display form for the addressbook
|
||||
*
|
||||
*/
|
||||
class addressbook_display extends addressbook_ui
|
||||
{
|
||||
/**
|
||||
* 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)
|
||||
function get_rows(&$query,&$rows,&$readonlys)
|
||||
{
|
||||
$query['sitemgr_display'] = ($readonlys['sitemgr_display'] ?$readonlys['sitemgr_display']:'addressbook.display');
|
||||
$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)
|
||||
{
|
||||
$tpl_name=($tpl_name ? $tpl_name : 'addressbook.display');
|
||||
@ -52,7 +53,7 @@ function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
|
||||
$content = array(
|
||||
'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;
|
||||
if (!is_array($content['nm1']))
|
||||
{
|
||||
|
@ -11,6 +11,9 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Framework;
|
||||
|
||||
/**
|
||||
* class addressbook_egw_record
|
||||
* 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='' ){
|
||||
$this->identifier = $_identifier;
|
||||
$this->bocontacts = new addressbook_bo();
|
||||
$this->bocontacts = new Api\Contacts();
|
||||
if($_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);
|
||||
|
||||
// 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
|
||||
@ -171,5 +174,4 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
||||
public function __destruct() {
|
||||
unset ($this->bocontacts);
|
||||
}
|
||||
|
||||
} // end of egw_addressbook_record
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare
|
||||
* EGroupware - addressbook
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package addressbook
|
||||
@ -11,12 +11,14 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -44,8 +46,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
$selection = array();
|
||||
|
||||
// Addressbook defines its own export imits
|
||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
||||
$export_limit = bo_merge::getExportLimit($app='addressbook');
|
||||
$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
|
||||
$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) {
|
||||
return;
|
||||
@ -57,11 +59,12 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
|
||||
if ($options['selection'] == 'search') {
|
||||
// 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['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
||||
$query['order'] = 'contact_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
|
||||
}
|
||||
elseif ( $options['selection'] == 'all' ) {
|
||||
@ -73,9 +76,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
}
|
||||
elseif ($options['selection'] == 'filter')
|
||||
{
|
||||
$fields = importexport_helper_functions::get_filter_fields($_definition->application, $this);
|
||||
$filter = $_definition->filter;
|
||||
$known_fields = $this->ui->get_fields('supported');
|
||||
$query = array();
|
||||
|
||||
// Handle ranges
|
||||
@ -125,14 +126,14 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
}
|
||||
$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);
|
||||
}
|
||||
|
||||
if($options['explode_multiselects']) {
|
||||
$customfields = config::get_customfields('addressbook');
|
||||
$customfields = Api\Storage\Customfields::get('addressbook');
|
||||
$additional_fields = array();
|
||||
$cat_obj = new categories('', 'addressbook');
|
||||
$cat_obj = new Api\Categories('', 'addressbook');
|
||||
foreach($options['explode_multiselects'] as $field => $explode) {
|
||||
switch($explode['explode']) {
|
||||
case self::MAIN_CATS:
|
||||
@ -241,7 +242,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
}
|
||||
|
||||
$export_object->set_mapping($options['mapping']);
|
||||
|
||||
|
||||
// Add in last/next event, if needed
|
||||
if($options['mapping']['last_date'] || $options['mapping']['next_date'])
|
||||
{
|
||||
@ -439,7 +440,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
'type' => 'select',
|
||||
'rows' => 5,
|
||||
'tags' => true,
|
||||
'values' => $this->ui->get_addressbooks(EGW_ACL_READ)
|
||||
'values' => $this->ui->get_addressbooks(Acl::READ)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?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
|
||||
* @package addressbook
|
||||
@ -11,6 +11,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* export addressbook contacts as vcard
|
||||
*/
|
||||
@ -29,9 +31,8 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
||||
$this->selection = array();
|
||||
|
||||
// Addressbook defines its own export imits
|
||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
||||
$export_limit = bo_merge::getExportLimit($app='addressbook');
|
||||
if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all
|
||||
$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
|
||||
$export_limit = Api\Storage\Merge::getExportLimit($app='addressbook');
|
||||
if($export_limit == 'no' && !$limit_exception) {
|
||||
return;
|
||||
}
|
||||
@ -42,10 +43,11 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
||||
|
||||
if ($options['selection'] == 'search') {
|
||||
// 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['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'];
|
||||
$readonlys = null;
|
||||
$this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids
|
||||
}
|
||||
elseif ( $options['selection'] == 'all' ) {
|
||||
@ -59,7 +61,7 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
||||
}
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -69,7 +71,7 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
||||
$_contact = $_contact[$_contact['id'] ? 'id' : 'contact_id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// vCard opens & closes the resource itself, but this doesn't seem to matter
|
||||
$meta = stream_get_meta_data($_stream);
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
/**
|
||||
* CalDAV/CardDAV/GroupDAV access: Addressbook handler
|
||||
@ -237,7 +238,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
unset($requested_multiget_ids[$k]);
|
||||
}
|
||||
// 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)));
|
||||
continue;
|
||||
@ -311,7 +312,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
}
|
||||
$props = array(
|
||||
'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'],
|
||||
'getetag' => '"'.$etag.'"',
|
||||
);
|
||||
@ -415,7 +416,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
{
|
||||
case 'i;unicode-casemap':
|
||||
default:
|
||||
$comp = ' '.$GLOBALS['egw']->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' ';
|
||||
$comp = ' '.$GLOBALS['egw']->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' ';
|
||||
break;
|
||||
}
|
||||
$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';
|
||||
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']))
|
||||
@ -651,7 +652,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
{
|
||||
$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))
|
||||
{
|
||||
$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
|
||||
// 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'");
|
||||
return '403 Forbidden';
|
||||
@ -689,7 +690,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
{
|
||||
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
|
||||
@ -835,7 +836,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
* </D:supported-report-set>
|
||||
* @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 $base_uri =null base url of handler
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
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']) &&
|
||||
$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')))
|
||||
{
|
||||
$user = $hook_data['account_id'];
|
||||
$addressbook_bo = new addressbook_bo();
|
||||
$addressbooks += $addressbook_bo->get_addressbooks(EGW_ACL_READ, null, $user);
|
||||
$addressbook_bo = new Api\Contacts();
|
||||
$addressbooks += $addressbook_bo->get_addressbooks(Acl::READ, null, $user);
|
||||
if ($user > 0) unset($addressbooks[$user]); // allways synced
|
||||
unset($addressbooks[$user.'p']);// ignore (optional) private addressbook for now
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?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
|
||||
* @package addressbook
|
||||
@ -11,6 +11,10 @@
|
||||
*/
|
||||
|
||||
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
|
||||
@ -43,21 +47,21 @@ class addressbook_hooks
|
||||
));
|
||||
}
|
||||
// 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(
|
||||
'Addressbook list' => egw::link('/index.php',array(
|
||||
'Addressbook list' => Egw::link('/index.php',array(
|
||||
'menuaction' => 'addressbook.addressbook_ui.index',
|
||||
'ajax' => 'true')),
|
||||
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,
|
||||
'link' => "javascript:egw.open('','$appname','add')"
|
||||
),
|
||||
'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')",
|
||||
'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);
|
||||
}
|
||||
@ -65,11 +69,11 @@ class addressbook_hooks
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
||||
{
|
||||
$file = Array(
|
||||
'Site configuration' => egw::link('/index.php',array(
|
||||
'Site configuration' => Egw::link('/index.php',array(
|
||||
'menuaction' => 'admin.uiconfig.index',
|
||||
'appname' => $appname,
|
||||
)),
|
||||
'Global Categories' => egw::link('/index.php',array(
|
||||
'Global Categories' => Egw::link('/index.php',array(
|
||||
'menuaction' => 'admin.admin_categories.index',
|
||||
'appname' => $appname,
|
||||
'global_cats'=> True,
|
||||
@ -78,7 +82,7 @@ class addressbook_hooks
|
||||
// custom fields are not availible in 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',
|
||||
'appname' => $appname,
|
||||
'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
|
||||
* @return array
|
||||
@ -118,7 +122,7 @@ class addressbook_hooks
|
||||
'label' => 'Default addressbook for adding contacts',
|
||||
'name' => 'add_default',
|
||||
'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,
|
||||
'admin' => False,
|
||||
);
|
||||
@ -159,7 +163,7 @@ class addressbook_hooks
|
||||
'type' => 'select',
|
||||
'label' => 'Add a customfield to link title',
|
||||
'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.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
@ -223,7 +227,7 @@ class addressbook_hooks
|
||||
'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')).' '.
|
||||
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,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
@ -235,7 +239,7 @@ class addressbook_hooks
|
||||
'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')).' '.
|
||||
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,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
@ -301,7 +305,7 @@ class addressbook_hooks
|
||||
'type' => 'select',
|
||||
'label' => 'Charset for the vCard import and export',
|
||||
'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.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
@ -425,18 +429,18 @@ class addressbook_hooks
|
||||
/**
|
||||
* ACL rights and labels used
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
public static function acl_rights($params)
|
||||
{
|
||||
unset($params); // not used, but required by function signature
|
||||
|
||||
return array(
|
||||
acl::READ => 'read',
|
||||
acl::EDIT => 'edit',
|
||||
acl::ADD => 'add',
|
||||
acl::DELETE => 'delete',
|
||||
Acl::READ => 'read',
|
||||
Acl::EDIT => 'edit',
|
||||
Acl::ADD => 'add',
|
||||
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(
|
||||
'Unable to convert "%1" to account ID. Using plugin setting (%2) for owner.',
|
||||
$record->owner,
|
||||
common::grab_owner_name($this->user)
|
||||
Api\Accounts::username($this->user)
|
||||
);
|
||||
$record->owner = $this->user;
|
||||
} 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()))
|
||||
{
|
||||
$this->errors[$import_csv->get_current_position()] = lang("Unable to import into %1, using %2",
|
||||
common::grab_owner_name($record->owner),
|
||||
common::grab_owner_name($this->user)
|
||||
Api\Accounts::username($record->owner),
|
||||
Api\Accounts::username($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
|
||||
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');
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
return $result;
|
||||
}
|
||||
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() {
|
||||
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)
|
||||
{
|
||||
// ToDo: Nathan: $_definition is not defined
|
||||
$charset = $_definition->plugin_options['charset'];
|
||||
if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['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
|
||||
$old = $this->bocontacts->read($_data['id']);
|
||||
// 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) {
|
||||
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);
|
||||
foreach(array('adr_one_', 'adr_two_') as $c_prefix)
|
||||
{
|
||||
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
|
||||
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]);
|
||||
|
||||
foreach($this->preview_records as $i => $record)
|
||||
foreach($this->preview_records as $record)
|
||||
{
|
||||
// Convert to human-friendly
|
||||
importexport_export_csv::convert($record,$record_class::$types,$_definition->application);
|
||||
$record = $record->get_record_array();
|
||||
$row = array();
|
||||
foreach($labels as $field => $label)
|
||||
foreach(array_keys($labels) as $field)
|
||||
{
|
||||
$row[$field] = $record[$field];
|
||||
|
||||
@ -380,4 +385,4 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
||||
public function get_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\Link;
|
||||
|
||||
/**
|
||||
* Addressbook - vCard parser
|
||||
*/
|
||||
class addressbook_vcal extends addressbook_bo
|
||||
class addressbook_vcal extends Api\Contacts
|
||||
{
|
||||
/**
|
||||
* product manufacturer from setSupportedFields (lowercase!)
|
||||
@ -32,11 +33,11 @@ class addressbook_vcal extends addressbook_bo
|
||||
*/
|
||||
var $productName;
|
||||
/**
|
||||
* supported fields for vCard file and groupdav import/export
|
||||
* supported fields for vCard file and CardDAV import/export
|
||||
*
|
||||
* @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_one_postalcode','adr_one_countryname'),
|
||||
'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'].'//'.
|
||||
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.
|
||||
if ($this->productName == 'kde' ||
|
||||
@ -280,7 +281,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
switch ($databaseField)
|
||||
{
|
||||
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++;
|
||||
break;
|
||||
|
||||
@ -332,7 +333,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
case 'cat_id':
|
||||
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
|
||||
if (($size > 0) && strlen($value) > $size)
|
||||
{
|
||||
@ -428,7 +429,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
|| in_array($vcardField,array('FN','ORG','N'))
|
||||
|| ($size >= 0 && !$noTruncate))
|
||||
{
|
||||
$value = translation::convert(trim($value), $sysCharSet, $_charset);
|
||||
$value = Api\Translation::convert(trim($value), $sysCharSet, $_charset);
|
||||
$values[] = $value;
|
||||
if (preg_match('/[^\x20-\x7F]/', $value))
|
||||
{
|
||||
@ -1030,8 +1031,8 @@ class addressbook_vcal extends addressbook_bo
|
||||
{
|
||||
if (!$file)
|
||||
{
|
||||
$filename = count($ids) == 1 ? egw_link::title('addressbook',$ids[0]): 'egw_addressbook_'.date('Y-m-d');
|
||||
html::content_header(($filename ? $filename : 'addressbook').'.vcf','text/x-vcard');
|
||||
$filename = count($ids) == 1 ? Link::title('addressbook',$ids[0]): 'egw_addressbook_'.date('Y-m-d');
|
||||
Api\Header\Content::type(($filename ? $filename : 'addressbook').'.vcf','text/x-vcard');
|
||||
}
|
||||
if (!($fp = fopen($file ? $file : 'php://output','w')))
|
||||
{
|
||||
@ -1053,7 +1054,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
|
||||
if (!$file)
|
||||
{
|
||||
common::egw_exit();
|
||||
exit();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1079,7 +1080,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
{
|
||||
$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']);
|
||||
|
||||
return $vCard->exportvCalendar();
|
||||
|
@ -1,14 +1,16 @@
|
||||
<?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
|
||||
* @package addressbook
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id: $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_export_csv
|
||||
{
|
||||
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';
|
||||
|
||||
// Field mapping
|
||||
$bocontacts = new addressbook_bo();
|
||||
$bocontacts = new Api\Contacts();
|
||||
$this->export_fields = $bocontacts->contact_fields;
|
||||
foreach($bocontacts->customfields as $name => $data) {
|
||||
$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)
|
||||
{
|
||||
@ -87,7 +89,7 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
||||
$content['step'] = 'wizard_step50';
|
||||
unset ($preserv['button']);
|
||||
$field_list = $this->get_field_list($content);
|
||||
|
||||
|
||||
$settings = $content['explode_multiselects'] ? $content['explode_multiselects'] : $content['plugin_options']['explode_multiselects'];
|
||||
|
||||
// Skip this step if no fields applicable
|
||||
@ -97,7 +99,7 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
||||
|
||||
$cat_options = array(
|
||||
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'),
|
||||
);
|
||||
$multi_options = array(
|
||||
@ -132,16 +134,16 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
||||
*/
|
||||
protected function get_field_list($content) {
|
||||
$field_list = array();
|
||||
|
||||
|
||||
// Category gets special handling
|
||||
if(in_array('cat_id', array_keys($content['mapping']))) {
|
||||
$field_list['cat_id'] = $this->export_fields['cat_id'];
|
||||
}
|
||||
|
||||
// Add any multi-select custom fields
|
||||
$custom = config::get_customfields('addressbook');
|
||||
$custom = Api\Storage\Customfields::get('addressbook');
|
||||
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'];
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
* @author Nathan Gray
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* 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(
|
||||
'wizard_step40' => 'addressbook.importexport_wizard_vcard_charset'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,14 +60,14 @@ class addressbook_wizard_export_vcard
|
||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||
$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(
|
||||
'user' => lang('User preference'),
|
||||
);
|
||||
$preserv = $content;
|
||||
|
||||
// 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());
|
||||
if($extra_charsets)
|
||||
{
|
||||
|
@ -9,6 +9,9 @@
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
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
|
||||
$bocontacts = new addressbook_bo();
|
||||
$bocontacts = new Api\Contacts();
|
||||
$this->mapping_fields = $bocontacts->contact_fields;
|
||||
|
||||
$categories = new categories('','addressbook');
|
||||
$categories = new Api\Categories('','addressbook');
|
||||
$cat_list = array();
|
||||
foreach((array)$categories->return_sorted_array(0,False,'','','',true,0,true) as $cat)
|
||||
{
|
||||
$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
|
||||
|
||||
if (categories::is_global($cat))
|
||||
if (Api\Categories::is_global($cat))
|
||||
{
|
||||
$s .= ' ♦';
|
||||
}
|
||||
@ -51,7 +54,7 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
$this->mapping_fields['#'.$name] = $data['label'];
|
||||
}
|
||||
unset($this->mapping_fields['jpegphoto']); // can't cvs import that
|
||||
|
||||
|
||||
// Add in special handled fields
|
||||
$this->mapping_fields[lang('Special')] = addressbook_import_contacts_csv::$special_fields;
|
||||
|
||||
@ -77,10 +80,10 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
}
|
||||
$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv);
|
||||
$content['msg'] .= "\n*" . lang('Contact ID cannot be changed by import');
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizard_step60->$content '.print_r($content,true));
|
||||
@ -115,8 +118,8 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
||||
}
|
||||
|
||||
$bocontacts = new addressbook_bo();
|
||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
|
||||
$bocontacts = new Api\Contacts();
|
||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
|
||||
if(!in_array('owner', $content['field_mapping'])) {
|
||||
$content['no_owner_map'] = true;
|
||||
}
|
||||
@ -125,6 +128,5 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
unset ($preserv['button']);
|
||||
return 'addressbook.importexport_wizard_chooseowner';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,27 +10,27 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
||||
{
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
|
||||
$this->steps = array(
|
||||
'wizard_step40' => lang('Choose charset'),
|
||||
'wizard_step60' => lang('Choose owner of imported data'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
|
||||
// return from step40
|
||||
if ($content['step'] == 'wizard_step40')
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
|
||||
// return from step40
|
||||
if ($content['step'] == 'wizard_step40')
|
||||
{
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
@ -50,20 +50,20 @@ class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
||||
$content['msg'] = $this->steps['wizard_step40'];
|
||||
$content['step'] = 'wizard_step40';
|
||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||
$content['charset'] = $content['plugin_options']['charset'];
|
||||
}
|
||||
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
||||
array(
|
||||
'user' => lang('User preference'),
|
||||
);
|
||||
$content['charset'] = $content['plugin_options']['charset'];
|
||||
}
|
||||
$sel_options['charset'] = Api\Translation::get_installed_charsets()+
|
||||
array(
|
||||
'user' => lang('User preference'),
|
||||
);
|
||||
|
||||
// Add in extra allowed charsets
|
||||
$config = config::read('importexport');
|
||||
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
||||
if($extra_charsets)
|
||||
{
|
||||
$sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
|
||||
}
|
||||
$config = Api\Config::read('importexport');
|
||||
$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
|
||||
if($extra_charsets)
|
||||
{
|
||||
$sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
|
||||
}
|
||||
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
@ -102,13 +102,12 @@ class addressbook_wizard_import_vcard extends addressbook_import_vcard
|
||||
$content['change_owner'] = $content['plugin_options']['change_owner'];
|
||||
}
|
||||
|
||||
$bocontacts = new addressbook_bo();
|
||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
|
||||
$bocontacts = new Api\Contacts();
|
||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
|
||||
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return 'addressbook.importexport_wizard_vcard_chooseowner';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
/**
|
||||
* Addressbook activesync plugin
|
||||
*/
|
||||
@ -25,7 +28,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
/**
|
||||
* Instance of addressbook_bo
|
||||
*
|
||||
* @var addressbook_bo
|
||||
* @var Api\Contacts
|
||||
*/
|
||||
private $addressbook;
|
||||
|
||||
@ -134,11 +137,11 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
}
|
||||
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_abs = (string)$pref !== '' ? explode(',',$pref) : array();
|
||||
|
||||
@ -172,7 +175,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
*/
|
||||
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();
|
||||
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)
|
||||
{
|
||||
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;
|
||||
$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)
|
||||
{
|
||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
||||
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||
|
||||
//$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
|
||||
//$mimesupport = $contentparameters->GetMimeSupport();
|
||||
@ -386,7 +389,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
$message->$key = array();
|
||||
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
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
@ -511,7 +514,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
public function ChangeMessage($folderid, $id, $message, $contentParameters)
|
||||
{
|
||||
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;
|
||||
$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");
|
||||
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!");
|
||||
return false; //no changing of accounts
|
||||
debugLog(__METHOD__." Changing of Api\Accounts denied!");
|
||||
return false; //no changing of Api\Accounts
|
||||
}
|
||||
$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
|
||||
$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!
|
||||
// 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 (!$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)
|
||||
{
|
||||
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);
|
||||
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 (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
||||
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||
|
||||
// handle all-in-one addressbook
|
||||
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)
|
||||
{
|
||||
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
||||
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
|
||||
//error_log(__METHOD__.'('.array2string($searchquery).')');
|
||||
|
||||
// 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')))
|
||||
{
|
||||
$user = $hook_data['account_id'];
|
||||
$addressbook_bo = new addressbook_bo();
|
||||
$addressbooks = $addressbook_bo->get_addressbooks(EGW_ACL_READ, null, $user);
|
||||
$addressbook_bo = new Api\Contacts();
|
||||
$addressbooks = $addressbook_bo->get_addressbooks(Acl::READ, null, $user);
|
||||
if ($user > 0)
|
||||
{
|
||||
unset($addressbooks[$user]); // personal addressbook is allways synced
|
||||
|
@ -8,6 +8,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => 'addressbook',
|
||||
@ -17,10 +19,10 @@ $GLOBALS['egw_info'] = array(
|
||||
include('../header.inc.php');
|
||||
|
||||
// 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'])
|
||||
{
|
||||
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 */
|
||||
$setup_info['addressbook']['name'] = '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']['enable'] = 1;
|
||||
$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 */
|
||||
$setup_info['addressbook']['depends'][] = array(
|
||||
'appname' => 'phpgwapi',
|
||||
'versions' => Array('14.1')
|
||||
);
|
||||
$setup_info['addressbook']['depends'][] = array(
|
||||
'appname' => 'etemplate',
|
||||
'versions' => Array('14.1')
|
||||
'appname' => 'api',
|
||||
'versions' => Array('16.1')
|
||||
);
|
||||
|
||||
// installation checks for addresbook
|
||||
|
@ -10,6 +10,9 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
/**
|
||||
* SiteMgr contact form for the addressbook
|
||||
*
|
||||
@ -38,7 +41,7 @@ class module_addressbook_contactform extends sitemgr_module
|
||||
*/
|
||||
function get_user_interface()
|
||||
{
|
||||
$GLOBALS['egw']->translation->add_app('addressbook');
|
||||
Api\Translation::add_app('addressbook');
|
||||
|
||||
$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!').')',
|
||||
'options' => array(
|
||||
'' => 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(
|
||||
'type' => 'textfield',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/***
|
||||
* Addressbook - Sitemgr contact form
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Acl;
|
||||
|
||||
/**
|
||||
* SiteMgr contact form for the addressbook
|
||||
*/
|
||||
@ -36,7 +39,7 @@ class module_addressbook_display extends sitemgr_module
|
||||
*/
|
||||
function get_user_interface()
|
||||
{
|
||||
$GLOBALS['egw']->translation->add_app('addressbook');
|
||||
Api\Translation::add_app('addressbook');
|
||||
|
||||
$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!').')',
|
||||
'options' => array(
|
||||
'' => 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(
|
||||
'type' => 'select',
|
||||
|
Loading…
Reference in New Issue
Block a user