Author: jleroux
Date: Fri Oct 24 15:26:46 2008 New Revision: 707768 URL: http://svn.apache.org/viewvc?rev=707768&view=rev Log: A patch from Bruno Busco "Collapsible field-group" (https://issues.apache.org/jira/browse/OFBIZ-1992) - OFBIZ-1992 I only added i18n (in renderFieldGroupOpen) and l10n (all in CommonUiLabels.xml) and made some changes in grouping Modified: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml ofbiz/trunk/framework/common/config/CommonUiLabels.xml ofbiz/trunk/framework/images/webapp/images/maincss.css ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Modified: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml?rev=707768&r1=707767&r2=707768&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml (original) +++ ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml Fri Oct 24 15:26:46 2008 @@ -279,6 +279,109 @@ <drop-down allow-empty="true"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down> </field> <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> + + <sort-order> + <field-group> + <sort-field name="productStoreId"/> + <sort-field name="primaryStoreGroupId"/> + <sort-field name="storeName"/> + <sort-field name="title"/> + <sort-field name="subtitle"/> + <sort-field name="companyName"/> + <sort-field name="isDemoStore"/> + </field-group> + <field-group title="${uiLabelMap.CommonInventory}" collapsible="true"> + <sort-field name="inventoryFacilityId"/> + <sort-field name="oneInventoryFacility"/> + <sort-field name="isImmediatelyFulfilled"/> + <sort-field name="checkInventory"/> + <sort-field name="reserveInventory"/> + <sort-field name="requireInventory"/> + </field-group> + <field-group title="${uiLabelMap.CommonShoppingCart}" collapsible="true" initially-collapsed="true"> + <sort-field name="viewCartOnAdd"/> + <sort-field name="autoSaveCart"/> + <sort-field name="addToCartReplaceUpsell"/> + <sort-field name="addToCartRemoveIncompat"/> + <sort-field name="showCheckoutGiftOptions"/> + <sort-field name="prodSearchExcludeVariants"/> + </field-group> + <field-group title="${uiLabelMap.CommonShipping}" collapsible="true" initially-collapsed="true"> + <sort-field name="prorateShipping"/> + <sort-field name="reqShipAddrForDigItems"/> + <sort-field name="selectPaymentTypePerItem"/> + <sort-field name="shipIfCaptureFails"/> + <sort-field name="splitPayPrefPerShpGrp"/> + </field-group> + <field-group title="${uiLabelMap.CommonPayments}" collapsible="true" initially-collapsed="true"> + <sort-field name="payToPartyId"/> + <sort-field name="manualAuthIsCapture"/> + <sort-field name="retryFailedAuths"/> + <sort-field name="daysToCancelNonPay"/> + <sort-field name="autoOrderCcTryExp"/> + <sort-field name="autoOrderCcTryOtherCards"/> + <sort-field name="autoOrderCcTryLaterNsf"/> + <sort-field name="autoOrderCcTryLaterMax"/> + <sort-field name="storeCreditValidDays"/> + <sort-field name="setOwnerUponIssuance"/> + </field-group> + <field-group title="${uiLabelMap.CommonOrders}" collapsible="true" initially-collapsed="true"> + <sort-field name="reserveOrderEnumId"/> + <sort-field name="balanceResOnOrderCreation"/> + <sort-field name="orderNumberPrefix"/> + <sort-field name="defaultSalesChannelEnumId"/> + <sort-field name="explodeOrderItems"/> + <sort-field name="checkGcBalance"/> + <sort-field name="autoInvoiceDigitalItems"/> + <sort-field name="autoApproveInvoice"/> + <sort-field name="autoApproveOrder"/> + <sort-field name="reqReturnInventoryReceive"/> + </field-group> + <field-group title="${uiLabelMap.CommonLocalisation}" collapsible="true" initially-collapsed="true"> + <sort-field name="defaultLocaleString"/> + <sort-field name="defaultCurrencyUomId"/> + </field-group> + <field-group title="${uiLabelMap.CommonOrdersStatus}" collapsible="true" initially-collapsed="true"> + <sort-field name="headerApprovedStatus"/> + <sort-field name="itemApprovedStatus"/> + <sort-field name="digitalItemApprovedStatus"/> + <sort-field name="headerDeclinedStatus"/> + <sort-field name="itemDeclinedStatus"/> + <sort-field name="headerCancelStatus"/> + <sort-field name="itemCancelStatus"/> + </field-group> + <field-group title="${uiLabelMap.CommonMessages}" collapsible="true" initially-collapsed="true"> + <sort-field name="authDeclinedMessage"/> + <sort-field name="authFraudMessage"/> + <sort-field name="authErrorMessage"/> + </field-group> + <field-group title="${uiLabelMap.CommonTax}" collapsible="true" initially-collapsed="true"> + <sort-field name="prorateTaxes"/> + <sort-field name="showPricesWithVatTax"/> + <sort-field name="showTaxIsExempt"/> + <sort-field name="vatTaxAuthGeoId"/> + <sort-field name="vatTaxAuthPartyId"/> + </field-group> + <field-group title="${uiLabelMap.CommonVisitors}" collapsible="true" initially-collapsed="true"> + <sort-field name="autoApproveReviews"/> + <sort-field name="allowPassword"/> + <sort-field name="defaultPassword"/> + <sort-field name="usePrimaryEmailUsername"/> + <sort-field name="requireCustomerRole"/> + <sort-field name="enableAutoSuggestionList"/> + </field-group> + <field-group title="${uiLabelMap.CommonVisualTheme}" collapsible="true" initially-collapsed="true"> + <sort-field name="styleSheet"/> + <sort-field name="headerLogo"/> + <sort-field name="headerMiddleBackground"/> + <sort-field name="headerRightBackground"/> + </field-group> + <field-group title="${uiLabelMap.CommonUpload}" collapsible="true" initially-collapsed="true"> + <sort-field name="enableDigProdUpload"/> + <sort-field name="digProdUploadCategoryId"/> + </field-group> + + </sort-order> </form> <form name="ListProductStoreFinAccountSettings" type="list" target="UpdateProductStoreFinAccountSettings" list-name="productStoreFinActSettings" Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=707768&r1=707767&r2=707768&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Fri Oct 24 15:26:46 2008 @@ -2945,6 +2945,10 @@ <value xml:lang="zh_CN">å¼å ¥æ¥æ</value> <value xml:lang="zh">ä»ç»æ¥æ</value> </property> + <property key="CommonInventory"> + <value xml:lang="en">Inventory</value> + <value xml:lang="fr">Stockage</value> + </property> <property key="CommonIsA"> <value xml:lang="ar">ÙÙ</value> <value xml:lang="de">ist ein</value> @@ -3157,6 +3161,10 @@ <value xml:lang="zh_CN">ææå表</value> <value xml:lang="zh">å ¨é¨å表</value> </property> + <property key="CommonLocalisation"> + <value xml:lang="en">Localisation</value> + <value xml:lang="fr">Options régionales et linguistiques</value> + </property> <property key="CommonLogin"> <value xml:lang="ar">دخÙÙ</value> <value xml:lang="cs">PÅihlásit</value> @@ -3394,6 +3402,10 @@ <value xml:lang="zh_CN">æ¶æ¯</value> <value xml:lang="zh">ä¿¡æ¯</value> </property> + <property key="CommonMessages"> + <value xml:lang="en">Messages</value> + <value xml:lang="fr">Messages</value> + </property> <property key="CommonMethod"> <value xml:lang="ar">طرÙÙØ©</value> <value xml:lang="de">Methode</value> @@ -4141,6 +4153,10 @@ <value xml:lang="zh_CN">订å</value> <value xml:lang="zh">订å</value> </property> + <property key="CommonOrdersStatus"> + <value xml:lang="en">Orders Status</value> + <value xml:lang="fr">Statuts des commandes</value> + </property> <property key="CommonOther"> <value xml:lang="ar">أخرÙ</value> <value xml:lang="de">Andere</value> @@ -4252,6 +4268,10 @@ <value xml:lang="fr">SVP, changer cotre mot de passe</value> <value xml:lang="th">à¸à¸£à¸¸à¸à¸²à¹à¸à¸¥à¸µà¹à¸¢à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¸à¸à¸à¸à¸¸à¸</value> </property> + <property key="CommonPayments"> + <value xml:lang="en">Payments</value> + <value xml:lang="fr">Paiements</value> + </property> <property key="CommonPdf"> <value xml:lang="en">Pdf</value> </property> @@ -5426,6 +5446,14 @@ <value xml:lang="zh_CN">æ¾ç¤ºæ¥æ¾å段</value> <value xml:lang="zh">æ¾ç¤ºæ¥è¯¢é¡¹</value> </property> + <property key="CommonShipping"> + <value xml:lang="en">Shipping</value> + <value xml:lang="fr">Expédition</value> + </property> + <property key="CommonShoppingCart"> + <value xml:lang="en">ShoppingCart</value> + <value xml:lang="fr">Panier</value> + </property> <property key="CommonSince"> <value xml:lang="ar">Ù ÙØ°</value> <value xml:lang="de">Seit</value> @@ -5625,7 +5653,7 @@ </property> <property key="CommonStatustoComplete"> <value xml:lang="en">Status to 'complete'</value> - <value xml:lang="fr">Mettre statut à terminé</value> + <value xml:lang="fr">Mettre le statut à terminé</value> <value xml:lang="it">Stato a 'completo'</value> <value xml:lang="th">สà¸à¸²à¸à¸°à¹à¸à¹à¸ 'à¹à¸ªà¸£à¹à¸à¸ªà¸¡à¸à¸¹à¸£à¸à¹'</value> <value xml:lang="zh">ç½®ç¶æ为å®æ</value> @@ -5771,6 +5799,10 @@ <value xml:lang="zh_CN">符å</value> <value xml:lang="zh">è®°å½</value> </property> + <property key="CommonTax"> + <value xml:lang="en">Tax</value> + <value xml:lang="fr">Taxes (TVA)</value> + </property> <property key="CommonTelephoneAbbr"> <value xml:lang="ar">ÙاتÙ</value> <value xml:lang="de">Tel</value> @@ -6301,7 +6333,7 @@ <value xml:lang="de">Hinaufladen</value> <value xml:lang="en">Upload</value> <value xml:lang="es">Cargar</value> - <value xml:lang="fr">Télécharger vers le serveur</value> + <value xml:lang="fr">Téléchargement vers le serveur</value> <value xml:lang="it">Carica</value> <value xml:lang="nl">Upload</value> <value xml:lang="pt">Upload</value> @@ -6504,6 +6536,14 @@ <value xml:lang="th">à¹à¸ªà¸à¸à¸à¸³à¸£à¹à¸à¸</value> <value xml:lang="zh_CN">æ¥ç请æ±</value> <value xml:lang="zh">æµè§è¯·æ±</value> + </property> + <property key="CommonVisitors"> + <value xml:lang="en">Visitors</value> + <value xml:lang="fr">Visiteurs</value> + </property> + <property key="CommonVisualTheme"> + <value xml:lang="en">Visual Theme</value> + <value xml:lang="fr">Charte graphique</value> </property> <property key="CommonVolume"> <value xml:lang="ar">اÙجØÙ </value> @@ -7579,7 +7619,7 @@ </property> <property key="VisualThemes"> <value xml:lang="en">Visual Themes</value> - <value xml:lang="fr">Charte graphique</value> + <value xml:lang="fr">Charte graphiques</value> <value xml:lang="it">Tema grafico</value> </property> <property key="VisualThemeNoScreenshots"> Modified: ofbiz/trunk/framework/images/webapp/images/maincss.css URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/maincss.css?rev=707768&r1=707767&r2=707768&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/maincss.css (original) +++ ofbiz/trunk/framework/images/webapp/images/maincss.css Fri Oct 24 15:26:46 2008 @@ -1964,3 +1964,33 @@ .fieldWithErrors .calendar_date_select { border: 2px solid #FF0000; } + +/* ============================= */ +/* ===== FieldGroup Styles ===== */ +/* ============================= */ + +.fieldgroup-title-bar { +border-top: 0.1em solid #DADADA; +font-size: 1em; +font-weight: bold; +padding: 0.1em 0.5em 0.2em 0.5em; +} + +.fieldgroup-title-bar ul .collapsed, +.fieldgroup-title-bar ul .collapsed:hover { +background: url(/images/expand.gif) no-repeat center center; +min-height: 1.1em; +min-width: 1.1em; +} + +.fieldgroup-title-bar ul .expanded, +.fieldgroup-title-bar ul .expanded:hover { +background: url(/images/collapse.gif) no-repeat center center; +min-height: 1.1em; +min-width: 1.1em; +} + +.fieldgroup-title-bar td.collapse { +width: 1.1em; +cursor: default; +} Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=707768&r1=707767&r2=707768&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Fri Oct 24 15:26:46 2008 @@ -904,10 +904,6 @@ Object obj = iter.next(); if (obj instanceof ModelForm.Banner) { ((ModelForm.Banner) obj).renderString(writer, context, formStringRenderer); - } else { - // no need to open and close an empty table, so skip that call - formStringRenderer.renderFieldGroupOpen(writer, context, (FieldGroup) obj); - formStringRenderer.renderFieldGroupClose(writer, context, (FieldGroup) obj); } } if (currentFieldGroup != null && (lastFieldGroup == null || !lastFieldGroupName.equals(currentFieldGroupName))) { @@ -952,10 +948,6 @@ Object obj = iter.next(); if (obj instanceof ModelForm.Banner) { ((ModelForm.Banner) obj).renderString(writer, context, formStringRenderer); - } else { - // no need to open and close an empty table, so skip that call - formStringRenderer.renderFieldGroupOpen(writer, context, (FieldGroup) obj); - formStringRenderer.renderFieldGroupClose(writer, context, (FieldGroup) obj); } } } @@ -2753,6 +2745,9 @@ public static class FieldGroup implements FieldGroupBase { public String id; public String style; + public String title; + public boolean collapsible = false; + public boolean initiallyCollapsed = false; protected ModelForm modelForm; protected static int baseSeqNo = 0; protected static String baseId = "_G"; @@ -2766,6 +2761,13 @@ this.setId(lastGroupId); } this.style = sortOrderElement.getAttribute("style"); + this.title = sortOrderElement.getAttribute("title"); + this.collapsible = "true".equals(sortOrderElement.getAttribute("collapsible")); + this.initiallyCollapsed = "true".equals(sortOrderElement.getAttribute("initially-collapsed")); + if (this.initiallyCollapsed) { + this.collapsible = true; + } + List sortFieldElements = UtilXml.childElementList(sortOrderElement, "sort-field"); Iterator sortFieldElementIter = sortFieldElements.iterator(); while (sortFieldElementIter.hasNext()) { @@ -2791,6 +2793,18 @@ return this.style; } + public String getTitle() { + return this.title; + } + + public Boolean collapsible() { + return this.collapsible; + } + + public Boolean initiallyCollapsed() { + return this.initiallyCollapsed; + } + public void renderStartString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { formStringRenderer.renderFieldGroupOpen(writer, context, this); formStringRenderer.renderFormatSingleWrapperOpen(writer, context, modelForm); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=707768&r1=707767&r2=707768&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Fri Oct 24 15:26:46 2008 @@ -2651,28 +2651,76 @@ } public void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException { - String style = fieldGroup.getStyle(); - String id = fieldGroup.getId(); - if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id)) { - writer.append("<div"); + String style = fieldGroup.getStyle(); + String id = fieldGroup.getId(); + FlexibleStringExpander titleNotExpanded = FlexibleStringExpander.getInstance(fieldGroup.getTitle()); + String title = titleNotExpanded.expandString(context); + Boolean collapsed = fieldGroup.initiallyCollapsed(); + String collapsibleAreaId = fieldGroup.getId() + "_body"; + + if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) || UtilValidate.isNotEmpty(title)) { + + writer.append("<div class=\"fieldgroup"); if (UtilValidate.isNotEmpty(style)) { - writer.append(" class=\""); + writer.append(" "); writer.append(style); - writer.append("\""); } + writer.append("\""); if (UtilValidate.isNotEmpty(id)) { writer.append(" id=\""); writer.append(id); writer.append("\""); } writer.append(">"); + + writer.append("<div class=\"fieldgroup-title-bar\"><table><tr><td class=\"collapse\">"); + + if (fieldGroup.collapsible()) { + String expandToolTip = null; + String collapseToolTip = null; + Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); + Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); + if (uiLabelMap != null) { + expandToolTip = (String) uiLabelMap.get("CommonExpand"); + collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); + } + + writer.append("<ul><li class=\""); + if (collapsed) { + writer.append("collapsed\"><a "); + writer.append("onclick=\"javascript:toggleCollapsiblePanel(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); + } else { + writer.append("expanded\"><a "); + writer.append("onclick=\"javascript:toggleCollapsiblePanel(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); + } + writer.append(">   </a></li></ul>"); + + appendWhitespace(writer); + } + writer.append("</td><td>"); + + if (UtilValidate.isNotEmpty(title)) { + writer.append("<div class=\"title\">"); + writer.append(title); + writer.append("</div>"); + } + + writer.append("</td></tr></table></div>"); + + writer.append("<div id=\"" + collapsibleAreaId + "\" class=\"fieldgroup-body\""); + if (fieldGroup.collapsible() && collapsed) { + writer.append(" style=\"display: none;\""); + } + writer.append(">"); } } public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException { - String style = fieldGroup.getStyle(); - String id = fieldGroup.getId(); - if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id)) { + String style = fieldGroup.getStyle(); + String id = fieldGroup.getId(); + String title = fieldGroup.getTitle(); + if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) || UtilValidate.isNotEmpty(title)) { + writer.append("</div>"); writer.append("</div>"); } } |
Free forum by Nabble | Edit this page |