Mmm, let's clarify further, it's about conventions here.

Because the names used to retrieve the help files are in contents records of 
*HelpData.xml files, see notably the mapKey attributes which relate requests to 
HELP_*.xml filenames.
So you can use there either the component name or the webapps names since the 
mapping done with contents records is open. It's what is currently done, which 
leads to confusion.

I agree, using the webapp names makes more sense. So we should follow this 
convention and change the mappings in *HelpData.xml files and the HELP_*.xml 
filenames when needed.

If I did not miss anything, putting
context.put("webappName", context.put("webappName", 
session.getAttribute("_WEBAPP_NAME_")));in ScreenRenderer.java 
and using
<set field="helpTopic" value="${groovy: webappName. + '_' + 
requestAttributes._CURRENT_VIEW_}"/>
in CommonScreens.xml, will be enough on Framework side.

I will open a Jira... 

Jacques
PS: note for myself: add webbappName in wiki page on parameters

Pierre @GMail wrote:
> Thanks for the clarification, Jacques. Co
> 
> Sent from my iPhone
> 
> On 13 sep. 2013, at 23:49, Jacques Le Roux <jacques.le.r...@les7arts.com> 
> 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 <
>>> jacques.le.r...@les7arts.com> 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

Reply via email to