From fd7006f6b43b11ddc51ac745f71879afe424aafe Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 3 Jan 2005 10:49:40 +0000 Subject: [PATCH] Some tweaks here and there to the display --- message/index.php | 2 +- message/lib.php | 60 +++++++++++++++++++++------------- message/search.html | 4 +-- message/settings.html | 2 +- message/user.php | 8 +++-- theme/standardxhtml/styles.php | 16 +++++++++ 6 files changed, 62 insertions(+), 30 deletions(-) diff --git a/message/index.php b/message/index.php index 2fecc81243..a1fe38b871 100644 --- a/message/index.php +++ b/message/index.php @@ -45,7 +45,7 @@ $tabprintfunction = 'message_print_'.$tab; if ($tab == 'contacts') { print_header(get_string('messages', 'message').' - '.$SITE->fullname, '', '', '', - ''); + ''); } else { print_header(get_string('messages', 'message').' - '.$SITE->fullname); } diff --git a/message/lib.php b/message/lib.php index 6196bb937c..d22aab65c7 100644 --- a/message/lib.php +++ b/message/lib.php @@ -3,8 +3,14 @@ define ('MESSAGE_SHORTLENGTH', 300); -define ('MESSAGE_WINDOW', true); -define ('MESSAGE_CONTACTS_REFRESH', 30); +define ('MESSAGE_WINDOW', true); // We are in a message window (so don't pop up a new one!) + +if (!isset($CFG->message_contacts_refresh)) { // Refresh the contacts list every 30 seconds + $CFG->message_contacts_refresh = 30; +} +if (!isset($CFG->message_chat_refresh)) { // Look for new comments every 5 seconds + $CFG->message_chat_refresh = 5; +} function message_print_contacts() { @@ -22,13 +28,13 @@ function message_print_contacts() { FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom AND mc.blocked='0' - ORDER BY u.lastaccess DESC"); + ORDER BY u.firstname ASC"); $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom AND mc.blocked='0' - ORDER BY u.lastaccess DESC"); + ORDER BY u.firstname ASC"); $unreadmessages = get_records_sql("SELECT m.id, m.useridfrom, u.firstname, u.lastname, u.picture FROM {$CFG->prefix}user u, {$CFG->prefix}message m @@ -44,8 +50,8 @@ function message_print_contacts() { $countcontacts = (is_array($onlinecontacts)) ? count($onlinecontacts) : 0; - echo ''; - echo ''.get_string('onlinecontacts', 'message', $countcontacts).''; + echo ''; + echo get_string('onlinecontacts', 'message', $countcontacts); echo ''; if (!empty($onlinecontacts)) { @@ -80,8 +86,8 @@ function message_print_contacts() { $countcontacts = (is_array($offlinecontacts)) ? count($offlinecontacts) : 0; - echo ''; - echo ''.get_string('offlinecontacts', 'message', $countcontacts).''; + echo ''; + echo get_string('offlinecontacts', 'message', $countcontacts); echo ''; if (!empty($offlinecontacts)) { @@ -141,8 +147,8 @@ function message_print_contacts() { /// print out list of incoming contacts if (!empty($unknownmessages)) { - echo ''; - echo ''.get_string('incomingcontacts', 'message', count($unknownmessages)).''; + echo ''; + echo get_string('incomingcontacts', 'message', count($unknownmessages)); echo ''; foreach ($unknownmessages as $messageuser) { @@ -172,7 +178,7 @@ function message_print_contacts() { echo ''; - echo '

'.get_string('pagerefreshes', 'message', MESSAGE_CONTACTS_REFRESH).'

'; + echo '

'.get_string('pagerefreshes', 'message', $CFG->message_contacts_refresh).'

'; } @@ -237,7 +243,7 @@ function message_print_settings() { } $cbshowmessagewindow = (get_user_preferences('message_showmessagewindow', 1) == '1') ? 'checked="checked"' : ''; - $cbbeepnewmessage = (get_user_preferences('message_beepnewmessage', 1) == '1') ? 'checked="checked"' : ''; + $cbbeepnewmessage = (get_user_preferences('message_beepnewmessage', 0) == '1') ? 'checked="checked"' : ''; $txmaxmessages = get_user_preferences('message_maxmessages', 20); $txdeletemessagesdays = get_user_preferences('message_deletemessagesdays', 30); $cbemailmessages = (get_user_preferences('message_emailmessages', 1) == '1') ? 'checked="checked"' : ''; @@ -305,7 +311,7 @@ function message_get_contact($contactid) { function message_print_search_results($frm) { - global $ME, $USER; + global $ME, $USER, $CFG; echo '
'; @@ -399,19 +405,20 @@ function message_print_search_results($frm) { } /// print heading with number of results - echo ''.get_string('keywordssearchresults', 'message', count($messages)).''; + echo ''.get_string('keywordssearchresults', 'message', count($messages)).''; /// print table headings - echo ''; + echo '
'; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo "\n"; $blockedcount = 0; $dateformat = get_string('strftimedatetime'); + $strmore = get_string('more'); foreach ($messages as $message) { /// ignore messages to and from blocked users unless $frm->includeblocked is set @@ -463,7 +470,8 @@ function message_print_search_results($frm) { message_print_user($userto, $tocontact, $toblocked); echo ''; echo ''; echo ''; echo "\n"; @@ -566,8 +574,8 @@ function message_contact_link($userid, $linktype='add', $return=false) { } } -function message_history_link ($userid1, $userid2=0, $returnstr=false, $position='') { - global $USER; +function message_history_link ($userid1, $userid2=0, $returnstr=false, $position='', $linktext='') { + global $USER, $CFG; if (!$userid2) { $userid2 = $USER->id; @@ -576,8 +584,14 @@ function message_history_link ($userid1, $userid2=0, $returnstr=false, $position $position = "#$position"; } + if ($linktext == 'icon') { + $linktext = ''; + } else if ($linktext == '') { + $linktext = get_string('messagehistory', 'message'); + } + $str = link_to_popup_window("/message/history.php?user1=$userid1&user2=$userid2$position", - "message_history_$user->id", get_string('messagehistory', 'message'), 500, 500, '', + "message_history_$user->id", $linktext, 500, 500, '', 'menubar=0,location=0,status,scrollbars,resizable,width=500,height=500', true); if ($returnstr) { diff --git a/message/search.html b/message/search.html index 85c5edf5d7..bb159e0691 100644 --- a/message/search.html +++ b/message/search.html @@ -6,7 +6,7 @@ - + @@ -24,7 +24,7 @@ - + diff --git a/message/settings.html b/message/settings.html index 2fa133b001..4c8dc8ecb9 100644 --- a/message/settings.html +++ b/message/settings.html @@ -37,7 +37,7 @@ - + diff --git a/message/user.php b/message/user.php index 645c32d0cc..781a449b50 100644 --- a/message/user.php +++ b/message/user.php @@ -19,6 +19,7 @@ /// By default, print frameset to contain all the various panes if (!$frame) { + $USER->message_user_refresh[$user->id] = time(); ?> <?php echo get_string('discussion', 'message').': '.fullname($user) ?> @@ -58,6 +59,8 @@ echo ''; echo '
'.get_string('from').''.get_string('to').''.get_string('message', 'message').''.get_string('timesent', 'message').''.get_string('from').''.get_string('to').''.get_string('message', 'message').''.get_string('timesent', 'message').'
'.message_shorten_message($message->message, 20); - echo ' '.message_history_link($message->useridto, $message->useridfrom, true, $datestring); + echo ' ...('.message_history_link($message->useridto, $message->useridfrom, true, $datestring, + $strmore.' ').')'; echo ''.userdate($message->timecreated, $dateformat).'
:
:

'; echo ''; // Close possible theme tables off + + $USER->message_user_refresh[$user->id] = time(); break; case 'messages': /// Print the main frame containing the current chat @@ -74,7 +77,7 @@ header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Type: text/html"); - header("Refresh: 5; url=user.php?id=$user->id&frame=refresh"); + header("Refresh: $CFG->message_chat_refresh; url=user.php?id=$user->id&frame=refresh"); echo ''; if ($messages = get_records_select('message', "useridto = '$USER->id' AND useridfrom = '$user->id'", @@ -107,8 +110,7 @@ echo "parent.messages.scroll(1,5000000);\n"; echo "\n\n"; } - $timeago = time() - $user->lastaccess; - if ($user->lastaccess and $timeago > 300) { + if ($user->lastaccess > $USER->message_user_refresh[$user->id]) { echo '\n\n"; diff --git a/theme/standardxhtml/styles.php b/theme/standardxhtml/styles.php index 32d2e30c4e..5a8378e018 100644 --- a/theme/standardxhtml/styles.php +++ b/theme/standardxhtml/styles.php @@ -825,6 +825,7 @@ TABLE.formtable TD { } .message_link { font-size: x-small; + vertical-align: center; } .message_pix { font-size: x-small; @@ -832,3 +833,18 @@ TABLE.formtable TD { .message_form { font-size: 0.78em; } +.message_heading { + font-size: medium; + font-weight: bold; + text-align:center; +} +.message_search_results { + border-collapse: collapse; + border-spacing: 0px; +} +TABLE.message_search_results TD { + border-width: 1px; + border-color: borders?>; + border-style: solid; + padding: 5px; +} -- 2.39.5