"MDL-8224, fixed chat module"

This commit is contained in:
Dongsheng Cai 2010-04-25 15:14:36 +00:00
parent c944495eed
commit 50d7699489
4 changed files with 51 additions and 29 deletions

View File

@ -35,15 +35,16 @@ require_capability('mod/chat:chat',$context);
$groupname = '';
}
// if requested theme doesn't exist, use default 'bubble' theme
if (!file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) {
$theme = 'bubble';
}
// login chat room
if (!$chat_sid = chat_login_user($chat->id, 'ajax', $groupid, $course)) {
print_error('cantlogin', 'chat');
}
if (!file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) {
$theme = 'bubble';
}
$module = array(
'name' => 'mod_chat_ajax', // chat gui's are not real plugins, we have to break the naming standards for JS modules here :-(
'fullpath' => '/mod/chat/gui_ajax/module.js',
@ -67,6 +68,7 @@ $PAGE->requires->js_init_call('M.mod_chat_ajax.init', array($modulecfg), false,
$PAGE->set_title(get_string('modulename', 'chat').": $course->shortname: ".format_string($chat->name,true)."$groupname");
$PAGE->add_body_class('yui-skin-sam');
$PAGE->set_pagelayout('embedded');
$PAGE->requires->css('/mod/chat/gui_ajax/theme/'.$theme.'/chat.css');
echo $OUTPUT->header();
echo $OUTPUT->box('<ul id="users-list"></ul>', '', 'chat-userlist');
@ -74,12 +76,8 @@ echo $OUTPUT->box('', '', 'chat-options');
echo $OUTPUT->box('<ul id="messages-list"></ul>', '', 'chat-messages');
$table = new html_table();
$table->data = array(
array(
' &raquo;<input type="text" disabled="true" id="input-message" value="Loading..." size="50" /><input type="button" id="button-send" value="'.get_string('send', 'chat').'" />',
'<a id="choosetheme" href="###">'.get_string('themes').' ▶</a>'
)
array(' &raquo; <input type="text" disabled="true" id="input-message" value="Loading..." size="50" /> <input type="button" id="button-send" value="'.get_string('send', 'chat').'" /> <a id="choosetheme" href="###">'.get_string('themes').' &raquo; </a>')
);
echo $OUTPUT->box(html_writer::table($table), '', 'chat-input-area');
echo $OUTPUT->box('', '', 'chat-notify');
echo $OUTPUT->footer();

View File

@ -15,6 +15,12 @@
border-radius: 9px;
-moz-border-radius: 9px;
}
.mdl-chat-entry, .mdl-chat-my-entry {
clear:both;
}
.chat-message td {
padding: 0;
}
.mdl-chat-entry .topleft { background:transparent url(bubbles.png) no-repeat scroll left top; height:9px; width:18px; }
.mdl-chat-entry .top { background:transparent url(horizontal.png) repeat-x scroll center top; font-size:1px; height:9px; }
@ -35,3 +41,11 @@
.mdl-chat-my-entry .left{background:url(vertical.png) repeat-y -29px 0;width:11px;}
.mdl-chat-my-entry .right{background:url(vertical.png) repeat-y right;width:18px;}
.mdl-chat-my-entry .conmts{background:#C0E668;color:#000;}
#chat-input-area ,#chat-input-area table.generaltable, #chat-input-area table.generaltable td.cell {
background: #92B3E8;
border: 0;
}
#chat-userlist {
background: #E3E8F0;
height: 100%;
}

View File

@ -12,9 +12,7 @@
background:#FFFFFF url(input.png) repeat-x scroll 0 0;
border: 1px solid #999;
}
.chat-message {
margin: 3px;
}
.mdl-chat-entry .meta {
background: #82b5ee;
border-bottom: 1px solid white;
@ -24,28 +22,40 @@
border-top-right-radius: 6px;
}
.mdl-chat-entry .text{
.mdl-chat-entry , .mdl-chat-my-entry {
margin: 1em auto;
border: 1px solid #938F5A
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
border-bottom-left-radius:6px;
border-bottom-right-radius:6px;
}
.mdl-chat-entry .chat-message .text{
color:white;
background:#82b5ee;
}
.chat-message {
padding: 3px;
background: #82b5ee;
border:1px solid #CCC;
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
border-bottom-left-radius:6px;
border-bottom-right-radius:6px;
}
.mdl-chat-my-entry .meta {
background: #f3f3f3;
.mdl-chat-my-entry .chat-message .meta {
background: #FFFEEB;
border-bottom: 1px solid white;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
.mdl-chat-my-entry .text{
padding: 3px;
background: #f3f3f3;
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
border-bottom-left-radius:6px;
border-bottom-right-radius:6px;
.mdl-chat-my-entry .chat-message .text{
background: #F1F3CB;
}
#chat-input-area ,#chat-input-area table.generaltable, #chat-input-area table.generaltable td.cell {
background: #92B3E8;
border: 0;
margin: 0;
padding: 2px;
}
#chat-userlist {
background: #E3E8F0;
height: 100%;
}

View File

@ -1234,7 +1234,7 @@ function chat_extend_navigation($navigation, $course, $module, $cm) {
$currentgroup = groups_get_activity_group($cm, true);
if (has_capability('mod/chat:chat', get_context_instance(CONTEXT_MODULE, $cm->context))) {
if (has_capability('mod/chat:chat', get_context_instance(CONTEXT_MODULE, $cm->instance))) {
$strenterchat = get_string('enterchat', 'chat');
$target = $CFG->wwwroot.'/mod/chat/';
@ -1309,4 +1309,4 @@ function chat_extend_settings_navigation(settings_navigation $settings, navigati
$chatnode->add(get_string('viewreport', 'chat'), new moodle_url('/mod/chat/report.php', array('id'=>$PAGE->cm->id)));
}
}
}
}