mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'm29_MDL-48060' of https://github.com/totara/moodle
This commit is contained in:
commit
aa94403ab2
124
message/lib.php
124
message/lib.php
@ -181,12 +181,11 @@ function message_print_participants($context, $courseid, $contactselecturl=null,
|
||||
$pagingbar = new paging_bar($countparticipants, $page, MESSAGE_CONTACTS_PER_PAGE, $PAGE->url, 'page');
|
||||
echo $OUTPUT->render($pagingbar);
|
||||
|
||||
echo html_writer::start_tag('table', array('id' => 'message_participants', 'class' => 'boxaligncenter', 'cellspacing' => '2', 'cellpadding' => '0', 'border' => '0'));
|
||||
echo html_writer::start_tag('div', array('id' => 'message_participants', 'class' => 'boxaligncenter'));
|
||||
|
||||
echo html_writer::start_tag('tr');
|
||||
echo html_writer::tag('td', $titletodisplay, array('colspan' => 3, 'class' => 'heading'));
|
||||
echo html_writer::end_tag('tr');
|
||||
echo html_writer::tag('div' , $titletodisplay, array('class' => 'heading'));
|
||||
|
||||
$users = '';
|
||||
foreach ($participants as $participant) {
|
||||
if ($participant->id != $USER->id) {
|
||||
|
||||
@ -205,11 +204,16 @@ function message_print_participants($context, $courseid, $contactselecturl=null,
|
||||
}
|
||||
|
||||
$participant->messagecount = 0;//todo it would be nice if the course participant could report new messages
|
||||
message_print_contactlist_user($participant, $iscontact, $isblocked, $contactselecturl, $showactionlinks, $user2);
|
||||
$content = message_print_contactlist_user($participant, $iscontact, $isblocked,
|
||||
$contactselecturl, $showactionlinks, $user2);
|
||||
$users .= html_writer::tag('li', $content);
|
||||
}
|
||||
}
|
||||
if (strlen($users) > 0) {
|
||||
echo html_writer::tag('ul', $users, array('id' => 'message-courseparticipants', 'class' => 'message-contacts'));
|
||||
}
|
||||
|
||||
echo html_writer::end_tag('table');
|
||||
echo html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -266,31 +270,31 @@ function message_get_blocked_users($user1=null, $user2=null) {
|
||||
* @return void
|
||||
*/
|
||||
function message_print_blocked_users($blockedusers, $contactselecturl=null, $showactionlinks=true, $titletodisplay=null, $user2=null) {
|
||||
global $DB, $USER;
|
||||
global $OUTPUT;
|
||||
|
||||
$countblocked = count($blockedusers);
|
||||
|
||||
echo html_writer::start_tag('table', array('id' => 'message_contacts', 'class' => 'boxaligncenter'));
|
||||
echo html_writer::start_tag('div', array('id' => 'message_contacts', 'class' => 'boxaligncenter'));
|
||||
|
||||
if (!empty($titletodisplay)) {
|
||||
echo html_writer::start_tag('tr');
|
||||
echo html_writer::tag('td', $titletodisplay, array('colspan' => 3, 'class' => 'heading'));
|
||||
echo html_writer::end_tag('tr');
|
||||
echo html_writer::tag('div', $titletodisplay, array('class' => 'heading'));
|
||||
}
|
||||
|
||||
if ($countblocked) {
|
||||
echo html_writer::start_tag('tr');
|
||||
echo html_writer::tag('td', get_string('blockedusers', 'message', $countblocked), array('colspan' => 3, 'class' => 'heading'));
|
||||
echo html_writer::end_tag('tr');
|
||||
echo html_writer::tag('div', get_string('blockedusers', 'message', $countblocked), array('class' => 'heading'));
|
||||
|
||||
$isuserblocked = true;
|
||||
$isusercontact = false;
|
||||
$blockeduserslist = '';
|
||||
foreach ($blockedusers as $blockeduser) {
|
||||
message_print_contactlist_user($blockeduser, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
|
||||
$content = message_print_contactlist_user($blockeduser, $isusercontact, $isuserblocked,
|
||||
$contactselecturl, $showactionlinks, $user2);
|
||||
$blockeduserslist .= html_writer::tag('li', $content);
|
||||
}
|
||||
echo html_writer::tag('ul', $blockeduserslist, array('id' => 'message-blockedusers', 'class' => 'message-contacts'));
|
||||
}
|
||||
|
||||
echo html_writer::end_tag('table');
|
||||
echo html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -417,59 +421,78 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $
|
||||
echo html_writer::tag('div', get_string('contactlistempty', 'message'), array('class' => 'heading'));
|
||||
}
|
||||
|
||||
echo html_writer::start_tag('table', array('id' => 'message_contacts', 'class' => 'boxaligncenter'));
|
||||
|
||||
if (!empty($titletodisplay)) {
|
||||
message_print_heading($titletodisplay);
|
||||
echo html_writer::tag('div', $titletodisplay, array('class' => 'heading'));
|
||||
}
|
||||
|
||||
if($countonlinecontacts) {
|
||||
// Print out list of online contacts.
|
||||
|
||||
if (empty($titletodisplay)) {
|
||||
message_print_heading(get_string('onlinecontacts', 'message', $countonlinecontacts));
|
||||
echo html_writer::tag('div',
|
||||
get_string('onlinecontacts', 'message', $countonlinecontacts),
|
||||
array('class' => 'heading'));
|
||||
}
|
||||
|
||||
$isuserblocked = false;
|
||||
$isusercontact = true;
|
||||
$contacts = '';
|
||||
foreach ($onlinecontacts as $contact) {
|
||||
if ($minmessages == 0 || $contact->messagecount >= $minmessages) {
|
||||
message_print_contactlist_user($contact, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
|
||||
$content = message_print_contactlist_user($contact, $isusercontact, $isuserblocked,
|
||||
$contactselecturl, $showactionlinks, $user2);
|
||||
$contacts .= html_writer::tag('li', $content);
|
||||
}
|
||||
}
|
||||
if (strlen($contacts) > 0) {
|
||||
echo html_writer::tag('ul', $contacts, array('id' => 'message-onlinecontacts', 'class' => 'message-contacts'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($countofflinecontacts) {
|
||||
// Print out list of offline contacts.
|
||||
|
||||
if (empty($titletodisplay)) {
|
||||
message_print_heading(get_string('offlinecontacts', 'message', $countofflinecontacts));
|
||||
echo html_writer::tag('div',
|
||||
get_string('offlinecontacts', 'message', $countofflinecontacts),
|
||||
array('class' => 'heading'));
|
||||
}
|
||||
|
||||
$isuserblocked = false;
|
||||
$isusercontact = true;
|
||||
$contacts = '';
|
||||
foreach ($offlinecontacts as $contact) {
|
||||
if ($minmessages == 0 || $contact->messagecount >= $minmessages) {
|
||||
message_print_contactlist_user($contact, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
|
||||
$content = message_print_contactlist_user($contact, $isusercontact, $isuserblocked,
|
||||
$contactselecturl, $showactionlinks, $user2);
|
||||
$contacts .= html_writer::tag('li', $content);
|
||||
}
|
||||
}
|
||||
if (strlen($contacts) > 0) {
|
||||
echo html_writer::tag('ul', $contacts, array('id' => 'message-offlinecontacts', 'class' => 'message-contacts'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Print out list of incoming contacts.
|
||||
if ($countstrangers) {
|
||||
message_print_heading(get_string('incomingcontacts', 'message', $countstrangers));
|
||||
echo html_writer::tag('div', get_string('incomingcontacts', 'message', $countstrangers), array('class' => 'heading'));
|
||||
|
||||
$isuserblocked = false;
|
||||
$isusercontact = false;
|
||||
$contacts = '';
|
||||
foreach ($strangers as $stranger) {
|
||||
if ($minmessages == 0 || $stranger->messagecount >= $minmessages) {
|
||||
message_print_contactlist_user($stranger, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
|
||||
$content = message_print_contactlist_user($stranger, $isusercontact, $isuserblocked,
|
||||
$contactselecturl, $showactionlinks, $user2);
|
||||
$contacts .= html_writer::tag('li', $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($contacts) > 0) {
|
||||
echo html_writer::tag('ul', $contacts, array('id' => 'message-incommingcontacts', 'class' => 'message-contacts'));
|
||||
}
|
||||
|
||||
echo html_writer::end_tag('table');
|
||||
}
|
||||
|
||||
if ($countstrangers && ($countonlinecontacts + $countofflinecontacts == 0)) { // Extra help
|
||||
echo html_writer::tag('div','('.get_string('addsomecontactsincoming', 'message').')',array('class' => 'note'));
|
||||
@ -2022,7 +2045,7 @@ function message_print_message_history($user1, $user2 ,$search = '', $messagelim
|
||||
|
||||
$strcontact = message_get_contact_add_remove_link($user2->iscontact, $user2->isblocked, $user2, $script, $text, $icon);
|
||||
$strblock = message_get_contact_block_link($user2->iscontact, $user2->isblocked, $user2, $script, $text, $icon);
|
||||
$useractionlinks = $strcontact.' |'.$strblock;
|
||||
$useractionlinks = $strcontact.' | '.$strblock;
|
||||
|
||||
echo html_writer::tag('div', $useractionlinks, array('class' => 'useractionlinks'));
|
||||
}
|
||||
@ -2211,6 +2234,7 @@ function message_print_contactlist_user($contact, $incontactlist = true, $isbloc
|
||||
global $OUTPUT, $USER, $COURSE;
|
||||
$fullname = fullname($contact);
|
||||
$fullnamelink = $fullname;
|
||||
$output = '';
|
||||
|
||||
$linkclass = '';
|
||||
if (!empty($selecteduser) && $contact->id == $selecteduser->id) {
|
||||
@ -2233,12 +2257,9 @@ function message_print_contactlist_user($contact, $incontactlist = true, $isbloc
|
||||
$strhistory = message_history_link($USER->id, $contact->id, true, '', '', 'icon');
|
||||
}
|
||||
|
||||
echo html_writer::start_tag('tr');
|
||||
echo html_writer::start_tag('td', array('class' => 'pix'));
|
||||
echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => $COURSE->id));
|
||||
echo html_writer::end_tag('td');
|
||||
|
||||
echo html_writer::start_tag('td', array('class' => 'contact'));
|
||||
$output .= html_writer::start_tag('div', array('class' => 'pix'));
|
||||
$output .= $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => $COURSE->id));
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$popupoptions = array(
|
||||
'height' => MESSAGE_DISCUSSION_HEIGHT,
|
||||
@ -2257,13 +2278,23 @@ 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('class' => $linkclass,'title' => get_string('sendmessageto', 'message', $fullname)));
|
||||
|
||||
echo html_writer::end_tag('td');
|
||||
|
||||
echo html_writer::tag('td', ' '.$strcontact.$strblock.' '.$strhistory, array('class' => 'link'));
|
||||
if (strlen($strcontact . $strblock . $strhistory) > 0) {
|
||||
$output .= html_writer::tag('div', $strcontact . $strblock . $strhistory, array('class' => 'link'));
|
||||
|
||||
echo html_writer::end_tag('tr');
|
||||
$output .= html_writer::start_tag('div', array('class' => 'contact'));
|
||||
$linkattr = array('class' => $linkclass, 'title' => get_string('sendmessageto', 'message', $fullname));
|
||||
$output .= $OUTPUT->action_link($link, $fullnamelink, $action, $linkattr);
|
||||
$output .= html_writer::end_tag('div');
|
||||
} else {
|
||||
$output .= html_writer::start_tag('div', array('class' => 'contact nolinks'));
|
||||
$linkattr = array('class' => $linkclass, 'title' => get_string('sendmessageto', 'message', $fullname));
|
||||
$output .= $OUTPUT->action_link($link, $fullnamelink, $action, $linkattr);
|
||||
$output .= html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2310,9 +2341,9 @@ function message_get_contact_block_link($incontactlist, $isblocked, $contact, $s
|
||||
//$strblock = '';
|
||||
} else*/
|
||||
if ($isblocked) {
|
||||
$strblock = ' '.message_contact_link($contact->id, 'unblock', true, $script, $text, $icon);
|
||||
$strblock = message_contact_link($contact->id, 'unblock', true, $script, $text, $icon);
|
||||
} else{
|
||||
$strblock = ' '.message_contact_link($contact->id, 'block', true, $script, $text, $icon);
|
||||
$strblock = message_contact_link($contact->id, 'block', true, $script, $text, $icon);
|
||||
}
|
||||
|
||||
return $strblock;
|
||||
@ -2403,19 +2434,6 @@ function message_mark_message_read($message, $timeread, $messageworkingempty=fal
|
||||
return $messagereadid;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function that prints a formatted heading
|
||||
*
|
||||
* @param string $title the heading to display
|
||||
* @param int $colspan
|
||||
* @return void
|
||||
*/
|
||||
function message_print_heading($title, $colspan=3) {
|
||||
echo html_writer::start_tag('tr');
|
||||
echo html_writer::tag('td', $title, array('colspan' => $colspan, 'class' => 'heading'));
|
||||
echo html_writer::end_tag('tr');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all message processors, validate corresponding plugin existance and
|
||||
* system configuration
|
||||
|
@ -18,13 +18,13 @@ Feature: Manage contacts
|
||||
When I click on "Add contact" "link" in the "User Two" "table_row"
|
||||
Then I should see "Message 1 from user1 to user2"
|
||||
And I should see "Message 2 from user1 to user2"
|
||||
And I should see "User Two" in the "#message_contacts" "css_element"
|
||||
And I should see "User Two" in the ".contactselector" "css_element"
|
||||
And I follow "Remove contact"
|
||||
And I should not see "User Two" in the "#message_contacts" "css_element"
|
||||
And I should not see "User Two" in the ".contactselector" "css_element"
|
||||
And I should not see "Remove contact"
|
||||
And I should see "Add contact"
|
||||
And I follow "Add contact"
|
||||
And I should see "User Two" in the "#message_contacts" "css_element"
|
||||
And I should see "User Two" in the ".contactselector" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Adding and removing contacts with Javascript enabled
|
||||
|
@ -5,7 +5,7 @@
|
||||
.message .noframesjslink {font-size:0.8em;}
|
||||
.message .link {font-size:0.8em;}
|
||||
|
||||
.message .heading {font-size:1.0em;font-weight:bold;}
|
||||
.message .heading {font-size:1.0em;font-weight:bold;clear:both;}
|
||||
|
||||
.message .author {font-weight: bold;}
|
||||
.message .time {font-style: italic;}
|
||||
@ -26,10 +26,51 @@ table.message_search_results td {border-color:#DDDDDD;}
|
||||
.message .note {padding:10px;}
|
||||
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 .contactselector .paging {z-index:1;position:relative;}
|
||||
.message .contactselector {
|
||||
width: 24%;
|
||||
float: left;
|
||||
}
|
||||
.message .message-contacts {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.message .message-contacts li {
|
||||
clear: both;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.message .message-contacts li .pix {
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.dir-rtl .message .message-contacts li .pix {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
.message .message-contacts li .contact {
|
||||
font-weight: bold;
|
||||
margin: 0 24% 0 25px;
|
||||
text-align: left;
|
||||
}
|
||||
.dir-rtl .message .message-contacts li .contact {
|
||||
text-align: right;
|
||||
margin: 0 25px 0 24%;
|
||||
}
|
||||
.message .message-contacts li .contact.nolinks {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.dir-rtl .message .message-contacts li .contact.nolinks {
|
||||
margin-left: 5px;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.message .message-contacts li .link {
|
||||
float: right;
|
||||
max-width: 30%;
|
||||
}
|
||||
.dir-rtl .message .message-contacts li .link {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.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;}
|
||||
@ -70,7 +111,8 @@ table.message .searchresults td {padding:5px;}
|
||||
float: right;
|
||||
}
|
||||
|
||||
.message .messagearea .messagehistory .heading {width:100%;clear:both;}
|
||||
.message .messagearea .messagehistory .heading,
|
||||
.message .messagearea .messagehistory h3 {width:100%;clear:both;}
|
||||
.message .messagearea .messagehistory .left {padding-bottom:10px;width:50%;float:left;clear:both;}
|
||||
.dir-rtl .message .messagearea .messagehistory .left { float: right; }
|
||||
.message .messagearea .messagehistory .right {padding-bottom:10px;width:50%;float:right;clear:both;}
|
||||
@ -157,4 +199,4 @@ table.message .searchresults td {padding:5px;}
|
||||
}
|
||||
.dir-rtl .core_message-messenger-sendmessage .message-send {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
.message .heading {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
clear: both;
|
||||
}
|
||||
.message .author {
|
||||
font-weight: bold;
|
||||
@ -46,16 +47,52 @@ table.message .searchresults td {
|
||||
width: 24%;
|
||||
float: left;
|
||||
}
|
||||
.message .contactselector .contact {
|
||||
text-align: left;
|
||||
|
||||
.message .message-contacts {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
|
||||
li {
|
||||
clear: both;
|
||||
position: relative;
|
||||
min-height: 23px;
|
||||
|
||||
.pix {
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.contact {
|
||||
font-weight: bold;
|
||||
margin: 0 24% 0 25px;
|
||||
text-align: left;
|
||||
}
|
||||
.contact.nolinks {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.link {
|
||||
float: right;
|
||||
max-width: 30%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.message .contactselector .messageselecteduser {
|
||||
font-weight: bold;
|
||||
}
|
||||
.message .contactselector .paging {
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
|
||||
.dir-rtl .message .message-contacts li {
|
||||
.pix {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
.contact {
|
||||
margin: 0 25px 0 24%;
|
||||
}
|
||||
.contact.nolinks {
|
||||
margin-right: 25px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.link {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
.message .messagearea {
|
||||
padding-left: 1%;
|
||||
border-left: 1px solid @tableBorder;
|
||||
@ -288,4 +325,4 @@ table.message .searchresults td {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@
|
||||
}
|
||||
@media (max-width : 767px) {
|
||||
.row-fluid .desktop-first-column {
|
||||
clear: right;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
// Forms
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user