From aa45c25685feaf076e493019dbcb866c99b97556 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 6 Apr 2016 09:49:50 +0000 Subject: [PATCH] move addressbook_merge to Api\Contacts\Merge --- .../inc/class.addressbook_hooks.inc.php | 35 ++- .../inc/class.addressbook_merge.inc.php | 246 +---------------- addressbook/inc/class.addressbook_ui.inc.php | 6 +- addressbook/merge.php | 4 +- api/src/Contacts/Merge.php | 259 ++++++++++++++++++ api/src/Mail.php | 9 +- api/src/Mail/Account.php | 6 +- api/src/Storage/Merge.php | 2 - 8 files changed, 304 insertions(+), 263 deletions(-) create mode 100644 api/src/Contacts/Merge.php diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index 2960a768af..4de0cc94a6 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @package addressbook * @author Ralf Becker - * @copyright (c) 2006-13 by Ralf Becker + * @copyright (c) 2006-16 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -55,7 +55,7 @@ class addressbook_hooks 'Advanced search' => "javascript:egw_openWindowCentered2('". egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.search'),false). "','_blank',870,480,'yes')", - 'Placeholders' => egw::link('/index.php','menuaction=addressbook.addressbook_merge.show_replacements') + 'Placeholders' => egw::link('/index.php','menuaction=api.EGroupware\\Api\\Contacts\\Merge.show_replacements') ); display_sidebox($appname,lang('Addressbook menu'),$file); } @@ -140,7 +140,7 @@ class addressbook_hooks 'xmlrpc' => True, 'admin' => false, ); - $fileas_options = ExecMethod('addressbook.addressbook_bo.fileas_options'); + $fileas_options = ExecMethod('api.EGroupware\\Api\\Contacts.fileas_options'); $settings['link_title'] = array( 'type' => 'select', 'label' => 'Link title for contacts show', @@ -273,10 +273,11 @@ class addressbook_hooks } catch (Exception $e) { + unset($e); // permission error continue; } - if ($title = $definition->get_title()) + if (($title = $definition->get_title())) { $options[$title] = $title; } @@ -316,10 +317,12 @@ class addressbook_hooks */ static function search_link($location) { + unset($location); // not used, but required by function signature + $links = array( - 'query' => 'addressbook.addressbook_bo.link_query', - 'title' => 'addressbook.addressbook_bo.link_title', - 'titles' => 'addressbook.addressbook_bo.link_titles', + 'query' => 'api.EGroupware\\Api\\Contacts.link_query', + 'title' => 'api.EGroupware\\Api\\Contacts.link_title', + 'titles' => 'api.EGroupware\\Api\\Contacts.link_titles', 'view' => array( 'menuaction' => 'addressbook.addressbook_ui.view', 'ajax' => 'true' @@ -341,12 +344,12 @@ class addressbook_hooks 'add_id' => 'link_id', 'add_popup' => '859x550', 'file_access_user' => true, // file_access supports 4th parameter $user - 'file_access'=> 'addressbook.addressbook_bo.file_access', + 'file_access'=> 'api.EGroupware\\Api\\Contacts.file_access', 'default_types' => array('n' => array('name' => 'contact', 'options' => array('icon' => 'navbar.png','template' => 'addressbook.edit'))), // registers an addtional type 'addressbook-email', returning only contacts with email, title has email appended 'additional' => array( 'addressbook-email' => array( - 'query' => 'addressbook.addressbook_bo.link_query_email', + 'query' => 'api.EGroupware\\Api\\Contacts.link_query_email', 'view' => array( 'menuaction' => 'addressbook.addressbook_ui.view', 'ajax' => 'true' @@ -369,6 +372,8 @@ class addressbook_hooks */ static function getAppExportLimit($location) { + unset($location); // not used, but required by function signature + return $GLOBALS['egw_info']['server']['contact_export_limit']; } @@ -380,9 +385,11 @@ class addressbook_hooks */ static function calendar_resources($args) { + unset($args); // not used, but required by function signature + return array( 'type' => 'c',// one char type-identifiy for this resources - 'info' => 'addressbook.addressbook_bo.calendar_info',// info method, returns array with id, type & name for a given id + 'info' => 'api.EGroupware\\Api\\Contacts.calendar_info',// info method, returns array with id, type & name for a given id ); } @@ -394,6 +401,8 @@ class addressbook_hooks */ static function group_acl($args) { + unset($args); // not used, but required by function signature + // addressbook uses group-acl, only if contacts-backend is NOT LDAP, as the ACL can not be modified there return $GLOBALS['egw_info']['server']['contact_repository'] != 'ldap'; } @@ -406,6 +415,8 @@ class addressbook_hooks */ static function not_enum_group_acls($data) { + unset($data); // not used, but required by function signature + return true; } @@ -417,6 +428,8 @@ class addressbook_hooks */ public static function acl_rights($params) { + unset($params); // not used, but required by function signature + return array( acl::READ => 'read', acl::EDIT => 'edit', @@ -433,6 +446,8 @@ class addressbook_hooks */ public static function categories($data) { + unset($data); // not used, but required by function signature + return true; } diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index eb191898d5..3835bcc1d6 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -4,248 +4,18 @@ * * @link http://www.egroupware.org * @author Ralf Becker - * @package addressbook - * @copyright (c) 2007-9 by Ralf Becker + * @package api + * @subpackage contacts + * @copyright (c) 2007-16 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ +use EGroupware\Api\Contacts\Merge; + /** * Addressbook - document merge object + * + * @deprecated use Api\Contacts\Merge */ -class addressbook_merge extends bo_merge -{ - /** - * Functions that can be called via menuaction - * - * @var array - */ - var $public_functions = array( - 'download_by_request' => true, - 'show_replacements' => true, - ); - - /** - * Constructor - * - * @return addressbook_merge - */ - function __construct() - { - parent::__construct(); - - // overwrite global export-limit, if an addressbook one is set - $this->export_limit = bo_merge::getExportLimit('addressbook'); - - // switch of handling of html formated content, if html is not used - $this->parse_html_styles = egw_customfields::use_html('addressbook'); - } - - /** - * Get addressbook replacements - * - * @param int $id id of entry - * @param string &$content=null content to create some replacements only if they are use - * @param boolean $ignore_acl =false true: no acl check - * @return array|boolean - */ - protected function get_replacements($id,&$content=null,$ignore_acl=false) - { - if (!($replacements = $this->contact_replacements($id,'',$ignore_acl))) - { - return false; - } - if($content && strpos($content, '$$#') !== 0) - { - $this->cf_link_to_expand($this->contacts->read($id, $ignore_acl), $content, $replacements,'addressbook'); - } - - // Links - $replacements += $this->get_all_links('addressbook', $id, '', $content); - if (!(strpos($content,'$$calendar/') === false)) - { - $replacements += $this->calendar_replacements($id,!(strpos($content,'$$calendar/-1/') === false)); - } - return $replacements; - } - - /** - * Return replacements for the calendar (next events) of a contact - * - * @param int $id contact-id - * @param boolean $last_event_too =false also include information about the last event - * @return array - */ - protected function calendar_replacements($id,$last_event_too=false) - { - $calendar = new calendar_boupdate(); - - // next events - $events = $calendar->search(array( - 'start' => $calendar->now_su, - 'users' => 'c'.$id, - 'offset' => 0, - 'num_rows' => 20, - 'order' => 'cal_start', - 'enum_recurring' => true - )); - if (!$events) - { - $events = array(); - } - if ($last_event_too==true) - { - $last = $calendar->search(array( - 'end' => $calendar->now_su, - 'users' => 'c'.$id, - 'offset' => 0, - 'num_rows' => 1, - 'order' => 'cal_start DESC', - 'enum_recurring' => true - )); - $events['-1'] = $last ? array_shift($last) : array(); // returned events are indexed by cal_id! - } - $replacements = array(); - $n = 1; // Returned events are indexed by cal_id, need to index sequentially - foreach($events as $key => $event) - { - // Use -1 for previous key - if($key < 0) $n = $key; - - foreach($calendar->event2array($event) as $name => $data) - { - if (substr($name,-4) == 'date') $name = substr($name,0,-4); - $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; - } - foreach(array('start','end') as $what) - { - foreach(array( - 'date' => $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], - 'day' => 'l', - 'time' => $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i', - ) as $name => $format) - { - $value = $event[$what] ? date($format,$event[$what]) : ''; - if ($format == 'l') $value = lang($value); - $replacements['$$calendar/'.$n.'/'.$what.$name.'$$'] = $value; - } - } - $duration = ($event['end'] - $event['start'])/60; - $replacements['$$calendar/'.$n.'/duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); - - ++$n; - } - - // Need to set some keys if there is no previous event - if($last_event_too && count($events['-1']) == 0) { - $replacements['$$calendar/-1/start$$'] = ''; - $replacements['$$calendar/-1/end$$'] = ''; - $replacements['$$calendar/-1/owner$$'] = ''; - $replacements['$$calendar/-1/updated$$'] = ''; - } - return $replacements; - } - - /** - * Generate table with replacements for the preferences - * - */ - public function show_replacements() - { - $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Replacements for inserting contacts into documents'); - $GLOBALS['egw_info']['flags']['nonavbar'] = (bool)$_GET['nonavbar']; - common::egw_header(); - - echo "\n"; - echo '"; - - $n = 0; - foreach($this->contacts->contact_fields as $name => $label) - { - if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. - - if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column - { - echo "\n"; - $n++; - } - if (!($n&1)) echo ''; - echo ''; - if($name == 'cat_id') - { - if ($n&1) echo "\n"; - echo ''; - $n++; - } - if ($n&1) echo "\n"; - $n++; - } - - echo '"; - foreach($this->contacts->customfields as $name => $field) - { - echo '\n"; - } - - echo '"; - foreach(array( - 'link' => lang('HTML link to the current record'), - 'links' => lang('Titles of any entries linked to the current record, excluding attached files'), - 'attachments' => lang('List of files linked to the current record'), - 'links_attachments' => lang('Links and attached files'), - 'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'), - 'date' => lang('Date'), - 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), - 'user/account_lid' => lang('Username'), - 'pagerepeat' => lang('For serial letter use this tag. Put the content, you want to repeat between two Tags.'), - 'label' => lang('Use this tag for addresslabels. Put the content, you want to repeat, between two tags.'), - 'labelplacement' => lang('Tag to mark positions for address labels'), - 'IF fieldname' => lang('Example {{IF n_prefix~Mr~Hello Mr.~Hello Ms.}} - search the field "n_prefix", for "Mr", if found, write Hello Mr., else write Hello Ms.'), - 'NELF' => lang('Example {{NELF role}} - if field role is not empty, you will get a new line with the value of field role'), - 'NENVLF' => lang('Example {{NELFNV role}} - if field role is not empty, set a LF without any value of the field'), - 'LETTERPREFIX' => lang('Example {{LETTERPREFIX}} - Gives a letter prefix without double spaces, if the title is empty for example'), - 'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'), - ) as $name => $label) - { - echo '\n"; - } - - $GLOBALS['egw']->translation->add_app('calendar'); - echo '"; - foreach(array( - 'title' => lang('Title'), - 'description' => lang('Description'), - 'participants' => lang('Participants'), - 'location' => lang('Location'), - 'start' => lang('Start').': '.lang('Date').'+'.lang('Time'), - 'startday' => lang('Start').': '.lang('Weekday'), - 'startdate'=> lang('Start').': '.lang('Date'), - 'starttime'=> lang('Start').': '.lang('Time'), - 'end' => lang('End').': '.lang('Date').'+'.lang('Time'), - 'endday' => lang('End').': '.lang('Weekday'), - 'enddate' => lang('End').': '.lang('Date'), - 'endtime' => lang('End').': '.lang('Time'), - 'duration' => lang('Duration'), - 'category' => lang('Category'), - 'priority' => lang('Priority'), - 'updated' => lang('Updated'), - 'recur_type' => lang('Repetition'), - 'access' => lang('Access').': '.lang('public').', '.lang('private'), - 'owner' => lang('Owner'), - ) as $name => $label) - { - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column - { - echo "\n"; - $n++; - } - if (!($n&1)) echo ''; - echo ''; - if ($n&1) echo "\n"; - $n++; - } - echo "

'.lang('Contact fields:')."

{{'.$name.'}}'.$label.'
{{categories}}'.lang('Category path').'

'.lang('Custom fields').":

{{#'.$name.'}}'.$field['label']."

'.lang('General fields:')."

{{'.$name.'}}'.$label."

'.lang('Calendar fields:')." # = 1, 2, ..., 20, -1

{{calendar/#/'.$name.'}}'.$label.'
\n"; - - common::egw_footer(); - } -} +class addressbook_merge extends Merge {} \ No newline at end of file diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index a715938770..f061fad446 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -12,6 +12,8 @@ * @version $Id$ */ +use EGroupware\Api; + /** * General user interface object of the adressbook */ @@ -698,7 +700,7 @@ class addressbook_ui extends addressbook_bo ); } - $actions['documents'] = addressbook_merge::document_action( + $actions['documents'] = Api\Contacts\Merge::document_action( $this->prefs['document_dir'], $group, 'Insert in document', 'document_', $this->prefs['default_document'], $this->config['contact_export_limit'] ); @@ -1082,7 +1084,7 @@ window.egw_LAB.wait(function() { case 'document': if (!$document) $document = $this->prefs['default_document']; - $document_merge = new addressbook_merge(); + $document_merge = new Api\Contacts\Merge(); $msg = $document_merge->download($document, $checked, '', $this->prefs['document_dir']); $failed = count($checked); return false; diff --git a/addressbook/merge.php b/addressbook/merge.php index f0de46d862..7cf511afe7 100644 --- a/addressbook/merge.php +++ b/addressbook/merge.php @@ -27,6 +27,8 @@ * @version $Id$ */ +use EGroupware\Api\Contacts\Merge; + $GLOBALS['egw_info'] = array( 'flags' => array( 'noheader' => True, @@ -40,7 +42,7 @@ $GLOBALS['egw_info'] = array( $egw_dir = dirname(dirname(__FILE__)); include($egw_dir.'/header.inc.php'); -$merge = new addressbook_merge(); +$merge = new Merge(); if (!isset($_REQUEST['ids']) && isset($_REQUEST['search'])) { diff --git a/api/src/Contacts/Merge.php b/api/src/Contacts/Merge.php new file mode 100644 index 0000000000..119dbcb310 --- /dev/null +++ b/api/src/Contacts/Merge.php @@ -0,0 +1,259 @@ + + * @package api + * @subpackage contacts + * @copyright (c) 2007-16 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +namespace EGroupware\Api\Contacts; + +use EGroupware\Api; + +// explicit import not namespaced classes +use calendar_boupdate; // we detect if it is not available + +/** + * Contacts document merge + */ +class Merge extends Api\Storage\Merge +{ + /** + * Functions that can be called via menuaction + * + * @var array + */ + var $public_functions = array( + 'download_by_request' => true, + 'show_replacements' => true, + ); + + /** + * Constructor + */ + function __construct() + { + parent::__construct(); + + // overwrite global export-limit, if an addressbook one is set + $this->export_limit = self::getExportLimit('addressbook'); + + // switch of handling of html formated content, if html is not used + $this->parse_html_styles = Api\Storage\Customfields::use_html('addressbook'); + } + + /** + * Get addressbook replacements + * + * @param int $id id of entry + * @param string &$content=null content to create some replacements only if they are use + * @param boolean $ignore_acl =false true: no acl check + * @return array|boolean + */ + protected function get_replacements($id,&$content=null,$ignore_acl=false) + { + if (!($replacements = $this->contact_replacements($id,'',$ignore_acl))) + { + return false; + } + if($content && strpos($content, '$$#') !== 0) + { + $this->cf_link_to_expand($this->contacts->read($id, $ignore_acl), $content, $replacements,'addressbook'); + } + + // Links + $replacements += $this->get_all_links('addressbook', $id, '', $content); + if (!(strpos($content,'$$calendar/') === false)) + { + $replacements += $this->calendar_replacements($id,!(strpos($content,'$$calendar/-1/') === false)); + } + return $replacements; + } + + /** + * Return replacements for the calendar (next events) of a contact + * + * @param int $id contact-id + * @param boolean $last_event_too =false also include information about the last event + * @return array + */ + protected function calendar_replacements($id,$last_event_too=false) + { + if (!class_exists('calendar_boupdate')) return array(); + + $calendar = new calendar_boupdate(); + + // next events + $events = $calendar->search(array( + 'start' => $calendar->now_su, + 'users' => 'c'.$id, + 'offset' => 0, + 'num_rows' => 20, + 'order' => 'cal_start', + 'enum_recurring' => true + )); + if (!$events) + { + $events = array(); + } + if ($last_event_too==true) + { + $last = $calendar->search(array( + 'end' => $calendar->now_su, + 'users' => 'c'.$id, + 'offset' => 0, + 'num_rows' => 1, + 'order' => 'cal_start DESC', + 'enum_recurring' => true + )); + $events['-1'] = $last ? array_shift($last) : array(); // returned events are indexed by cal_id! + } + $replacements = array(); + $n = 1; // Returned events are indexed by cal_id, need to index sequentially + foreach($events as $key => $event) + { + // Use -1 for previous key + if($key < 0) $n = $key; + + foreach($calendar->event2array($event) as $name => $data) + { + if (substr($name,-4) == 'date') $name = substr($name,0,-4); + $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; + } + foreach(array('start','end') as $what) + { + foreach(array( + 'date' => $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], + 'day' => 'l', + 'time' => $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i', + ) as $name => $format) + { + $value = $event[$what] ? date($format,$event[$what]) : ''; + if ($format == 'l') $value = lang($value); + $replacements['$$calendar/'.$n.'/'.$what.$name.'$$'] = $value; + } + } + $duration = ($event['end'] - $event['start'])/60; + $replacements['$$calendar/'.$n.'/duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); + + ++$n; + } + + // Need to set some keys if there is no previous event + if($last_event_too && count($events['-1']) == 0) { + $replacements['$$calendar/-1/start$$'] = ''; + $replacements['$$calendar/-1/end$$'] = ''; + $replacements['$$calendar/-1/owner$$'] = ''; + $replacements['$$calendar/-1/updated$$'] = ''; + } + return $replacements; + } + + /** + * Generate table with replacements for the preferences + * + */ + public function show_replacements() + { + $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Replacements for inserting contacts into documents'); + $GLOBALS['egw_info']['flags']['nonavbar'] = (bool)$_GET['nonavbar']; + + ob_start(); + echo "\n"; + echo '"; + + $n = 0; + foreach($this->contacts->contact_fields as $name => $label) + { + if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. + + if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column + { + echo "\n"; + $n++; + } + if (!($n&1)) echo ''; + echo ''; + if($name == 'cat_id') + { + if ($n&1) echo "\n"; + echo ''; + $n++; + } + if ($n&1) echo "\n"; + $n++; + } + + echo '"; + foreach($this->contacts->customfields as $name => $field) + { + echo '\n"; + } + + echo '"; + foreach(array( + 'link' => lang('HTML link to the current record'), + 'links' => lang('Titles of any entries linked to the current record, excluding attached files'), + 'attachments' => lang('List of files linked to the current record'), + 'links_attachments' => lang('Links and attached files'), + 'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'), + 'date' => lang('Date'), + 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), + 'user/account_lid' => lang('Username'), + 'pagerepeat' => lang('For serial letter use this tag. Put the content, you want to repeat between two Tags.'), + 'label' => lang('Use this tag for addresslabels. Put the content, you want to repeat, between two tags.'), + 'labelplacement' => lang('Tag to mark positions for address labels'), + 'IF fieldname' => lang('Example {{IF n_prefix~Mr~Hello Mr.~Hello Ms.}} - search the field "n_prefix", for "Mr", if found, write Hello Mr., else write Hello Ms.'), + 'NELF' => lang('Example {{NELF role}} - if field role is not empty, you will get a new line with the value of field role'), + 'NENVLF' => lang('Example {{NELFNV role}} - if field role is not empty, set a LF without any value of the field'), + 'LETTERPREFIX' => lang('Example {{LETTERPREFIX}} - Gives a letter prefix without double spaces, if the title is empty for example'), + 'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'), + ) as $name => $label) + { + echo '\n"; + } + + Api\Translation::add_app('calendar'); + echo '"; + foreach(array( + 'title' => lang('Title'), + 'description' => lang('Description'), + 'participants' => lang('Participants'), + 'location' => lang('Location'), + 'start' => lang('Start').': '.lang('Date').'+'.lang('Time'), + 'startday' => lang('Start').': '.lang('Weekday'), + 'startdate'=> lang('Start').': '.lang('Date'), + 'starttime'=> lang('Start').': '.lang('Time'), + 'end' => lang('End').': '.lang('Date').'+'.lang('Time'), + 'endday' => lang('End').': '.lang('Weekday'), + 'enddate' => lang('End').': '.lang('Date'), + 'endtime' => lang('End').': '.lang('Time'), + 'duration' => lang('Duration'), + 'category' => lang('Category'), + 'priority' => lang('Priority'), + 'updated' => lang('Updated'), + 'recur_type' => lang('Repetition'), + 'access' => lang('Access').': '.lang('public').', '.lang('private'), + 'owner' => lang('Owner'), + ) as $name => $label) + { + if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column + { + echo "\n"; + $n++; + } + if (!($n&1)) echo ''; + echo ''; + if ($n&1) echo "\n"; + $n++; + } + echo "

'.lang('Contact fields:')."

{{'.$name.'}}'.$label.'
{{categories}}'.lang('Category path').'

'.lang('Custom fields').":

{{#'.$name.'}}'.$field['label']."

'.lang('General fields:')."

{{'.$name.'}}'.$label."

'.lang('Calendar fields:')." # = 1, 2, ..., 20, -1

{{calendar/#/'.$name.'}}'.$label.'
\n"; + + $GLOBALS['egw']->framework->render(ob_get_clean()); + } +} diff --git a/api/src/Mail.php b/api/src/Mail.php index 46d9001cbf..d88e5201b9 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -30,9 +30,6 @@ use Horde_Mime_Mdn; use tidy; -// old not yet converted api classes -use addressbook_merge; // should go to Contacts\Merge - /** * Mail worker class * -provides backend functionality for all classes in Mail @@ -6211,7 +6208,7 @@ class Mail */ static function merge($content,$ids,$mimetype='') { - $mergeobj = new addressbook_merge(); + $mergeobj = new Contacts\Merge(); if (empty($mimetype)) $mimetype = (strlen(strip_tags($content)) == strlen($content) ?'text/plain':'text/html'); $rv = $mergeobj->merge_string($content,$ids,$err='',$mimetype, array(), self::$displayCharset); @@ -6530,7 +6527,7 @@ class Mail /** * importMessageToMergeAndSend * - * @param Storage\Merge bo_merge bo_merge object + * @param Storage\Merge Storage\Merge bo_merge object * @param string $document the full filename * @param array $SendAndMergeTocontacts array of contact ids * @param string& $_folder (passed by reference) will set the folder used. must be set with a folder, but will hold modifications if @@ -6549,7 +6546,7 @@ class Mail } // check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.) - /* as the file is provided by bo_merge, we do not check + /* as the file is provided by Storage\Merge, we do not check try { $tmpFileName = Mail::checkFileBasics($_formData,$importID); diff --git a/api/src/Mail/Account.php b/api/src/Mail/Account.php index a64053d8aa..feaa647cbc 100644 --- a/api/src/Mail/Account.php +++ b/api/src/Mail/Account.php @@ -19,8 +19,6 @@ use EGroupware\Api; use Horde_Imap_Client_Exception; use Horde_Mail_Transport_Smtphorde; -use addressbook_merge; // should go to Contacts\Merge - /** * Mail accounts supports 3 types of accounts: * @@ -638,7 +636,7 @@ class Account implements \ArrayAccess /** * Replace placeholders like {{n_fn}} in an identity * - * For full list of placeholders see addressbook_merge. + * For full list of placeholders see Api\Contacts\Merge. * * @param array|Account $identity * @param int $account_id =null account_id of user, or current user @@ -663,7 +661,7 @@ class Account implements \ArrayAccess if ($to_replace) { static $merge=null; - if (!isset($merge)) $merge = new addressbook_merge(); + if (!isset($merge)) $merge = new Api\Contacts\Merge(); if (!isset($account_id)) $account_id = $GLOBALS['egw_info']['user']['account_id']; foreach($to_replace as $name => &$value) { diff --git a/api/src/Storage/Merge.php b/api/src/Storage/Merge.php index 68128a8955..dda8d2ca82 100644 --- a/api/src/Storage/Merge.php +++ b/api/src/Storage/Merge.php @@ -110,8 +110,6 @@ abstract class Merge /** * Constructor - * - * @return bo_merge */ function __construct() {