Commit Graph
106 Commits
Author SHA1 Message Date
Jacques Le Roux 83d0880ab8 Improved: Use NPM with gradle to get external JS dependencies (OFBIZ-11960)
Updates flot from 0.8.2 to 4.2.2 using npm
2022-01-08 11:18:40 +01:00
Nicolas Malin 7341e5662c Fixed: Screen Xml renderer failed on renderContainer[Begin,End] ftl macro (OFBIZ-12478)
This complete the previous Improvement, Rendering different HTML container types with ScreenRenderer (OFBIZ-10495), where the xml macro are forgotten.

In same time resynchronise also missing macro renderColumn*
2022-01-03 10:22:48 +01:00
Jacques Le Roux 47d8fea5fd Fixed: Bug in HtmlFormMacroLibrary.ftl::makeHyperlinkString macro (OFBIZ-12468)
I was unable to reproduce the error, but according to
https://stackoverflow.com/questions/51524640/why-does-freemarkers-built-in-is-string-return-true-for-an-object
The solution is to check for targetParameters not being an hash

Actually this was not the reason of the 1.7GB console log, another Jira to come
2021-12-18 11:58:54 +01:00
Aditya Sharma 4bd30ce4d5 Implemented: Use NPM with gradle to get external JS dependencies (OFBIZ-11960)
Removed javascript for jQuery, jQuery Migrate, jQuery Browser and jQuery Validation from OFBiz sources. Instead these are now retrieved during the build as NPM packages using gradle-node-plugin.

Thanks: Aditya Sharma for implementation.
2021-10-12 20:50:41 +01: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 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
Nicolas Malin 99696b0228 Fixed: Xml Element Link type hidden-form fail to resolve the form
(OFBIZ-12260)

When you generate a link with the type hidden-form and the link present an update area, on the click jquery failed to resolve the form.

 Example of a current link generate :

  <a href="javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')">javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')</a>

The problem come from OfbizUtil.js:748

    var $form = jQuery("#" + form)

To solve it, we change the form resolution in the function ajaxSubmitFormUpdateAreas with use the form name instead the form id.

Thanks to Xin Wang for this suggest to fix it.
2021-06-22 09:38:03 +02:00
Jacques Le Roux a99cbb5378 Fixed: XSS vulnerability for ListWorkEfforts form (OFBIZ-12254)
If `sanitizer.enable` is turned off, `ListWorkEfforts` form will be vulnerable
to XSS attack, because of incomplete escaping.

Steps to reproduce:

1. Turn off `sanitizer.enable` in owasp.properties
2. Create a WorkEffort entity with name as `<script>alert(1)</script>`
3. Go to page: http://localhost:8080/workeffort/control/FindWorkEffort
4. Search for "Work Effort Name" which contains "script"

Thanks: Xin Wang
2021-06-09 10:51:34 +02:00
Jacques Le Roux c4b106e1b1 Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
Fixes the call to the Google API key

Thanks to Daniel
2021-05-30 06:22:24 +02:00
Jacques Le Roux de5d1f8fc4 Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
Better way to handle a missing Google API key
2021-05-29 12:52:18 +02:00
Jacques Le Roux fec6559e7b Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
This is related to this question from Daniel at
https://github.com/apache/ofbiz-framework/pull/220

I couldn't figure out how to configure OFBiz with my Google API key so ended up
temporarily patching
themes/common-theme/template/includes/GeoLocation.ftl line 44 with my key.
Line 44 looked similar to:
<script src="https://maps.googleapis.com/maps/api/js?key=secret_google_api_key" type="application/javascript"></script>

Is there a way to configure ofbiz with the API key?

Disclaimer: w/o a not free "Google API key" I was not able to test, will ask
Daniel...
2021-05-29 12:06:16 +02:00
Aditya Sharma e97f45c381 Fixed: removed unused asmselect files and unused variable asm_asmListItemPercentOfForm (OFBIZ-10113)
asm select library is already replaced with select2 library, but the library files still exist in code base unused.
asm_asmListItemPercentOfForm varaible was used to set the width of the selected items which were displaced distictly from select fields. With select2, the selected items display inside the input field so it is no more needed

Thanks Jacques Le Roux for reporting it
2021-05-12 11:57:54 +05:30
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
James Yong 162506d372 Fixed: Display last-visited-time popup after login (OFBIZ-12148)
Empty popup occurs when showjGrowl is run later than the javascript from unsafe message. Delay running of showjGrowl function from 10 to 100 milliseconds.

Thanks Jacques for reporting.
2021-02-24 16:54:39 +07: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
Benjamin Jugl 7bca526c10 Fixed: StringOutOfBounds Exception while checking available Languages
(OFBIZ-10707)
2021-02-03 11:24:10 +01:00
James Yong d7d424fafd Fixed: Issue in rendering Comparitive balance sheet pdf (OFBIZ-12151), and Exporting the PDF for Cash Flow Statement displays the macro code for the date fields (OFBIZ-12155)
Bug introduced when fixing OFBIZ-12097

Thanks: Lalit for reporting OFBIZ-12151; Ankit, OFBIZ-12155. Jacques for linking the issues.
2021-01-24 10:27:42 +08:00
James Yong 6a08920606 Improved: Allow Unsafe Event Message (OFBIZ-12147)
Only delay jgrowl message when there is _UNSAFE_EVENT_MESSAGE_

Thanks Michael for feedback.
2021-01-21 22:53:57 +08:00
James Yong 1bfd3c5fb0 Improved: Allow Unsafe Event Message (OFBIZ-12147)
Allow application to define event messages that contain javascripts, via request attribute "_UNSAFE_EVENT_MESSAGE_"

Thanks Jacques for review
2021-01-21 20:46:06 +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 a66f0a9be8 Improved: Change inline style to js for multiple select field (OFBIZ-12115)
Test pages at /ordermgr/control/FindRequest and /ordermgr/control/findorders
2021-01-01 13:13:46 +08:00
James Yong 451f42a21c Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102)
Extend the same behavior to SetMultipleSelectJs.ftl.
2020-12-26 17:08:22 +08:00
James Yong f561c41ea0 Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102)
Changed at SetMultipleSelectJsList.ftl.
Tested page at /ordermgr/control/FindRequest
2020-12-26 13:14:07 +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
James Yong e405d35c08 Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load locale-specific datepicker js.
Corrected locale naming in macro to use '.locale'.
Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry.
2020-12-05 23:23:04 +08:00
James Yong cfabbc9b74 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071)
Fixed for Jquery DatePicker
2020-12-05 19:24:09 +08:00
James Yong a3fbb66479 Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load time-related js and css for date time picker.
Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry
2020-11-30 10:29:08 +08:00
James Yong 283752fd26 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071)
Default language file specified for DateTime doesn't exist in the project i.e.
/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js

Changed to /common/js/jquery/plugins/datetimepicker/i18n/jquery-ui-timepicker-en.js
2020-11-28 21:26:47 +08:00
James Yong bc5b0d595c Improved: Load language js for date.js only when required (OFBIZ-12064)
Tested on
1) date time field at /ordermgr/control/orderentry and
2) date find field at /ordermgr/control/findreturn
2020-11-27 21:51:35 +08:00
James Yong 0987c11ca7 Improved: Remove date.format-1.2.3-min.js (OFBIZ-12040)
This Javascript library is not use in the project.
2020-10-10 19:36:24 +08:00
Jacques Le Roux 96be0c62a3 Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
All final data members of the class must match this naming pattern
'^[A-Z][A-Z0-9](_[A-Z0-9]+)$'

I added the changes in CommonScreens.xml and kept the
private static Map<String, String> localeFiles = new HashMap<>();
expression, instead of
private static Map<String, String> localeFiles = new HashMap<String, String>();
in JsLanguageFilesMapping.ftl

I note that we use JQuery instead of Java conventional Jquery but that sounds OK
with me

Thanks: Suraj for the patch
2020-08-27 19:10:08 +02:00
James Yong 2eb3282988 Reverted: Error when rendering renderSubmitField macro (OFBIZ-11968)
No issue after new checkout.

Thanks Jacques and Dennis for the check
2020-08-22 14:43:00 +08:00
James Yong c3c41b28b4 Improved: multi-block attribute for html-template tag (OFBIZ-11686)
Moved <@scriptTagsFooter/> within the body tag.
2020-08-21 17:59:00 +08:00
James Yong 796e0d94ee Fixed: Error when rendering renderSubmitField macro (OFBIZ-11968)
Fixed error rendering renderSubmitField when accessing /humanres/control/FindPartySkills page
2020-08-21 15:44:39 +08:00
James Yong b480426e10 Improved: Move page-specific script links to html template (OFBIZ-11799)
use importLibrary js function to load impersonate.css
2020-08-21 15:13:35 +08:00
Jacques Le Roux 3c687a757c Improved: Form-Fields of certain types won't render IDs (OFBIZ-11957)
While implementing some OFBiz-Forms, I noticed, that certain types of
form-fields will not render the set ID.

Field-Types that won't work for sure are {{submit}} and {{hyperlink}} where the
set name for the parameter {{id-name}} simply will not be rendered in the
HTML-Code that is generated by OFBiz.

Thanks: Dennis Balkir
2020-08-20 15:17:21 +02:00
James Yong ede5aa1550 Improved: Move page-specific script links to html template (OFBIZ-11799)
ensure select2 lang js is loaded after the main js.
2020-08-17 21:52:19 +08:00
James Yong 7322abbcbe Improved: Move page-specific script links to html template (OFBIZ-11799)
refactoring
2020-08-17 20:45:47 +08:00
James Yong 39c1e280f9 Improved: Move page-specific script links to html template (OFBIZ-11799)
refactoring +
importLibrary function to use crossDomain = true to allow js file to be shown under browser's sources folder
2020-08-16 18:05:32 +08:00
James Yong dd5c7b715a Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load select2 js and css
Tested on
https://localhost:8443/example/control/FormWidgetExamples

https://localhost:8443/ordermgr/control/FindRequest
2020-08-15 20:25:34 +08:00
James Yong eb4f082fef Fixed: Error in log when running renderDropDownField macro (OFBIZ-11959)
Fixed unable to render the disable attribute.
2020-08-15 20:01:29 +08:00
James Yong c4b5407eb2 Improved: Move page-specific script links to html template (OFBIZ-11799)
Created new importLibrary js function to load OpenLayer js and css
Tested on
https://localhost:8443/example/control/ExampleGeoLocationPointSet4
https://localhost:8443/example/control/ExampleOsmGeoLocationPointSet4
2020-08-15 11:57:58 +08:00
James Yong aaa5d9e9a5 Improved: Move page-specific script links to html template (OFBIZ-11799)
Moved OpenLayer js and css to html template
Tested on https://localhost:8443/partymgr/control/PartyGeoLocation?partyId=DemoCustomer
2020-08-13 22:16:33 +08:00
James Yong d5140ca65d Improved: Move page-specific script links to html template (OFBIZ-11799)
Moved select2 script and link tags to html template when multi-block=true.
select2 language js will be auto added by MultiBlockHtmlTemplateUtil#addLinksToLayoutSettings

Tested on
https://localhost:8443/example/control/FormWidgetExamples

https://localhost:8443/ordermgr/control/FindRequest
2020-08-06 22:39:59 +08:00
James Yong c0e527efb2 Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Allow external scripts within the multi-block html template, to be rendered
within the html head tag, when a new attribute data-import is set to “head”

Thanks: Jacques for review
2020-05-30 12:00:21 +08:00
James Yong e46c7b9724 Fixed: showjGrowl called twice (OFBIZ-11720)
showjGrowl function is called twice,
even when there is no message to show.
2020-05-21 21:38:08 +08:00
James Yong ac541342ae Improved: Apply multi-block attr to each application (OFBIZ-11706)
Revert regression for showHelp.
2020-05-21 00:07:36 +08:00
Pawan Verma bc0afa36ee Fixed: Entering manually date in date-time field become unworkable
(OFBIZ-10432)

Thanks, Olivier for the report.
2020-05-20 14:26:52 +05:30