mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-42711 ported less style for chat from learnmoodle. added ability to choose course theme's css - this will use ONLY the css available from the theme to style this chat box.
This commit is contained in:
parent
5386f0bbfe
commit
fcb2b77ffa
3 changed files with 10 additions and 24 deletions
|
@ -4,7 +4,7 @@ require_once('../lib.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT);
|
$id = required_param('id', PARAM_INT);
|
||||||
$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
|
$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
|
||||||
$theme = optional_param('theme', 'compact', PARAM_SAFEDIR);
|
$theme = optional_param('theme', 'course_theme', PARAM_SAFEDIR); //course_theme to use the current theme.
|
||||||
|
|
||||||
$url = new moodle_url('/mod/chat/gui_ajax/index.php', array('id'=>$id));
|
$url = new moodle_url('/mod/chat/gui_ajax/index.php', array('id'=>$id));
|
||||||
if ($groupid !== 0) {
|
if ($groupid !== 0) {
|
||||||
|
@ -37,7 +37,7 @@ require_capability('mod/chat:chat', $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if requested theme doesn't exist, use default 'bubble' theme
|
// if requested theme doesn't exist, use default 'bubble' theme
|
||||||
if (!file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) {
|
if ($theme != 'course_theme' and !file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) {
|
||||||
$theme = 'compact';
|
$theme = 'compact';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,9 @@ $PAGE->requires->js_init_call('M.mod_chat_ajax.init', array($modulecfg), false,
|
||||||
$PAGE->set_title(get_string('modulename', 'chat').": $courseshortname: ".format_string($chat->name,true)."$groupname");
|
$PAGE->set_title(get_string('modulename', 'chat').": $courseshortname: ".format_string($chat->name,true)."$groupname");
|
||||||
$PAGE->add_body_class('yui-skin-sam');
|
$PAGE->add_body_class('yui-skin-sam');
|
||||||
$PAGE->set_pagelayout('embedded');
|
$PAGE->set_pagelayout('embedded');
|
||||||
$PAGE->requires->css('/mod/chat/gui_ajax/theme/'.$theme.'/chat.css');
|
if ( $theme != 'course_theme') {
|
||||||
|
$PAGE->requires->css('/mod/chat/gui_ajax/theme/'.$theme.'/chat.css');
|
||||||
|
}
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
echo $OUTPUT->box(html_writer::tag('h2', get_string('participants'), array('class' => 'accesshide')) .
|
echo $OUTPUT->box(html_writer::tag('h2', get_string('participants'), array('class' => 'accesshide')) .
|
||||||
|
|
|
@ -116,28 +116,11 @@ M.mod_chat_ajax.init = function(Y, cfg) {
|
||||||
}, this.cfg.timer, this);
|
}, this.cfg.timer, this);
|
||||||
|
|
||||||
// Create and initalise theme changing menu
|
// Create and initalise theme changing menu
|
||||||
/*
|
|
||||||
this.thememenu = new Y.Overlay({
|
|
||||||
bodyContent : '<div class="menuitem"><a href="'+this.cfg.chaturl+'&theme=bubble">Bubble</a></div><div class="menuitem"><a href="'+this.cfg.chaturl+'&theme=compact">Compact</a></div>',
|
|
||||||
visible : false,
|
|
||||||
zIndex : 2,
|
|
||||||
align : {
|
|
||||||
node : '#choosetheme',
|
|
||||||
points : [Y.WidgetPositionExt.BL, Y.WidgetPositionExt.BR]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.thememenu.render(document.body);
|
|
||||||
Y.one('#choosetheme').on('click', function(e){
|
|
||||||
this.show();
|
|
||||||
this.get('boundingBox').setStyle('visibility', 'visible');
|
|
||||||
}, this.thememenu);
|
|
||||||
|
|
||||||
return;
|
|
||||||
*/
|
|
||||||
this.thememenu = new Y.YUI2.widget.Menu('basicmenu', {xy:[0,0]});
|
this.thememenu = new Y.YUI2.widget.Menu('basicmenu', {xy:[0,0]});
|
||||||
this.thememenu.addItems([
|
this.thememenu.addItems([
|
||||||
{text: "Bubble", url: this.cfg.chaturl+'&theme=bubble'},
|
{text: "Bubble", url: this.cfg.chaturl+'&theme=bubble'},
|
||||||
{text: "Compact", url: this.cfg.chaturl+'&theme=compact'}
|
{text: "Compact", url: this.cfg.chaturl+'&theme=compact'},
|
||||||
|
{text: "Course theme", url: this.cfg.chaturl+'&theme=course_theme'}
|
||||||
]);
|
]);
|
||||||
this.thememenu.render(document.body);
|
this.thememenu.render(document.body);
|
||||||
Y.one('#choosetheme').on('click', function(e){
|
Y.one('#choosetheme').on('click', function(e){
|
||||||
|
@ -156,8 +139,8 @@ M.mod_chat_ajax.init = function(Y, cfg) {
|
||||||
},
|
},
|
||||||
|
|
||||||
send : function(e, beep) {
|
send : function(e, beep) {
|
||||||
this.sendbutton.set('value', M.str.chat.sending);
|
this.sendbutton.set('value', this.cfg.theme);
|
||||||
|
// alert(this.cfg.theme);
|
||||||
var data = {
|
var data = {
|
||||||
chat_message : (!beep)?this.messageinput.get('value'):'',
|
chat_message : (!beep)?this.messageinput.get('value'):'',
|
||||||
chat_sid : this.cfg.sid,
|
chat_sid : this.cfg.sid,
|
||||||
|
|
|
@ -43,6 +43,7 @@ body {
|
||||||
@import "moodle/blocks";
|
@import "moodle/blocks";
|
||||||
@import "moodle/forms";
|
@import "moodle/forms";
|
||||||
@import "moodle/modules";
|
@import "moodle/modules";
|
||||||
|
@import "moodle/chat";
|
||||||
@import "moodle/reports";
|
@import "moodle/reports";
|
||||||
@import "moodle/backup-restore";
|
@import "moodle/backup-restore";
|
||||||
@import "moodle/tables";
|
@import "moodle/tables";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue