diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index cf8b116949..e9cb286f16 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -38,7 +38,7 @@ class addressbook_hooks { display_sidebox($appname, lang('Contact data'), array( array( - 'text' => '
', + 'text' => '
', 'no_lang' => true, 'link' => false, 'icon' => false, @@ -102,6 +102,17 @@ class addressbook_hooks } } + /** + * Generate unique Id for addressbook view sidebox + * @param $contact_id + * @param $view + * @return string + */ + static function getViewDOMID($contact_id, $view) + { + return 'addressbook_'.$contact_id.'_'.$view.'_view_sidebox'; + } + /** * populates $settings for the Api\Preferences * @@ -352,7 +363,9 @@ class addressbook_hooks 'titles' => 'api.EGroupware\\Api\\Contacts.link_titles', 'view' => array( 'menuaction' => 'addressbook.addressbook_ui.view', - 'ajax' => 'true' + 'ajax' => 'true', + 'target' => 'tab', + 'crm_list' => 'infolog' ), 'view_id' => 'contact_id', 'list' => array( diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index bfbbecf8f8..85e244ee44 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -2742,7 +2742,7 @@ class addressbook_ui extends addressbook_bo if(is_array($content)) { $button = key($content['button']); - switch ($content['toolbar'] ? $content['toolbar'] : $button) + switch ($button) { case 'vcard': Egw::redirect_link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$content['id']); @@ -2844,8 +2844,7 @@ class addressbook_ui extends addressbook_bo // make everything not explicit mentioned readonly $readonlys['__ALL__'] = true; - $readonlys['photo'] = $readonlys['button[cancel]'] = $readonlys['button[copy]'] = - $readonlys['button[ok]'] = $readonlys['button[more]'] = $readonlys['toolbar'] = false; + $readonlys['photo'] = $readonlys['button[copy]'] =false; foreach(array_keys($this->contact_fields) as $key) { @@ -2945,40 +2944,6 @@ class addressbook_ui extends addressbook_bo // dont show an app-header $GLOBALS['egw_info']['flags']['app_header'] = ''; - $actions = array( - 'open' => array( - 'caption' => 'Open', - 'toolbarDefault' => true, - ), - 'copy' => 'Copy', - 'delete' => array( - 'caption' => 'Delete', - 'confirm' => 'Delete this entry', - ), - 'cancel' => array( - 'caption' => 'Cancel', - 'toolbarDefault' => true, - 'icon' => 'close' - ), - 'back' => array( - 'caption' => 'Back', - 'toolbarDefault' => true, - ), - 'next' => array( - 'caption' => 'Next', - 'toolbarDefault' => true, - ), - ); - if (!isset($content['index']) || !$content['index']) - { - unset($actions['back']); - } - if (!isset($content['index']) || $content['index'] >= $num_rows-1) - { - unset($actions['next']); - } - $this->tmpl->setElementAttribute('toolbar', 'actions', $actions); - // always show sidebox, as it contains contact-data unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); @@ -2987,7 +2952,7 @@ class addressbook_ui extends addressbook_bo // Load CRM code Framework::includeJS('.','CRM','addressbook'); - + $content['view_sidebox'] = addressbook_hooks::getViewDOMID($contact_id, $crm_list); $this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array( 'id' => $content['id'], 'index' => $content['index'], diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 69b4ad0ceb..5b4c23cb19 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -90,10 +90,12 @@ var AddressbookApp = /** @class */ (function (_super) { break; } jQuery('select[id*="adr_one_countrycode"]').each(function () { - app.addressbook.show_custom_country(this); + if (app.addressbook) + app.addressbook.show_custom_country(this); }); jQuery('select[id*="adr_two_countrycode"]').each(function () { - app.addressbook.show_custom_country(this); + if (app.addressbook) + app.addressbook.show_custom_country(this); }); }; /** @@ -198,11 +200,27 @@ var AddressbookApp = /** @class */ (function (_super) { var extras = { index: index }; + var data = egw.dataGetUIDdata(_senders[0].id)['data']; // CRM list if (_action.id != 'view') { extras.crm_list = _action.id.replace('view-', ''); } - this.egw.open(id, 'addressbook', 'view', extras, '_self', 'addressbook'); + this.egw.openTab(id, 'addressbook', 'view', extras, { + displayName: (_action.id.match(/\-organisation/) && data.org_name != "") ? data.org_name + : data.n_fn + " (" + egw.lang(extras.crm_list) + ")", + icon: data.photo, + refreshCallback: this.view_refresh, + id: id + '-' + extras.crm_list, + }); + }; + /** + * callback for refreshing relative crm view list + */ + AddressbookApp.prototype.view_refresh = function () { + var et2 = etemplate2_1.etemplate2.getById("addressbook-view-" + this.appName); + if (et2) { + et2.app_obj.addressbook.view_set_list(); + } }; /** * Set link filter for the already open & rendered list @@ -222,20 +240,22 @@ var AddressbookApp = /** @class */ (function (_super) { * * @param {object} _action */ - AddressbookApp.prototype.view_actions = function (_action) { - var id = this.et2.getArrayMgr('content').data.id; - switch (_action.id) { - case 'open': + AddressbookApp.prototype.view_actions = function (_action, _widget) { + var app_id = _widget.dom_id.split('_'); + var et2 = etemplate2_1.etemplate2.getById(app_id[0]); + var id = et2.widgetContainer.getArrayMgr('content').data.id; + switch (_widget.id) { + case 'button[edit]': this.egw.open(id, 'addressbook', 'edit'); break; - case 'copy': + case 'button[copy]': this.egw.open(id, 'addressbook', 'edit', { makecp: 1 }); break; - case 'cancel': - this.egw.open(null, 'addressbook', 'list', null, '_self', 'addressbook'); + case 'button[delete]': + et2_dialog.confirm(_widget, egw.lang('Delete this contact?'), egw.lang('Delete')); break; default: // submit all other buttons back to server - this.et2._inst.submit(); + et2.widgetContainer._inst.submit(); break; } }; @@ -1202,4 +1222,4 @@ var AddressbookApp = /** @class */ (function (_super) { return AddressbookApp; }(egw_app_1.EgwApp)); app.classes.addressbook = AddressbookApp; -//# sourceMappingURL=app.js.map \ No newline at end of file +//# sourceMappingURL=app.js.map diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts index 90d7356f69..5ab7b659ae 100644 --- a/addressbook/js/app.ts +++ b/addressbook/js/app.ts @@ -92,10 +92,10 @@ class AddressbookApp extends EgwApp } jQuery('select[id*="adr_one_countrycode"]').each(function() { - app.addressbook.show_custom_country(this); + if (app.addressbook) app.addressbook.show_custom_country(this); }); jQuery('select[id*="adr_two_countrycode"]').each(function() { - app.addressbook.show_custom_country(this); + if (app.addressbook) app.addressbook.show_custom_country(this); }); } @@ -221,14 +221,32 @@ class AddressbookApp extends EgwApp var extras : any = { index: index }; - + var data = egw.dataGetUIDdata(_senders[0].id)['data']; // CRM list if(_action.id != 'view') { extras.crm_list = _action.id.replace('view-',''); } - this.egw.open(id, 'addressbook', 'view', extras, '_self', 'addressbook'); + this.egw.openTab(id, 'addressbook', 'view', extras, { + displayName: (_action.id.match(/\-organisation/) && data.org_name != "") ? data.org_name + : data.n_fn+" ("+egw.lang(extras.crm_list)+")", + icon: data.photo, + refreshCallback: this.view_refresh, + id: id+'-'+extras.crm_list, + }); + } + + /** + * callback for refreshing relative crm view list + */ + view_refresh() + { + let et2 = etemplate2.getById("addressbook-view-"+this.appName); + if (et2) + { + et2.app_obj.addressbook.view_set_list(); + } } /** @@ -254,23 +272,26 @@ class AddressbookApp extends EgwApp * * @param {object} _action */ - view_actions(_action) + view_actions(_action, _widget) { - var id = this.et2.getArrayMgr('content').data.id; - switch(_action.id) + var app_id = _widget.dom_id.split('_'); + var et2 = etemplate2.getById(app_id[0]); + var id = et2.widgetContainer.getArrayMgr('content').data.id; + + switch(_widget.id) { - case 'open': + case 'button[edit]': this.egw.open(id, 'addressbook', 'edit'); break; - case 'copy': + case 'button[copy]': this.egw.open(id, 'addressbook', 'edit', { makecp: 1}); break; - case 'cancel': - this.egw.open(null, 'addressbook', 'list', null, '_self', 'addressbook'); + case 'button[delete]': + et2_dialog.confirm(_widget, egw.lang('Delete this contact?'), egw.lang('Delete')); break; default: // submit all other buttons back to server - this.et2._inst.submit(); + et2.widgetContainer._inst.submit(); break; } } diff --git a/addressbook/templates/default/app.css b/addressbook/templates/default/app.css index b68cf3ab3a..0e1cb43c56 100644 --- a/addressbook/templates/default/app.css +++ b/addressbook/templates/default/app.css @@ -13,7 +13,7 @@ td.addressbook_sidebox_header { height: 20px; vertical-align: bottom; } -#addressbook-view.et2_container { +form[id^=addressbook-view].et2_container { height: 0 !important; } td.addressbook_sidebox_toolbar { @@ -140,4 +140,4 @@ select#addressbook-index_col_filter\[tid\] { margin-left: 1px; } .smime_section_border {border-top: 1px solid #e5e5e5;} -.smime_section_border> * {padding-top: 10px;} \ No newline at end of file +.smime_section_border> * {padding-top: 10px;} diff --git a/addressbook/templates/default/view.xet b/addressbook/templates/default/view.xet index 14113a7162..48fddb0f6a 100644 --- a/addressbook/templates/default/view.xet +++ b/addressbook/templates/default/view.xet @@ -3,7 +3,7 @@