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/specialpurpose@1296782 13f79535-47bb-0310-9956-ffa450edef68
124 lines
6.7 KiB
XML
124 lines
6.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
|
|
|
|
<screen name="main-decorator">
|
|
<section>
|
|
<actions>
|
|
<property-map resource="GoogleBaseUiLabels" map-name="uiLabelMap" global="true"/>
|
|
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
|
|
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
|
|
<property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
|
|
<set field="activeApp" value="googlebase" global="true"/>
|
|
|
|
<set field="layoutSettings.companyName" from-field="uiLabelMap.GoogleBaseCompanyName" global="true"/>
|
|
<set field="layoutSettings.companySubtitle" from-field="uiLabelMap.GoogleBaseApplication" global="true"/>
|
|
<set field="applicationMenuName" value="GoogleBaseAppBar" global="true"/>
|
|
<set field="applicationMenuLocation" value="component://googlebase/widget/GoogleBaseMenus.xml" global="true"/>
|
|
<set field="applicationTitle" value="${uiLabelMap.GoogleBaseApplication}" global="true"/>
|
|
</actions>
|
|
<widgets>
|
|
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
|
|
</widgets>
|
|
</section>
|
|
</screen>
|
|
|
|
<screen name="CommonFindDecorator">
|
|
<section>
|
|
<actions>
|
|
<set field="headerItem" value="googlebase"/>
|
|
</actions>
|
|
<widgets>
|
|
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
|
<decorator-section name="body">
|
|
<section>
|
|
<condition>
|
|
<if-has-permission permission="GOOGLEBASE" action="_VIEW"/>
|
|
</condition>
|
|
<widgets>
|
|
<decorator-section-include name="body"/>
|
|
</widgets>
|
|
<fail-widgets>
|
|
<label style="h3">${uiLabelMap.GoogleBaseViewPermissionError}</label>
|
|
</fail-widgets>
|
|
</section>
|
|
</decorator-section>
|
|
</decorator-screen>
|
|
</widgets>
|
|
</section>
|
|
</screen>
|
|
|
|
<screen name="CommonProductDecorator">
|
|
<section>
|
|
<actions>
|
|
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
|
|
|
|
<set field="productId" from-field="parameters.productId"/>
|
|
<entity-one entity-name="Product" value-field="product"/>
|
|
<set field="productName" from-field="product.productName"/>
|
|
</actions>
|
|
<widgets>
|
|
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
|
<decorator-section name="body">
|
|
<section>
|
|
<!-- do check for GOOGLEBASE, _VIEW permission -->
|
|
<condition>
|
|
<if-has-permission permission="GOOGLEBASE" action="_VIEW"/>
|
|
</condition>
|
|
<widgets>
|
|
<section>
|
|
<condition><not><if-empty field="product"/></not></condition>
|
|
<widgets>
|
|
<include-menu name="ProductTabBar" location="component://product/widget/catalog/CatalogMenus.xml"/>
|
|
<container>
|
|
<label style="h1">${uiLabelMap.${labelTitleProperty}} ${uiLabelMap.CommonFor}: ${product.internalName} [${uiLabelMap.CommonId}:${productId}] ${${extraFunctionName}}</label>
|
|
<image src="${product.smallImageUrl}" url-mode="content" style="cssImgSmall"/>
|
|
</container>
|
|
|
|
<!-- add Create Product and View Product (in ecommerce) links -->
|
|
<container style="button-bar">
|
|
<link target="EditProduct" text="${uiLabelMap.ProductNewProduct}" style="buttontext"/>
|
|
<link target="CreateVirtualWithVariantsForm" text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/>
|
|
<link target="/ecommerce/control/product" url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" style="buttontext">
|
|
<parameter param-name="product_id" from-field="productId"/>
|
|
</link>
|
|
<link target="ProductBarCode.pdf" target-window="_blank" text="${uiLabelMap.ProductBarcode}" style="buttontext">
|
|
<parameter param-name="productId"/>
|
|
<parameter param-name="productName"/>
|
|
</link>
|
|
</container>
|
|
</widgets>
|
|
</section>
|
|
|
|
<decorator-section-include name="body"/>
|
|
</widgets>
|
|
<fail-widgets>
|
|
<label style="h3">${uiLabelMap.ProductCatalogViewPermissionError}</label>
|
|
</fail-widgets>
|
|
</section>
|
|
</decorator-section>
|
|
</decorator-screen>
|
|
</widgets>
|
|
</section>
|
|
</screen>
|
|
</screens>
|