Foros de discusión

liferay-look-and-feel.xml with more than one theme causes JS errors?

Luis Serrano, modificado hace 13 años.

liferay-look-and-feel.xml with more than one theme causes JS errors?

New Member Mensajes: 4 Fecha de incorporación: 23/02/11 Mensajes recientes
Hi there,

I am trying to create two themes within liferay-look-and-feel.xml (LifeRay version is 6.0)

This is the code I have written:

<!--?xml version="1.0"?-->


<look-and-feel>
<compatibility>
<version>6.0.5+</version>
</compatibility>
<theme name="HC3-VP" id="HC3-VP">
<settings>
<setting key="active-theme" value="HC3-VP" />
</settings>
</theme>
<theme name="HCR-CPS" id="HC3-CPS">
<settings>
<setting key="active-theme" value="HC3-CPS" />
</settings>
</theme>
</look-and-feel>


Then, in my Velocity templates, I use $theme.getSetting() to read the value of "active-theme" and #parse the desired file accordingly.

Problem is, when I have more than one theme, a number of JS errors appear:

Liferay.publish is not a function
http://localhost:8080/html/js/everything.jsp?browserId=firefox&themeId=HC3CPS_WAR_HC3VPtheme&colorSchemeId=01&minifierType=js&minifierBundleId=javascript.everything.files&languageId=en_US&b=6011&t=1294917322000
Line 3

Liferay.Portlet is undefined
http://localhost:8080/en/web/guest/home
Line 1

Liferay.Portlet is undefined
http://localhost:8080/HC3-VP-theme/js/portlet.api.client.js
Line 108

Liferay.once is not a function
http://localhost:8080/combo/?browserId=firefox&minifierType=js&languageId=en_US&b=6011&t=1294917322000&p=/html/js&m=/aui/base/base-base-min.js&m=/aui/pluginhost/pluginhost-min.js&m=/aui/dom/dom-min.js&m=/aui/event/event-min.js&m=/aui/node/node-min.js&m=/aui/anim/anim-min.js&m=/aui/collection/collection-min.js&m=/aui/base/base-pluginhost-min.js&m=/aui/classnamemanager/classnamemanager-min.js&m=/aui/widget/widget-min.js&m=/aui/aui-component/aui-component-min.js&m=/aui/aui-delayed-task/aui-delayed-task-min.js&m=/aui/aui-selector/aui-selector-min.js&m=/aui/aui-node/aui-node-min.js&m=/aui/plugin/plugin-min.js&m=/aui/aui-state-interaction/aui-state-interaction-min.js&m=/aui/base/base-build-min.js&m=/aui/widget/widget-child-min.js&m=/aui/aui-button-item/aui-button-item-min.js&m=/aui/widget/widget-position-min.js&m=/aui/widget/widget-stack-min.js&m=/aui/widget/widget-position-align-min.js&m=/aui/widget/widget-position-constrain-min.js&m=/aui/widget/widget-stdmod-min.js&m=/aui/aui-overlay/aui-overlay-base-min.js&m=/aui/async-queue/async-queue-min.js&m=/aui/aui-parse-content/aui-parse-content-min.js&m=/aui/io/io-base-min.js&m=/aui/json/json-min.js&m=/aui/querystring/querystring-stringify-min.js&m=/aui/aui-io/aui-io-request-min.js&m=/aui/aui-overlay/aui-overlay-mask-min.js&m=/aui/substitute/substitute-min.js&m=/aui/aui-loading-mask/aui-loading-mask-min.js&m=/aui/aui-io/aui-io-plugin-min.js&m=/aui/overlay/overlay-min.js&m=/aui/aui-overlay/aui-overlay-manager-min.js&m=/aui/aui-overlay/aui-overlay-context-min.js&m=/aui/event-simulate/event-simulate-min.js&m=/aui/node/node-event-simulate-min.js&m=/aui/node-focusmanager/node-focusmanager-min.js&m=//liferay/dockbar.js
Line 1

Liferay.Util is undefined
http://localhost:8080/en/web/guest/home
Line 100

g is undefined
http://localhost:8080/html/js/everything.jsp?browserId=firefox&themeId=HC3CPS_WAR_HC3VPtheme&colorSchemeId=01&minifierType=js&minifierBundleId=javascript.everything.files&languageId=en_US&b=6011&t=1294917322000
Line 3

Liferay.Portlet is undefined
http://localhost:8080/HC3-VP-theme/js/main.js?browserId=firefox&minifierType=js&languageId=en_US&b=6011&t=1301510772000
Line 1


Removing the second theme from the XML seems to solve this error.

Additionally, and in case it has something to do with this, these errors also appear in the LifeRay Control Panel ¿¿??

Any idea of what's going on?
Luis Serrano, modificado hace 13 años.

RE: liferay-look-and-feel.xml with more than one theme causes JS errors?

New Member Mensajes: 4 Fecha de incorporación: 23/02/11 Mensajes recientes
More info about the issue:

We've overwritten portal-normal.vm, or more exactly, we've built it ourselves, since it's a completely customized theme. But the LifeRay core JS files aren't included there, those are supposed to be included from portal.properties ("javascript.barebone.files" property).

We have NOT overwritten that property in portal-ext.properties, and for what we know, the following lines:

$theme.include($top_head_include)
$theme.include($bottom_include)


in portal-normal.vm import the default portal.properties file, causing the core JS to be included.

That is how we have our template, so the JS files are supposed to be actually included. In fact, I see that the request for barebone.jsp returns a lot of packed JS.

We tried overwriting javascript.barebone.files in our portal-ext.properties, though, following this instructions:

http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Properties+6.0.5

We also added "liferay/portlet_url.js" to the list of javascripts on property "javascript.barebone.files". We got this to work perfectly, in fact, this file I have included: http://localhost:8080/HC3-VP-theme/js/portlet.api.client.js makes extensive use of it.

The problem appears when I want to have to themes declared in liferay-look-and-feel.xml - then JS stops working.

Somehow that messes up with Javascript.

Any idea? I include some code to help understanding the problem:

Our portal-normal.vm file (partial)

#*  *#

#parse ($init)



<title>$the_title - $company_name</title>
$theme.include($top_head_include)
<!--[if IE 7]>
#* IE7 CSS *#
#parse ("$full_templates_path/ie_rules.vm")
<![endif]-->

#parse ("$full_templates_path/styles.vm")
#parse ("$full_templates_path/js.vm")




And now, the results of rendering $theme.include($top_head_include)

<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<link rel="Shortcut Icon" href="/HC3-VP-theme/images/favicon.ico">
<link href="/html/portal/css.jsp?browserId=firefox&amp;themeId=HC3CPS_WAR_HC3VPtheme&amp;colorSchemeId=01&amp;languageId=en_US&amp;b=6011&amp;t=1294916806000" rel="stylesheet" type="text/css">
<link href="/html/portlet/login/css/main.jsp?browserId=firefox&amp;themeId=HC3CPS_WAR_HC3VPtheme&amp;colorSchemeId=01&amp;languageId=en_US&amp;b=6011&amp;t=1301500679383" rel="stylesheet" type="text/css">
<script type="text/javascript">/*<![CDATA[*/var Liferay={Browser:{acceptsGzip:function(){return true},getMajorVersion:function(){return 3.6},getRevision:function(){return"1.9.2.16"},getVersion:function(){return"3.6.16"},isAir:function(){return false},isChrome:function(){return false},isFirefox:function(){return true},isGecko:function(){return true},isIe:function(){return false},isIphone:function(){return false},isLinux:function(){return false},isMac:function(){return false},isMobile:function(){return false},isMozilla:function(){return true},isOpera:function(){return false},isRtf:function(){return true},isSafari:function(){return false},isSun:function(){return false},isWap:function(){return false},isWapXhtml:function(){return false},isWebKit:function(){return false},isWindows:function(){return true},isWml:function(){return false}},ThemeDisplay:{getCompanyId:function(){return"1"},getCompanyGroupId:function(){return"10133"},getUserId:function(){return"5"},getDoAsUserIdEncoded:function(){return""},getPlid:function(){return"10146"},getLayoutId:function(){return"1"},getLayoutURL:function(){return"/web/guest/home"},isPrivateLayout:function(){return"false"},getParentLayoutId:function(){return"0"},getScopeGroupId:function(){return"18"},getParentGroupId:function(){return"18"},isImpersonated:function(){return false},isSignedIn:function(){return false},getDefaultLanguageId:function(){return"en_US"},getLanguageId:function(){return"en_US"},isFreeformLayout:function(){return false},isStateExclusive:function(){return false},isStateMaximized:function(){return false},isStatePopUp:function(){return false},getPathContext:function(){return""},getPathImage:function(){return"/image"},getPathJavaScript:function(){return"/html/js"},getPathMain:function(){return"/c"},getPathThemeImages:function(){return"/HC3-VP-theme/images"},getPathThemeRoot:function(){return"/HC3-VP-theme/"},getURLHome:function(){return"http://localhost:8080/web/guest"},getSessionId:function(){return"91B01E197BE1BE61E2E208FAA4FC07DA"},getPortletSetupShowBordersDefault:function(){return true}},PropsValues:{NTLM_AUTH_ENABLED:false}};var themeDisplay=Liferay.ThemeDisplay;Liferay.AUI={getBaseURL:function(){return"http://localhost:8080/html/js/aui/"},getCombine:function(){return true},getComboPath:function(){return"/combo/?browserId=firefox&minifierType=js&languageId=en_US&b=6011&t=1294917322000&p=/html/js&"},getFilter:function(){return{replaceStr:function(c,b,a){return b+"m="+(c.split("/html/js")[1]||"")},searchExp:"(\\?|&)/([^&]+)"}},getJavaScriptRootPath:function(){return"/html/js"},getRootPath:function(){return"/html/js/aui/"}};window.YUI_config={base:Liferay.AUI.getBaseURL(),comboBase:Liferay.AUI.getComboPath(),fetchCSS:false,filter:Liferay.AUI.getFilter(),root:Liferay.AUI.getRootPath()};Liferay.currentURL="\x2f";Liferay.currentURLEncoded="%2f";/*]]>*/</script>
<script src="/html/js/barebone.jsp?browserId=firefox&amp;themeId=HC3CPS_WAR_HC3VPtheme&amp;colorSchemeId=01&amp;minifierType=js&amp;minifierBundleId=javascript.barebone.files&amp;languageId=en_US&amp;b=6011&amp;t=1294917322000" type="text/javascript"></script>
<script src="/html/js/firebug/firebug.js" type="text/javascript"></script>
<script type="text/javascript">/*<![CDATA[*/Liferay.Portlet.list=["58","47"];/*]]>*/</script>
<link class="lfr-css-file" href="/HC3-VP-theme/css/main.css?browserId=firefox&amp;languageId=en_US&amp;b=6011&amp;t=1301511422000" rel="stylesheet" type="text/css">
<style type="text/css">
#heading .logo{background:url(/image/company_logo?img_id=0&t=1301556625032) no-repeat;display:block;font-size:0;height:76px;text-indent:-9999em;width:209px;}
</style>
<style type="text/css">
</style>


Any help will be appreciated.
Luis Serrano, modificado hace 12 años.

RE: liferay-look-and-feel.xml with more than one theme causes JS errors?

New Member Mensajes: 4 Fecha de incorporación: 23/02/11 Mensajes recientes
So no one has any idea of what's going on?

I could really use a hint with this...
Ketkee A, modificado hace 11 años.

RE: liferay-look-and-feel.xml with more than one theme causes JS errors?

Junior Member Mensajes: 78 Fecha de incorporación: 10/03/11 Mensajes recientes
Hi Luis,

Were you able to solve this issue of JS errors when trying to implement configurable settings in theme?

I am facing the same issue. Request you to provide help.

Thanks.
Neha Goyal, modificado hace 10 años.

RE: liferay-look-and-feel.xml with more than one theme causes JS errors?

New Member Mensajes: 14 Fecha de incorporación: 19/08/13 Mensajes recientes
Setting javascript.fast.load=false might solve your problem.
Please reply if it works..!!!