Hide MDN and DSN options in compose if disabled by admin (#1490221)

pull/260/head
Aleksander Machniak 10 years ago
parent 9e26034801
commit f6502176f8

@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
=========================== ===========================
- Fix bug where max_group_members was ignored when adding a new contact (#1490214) - Fix bug where max_group_members was ignored when adding a new contact (#1490214)
- Hide MDN and DSN options in compose if disabled by admin (#1490221)
RELEASE 1.1-rc RELEASE 1.1-rc
-------------- --------------

@ -419,7 +419,8 @@ $OUTPUT->add_handlers(array(
'filedroparea' => 'compose_file_drop_area', 'filedroparea' => 'compose_file_drop_area',
'priorityselector' => 'rcmail_priority_selector', 'priorityselector' => 'rcmail_priority_selector',
'editorselector' => 'rcmail_editor_selector', 'editorselector' => 'rcmail_editor_selector',
'receiptcheckbox' => 'rcmail_receipt_checkbox', 'receiptcheckbox' => 'rcmail_mdn_checkbox', // deprecated
'mdncheckbox' => 'rcmail_mdn_checkbox',
'dsncheckbox' => 'rcmail_dsn_checkbox', 'dsncheckbox' => 'rcmail_dsn_checkbox',
'storetarget' => 'rcmail_store_target_selection', 'storetarget' => 'rcmail_store_target_selection',
'addressbooks' => 'rcmail_addressbook_list', 'addressbooks' => 'rcmail_addressbook_list',
@ -1642,7 +1643,7 @@ function rcmail_priority_selector($attrib)
} }
function rcmail_receipt_checkbox($attrib) function rcmail_mdn_checkbox($attrib)
{ {
global $RCMAIL, $MESSAGE, $compose_mode; global $RCMAIL, $MESSAGE, $compose_mode;
@ -1652,13 +1653,13 @@ function rcmail_receipt_checkbox($attrib)
if (!isset($attrib['id'])) if (!isset($attrib['id']))
$attrib['id'] = 'receipt'; $attrib['id'] = 'receipt';
$attrib['name'] = '_receipt'; $attrib['name'] = '_mdn';
$attrib['value'] = '1'; $attrib['value'] = '1';
$checkbox = new html_checkbox($attrib); $checkbox = new html_checkbox($attrib);
if (isset($_POST['_receipt'])) if (isset($_POST['_mdn']))
$mdn_default = $_POST['_receipt']; $mdn_default = $_POST['_mdn'];
else if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) else if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT)))
$mdn_default = (bool) $MESSAGE->headers->mdn_to; $mdn_default = (bool) $MESSAGE->headers->mdn_to;
else else

@ -188,6 +188,10 @@ if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) {
} }
} }
$dont_override = (array) $RCMAIL->config->get('dont_override');
$mdn_enabled = in_array('mdn_default', $dont_override) ? $RCMAIL->config->get('mdn_default') : !empty($_POST['_mdn']);
$dsn_enabled = in_array('dsn_default', $dont_override) ? $RCMAIL->config->get('dsn_default') : !empty($_POST['_dsn']);
// add subject // add subject
$headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset)); $headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset));
@ -228,7 +232,7 @@ if (!empty($_POST['_priority'])) {
} }
} }
if (!empty($_POST['_receipt'])) { if ($mdn_enabled) {
$headers['Return-Receipt-To'] = $from_string; $headers['Return-Receipt-To'] = $from_string;
$headers['Disposition-Notification-To'] = $from_string; $headers['Disposition-Notification-To'] = $from_string;
} }
@ -520,9 +524,7 @@ if (!$savedraft) {
} }
// Handle Delivery Status Notification request // Handle Delivery Status Notification request
if (!empty($_POST['_dsn'])) { $smtp_opts['dsn'] = $dsn_enabled;
$smtp_opts['dsn'] = true;
}
$sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto, $sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto,
$smtp_error, $mailbody_file, $smtp_opts); $smtp_error, $mailbody_file, $smtp_opts);

@ -174,11 +174,13 @@
<div id="composeoptionsmenu" class="popupmenu"> <div id="composeoptionsmenu" class="popupmenu">
<table> <table>
<roundcube:if condition="!in_array('mdn_default', (array)config:dont_override)" />
<tr> <tr>
<td><label for="rcmcomposereceipt"><roundcube:label name="returnreceipt" />:</label></td> <td><label for="rcmcomposereceipt"><roundcube:label name="returnreceipt" />:</label></td>
<td><roundcube:object name="receiptCheckBox" form="form" id="rcmcomposereceipt" /></td> <td><roundcube:object name="mdnCheckBox" form="form" id="rcmcomposereceipt" /></td>
</tr> </tr>
<roundcube:if condition="config:smtp_server != ''" /> <roundcube:endif />
<roundcube:if condition="config:smtp_server != '' and !in_array('dsn_default', (array)config:dont_override)" />
<tr> <tr>
<td><label for="rcmcomposedsn"><roundcube:label name="dsn" />:</label></td> <td><label for="rcmcomposedsn"><roundcube:label name="dsn" />:</label></td>
<td><roundcube:object name="dsnCheckBox" form="form" id="rcmcomposedsn" /></td> <td><roundcube:object name="dsnCheckBox" form="form" id="rcmcomposedsn" /></td>

@ -146,10 +146,12 @@
<label for="rcmcomposepriority"><roundcube:label name="priority" /> <label for="rcmcomposepriority"><roundcube:label name="priority" />
<roundcube:object name="prioritySelector" form="form" id="rcmcomposepriority" tabindex="4" /></label> <roundcube:object name="prioritySelector" form="form" id="rcmcomposepriority" tabindex="4" /></label>
</span> </span>
<roundcube:if condition="!in_array('mdn_default', (array)config:dont_override)" />
<span class="composeoption"> <span class="composeoption">
<label><roundcube:object name="receiptCheckBox" form="form" id="rcmcomposereceipt" tabindex="4" /> <roundcube:label name="returnreceipt" /></label> <label><roundcube:object name="mdnCheckBox" form="form" id="rcmcomposereceipt" tabindex="4" /> <roundcube:label name="returnreceipt" /></label>
</span> </span>
<roundcube:if condition="config:smtp_server != ''" /> <roundcube:endif />
<roundcube:if condition="config:smtp_server != '' and !in_array('dsn_default', (array)config:dont_override)" />
<span class="composeoption"> <span class="composeoption">
<label><roundcube:object name="dsnCheckBox" form="form" id="rcmcomposedsn" tabindex="4" /> <roundcube:label name="dsn" /></label> <label><roundcube:object name="dsnCheckBox" form="form" id="rcmcomposedsn" tabindex="4" /> <roundcube:label name="dsn" /></label>
</span> </span>

Loading…
Cancel
Save