Skip to content

Commit

Permalink
message MDL-24972 made search box smaller and added highlighting of c…
Browse files Browse the repository at this point in the history
…urrently selected user
  • Loading branch information
Andrew Davis committed Nov 2, 2010
1 parent 37a75be commit a402c30
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
17 changes: 11 additions & 6 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function message_get_contacts($user1=null, &$user2=null) {
return array($onlinecontacts, $offlinecontacts, $strangers);
}

function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $refresh=true, $contactselecturl=null, $minmessages=0, $showactionlinks=true, $titletodisplay=null) {
function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $refresh=true, $contactselecturl=null, $minmessages=0, $showactionlinks=true, $titletodisplay=null, $user2=null) {
global $CFG, $PAGE, $OUTPUT;

$countonlinecontacts = count($onlinecontacts);
Expand Down Expand Up @@ -335,7 +335,7 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $

foreach ($onlinecontacts as $contact) {
if ($minmessages==0 || $contact->messagecount>=$minmessages) {
message_print_contactlist_user($contact, IS_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks);
message_print_contactlist_user($contact, IS_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks, $user2);
}
}
}
Expand All @@ -351,7 +351,7 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $

foreach ($offlinecontacts as $contact) {
if ($minmessages==0 || $contact->messagecount>=$minmessages) {
message_print_contactlist_user($contact, IS_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks);
message_print_contactlist_user($contact, IS_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks, $user2);
}
}
echo '<tr><td colspan="3">&nbsp;</td></tr>';
Expand All @@ -365,7 +365,7 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $

foreach ($strangers as $stranger) {
if ($minmessages==0 || $stranger->messagecount>=$minmessages) {
message_print_contactlist_user($stranger, IS_NOT_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks);
message_print_contactlist_user($stranger, IS_NOT_CONTACT, IS_NOT_BLOCKED, $contactselecturl, $showactionlinks, $user2);
}
}
}
Expand Down Expand Up @@ -1601,11 +1601,16 @@ function message_get_participants() {
* @param $incontactlist is the user a contact of ours?
* @param $selectcontacturl string the url to send the user to when a contact's name is clicked
*/
function message_print_contactlist_user($contact, $incontactlist = true, $isblocked = false, $selectcontacturl = null, $showactionlinks = true) {
function message_print_contactlist_user($contact, $incontactlist = true, $isblocked = false, $selectcontacturl = null, $showactionlinks = true, $selecteduser=null) {
global $OUTPUT, $USER;
$fullname = fullname($contact);
$fullnamelink = $fullname;

$linkclass = '';
if (!empty($selecteduser) && $contact->id==$selecteduser->id) {
$linkclass = 'messageselecteduser';
}

/// are there any unread messages for this contact?
if ($contact->messagecount > 0 ){
$fullnamelink = '<strong>'.$fullnamelink.' ('.$contact->messagecount.')</strong>';
Expand Down Expand Up @@ -1641,7 +1646,7 @@ function message_print_contactlist_user($contact, $incontactlist = true, $isbloc
$link = new moodle_url("/message/index.php?id=$contact->id");
$action = new popup_action('click', $link, "message_$contact->id", $popupoptions);
}
echo $OUTPUT->action_link($link, $fullnamelink, $action, array('title'=>get_string('sendmessageto', 'message', $fullname)));
echo $OUTPUT->action_link($link, $fullnamelink, $action, array('class'=>$linkclass,'title'=>get_string('sendmessageto', 'message', $fullname)));

echo '</td>';
echo '<td class="link">&nbsp;'.$strcontact.$strblock.'&nbsp;'.$strhistory.'</td>';
Expand Down
2 changes: 1 addition & 1 deletion message/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<table cellpadding="5" class="message_form">
<tr>
<td colspan="3" class="message_heading mdl-left">
<input type="text" name="combinedsearch" size="50" id="combinedsearch" value="<?php echo $combinedsearchstring; ?>" />
<input type="text" name="combinedsearch" size="40" id="combinedsearch" value="<?php echo $combinedsearchstring; ?>" />
<input type="submit" name="combinedsubmit" value="<?php print_string('searchcombined','message') ?>" />
<a href="contacts.php?advanced=1" id="advancedcontactsearchlink"><?php print_string('advanced') ?></a>
</td>
Expand Down
4 changes: 2 additions & 2 deletions message/search_advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</tr>
<tr>
<td><label for="name"><?php print_string('name') ?></label></td>
<td><input type="text" name="name" size="50" id="name" value="<? echo $personsearch ?>" /></td>
<td><input type="text" name="name" size="40" id="name" value="<? echo $personsearch ?>" /></td>
<td><input type="submit" name="personsubmit" value="<?php print_string('searchforperson','message') ?>" /></td>
</tr>
<tr>
Expand All @@ -29,7 +29,7 @@
</tr>
<tr>
<td><label for="keywords"><?php print_string('keywords', 'message') ?></label></td>
<td><input type="text" name="keywords" id="keywords" size="50" value="<? echo $messagesearch ?>" /></td>
<td><input type="text" name="keywords" id="keywords" size="40" value="<? echo $messagesearch ?>" /></td>
<td><input type="submit" name="keywordssubmit" value="<?php print_string('searchmessages','message') ?>" /></td>
</tr>

Expand Down
1 change: 1 addition & 0 deletions theme/base/style/message.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ table.message .searchresults td {padding:5px;}

.message .contactselector {width:24%;float:left;}
.message .contactselector .contact {text-align:left;}
.message .contactselector .messageselecteduser {font-weight:bold;}

.message .messagearea {padding-left:1%;border-left:1px solid LightGrey;width:74%;float:right;min-height:200px;}
.message .messagearea .messagehistorytype {clear:both;padding-bottom:20px;}
Expand Down

0 comments on commit a402c30

Please sign in to comment.