2013年10月7日 星期一

Moodle2版前 Html Editor(Chrome) bug

修正Moodle2前的版本在chrome瀏覽器中雖已啟動Html Editor元件,確無法正常顯示問題

範本moodle1.9

/lib/editor/htmlarea/htmlarea.php 
行2401
HTMLArea.checkSupportedBrowser = function() {
-    //if (HTMLArea.is_gecko) {
+    if (HTMLArea.is_gecko && !HTMLArea.is_chrome) {
        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_chrome) {
+        return true;
+    }
    if(HTMLArea.is_safari) {
        return false;
    }
    return HTMLArea.is_gecko || HTMLArea.is_ie;
};


/lib/moodlelib.php
行6379
      case 'Gecko':   /// Gecko based browsers

          if (substr_count($agent, 'Camino')) {
              // MacOS X Camino support
              $version = 20041110;
          }
+          if (substr_count($agent, 'Chrome')) {
+              // Lets allow Chrome!
+              return true;
+          }
          // the proper string - Gecko/CCYYMMDD Vendor/Version
          // Faster version and work-a-round No IDN problem.
          if (preg_match("/Gecko\/([0-9]+)/i", $agent, $match)) {
              if ($match[1] > $version) {
                      return true;
                  }
              }
          break;




參考:https://tracker.moodle.org/browse/MDL-16336


沒有留言:

張貼留言