Author: ralfbecker
New Revision: 55935
URL: http://svn.stylite.de/viewvc/egroupware?rev=55935&view=rev
Log:
converted addressbook to use new api
Modified:
trunk/addressbook/inc/class.addressbook_bo.inc.php
trunk/addressbook/inc/class.addressbook_contactform.inc.php
trunk/addressbook/inc/class.addressbook_display.inc.php
trunk/addressbook/inc/class.addressbook_egw_record.inc.php
trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php
trunk/addressbook/inc/class.addressbook_export_vcard.inc.php
trunk/addressbook/inc/class.addressbook_groupdav.inc.php
trunk/addressbook/inc/class.addressbook_hooks.inc.php
trunk/addressbook/inc/class.addressbook_import_contacts_csv.inc.php
trunk/addressbook/inc/class.addressbook_import_vcard.inc.php
trunk/addressbook/inc/class.addressbook_ui.inc.php
trunk/addressbook/inc/class.addressbook_vcal.inc.php
trunk/addressbook/inc/class.addressbook_wizard_export_contacts_csv.inc.php (contents, props changed)
trunk/addressbook/inc/class.addressbook_wizard_export_vcard.inc.php
trunk/addressbook/inc/class.addressbook_wizard_import_contacts_csv.inc.php
trunk/addressbook/inc/class.addressbook_wizard_import_vcard.inc.php
trunk/addressbook/inc/class.addressbook_zpush.inc.php
trunk/addressbook/index.php
trunk/addressbook/setup/setup.inc.php
trunk/addressbook/sitemgr/class.module_addressbook_contactform.inc.php
trunk/addressbook/sitemgr/class.module_addressbook_display.inc.php
— trunk/addressbook/inc/class.addressbook_bo.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_bo.inc.php Fri Apr 29 12:41:53 2016
@@ -14,6 +14,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Acl;
/**
- Business object for addressbook
@@ -126,7 +127,7 @@
$result = self::get_pgp_keyserver($missing, $result);
}
//error_log(METHOD."(".array2string($recipients).") returning ".array2string($result));
-
Api\Json\Response::get()->data($result);
}
/**
@@ -191,7 +192,7 @@
{
$contact[‘pubkey’] = preg_replace(self::$pgp_key_regexp, $key, $contact[‘pubkey’]);
}
@@ -209,7 +210,7 @@
$message .= “\n”.lang(’%1 key(s) added to public keyserver “%2”.’,
self::set_pgp_keyserver($keys), PARSE_URL(self::KEYSERVER_ADD, PHP_URL_HOST));
— trunk/addressbook/inc/class.addressbook_contactform.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_contactform.inc.php Fri Apr 29 12:41:53 2016
@@ -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 @@
// 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;
}
}
— trunk/addressbook/inc/class.addressbook_display.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_display.inc.php Fri Apr 29 12:41:53 2016
@@ -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 @@
}
-
/**
-
- 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 @@
$content = array(
‘msg’ => $msg ? $msg : $_GET[‘msg’],
);
— trunk/addressbook/inc/class.addressbook_egw_record.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_egw_record.inc.php Fri Apr 29 12:41:53 2016
@@ -10,6 +10,9 @@
+use EGroupware\Api;
+use EGroupware\Api\Framework;
/**
- class addressbook_egw_record
@@ -44,7 +47,7 @@
*/
public function __construct( $_identifier=’’ ){
$this->identifier = $_identifier;
@@ -123,7 +126,7 @@
$ui->type_icon($this->owner, $this->private, $this->tid, $icon, $label);
// Specific photo
-} // end of egw_addressbook_record
+}
— trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php Fri Apr 29 12:41:53 2016
@@ -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 @@
$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 @@
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 @@
}
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 @@
}
$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 @@
}
$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 @@
'type' => 'select',
'rows' => 5,
'tags' => true,
- 'values' => $this->ui->get_addressbooks(EGW_ACL_READ)
+ 'values' => $this->ui->get_addressbooks(Acl::READ)
);
}
}
Modified: trunk/addressbook/inc/class.addressbook_export_vcard.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_export_vcard.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_export_vcard.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_export_vcard.inc.php Fri Apr 29 12:41:53 2016
@@ -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
@@ -10,6 +10,8 @@
* @copyright 2012 Nathan Gray
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* export addressbook contacts as vcard
@@ -29,9 +31,8 @@
$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 @@
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 @@
}
$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 @@
$_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);
Modified: trunk/addressbook/inc/class.addressbook_groupdav.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_groupdav.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_groupdav.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_groupdav.inc.php Fri Apr 29 12:41:53 2016
@@ -12,6 +12,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Acl;
/**
* CalDAV/CardDAV/GroupDAV access: Addressbook handler
@@ -237,7 +238,7 @@
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 @@
}
$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 @@
{
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 @@
$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 @@
{
$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 @@
}
// 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 @@
{
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 @@
*
* @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 @@
/**
* 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 @@
$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 @@
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
}
Modified: trunk/addressbook/inc/class.addressbook_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_hooks.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_hooks.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_hooks.inc.php Fri Apr 29 12:41:53 2016
@@ -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 @@
));
}
// 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 @@
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 @@
// 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 @@
}
/**
- * populates $settings for the preferences
+ * populates $settings for the Api\Preferences
*
* @param array|string $hook_data
* @return array
@@ -118,7 +122,7 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
/**
* 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',
);
}
Modified: trunk/addressbook/inc/class.addressbook_import_contacts_csv.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_import_contacts_csv.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_import_contacts_csv.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_import_contacts_csv.inc.php Fri Apr 29 12:41:53 2016
@@ -98,7 +98,7 @@
$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 @@
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 @@
// 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 @@
return $result;
}
default:
- throw new egw_exception('Unsupported action: '. $_action);
+ throw new Api\Exception('Unsupported action: '. $_action);
}
}
@@ -415,4 +415,4 @@
public function get_results() {
return $this->results;
}
-} // end of iface_export_plugin
+}
Modified: trunk/addressbook/inc/class.addressbook_import_vcard.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_import_vcard.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_import_vcard.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_import_vcard.inc.php Fri Apr 29 12:41:53 2016
@@ -157,6 +157,7 @@
*/
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 @@
// 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 @@
$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 @@
public function get_results() {
return $this->results;
}
-} // end of iface_export_plugin
+}
Modified: trunk/addressbook/inc/class.addressbook_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_ui.inc.php?rev=55935&r1=55934&r2=55935&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_ui.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_ui.inc.php Fri Apr 29 12:41:53 2016
@@ -13,6 +13,12 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Egw;
+use EGroupware\Api\Acl;
+use EGroupware\Api\Vfs;
+use EGroupware\Api\Etemplate;
/**
* General user interface object of the adressbook
@@ -64,7 +70,7 @@
/**
* Instance of eTemplate class
*
- * @var etemplate_new
+ * @var Etemplate
*/
protected $tmpl;
@@ -77,7 +83,7 @@
{
parent::__construct($contact_app);
- $this->tmpl = new etemplate_new();
+ $this->tmpl = new Etemplate();
$this->org_views = array(
'org_name' => lang('Organisations'),
@@ -86,12 +92,12 @@
);
// make sure the hook for export_limit is registered
- if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','addressbook')) $GLOBALS['egw']->hooks->register_single_app_hook('addressbook','export_limit');
+ if (!Api\Hooks::exists('export_limit','addressbook')) Api\Hooks::read(true);
$this->config =& $GLOBALS['egw_info']['server'];
// check if a contact specific export limit is set, if yes use it also for etemplate's csv export
- $this->config['export_limit'] = $this->config['contact_export_limit'] = bo_merge::getExportLimit($app='addressbook');
+ $this->config['export_limit'] = $this->config['contact_export_limit'] = Api\Storage\Merge::getExportLimit($app='addressbook');
if ($this->config['copy_fields'] && ($fields = is_array($this->config['copy_fields']) ?
$this->config['copy_fields'] : unserialize($this->config['copy_fields'])))
@@ -114,69 +120,70 @@
/**
* List contacts of an addressbook
*
- * @param array $content=null submitted content
- * @param string $msg=null message to show
- * @param boolean $do_email=false do an email-selection popup or the regular index-page
+ * @param array $_content =null submitted content
+ * @param string $msg =null message to show
+ * @param boolean $do_email =false do an email-selection popup or the regular index-page
*/
- function index($content=null,$msg=null,$do_email=false)
+ function index($_content=null,$msg=null,$do_email=false)
{
- //echo "
uicontacts::index(".print_r($content,true).",'$msg')
\n";
- if (($re_submit = is_array($content)))
- {
- $do_email = $content['do_email'];
-
- if (isset($content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes
- {
- list($id) = @each($content['nm']['rows']['delete']);
- $content['nm']['action'] = 'delete';
- $content['nm']['selected'] = array($id);
- }
- if (isset($content['nm']['rows']['document'])) // handle insert in default document button like an action
- {
- list($id) = @each($content['nm']['rows']['document']);
- $content['nm']['action'] = 'document';
- $content['nm']['selected'] = array($id);
- }
- if ($content['nm']['action'] !== '' && $content['nm']['action'] !== null)
- {
- if (!count($content['nm']['selected']) && !$content['nm']['select_all'] && $content['nm']['action'] != 'delete_list')
+ //echo "
uicontacts::index(".print_r($_content,true).",'$msg')
\n";
+ if (($re_submit = is_array($_content)))
+ {
+ $do_email = $_content['do_email'];
+
+ if (isset($_content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes
+ {
+ list($id) = @each($_content['nm']['rows']['delete']);
+ $_content['nm']['action'] = 'delete';
+ $_content['nm']['selected'] = array($id);
+ }
+ if (isset($_content['nm']['rows']['document'])) // handle insert in default document button like an action
+ {
+ list($id) = @each($_content['nm']['rows']['document']);
+ $_content['nm']['action'] = 'document';
+ $_content['nm']['selected'] = array($id);
+ }
+ if ($_content['nm']['action'] !== '' && $_content['nm']['action'] !== null)
+ {
+ if (!count($_content['nm']['selected']) && !$_content['nm']['select_all'] && $_content['nm']['action'] != 'delete_list')
{
$msg = lang('You need to select some contacts first');
}
- elseif ($content['nm']['action'] == 'view_org') // org-view via context menu
- {
- $content['nm']['org_view'] = array_shift($content['nm']['selected']);
+ elseif ($_content['nm']['action'] == 'view_org') // org-view via context menu
+ {
+ $_content['nm']['org_view'] = array_shift($_content['nm']['selected']);
}
else
{
- if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
- $success,$failed,$action_msg,$content['do_email'] ? 'email' : 'index',$msg,$content['nm']['checkboxes']))
+ $success = $failed = $action_msg = null;
+ if ($this->action($_content['nm']['action'],$_content['nm']['selected'],$_content['nm']['select_all'],
+ $success,$failed,$action_msg,$_content['do_email'] ? 'email' : 'index',$msg,$_content['nm']['checkboxes']))
{
$msg .= lang('%1 contact(s) %2',$success,$action_msg);
- egw_framework::message($msg);
+ Framework::message($msg);
}
elseif(is_null($msg))
{
$msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
- egw_framework::message($msg,'error');
+ Framework::message($msg,'error');
}
$msg = '';
}
}
- if ($content['nm']['rows']['infolog'])
- {
- list($org) = each($content['nm']['rows']['infolog']);
+ if ($_content['nm']['rows']['infolog'])
+ {
+ list($org) = each($_content['nm']['rows']['infolog']);
return $this->infolog_org_view($org);
}
- if ($content['nm']['rows']['view']) // show all contacts of an organisation
- {
- list($org_view) = each($content['nm']['rows']['view']);
+ if ($_content['nm']['rows']['view']) // show all contacts of an organisation
+ {
+ list($org_view) = each($_content['nm']['rows']['view']);
}
else
{
- $org_view = $content['nm']['org_view'];
- }
- $typeselection = $content['nm']['col_filter']['tid'];
+ $org_view = $_content['nm']['org_view'];
+ }
+ $typeselection = $_content['nm']['col_filter']['tid'];
}
elseif($_GET['add_list'])
{
@@ -197,14 +204,14 @@
$preserv = array(
'do_email' => $do_email,
);
- $to = $content['nm']['to'];
+ $to = $_content['nm']['to'];
$content = array();
if($msg || $_GET['msg'])
{
- egw_framework::message($msg ? $msg : $_GET['msg']);
- }
-
- $content['nm'] = egw_session::appsession($do_email ? 'email' : 'index','addressbook');
+ Framework::message($msg ? $msg : $_GET['msg']);
+ }
+
+ $content['nm'] = Api\Cache::getSession('addressbook', $do_email ? 'email' : 'index');
if (!is_array($content['nm']))
{
$content['nm'] = array(
@@ -257,7 +264,7 @@
$sel_options['cat_id'] = array('' => lang('All categories'), '0' => lang('None'));
// Edit and delete list actions depends on permissions
- if($this->get_lists(EGW_ACL_EDIT))
+ if($this->get_lists(Acl::EDIT))
{
$content['nm']['placeholder_actions'][] = 'rename_list';
$content['nm']['placeholder_actions'][] = 'delete_list';
@@ -270,10 +277,10 @@
if (isset($typeselection)) $content['nm']['col_filter']['tid'] = $typeselection;
// save the tid for use in creating new addressbook entrys via UI. Current tid is to be used as type of new entrys
//error_log(__METHOD__.__LINE__.' '.$content['nm']['col_filter']['tid']);
- egw_cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']);
+ Api\Cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']);
if ($this->lists_available())
{
- $sel_options['filter2'] = $this->get_lists(EGW_ACL_READ,array('' => lang('No distribution list')));
+ $sel_options['filter2'] = $this->get_lists(Acl::READ,array('' => lang('No distribution list')));
$sel_options['filter2']['add'] = lang('Add a new list').'...'; // put it at the end
}
if ($do_email)
@@ -296,13 +303,13 @@
{
$content['nm']['header_left'] = 'addressbook.index.left';
}
- $sel_options['filter'] = $sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ, lang('All addressbooks'));
+ $sel_options['filter'] = $sel_options['owner'] = $this->get_addressbooks(Acl::READ, lang('All addressbooks'));
$sel_options['to'] = array(
'to' => 'To',
'cc' => 'Cc',
'bcc' => 'Bcc',
);
- $sel_options['adr_one_countrycode']['-custom-'] = lang('No country selected');
+ $sel_options['adr_one_countrycode']['-custom-'] = lang('No Api\Country selected');
// if there is any export limit set, pass it on to the nextmatch, to be evaluated by the export
if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit']=$this->config['contact_export_limit'];
@@ -351,17 +358,16 @@
$this->tmpl->read($do_email ? 'addressbook.email' : 'addressbook.index');
return $this->tmpl->exec($do_email ? 'addressbook.addressbook_ui.emailpopup' : 'addressbook.addressbook_ui.index',
- $content,$sel_options,$readonlys,$preserv,$do_email ? 2 : 0);
+ $content,$sel_options,array(),$preserv,$do_email ? 2 : 0);
}
/**
* Get actions / context menu items
*
- * @param string $tid_filter=null
- * @param string $org_view=null
- * @return array see nextmatch_widget::get_actions()
+ * @param string $tid_filter =null
+ * @return array see Etemplate\Widget\Nextmatch::get_actions()
*/
- public function get_actions($tid_filter=null, $org_view=null)
+ public function get_actions($tid_filter=null)
{
// Contact view
$actions = array(
@@ -384,7 +390,7 @@
'disableClass' => 'contact_organisation',
'hideOnDisabled' => true,
'url' => 'menuaction=addressbook.addressbook_ui.edit&contact_id=$id',
- 'popup' => egw_link::get_registry('addressbook', 'edit_popup'),
+ 'popup' => Link::get_registry('addressbook', 'edit_popup'),
'group' => $group,
),
'add' => array(
@@ -396,13 +402,13 @@
'new' => array(
'caption' => 'New',
'url' => 'menuaction=addressbook.addressbook_ui.edit',
- 'popup' => egw_link::get_registry('addressbook', 'add_popup'),
+ 'popup' => Link::get_registry('addressbook', 'add_popup'),
'icon' => 'new',
),
'copy' => array(
'caption' => 'Copy',
'url' => 'menuaction=addressbook.addressbook_ui.edit&makecp=1&contact_id=$id',
- 'popup' => egw_link::get_registry('addressbook', 'add_popup'),
+ 'popup' => Link::get_registry('addressbook', 'add_popup'),
'allowOnMultiple' => false,
'icon' => 'copy',
),
@@ -445,7 +451,7 @@
'disableClass' => 'contact_contact',
'hideOnDisabled' => true,
'url' => 'menuaction=addressbook.addressbook_ui.edit&org=$id',
- 'popup' => egw_link::get_registry('addressbook', 'add_popup'),
+ 'popup' => Link::get_registry('addressbook', 'add_popup'),
),
);
@@ -455,16 +461,16 @@
'caption' => 'Categories',
'group' => $group,
'children' => array(
- 'cat_add' => nextmatch_widget::category_action(
+ 'cat_add' => Etemplate\Widget\Nextmatch::category_action(
'addressbook',$group,'Add category', 'cat_add_',
- true, 0,nextmatch_widget::DEFAULT_MAX_MENU_LENGTH,false
+ true, 0,Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH,false
)+array(
'icon' => 'foldertree_nolines_plus',
'disableClass' => 'rowNoEdit',
),
- 'cat_del' => nextmatch_widget::category_action(
+ 'cat_del' => Etemplate\Widget\Nextmatch::category_action(
'addressbook',$group,'Delete category', 'cat_del_',
- true, 0,nextmatch_widget::DEFAULT_MAX_MENU_LENGTH,false
+ true, 0,Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH,false
)+array(
'icon' => 'foldertree_nolines_minus',
'disableClass' => 'rowNoEdit',
@@ -484,7 +490,7 @@
),
'group' => $group,
);
- if (($add_lists = $this->get_lists(EGW_ACL_EDIT))) // do we have distribution lists?, and are we allowed to edit them
+ if (($add_lists = $this->get_lists(Acl::EDIT))) // do we have distribution lists?, and are we allowed to edit them
{
$actions['lists']['children'] += array(
'to_list' => array(
@@ -528,11 +534,12 @@
}
}
// move to AB
- if (($move2addressbooks = $this->get_addressbooks(EGW_ACL_ADD))) // do we have addressbooks, we should
+ if (($move2addressbooks = $this->get_addressbooks(Acl::ADD))) // do we have addressbooks, we should
{
unset($move2addressbooks[0]); // do not offer action to move contact to an account, as we dont support that currrently
foreach($move2addressbooks as $owner => $label)
{
+ $icon = $type_label = null;
$this->type_icon((int)$owner, substr($owner,-1) == 'p', 'n', $icon, $type_label);
$move2addressbooks[$owner] = array(
'icon' => $icon,
@@ -583,7 +590,7 @@
'caption' => 'Add a new Infolog',
'icon' => 'new',
'url' => 'menuaction=infolog.infolog_ui.edit&type=task&action=addressbook&action_id=$id',
- 'popup' => egw_link::get_registry('infolog', 'add_popup'),
+ 'popup' => Link::get_registry('infolog', 'add_popup'),
'onExecute' => 'javaScript:app.addressbook.add_task', // call server for org-view only
),
),
@@ -607,7 +614,7 @@
'calendar_add' => array(
'caption' => 'Add appointment',
'icon' => 'new',
- 'popup' => egw_link::get_registry('calendar', 'add_popup'),
+ 'popup' => Link::get_registry('calendar', 'add_popup'),
'onExecute' => 'javaScript:app.addressbook.add_cal',
),
),
@@ -676,7 +683,7 @@
);
}
// check if user is an admin or the export is not generally turned off (contact_export_limit is non-numerical, eg. no)
- $exception = bo_merge::is_export_limit_excepted();
+ $exception = Api\Storage\Merge::is_export_limit_excepted();
if ((isset($GLOBALS['egw_info']['user']['apps']['admin']) || $exception) || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit'])
{
$actions['export'] = array(
@@ -693,7 +700,7 @@
'vcard' => array(
'caption' => 'Export as VCard',
'postSubmit' => true, // download needs post submit (not Ajax) to work
- 'icon' => egw_vfs::mime_icon('text/vcard'),
+ 'icon' => Vfs::mime_icon('text/vcard'),
),
),
'hideOnMobile' => true
@@ -727,7 +734,7 @@
'disableClass' => 'rowNoDelete',
);
}
- if ($this->grants[0] & EGW_ACL_DELETE)
+ if ($this->grants[0] & Acl::DELETE)
{
$actions['delete_account'] = array(
'caption' => 'Delete',
@@ -752,7 +759,7 @@
if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook','export')) unset($actions['export']['children']['csv']);
// Intercept op