From 0cc5b5a34cdc48534ee171fdcbb3876f3b430c6a Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Fri, 24 Sep 2010 06:10:53 +0000 Subject: [PATCH] MDL-24367, fixed 'Show only new' feature in basic chat ui --- mod/chat/gui_basic/index.php | 22 +++++++++++++--------- mod/chat/view.php | 11 ++++++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/mod/chat/gui_basic/index.php b/mod/chat/gui_basic/index.php index 19eb29bfc28..fab3f4ebb99 100644 --- a/mod/chat/gui_basic/index.php +++ b/mod/chat/gui_basic/index.php @@ -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 '
'; -echo '

'.get_string('participants').'

'; -echo '
    '; +echo '
    '; +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 '
      '; foreach($chatusers as $chu) { echo '
    • '; echo $OUTPUT->user_picture($chu, array('size'=>24, 'courseid'=>$course->id)); @@ -130,11 +134,11 @@ foreach($chatusers as $chu) { echo '
    '; echo ''; } -echo '
'; +echo ''; +echo $OUTPUT->box_end(); echo '
'; echo '
'; -$usehtmleditor = can_use_html_editor(); echo '

'; echo '
'; echo ''; @@ -151,7 +155,7 @@ echo ''; echo '
'; echo '
'; -echo '

'.get_string('messages', 'chat').'

'; +echo $OUTPUT->heading(get_string('messages', 'chat'), 2, 'mdl-left'); $allmessages = array(); $options = new stdClass(); @@ -186,6 +190,6 @@ if (empty($allmessages)) { } } -echo '
'; +echo '
'; +echo $OUTPUT->container_end(); echo $OUTPUT->footer(); - diff --git a/mod/chat/view.php b/mod/chat/view.php index 15583fdbb85..cc2a64bcf65 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -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 = "&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 '

'; echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700))); echo '

'; @@ -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 '

'; echo $OUTPUT->action_link($link, get_string('noframesjs', 'message'), $action, array('title'=>get_string('modulename', 'chat'))); echo '

';