Permalink
Browse files

ForumNG: Should use standard Moodle API to detect IE6, not custom cod…

…e #3136
  • Loading branch information...
1 parent f35ec18 commit b06ce55660ff6033be884458357d955380f7d758 @raymanuk raymanuk committed with sammarshallou Feb 23, 2012
Showing with 7 additions and 23 deletions.
  1. +1 −1 discuss.php
  2. +2 −2 mod_forumng.php
  3. +0 −17 mod_forumng_utils.php
  4. +2 −1 renderer.php
  5. +2 −2 type/general/forumngtype_general.php
View
@@ -105,7 +105,7 @@
print '</div>';
-if ($bad = mod_forumng_utils::is_bad_browser()) {
+if ($bad = $PAGE->devicetypeinuse == 'legacy') {
print '<div class="forumng-bad-browser">'.
get_string('badbrowser', 'forumng', $bad) . '</div>';
}
View
@@ -3625,12 +3625,12 @@ public function init_page(moodle_url $url, $pagename='', $navigation=array()) {
* @param bool $ajaxattachments If true, includes data needed to init file managers
*/
public function print_js($cmid=0, $ajaxattachments=false) {
+ global $CFG, $PAGE;
$simple = get_user_preferences('forumng_simplemode', '');
- if (mod_forumng_utils::is_bad_browser() || $simple) {
+ if ($PAGE->devicetypeinuse == 'legacy' || $simple) {
return;
}
- global $CFG, $PAGE;
if (ajaxenabled()) {
// Prepare strings
$mainstrings = array(
View
@@ -475,23 +475,6 @@ static function make_grades_menu($gradingtype) {
// UI
/////
- /**
- * We disable JavaScript for 'bad' browsers.
- * @return string Name of bad browser, or false if using a good browser
- */
- public static function is_bad_browser() {
- if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
- // Don't know what browser it is, let's assume it's a good one
- return false;
- }
- $agent = $_SERVER['HTTP_USER_AGENT'];
-
- if (strpos($agent, 'MSIE 6')!==false) {
- return 'Internet Explorer 6';
- }
- return false;
- }
-
/**
* Wraps nice way to display reasonable date format in Moodle for use
* in all forum locations.
View
@@ -559,7 +559,8 @@ public function render_paste_button($forum, $groupid) {
* @return string HTML for the switch link.
*/
public function render_switch_link() {
- if (mod_forumng_utils::is_bad_browser()) {
+ global $PAGE;
+ if ($PAGE->devicetypeinuse == 'legacy') {
return '';
}
$simple = get_user_preferences('forumng_simplemode', '');
@@ -215,7 +215,7 @@ public function print_discussion_page($discussion) {
// 'Expand all' option (always chosen for non-JS browsers)
$expandall = optional_param('expand', 0, PARAM_INT)
- || mod_forumng_utils::is_bad_browser();
+ || $PAGE->devicetypeinuse == 'legacy';
// 'Expand all' option (always chosen for non-JS browsers)
$collapseall = optional_param('collapse', 0, PARAM_INT);
@@ -252,7 +252,7 @@ public function print_discussion_page($discussion) {
// Note: On bad browsers we always expand all posts
$showcollapseall = preg_match(
'~<div class="forumng-post forumng-full.*<div class="forumng-post forumng-full~s',
- $content) && !mod_forumng_utils::is_bad_browser();
+ $content) && !$PAGE->devicetypeinuse == 'legacy';
if ($showexpandall) {
print '<a class="forumng-expandall-link" href="' .
$discussion->get_url(mod_forumng::PARAM_HTML) . '&amp;expand=1' .

0 comments on commit b06ce55

Please sign in to comment.