Skip to content

Commit

Permalink
MDL-14739: make the html editor work on the messaging screen
Browse files Browse the repository at this point in the history
  • Loading branch information
scyrma committed Jun 11, 2008
1 parent b413494 commit cd81f66
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions message/send.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTEM))) {

// if ($USER->

/// Don't use print_header, for more speed
$stylesheetshtml = '';
Expand All @@ -34,8 +35,15 @@
echo "<html $direction xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n";
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo $stylesheetshtml;

include($CFG->javascript);

require_once($CFG->libdir .'/editor/htmlEditor.class.php');
$htmlEditorObject = new htmlEditor();
echo $htmlEditorObject->configure();

echo '<title> </title></head>';

/// Script parameters
$userid = required_param('id', PARAM_INT);
$message = optional_param('message', '', PARAM_CLEANHTML);
Expand All @@ -62,6 +70,7 @@
}
}

echo '<body class="message course-1" id="message-send">';

if ($message!='' and confirm_sesskey()) { /// Current user has just sent a message

Expand Down Expand Up @@ -89,40 +98,39 @@
add_to_log(SITEID, 'message', 'write', 'history.php?user1='.$user->id.'&amp;user2='.$USER->id.'#m'.$messageid, $user->id);
}

echo '<title> </title></head>';


echo '<body class="message course-1" id="message-send">';
echo '<center>';
echo '<form id="editing" method="post" action="send.php">';
echo '<div>';
echo '<div class="message-form">';
echo '<input type="hidden" name="id" value="'.$user->id.'" />';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';

$usehtmleditor = (can_use_html_editor() && get_user_preferences('message_usehtmleditor', 0));
if ($usehtmleditor) {
echo '<table><tr><td class="fixeditor" align="center">';
print_textarea($usehtmleditor, 9, 200, 0, 0, 'message', '');
echo '</td></tr></table>';
echo '<input type="submit" value="'.get_string('sendmessage', 'message').'" />';
use_html_editor('message', 'formatblock subscript superscript copy cut paste clean undo redo justifyleft justifycenter justifyright justifyfull lefttoright righttoleft insertorderedlist insertunorderedlist outdent indent inserthorizontalrule createanchor nolink inserttable');
echo '<div class="message-send-box">';
print_textarea($usehtmleditor, 5, 34, 0, 0, 'message', '', 0, false, '', 'form-textarea-simple');
echo '</div>';
echo '<input class="message-send-button" type="submit" value="'.get_string('sendmessage', 'message').'" />';
//use_html_editor('message', 'formatblock subscript superscript copy cut paste clean undo redo justifyleft justifycenter justifyright justifyfull lefttoright righttoleft insertorderedlist insertunorderedlist outdent indent inserthorizontalrule createanchor nolink inserttable');
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
print_textarea(false, 5, 34, 0, 0, 'message', '');
echo '<input type="hidden" name="format" value="'.FORMAT_MOODLE.'" />';
echo '<br /><input type="submit" value="'.get_string('sendmessage', 'message').'" />';
echo '<br /><input class="message-send-button" type="submit" value="'.get_string('sendmessage', 'message').'" />';
}
echo '</div>';
echo '</form>';
if (!empty($CFG->messagewasjustemailed)) {
notify(get_string('mailsent', 'message'), 'notifysuccess');
}
echo '<div class="noframesjslink"><a target="_parent" href="discussion.php?id='.$userid.'&amp;noframesjs=1">'.get_string('noframesjs', 'message').'</a></div>';
echo '</center>';

echo "\n<script type=\"text/javascript\">\n<!--\n"; /// Focus on the textarea
echo 'document.getElementById("edit-message").focus();'."\n";
echo "\n-->\n</script>\n\n";
echo <<<EOF
<script type="text/javascript">
//<![CDATA[
document.getElementById("edit-message").focus();
//]]>
</script>
EOF;

echo '</body></html>';
}
Expand Down

0 comments on commit cd81f66

Please sign in to comment.