Commit Graph
1588 Commits
Author SHA1 Message Date
Gil Portenseigne ab9ca12221 Execute a callback with parameters from the request (OFBIZ-12262)
Transform workEffort creation using modal and callback system to
illustrate this improvement.

A new Attribute `from-event-result` is created for `set-callback`
parameters, to indicate that the callback should be called with a
parameter which value comes from the event result initiated by the link.

In this example, is retrieved from the workeffort creation event the id
needed to display the WorkEffortSummary screen of the new data.

A new pattern is created to encode in CALLBACK JWT token the data that
should be parsed from the event. The parsing occurs in javascript.
2021-09-07 14:56:20 +02:00
Jacques Le Roux 4f14cb96cf Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
Fixes a checkstyle issue
2021-07-23 09:30:25 +02:00
Nicolas Malin c5a1a91fbd Fixed: Correct checkstyle typo 2021-07-23 09:10:09 +02:00
Nicolas Malin 8b5bd93d3a Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
When you use a platform-specific element on CompoundWidget like this :

     <ws:platform-specific>
        <ws:html><ws:html-template location="component ..."/></ws:html>
     </ws:platform-specific>

the ModelScreenWidget failed to resolve the attended type due to the
namespace presence (ws:html != html) and finally failed to rendering the screen

Complete the previous commit where I forgot this part
2021-07-22 21:37:09 +02:00
Jacques Le Roux 2c421cedfb Fixed: Add http to https redirect rule for ofbiz.apache.org (OFBIZ-10590)
This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?

The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
2021-07-20 07:47:32 +02:00
Nicolas Malin c7e21a7249 Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
When you use a platform-specific element on CompoundWidget like this :

     <ws:platform-specific>
        <ws:html><ws:html-template location="component ..."/></ws:html>
     </ws:platform-specific>

the ModelScreenWidget failed to resolve the attended type due to the
namespace presence (ws:html != html) and finally failed to rendering the screen
2021-07-16 18:10:17 +02:00
Jacques Le Roux 414e4d83ed Fixed: Macro renderLink default height and width not retrieved on menus (OFBIZ-12279)
Menus link defaut parameters for height and width are not considered when the
link is generated. When parameter with empty value is passed to the macro, macro
default values are not retrieved.

To reproduce
you can create a "layered-modal" type link in a menu and click on the link
(without height nor width):
this will generate the link with parameters "data-dialog-height" and
"data-dialog-width" empty

Patch provided
When applied, the MacroMenuRenderer.renderLink  will not send empty values to
the macro so that default value will be retrieved (what is actually done on
MacroFormRenderer.renderLookup)

Thanks: Leila
2021-07-12 12:03:59 +02:00
Nicolas Malin 894408cb0d Fixed: Link request-confirmation not generated on menus (OFBIZ-12278)
Menus link with request-confirmation and confirmation message do not generate the script that open confirmation

When you activate the following menu item :
      <menu-item name="statusToCancelled" title="${uiLabelMap.AccountingPaymentTabStatusToCancelled}">
          <link target="setPaymentStatus" request-confirmation="true" confirmation-message="You want to cancel this payment number ${payment.paymentId}?">
              ....
         </link>
      </menu-item>

OFBiz to not generate the js code link to the request-confirmation attribute because this functionality has been never implemented on java code for MenuRenderer

Thanks to Leila Mekika for raised this issue and solved it
2021-07-09 20:31:56 +02:00
Nicolas Malin d795fd45be Fixed: List parameters forwarded by element callback failed to restore the list (OFBIZ-11812) (OFBIZ-12261)
There is an error when the callback element resolve the list parameters, it check the parameters element as field and not as final variable.

This generate an empty callback link.
2021-07-07 10:17:36 +02:00
Jacques Le Roux 27d9e64d82 Fixed: fixes a chekstyle issue
It was put in with
https://github.com/apache/ofbiz-framework/commit/7120cf7
2021-07-03 19:30:17 +02:00
Nicolas Malin 7120cf7d5f Implemented: Keep paginate list query on dynamic refresh (OFBIZ-12261)
When you display a list with search criteria, pagination information and/or sort parameters, if you update an element of this list with a update area, you loose all of them.

Example:

<form name="ListProductMeters" type="list" list-name="productMeters" target="updateProductMeter" paginate-target="ListProductMeters">
    <actions>
       <entity-condition entity-name="ProductMeter">...
    </actions>
    <auto-fields-service service-name="updateProductMeter"/>
    <field name="meterName"><text size="20"/></field>
    <field name="updateButton"><submit/></field>
    <on-event-update-area event-type="paginate"/>
    <on-event-update-area event-type="sort-column"/>
    <on-event-update-area event-type="submit"/>
</form>

Or this works well if you move an next page sort the list.
I realize the same principle for each event which do a modification of element in the list and after refresh it.

I also introduce the possibility to submit a form on modal (for edition) when you press 'enter' that will refresh the origin list.

Last point, the queryString element use to propage pagination state is also forwarded on callback element to keep this on update the list.

Thanks to Gil Portenseigne is help.
2021-07-02 17:27:21 +02:00
Gil Portenseigne b4e46ff070 Implemented : New child element set-callback on link to control dynamism (OFBIZ-11812)
Refreshment information are controlled by the calling object,
instead of the called form.

This avoid dependency between called form and parent screens.

The set-callback tag generate a jwt encoded UpdateArea widget, that
is transmitted through submits and links until a submit with no
update-area information is met.  This specific submit ends the
process launched by the link, and trigger the refresh action
contained into the JWT token.
2021-06-24 16:13:00 +02:00
Jacques Le Roux cf2f0b378c Fixed: Status change button on Invoice screen is not working (OFBIZ-12248)
Steps:
1. Open URL https://demo-trunk.ofbiz.apache.org/accounting/control/findInvoices
2. View any invoice from the list say [invoice# : 8010]
3. Change the status to Ready / Cancelled

Expected:
Status should be marked to Ready for Posting or Cancelled

Actual Result
The loader is visible but nothing happens

Thanks: Nameet Jain
2021-06-03 11:53:59 +02:00
Daniel Watford d16bef46dc Improved: MacroFormRenderer refactoring of field group open and close elements
(OFBIZ-12124)

Part of the OFBIZ-11456 MacroFormRenderer refactoring effort.

Rather than MacroFormRenderer producing and evaulating FTL strings, it now
uses RenderableFtlElementsBuilder to create RenderableFtlMacroCall objects
which are then passed to an FtlWriter for evaluation.
2021-05-27 11:12:12 +01:00
Nicolas Malin b663660486 Implemented: on-event-update-area on form inherit information from parent form
(OFBIZ-11811) (OFBIZ-11808)

When you write a form, if you want the dynamic interaction and style, you need to implement everything on the form.
The developer must know the style used, different area and rules support by the technology besides the really information/action that the form will do.

   <form name="ListFacility" type="list" list-name="listIt" paginate-target="FindFacility"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
       <actions>...
       <field name="facilityId">....
       <on-event-update-area event-type="sort-column" area-id="search-results" area-target="FacilitySearchResults"/>
       <on-event-update-area event-type="paginate" area-id="search-results" area-target="FacilitySearchResults"/>
   </form>

We can put all information on the theme and all dynamic refresh (for area) are related to the parent form and parent screen. Finally we will obtain :

    <form name="ListFacility" extends="CommonDynamicList" extends-resource="component://common/widget/CommonForms.xml"
          paginate-target="FindFacility">
        <actions>...
        <field name="facilityId">....
    </form>

    <form name="CommonDynamicList" type="list"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
       <on-event-update-area event-type="sort-column"/>
       <on-event-update-area event-type="paginate"/>
   </form>

The target and area to update has been automatically resolved from the parent form and screen.

This commit improve the modelForm and the widget-form.xsd to do that.

Thanks to Gil Portenseigne his help
2021-05-21 17:58:27 +02:00
Jacques Le Roux 75d3367d47 Improved: replaces java.rmi.server.UID by java.util.UUID
Not a big deal but better use java.util.UUID there.
2021-03-23 09:38:03 +01:00
Jacques Le Roux 8243d926d0 Improved: Improves encoding in 3 classes
Fixes an issue put in with commit c54dced51c

There I wrongly replaced internalEncoder in MacroFormRenderer.java by
context.get("simpleEncoder")

While at it uses the pattern used in commit cb9c366 in every place in
modelFormField class
2021-03-07 16:23:21 +01:00
Jacques Le Roux 000473c7ed Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)
I tried to use the form-widgets checkbox on a custom find screen.
But after searching values with option/s checked, no checkbox remains selected.

I found similar kind of ticket OFBIZ-11933.
The checkbox was replaced by usage of the asmselect jQuery plugin

This fixes the bug at the framework level.

jleroux: fixes checkstyle issues: missing spaces after (3) if

Thanks: Nameet Jain
2021-03-03 11:27:47 +01:00
Jacques Le Roux 548cfa8033 Reverted: reverts "Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)"
This reverts commit 6bfae1293a.

There is an issue with checkFieldMacroRendered test
2021-03-02 14:19:38 +01:00
Jacques Le Roux 6bfae1293a Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)
I tried to use the form-widgets checkbox on a custom find screen.
But after searching values with option/s checked, no checkbox remains selected.

I found similar kind of ticket OFBIZ-11933.
The checkbox was replaced by usage of the asmselect jQuery plugin

This fixes the bug at the framework level.

jleroux: fixes checkstyle issues: missing spaces after (3) if

Thanks: Nameet Jain
2021-03-02 12:14:45 +01:00
Nicolas Malin 5229d572df Implemented: Element link can update partial area
(OFBIZ-11810)

   Currently when you want to display an information easily on sub-screen
dynamically (example as related element) is currently not possible without
write specific js code.
   To simplify it, we introduce a new link type: update-area, to indicate
to the theme that we want to refresh  a local area with the call result.

   Example :
       <link target="ListCategoryProductMembers" link-type="update-area" target-window="detail">
           <parameter param-name="productCategoryId"/>
       </link>

For this example we indicate that the display result of target 'ListCategoryProductMembers' is going
on the area identify by 'detail'. Pleasure to the theme to manage it.
2021-02-17 18:11:19 +01:00
Wiebke Pätzold 384572401d Improved: Fixed indentation level (OFBIZ-12169) 2021-02-09 14:12:15 +01:00
Wiebke Pätzold 95d37d2189 Removes and adds whitespaces as suggested by checkstyle (OFBIZ-12169) 2021-02-09 08:46:20 +01:00
Michael Brohl bae3628501 Declare classes final as suggested by checkstyle (OFBIZ-12169)
Helper and Worker classes which are likely to be extended by custom
projects where left as is.
2021-02-08 17:09:56 +01:00
Wiebke Pätzold 2fe5e15a83 Improved: Adds newline at the end of file (OFBIZ-12169) 2021-02-08 16:31:13 +01:00
Jacques Le Roux c54dced51c Improved: Improve description encoding in 2 classes: MacroFormRenderer and renderableFtlFormElementsBuilder (OFBIZ-12159)
Concern MacroFormRenderer::makeHyperlinkByType and renderableFtlFormElementsBuilder::encode
I'm not sure it's useful but it's harmless
2021-01-23 18:18:16 +01:00
Jacques Le Roux cb9c366327 Fixed: Ampersand in Party not displayed correctly (OFBIZ-12140)
In the reported case, ModelFormField::getDescription double HTML encodes the
description when both the entity and the description contain an ampersand.

A solution is to test if the description is already HTML encoded before encoding
it again. If HTML encoded then only String encodes it.

BTW I'm not sure it's useful but it's harmless, the same solution can be applied
to OFBIZ-12026 and similarly in renderableFtlFormElementsBuilder::encode. I'll
do as improvements...

Thanks: Andrew Waters for report and help in analysis
2021-01-23 17:56:15 +01:00
Jacques Le Roux 3f76f86014 Improved: Marked unused HTML renderers as deprecated (OFBIZ-11927)
Upcoming Branch is actually another name for trunk. It's always evolving and
never released. Better put a date when deprecating a Class or method. Else you
have no idea when it was deprecated, apart referring to git-blame.
2021-01-16 10:14:28 +01:00
Daniel Watford 406f51d032 Improved: Marked unused HTML renderers as deprecated
(OFBIZ-11927)
2021-01-14 17:30:03 +00:00
Daniel Watford d40081dc86 Improved: Minor changes to reduce checkstyle warnings count 2021-01-13 14:28:19 +00:00
James Yong 9c7dc7b877 Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134)
Rename + Refactor
2021-01-13 09:26:42 +08:00
Nicolas Malin e0a840a0c4 Implemented: Access to the current screen from any widget element
(OFBIZ-11809)

During the rendering process, an element have no information about the screen which is dependent from. This not really help to automate some refresh treatment and force the developer to know the screen structure where is the element.

To solve this situation we implement a new class, ScreenStack that allow anytime for any element to identify its direct dependency. This help to resolve the unique Id that the screen take and can be used by the theme.

At any time a developer can retrieve the screen reference with uel function screen:id(screenStack)

example:
     <container id="${screen:id(screenStack)}">

The object screenStack is always present during a rendering process.
2021-01-12 17:48:00 +01:00
James Yong 3c83ab53b2 Refactoring 2021-01-12 23:25:25 +08:00
Daniel Watford 3795727ea2 Improved: MacroFormRenderer refactoring of label, display and text
fields

(OFBIZ-11900)

New RenderableFtl elements to represent pre-rendered FTL strings and FTL
macro calls. RenderableFtl elements are able to render themselves to
strings which are processed as an FTL template by the FtlWriter class.

For labels, display fields and text fields, MacroFormRenderer no longer
generates FTL to write to a template itself, but instead calls
RenderableFtlFormElementsBuilder to create corresponding RenderableFtl
elements which are then processed by FtlWriter. This is a WIP to reduce
complexity in MacroFormRenderer.
2021-01-12 10:40:58 +00:00
James Yong 067db8fe9e Improved: Open Menu file from browser (OFBIZ-12119)
User can open menu definition file from the browser by clicking on the named border.
2021-01-09 13:05:23 +08:00
James Yong f484b0d318 Fixed: Open Screen file from browser (OFBIZ-12038)
Fix named borders not rendered for sub-screens.
2021-01-06 23:23:35 +08:00
James Yong 203fa5f1c1 Implemented: Support Freemarker square interpolation syntax (OFBIZ-12099)
Use square interpolation syntax when file extension is .spi.ftl
2020-12-21 19:46:11 +08:00
James Yong 483e77ea83 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
Use inline script when request is ajax
2020-12-20 08:46:52 +08:00
Jacques Le Roux ec2b84341e Reverted: "Improved: Hyperlink target-type attribute is deprecated and should be replaced by url-mode (OFBIZ-12091)"
This reverts commit 17eb2e4cf7.

It does not work when using <<target="javascript:........>>
I could change those cases but it's easier and safer to simply revert back to
target-type!

Thanks: James for report
2020-12-18 11:08:32 +01:00
Jacques Le Roux 93fb762071 Improved: Add unique identifier data to portlet context (OFBIZ-12090)
Add the portalPortletId + portletSeqId to the portlet context. This is useful if
a unique identifier within the portlet body (the portlet content) is required.

Thanks: Ingo Wolfmayr
2020-12-12 19:39:31 +01:00
Jacques Le Roux caded9e937 Fixed: Hyperlink title under form widget doesn't support character encoding for special characters (OFBIZ-12026)
When we use any title with special characters for hyperlink tag, it shows broken
string on UI, eg:
<hyperlink description="${uiLabelMap.CommonImportExport}"  target="ImportExport">
should render a button with the title "Import/Export. But it shows as
Import&#x2f;Export

jleroux: I have noticed that the same happens with special French characters.
So it's a general issue.
The title (description in code) is HTML encoded and that does not work for
special characters. I simply used a string encoder.

Thanks: Pradeep Choudhary for report, Sourabh Jain for a possible but not
general solution at OFBIZ-12023, ie using target-type="plain"
2020-12-11 13:40:53 +01:00
James Yong c1644940e9 Fixed: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
Fixed compile error in MacroFormRendererTest.java.

Thanks: Daniel and Tomek for the finding
2020-12-07 23:46:02 +08:00
James Yong 76a940ab43 Improved: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
DateFindField and DateTimeField macros need to find locale-specific javascript library files.
2020-12-05 23:13:55 +08:00
Jacques Le Roux 21e5f215f1 Fixed: Sorting of lists generates undesired results (OFBIZ-8302)
Workaround for an issue reported by
MacroFormRendererTest::renderSortFieldUsesQueryString
Put in with "MacroFormRenderer refactoring" (OFBIZ-11456)

I put a FIXME as I'm not sure how to handle it in a reasonable time :/
2020-11-01 17:43:07 +01:00
Jacques Le Roux cd242ea34c Fixed: Sorting of lists generates undesired results (OFBIZ-8302)
For this issue (OFBIZ-8302) I reverted the point 1 of
http://svn.apache.org/viewvc?view=revision&revision=1759555

As reported by Alvaro Munoz from GH security team it's not sufficient:
<<the second part of the fix was not effective, since the attacker can close the
raw string context with a double quote and write a new attribute or even close
the macro tag and write arbitrary FreeMarker code.>>

So this removes the 2nd part and add better solution to fix the OFBIZ-8302 issue
The solution is to encode only the QueryString and to handle it correctly in
UtilHttp::getParameterMap. I must say it was not a sinecure!
2020-10-31 20:21:32 +01:00
James Yong 127cd86da7 Improved: Open Screen file from browser (OFBIZ-12038)
Refactoring
2020-10-11 09:18:58 +08:00
James Yong a983c7741c Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041)
Add function to open the corresponding Form Widget file with IDE
when the named border is clicked from browser.
Dependent on widget.dev.namedBorder and widget.dev.cmd.openSourceFile properties.

Thanks Jacques for review
2020-10-11 08:37:39 +08:00
James Yong cbbcb14119 Improved: Open Screen file from browser (OFBIZ-12038)
Refactoring
2020-10-10 18:06:14 +08:00
James Yong 0088af8b90 Fixed: Open Screen file from browser (OFBIZ-12038)
Fix regresssions in integration tests
2020-10-10 16:29:41 +08:00
James Yong 5fca2ed58d Improved: Open Screen file from browser (OFBIZ-12038)
Refactoring
2020-10-10 12:39:43 +08:00