Skip to content

Commit

Permalink
Addition fix for #1027: AJAX in PM
Browse files Browse the repository at this point in the history
Some workaround to work `cleditor` and `epiceditor` with AJAX enabled in
PM (just turn off AJAX).
  • Loading branch information
macik committed Sep 18, 2014
1 parent 3abaabf commit 7c32e22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 4 additions & 1 deletion modules/pm/inc/pm.functions.php
Expand Up @@ -14,9 +14,12 @@
require_once cot_langfile('pm', 'module');
require_once cot_incfile('pm', 'module', 'resources');

$parser = ! empty(cot::$sys['parser']) ? cot::$sys['parser'] : cot::$cfg['parser'];
$editor = cot::$cfg['plugin'][$parser]['editor'];

cot::$db->registerTable('pm');

cot::$cfg['pm']['turnajax'] = cot::$cfg['jquery'] && cot::$cfg['turnajax'] && cot::$cfg['pm']['turnajax'];
cot::$cfg['pm']['turnajax'] = cot::$cfg['pm']['turnajax'] && cot::$cfg['jquery'] && cot::$cfg['turnajax'] && $editor != 'elrte' && $editor != 'epiceditor';

/**
* Send an email in the recipient's language
Expand Down
8 changes: 3 additions & 5 deletions modules/pm/inc/pm.message.php
Expand Up @@ -20,8 +20,6 @@
$q = cot_import('q','G','TXT'); // Quote
$history = cot_import('history','G','BOL'); // Turn on history
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['pm']['maxpmperpage']); //pagination history
$parser = ! empty($sys['parser']) ? $sys['parser'] : $cfg['parser'];
$editor = $cfg['plugin'][$parser]['editor'];

if (empty($id))
{
Expand Down Expand Up @@ -193,13 +191,13 @@
switch ($editor)
{
case 'markitup':
$newpmtext = (!empty($q)) ? '[quote]'.htmlspecialchars($row['pm_text']).'[/quote]' : '';
$newpmtext = (! empty($q)) ? '[quote]' . htmlspecialchars($row['pm_text']) . '[/quote]' : '';
if ($cfg['jquery']) $onclick = "insertText(document, 'newpmtext', '[quote]'+$('#pm_text').text()+'[/quote]'); return false;";
break;
case 'ckeditor':
if ($cfg['jquery']) $onclick = "CKEDITOR.instances.newpmtext.insertHtml('<blockquote>'+$('#pm_text').text()+'</blockquote><br />'); return false;";
default:
$newpmtext = (!empty($q)) ? '<blockquote>'.$row['pm_text'].'</blockquote>' : '';
$newpmtext = (! empty($q)) ? '<blockquote>' . $row['pm_text'] . '</blockquote>' : '';
}

if (COT_AJAX)
Expand All @@ -225,7 +223,7 @@
'PM_QUOTE' => cot_rc_link(cot_url('pm', 'm=message&id='.$id.'&q=quote&history='.(int)$history.'&d='.$durl), $L['Quote'], array('onclick' => $onclick)),
'PM_FORM_SEND' => cot_url('pm', 'm=send&a=send&to='.$to),
'PM_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'),
'PM_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor').$text_editor_code,
'PM_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code,
));

/* === Hook === */
Expand Down
4 changes: 1 addition & 3 deletions modules/pm/inc/pm.send.php
Expand Up @@ -19,8 +19,6 @@
$to = cot_import('to', 'G', 'TXT');
$a = cot_import('a','G','TXT');
$id = cot_import('id','G','INT');
$parser = ! empty($sys['parser']) ? $sys['parser'] : $cfg['parser'];
$editor = $cfg['plugin'][$parser]['editor'];

$totalrecipients = 0;
$touser_sql = array();
Expand Down Expand Up @@ -301,7 +299,7 @@
'PMSEND_SENTBOX_COUNT' => $totalsentbox,
'PMSEND_FORM_SEND' => cot_url('pm', 'm=send&a=send'.$idurl),
'PMSEND_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'),
'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor').$text_editor_code,
'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code,
'PMSEND_FORM_TOUSER' => cot_textarea('newpmrecipient', $touser, 3, 56, 'class="userinput"'),
));

Expand Down

0 comments on commit 7c32e22

Please sign in to comment.