diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index a699935f51e..11ccacf9d67 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -56,20 +56,19 @@ class block_calendar_month extends block_base { $courseset = true; $SESSION->cal_courses_shown[$this->page->course->id] = $this->page->course; } - + // Be VERY careful with the format for default courses arguments! // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions. calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false); + $this->page->requires->js('calendar/calendar.js'); if ($courseshown == SITEID) { // For the front page - $this->content->text .= calendar_overlib_html(); $this->content->text .= calendar_top_controls('frontpage', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y)); $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y); // No filters for now } else { // For any other course - $this->content->text .= calendar_overlib_html(); $this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y)); $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y); $this->content->text .= '<h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>'; diff --git a/calendar/calendar.js b/calendar/calendar.js new file mode 100644 index 00000000000..5259e121b0a --- /dev/null +++ b/calendar/calendar.js @@ -0,0 +1,15 @@ +function attach_calendar_panel(properties) { + YAHOO.namespace("moodle.container"); + YAHOO.moodle.container[properties.id] = new YAHOO.widget.Panel(properties.id+'_panel', { + width:"320px", + visible:false, + draggable:false, + close:false, + constraintoviewport:true + } ); + YAHOO.moodle.container[properties.id].setHeader(properties.title); + YAHOO.moodle.container[properties.id].setBody(properties.content); + YAHOO.moodle.container[properties.id].render(properties.id); + YAHOO.util.Event.addListener(properties.id, 'mouseover', YAHOO.moodle.container[properties.id].show, YAHOO.moodle.container[properties.id], true); + YAHOO.util.Event.addListener(properties.id, 'mouseout', YAHOO.moodle.container[properties.id].hide, YAHOO.moodle.container[properties.id], true); +} \ No newline at end of file diff --git a/calendar/event.php b/calendar/event.php index ea18110a71e..d2549102346 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -283,8 +283,6 @@ echo $OUTPUT->header(); - echo calendar_overlib_html(); - echo '<table id="calendar">'; echo '<tr><td class="maincalendar">'; diff --git a/calendar/export.php b/calendar/export.php index 0ebc55899cb..f759edfc542 100644 --- a/calendar/export.php +++ b/calendar/export.php @@ -75,8 +75,6 @@ $PAGE->set_focuscontrol('eventform.name'); echo $OUTPUT->header(); -echo calendar_overlib_html(); - // Layout the whole page as three big columns. echo '<table id="calendar">'; echo '<tr>'; diff --git a/calendar/lib.php b/calendar/lib.php index 0b30f972606..dce38bd0d91 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -347,6 +347,11 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y * @return $popup string, contains onmousover and onmouseout events. */ function calendar_get_popup($is_today, $event_timestart, $popupcontent='') { + global $PAGE; + static $popupcount; + if ($popupcount === null) { + $popupcount = 1; + } $popupcaption = ''; if($is_today) { $popupcaption = get_string('today', 'calendar').' '; @@ -358,10 +363,11 @@ function calendar_get_popup($is_today, $event_timestart, $popupcontent='') { } else { $popupcaption .= get_string('eventsfor', 'calendar', userdate($event_timestart, get_string('strftimedayshort'))); } - $popupcontent = addslashes_js(s($popupcontent)); - $popupcaption = addslashes_js(s($popupcaption)); - $popup = 'onmouseover="return overlib(\''.$popupcontent.'\', CAPTION, \''.$popupcaption.'\');" onmouseout="return nd();"'; - return $popup; + $id = 'calendar_tooltip_'.$popupcount; + $PAGE->requires->yui_lib('container'); + $PAGE->requires->js_function_call('attach_calendar_panel', Array(Array('id'=>$id,'title'=>$popupcaption, 'content'=>$popupcontent))); + $popupcount++; + return 'id="'.$id.'"'; } function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxevents, $fromtime=0) { @@ -1180,14 +1186,6 @@ function calendar_session_vars($course=null) { } } -function calendar_overlib_html() { - global $PAGE; - $output = ''; - $output .= $PAGE->requires->js('calendar/overlib.cfg.php')->asap(); - $output .= '<div id="overDiv" style="position: absolute; visibility: hidden; z-index:1000;"></div>'; - return $output; -} - function calendar_set_referring_course($courseid) { global $SESSION; $SESSION->cal_course_referer = intval($courseid); diff --git a/calendar/overlib.cfg.php b/calendar/overlib.cfg.php deleted file mode 100644 index eb2221a5862..00000000000 --- a/calendar/overlib.cfg.php +++ /dev/null @@ -1,10 +0,0 @@ -ol_delay = 350; -ol_fgclass = 'cal_popup_fg'; -ol_bgclass = 'cal_popup_bg'; -ol_cgclass = 'cal_popup_cg'; -ol_captionfontclass = 'cal_popup_caption'; -ol_noclose = true; -ol_sticky = true; -ol_close = 'X'; -ol_offsety = -1; -ol_mouseoff = 1; diff --git a/calendar/view.php b/calendar/view.php index 4cb9bc8e8f1..8c17594a2f6 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -133,6 +133,8 @@ $strcalendar = get_string('calendar', 'calendar'); $prefsbutton = calendar_preferences_button(); + $PAGE->requires->js('calendar/calendar.js'); + // Print title and header $PAGE->set_title("$site->shortname: $strcalendar: $pagetitle"); $PAGE->set_heading($strcalendar); @@ -141,8 +143,6 @@ echo $OUTPUT->header(); - echo calendar_overlib_html(); - // Layout the whole page as three big columns. echo '<table id="calendar" style="height:100%;">'; echo '<tr>'; diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 2eab35fa45e..0ba3f079a14 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -119,6 +119,8 @@ $PAGE->requires->yui_lib('element'); $PAGE->requires->yui_lib('container'); $PAGE->requires->js('grade/report/grader/functions.js'); $PAGE->requires->js('grade/report/grader/grader.js'); +$PAGE->requires->js('lib/overlib/overlib.js')->in_head(); +$PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); if ($report->get_pref('enableajax')) { $report = new grade_report_grader_ajax($courseid, $gpr, $context, $page, $sortitemid); diff --git a/group/overview.php b/group/overview.php index c207a3e0b0f..0b14a741c93 100644 --- a/group/overview.php +++ b/group/overview.php @@ -115,6 +115,9 @@ if ($rs = $DB->get_recordset_sql($sql, $params)) { $rs->close(); } +$PAGE->requires->js('lib/overlib/overlib.js')->in_head(); +$PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); + $PAGE->navbar->add($strparticipants, new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid))); $PAGE->navbar->add($strgroups); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 1efb7f6208f..41d021f8fd6 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -492,8 +492,6 @@ class moodle_core_renderer extends moodle_renderer_base { $this->page->requires->js('lib/javascript-static.js')->in_head(); $this->page->requires->js('lib/javascript-deprecated.js')->in_head(); $this->page->requires->js('lib/javascript-mod.php')->in_head(); - $this->page->requires->js('lib/overlib/overlib.js')->in_head(); - $this->page->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); $this->page->requires->js_function_call('setTimeout', array('fix_column_widths()', 20)); $focus = $this->page->focuscontrol; diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index 7d82add3902..76c4c672599 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -51,7 +51,9 @@ $strmodulenameplural = get_string("modulenameplural", "hotpot"); $strmodulename = get_string("modulename", "hotpot"); // print header - + + $PAGE->requires->js('lib/overlib/overlib.js')->in_head(); + $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); $PAGE->set_title(format_string($course->shortname) . ": $hotpot->name"); $PAGE->set_heading($course->fullname); $PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename)); diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index cb0a786cd74..7d9809ff6e2 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -85,6 +85,8 @@ $attemptobj->load_question_states($questionids); /// Print the quiz page //////////////////////////////////////////////////////// + $PAGE->requires->js('lib/overlib/overlib.js')->in_head(); + $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); // Arrange for the navigation to be displayed. $navbc = $attemptobj->get_navigation_panel('quiz_attempt_nav_panel', $page); diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index 5e2ce45000f..60993cf9b93 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -28,7 +28,7 @@ class quiz_grading_report extends quiz_default_report { * Displays the report. */ function display($quiz, $cm, $course) { - global $CFG, $QTYPES, $DB, $OUTPUT; + global $CFG, $QTYPES, $DB, $OUTPUT, $PAGE; $viewoptions = array('mode'=>'grading', 'q'=>$quiz->id); @@ -56,6 +56,9 @@ class quiz_grading_report extends quiz_default_report { $this->cm = $cm; + echo $PAGE->requires->js('lib/overlib/overlib.js')->asap(); + echo $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->asap(); + $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="grading"); // Check permissions diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 0a823e162aa..7577725eaa7 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -85,6 +85,9 @@ $firstregion = reset($PAGE->blocks->get_regions()); $PAGE->blocks->add_pretend_block($navbc, $firstregion); + $PAGE->requires->js('lib/overlib/overlib.js')->in_head(); + $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); + /// Print the page header $headtags = $attemptobj->get_html_head_contributions($page); if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) { diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index f02fb41e08c..75f21de62be 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -61,6 +61,9 @@ ($stateid ? '&state=' . $stateid : ''), $attemptobj->get_quizid(), $attemptobj->get_cmid()); + $PAGE->requires->js('lib/overlib/overlib.js')->in_head(); + $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); + /// Print the page header $attemptobj->get_question_html_head_contributions($questionid); diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 7cd6e655186..a3672e452e0 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -277,7 +277,7 @@ class embedded_cloze_qtype extends default_questiontype { } function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { - global $QTYPES, $CFG, $USER, $OUTPUT; + global $QTYPES, $CFG, $USER, $OUTPUT, $PAGE; $readonly = empty($options->readonly) ? '' : 'readonly="readonly"'; $disabled = empty($options->readonly) ? '' : 'disabled="disabled"'; @@ -307,6 +307,9 @@ class embedded_cloze_qtype extends default_questiontype { // The regex will recognize text snippets of type {#X} // where the X can be any text not containg } or white-space characters. + echo $PAGE->requires->js('lib/overlib/overlib.js')->asap(); + echo $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->asap(); + while (preg_match('~\{#([^[:space:]}]*)}~', $qtextremaining, $regs)) { $qtextsplits = explode($regs[0], $qtextremaining, 2); echo $qtextsplits[0]; @@ -360,6 +363,7 @@ class embedded_cloze_qtype extends default_questiontype { $feedback .= '</div>'; } } + if ($options->feedback) { $chosenanswer = null; switch ($wrapped->qtype) {