[jira] Commented: (OFBIZ-4060) Bug In Jquery Integration - js File Not Found

Posted by Nicolas Malin (Jira) on
URL: http://ofbiz.116.s1.nabble.com/jira-Created-OFBIZ-4060-Bug-In-Jquery-Integration-js-File-Not-Found-tp3089558p3162116.html


    [ https://issues.apache.org/jira/browse/OFBIZ-4060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974625#action_12974625 ]

Sascha Rodekamp commented on OFBIZ-4060:
----------------------------------------

Hi Jacques, Hi Scott, Hi *,
can we have a default i18n language file? I played a little bit around:
{code}
<set field="existLocaleJSFile" type="Boolean" value="${groovy: org.ofbiz.base.util.FileUtil.checkIfFileExists(localeJsFile)}"/>
<set field="localeJsFile" type="String" value="${groovy: existLocaleJSFile ? localeJsFile : defaultLocaleFile}" />
               
<set field="layoutSettings.javaScripts[+0]" value="${groovy: existLocaleJSFile ? localeJsFile : defaultLocaleFile}" global="true"/>
{code}

But my problem is, that i have to pass a value to the JS Object, if i pass nothing or an random string i got an exception (works as expected, but don't help us).

If we now extract the default language from the datepicker js file and copy it to a separate file which we load if the file with the user locale doesn't exist , solves our problem.

An alternative is to modify the JS loading directly in the header.ftl
{code}
        <#list layoutSettings.javaScripts as javaScript>
            <#if javaScriptsSet.contains(javaScript)>
                <#assign nothing = javaScriptsSet.remove(javaScript)/>
                <#assign existsJSFile = Static["org.ofbiz.base.util.FileUtil"].checkIfFileExists("framework/images/webapp" + StringUtil.wrapString(javaScript))/>
                <#if existsJSFile>
                  <script src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>" type="text/javascript"></script>
                </#if>
            </#if>
        </#list>
{code}
That is of course very slow because he have to check the availability for each *.js file.

What do u think?

Cheers Sascha

> Bug In Jquery Integration - js File Not Found
> ---------------------------------------------
>
>                 Key: OFBIZ-4060
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4060
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Adrian Crum
>            Priority: Minor
>
> I'm getting this error in the log:
> 2010-12-15 09:58:38,203 (http-0.0.0.0-8443-2) [ComponentLocationResolver.java:43 :WARN ] Unable to get file URL for component location; expanded location was [C:/ofbiz/framework/images/webapp/images/jquery/ui/development-bundle/ui/i18n/jquery.ui.datepicker-en-US.js], original location was [component://images/webapp/images/jquery/ui/development-bundle/ui/i18n/jquery.ui.datepicker-en-US.js]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.