Commit Graph
1141 Commits
Author SHA1 Message Date
James Yong e3f6d1547f Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Fix regression in scrumtests that resulted in NullPointerException.
2020-06-06 14:28:32 +08:00
James Yong 347ea63479 Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Improve function for adding links to layoutSettings
2020-06-06 10:23:41 +08:00
Jacques Le Roux 4b55e07505 Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Fixes Javadoc issues
2020-06-01 07:52:59 +02:00
James Yong a5ab3961fa Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Allow expression in template location.
2020-05-31 23:31:49 +08:00
James Yong f85040ff04 Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Allow expression in template location.
2020-05-31 17:42:42 +08:00
James Yong d1a22a6ba8 Improved: Headerize external script in multi-block html template (OFBIZ-11741)
Cleanup script cache when session ended
2020-05-30 14:32:38 +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
holivier 097db39ee0 fixed: sort-order (field) not works in CompoundWidgets file (OFBIZ-11708)
In a form, when <sort-order tag is used, the children analyze not works
because, getTagName() is used not the getLocalName(). getTagName()
return "wf:sort-field" when getLocalName return "sort-field".
So change getTagName() to getLocalName() for sort-order children
2020-05-29 11:43:58 +02:00
holivier e4ee439e27 Fixed: drop-down field not work when in a compound-widget file (OFBIZ-11676)
When, in ModelFormField, FieldInfoWithOptions (which read xml file ) is
call, test on tag name is done with getName() and not getLocalName() so
none "option" is recognize when field is declare on a compound-widget
file. getName() is change to getLocalName()
2020-05-29 11:26:40 +02:00
Suraj Khurana abc7836dde Improved: Made MODULE as private data member of class instead of public in all framework components.
(OFBIZ-11739)
This will reduce checkstlye issues. Thanks Jacques for review.
2020-05-29 13:20:46 +05:30
James Yong 767390ad89 Improved: Apply multi-block attr to each application (OFBIZ-11706)
1. Bug Fix
2. Disable multi-block until function is stabilized.
2020-05-23 14:08:35 +08:00
James Yong e675f0a79f Improved: Apply multi-block attr to each application (OFBIZ-11706)
1. Fix missing Boundary Comment at beginning
2. Apply multi-block attr
2020-05-22 00:54:20 +08:00
Pawan Verma 3b7e63744c Improved: Expansion of form widget field disabled atrribute with xsd improvement (#141)
(OFBIZ-10432)

1. Added disabled attribute support in ModelFormField with xs:boolean type
2. Removed specific field level disabled attribute support for CheckField and TextField
3. Modified existing usage of disabled attribute as per new implementation.

Thanks: Rishi for the report and Taher, Gil and Jacques for the feedback
2020-05-19 17:37:24 +05:30
James Yong e3e12ee487 Improved: No need to specify externalKeyParam in ofbizUrl calls (OFBIZ-11711)
Let ofbizUrl macro generates externalLoginKey when needed.

Thanks: Jacques for review
2020-05-17 20:37:48 +08:00
James Yong 47e6b9cad6 Improved: Apply multi-block attr to each application (OFBIZ-11706)
Fix regresssion
2020-05-16 17:51:34 +08:00
James Yong d94beee1b6 Improved: Apply multi-block attr to each application (OFBIZ-11706)
For Party application.
Also fixed bug where external script tag is incorrectly handled
when extracting internal script tag from freemarker template.
2020-05-15 15:43:31 +08:00
James Yong 60c78d24be Improved: <script-template> widget tag (OFBIZ-11686)
Removed script-template tag.
Use multi-block=true on html-template tag instead.
2020-05-15 11:16:15 +08:00
holivier 4f5e6f9f06 Improved: <script-template> widget tag
(OFBIZ-11686)

Correction in javadoc, <script is not authorize in javadoc because it
can introduce some javascript in javadoc, and so generate an error in
javadoc build.
Replace <script-template/> by "script-template"
2020-05-14 09:38:23 +02:00
James Yong 803f7fa060 Improved: <script-template> widget tag (OFBIZ-11686)
The new tag allows us to render a freemarker template containing javascript,
as external script in html instead of inline script.
This helps to reduce CSP errors.
2020-05-13 20:19:05 +08:00
Pawan Verma 8bd7b9b6f9 Fixed: Theme files loading taking longer time
(OFBIZ-11665)

Thanks: Pierre and Jacques for the review.
2020-05-10 14:17:13 +05:30
Jacques Le Roux ec23f8b61f Fixed: Compound-widget not works with condition
(OFBIZ-11606)

Fixes "<**:condition" not well managed and generating an error

Changes all the getNodeName() by getLocalName() in the ModelX****Condition.java

Thanks: Olivier
2020-04-27 17:43:38 +02:00
Jacques Le Roux d7c42e3b8c Fixed: Compound-widget not works with condition
(OFBIZ-11606)

rootElement is not correct for a compound file, it's necessary to do a
UtilXml.firstChildElement(rootElement, "forms"); to be correct.
It's done for screen, form but not for grid !

So correction is now added the correct read of rootElement.

Thanks: Olivier
2020-04-27 14:31:31 +02:00
Jacques Le Roux b95fa36bf4 Improved: follow checkstyle conventions in files committed for CSRF token defense
Mostly manually-automated, so some changes are not perfect. I have manually
changed back excessive ones

Comments out ArrayTypeStyle checkstyle
Updates checkstyleMain.maxErrors
2020-04-06 12:05:16 +02:00
Jacques Le Roux ddb8f4273a Improved: replaces module by MODULE everywhere 2020-04-05 19:46:34 +02:00
Jacques Le Roux 43f46399ff Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux c68d43efa2 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes an issue due to Eclipse automated import organisation.

There are still check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux d1ca68c166 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes a check issue (line too long)

Notice: on Windows I get 20 errors when compiling:
> Task :compileTestJava FAILED
C:\projectsASF\Git\ofbiz-framework\framework\widget\src\test\java\org\apache\
ofbiz\widget\renderer\macro\MacroFormRendererTest.java:134:
error: annotation type not applicable to this kind of declaration
        @Mock
        ^
I guess the change in build.gradle are not enough for Windows, to be seen later...
2020-04-04 15:49:41 +02:00
Daniel Watford 1fbf6c3d6b Improved: Added license header to MacroFormRendererTest
(OFBIZ-4035)
2020-04-04 15:49:41 +02:00
Daniel Watford 87277ab992 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)
2020-04-04 15:49:40 +02:00
Daniel Watford a769aaf5fd Improved: Ensure MacroFormRenderer uses
ModelFormField#getCurrentContainerId rather than
ModelFormField#getIdName to ensure any FlexibleStringExpander expression
defined in the field's id-name property is processed before rendering
into the container FTL macro.

(OFBIZ-4035)
2020-03-21 11:31:55 +01:00
Daniel Watford 09b42258d9 Fixed: Fixed line lengths in ModelFormFieldTest to adhere to coding standards
(OFBIZ-11418)
2020-03-21 11:31:42 +01:00
Daniel Watford b770f91a97 Improved: Use FlexibleStringExpander in form widget lookup field field
target parameters

(OFBIZ-11418)

Changed target-parameter attribute of the form widget's Lookup field to
use the FlexibleStringExpander type rather than String. This has been
done to allow reference to other form fields which may have had their
parameter-name attribute set to a FlexibleStringExpander expression.
2020-03-21 11:31:42 +01:00
Jacques Le Roux c34491892a Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:
Improved: no functional change
(OFBIZ-)
Explanation
Thanks:
2020-02-27 14:36:26 +01:00
Daniel Watford e76cbd1f34 Improved: Added ModelFormField testing to ensure getting a field's
current container id will return an evaulated FlexibleStringExpander
expression.

(OFBIZ-4035)
2020-02-23 20:32:50 +01:00
Nicolas Malin 296417a7bd Fixed: Correct check style issue on ModelTheme 2020-02-20 14:50:19 +01:00
Nicolas Malin 38f972a0d0 Improved: Add CommonForms as template pattern configured by theme
(OFBIZ-11335)

Currently on OFBiz we implemented a process to define some different
screen and menu that can be implemented by the theming.
But for the form we have nothing. All style are hard coded on each

    <grid name="ListEntities" ...
      odd-row-style="alternate-row" default-table-style="basic-table hover-bar">

I extend the theming implementation principle to forms element with adding :
 * a new xsd element common-forms (like common-screens)
 * some default form templates to extend :
   * grid CommonSimpleGrid
   * grid CommonBasicGrid
   * form CommonSimpleList
   * form CommonBasicList
   * form CommonInLineEditList
   * form CommonBasicSingle

We can use its like :

    <form name="LayoutDemoList" extends="CommonBasicList"
          extends-resource="component://common/widget/CommonForms.xml"

The main difficulty raise to this task was propage the visualTheme during
the ModelForm intanciation, because we need to load wiget style
(and some other information wanted on the template) on model load in memory.
This is cover by commit 1941a05a34.

Forms present on the screen https://localhost:8443/webtools/control/WebtoolsLayoutDemo
are now extend through with theme.

Finally with this we can extend style form (pagination, header, line and so on ...)
directly by your theme without change the framework.
2020-02-20 14:49:11 +01:00
Nicolas Malin 1941a05a34 Improved: Manage VisualTheme in ModelForm
(OFBIZ-11335)

Related to issue OFBIZ-11335, extends form's factories and form's models
to support a visualTheme during the model creation.

This extend help centralize style information used by forms on a theme.
For performance reason when the model is loaded in memory, all theme information
need to be present to set immutable as possible to put it in cache
(implies why the key cache contains now the visualThemeId).
2020-02-20 14:34:28 +01:00
Daniel Watford 52e21a3d2e Improved: Use FlexibleStringExpander for field parameter names.
(OFBIZ-11330)

Allows generation of unique names when repeating rendering of a form on a screen.
Added test cases to ensure parameter names can be built using FlexibleStringExpander.
2020-01-29 14:05:37 +01:00
Mathieu Lirzin 7508917a0a Improved: Remove ‘RequestHandler#ControllerConfig’ wrapper
(OFBIZ-11313)

‘RequestHandler#ControllerConfig’ was a wrapper around
‘ConfigXMLReader#ControllerConfig’ used as a convenience to gather
error handling when accessing configuration properties. Since the
later is now only throwing exceptions when instantiating the object,
‘RequestHandler#ControllerConfig’ is not useful anymore.
2019-12-30 09:54:24 +01:00
Mathieu Lirzin 4d4a1ba1cd Improved: Lint ‘FreeMarkerWorker’ class
(OFBIZ-11161)
2019-12-07 23:16:45 +01:00
Samuel Trégouët 98bfafd148 Improved: Resolve classpath conflict on freemarkerTransforms.properties
(OFBIZ-11161)

All files in {compoment}/config directories are placed in jar
root (cf. sourceSets definition in build.gradle) but there are 4 different
`freemarkerTransforms.properties` in ofbiz (content, product, webapp, widget).
This works fine because we are adding config directories in classpath (through
classpath tag in ofbiz-component.xml), but this is not really intuitive. So to
make things clearer this patch move `freemarkerTransforms.properties` into
`src/main/resources` with a namespace package and `FreeMarkerWorker.java` is
modified accordingly.
2019-12-07 23:13:10 +01:00
Nicolas Malin 071a74238b Fixed: Fix missing else during previous refactoring
(OFBIZ-11253)
When you rendering for with auto-field-entity on edit mode, indicator field has been override by text field.
Fix also two error on source field type set to FieldInfo.SOURCE_AUTO_SERVICE instead of FieldInfo.SOURCE_AUTO_ENTITY

Thanks to Olivier Heintz to inform on the regression.
2019-12-06 21:29:32 +01:00
Nicolas Malin 2c58133e50 Improved: Improve webtools/control/FindGeneric
(OFBIZ-11253)
Update the script to generate xml form to introduce new following features :

   * set equals as operator by default on pk instead of contains, when you use a pk on FindGeneric it's in general to resolve it on completed key.
   * add on tooltip the raw field name
   * add possibility to filter on internal field
   * add sort on column

During this work I also view that the ModelFormField contains an 'IF forest' to analyze each field. I rewrote it to consolidate the analyze by type.
2019-11-10 20:14:34 +01:00
Nicolas Malin 39f5dda302 Implemented: Add transaction timeout default properties for screen widget
(OFBIZ-11190)

Currently when you rendering a screen, the transaction timeout would be resolve from the context or use default value (60s)
I reviewed this code part to reorganize timeout resolution on dedicate function (transaction timeout on widget screen is pre-apache)
and introduce possibility to set a default value by properties on 'widget.property' with name 'widget.screen.transaction.defaultTimeout'.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867620 13f79535-47bb-0310-9956-ffa450edef68
2019-09-27 07:21:30 +00:00
Nicolas Malin 2132b9e60c Fixed: Default option for ModelFormField.DateFindField doesn't work
(OFBIZ-11212)
When you use a date-find element on form, the defaut option are in code like to greater_than and less _than

        public DateFindField(int fieldSource, String type) {
            super(fieldSource, type);
            this.defaultOptionFrom = greaterThanEqualTo;
            this.defaultOptionThru = lessThanEqualTo;
        }

but on macro

<#macro renderDateFindField ...
      <option value=greaterThan<#if defaultOptionFrom==greaterThan> selected=selected</#if>></option><#rt/>
      ...
      <option value=opLessThan<#if defaultOptionThru==opLessThan> selected=selected</#if>></option><#rt/>
      ...
</#macro>

So the value java isn't correct with ftl values and default value never used.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867582 13f79535-47bb-0310-9956-ffa450edef68
2019-09-26 15:29:11 +00:00
Mathieu Lirzin d8e9261857 Improved: Remove unused imports
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865845 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 12:57:20 +00:00
Nicolas Malin 4a511be1cc Implemented: Homogenize displaying number with multiple format
(OFBIZ-7532)

To display a number we had different possibilities :
 * on ftl use the template <@ofbizAmount and <@ofbizCurrency
 * by java call a function UtilFormatOut.formatAmount, UtilFormatOut.formatPrice, UtilFormatOut.formatQuantity, etc..
 * by form widget, use <display type=accounting-number for accounting but nothing for other

To simplify and homogenize all, I implemented a number type purpose :
   * default: display a number by default, use when no purpose is present
   * quantity: display a number as a quantity
   * amount: display a number as an amount (like price without currency)
   * spelled: litteral displaying for a number (use on <@ofbizAmount ftl only before)
   * percentage: display a number as a percentage
   * accounting: diplay a number for accounting specific

Each purpose can be associate to a number for displaying it :
   * on ftl <@ofbizNumber number=value format=purpose/>
   * on java UtilFormatOut.formatNumber(value, purpose, delegator, locale)
   * on form widget <display type=number format=purpose/>

The format use by a purpose is define on framework/common/config/number.properties with the template
    .displaying.format = ##0.00

With this, you can surchage a configuration, create your own purpose or surchage only one through entity SystemProperty.

Concerning the backware compatibility: 
 * For the ftl the template <@ofbizAmount is now a link to '<@ofbizNumber format=amount'
 * For java all previous function call UtilFormatOut.formatNumber with the matching purpose
 * For form xml accounting-number is managed as an exection

Last point, display a currency is different that a number, so I didn't refactoring some code for this case (only move properties from general to number for centralize de configuration on the same file)

Thanks Charles Steltzlen to start the refactoring

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864832 13f79535-47bb-0310-9956-ffa450edef68
2019-08-09 20:37:11 +00:00
Mathieu Lirzin 54f210a866 Improved: Inline ‘UtilGenerics#checkCollection(Object)’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863502 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:36:12 +00:00
Mathieu Lirzin e9a56a78e5 Improved: Inline ‘UtilGenerics#checkList’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863501 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:35:13 +00:00
Mathieu Lirzin 83fd20607b Improved: Inline ‘UtilGenerics#checkMap’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863500 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:32:34 +00:00