mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +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,55 +592,83 @@ 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")
|
||||||
{
|
{
|
||||||
try {
|
return openUp(_app, _extra);
|
||||||
|
}
|
||||||
|
if (new_dialog_pref == "add" && popups.length == 1)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
popups[0].app[_app][_method](popups[0], _content);
|
popups[0].app[_app][_method](popups[0], _content);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch (e)
|
||||||
window.setTimeout(function() {
|
{
|
||||||
|
window.setTimeout(function ()
|
||||||
|
{
|
||||||
openUp(_app, _extra);
|
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++)
|
||||||
{
|
{
|
||||||
var buttons = [
|
c.push({label: popups[i].document.title || this.lang(_app), index: i});
|
||||||
{label: this.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true},
|
}
|
||||||
{label: this.lang("Cancel"), id: "cancel"}
|
c.push({label: this.lang("New %1", egw.link_get_registry(_app, "entry")), index: "new"});
|
||||||
];
|
|
||||||
var c = [];
|
// Set initial value
|
||||||
for (var i = 0; i < popups.length; i++)
|
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)
|
||||||
{
|
{
|
||||||
c.push({label: popups[i].document.title || this.lang(_app), index: i});
|
if (_value.remember)
|
||||||
}
|
|
||||||
let dialog = new Et2Dialog(this.app_name());
|
|
||||||
dialog.transformAttributes({
|
|
||||||
callback: function (_button_id, _value)
|
|
||||||
{
|
{
|
||||||
if (_value && _value.grid)
|
// 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)
|
||||||
{
|
{
|
||||||
switch (_button_id)
|
case "add":
|
||||||
{
|
if (_value.grid.index == "new")
|
||||||
case "add":
|
{
|
||||||
popups[_value.grid.index].app[_app][_method](popups[_value.grid.index], _content);
|
return openUp(_app, _extra);
|
||||||
return;
|
}
|
||||||
case "cancel":
|
popups[_value.grid.index].app[_app][_method](popups[_value.grid.index], _content);
|
||||||
}
|
return;
|
||||||
|
case "cancel":
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
title: this.lang("Select an opened dialog"),
|
},
|
||||||
buttons: buttons,
|
title: this.lang("Select an opened dialog"),
|
||||||
value: {content: {grid: c}},
|
buttons: buttons,
|
||||||
template: this.webserverUrl + '/api/templates/default/promptOpenedDialog.xet?1',
|
value: {content: {grid: c}},
|
||||||
resizable: false
|
template: this.webserverUrl + '/api/templates/default/promptOpenedDialog.xet?1',
|
||||||
});
|
resizable: false
|
||||||
document.body.appendChild(dialog);
|
});
|
||||||
}
|
document.body.appendChild(dialog);
|
||||||
else
|
|
||||||
{
|
|
||||||
openUp(_app, _extra);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
|
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
|
||||||
<overlay>
|
<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">
|
<grid id="grid">
|
||||||
<columns>
|
<columns>
|
||||||
<column/>
|
<column/>
|
||||||
<column/>
|
<column/>
|
||||||
<column/>
|
<column/>
|
||||||
</columns>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<radio id="index" set_value="$row_cont[index]"/>
|
<radio id="index" set_value="$row_cont[index]"/>
|
||||||
<et2-description></et2-description>
|
<et2-description></et2-description>
|
||||||
<et2-description id="${row}[label]"></et2-description>
|
<et2-description id="${row}[label]" for="$row_cont[index]"></et2-description>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
</template>
|
<et2-checkbox id="remember" label="Remember and do not ask again" slot="footer" align="right"></et2-checkbox>
|
||||||
|
</template>
|
||||||
</overlay>
|
</overlay>
|
Loading…
Reference in New Issue
Block a user