Re: svn commit: r1518777 - in /ofbiz/trunk: applications/accounting/webapp/accounting/WEB-INF/ applications/order/webapp/ordermgr/WEB-INF/ applications/product/webapp/facility/WEB-INF/ framework/base/src/org/ofbiz/base/location/ framework/base/src/org/ofbi

Posted by Pierre Smits on
URL: http://ofbiz.116.s1.nabble.com/Re-svn-commit-r1518777-in-ofbiz-trunk-applications-accounting-webapp-accounting-WEB-INF-applications-tp4643588p4643936.html

Thanks for the clarification, Jacques. Co

Sent from my iPhone

On 13 sep. 2013, at 23:49, Jacques Le Roux <[hidden email]> wrote:

> Hi Pierre,
>
> The same reason that made me pick the (possibly overriden) component name. Jacopo also suggested the webapp name (we miss a part of the thread here, refer to it if needed)
> But that's not how the HELP is coded at the moment. It uses the component name.
>
> Also to use _WEBAPP_NAME_ (note the _ at end), since it's not in parameters but is a session attribute, we would also need to put it in context in ScreenRenderer.java using something like
> context.put("webappName", session.getAttribute("_WEBAPP_NAME_")
> or
> context.put("webappName", UtilHttp.getApplicationName(request))
> I don't see a plus compared to my solution.
>
> The only drawback of my solution is that the localDispatcherName *MUST* be named after the component name.
> But it's the case for all webapps so far. And I don't see a need to change this (very useful) convention.
>
> Disclaimer: I did not look yet at how the helpTopic var is used to render the help, just followed the trend. Maybe using the webapp is possible...
>
> Jacques
>
> Pierre Smits wrote:
>> Hi Jacques,
>>
>> Why not use the  '_WEBAPP_NAME'  variable. That is already available in the
>> parameter list. You could even avoid transforming it to upper case. A one
>> time conversion of the data to the appropriate case would then align the
>> data.
>>
>> Regards,
>>
>> Pierre Smits
>>
>> *ORRTIZ.COM <http://www.orrtiz.com>*
>> Services & Solutions for Cloud-
>> Based Manufacturing, Professional
>> Services and Retail & Trade
>> http://www.orrtiz.com
>>
>>
>> On Fri, Sep 13, 2013 at 12:02 PM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>> Jacopo Cappellato wrote:
>>>> is a general issue caused by a wrong design in the generation of help
>>> links; specifically, the issue is that in
>>>>
>>>> <set field="helpTopic" value="${groovy:
>>> parameters.componentName.toUpperCase() + '_' +
>>> requestAttributes._CURRENT_VIEW_}"/>
>>>>
>>>> the name of the help file is composed using the component name; this is
>>> a wrong approach and could be solved, for instance, by
>>>> using  the webapp name instead of the component name;
>>>
>>> As it is now, it should not be the webapp name but the component name or
>>> the overriden component name.
>>>
>>> We could do it like this (both cases will be covered as long as the
>>> web.xml file of the overriding webapp is correct)
>>>
>>> Index: applications/commonext/widget/CommonScreens.xml
>>> ===================================================================
>>> --- applications/commonext/widget/CommonScreens.xml (revision 1522780)
>>> +++ applications/commonext/widget/CommonScreens.xml (working copy)
>>> @@ -45,8 +45,7 @@
>>>                 <set field="layoutSettings.middleTopLink2"
>>> value="${lastSystemInfoNote2.moreInfoUrl}${groovy: if
>>> (lastSystemInfoNote2&amp;&amp;lastSystemInfoNote2.moreInfoItemName&amp;&amp;lastSystemInfoNote2.moreInfoItemId)&quot;?&quot;
>>> + lastSystemInfoNote2.moreInfoItemName + &quot;=&quot; +
>>> lastSystemInfoNote2.moreInfoItemId + &quot;&amp;id=&quot; +
>>> lastSystemInfoNote2.moreInfoItemId;}"/>
>>>                 <set field="layoutSettings.middleTopLink3"
>>> value="${lastSystemInfoNote3.moreInfoUrl}${groovy: if
>>> (lastSystemInfoNote3&amp;&amp;lastSystemInfoNote3.moreInfoItemName&amp;&amp;lastSystemInfoNote3.moreInfoItemId)&quot;?&quot;
>>> + lastSystemInfoNote3.moreInfoItemName + &quot;=&quot; +
>>> lastSystemInfoNote3.moreInfoItemId + &quot;&amp;id=&quot; +
>>> lastSystemInfoNote3.moreInfoItemId;}"/>
>>>                 <!-- Help link actions -->
>>> -                <!--<set field="helpTopic" value="${groovy: webSiteId +
>>> '_' + requestAttributes._CURRENT_VIEW_}"/>-->
>>> -                <set field="helpTopic" value="${groovy:
>>> parameters.componentName.toUpperCase() + '_' +
>>> requestAttributes._CURRENT_VIEW_}"/>
>>> +                <set field="helpTopic" value="${groovy:
>>> applicationName.toUpperCase() + '_' + requestAttributes._CURRENT_VIEW_}"/>
>>>                 <entity-and list="pageAvail" entity-name="ContentAssoc">
>>>                     <field-map field-name="mapKey"
>>> from-field="helpTopic"/>
>>>                 </entity-and>
>>> Index: framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>> ===================================================================
>>> --- framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>> (revision 1522780)
>>> +++ framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>> (working copy)
>>> @@ -220,6 +220,8 @@
>>>         if (servletContext != null) {
>>>             String rootDir = (String) context.get("rootDir");
>>>             String webSiteId = (String) context.get("webSiteId");
>>> +            String localDispatcherName = (String)
>>> servletContext.getAttribute("localDispatcherName");
>>> +            context.put("applicationName", localDispatcherName);
>>>             String https = (String) context.get("https");
>>>             if (UtilValidate.isEmpty(rootDir)) {
>>>                 rootDir = servletContext.getRealPath("/");
>>>
>>> Thanks for your help Jacopo, I really went on a wrong track, my apologies
>>>
>>>
>>> Jacques