fixing google chrome installation to work on all browsers

This commit is contained in:
Pablo Luna 2011-04-01 18:32:55 +01:00
parent 183dd367a8
commit 8ea733fc55
8 changed files with 94 additions and 76 deletions

View File

@ -41,23 +41,26 @@ public class MindmapEditorController extends BaseMultiActionController {
ModelAndView view; 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);
// Mark as try mode... UserAgent userAgent = UserAgent.create(httpServletRequest);
view = new ModelAndView("mindmapEditor", "mindmap", mindmap); if(userAgent.needsGCF()){
view.addObject("editorTryMode", false); view = new ModelAndView("gcfPluginNeeded");
final boolean showHelp = isWelcomeMap(mindmap); view.addObject(MINDMAP_ID_PARAMETER, mindmapId);
view.addObject("showHelp", showHelp); }
final String xmlMap = mindmap.getNativeXmlAsJsLiteral(); else{
view.addObject(MAP_XML_PARAM, xmlMap);
view.addObject("user", Utils.getUser()); final MindMap mindmap = getMindmapService().getMindmapById(mapId);
// Mark as try mode...
view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
view.addObject("editorTryMode", false);
final boolean showHelp = isWelcomeMap(mindmap);
view.addObject("showHelp", showHelp);
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
view.addObject(MAP_XML_PARAM, xmlMap);
view.addObject("user", Utils.getUser());
} }
return view; return view;
} }

View File

@ -52,6 +52,10 @@ public class PublicPagesController extends BaseMultiActionController {
return new ModelAndView("privacyPolicy"); return new ModelAndView("privacyPolicy");
} }
public ModelAndView installCFG(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
return new ModelAndView("installCFG");
}
public ModelAndView home(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { public ModelAndView home(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
return new ModelAndView("homepage"); return new ModelAndView("homepage");
} }

View File

@ -323,10 +323,9 @@ NO_HISTORY_RESULTS= No History Information was found.
HISTORY_INFO = Here is the list of the last revisions of you map. HISTORY_INFO = Here is the list of the last revisions of you map.
REVERT=revert REVERT=revert
SAMPLE_MAPS=Sample Maps SAMPLE_MAPS=Sample Maps
INSTALL_CFG=Install Google Chrome Frame INSTALL_CFG=Google Chrome Frame Plugin Needed
INSTALL_CFG_REASON = Since you are using Internet Explorer 8 or previous, you need to install Google Chrome Frame. This is a plugin made by Google that will allow you to see SVG in your browser. INSTALL_CFG_REASON = <h1>You need to install the Google Chrome Frame Plugin</h1><br/><h2>We used to support IE 7/8 by rendering VML instead of SVG. In a few words, VML was the SVG equivalent in the Microsoft world, and we have invested a lot of energy in VML during several years solving several performance and instability issues among others things. Since Internet Explorer 9 has support for HTML 5.0 (thus SVG support), we decided to deprecate the support of VML. The side effect of this is that all users using Internet Explorer 7/8 will have to install a plugin from google that enables the display of HTML 5.0 webpages.</h2>
INSTALL_CFG_BROWSERS=This plug in is not necessary for Internet Explorer 9, or any other browser. INSTALL_CFG_CLICK_HERE=To install Google Chrome Frame Plugin click here
INSTALL_CFG_CLICK_HERE=To download click here
INVALID_EMAIL_ERROR = The e-mail was not verified INVALID_EMAIL_ERROR = The e-mail was not verified
BROWSER_NOT_SUPPOERTED= Current Browser is not supported. BROWSER_NOT_SUPPOERTED= Current Browser is not supported.

View File

@ -16,7 +16,6 @@
<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">
@ -35,6 +34,16 @@
<put name="body" value="/jsp/errorTemplate.jsp" type="page"/> <put name="body" value="/jsp/errorTemplate.jsp" type="page"/>
</definition> </definition>
<definition name="gcfPluginNeeded" extends="pageTemplate">
<put name="body" value="/jsp/gcfPluginNeeded.jsp" type="page"/>
<put name="title" value="INSTALL_CFG"/>
</definition>
<definition name="installCFG" extends="pageTemplate">
<put name="body" value="/jsp/installCFG.jsp" type="page"/>
<put name="title" value="INSTALL_CFG"/>
</definition>
<!-- Error Pages --> <!-- Error Pages -->
<definition name="unexpectedError" extends="errorTemplate"> <definition name="unexpectedError" extends="errorTemplate">
<put name="title" value="UNEXPECTED_ERROR"/> <put name="title" value="UNEXPECTED_ERROR"/>

View File

@ -71,6 +71,7 @@
<property name="mappings"> <property name="mappings">
<props> <props>
<prop key="/c/try.htm">tryEditor</prop> <prop key="/c/try.htm">tryEditor</prop>
<prop key="/c/installCFG.htm">installCFG</prop>
</props> </props>
</property> </property>
</bean> </bean>
@ -313,6 +314,7 @@
<prop key="/c/importMap.htm">importMapController</prop> <prop key="/c/importMap.htm">importMapController</prop>
<prop key="/c/newMap.htm">newMapController</prop> <prop key="/c/newMap.htm">newMapController</prop>
<prop key="/c/history.htm">historyController</prop> <prop key="/c/history.htm">historyController</prop>
<prop key="/c/installCFG.htm">homeController</prop>
</props> </props>
</property> </property>
</bean> </bean>

View File

@ -587,3 +587,26 @@ span.fieldRequired {
#keyboardTable tr { #keyboardTable tr {
padding: 5px; padding: 5px;
} }
div.installCFG {
width:100%;
font-size:130%;
}
div.installCFG h1{
width:100%;
font-size:130%;
}
div.installCFG h2{
font-size:100%;
border-bottom:0 solid black;
}
.chromeFrameInstallDefaultStyle {
position:relative;
left:0;
top:0;
margin:0;
}

View File

@ -0,0 +1,13 @@
<%@ page import="org.apache.log4j.Logger" %>
<%@ page autoFlush="true" buffer="none" %>
<%@ include file="/jsp/init.jsp" %>
<%!
final Logger logger = Logger.getLogger("com.wisemapping");
%>
<div class="installCFG">
<spring:message code="INSTALL_CFG_REASON"/>
<br/><br/>
<a href="${pageContext.request.contextPath}/c/installCFG.htm?mapId=${mapId}"><spring:message code="INSTALL_CFG_CLICK_HERE"/></a>
</div>

View File

@ -1,62 +1,27 @@
<!DOCTYPE HTML> <%@ page import="org.apache.log4j.Logger" %>
<%@page pageEncoding="UTF-8"%> <%@ page autoFlush="true" buffer="none" %>
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles" %>
<%@ include file="/jsp/init.jsp" %> <%@ include file="/jsp/init.jsp" %>
<html> <%!
<head> final Logger logger = Logger.getLogger("com.wisemapping");
<title> %>
<spring:message code="SITE.TITLE"/> <div style="position:relative;">
- <div id="prompt">
<spring:message code="INSTALL_CFG"/> <!-- if IE without GCF, prompt goes here -->
</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../css/wisehome.css"/>
<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<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>
<jsp:include page="header.jsp"/>
<div class="pageBody">
<div class="pageBodyContent">
<div style="width:100%; font-size:130%;">
<spring:message code="INSTALL_CFG_REASON"/>
<br/><br/>
<span style="font-size:20px; font-weight:bold;"><spring:message code="INSTALL_CFG_BROWSERS"/></span>
<br/><br/>
<div id="div" style="text-decoration:underline; cursor:pointer; color:blue;"><spring:message code="INSTALL_CFG_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
});
$(".chromeFrameOverlayContent").css("display","none");
$(".chromeFrameOverlayUnderlay").css("display","none");
});
</script>
</div> </div>
</div> </div>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<jsp:include page="footer.jsp"/> <script type="text/javascript">
</body> function getURLParameter(name) {
</html> return unescape(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
CFInstall.check({
mode: "inline",
node:"prompt",
destination:"${pageContext.request.contextPath}/c/editor.htm?mapId="+getURLParameter("mapId")
});
</script>