Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin, branding: fix PatternFly impl for IE8 ......................................................................
userportal, webadmin, branding: fix PatternFly impl for IE8 Our PatternFly implementation was not IE8 compliant. Needed to add respond.js and html5shiv.js. Everything now looks good in IE8. Major caveat with respond.js is that it will not follow CSS @import's, and we used them heavily. Changed branding to allow multiple CSS files as part of a branding theme. Then changed ovirt-brand to use all of the CSS files directly and removed all @import's. So now instead of ovirt-brand depending on one CSS file and that file importing a chain, all individual files are now referenced by the brand directly. Change-Id: I4b40eef0a1dbdab93d55ab5ea6c25bb9e70714c5 Bug-Url: https://bugzilla.redhat.com/1152656 Bug-Url: https://bugzilla.redhat.com/1152646 Signed-off-by: Greg Sheremeta <gsher...@redhat.com> --- M backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java M backend/manager/modules/branding/src/main/resources/META-INF/obrand.tld A backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/javascripts.tag M backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/stylesheets.tag M backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java M backend/manager/modules/branding/src/test/resources/org/ovirt/engine/core/branding/01-test.brand/branding.properties M backend/manager/modules/docs/src/main/webapp/WEB-INF/no_lang.jsp M backend/manager/modules/welcome/src/main/webapp/WEB-INF/404.jsp M backend/manager/modules/welcome/src/main/webapp/WEB-INF/405.jsp M backend/manager/modules/welcome/src/main/webapp/WEB-INF/ReportsNotInstalled.jsp M backend/manager/modules/welcome/src/main/webapp/WEB-INF/ovirt-engine.jsp M frontend/webadmin/modules/frontend/src/main/resources/META-INF/resources/GwtHostPage.jsp M packaging/branding/ovirt.brand/branding.properties M packaging/branding/ovirt.brand/common.css M packaging/branding/ovirt.brand/user_portal.css M packaging/branding/ovirt.brand/web_admin.css M packaging/branding/ovirt.brand/welcome_style.css 17 files changed, 61 insertions(+), 31 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/34524/1 diff --git a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java index e7d88fc..ce3a8c7 100644 --- a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java +++ b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java @@ -86,7 +86,7 @@ /** * Post fix for denoting css files. */ - private static final String CSS_POST_FIX = "_css"; + private static final String CSS_POST_FIX = "_css"; //$NON-NLS-1$ private static final String[] TEMPLATE_REPLACE_VALUES = {"true", "false"}; //$NON-NLS-1$ //$NON-NLS-2$ @@ -197,12 +197,22 @@ } /** - * Get the style sheet type based on the passed in {@code ApplicationType}. - * @param applicationName The application name to get the style sheet string for. - * @return A {@code String} representation of the style sheet name. + * Get the css resources for this theme for this {@code ApplicationType}. + * @param applicationName The application name for which to get the css resources + * @return A {@code List} of filenames */ - public String getThemeStyleSheet(String applicationName) { - return brandingProperties.getProperty(applicationName + CSS_POST_FIX); + public List<String> getThemeStylesheets(String applicationName) { + List<String> ret = null; + final String cssFiles = brandingProperties.getProperty(applicationName + CSS_POST_FIX); + if (cssFiles == null) { + log.warn("Theme '{}' has no property defined for key '{}'", //$NON-NLS-1$ + this.getPath(), applicationName + CSS_POST_FIX); + } + else { + // comma-delimited list + ret = Arrays.asList(cssFiles.split("\\s*,\\s*")); //$NON-NLS-1$ + } + return ret; } /** @@ -359,9 +369,9 @@ @Override public String toString() { return "Path to theme: " + getPath() + ", User portal css: " //$NON-NLS-1$ //$NON-NLS-2$ - + getThemeStyleSheet("userportal") + ", Web admin css: " //$NON-NLS-1$ //$NON-NLS-2$ - + getThemeStyleSheet("webadmin") + ", Welcome page css: " //$NON-NLS-1$ //$NON-NLS-2$ - + getThemeStyleSheet("welcome"); //$NON-NLS-1$ + + getThemeStylesheets("userportal") + ", Web admin css: " //$NON-NLS-1$ //$NON-NLS-2$ + + getThemeStylesheets("webadmin") + ", Welcome page css: " //$NON-NLS-1$ //$NON-NLS-2$ + + getThemeStylesheets("welcome"); //$NON-NLS-1$ } } diff --git a/backend/manager/modules/branding/src/main/resources/META-INF/obrand.tld b/backend/manager/modules/branding/src/main/resources/META-INF/obrand.tld index 923d227..23e49b1 100644 --- a/backend/manager/modules/branding/src/main/resources/META-INF/obrand.tld +++ b/backend/manager/modules/branding/src/main/resources/META-INF/obrand.tld @@ -15,4 +15,8 @@ <name>messages</name> <path>/META-INF/tags/obrand/messages.tag</path> </tag-file> + <tag-file> + <name>javascripts</name> + <path>/META-INF/tags/obrand/javascripts.tag</path> + </tag-file> </taglib> diff --git a/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/javascripts.tag b/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/javascripts.tag new file mode 100644 index 0000000..0485c39 --- /dev/null +++ b/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/javascripts.tag @@ -0,0 +1,14 @@ +<%@ tag language="java" pageEncoding="UTF-8"%> +<%@ tag body-content="empty" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + +<c:set var="baseTheme" value="${requestScope['brandingStyle'][0]}" /> +<c:choose> + <c:when test="${fn:containsIgnoreCase(header['User-Agent'],'MSIE 8.0')}"> + <script type="text/javascript" src="${pageContext.request.contextPath}${initParam['obrandThemePath']}${baseTheme.path}/patternfly/components/respond/dest/respond.min.js"></script> + <script type="text/javascript" src="${pageContext.request.contextPath}${initParam['obrandThemePath']}${baseTheme.path}/patternfly/components/html5shiv/dist/html5shiv.min.js"></script> + </c:when> +</c:choose> +<script type="text/javascript" src="${pageContext.request.contextPath}${initParam['obrandThemePath']}${baseTheme.path}/patternfly/components/jquery/jquery-1.9.1.min.js"></script> +<script type="text/javascript" src="${pageContext.request.contextPath}${initParam['obrandThemePath']}${baseTheme.path}/patternfly/js/patternfly.min.js"></script> diff --git a/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/stylesheets.tag b/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/stylesheets.tag index 991a265..329770c 100644 --- a/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/stylesheets.tag +++ b/backend/manager/modules/branding/src/main/resources/META-INF/tags/obrand/stylesheets.tag @@ -3,9 +3,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:if test="${requestScope['brandingStyle'] != null}"> <c:forEach items="${requestScope['brandingStyle']}" var="theme"> - <c:if test="${initParam['obrandApplicationName'] != null && theme.getThemeStyleSheet(initParam['obrandApplicationName']) != null}"> - <!-- for actual servlets that have to set the request attribute --> -<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}${initParam['obrandThemePath']}${theme.path}/${theme.getThemeStyleSheet(initParam['obrandApplicationName'])}"> + <c:if test="${initParam['obrandApplicationName'] != null && theme.getThemeStylesheets(initParam['obrandApplicationName']) != null}"> + <c:forEach items="${theme.getThemeStylesheets(initParam['obrandApplicationName'])}" var="css"> + <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}${initParam['obrandThemePath']}${theme.path}/${css}"> + </c:forEach> </c:if> </c:forEach> </c:if> diff --git a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java index ef475b7..8d982b6 100644 --- a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java +++ b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java @@ -43,9 +43,14 @@ @Test public void testGetThemeStyleSheet() { assertEquals("User portal style sheet: 'user_portal.css'", "user_portal.css", //$NON-NLS-1$ //$NON-NLS-2$ - testTheme.getThemeStyleSheet("userportal")); + testTheme.getThemeStylesheets("userportal").get(0)); + assertEquals("User portal style sheet: 'user_portal.css'", "abc.css", //$NON-NLS-1$ //$NON-NLS-2$ + testTheme.getThemeStylesheets("userportal").get(1)); + assertEquals("Wedadmin style sheet: 'web_admin.css'", "web_admin.css", //$NON-NLS-1$ //$NON-NLS-2$ - testTheme.getThemeStyleSheet("webadmin")); + testTheme.getThemeStylesheets("webadmin").get(0)); + assertEquals("Wedadmin style sheet: 'web_admin.css'", "123.css", //$NON-NLS-1$ //$NON-NLS-2$ + testTheme.getThemeStylesheets("webadmin").get(1)); } @Test diff --git a/backend/manager/modules/branding/src/test/resources/org/ovirt/engine/core/branding/01-test.brand/branding.properties b/backend/manager/modules/branding/src/test/resources/org/ovirt/engine/core/branding/01-test.brand/branding.properties index fba43ab..497399e 100644 --- a/backend/manager/modules/branding/src/test/resources/org/ovirt/engine/core/branding/01-test.brand/branding.properties +++ b/backend/manager/modules/branding/src/test/resources/org/ovirt/engine/core/branding/01-test.brand/branding.properties @@ -2,8 +2,8 @@ #possible values OEM, END_USER, if missing defaults to END_USER type=END_USER #style sheets. -userportal_css=user_portal.css -webadmin_css=web_admin.css +userportal_css=user_portal.css, abc.css +webadmin_css=web_admin.css , 123.css common_css=common.css #text diff --git a/backend/manager/modules/docs/src/main/webapp/WEB-INF/no_lang.jsp b/backend/manager/modules/docs/src/main/webapp/WEB-INF/no_lang.jsp index c6201ddc..e42f077 100644 --- a/backend/manager/modules/docs/src/main/webapp/WEB-INF/no_lang.jsp +++ b/backend/manager/modules/docs/src/main/webapp/WEB-INF/no_lang.jsp @@ -14,6 +14,7 @@ </fmt:message> </title> <obrand:stylesheets /> + <obrand:javascripts /> </head> <body> <div class="obrand_loginPageBackground"> diff --git a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/404.jsp b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/404.jsp index 781bbe9..95021a3 100644 --- a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/404.jsp +++ b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/404.jsp @@ -11,6 +11,7 @@ <obrand:favicon /> <title><fmt:message key="pagenotfound.page_not_found" bundle="${pagenotfound}" /></title> <obrand:stylesheets /> + <obrand:javascripts /> </head> <body> <div class="obrand_loginPageBackground"> diff --git a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/405.jsp b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/405.jsp index 363cd1c..c5f0afb 100644 --- a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/405.jsp +++ b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/405.jsp @@ -11,6 +11,7 @@ <obrand:favicon /> <title><fmt:message key="methodnotallowed.method_not_allowed" bundle="${methodnotallowed}" /></title> <obrand:stylesheets /> + <obrand:javascripts /> </head> <body> <div class="obrand_loginPageBackground"> diff --git a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ReportsNotInstalled.jsp b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ReportsNotInstalled.jsp index d2f48d7..7c5b9e3 100644 --- a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ReportsNotInstalled.jsp +++ b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ReportsNotInstalled.jsp @@ -11,6 +11,7 @@ <obrand:favicon /> <title><fmt:message key="reportsnotinstalled.reports_not_installed" bundle="${reportsnotinstalled}" /></title> <obrand:stylesheets /> + <obrand:javascripts /> </head> <body> <div class="obrand_loginPageBackground"> diff --git a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ovirt-engine.jsp b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ovirt-engine.jsp index 11b3498..65ecdc8 100644 --- a/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ovirt-engine.jsp +++ b/backend/manager/modules/welcome/src/main/webapp/WEB-INF/ovirt-engine.jsp @@ -10,6 +10,7 @@ <obrand:favicon /> <title><fmt:message key="obrand.welcome.title" /></title> <obrand:stylesheets /> + <obrand:javascripts /> <script src="splash.js" type="text/javascript"></script> </head> <body onload="pageLoaded()"> diff --git a/frontend/webadmin/modules/frontend/src/main/resources/META-INF/resources/GwtHostPage.jsp b/frontend/webadmin/modules/frontend/src/main/resources/META-INF/resources/GwtHostPage.jsp index f3728c3..5805c37 100644 --- a/frontend/webadmin/modules/frontend/src/main/resources/META-INF/resources/GwtHostPage.jsp +++ b/frontend/webadmin/modules/frontend/src/main/resources/META-INF/resources/GwtHostPage.jsp @@ -9,6 +9,7 @@ <obrand:favicon /> <meta name="gwt:property" content="locale=${requestScope['locale']}"> <obrand:stylesheets /> + <obrand:javascripts /> <script type="text/javascript"> <c:if test="${requestScope['userInfo'] != null}"> var userInfo = <c:out value="${requestScope['userInfo']}" escapeXml="false"/>; diff --git a/packaging/branding/ovirt.brand/branding.properties b/packaging/branding/ovirt.brand/branding.properties index 6f7e534..6416b8a 100644 --- a/packaging/branding/ovirt.brand/branding.properties +++ b/packaging/branding/ovirt.brand/branding.properties @@ -10,10 +10,10 @@ # branding path while only loading the one that the engine can use. # style sheets. Optional in case you don't want to override styles. -# Make sure everything before _css matches the application type. -userportal_css=user_portal.css -webadmin_css=web_admin.css -welcome_css=welcome_style.css +# Make sure everything before _css matches the application name. +userportal_css=user_portal.css, common.css, gwt_common.css, patternfly/css/styles.min.css, patternfly-ovirt.css, ovirt-patternfly-compat.css +webadmin_css=web_admin.css, common.css, gwt_common.css, patternfly/css/styles.min.css, patternfly-ovirt.css, ovirt-patternfly-compat.css +welcome_css=welcome_style.css, common.css, gwt_common.css, patternfly/css/styles.min.css, patternfly-ovirt.css, ovirt-patternfly-compat.css # text (optional, this overrides the default messages) # URIs, other strings that should not be translated. diff --git a/packaging/branding/ovirt.brand/common.css b/packaging/branding/ovirt.brand/common.css index 33db518..643e6f1 100644 --- a/packaging/branding/ovirt.brand/common.css +++ b/packaging/branding/ovirt.brand/common.css @@ -1,7 +1,3 @@ -@import url("gwt_common.css"); -@import url("patternfly/css/styles.min.css"); -@import url("patternfly-ovirt.css"); -@import url("ovirt-patternfly-compat.css"); /* LoginPopupView.ui.xml: These classes allow you to modify the logo used in the login form. */ diff --git a/packaging/branding/ovirt.brand/user_portal.css b/packaging/branding/ovirt.brand/user_portal.css index 8ab0dd5..6c0840c 100644 --- a/packaging/branding/ovirt.brand/user_portal.css +++ b/packaging/branding/ovirt.brand/user_portal.css @@ -1,5 +1,3 @@ -@import url('common.css'); - /* MainTabBasicView.ui.xml: Change the border of the main screen */ .obrand_borderPanelStyle { diff --git a/packaging/branding/ovirt.brand/web_admin.css b/packaging/branding/ovirt.brand/web_admin.css index 0ef6d39..17392c6 100644 --- a/packaging/branding/ovirt.brand/web_admin.css +++ b/packaging/branding/ovirt.brand/web_admin.css @@ -1,5 +1,3 @@ -@import url('common.css'); - /* HeaderView.ui.xml: These classes allow you to customize the header at the top of the screen */ .obrand_logo { diff --git a/packaging/branding/ovirt.brand/welcome_style.css b/packaging/branding/ovirt.brand/welcome_style.css index 845ae1d..0929e9a 100644 --- a/packaging/branding/ovirt.brand/welcome_style.css +++ b/packaging/branding/ovirt.brand/welcome_style.css @@ -1,6 +1,4 @@ -@import url('common.css'); - -.login-pf { +.login-pf { color: #fff; font-family: 'Open Sans', Helvetica, Arial, sans-serif; } -- To view, visit http://gerrit.ovirt.org/34524 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b40eef0a1dbdab93d55ab5ea6c25bb9e70714c5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches