diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 3aab9f4d5a5..05e9c372a4d 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -4669,3 +4669,13 @@ function convert_tabrows_to_tree($tabrows, $selected, $inactive, $activated) { function move_section($course, $section, $move) { throw new coding_exception('move_section() can not be used any more, please see move_section_to().'); } +/** + * Can handle rotated text. Whether it is safe to use the trickery in textrotate.js. + * + * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically + * @return bool True for yes, false for no + */ +function can_use_rotated_text() { + debugging('can_use_rotated_text() is deprecated since Moodle 2.5. JS feature detection is used automatically.', DEBUG_DEVELOPER); + return true; +} diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 463787578a2..1581cd77edf 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -9111,17 +9111,6 @@ function get_browser_version_classes() { return $classes; } -/** - * Can handle rotated text. Whether it is safe to use the trickery in textrotate.js. - * - * @return bool True for yes, false for no - */ -function can_use_rotated_text() { - return check_browser_version('MSIE', 9) || check_browser_version('Firefox', 2) || - check_browser_version('Chrome', 21) || check_browser_version('Safari', 536.25) || - check_browser_version('Opera', 12) || check_browser_version('Safari iOS', 533); -} - /** * Determine if moodle installation requires update * diff --git a/report/progress/index.php b/report/progress/index.php index 6bae97a9cc3..3df14ed14b6 100644 --- a/report/progress/index.php +++ b/report/progress/index.php @@ -146,8 +146,6 @@ if ($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are $line="\n"; } } else { - // Use SVG to draw sideways text if supported - $svgcleverness = can_use_rotated_text(); // Navigation and header $strreports = get_string("reports"); @@ -156,11 +154,8 @@ if ($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are $PAGE->set_title($strcompletion); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); - - if ($svgcleverness) { - $PAGE->requires->js('/report/progress/textrotate.js'); - $PAGE->requires->js_function_call('textrotate_init', null, true); - } + $PAGE->requires->js('/report/progress/textrotate.js'); + $PAGE->requires->js_function_call('textrotate_init', null, true); // Handle groups (if enabled) groups_print_course_menu($course,$CFG->wwwroot.'/report/progress/?course='.$course->id); diff --git a/report/progress/textrotate.js b/report/progress/textrotate.js index 7414ec46bdb..56ee2d72855 100644 --- a/report/progress/textrotate.js +++ b/report/progress/textrotate.js @@ -48,7 +48,16 @@ function textrotate_make_svg(el) el.parentNode.removeChild(el); } +function browser_supports_svg() { + return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); +} + function textrotate_init() { + if (!browser_supports_svg()) { + // Feature detect, else bail. + return; + } + YUI().use('yui2-dom', function(Y) { var elements= Y.YUI2.util.Dom.getElementsByClassName('completion-activityname', 'span'); for(var i=0;i