require_once dirname(__FILE__) . '/lib/base.php';
+/* Determine if compose mode is disabled. */
+$compose_disable = !empty($conf['hooks']['disable_compose']) &&
+ Horde::callHook('_imp_hook_disable_compose', array(), 'imp');
+
/* The headers of the message. */
$header = array();
foreach (array('to', 'cc', 'bcc', 'subject', 'in_reply_to', 'references') as $v) {
break;
case 'send_message':
+ if ($compose_disable) {
+ break;
+ }
+
try {
$from = $identity->getFromLine(null, Util::getFormData('from'));
} catch (Horde_Exception $e) {
this._setFilterText(true);
- /* Add popdown menus. */
- this._addMouseEvents({ id: 'button_reply', type: 'reply' }, true);
- DM.disable('button_reply_img', true, true);
+ /* Add popdown menus. Check for disabled compose at the same time. */
this._addMouseEvents({ id: 'button_other', type: 'otheractions' }, true);
DM.addSubMenu('ctx_message_reply', 'ctx_reply');
DM.addSubMenu('ctx_message_setflag', 'ctx_flag');
DM.addSubMenu('oa_setflag', 'ctx_flag');
DM.addSubMenu('ctx_draft_setflag', 'ctx_flag');
+ if (DIMP.conf.disable_compose) {
+ $('button_reply', 'button_forward').compact().invoke('up', 'SPAN').concat($('button_compose', 'composelink', 'ctx_contacts_new')).compact().invoke('remove');
+ } else {
+ this._addMouseEvents({ id: 'button_reply', type: 'reply' }, true);
+ DM.disable('button_reply_img', true, true);
+ }
+
new Drop('dropbase', this._folderDropConfig);
if (DIMP.conf.toggle_pref) {
{
DimpCore.init();
- this.addPopdown('reply_link', 'replypopdown');
+ if (DIMP.conf.disable_compose) {
+ tmp = $('reply_link', 'forward_link').compact().invoke('up', 'SPAN').concat([ $('ctx_contacts_new') ]).compact().invoke('remove');
+ } else {
+ this.addPopdown('reply_link', 'replypopdown');
+ }
/* Set up address linking. */
[ 'from', 'to', 'cc', 'bcc', 'replyTo' ].each(function(a) {
? array()
: array_map(array('DIMP', '_appendedFolderPref'), $conf['server']['fixed_folders']),
+ 'disable_compose' => (!empty($conf['hooks']['disable_compose']) && Horde::callHook('_imp_hook_disable_compose', array(), 'imp')),
+
'name' => $registry->get('name', 'dimp'),
'preview_pref' => (bool)$prefs->getValue('dimp_show_preview'),
exit;
}
-$compose_args = array(
- 'folder' => $folder,
- 'index' => $index,
- 'messageCache' => '',
- 'popup' => false,
- 'qreply' => true,
+$scripts = array(
+ array('ContextSensitive.js', 'imp', true),
+ array('fullmessage-dimp.js', 'imp', true),
+ array('imp.js', 'imp', true)
);
-$compose_result = IMP_Views_Compose::showCompose($compose_args);
-/* Init IMP_UI_Compose:: object. */
-$imp_ui = new IMP_UI_Compose();
-
-/* Attach spellchecker & auto completer. */
-$imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc'));
-$imp_ui->attachSpellChecker('dimp');
-
-$compose_result['js'] = array_merge($compose_result['js'], array(
+$js_out = array(
'DIMP.conf.msg_index = "' . $show_msg_result['index'] . '"',
'DIMP.conf.msg_folder = "' . $show_msg_result['folder'] . '"'
-));
+);
foreach (array('from', 'to', 'cc', 'bcc', 'replyTo') as $val) {
if (!empty($show_msg_result[$val])) {
- $compose_result['js'][] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON);
+ $js_out[] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON);
}
}
-IMP::addInlineScript($compose_result['js']);
-IMP::addInlineScript($compose_result['jsonload'], 'load');
-IMP::addInlineScript(array(DIMP::notify()), 'dom');
+/* Determine if compose mode is disabled. */
+$disable_compose = !empty($conf['hooks']['disable_compose']) &&
+ !Horde::callHook('_imp_hook_disable_compose', array(), 'imp');
-$scripts = array(
- array('ContextSensitive.js', 'imp', true),
- array('fullmessage-dimp.js', 'imp', true),
- array('compose-dimp.js', 'imp', true),
- array('imp.js', 'imp', true)
-);
+if (!$disable_compose) {
+ $compose_args = array(
+ 'folder' => $folder,
+ 'index' => $index,
+ 'messageCache' => '',
+ 'popup' => false,
+ 'qreply' => true,
+ );
+ $compose_result = IMP_Views_Compose::showCompose($compose_args);
+
+ /* Init IMP_UI_Compose:: object. */
+ $imp_ui = new IMP_UI_Compose();
+
+ /* Attach spellchecker & auto completer. */
+ $imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc'));
+ $imp_ui->attachSpellChecker('dimp');
+
+ $js_out = array_merge($js_out, $compose_result['js']);
+ $scripts[] = array('compose-dimp.js', 'imp', true);
+
+ IMP::addInlineScript($compose_result['jsonload'], 'load');
+}
+
+IMP::addInlineScript($js_out);
+IMP::addInlineScript(array(DIMP::notify()), 'dom');
DIMP::header($show_msg_result['subject'], $scripts);
echo "<body>\n";
require IMP_TEMPLATES . '/chunks/message.php';
IMP::includeScriptFiles();
IMP::outputInlineScript();
-echo $compose_result['jsappend'];
+if (!$disable_compose) {
+ echo $compose_result['jsappend'];
+}
$notification->notify(array('listeners' => array('javascript')));
echo "</body>\n</html>";
$d_read = $GLOBALS['prefs']->getValue('disposition_request_read');
$save_attach = $GLOBALS['prefs']->getValue('save_attachments');
+/* Determine if compose mode is disabled. */
+$compose_disable = !empty($GLOBALS['conf']['hooks']['disable_compose']) &&
+ Horde::callHook('_imp_hook_disable_compose', array(), 'imp');
+
// Small utility function to simplify creating dimpactions buttons.
// As of right now, we don't show text only links.
function _createDAcompose($text, $image, $id)
<input type="hidden" id="composeCache" name="composeCache" value="<?php echo $composeCache ?>" />
<div class="dimpActions dimpActionsCompose">
+<?php if (!$compose_disable): ?>
<span>
<?php _createDAcompose(_("Send"), 'Forward', 'send_button') ?>
</span>
<label><input type="checkbox" class="checkbox" id="save_sent_mail" name="save_sent_mail"<?php if ($identity->saveSentmail()) echo ' checked="checked"' ?> /> <?php echo _("Save in ") ?><span id="sent_mail_folder_label"><?php echo $sent_mail_folder ?></span></label>
</span>
<?php endif; ?>
+<?php endif; ?>
<span>
<?php _createDAcompose(_("Check Spelling"), 'Spellcheck', 'spellcheck') ?>
</span>
</div>
</div>
+<?php if (!$disable_compose): ?>
<div id="qreply" style="display:none">
<div class="header">
<div class="headercloseimg"><?php echo IMP::img('close.png', 'X', array(), $horde_img) ?></div>
<a id="ctx_reply_reply_list"><span class="contextImg"></span><?php echo _("To List") ?></a>
<?php endif; ?>
</div>
+<?php endif; ?>
<div class="context" id="ctx_contacts" style="display:none">
<a id="ctx_contacts_new"><span class="contextImg"></span><?php echo _("New Message") ?></a>