Get calendar sidemenu loading into kdots left slot

This commit is contained in:
nathan 2024-05-09 13:14:43 -06:00
parent 2dba426ae6
commit 7ec41f1ca0
3 changed files with 20 additions and 2 deletions

View File

@ -31,6 +31,10 @@ class Etemplate extends Etemplate\Widget\Template
*/
public $sitemgr=false;
/**
* @var array Additional attributes to set on the DOM (eg: slot)
*/
protected $dom_attributes = [];
/**
* Tell egw framework it's ok to call this
*/
@ -264,7 +268,12 @@ class Etemplate extends Etemplate\Widget\Template
}
else
{
$content = '<form target="egw_iframe_autocomplete_helper" action="'.$form_action.'" id="'.$dom_id.'" class="et2_container"></form>'."\n".
$content = '<form target="egw_iframe_autocomplete_helper" action="' . $form_action . '" id="' . $dom_id . '" class="et2_container"' .
array_reduce(array_keys($this->dom_attributes), function ($carry, $key)
{
return "$carry $key=\"" . htmlspecialchars($this->dom_attributes[$key]) . "\"";
}, '') .
'></form>' . "\n" .
'<iframe name="egw_iframe_autocomplete_helper" style="width:0;height:0;position: absolute;visibility:hidden;"></iframe>';
}
$GLOBALS['egw']->framework->response->generic("data", array($content));
@ -582,6 +591,11 @@ class Etemplate extends Etemplate\Widget\Template
$this->dom_id = $new_id;
}
public function set_dom_attributes($dom_attributes)
{
$this->dom_attributes = array_merge($this->dom_attributes, $dom_attributes);
}
/**
* Make sure there's a new request, in case of multiple Etemplates in one call.
* Normally this isn't a problem, but if you've got an etemplate in the sidebox,

View File

@ -536,6 +536,7 @@ class calendar_ui
{
Etemplate::reset_request();
$sidebox = new Etemplate('calendar.sidebox');
$sidebox->set_dom_attributes(['slot' => 'left']);
$cont = $this->cal_prefs['saved_states'];
if (!is_array($cont)) $cont = array();

View File

@ -281,7 +281,10 @@ export class CalendarApp extends EgwApp
case 'calendar.sidebox':
this.sidebox_et2 = _et2.widgetContainer;
this.sidebox_hooked_templates.push(this.sidebox_et2);
if(!_et2.DOMContainer.slot)
{
jQuery(_et2.DOMContainer).hide();
}
this._setup_sidebox_filters();