MDL-24367, fixed 'Show only new' feature in basic chat ui

This commit is contained in:
Dongsheng Cai 2010-09-24 06:10:53 +00:00
parent 2473693278
commit 0cc5b5a34c
2 changed files with 21 additions and 12 deletions

View File

@ -109,14 +109,18 @@ if (!empty($refresh) and data_submitted()) {
chat_delete_old_users();
redirect('index.php?id='.$id.'&newonly='.$newonly.'&last='.$last);
$url = new moodle_url('/mod/chat/gui_basic/index.php', array('id'=>$id, 'newonly'=>$newonly, 'last'=>$last));
redirect($url);
}
$PAGE->set_title("$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname");
echo $OUTPUT->header();
echo '<div id="page-mod-chat-gui_basic">';
echo '<h2>'.get_string('participants').'</h2>';
echo '<div id="participants"><ul>';
echo '<div id="">';
echo $OUTPUT->container_start(null, 'page-mod-chat-gui_basic');
echo $OUTPUT->heading(get_string('participants'), 2, 'mdl-left');
echo $OUTPUT->box_start('generalbox', 'participants');
echo '<ul>';
foreach($chatusers as $chu) {
echo '<li class="clearfix">';
echo $OUTPUT->user_picture($chu, array('size'=>24, 'courseid'=>$course->id));
@ -130,11 +134,11 @@ foreach($chatusers as $chu) {
echo '</div>';
echo '</li>';
}
echo '</ul></div>';
echo '</ul>';
echo $OUTPUT->box_end();
echo '<div id="send">';
echo '<form id="editing" method="post" action="index.php">';
$usehtmleditor = can_use_html_editor();
echo '<h2><label for="message">'.get_string('sendmessage', 'message').'</label></h2>';
echo '<div>';
echo '<input type="text" id="message" name="message" value="'.s($refreshedmessage, true).'" size="60" />';
@ -151,7 +155,7 @@ echo '</form>';
echo '</div>';
echo '<div id="messages">';
echo '<h2>'.get_string('messages', 'chat').'</h2>';
echo $OUTPUT->heading(get_string('messages', 'chat'), 2, 'mdl-left');
$allmessages = array();
$options = new stdClass();
@ -186,6 +190,6 @@ if (empty($allmessages)) {
}
}
echo '</div></div>';
echo '</div>';
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -91,9 +91,12 @@ $groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id");
// url parameters
$params = array();
if ($currentgroup) {
$groupselect = " AND groupid = '$currentgroup'";
$groupparam = "&amp;groupid=$currentgroup";
$params['groupid'] = $currentgroup;
} else {
$groupselect = "";
$groupparam = "";
@ -114,7 +117,8 @@ if (has_capability('mod/chat:chat',$context)) {
}
if (empty($USER->screenreader)) {
$chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam";
$params['id'] = $chat->id;
$chattarget = new moodle_url("/mod/chat/gui_$CFG->chat_method/index.php", $params);
echo '<p>';
echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
echo '</p>';
@ -124,8 +128,9 @@ if (has_capability('mod/chat:chat',$context)) {
// users with screenreader set, will only see 1 link, to the manual refresh page
// for better accessibility
// show frame/js-less alternative
$link = new moodle_url("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam");
$action = new popup_action('click', $link, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700));
$params['id'] = $chat->id;
$link = new moodle_url('/mod/chat/gui_basic/index.php', $params);
$action = new popup_action('click', $link, "chat{$course->id}{$chat->id}{$groupparam}", array('height' => 500, 'width' => 700));
echo '<p>';
echo $OUTPUT->action_link($link, get_string('noframesjs', 'message'), $action, array('title'=>get_string('modulename', 'chat')));
echo '</p>';