2013年12月18日 星期三

如何讓 Moodle 1.9.5 在 IE11、Chrome 等兩個瀏覽器中仍能看到 HTML Editor 的解決方法

IE Version 11:


主選單 --> 工具 --> 相容性檢視設定 --> "將 Moodle 1.9.5 所在的網域加入 [相容性檢視] 的網站"。


Chrome:

此方法引用自:http://lewiscarr.co.uk/2010/08/enable-the-moodle-wysiwyg-editor-on-chrome-and-safari/
  1. 修改 lib/moodlelib.php,將
  2. function can_use_html_editor() {
         global $USER, $CFG;
     
         if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
             if (check_browser_version('MSIE', 5.5)) {
                 return 'MSIE';
             } else if (check_browser_version('Gecko', 20030516)) {
                 return 'Gecko';
             }
         }
         return false;
     }
    修改為:
    function can_use_html_editor() {
         global $USER, $CFG;
     
         if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
             if (check_browser_version('MSIE', 5.5)) {
                 return 'MSIE';
             } else if (check_browser_version('Gecko', 20030516)) {
                 return 'Gecko';
             } else { 
                return 1; //Pall's Safari/Chrome editor hack
             } 
         }
         return false;
     }
  3. 修改 lib/editor/htmlarea/htmlarea.php,將
    HTMLArea.checkSupportedBrowser = function() {
         if (HTMLArea.is_gecko) {
             if (navigator.productSub < 20021201) {
                 alert("You need at least Mozilla-1.3 Alpha.\n" +
                       "Sorry, your Gecko is not supported.");
                 return false;
             }
             if (navigator.productSub < 20030210) {
                 alert("Mozilla < 1.3 Beta is not supported!\n" +
                       "I'll try, though, but it might not work.");
             }
         }
         if(HTMLArea.is_safari) {
             return false;
         }
         return HTMLArea.is_gecko || HTMLArea.is_ie;
     };
    修改為:
    HTMLArea.checkSupportedBrowser = function() { 
        if (HTMLArea.is_gecko) {
            if (navigator.productSub < 20021201) {
                alert("You need at least Mozilla-1.3 Alpha.\n" +
                      "Sorry, your Gecko is not supported.");
                return false;
            }
            if (navigator.productSub < 20030210) {
                //alert("Mozilla < 1.3 Beta is not supported!\n" +
                //      "I'll try, though, but it might not work.");
                return 'HTMLArea.is_gecko';
            }
        }
        if(HTMLArea.is_safari) {
            //return false;
            return 'HTMLArea.is_gecko';
        }
        return HTMLArea.is_gecko || HTMLArea.is_ie;
    };

沒有留言:

張貼留言