mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Adding Google Chrome Framework for IE<9
This commit is contained in:
parent
331652ad74
commit
1b04d1effc
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
|
import com.wisemapping.filter.UserAgent;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@ -38,19 +39,26 @@ public class MindmapEditorController extends BaseMultiActionController {
|
|||||||
|
|
||||||
public ModelAndView open(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
|
public ModelAndView open(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
|
||||||
|
|
||||||
|
ModelAndView view;
|
||||||
|
|
||||||
|
UserAgent userAgent = UserAgent.create(httpServletRequest);
|
||||||
|
if(userAgent.needsGCF()){
|
||||||
|
view = new ModelAndView("installCFG");
|
||||||
|
}
|
||||||
|
else{
|
||||||
final String mindmapId = httpServletRequest.getParameter(MINDMAP_ID_PARAMETER);
|
final String mindmapId = httpServletRequest.getParameter(MINDMAP_ID_PARAMETER);
|
||||||
final int mapId = Integer.parseInt(mindmapId);
|
final int mapId = Integer.parseInt(mindmapId);
|
||||||
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
||||||
|
|
||||||
// Mark as try mode...
|
// Mark as try mode...
|
||||||
final ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
||||||
view.addObject("editorTryMode", false);
|
view.addObject("editorTryMode", false);
|
||||||
final boolean showHelp = isWelcomeMap(mindmap);
|
final boolean showHelp = isWelcomeMap(mindmap);
|
||||||
view.addObject("showHelp", showHelp);
|
view.addObject("showHelp", showHelp);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
||||||
view.addObject(MAP_XML_PARAM, xmlMap);
|
view.addObject(MAP_XML_PARAM, xmlMap);
|
||||||
view.addObject("user", Utils.getUser());
|
view.addObject("user", Utils.getUser());
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ public class UserAgent implements Serializable {
|
|||||||
private Product product;
|
private Product product;
|
||||||
private OS os;
|
private OS os;
|
||||||
private final org.apache.commons.logging.Log logger = LogFactory.getLog(UserAgent.class.getName());
|
private final org.apache.commons.logging.Log logger = LogFactory.getLog(UserAgent.class.getName());
|
||||||
|
private boolean hasGCFInstalled = false;
|
||||||
|
|
||||||
public static void main(final String argv[]) {
|
public static void main(final String argv[]) {
|
||||||
UserAgent explorer = UserAgent.create("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
|
UserAgent explorer = UserAgent.create("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
|
||||||
@ -65,6 +66,10 @@ public class UserAgent implements Serializable {
|
|||||||
return this.versionMajor > mayor || (mayor == this.versionMajor && this.versionVariation >= variation);
|
return this.versionMajor > mayor || (mayor == this.versionMajor && this.versionVariation >= variation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVersionLessThan(final int mayor) {
|
||||||
|
return this.versionMajor < mayor;
|
||||||
|
}
|
||||||
|
|
||||||
public int getVersionMajor() {
|
public int getVersionMajor() {
|
||||||
return versionMajor;
|
return versionMajor;
|
||||||
}
|
}
|
||||||
@ -127,6 +132,7 @@ public class UserAgent implements Serializable {
|
|||||||
|
|
||||||
// Explorer Parse ...
|
// Explorer Parse ...
|
||||||
this.product = Product.EXPLORER;
|
this.product = Product.EXPLORER;
|
||||||
|
this.hasGCFInstalled = productDetails.indexOf("chromeframe")!=-1;
|
||||||
} else if (userAgentHeader.indexOf("iCab") != -1 || userAgentHeader.indexOf("Safari") != -1) {
|
} else if (userAgentHeader.indexOf("iCab") != -1 || userAgentHeader.indexOf("Safari") != -1) {
|
||||||
// Safari:
|
// Safari:
|
||||||
//Formats: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1
|
//Formats: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1
|
||||||
@ -334,4 +340,9 @@ public class UserAgent implements Serializable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean needsGCF(){
|
||||||
|
final UserAgent.Product product = this.getProduct();
|
||||||
|
return product == UserAgent.Product.EXPLORER && this.isVersionLessThan(9) && this.getOs() == UserAgent.OS.WINDOWS && !this.hasGCFInstalled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<definition name="closeDialog" page="/jsp/closeDialog.jsp"/>
|
<definition name="closeDialog" page="/jsp/closeDialog.jsp"/>
|
||||||
<definition name="embeddedViewError" page="/jsp/embeddedViewError.jsp"/>
|
<definition name="embeddedViewError" page="/jsp/embeddedViewError.jsp"/>
|
||||||
<definition name="mindmapPrint" page="/jsp/mindmapPrint.jsp"/>
|
<definition name="mindmapPrint" page="/jsp/mindmapPrint.jsp"/>
|
||||||
|
<definition name="installCFG" page="/jsp/installCFG.jsp"/>
|
||||||
|
|
||||||
<!-- Template Declaration -->
|
<!-- Template Declaration -->
|
||||||
<definition name="pageTemplate" page="/jsp/template.jsp">
|
<definition name="pageTemplate" page="/jsp/template.jsp">
|
||||||
|
@ -23,7 +23,7 @@ function afterCoreLoading()
|
|||||||
// Uncomment for debug ...
|
// Uncomment for debug ...
|
||||||
if (core.UserAgent.isVMLSupported())
|
if (core.UserAgent.isVMLSupported())
|
||||||
{
|
{
|
||||||
$import("../js/mindplot.vml.js");
|
// $import("../js/mindplot.vml.js");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$import("../js/mindplot.svg.js");
|
$import("../js/mindplot.svg.js");
|
||||||
|
33
wise-webapp/src/main/webapp/jsp/installCFG.jsp
Normal file
33
wise-webapp/src/main/webapp/jsp/installCFG.jsp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="width:100%; font-size:130%;">
|
||||||
|
you need to install Google Chrome Frame.
|
||||||
|
<br/>
|
||||||
|
<div id="div"> click here</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="prompt">
|
||||||
|
<!-- if IE without GCF, prompt goes here -->
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
// The conditional ensures that this code will only execute in IE,
|
||||||
|
// Therefore we can use the IE-specific attachEvent without worry
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#div").click(function(event){
|
||||||
|
$(".chromeFrameOverlayContent").css("display","block");
|
||||||
|
$(".chromeFrameOverlayUnderlay").css("display","block");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
window.attachEvent("onload", function() {
|
||||||
|
CFInstall.check({
|
||||||
|
mode: "overlay" // the default
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -12,6 +12,10 @@
|
|||||||
</c:url>
|
</c:url>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<!-- Internet Explorer 8 Hack -->
|
<!-- Internet Explorer 8 Hack -->
|
||||||
<meta http-equiv="Content-type" value="text/html;charset=UTF-8">
|
<meta http-equiv="Content-type" value="text/html;charset=UTF-8">
|
||||||
<title><spring:message code="SITE.TITLE"/> - ${mindmap.title} </title>
|
<title><spring:message code="SITE.TITLE"/> - ${mindmap.title} </title>
|
||||||
|
Loading…
Reference in New Issue
Block a user