Some tweaks here and there to the display

This commit is contained in:
moodler 2005-01-03 10:49:40 +00:00
parent e4eb5a273d
commit fd7006f6b4
6 changed files with 62 additions and 30 deletions

View file

@ -45,7 +45,7 @@ $tabprintfunction = 'message_print_'.$tab;
if ($tab == 'contacts') { if ($tab == 'contacts') {
print_header(get_string('messages', 'message').' - '.$SITE->fullname, '', '', '', print_header(get_string('messages', 'message').' - '.$SITE->fullname, '', '', '',
'<meta http-equiv="refresh" content="'. MESSAGE_CONTACTS_REFRESH .'; url=index.php" />'); '<meta http-equiv="refresh" content="'. $CFG->message_contacts_refresh .'; url=index.php" />');
} else { } else {
print_header(get_string('messages', 'message').' - '.$SITE->fullname); print_header(get_string('messages', 'message').' - '.$SITE->fullname);
} }

View file

@ -3,8 +3,14 @@
define ('MESSAGE_SHORTLENGTH', 300); define ('MESSAGE_SHORTLENGTH', 300);
define ('MESSAGE_WINDOW', true); define ('MESSAGE_WINDOW', true); // We are in a message window (so don't pop up a new one!)
define ('MESSAGE_CONTACTS_REFRESH', 30);
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() { function message_print_contacts() {
@ -22,13 +28,13 @@ function message_print_contacts() {
FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom
AND mc.blocked='0' 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 $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 FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom
AND mc.blocked='0' 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 $unreadmessages = get_records_sql("SELECT m.id, m.useridfrom, u.firstname, u.lastname, u.picture
FROM {$CFG->prefix}user u, {$CFG->prefix}message m FROM {$CFG->prefix}user u, {$CFG->prefix}message m
@ -44,8 +50,8 @@ function message_print_contacts() {
$countcontacts = (is_array($onlinecontacts)) ? count($onlinecontacts) : 0; $countcontacts = (is_array($onlinecontacts)) ? count($onlinecontacts) : 0;
echo '<tr><td colspan="3">'; echo '<tr><td colspan="3" class="message_heading">';
echo '<strong>'.get_string('onlinecontacts', 'message', $countcontacts).'</strong>'; echo get_string('onlinecontacts', 'message', $countcontacts);
echo '</td></tr>'; echo '</td></tr>';
if (!empty($onlinecontacts)) { if (!empty($onlinecontacts)) {
@ -80,8 +86,8 @@ function message_print_contacts() {
$countcontacts = (is_array($offlinecontacts)) ? count($offlinecontacts) : 0; $countcontacts = (is_array($offlinecontacts)) ? count($offlinecontacts) : 0;
echo '<tr><td colspan="3">'; echo '<tr><td colspan="3" class="message_heading">';
echo '<strong>'.get_string('offlinecontacts', 'message', $countcontacts).'</strong>'; echo get_string('offlinecontacts', 'message', $countcontacts);
echo '</td></tr>'; echo '</td></tr>';
if (!empty($offlinecontacts)) { if (!empty($offlinecontacts)) {
@ -141,8 +147,8 @@ function message_print_contacts() {
/// print out list of incoming contacts /// print out list of incoming contacts
if (!empty($unknownmessages)) { if (!empty($unknownmessages)) {
echo '<tr><td colspan="3">'; echo '<tr><td colspan="3" class="message_heading">';
echo '<strong>'.get_string('incomingcontacts', 'message', count($unknownmessages)).'</strong>'; echo get_string('incomingcontacts', 'message', count($unknownmessages));
echo '</td></tr>'; echo '</td></tr>';
foreach ($unknownmessages as $messageuser) { foreach ($unknownmessages as $messageuser) {
@ -172,7 +178,7 @@ function message_print_contacts() {
echo '</table>'; echo '</table>';
echo '<p align="center" class="message_small_note">'.get_string('pagerefreshes', 'message', MESSAGE_CONTACTS_REFRESH).'</p>'; echo '<p align="center" class="message_small_note">'.get_string('pagerefreshes', 'message', $CFG->message_contacts_refresh).'</p>';
} }
@ -237,7 +243,7 @@ function message_print_settings() {
} }
$cbshowmessagewindow = (get_user_preferences('message_showmessagewindow', 1) == '1') ? 'checked="checked"' : ''; $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); $txmaxmessages = get_user_preferences('message_maxmessages', 20);
$txdeletemessagesdays = get_user_preferences('message_deletemessagesdays', 30); $txdeletemessagesdays = get_user_preferences('message_deletemessagesdays', 30);
$cbemailmessages = (get_user_preferences('message_emailmessages', 1) == '1') ? 'checked="checked"' : ''; $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) { function message_print_search_results($frm) {
global $ME, $USER; global $ME, $USER, $CFG;
echo '<div align="center">'; echo '<div align="center">';
@ -402,16 +408,17 @@ function message_print_search_results($frm) {
echo '<strong>'.get_string('keywordssearchresults', 'message', count($messages)).'</strong>'; echo '<strong>'.get_string('keywordssearchresults', 'message', count($messages)).'</strong>';
/// print table headings /// print table headings
echo '<table class="message_users" cellpadding="5" border="0">'; echo '<table class="message_search_results">';
echo '<tr>'; echo '<tr>';
echo '<td align="center"><strong>'.get_string('from').'</strong></td>'; echo '<td><strong>'.get_string('from').'</strong></td>';
echo '<td align="center"><strong>'.get_string('to').'</strong></td>'; echo '<td><strong>'.get_string('to').'</strong></td>';
echo '<td align="center"><strong>'.get_string('message', 'message').'</strong></td>'; echo '<td><strong>'.get_string('message', 'message').'</strong></td>';
echo '<td align="center"><strong>'.get_string('timesent', 'message').'</strong></td>'; echo '<td><strong>'.get_string('timesent', 'message').'</strong></td>';
echo "</tr>\n"; echo "</tr>\n";
$blockedcount = 0; $blockedcount = 0;
$dateformat = get_string('strftimedatetime'); $dateformat = get_string('strftimedatetime');
$strmore = get_string('more');
foreach ($messages as $message) { foreach ($messages as $message) {
/// ignore messages to and from blocked users unless $frm->includeblocked is set /// 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); message_print_user($userto, $tocontact, $toblocked);
echo '</td>'; echo '</td>';
echo '<td class="message_summary">'.message_shorten_message($message->message, 20); echo '<td class="message_summary">'.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.'&nbsp;<img src="'.$CFG->pixpath.'/t/log.gif" height="11" width="11" border="0">').')';
echo '</td>'; echo '</td>';
echo '<td class="message_date">'.userdate($message->timecreated, $dateformat).'</td>'; echo '<td class="message_date">'.userdate($message->timecreated, $dateformat).'</td>';
echo "</tr>\n"; echo "</tr>\n";
@ -566,8 +574,8 @@ function message_contact_link($userid, $linktype='add', $return=false) {
} }
} }
function message_history_link ($userid1, $userid2=0, $returnstr=false, $position='') { function message_history_link ($userid1, $userid2=0, $returnstr=false, $position='', $linktext='') {
global $USER; global $USER, $CFG;
if (!$userid2) { if (!$userid2) {
$userid2 = $USER->id; $userid2 = $USER->id;
@ -576,8 +584,14 @@ function message_history_link ($userid1, $userid2=0, $returnstr=false, $position
$position = "#$position"; $position = "#$position";
} }
if ($linktext == 'icon') {
$linktext = '<img src="'.$CFG->pixpath.'/t/log.gif" height="11" width="11" border="0">';
} else if ($linktext == '') {
$linktext = get_string('messagehistory', 'message');
}
$str = link_to_popup_window("/message/history.php?user1=$userid1&user2=$userid2$position", $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); 'menubar=0,location=0,status,scrollbars,resizable,width=500,height=500', true);
if ($returnstr) { if ($returnstr) {

View file

@ -6,7 +6,7 @@
<tr> <tr>
<td colspan="3"><strong><?php print_string('searchforperson', 'message') ?></strong></td> <td colspan="3" class="message_heading"><?php print_string('searchforperson', 'message') ?></td>
</tr> </tr>
<tr> <tr>
<td align="right"><?php print_string('name') ?>:</td> <td align="right"><?php print_string('name') ?>:</td>
@ -24,7 +24,7 @@
<tr> <tr>
<td colspan="3"><strong><?php print_string('searchmessages', 'message') ?></strong></td> <td colspan="3" class="message_heading"><?php print_string('searchmessages', 'message') ?></td>
</tr> </tr>
<tr> <tr>
<td align="right"><?php print_string('keywords', 'message') ?>:</td> <td align="right"><?php print_string('keywords', 'message') ?>:</td>

View file

@ -37,7 +37,7 @@
</tr> </tr>
<tr valign="top"> <tr valign="top">
<td colspan="3" align="center"><input type="submit" value="<?php print_string('savemysettings', 'message') ?>" /></td> <td colspan="3" align="center"><br /><input type="submit" value="<?php print_string('savemysettings', 'message') ?>" /></td>
</tr> </tr>

View file

@ -19,6 +19,7 @@
/// By default, print frameset to contain all the various panes /// By default, print frameset to contain all the various panes
if (!$frame) { if (!$frame) {
$USER->message_user_refresh[$user->id] = time();
?> ?>
<html> <html>
<head><title><?php echo get_string('discussion', 'message').': '.fullname($user) ?></title></head> <head><title><?php echo get_string('discussion', 'message').': '.fullname($user) ?></title></head>
@ -58,6 +59,8 @@
echo '</td>'; echo '</td>';
echo '</tr></table>'; echo '</tr></table>';
echo '</table></table></body>'; // Close possible theme tables off echo '</table></table></body>'; // Close possible theme tables off
$USER->message_user_refresh[$user->id] = time();
break; break;
case 'messages': /// Print the main frame containing the current chat case 'messages': /// Print the main frame containing the current chat
@ -74,7 +77,7 @@
header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Content-Type: text/html"); 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 '<body>'; echo '<body>';
if ($messages = get_records_select('message', "useridto = '$USER->id' AND useridfrom = '$user->id'", 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 "parent.messages.scroll(1,5000000);\n";
echo "</script>\n\n"; echo "</script>\n\n";
} }
$timeago = time() - $user->lastaccess; if ($user->lastaccess > $USER->message_user_refresh[$user->id]) {
if ($user->lastaccess and $timeago > 300) {
echo '<script language="Javascript">'; echo '<script language="Javascript">';
echo "parent.info.document.location.replace('$CFG->wwwroot/message/user.php?id=$user->id&frame=info');\n"; echo "parent.info.document.location.replace('$CFG->wwwroot/message/user.php?id=$user->id&frame=info');\n";
echo "</script>\n\n"; echo "</script>\n\n";

View file

@ -825,6 +825,7 @@ TABLE.formtable TD {
} }
.message_link { .message_link {
font-size: x-small; font-size: x-small;
vertical-align: center;
} }
.message_pix { .message_pix {
font-size: x-small; font-size: x-small;
@ -832,3 +833,18 @@ TABLE.formtable TD {
.message_form { .message_form {
font-size: 0.78em; 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: <?PHP echo $THEME->borders?>;
border-style: solid;
padding: 5px;
}