WIP multitab:

- fix duplicated sidebox view id
This commit is contained in:
Hadi Nategh 2020-10-21 14:58:19 +02:00
parent d4d63d382e
commit 6a5c6599dd
4 changed files with 21 additions and 8 deletions

View File

@ -38,7 +38,7 @@ class addressbook_hooks
{
display_sidebox($appname, lang('Contact data'), array(
array(
'text' => '<div id="addressbook_'.$_GET['contact_id'].'_view_sidebox" class="addressbook_view_sidebox"/>',
'text' => '<div id="'.self::getViewDOMID($_GET['contact_id'], $_GET['crm_list']).'" class="addressbook_view_sidebox"/>',
'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
*

View File

@ -3149,7 +3149,7 @@ class addressbook_ui extends addressbook_bo
// Load CRM code
Framework::includeJS('.','CRM','addressbook');
$content['view_sidebox'] = 'addressbook_'.$contact_id.'_view_sidebox';
$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'],

View File

@ -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);
});
};
/**
@ -206,7 +208,7 @@ var AddressbookApp = /** @class */ (function (_super) {
this.egw.openTab(id, 'addressbook', 'view', extras, {
displayName: data.n_fn,
icon: data.photo,
id: id
id: id + '_' + extras.crm_list
});
};
/**

View File

@ -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);
});
}
@ -231,7 +231,7 @@ class AddressbookApp extends EgwApp
this.egw.openTab(id, 'addressbook', 'view', extras, {
displayName: data.n_fn,
icon: data.photo,
id: id
id: id+'_'+extras.crm_list
});
}