WIP multitabs and CRM view

This commit is contained in:
Hadi Nategh 2020-09-30 13:19:36 +02:00
parent 9cf0724420
commit 7f4535cf1d
12 changed files with 62 additions and 75 deletions

View File

@ -2742,7 +2742,7 @@ class addressbook_ui extends addressbook_bo
if(is_array($content)) if(is_array($content))
{ {
$button = key($content['button']); $button = key($content['button']);
switch ($content['toolbar'] ? $content['toolbar'] : $button) switch ($button)
{ {
case 'vcard': case 'vcard':
Egw::redirect_link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$content['id']); 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 // make everything not explicit mentioned readonly
$readonlys['__ALL__'] = true; $readonlys['__ALL__'] = true;
$readonlys['photo'] = $readonlys['button[cancel]'] = $readonlys['button[copy]'] = $readonlys['photo'] = $readonlys['button[copy]'] =false;
$readonlys['button[ok]'] = $readonlys['button[more]'] = $readonlys['toolbar'] = false;
foreach(array_keys($this->contact_fields) as $key) foreach(array_keys($this->contact_fields) as $key)
{ {
@ -2945,40 +2944,6 @@ class addressbook_ui extends addressbook_bo
// dont show an app-header // dont show an app-header
$GLOBALS['egw_info']['flags']['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 // always show sidebox, as it contains contact-data
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);

View File

@ -227,20 +227,22 @@ var AddressbookApp = /** @class */ (function (_super) {
* *
* @param {object} _action * @param {object} _action
*/ */
AddressbookApp.prototype.view_actions = function (_action) { AddressbookApp.prototype.view_actions = function (_action, _widget) {
var id = this.et2.getArrayMgr('content').data.id; var app_id = _widget.dom_id.split('_');
switch (_action.id) { var et2 = etemplate2_1.etemplate2.getById(app_id[0]);
case 'open': var id = et2.widgetContainer.getArrayMgr('content').data.id;
switch (_widget.id) {
case 'button[edit]':
this.egw.open(id, 'addressbook', 'edit'); this.egw.open(id, 'addressbook', 'edit');
break; break;
case 'copy': case 'button[copy]':
this.egw.open(id, 'addressbook', 'edit', { makecp: 1 }); this.egw.open(id, 'addressbook', 'edit', { makecp: 1 });
break; break;
case 'cancel': case 'button[delete]':
this.egw.open(null, 'addressbook', 'list', null, '_self', 'addressbook'); et2_dialog.confirm(_widget, egw.lang('Delete this contact?'), egw.lang('Delete'));
break; break;
default: // submit all other buttons back to server default: // submit all other buttons back to server
this.et2._inst.submit(); et2.widgetContainer._inst.submit();
break; break;
} }
}; };

View File

@ -258,23 +258,26 @@ class AddressbookApp extends EgwApp
* *
* @param {object} _action * @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'); this.egw.open(id, 'addressbook', 'edit');
break; break;
case 'copy': case 'button[copy]':
this.egw.open(id, 'addressbook', 'edit', { makecp: 1}); this.egw.open(id, 'addressbook', 'edit', { makecp: 1});
break; break;
case 'cancel': case 'button[delete]':
this.egw.open(null, 'addressbook', 'list', null, '_self', 'addressbook'); et2_dialog.confirm(_widget, egw.lang('Delete this contact?'), egw.lang('Delete'));
break; break;
default: // submit all other buttons back to server default: // submit all other buttons back to server
this.et2._inst.submit(); et2.widgetContainer._inst.submit();
break; break;
} }
} }

View File

@ -13,7 +13,7 @@ td.addressbook_sidebox_header {
height: 20px; height: 20px;
vertical-align: bottom; vertical-align: bottom;
} }
#addressbook-view.et2_container { form[id^=addressbook-view].et2_container {
height: 0 !important; height: 0 !important;
} }
td.addressbook_sidebox_toolbar { td.addressbook_sidebox_toolbar {

View File

@ -51,7 +51,11 @@
<url id="url" readonly="true"/> <url id="url" readonly="true"/>
</row> </row>
<row> <row>
<toolbar class="addressbook_sidebox_toolbar" id="toolbar" span="2" view_range="1" default_execute="app.addressbook.view_actions"/> <hbox>
<button id="button[edit]" label="open" background_image="1" image="edit" onclick="app.addressbook.view_actions"/>
<button id="button[copy]" label="copy" background_image="1" image="copy" onclick="app.addressbook.view_actions"/>
<buttononly id="button[delete]" label="delete" image="delete" onclick="app.addressbook.view_actions"/>
</hbox>
</row> </row>
</rows> </rows>
</grid> </grid>

View File

@ -27,7 +27,7 @@ td.addressbook_sidebox_header {
height: 20px; height: 20px;
vertical-align: bottom; vertical-align: bottom;
} }
#addressbook-view.et2_container { form[id^=addressbook-view].et2_container {
height: 0 !important; height: 0 !important;
} }
td.addressbook_sidebox_toolbar { td.addressbook_sidebox_toolbar {
@ -200,22 +200,22 @@ select#addressbook-index_col_filter\[tid\] {
vertical-align: top; vertical-align: top;
margin-right: 5px; margin-right: 5px;
} }
div.addressbook_view_sidebox #addressbook-view_n_fn { div.addressbook_view_sidebox .addressbook_sidebox_name {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
width: 85%; width: 85%;
} }
div.addressbook_view_sidebox #addressbook-view_org_name { div.addressbook_view_sidebox .addressbook_sidebox_org {
font-size: 14px; font-size: 14px;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
width: 85%; width: 85%;
} }
div.addressbook_view_sidebox #addressbook-view_org_unit { div.addressbook_view_sidebox span[id^=addressbook-view-addressbook][id$=_org_unit] {
font-size: 11px; font-size: 11px;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
} }
div.addressbook_view_sidebox #addressbook-view_adr_one_locality { div.addressbook_view_sidebox span[id^=addressbook-view-addressbook][id$=_adr_one_locality] {
font-size: 11px; font-size: 11px;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
} }

View File

@ -53,25 +53,25 @@
margin-right: 5px; margin-right: 5px;
} }
// name // name
#addressbook-view_n_fn { .addressbook_sidebox_name {
.fontsize_xl; .fontsize_xl;
font-weight: bold; font-weight: bold;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
width: 85%; width: 85%;
} }
// org // org
#addressbook-view_org_name { .addressbook_sidebox_org {
.fontsize_xl; .fontsize_xl;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
width: 85%; width: 85%;
} }
// Unit // Unit
#addressbook-view_org_unit { span[id^=addressbook-view-addressbook][id $=_org_unit] {
.fontsize_m; .fontsize_m;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
} }
// Ort // Ort
#addressbook-view_adr_one_locality { span[id^=addressbook-view-addressbook][id $=_adr_one_locality] {
.fontsize_m; .fontsize_m;
padding: 2px 0 2px 0; padding: 2px 0 2px 0;
} }

View File

@ -84,7 +84,7 @@ var egw_app_1 = require("../jsapi/egw_app");
* @param _menuaction is the URL to which the form data should be submitted. * @param _menuaction is the URL to which the form data should be submitted.
*/ */
var etemplate2 = /** @class */ (function () { var etemplate2 = /** @class */ (function () {
function etemplate2(_container, _menuaction) { function etemplate2(_container, _menuaction, _uniqueId) {
if (typeof _menuaction == "undefined") { if (typeof _menuaction == "undefined") {
_menuaction = "EGroupware\\Api\\Etemplate::ajax_process_content"; _menuaction = "EGroupware\\Api\\Etemplate::ajax_process_content";
} }
@ -92,7 +92,7 @@ var etemplate2 = /** @class */ (function () {
this._DOMContainer = _container; this._DOMContainer = _container;
this.menuaction = _menuaction; this.menuaction = _menuaction;
// Unique ID to prevent DOM collisions across multiple templates // Unique ID to prevent DOM collisions across multiple templates
this.uniqueId = _container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : ''; this.uniqueId = _uniqueId ? _uniqueId : (_container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '');
/** /**
* Preset the object variable * Preset the object variable
* @type {et2_container} * @type {et2_container}
@ -1013,6 +1013,7 @@ var etemplate2 = /** @class */ (function () {
else { else {
// Not etemplate // Not etemplate
var node = document.getElementById(data.DOMNodeID); var node = document.getElementById(data.DOMNodeID);
var uniqueId = '';
if (node) { if (node) {
if (node.children.length) { if (node.children.length) {
// Node has children already? Check for loading over an // Node has children already? Check for loading over an
@ -1021,7 +1022,10 @@ var etemplate2 = /** @class */ (function () {
if (old) if (old)
old.clear(); old.clear();
} }
var et2 = new etemplate2(node, data.menuaction); if (data['open_target']) {
uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target'];
}
var et2 = new etemplate2(node, data.menuaction, uniqueId);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']); et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true; return true;
} }

View File

@ -112,7 +112,7 @@ export class etemplate2
private app_obj: EgwApp; private app_obj: EgwApp;
app: string; app: string;
constructor(_container : HTMLElement, _menuaction? : string) constructor(_container : HTMLElement, _menuaction? : string, _uniqueId?: string)
{ {
if (typeof _menuaction == "undefined") if (typeof _menuaction == "undefined")
{ {
@ -124,7 +124,7 @@ export class etemplate2
this.menuaction = _menuaction; this.menuaction = _menuaction;
// Unique ID to prevent DOM collisions across multiple templates // Unique ID to prevent DOM collisions across multiple templates
this.uniqueId = _container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : ''; this.uniqueId = _uniqueId ? _uniqueId : (_container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '');
/** /**
* Preset the object variable * Preset the object variable
@ -1302,6 +1302,7 @@ export class etemplate2
{ {
// Not etemplate // Not etemplate
const node = document.getElementById(data.DOMNodeID); const node = document.getElementById(data.DOMNodeID);
let uniqueId = '';
if (node) if (node)
{ {
if (node.children.length) if (node.children.length)
@ -1311,7 +1312,11 @@ export class etemplate2
const old = etemplate2.getById(node.id); const old = etemplate2.getById(node.id);
if (old) old.clear(); if (old) old.clear();
} }
const et2 = new etemplate2(node, data.menuaction); if (data['open_target'])
{
uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target'];
}
const et2 = new etemplate2(node, data.menuaction, uniqueId);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']); et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true; return true;
} }

View File

@ -680,9 +680,10 @@ var fw_base = (function(){ "use strict"; return Class.extend(
var app = this.parseAppFromUrl(_link); var app = this.parseAppFromUrl(_link);
if (app) if (app)
{ {
var appname = app.appName+":"+(_extra.id ? _extra.id : btoa(_link)); var appname = app.appName+"-"+(_extra.id ? _extra.id : btoa(_link));
var self = this;
// add target flag // add target flag
_link += '&target='+appname; _link += '&fw_target='+appname;
// create an actual clone of existing app object // create an actual clone of existing app object
this.applications[appname] = jQuery.extend(true, {}, app); this.applications[appname] = jQuery.extend(true, {}, app);
// merge extra framework app data into the new one // merge extra framework app data into the new one
@ -693,7 +694,9 @@ var fw_base = (function(){ "use strict"; return Class.extend(
this.applications[appname]['browser'] = null; // must be rest to create a new browser content this.applications[appname]['browser'] = null; // must be rest to create a new browser content
this.applications[appname]['sidemenuEntry'] = this.sidemenuUi.addEntry( this.applications[appname]['sidemenuEntry'] = this.sidemenuUi.addEntry(
this.applications[appname].displayName, this.applications[appname].icon, this.applications[appname].displayName, this.applications[appname].icon,
this.applicationClickCallback, this.applications[appname], appname); function(){
self.applicationTabNavigate(self.applications[appname], _link, false, -1, null);
}, this.applications[appname], appname);
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null); this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);

View File

@ -527,7 +527,8 @@ class Etemplate extends Etemplate\Widget\Template
$this->version=$version, $this->laod_via = $load_via); $this->version=$version, $this->laod_via = $load_via);
//error_log(__METHOD__."('$name', '$template_set', '$lang', $group, '$version', '$load_via') rel_path=".array2string($this->rel_path)); //error_log(__METHOD__."('$name', '$template_set', '$lang', $group, '$version', '$load_via') rel_path=".array2string($this->rel_path));
$this->dom_id = $name; $this->dom_id = isset($_GET['fw_target']) && preg_match('/^[a-z0-9-]+$/i', $_GET['fw_target']) ?
$name.'-'.$_GET['fw_target'] : $name;
return (boolean)$this->rel_path; return (boolean)$this->rel_path;
} }

View File

@ -1007,7 +1007,7 @@ abstract class Ajax extends Api\Framework
$GLOBALS['egw']->framework->response->call('egw.set_preferences', $GLOBALS['egw']->framework->response->call('egw.set_preferences',
(array)$GLOBALS['egw_info']['user']['preferences'][$app], $app); (array)$GLOBALS['egw_info']['user']['preferences'][$app], $app);
// flag to indicate target of output e.g. _tab // flag to indicate target of output e.g. _tab
if ($_GET['target']) $GLOBALS['egw']->framework->set_extra('open','target',$_GET['target']); if ($_GET['fw_target']) $GLOBALS['egw']->framework->set_extra('open','target',$_GET['fw_target']);
// call application menuaction // call application menuaction
ob_start(); ob_start();
$obj->$method(); $obj->$method();