Load json2 on IE because IE<=7 do not implements JSON (Closes #1449)
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 29 Mar 2011 19:11:29 +0000 (21:11 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 29 Mar 2011 19:13:02 +0000 (21:13 +0200)
Could have been more clever by selecting only the version of IE without
JSON.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
Makefile
classes/xnetpage.php
classes/xorgpage.php
htdocs/javascript/.gitignore

index 90a3713..d63ab9b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -76,7 +76,7 @@ htdocs/.htaccess: htdocs/.htaccess.in Makefile
 ##
 ## static content
 ##
-static: htdocs/javascript/core.js htdocs/javascript@VERSION
+static: htdocs/javascript/core.js htdocs/javascript@VERSION htdocs/javascript/json2.js
 
 htdocs/javascript/core.js:
        cd htdocs/javascript/ && ln -s ../../core/htdocs/javascript/core.js
@@ -84,6 +84,10 @@ htdocs/javascript/core.js:
 %@VERSION: % Makefile ChangeLog
        cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
 
+htdocs/javascript/json2.js: DOWNLOAD_SRC = https://github.com/douglascrockford/JSON-js/raw/master/json2.js --no-check-certificate
+htdocs/javascript/json2.js:
+       @$(download)
+
 ##
 ## wiki
 ##
index e2075b0..0f1a1cd 100644 (file)
@@ -41,6 +41,9 @@ class XnetPage extends PlPage
             $this->assign('is_admin', may_update());
             $this->assign('is_member', is_member());
         }
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
+            $this->addJsLink('json2.js');
+        }
         $this->addJsLink('jquery.xorg.js');
         $this->addJsLink('overlib.js');
         $this->addJsLink('core.js');
index 83824d8..852b842 100644 (file)
@@ -27,6 +27,9 @@ class XorgPage extends PlPage
 
         // Set the default page
         $this->changeTpl('platal/index.tpl');
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
+            $this->addJsLink('json2.js');
+        }
         $this->addJsLink('jquery.xorg.js');
         $this->addJsLink('overlib.js');
         $this->addJsLink('core.js');
index 85fe6a4..47ad449 100644 (file)
@@ -4,4 +4,5 @@
 # jQuery and its plugins are downloaded by the Makefile
 /jquery*.*js
 /core.js
+/json2.js
 !/jquery.autocomplete.js