Some tweaks here and there to the display
authormoodler <moodler>
Mon, 3 Jan 2005 10:49:40 +0000 (10:49 +0000)
committermoodler <moodler>
Mon, 3 Jan 2005 10:49:40 +0000 (10:49 +0000)
message/index.php
message/lib.php
message/search.html
message/settings.html
message/user.php
theme/standardxhtml/styles.php

index 2fecc812434933ede4b4fe2006d20b0917f3780e..a1fe38b871f930e0168c3ffc3379d4cce0e6112e 100644 (file)
@@ -45,7 +45,7 @@ $tabprintfunction = 'message_print_'.$tab;
 
 if ($tab == 'contacts') {
     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 {
     print_header(get_string('messages', 'message').' - '.$SITE->fullname);
 }
index 6196bb937c3578321109c0131bd326aee3fd0411..d22aab65c73d90cf46a60dc79d249e8afb09afa2 100644 (file)
@@ -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 '<tr><td colspan="3">';
-    echo '<strong>'.get_string('onlinecontacts', 'message', $countcontacts).'</strong>';
+    echo '<tr><td colspan="3" class="message_heading">';
+    echo get_string('onlinecontacts', 'message', $countcontacts);
     echo '</td></tr>';
     
     if (!empty($onlinecontacts)) {
@@ -80,8 +86,8 @@ function message_print_contacts() {
     
     $countcontacts = (is_array($offlinecontacts)) ? count($offlinecontacts) : 0;
     
-    echo '<tr><td colspan="3">';
-    echo '<strong>'.get_string('offlinecontacts', 'message', $countcontacts).'</strong>';
+    echo '<tr><td colspan="3" class="message_heading">';
+    echo get_string('offlinecontacts', 'message', $countcontacts);
     echo '</td></tr>';
     
     if (!empty($offlinecontacts)) {
@@ -141,8 +147,8 @@ function message_print_contacts() {
 
 /// print out list of incoming contacts
     if (!empty($unknownmessages)) {
-        echo '<tr><td colspan="3">';
-        echo '<strong>'.get_string('incomingcontacts', 'message', count($unknownmessages)).'</strong>';
+        echo '<tr><td colspan="3" class="message_heading">';
+        echo get_string('incomingcontacts', 'message', count($unknownmessages));
         echo '</td></tr>';
 
         foreach ($unknownmessages as $messageuser) {
@@ -172,7 +178,7 @@ function message_print_contacts() {
 
     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"' : '';
-    $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 '<div align="center">';
 
@@ -399,19 +405,20 @@ function message_print_search_results($frm) {
             }
 
         /// print heading with number of results
-        echo '<strong>'.get_string('keywordssearchresults', 'message', count($messages)).'</strong>';
+            echo '<strong>'.get_string('keywordssearchresults', 'message', count($messages)).'</strong>';
 
         /// print table headings
-            echo '<table class="message_users" cellpadding="5" border="0">';
+            echo '<table class="message_search_results">';
             echo '<tr>';
-            echo '<td align="center"><strong>'.get_string('from').'</strong></td>';
-            echo '<td align="center"><strong>'.get_string('to').'</strong></td>';
-            echo '<td align="center"><strong>'.get_string('message', 'message').'</strong></td>';
-            echo '<td align="center"><strong>'.get_string('timesent', 'message').'</strong></td>';
+            echo '<td><strong>'.get_string('from').'</strong></td>';
+            echo '<td><strong>'.get_string('to').'</strong></td>';
+            echo '<td><strong>'.get_string('message', 'message').'</strong></td>';
+            echo '<td><strong>'.get_string('timesent', 'message').'</strong></td>';
             echo "</tr>\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 '</td>';
                 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 class="message_date">'.userdate($message->timecreated, $dateformat).'</td>';
                 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='') {
-    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 = '<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", 
-                    "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) {
index 85c5edf5d7f142828689f551ddf7c246a2aab138..bb159e0691ff1a7fdf1022d7e32efd9326470c61 100644 (file)
@@ -6,7 +6,7 @@
 
 
     <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>
         <td align="right"><?php print_string('name') ?>:</td>
@@ -24,7 +24,7 @@
 
 
     <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>
         <td align="right"><?php print_string('keywords', 'message') ?>:</td>
index 2fa133b0012a2c72873ff5f75d4d7dfd59af2b56..4c8dc8ecb9fb8cfab688bf5ba70b8e8d3d5fb150 100644 (file)
@@ -37,7 +37,7 @@
     </tr>
 
     <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>
 
 
index 645c32d0cc2cca279adb6f8c78ce7119c2f76b22..781a449b50a120f28166bf5a2fd8fc3b202d2f5f 100644 (file)
@@ -19,6 +19,7 @@
 
 /// By default, print frameset to contain all the various panes
     if (!$frame) {
+        $USER->message_user_refresh[$user->id] = time();
     ?>
     <html>
      <head><title><?php echo get_string('discussion', 'message').': '.fullname($user) ?></title></head>
@@ -58,6 +59,8 @@
             echo '</td>';
             echo '</tr></table>';
             echo '</table></table></body>'; // 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 '<body>';
             if ($messages = get_records_select('message', "useridto = '$USER->id' AND useridfrom = '$user->id'", 
                 echo "parent.messages.scroll(1,5000000);\n";
                 echo "</script>\n\n";
             }
-            $timeago = time() - $user->lastaccess;
-            if ($user->lastaccess and $timeago > 300) {
+            if ($user->lastaccess > $USER->message_user_refresh[$user->id]) {
                 echo '<script language="Javascript">';
                 echo "parent.info.document.location.replace('$CFG->wwwroot/message/user.php?id=$user->id&frame=info');\n";
                 echo "</script>\n\n";
index 32d2e30c4e712f81d8de355f4a3f8548dde65a38..5a8378e018bd5d1a8496f5cd2df44ed63a8394c2 100644 (file)
@@ -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: <?PHP echo $THEME->borders?>;
+    border-style: solid;
+    padding: 5px;
+}