Login  Register

Re: svn commit: r1150271 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl

Posted by Scott Gray-2 on Jul 25, 2011; 11:24am
URL: http://ofbiz.116.s1.nabble.com/Re-svn-commit-r1150271-ofbiz-trunk-specialpurpose-ecommerce-webapp-ecommerce-includes-headerHead-ftl-tp3691910p3692427.html

Try something like this in the OFBizContentTransform class:

                    String requestUrl = buf.toString();

+                    // If the URL starts with http(s) then there is nothing for us to do here
+                   if (requestUrl.matches("^https?://")) {
+                        out.write(requestUrl);
+                       return;
+                    }

                    // make the link
                    StringBuilder newURL = new StringBuilder();
                    ContentUrlTag.appendContentPrefix(request, newURL);

Regards
Scott

On 25/07/2011, at 11:07 PM, Hans Bakker wrote:

> I would appreciate your help here Scott. Sure that could be a better
> solution.
>
> We focus normally on application programming and less on framework
> programming as you may have noticed.
>
> So sure i agree with you yes,
>
> Regards,Hans
>
> On Mon, 2011-07-25 at 22:32 +1200, Scott Gray wrote:
>> Thanks for the explanation Hans, what if we put the improvement inside the transform code itself?  That way no one would ever have to worry about making a similar ftl change anywhere else.
>>
>> Regards
>> Scott
>>
>> On 25/07/2011, at 8:38 PM, Hans Bakker wrote:
>>
>>> The problem here is the contentUrl macro prefix is always applied to
>>> these script files. For the home site no problem, sometimes however
>>> these scriptfiles come from another site than where the contenturl macro
>>> prefixes to.
>>>
>>> If you have a better solution, sure let me know....
>>> This change could make a problem when the http switches to https, then
>>> the 'foreign' hard coded http is not switching.
>>>
>>> Regards,
>>> Hans
>>>
>>> On Mon, 2011-07-25 at 20:19 +1200, Scott Gray wrote:
>>>> Hi Hans,
>>>>
>>>> This seems a little messy, what are you trying to achieve that the transform cannot?
>>>>
>>>> Thanks
>>>> Scott
>>>>
>>>> On 24/07/2011, at 3:37 PM, [hidden email] wrote:
>>>>
>>>>> Author: hansbak
>>>>> Date: Sun Jul 24 03:37:20 2011
>>>>> New Revision: 1150271
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1150271&view=rev
>>>>> Log:
>>>>> only add contenturl prefix to javascript includes which do not start with http
>>>>>
>>>>> Modified:
>>>>>  ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl
>>>>>
>>>>> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl?rev=1150271&r1=1150270&r2=1150271&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl (original)
>>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl Sun Jul 24 03:37:20 2011
>>>>> @@ -35,7 +35,11 @@ under the License.
>>>>>   <#list layoutSettings.javaScripts as javaScript>
>>>>>     <#if javaScriptsSet.contains(javaScript)>
>>>>>       <#assign nothing = javaScriptsSet.remove(javaScript)/>
>>>>> -        <script type="text/javascript" src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>"></script>
>>>>> +        <#if javaScript?starts_with("http")>
>>>>> +            <script type="text/javascript" src="${StringUtil.wrapString(javaScript)}"></script>
>>>>> +        <#else>
>>>>> +            <script type="text/javascript" src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>"></script>
>>>>> +        </#if>
>>>>>     </#if>
>>>>>   </#list>
>>>>> </#if>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>>> Myself on twitter: http://twitter.com/hansbak
>>> Antwebsystems.com: Quality services for competitive rates.
>>>
>>
>
> --
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
>


smime.p7s (3K) Download Attachment