From: skodak Date: Wed, 27 Dec 2006 16:06:17 +0000 (+0000) Subject: MDL-7950 Display only new messages option and other minor changes in jsless messaging ui X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=adb61bc20312043f1ea370b3acb4a96a9059c8d4;p=moodle.git MDL-7950 Display only new messages option and other minor changes in jsless messaging ui --- diff --git a/lang/en_utf8/message.php b/lang/en_utf8/message.php index 6e93ba40fa..07bc43167c 100644 --- a/lang/en_utf8/message.php +++ b/lang/en_utf8/message.php @@ -34,6 +34,7 @@ $string['messages'] = 'Messages'; $string['messaging'] = 'Messaging'; $string['mycontacts'] = 'My Contacts'; $string['newsearch'] = 'New search'; +$string['newonlymsg'] = 'Show only new'; $string['noframesjs'] = 'Version without frames and JavaScript'; $string['nomessages'] = 'No messages waiting'; $string['nomessagesfound'] = 'No messages were found'; diff --git a/message/discussion.php b/message/discussion.php index 635df4ab72..84e6c6b356 100644 --- a/message/discussion.php +++ b/message/discussion.php @@ -61,6 +61,8 @@ $message = optional_param('message', '', PARAM_CLEAN); $format = optional_param('format', FORMAT_MOODLE, PARAM_INT); $refresh = optional_param('refresh', '', PARAM_RAW); + $last = optional_param('last', 0, PARAM_INT); + $newonly = optional_param('newonly', 0, PARAM_BOOL); $addcontact = optional_param('addcontact', 0, PARAM_INT); // adding a contact $removecontact = optional_param('removecontact', 0, PARAM_INT); // removing a contact @@ -111,7 +113,7 @@ if ($message!='') { message_post_message($USER, $user, $message, $format, 'direct'); } - redirect('discussion.php?id='.$userid.'&start='.$start.'&noframesjs='.$noframesjs); + redirect('discussion.php?id='.$userid.'&start='.$start.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last); } @@ -122,27 +124,27 @@ echo '
'; echo '
'; echo print_user_picture($user->id, SITEID, $user->picture, 48, true, true, 'userwindow'); - echo '

'.get_string('discussion', 'message').': '.$userfullname.'

'; + echo '

'.$userfullname.'

'; echo '
    '; if ($contact = get_record('message_contacts', 'userid', $USER->id, 'contactid', $user->id)) { if ($contact->blocked) { echo '
  • '; - message_contact_link($user->id, 'add', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'add', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; - message_contact_link($user->id, 'unblock', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'unblock', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; } else { echo '
  • '; - message_contact_link($user->id, 'remove', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'remove', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; - message_contact_link($user->id, 'block', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'block', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; } } else { echo '
  • '; - message_contact_link($user->id, 'add', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'add', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; - message_contact_link($user->id, 'block', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs, true); + message_contact_link($user->id, 'block', false, 'discussion.php?id='.$user->id.'&noframesjs='.$noframesjs.'&newonly='.$newonly.'&last='.$last, true); echo '
  • '; } echo '
  • '; @@ -157,10 +159,12 @@ echo ''; echo ''; echo ''; + echo ''; echo ''; $usehtmleditor = (can_use_html_editor() && get_user_preferences('message_usehtmleditor', 0)); echo '

    '; + echo '
    '; if ($usehtmleditor) { print_textarea(true, 8, 34, 100, 100, 'message', $refreshedmessage); 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'); @@ -169,8 +173,11 @@ print_textarea(false, 8, 50, 0, 0, 'message', $refreshedmessage); echo ''; } - echo '
     '; + echo '
    '; + echo ' '; echo ''; + echo ''; + echo '
    '; echo ''; echo '
'; @@ -183,7 +190,13 @@ $options->para = false; $options->newlines = true; - if ($messages = get_records_select('message_read', "(useridto = '$USER->id' AND useridfrom = '$userid' AND timeread > '$start') OR (useridto = '$userid' AND useridfrom = '$USER->id' AND timeread > '$start')")) { + if ($newonly) { + $lastsql = " AND timecreated > $last"; + } else { + $lastsql = ""; + } + + if ($messages = get_records_select('message_read', "(useridto = '$USER->id' AND useridfrom = '$userid' AND timeread > '$start' $lastsql) OR (useridto = '$userid' AND useridfrom = '$USER->id' AND timeread > '$start' $lastsql)")) { foreach ($messages as $message) { $time = userdate($message->timecreated, get_string('strftimedaytime')); @@ -203,7 +216,7 @@ } } - if ($messages = get_records_select('message', "useridto = '$userid' AND useridfrom = '$USER->id'")) { + if ($messages = get_records_select('message', "useridto = '$userid' AND useridfrom = '$USER->id' $lastsql")) { foreach ($messages as $message) { $time = userdate($message->timecreated, get_string('strftimedaytime')); @@ -217,7 +230,7 @@ } } - if ($messages = get_records_select('message', "useridto = '$USER->id' AND useridfrom = '$userid'")) { + if ($messages = get_records_select('message', "useridto = '$USER->id' AND useridfrom = '$userid' $lastsql")) { foreach ($messages as $message) { $time = userdate($message->timecreated, get_string('strftimedaytime')); diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index d6cb1eef9f..c23f735ea0 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1369,7 +1369,7 @@ body#grade-index .grades .weighted { } .message-discussion-noframes #userinfo .name { - text-align:left; + text-align:center; margin-left:60px; }