The problem is that on multi forms the bshInterpreter gets pushed to higher levels on the context stack when iterating the form rows.
What is intended in the code is to reset the bshInterpreter (this.resetBshInterpreter(context) for each row iteration, this reset translates into a key object being removed from context, this context is stored in a stack data structure. The removal assumes the value will always be at level 0, yet what happens is that the value resides at a higher level.
The fix is to perform the removal prior to context modification, this way the bshInterpereter object would be at level 0 upon removal.
jleroux: since the BshInterpreter is reseted just after with localContext this should not have any bad side effects
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1358735 13f79535-47bb-0310-9956-ffa450edef68
be used. What was occuring previously, was that any use of "null" would
actually end up using GenericEntity.NullField, which has a string value
of "[null-field]".
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1341094 13f79535-47bb-0310-9956-ffa450edef68
When specifying the ignore-if-empty attribute inside an entity-constraint in an entity-options a NPE will be thrown whenever the env-name of this entity-constraint is empty.
The error occurs because a null condition is created for the entity-constraint.
When validateSql get called in
org.ofbiz.entity.condition.EntityJoinOperator.validateSql(EntityJoinOperator.java:178)
there is no null checking so when
condition.checkCondition(modelEntity);
gets called an NPE is thrown.
The patch modifies the code in
framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
to avoid the inclusion of a null condition to the entity-options.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1340826 13f79535-47bb-0310-9956-ffa450edef68
"As of creating new BeansWrapper, be sure you create it only once during the application life-cycle and then reuse the same instance, or else it will have to rebuild the class introspection cache again and again."
Thanks to Adam Heath for the comment.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1340631 13f79535-47bb-0310-9956-ffa450edef68
"Since BeansWrapper.getDefaultInstance() returns an instance that is
shared in the scope of the class-loader that defined the FreeMarker
classes, and since possibly multiple independently developed
components in your system use FreeMarker and thus getDefaultInstance
(and you may don't even know about it), and since the returned
BeanWrapper can be configured (not read-only), you never know how the
returned BeanWrapper is configured. So you add a 3rd party component,
and if you are unlucky, suddenly your other component is broken.
As of creating new BeansWrapper, be sure you create it only once
during the application life-cycle and then reuse the same instance, or
else it will have to rebuild the class introspection cache again and
again."
I have replaced the usage of the static instance of the BeansWrapper with a newly created object.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1339504 13f79535-47bb-0310-9956-ffa450edef68
If sorting is enabled for at least one field in the list type form-widget, we get an error, here is the details:
Error executing macro: renderFieldTitle
required parameter: id is not specified.
The problematic instruction:
----------
==> macro renderFieldTitle [on line 53, column 1 in component://widget/templates/csvFormMacroLibrary.ftl]
in user-directive renderFieldTitle [on line 116, column 57 in component://widget/templates/csvFormMacroLibrary.ftl]
in user-directive renderSortField [on line 1, column 1 in Fri May 11 12:33:29 IST 2012]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Error executing macro: renderFieldTitle
required parameter: id is not specified.
at freemarker.core.Macro$Context.sanityCheck(Macro.java:211)
Adding a default empty string to the id parameter fixes the issue
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338570 13f79535-47bb-0310-9956-ffa450edef68
This was due to MacroScreenRenderer.renderScreenletSubWidget() calling HtmlFormRenderer instead of MacroFormRenderer. So there was still a call to the old, now inexistent, call_cal js function.
So this not only fixes this case but also all other similar cases, when a navigation-form-name screenlet attribute was used and a date field used in the related form.
I have also checked there are no other uses of HtmlFormRenderer in MacroScreenRenderer. So I think w are safe from other side effects...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1331898 13f79535-47bb-0310-9956-ffa450edef68
At this time the alt-target element value is only parse on bsh interpreter. To resynchronise with the rest of framework, convert with a flexibleStringRenderer.
jleroux: re-adding after reverting r1311082
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1311109 13f79535-47bb-0310-9956-ffa450edef68
When you use sort-field, you reorder only the form begin or you need list all file if you want reordered the end form.
Example
<form>
<field name="a"/>
<field name="b"/>
<field name="c"/>
<field name="d"/>
</form>
If you want put c at the end :
<form>
<field name="a"/>
<field name="b"/>
<field name="c"/>
<field name="d"/>
<sort-order>
<sort-field name="a"/>
<sort-field name="b"/>
<sort-field name="d"/>
<sort-field name="c"/>
</sort-order>
</form>
with the patch
<form>
<field name="a"/>
<field name="b"/>
<field name="c"/>
<field name="d"/>
<sort-order>
<last-field name="c"/>
</sort-order>
</form>
It's really useful for inherited forms when you adding new fields, you just use last-field for instance for submit button.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1307784 13f79535-47bb-0310-9956-ffa450edef68
Summary: The purpose of this patch is to address the following:
1. Provide a standardized set of image width and height specs for page layout in ofbiz. This gives ofbiz a uniform look throughout as it applies to image display.
2. Preserve the aspect ratio of the image when using these standardized image sizes.
3. One place to make styling modifications (eg. css file).
4. Decouple styling from code (eg. java,ftl,xml,html,jsp,etc).
Regarding including the real image size, the width/height attributes in <img> specifies the boundary of the image when shown on the page. If you need to specify the real size of the image, the server code would have to perform the determination. Afterwards, you can include the actual dimensions of the image in the title attribute of <img>
Details:
Manually specifying the image width and height does help with preserving the layout of a page regardless of the image size to be shown. The challenge with this method is that the image shown on the page in question may be distorted if the aspect ratio of the image differed from that of the width and height attributes of <img>. This basically forces the person uploading the image to be more vigilant about image aspect ratios.
The purpose is to harmonize on the display size of images with a standardized set of width/height constraints in which an image must fit and preserve the aspect ratio of images.
Currently the source files (eg. ftl, xml) either manually specifies the width or height of a displayed image (ie widget <image> and html <img> tag). The problem with specifying only one constraint is that an image can affect the layout of the page if the user uploads an image where the aspect ratio could be large.
Some ftl and xml files specify both the width and the height. The problem with this is that if the aspect ratio of the image in question does not match that of the width and height of the <img> tag, the image would be displayed distorted.
The solution was to create a standardized set of CSS styles that both configure the displayed image size and preserve the image aspect ratio (eg. thumbnail size, medium size and large size). Of course, the developers can further define or modify the styles to suit their need.
By using CSS, one can change the size of displayed images without having to tamper with the ftl and/or xml files. This helps to reduce potential bugs that come with modifying the ftl and xml files. The existing way of doing things is to go through each ftl or xml file in question and manually modify the width and/or height of the <image> and/or <img> tag.
The question about the "border" around images. If you do not wish to have a border around the image, just remove it from the CSS style. It's that easy No need to change anything else. Ie. configuration to the image is done on the CSS style and not on the <image>, <img> tag.
NB: The current patch does not apply to all displayed images. I have only made appropriate modifications to widget <image> and html <img> tags that have either specified the width and/or height. There are numerous <image> and <img> tags spread all over the project that do not specify dimensions. I would have to modify them as I encountered them when I could see where and how they are displayed on the screen. Note that these images would not be affect by this patch.
jleroux: despite my efforts I was not able to check all screens. But I think it's ok
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296782 13f79535-47bb-0310-9956-ffa450edef68
In particular these chenges should make it easier to implement JSR-223 (even if I think that we should still treat Groovy in a special way).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296762 13f79535-47bb-0310-9956-ffa450edef68
In htmlFormMacrolLibrary.ftl, renderFormClose has containerId, hasRequiredField.
But csv, fo, text, xml FormMacroLibary.ftl don't have these fields for this macro.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1245778 13f79535-47bb-0310-9956-ffa450edef68
Description:
Getting errors on clicking "Export" tab. Steps to regenerate the issue.
1. Go to Facility component.
2. Go to inventory tab.
3. After that go to "Export" tab, there is an error:
Macro renderFormOpen has no such argument: viewSize
The problematic instruction:
----------
==> macro renderFormOpen [on line 64, column 1 in component://widget/templates/xmlFormMacroLibrary.ftl]
in user-directive renderFormOpen
For reference- please have a look on below given link-
https://demo-trunk.ofbiz.apache.org:8443/facility/control/ViewFacilityInventoryByProduct?facilityId=WebStoreWarehouse
I have done searching and found that there are parameters missing in some xmlFormMacroLibrary.ftl macros for both trunk and release branch 11.04.
Thanks Amardeep for the contribution!!!
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1229090 13f79535-47bb-0310-9956-ffa450edef68