mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
Framework WIP:
- Fix template_set preference was ignored - Move top-level etemplate elements with slot to be direct children of EgwFrameworkApp element
This commit is contained in:
parent
1d6aa8e793
commit
24e265ef6e
@ -55,7 +55,10 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
|
||||
$this->sitemgr = isset($GLOBALS['Common_BO']) && is_object($GLOBALS['Common_BO']);
|
||||
|
||||
if ($name) $this->read($name,$template='default','default',0,'',$load_via);
|
||||
if($name)
|
||||
{
|
||||
$this->read($name, null, 'default', 0, '', $load_via);
|
||||
}
|
||||
|
||||
// generate new etemplate request object, if not already existing
|
||||
if(!isset(self::$request)) self::$request = Etemplate\Request::read();
|
||||
@ -276,7 +279,8 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
'></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));
|
||||
|
||||
$GLOBALS['egw']->framework->response->generic("data", $this->template_set == "kdots" ? $load_array : array($content));
|
||||
$GLOBALS['egw']->framework->response->generic('et2_load',$load_array+Framework::get_extra());
|
||||
Framework::clear_extra(); // to not send/set it twice for multiple etemplates (eg. CRM view)
|
||||
|
||||
@ -565,6 +569,10 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
public function read($name,$template_set=null,$lang='default',$group=0,$version='',$load_via='')
|
||||
{
|
||||
|
||||
if($template_set == null && $GLOBALS['egw_info']['user']['preferences']['common']['template_set'])
|
||||
{
|
||||
$template_set = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
// For mobile experience try to load custom mobile templates
|
||||
if (Header\UserAgent::mobile())
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ import styles from "./EgwFrameworkApp.styles";
|
||||
import {SlSplitPanel} from "@shoelace-style/shoelace";
|
||||
import {HasSlotController} from "../../api/js/etemplate/Et2Widget/slot";
|
||||
import type {EgwFramework} from "./EgwFramework";
|
||||
import {etemplate2} from "../../api/js/etemplate/etemplate2";
|
||||
|
||||
/**
|
||||
* @summary Application component inside EgwFramework
|
||||
@ -192,7 +193,19 @@ export class EgwFrameworkApp extends LitElement
|
||||
).then((data : string[]) =>
|
||||
{
|
||||
// Load request returns HTML. Shove it in.
|
||||
render(html`${unsafeHTML(data.join(""))}`, this);
|
||||
if(typeof data == "string" || typeof data == "object" && typeof data[0] == "string")
|
||||
{
|
||||
render(html`${unsafeHTML(data.join(""))}`, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We got some data, use it
|
||||
if(data.DOMNodeID)
|
||||
{
|
||||
this.id = data.DOMNodeID;
|
||||
}
|
||||
}
|
||||
this.addEventListener("load", this.handleEtemplateLoad, {once: true});
|
||||
|
||||
// Might have just slotted aside content, hasSlotController will requestUpdate()
|
||||
// but we need to do it anyway for translation
|
||||
@ -270,6 +283,21 @@ export class EgwFrameworkApp extends LitElement
|
||||
this.hasSlotController.test(side) || this.hasSlotController.test(`${side}-footer`);
|
||||
}
|
||||
|
||||
/**
|
||||
* An etemplate has loaded inside
|
||||
* Move anything top-level that has a slot
|
||||
*/
|
||||
protected handleEtemplateLoad(event)
|
||||
{
|
||||
const etemplate = etemplate2.getById(this.id);
|
||||
if(!etemplate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Move top level slotted components (slot watcher will requestUpdate)
|
||||
etemplate.widgetContainer.getDOMNode().querySelectorAll(":scope > [slot]").forEach(node => {this.appendChild(node);});
|
||||
}
|
||||
|
||||
/**
|
||||
* User adjusted side slider, update preference
|
||||
*
|
||||
|
151
mail/templates/kdots/index.xet
Normal file
151
mail/templates/kdots/index.xet
Normal file
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
|
||||
<overlay>
|
||||
<template id="mail.index.preview" slot="right">
|
||||
<grid id="mailPreview" width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
|
||||
</row>
|
||||
<row>
|
||||
<et2-vbox class="previewWrapper">
|
||||
<et2-box id="blank" disabled="@uid">
|
||||
<et2-image src="email"></et2-image>
|
||||
<et2-description value="Select an item to read"></et2-description>
|
||||
</et2-box>
|
||||
<et2-hbox class="mailPreviewHeaders">
|
||||
<et2-description id="subject" readonly="true" hoverAction="app.mail.modifyMessageSubjectDialog" hoverActionTitle="Modify subject of this message"></et2-description>
|
||||
<et2-hbox class="mailPreviewHeaders smimeIcons">
|
||||
<et2-image id="smime_signature" src="smime_sign" statustext="Smime signed message" disabled="!@smime=smime_sign" align="right" width="24"></et2-image>
|
||||
<et2-image id="smime_encryption" src="smime_encrypt" statustext="Smime encrypted message" disabled="!@smime=smime_encrypt" align="right" width="24"></et2-image>
|
||||
</et2-hbox>
|
||||
</et2-hbox>
|
||||
<et2-hbox width="100%" class="mailPreviewHeaders">
|
||||
<et2-lavatar contactId="email:$cont[fromaddress]" lname="$cont[fromlavatar][lname]" fname="$cont[fromlavatar][fname]" shape="rounded" size="2.75em"></et2-lavatar>
|
||||
<et2-vbox>
|
||||
<et2-vbox class="addresses">
|
||||
<et2-hbox>
|
||||
<et2-description value="From" class="firstColumnTitle"></et2-description>
|
||||
<et2-email id="additionalfromaddress" readonly="true"
|
||||
onclick="app.mail.onclickCompose"></et2-email>
|
||||
<et2-date-time align="right" id="date" readonly="true"></et2-date-time>
|
||||
</et2-hbox>
|
||||
<et2-hbox disabled="!@toaddress" width="100%">
|
||||
<et2-description value="To" class="firstColumnTitle"></et2-description>
|
||||
<et2-email id="additionaltoaddress" readonly="true" rows="1"
|
||||
onTagClick="app.mail.onclickCompose"></et2-email>
|
||||
</et2-hbox>
|
||||
<et2-hbox disabled="!@ccaddress" width="100%">
|
||||
<et2-description value="Cc" class="firstColumnTitle"></et2-description>
|
||||
<et2-email id="ccaddress" readonly="true" rows="1"
|
||||
onTagClick="app.mail.onclickCompose"></et2-email>
|
||||
</et2-hbox>
|
||||
<et2-hbox disabled="!@bccaddress" width="100%">
|
||||
<et2-description value="Bcc" class="firstColumnTitle"></et2-description>
|
||||
<et2-email id="bccaddress" readonly="true" rows="1"
|
||||
onTagClick="app.mail.onclickCompose"></et2-email>
|
||||
</et2-hbox>
|
||||
<et2-hbox width="100%" disabled="!@attachmentsBlock">
|
||||
<et2-description value="Attachments" class="firstColumnTitle"></et2-description>
|
||||
<et2-details overlaySummaryOnOpen="true" toggleAlign="right" toggleOnHover="true" hoist="true" class="attachments">
|
||||
<et2-hbox slot="summary">
|
||||
<grid class="previewAttachmentArea egwGridView_grid">
|
||||
<columns>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column width="70%"/>
|
||||
<column width="20%"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="row attachmentRow">
|
||||
<et2-description id="attachmentsBlock[0][attachment_number]"></et2-description>
|
||||
<et2-description id="attachmentsBlock[0][partID]"></et2-description>
|
||||
<et2-description id="attachmentsBlock[0][type]"></et2-description>
|
||||
<et2-description id="attachmentsBlock[0][winmailFlag]"></et2-description>
|
||||
<et2-description-expose class="et2_link useEllipsis" id="attachmentsBlock[0][filename]" mime="@attachmentsBlock[0][type]" href="@attachmentsBlock[0][mime_url]" noLang="1" mimeData="@attachmentsBlock[0][mime_data]"></et2-description-expose>
|
||||
<et2-description align="right" value="@attachmentsBlockTitle" class="et2_bold"></et2-description>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</et2-hbox>
|
||||
<grid id="attachmentsBlock" class="previewAttachmentArea egwGridView_grid">
|
||||
<columns>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column disabled="!@showtempname"/>
|
||||
<column width="70%"/>
|
||||
<column width="11%"/>
|
||||
<column width="10%"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="row attachmentRow" id="${row}">
|
||||
<et2-description id="${row}[attachment_number]"></et2-description>
|
||||
<et2-description id="${row}[partID]"></et2-description>
|
||||
<et2-description id="${row}[type]"></et2-description>
|
||||
<et2-description id="${row}[winmailFlag]"></et2-description>
|
||||
<et2-description-expose class="et2_link useEllipsis" id="${row}[filename]" mime="$row_cont[type]" href="$row_cont[mime_url]" noLang="1" mimeData="$row_cont[mime_data]"></et2-description-expose>
|
||||
<et2-description align="right" id="${row}[size]"></et2-description>
|
||||
<et2-dropdown-button id="${row}[actions]" label="$row_cont[actionsDefaultLabel]" onchange="app.mail.attachmentsBlockActions" onclick="app.mail.attachmentsBlockActions"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</et2-details>
|
||||
</et2-hbox>
|
||||
</et2-vbox>
|
||||
</et2-vbox>
|
||||
</et2-hbox>
|
||||
</et2-vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<et2-box id="mailPreviewContainer">
|
||||
<iframe frameborder="1" id="messageIFRAME" scrolling="auto"/>
|
||||
</et2-box>
|
||||
</template>
|
||||
<template id="mail.index.splitter" height="100%" template="" lang="" group="0" version="1.9.001">
|
||||
<et2-split id="mailSplitter" style="--min: 30%;--max:min(70%,calc(100% - 30em));" vertical="false" primary="start">
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" class="" template="mail.index.rows.vertical" header_left="mail.index.add" header_right="mail.index.header_right" disable_selection_advance="true"/>
|
||||
|
||||
</et2-split>
|
||||
</template>
|
||||
<template id="mail.index.nosplitter" template="" lang="" group="0" version="1.9.001">
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" template="mail.index.rows.horizental" header_left="mail.index.add"
|
||||
header_right="mail.index.header_right"/>
|
||||
</template>
|
||||
<template id="mail.index.add" template="" lang="" group="0" version="1.9.001">
|
||||
<et2-button id="button[mailcreate]" onclick="app.mail.mail_compose(false);" label="Compose" image="add" noSubmit="true"></et2-button>
|
||||
</template>
|
||||
<template id="mail.index.header_right" template="" lang="" group="0" version="1.9.001" slot="right-header">
|
||||
<et2-details id="mail.index.vacationnotice" disabled="true" summary="on vacation" toggleOnHover="true" hoist="true" class="vacationnotice" onclick="app.mail.edit_vacation">
|
||||
<et2-description id="nm[vacationnotice]" class="@nm[vacationclass]"></et2-description>
|
||||
<et2-description id="nm[vacationrange]" class="@nm[vacationrangeclass]"></et2-description>
|
||||
</et2-details>
|
||||
<et2-details id="mail.index.datefilter" class="mail-index_datefilter" summary="Date..." hoist="true">
|
||||
<et2-date id="startdate" label="Start" onchange="app.mail.mail_refreshMessageGrid(false,true);"></et2-date>
|
||||
<et2-date id="enddate" label="End" onchange="app.mail.mail_refreshMessageGrid(false,true);"></et2-date>
|
||||
</et2-details>
|
||||
|
||||
<et2-hbox id="mail.index.quotabox" class="mail-index_quotabox">
|
||||
<progress id="nm[quotainpercent]" label="@nm[quota]" class="@nm[quotaclass]"/>
|
||||
</et2-hbox>
|
||||
</template>
|
||||
<template id="mail.index" template="" lang="" group="0" version="1.9.001">
|
||||
<et2-tree autoloading="mail.mail_ui.ajax_foldertree" id="nm[foldertree]" onclick="app.mail.mail_changeFolder"
|
||||
onopenstart="app.mail.subscription_autoloadingStart" onopenend="app.mail.subscription_autoloadingEnd"
|
||||
highlighting="true" parentId="mail-tree_target" slot="left"/>
|
||||
<et2-box slot="right-header">
|
||||
<toolbar id="toolbar" list_header="short" slot="right-header"/>
|
||||
</et2-box>
|
||||
<et2-box slot="right">
|
||||
<template id="mail.index.preview"/>
|
||||
</et2-box>
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" class="" template="mail.index.rows.vertical" header_left="mail.index.add" header_right="mail.index.header_right" disable_selection_advance="true"/>
|
||||
<iframe frameborder="1" id="extra_iframe" scrolling="auto" disabled="true"/>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user