mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
* Api: When clicking an email address, ask if user wants to add email to existing compose window or start a new mail
This commit is contained in:
parent
333750587c
commit
0e6f74da02
@ -592,37 +592,70 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
||||
}
|
||||
}
|
||||
|
||||
if(popups.length == 1)
|
||||
const pref_name = "mail_add_address_new_popup";
|
||||
const new_dialog_pref = egw.preference(pref_name, "common");
|
||||
|
||||
if (popups.length == 0 || new_dialog_pref == "new")
|
||||
{
|
||||
return openUp(_app, _extra);
|
||||
}
|
||||
if (new_dialog_pref == "add" && popups.length == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
popups[0].app[_app][_method](popups[0], _content);
|
||||
}
|
||||
catch(e) {
|
||||
window.setTimeout(function() {
|
||||
catch (e)
|
||||
{
|
||||
window.setTimeout(function ()
|
||||
{
|
||||
openUp(_app, _extra);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (popups.length > 1)
|
||||
{
|
||||
|
||||
var buttons = [
|
||||
{label: this.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true},
|
||||
{label: this.lang("Cancel"), id: "cancel"}
|
||||
];
|
||||
|
||||
// Fill dialog options
|
||||
var c = [];
|
||||
for (var i = 0; i < popups.length; i++)
|
||||
{
|
||||
c.push({label: popups[i].document.title || this.lang(_app), index: i});
|
||||
}
|
||||
c.push({label: this.lang("New %1", egw.link_get_registry(_app, "entry")), index: "new"});
|
||||
|
||||
// Set initial value
|
||||
switch (new_dialog_pref)
|
||||
{
|
||||
case "new":
|
||||
c.index = "new";
|
||||
break;
|
||||
case "add":
|
||||
c.index = 0;
|
||||
break;
|
||||
}
|
||||
let dialog = new Et2Dialog(this.app_name());
|
||||
dialog.transformAttributes({
|
||||
callback: function (_button_id, _value)
|
||||
{
|
||||
if (_value.remember)
|
||||
{
|
||||
// Remember and do not ask again (if they chose new)
|
||||
egw.set_preference("common", pref_name, _value.remember && _value.grid.index == "new" ? "new" : "add");
|
||||
}
|
||||
if (_value && _value.grid)
|
||||
{
|
||||
switch (_button_id)
|
||||
{
|
||||
case "add":
|
||||
if (_value.grid.index == "new")
|
||||
{
|
||||
return openUp(_app, _extra);
|
||||
}
|
||||
popups[_value.grid.index].app[_app][_method](popups[_value.grid.index], _content);
|
||||
return;
|
||||
case "cancel":
|
||||
@ -637,11 +670,6 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
||||
});
|
||||
document.body.appendChild(dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
openUp(_app, _extra);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?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="api.promptOpenedDialog" template="" lang="" group="0" version="17.1">
|
||||
<template id="api.promptOpenedDialog" template="" lang="" group="0" version="23.1">
|
||||
<grid id="grid">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -12,9 +12,10 @@
|
||||
<row>
|
||||
<radio id="index" set_value="$row_cont[index]"/>
|
||||
<et2-description></et2-description>
|
||||
<et2-description id="${row}[label]"></et2-description>
|
||||
<et2-description id="${row}[label]" for="$row_cont[index]"></et2-description>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<et2-checkbox id="remember" label="Remember and do not ask again" slot="footer" align="right"></et2-checkbox>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user