From 641411cc03c32560aa79884e3b0aac3488784983 Mon Sep 17 00:00:00 2001 From: torsten haendler Date: Wed, 19 Mar 2014 16:18:19 +0100 Subject: [PATCH] add subject line to message by participant list --- lang/en/moodle.php | 4 ++++ message/lib.php | 11 ++++++++--- theme/base/style/core.css | 6 ++++++ user/message.html | 10 ++++++++++ user/messageselect.php | 24 +++++++++++++++++++++--- 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 1a45a01..78e7afa 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -1108,6 +1108,10 @@ $string['messageprovider:instantmessage'] = 'Personal messages between users'; $string['messageprovider:instantmessage_help'] = 'This section configures what happens to messages that are sent to you directly from other users on this site.'; $string['messageselect'] = 'Select this user as a message recipient'; $string['messageselectadd'] = 'Send a message'; +##############NEW############## +$string['messagesubject'] = 'Message subject'; +$string['messagesubjectoptional'] = '(optional)'; +##############NEW############## $string['middlename'] = 'Middle name'; $string['migratinggrades'] = 'Migrating grades'; $string['min'] = 'min'; diff --git a/message/lib.php b/message/lib.php index 4983b08..9794632 100644 --- a/message/lib.php +++ b/message/lib.php @@ -2101,7 +2101,7 @@ function message_format_contexturl($message) { * @param int $format message format such as FORMAT_PLAIN or FORMAT_HTML * @return int|false the ID of the new message or false */ -function message_post_message($userfrom, $userto, $message, $format) { +function message_post_message($userfrom, $userto, $message, $format, $subject=null) { global $SITE, $CFG, $USER; $eventdata = new stdClass(); @@ -2111,8 +2111,13 @@ function message_post_message($userfrom, $userto, $message, $format) { $eventdata->userto = $userto; //using string manager directly so that strings in the message will be in the message recipients language rather than the senders - $eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang); - +##############NEW############## + if ($subject != null) { + $eventdata->subject = $subject; + }else { + $eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang); + } +##############NEW############## if ($format == FORMAT_HTML) { $eventdata->fullmessagehtml = $message; //some message processors may revert to sending plain text even if html is supplied diff --git a/theme/base/style/core.css b/theme/base/style/core.css index a34e0e5..694b29a 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -1800,3 +1800,9 @@ body.lockscroll { height: 100%; overflow: hidden; } + +/******NEW******/ +.messagesubject { + display: inline-block; + font-weight: bold; +} \ No newline at end of file diff --git a/user/message.html b/user/message.html index 98cfbc3..ae0ddb2 100644 --- a/user/message.html +++ b/user/message.html @@ -5,6 +5,16 @@ box_start(); ?> + + + + + +
+ : + + +
: diff --git a/user/messageselect.php b/user/messageselect.php index 877adb8..182dfe4 100644 --- a/user/messageselect.php +++ b/user/messageselect.php @@ -34,11 +34,18 @@ $edit = optional_param('edit','',PARAM_BOOL); $returnto = optional_param('returnto','',PARAM_LOCALURL); $format = optional_param('format',FORMAT_MOODLE,PARAM_INT); $deluser = optional_param('deluser',0,PARAM_INT); - +##################NEW################# +$messagesubject = optional_param('messagesubject','',PARAM_TEXT); +##################NEW################# $url = new moodle_url('/user/messageselect.php', array('id'=>$id)); if ($messagebody !== '') { $url->param('messagebody', $messagebody); } +##################NEW################# +if ($messagesubject !== '') { + $url->param('messagesubject', $messagesubject); +} +##################NEW################# if ($send !== '') { $url->param('send', $send); } @@ -140,16 +147,27 @@ if (!empty($messagebody) && !$edit && !$deluser && ($preview || $send)) { + + '; - echo "

".get_string('previewhtml')."

\n".format_text($messagebody,$format)."\n
\n"; + echo "

".get_string('previewhtml')."


\n"; + if ($messagesubject != null){ + echo "
\n ".get_string('messagesubject').":
".$messagesubject."\n"; + echo "

"; + }else{ + echo""; + } + + echo"
\n".format_text($messagebody,$format)."\n
\n"; echo '

'."\n"; echo '

'; echo "\n"; } else if (!empty($send)) { $good = 1; foreach ($SESSION->emailto[$id] as $user) { - $good = $good && message_post_message($USER,$user,$messagebody,$format); + $good = $good && message_post_message($USER,$user,$messagebody,$format, $messagesubject); } +##################NEW################# if (!empty($good)) { echo $OUTPUT->heading(get_string('messagedselectedusers')); unset($SESSION->emailto[$id]); -- 1.9.0.msysgit.0