1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 18:04:43 +02:00

overlib MDL-19735 Overlib is now included only where it is used

At the same time I have converted the calendar block to use YUI instead of overlib, this introduces one regression in that the panel is shown immediatly but should really have a minimal delay for usability.
This will be fixed once the theme changes for 2.0 have been commited
This commit is contained in:
samhemelryk 2009-09-17 07:46:20 +00:00
parent bb55642327
commit 458eb0d10c
16 changed files with 54 additions and 36 deletions

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

15
calendar/calendar.js Normal file

@ -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);
}

@ -283,8 +283,6 @@
echo $OUTPUT->header();
echo calendar_overlib_html();
echo '<table id="calendar">';
echo '<tr><td class="maincalendar">';

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

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

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

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

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

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

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

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

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

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

@ -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())) {

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

@ -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) {