svn commit: r1381093 - in /ofbiz/trunk/applications/product: config/ data/ entitydef/ script/org/ofbiz/product/store/ servicedef/ src/org/ofbiz/product/store/ webapp/catalog/WEB-INF/ webapp/catalog/store/ widget/catalog/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1381093 - in /ofbiz/trunk/applications/product: config/ data/ entitydef/ script/org/ofbiz/product/store/ servicedef/ src/org/ofbiz/product/store/ webapp/catalog/WEB-INF/ webapp/catalog/store/ widget/catalog/

erwan
Author: erwan
Date: Wed Sep  5 09:19:53 2012
New Revision: 1381093

URL: http://svn.apache.org/viewvc?rev=1381093&view=rev
Log:
A patch from Nicolas Malin - OFBIZ-5021 - Add screen to manage productStoreGroup Hierarchy

Added:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java   (with props)
    ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl   (with props)
Modified:
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/applications/product/data/ProductDemoData.xml
    ofbiz/trunk/applications/product/entitydef/entitymodel_view.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
    ofbiz/trunk/applications/product/servicedef/secas.xml
    ofbiz/trunk/applications/product/servicedef/services_store.xml
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml
    ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml
    ofbiz/trunk/applications/product/widget/catalog/StoreForms.xml
    ofbiz/trunk/applications/product/widget/catalog/StoreScreens.xml

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Wed Sep  5 09:19:53 2012
@@ -4975,6 +4975,41 @@
         <value xml:lang="zh">产品店铺组标识</value>
         <value xml:lang="zh_TW">產品商店群組ID</value>
     </property>
+    <property key="FormFieldTitle_productStoreGroupName">
+        <value xml:lang="ar">إسم</value>
+        <value xml:lang="de">Name</value>
+        <value xml:lang="en">Name</value>
+        <value xml:lang="es">Nombre</value>
+        <value xml:lang="fr">Nom</value>
+        <value xml:lang="hi_IN">नाम</value>
+        <value xml:lang="it">Nome</value>
+        <value xml:lang="nl">Naam</value>
+        <value xml:lang="pt">Nome</value>
+        <value xml:lang="ro">Nume</value>
+        <value xml:lang="ru">Имя</value>
+        <value xml:lang="th">ชื่อ</value>
+        <value xml:lang="zh">名称</value>
+        <value xml:lang="zh_CN">名称</value>
+        <value xml:lang="zh_TW">名稱</value>
+    </property>
+    <property key="FormFieldTitle_productStoreGroupTypeId">
+        <value xml:lang="ar">النوع</value>
+        <value xml:lang="de">Typ</value>
+        <value xml:lang="en">Type</value>
+        <value xml:lang="es">Tipo</value>
+        <value xml:lang="fr">Type</value>
+        <value xml:lang="hi_IN">प्रकार</value>
+        <value xml:lang="it">Tipo</value>
+        <value xml:lang="nl">Soort</value>
+        <value xml:lang="pt">Tipo</value>
+        <value xml:lang="ro">Tip</value>
+        <value xml:lang="ru">Тип</value>
+        <value xml:lang="th">ประเภท</value>
+        <value xml:lang="vi">Chá»§ng loại</value>
+        <value xml:lang="zh">类型</value>
+        <value xml:lang="zh_CN">类型</value>
+        <value xml:lang="zh_TW">類型</value>
+    </property>
     <property key="FormFieldTitle_productStoreId">
         <value xml:lang="ar">تعريف المتجر</value>
         <value xml:lang="de">Produkt Laden ID</value>
@@ -10243,6 +10278,10 @@
         <value xml:lang="zh">添加到包装</value>
         <value xml:lang="zh_TW">添加到包裝</value>
     </property>
+    <property key="ProductAddToProductStoreGroup">
+        <value xml:lang="en">Add To Product Store Group</value>
+        <value xml:lang="fr">Ajout au groupe de centre de profit</value>
+    </property>
     <property key="ProductAddToShoppingList">
         <value xml:lang="de">Zu Einkaufsliste hinzufügen</value>
         <value xml:lang="en">Add to shopping list</value>
@@ -20211,6 +20250,14 @@
         <value xml:lang="zh">上级组 [标识]</value>
         <value xml:lang="zh_TW">上級組 [ID]</value>
     </property>
+    <property key="ProductParentProductStoreGroups">
+        <value xml:lang="en">Parent Product Store Groups</value>
+        <value xml:lang="fr">Groupes de centre de profit parent</value>
+    </property>
+    <property key="ProductParentProductStoreGroupList">
+        <value xml:lang="en">Parent Product Store Group List</value>
+        <value xml:lang="fr">Liste des groupes de centre de profit parent</value>
+    </property>
     <property key="ProductParentType">
         <value xml:lang="de">Übergeordneter Produkttyp</value>
         <value xml:lang="en">Product Parent Type</value>
@@ -21564,6 +21611,22 @@
         <value xml:lang="zh">产品店铺组标识</value>
         <value xml:lang="zh_TW">產品商店群組ID</value>
     </property>
+    <property key="ProductProductStoreGroupRollup">
+        <value xml:lang="en">Product Store Rollup</value>
+        <value xml:lang="fr">Groupes de centre de profit enfant</value>
+    </property>
+    <property key="ProductProductStoreGroups">
+        <value xml:lang="en">Product Store Groups</value>
+        <value xml:lang="fr">Groupes de centre de profit</value>
+    </property>
+    <property key="ProductProductStoreGroupMain">
+        <value xml:lang="en">Product Store main</value>
+        <value xml:lang="fr">Accueil groupes</value>
+    </property>
+    <property key="ProductProductStoreMember">
+        <value xml:lang="en">Product Store Member</value>
+        <value xml:lang="fr">Centres de profit associés</value>
+    </property>
     <property key="ProductProductStoreNotFound">
         <value xml:lang="en">No ProductStore found with id ${parameters.productStoreId}, not reserving inventory.</value>
         <value xml:lang="it">Nessun negozio trovato con id ${parameters.productStoreId}, nessun inventario verrà riservato.</value>

Modified: ofbiz/trunk/applications/product/data/ProductDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductDemoData.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductDemoData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductDemoData.xml Wed Sep  5 09:19:53 2012
@@ -43,4 +43,6 @@ under the License.
     <UserLoginSecurityGroup userLoginId="imageUpload" groupId="IMAGEUPLOAD" fromDate="2010-01-01 12:00:00.0"/>
     
     <PartyRole partyId="admin" roleTypeId="IMAGEAPPROVER"/>
+    <!-- Product store group management demo -->
+    <ProductStoreGroupType productStoreGroupTypeId="PSGT_AREA" description="Area cover"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel_view.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel_view.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel_view.xml Wed Sep  5 09:19:53 2012
@@ -80,4 +80,29 @@ under the License.
             <key-map field-name="productId"/>
         </view-link>
     </view-entity>
+
+    <view-entity entity-name="ProductStoreGroupAndMember" package-name="org.ofbiz.product.store" title="ProductStoreGroup And ProductStore View Entiry">
+        <member-entity entity-alias="PSG" entity-name="ProductStoreGroup"/>
+        <member-entity entity-alias="PSGM" entity-name="ProductStoreGroupMember"/>
+        <member-entity entity-alias="PS" entity-name="ProductStore"/>
+        <alias-all entity-alias="PSG"/>
+        <alias-all entity-alias="PSGM"/>
+        <alias-all entity-alias="PS"/>
+        <view-link entity-alias="PSG" rel-entity-alias="PSGM">
+            <key-map field-name="productStoreGroupId"/>
+        </view-link>
+        <view-link entity-alias="PSGM" rel-entity-alias="PS">
+            <key-map field-name="productStoreId"/>
+        </view-link>
+    </view-entity>
+
+    <view-entity entity-name="ProductStoreGroupRollupAndChild" package-name="org.ofbiz.product.store" title="ProductStoreGroupRollup And ProductStoreGroup View Entiry">
+        <member-entity entity-alias="PSGR" entity-name="ProductStoreGroupRollup"/>
+        <member-entity entity-alias="PSG" entity-name="ProductStoreGroup"/>
+        <alias-all entity-alias="PSG"/>
+        <alias-all entity-alias="PSGR"/>
+        <view-link entity-alias="PSG" rel-entity-alias="PSGR">
+            <key-map field-name="productStoreGroupId"/>
+        </view-link>
+    </view-entity>
 </entitymodel>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml Wed Sep  5 09:19:53 2012
@@ -771,5 +771,28 @@ under the License.
         <remove-value value-field="lookedUpValue"/>
     </simple-method>
 
+    <simple-method method-name="checkProductStoreGroupRollup" short-description="When product store group hierarchy has been operate, synchronize primaryParentGroupId with ProductStoreGroupRollup">
+        <entity-one value-field="productStoreGroup" entity-name="ProductStoreGroup"/>
+        <if-empty field="parameters.primaryParentGroupId">
+            <entity-one value-field="productStoreGroupRollup" entity-name="ProductStoreGroupRollup"/>
+            <if-not-empty field="productStoreGroupRollup">
+                <set field="productStoreGroup.primaryParentGroupId"/>
+                <set-service-fields service-name="updateProductStoreGroup" to-map="productStoreGroupMap" map="productStoreGroup"/>
+                <call-service service-name="updateProductStoreGroup" in-map-name="productStoreGroupMap"/>
+            </if-not-empty>
+            <else>
+                <entity-and list="productStoreGroupRollups" entity-name="ProductStoreGroupRollup" filter-by-date="true">
+                    <field-map field-name="productStoreGroupId" from-field="productStoreGroup.productStoreGroupId"/>
+                    <field-map field-name="parentGroupId" from-field="parameters.primaryParentGroupId"/>
+                </entity-and>
+                <if-empty field="productStoreGroupRollups">
+                    <set field="productStoreGroupRollupMap.productStoreGroupId" from="productStoreGroup.productStoreGroupId"/>
+                    <set field="productStoreGroupRollupMap.parentGroupId" from="parameters.primaryParentGroupId"/>
+                    <set field="productStoreGroupRollupMap.fromDate" from="date:nowTimestamp()"/>
+                    <call-service service-name="createProductStoreGroupRollup" in-map-name="productStoreGroupRollupMap"/>
+                </if-empty>
+            </else>
+        </if-empty>
+    </simple-method>
 </simple-methods>
 

Modified: ofbiz/trunk/applications/product/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/secas.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/secas.xml Wed Sep  5 09:19:53 2012
@@ -135,4 +135,12 @@ under the License.
         <action service="removeImageContentApproval" mode="sync"/>
     </eca>
 
+    <!-- ProductStoreGroup seca  -->
+    <eca service="updateProductStoreGroup" event="commit">
+        <condition field-name="primaryParentGroupId" operator="not-equals" value=""/>
+        <action service="checkProductStoreGroupRollup" mode="sync"/>
+    </eca>
+    <eca service="createProductStoreGroupRollup" event="commit">
+        <action service="checkProductStoreGroupRollup" mode="sync"/>
+    </eca>
 </service-eca>

Modified: ofbiz/trunk/applications/product/servicedef/services_store.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_store.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_store.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_store.xml Wed Sep  5 09:19:53 2012
@@ -306,4 +306,47 @@ under the License.
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
+    <!--ProductStoreGroup Services -->
+    <service name="createProductStoreGroup" default-entity-name="ProductStoreGroup" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a ProductStoreGroup</description>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="updateProductStoreGroup" default-entity-name="ProductStoreGroup" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a ProductStoreGroup</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="deleteProductStoreGroup" default-entity-name="ProductStoreGroup" engine="entity-auto" invoke="delete" auth="true">
+        <description>Delete a ProductStoreGroup</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+    <service name="createProductStoreGroupMember" default-entity-name="ProductStoreGroupMember" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a ProductStoreGroupMember</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="updateProductStoreGroupMember" default-entity-name="ProductStoreGroupMember" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a ProductStoreGroupMember</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="createProductStoreGroupRollup" default-entity-name="ProductStoreGroupRollup" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a ProductStoreGroupRollup</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="updateProductStoreGroupRollup" default-entity-name="ProductStoreGroupRollup" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a ProductStoreGroupRollup</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="checkProductStoreGroupRollup" engine="simple"
+            location="component://product/script/org/ofbiz/product/store/ProductStoreServices.xml" invoke="checkProductStoreGroupRollup" auth="true">
+        <description>Check if a productStoreGroupId with a primaryParentGroupId has related productStoreGroupRollup or for first ProductStoreGroupRollup on a ProductStoreGroup set relation on primaryParentGroupId</description>
+        <attribute name="productStoreGroupId" mode="IN" type="String"/>
+        <attribute name="primaryParentGroupId" mode="IN" type="String" optional="true"/>
+        <attribute name="parentGroupId" mode="IN" type="String" optional="true"/>
+        <attribute name="fromDate" mode="IN" type="String" optional="true"/>
+    </service>
 </services>

Added: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java?rev=1381093&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java (added)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java Wed Sep  5 09:19:53 2012
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.ofbiz.product.store;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+import net.sf.json.JSONObject;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityUtil;
+
+public class ProductStoreEvents {
+
+    public static final String module = ProductStoreWorker.class.getName();
+
+    // Please note : the structure of map in this function is according to the JSON data map of the jsTree
+    @SuppressWarnings("unchecked")
+    public static void getChildProductStoreGroupTree(HttpServletRequest request, HttpServletResponse response){
+        Delegator delegator = (Delegator) request.getAttribute("delegator");
+        String parentGroupId = request.getParameter("parentGroupId");
+        String onclickFunction = request.getParameter("onclickFunction");
+
+        List productStoreGroupList = FastList.newInstance();
+        List<GenericValue> children;
+        List<String> sortList = org.ofbiz.base.util.UtilMisc.toList("sequenceNum");
+
+        try {
+            GenericValue productStoreGroup = delegator.findOne("ProductStoreGroup" ,UtilMisc.toMap("productStoreGroupId", parentGroupId), true);
+            if (UtilValidate.isNotEmpty(productStoreGroup)) {
+                children = EntityUtil.filterByDate(delegator.findList("ProductStoreGroupRollupAndChild",
+                        EntityCondition.makeCondition("parentGroupId", parentGroupId), null, null, null, true));
+                if (UtilValidate.isNotEmpty(children)) {
+                    for (GenericValue child : children ) {
+                        String productStoreGroupId = child.getString("productStoreGroupId");
+                        Map josonMap = FastMap.newInstance();
+                        List<GenericValue> childList = null;
+                        // Get the child list of chosen category
+                        childList = EntityUtil.filterByDate(delegator.findList("ProductStoreGroupRollupAndChild",
+                                EntityCondition.makeCondition("parentGroupId", productStoreGroupId), null, null, null, true));
+
+                        if (UtilValidate.isNotEmpty(childList)) {
+                            josonMap.put("state", "closed");
+                        }
+                        Map dataMap = FastMap.newInstance();
+                        Map dataAttrMap = FastMap.newInstance();
+
+                        dataAttrMap.put("onClick", onclickFunction + "('" + productStoreGroupId + "')");
+                        String hrefStr = "EditProductStoreGroupAndAssoc";
+                        dataAttrMap.put("href", hrefStr);
+
+                        dataMap.put("attr", dataAttrMap);
+                        dataMap.put("title", child.get("productStoreGroupName") + " [" + child.get("productStoreGroupId") + "]");
+                        josonMap.put("data", dataMap);
+                        Map attrMap = FastMap.newInstance();
+                        attrMap.put("parentGroupId", productStoreGroupId);
+                        josonMap.put("attr",attrMap);
+                        josonMap.put("sequenceNum",child.get("sequenceNum"));
+                        josonMap.put("title", child.get("productStoreGroupName"));
+
+                        productStoreGroupList.add(josonMap);
+                    }
+                    List<Map<Object, Object>> sortedProductStoreGroupList = UtilMisc.sortMaps(productStoreGroupList, sortList);
+                    toJsonObjectList(sortedProductStoreGroupList,response);
+                }
+            }
+        } catch (GenericEntityException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public static void toJsonObjectList(List attrList, HttpServletResponse response){
+        String jsonStr = "[";
+        for (Object attrMap : attrList) {
+            JSONObject json = JSONObject.fromObject(attrMap);
+            jsonStr = jsonStr + json.toString() + ',';
+        }
+        jsonStr = jsonStr + "{ } ]";
+        if (UtilValidate.isEmpty(jsonStr)) {
+            Debug.logError("JSON Object was empty; fatal error!",module);
+        }
+        // set the X-JSON content type
+        response.setContentType("application/json");
+        // jsonStr.length is not reliable for unicode characters
+        try {
+            response.setContentLength(jsonStr.getBytes("UTF8").length);
+        } catch (UnsupportedEncodingException e) {
+            Debug.logError("Problems with Json encoding",module);
+        }
+        // return the JSON String
+        Writer out;
+        try {
+            out = response.getWriter();
+            out.write(jsonStr);
+            out.flush();
+        } catch (IOException e) {
+            Debug.logError("Unable to get response writer",module);
+        }
+    }
+}

Propchange: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreEvents.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Wed Sep  5 09:19:53 2012
@@ -1439,6 +1439,39 @@ under the License.
         <response name="error" type="view" value="EditProdCatalogStores"/>
     </request-map>
 
+    <request-map uri="ListParentProductStoreGroup"><security https="true" auth="true"/><response name="success" type="view" value="ListParentProductStoreGroup"/></request-map>
+    <request-map uri="EditProductStoreGroup"><security https="true" auth="true"/><response name="success" type="view" value="EditProductStoreGroup"/></request-map>
+    <request-map uri="EditProductStoreGroupAndAssoc"><security https="true" auth="true"/><response name="success" type="view" value="EditProductStoreGroupAndAssoc"/></request-map>
+    <request-map uri="createProductStoreGroup">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="createProductStoreGroup"/>
+        <response name="success" type="view" value="ListParentProductStoreGroup"/>
+        <response name="error" type="view" value="EditProductStoreGroup"/>
+    </request-map>
+    <request-map uri="updateProductStoreGroup">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="updateProductStoreGroup"/>
+        <response name="success" type="view" value="ListParentProductStoreGroup"/>
+        <response name="error" type="view" value="EditProductStoreGroup"/>
+    </request-map>
+    <request-map uri="getProductStoreGroupRollupHierarchy">
+        <security auth="false" https="true"/>
+        <event type="java" path="org.ofbiz.product.store.ProductStoreEvents" invoke="getChildProductStoreGroupTree"/>
+        <response name="success" type="none"/>
+    </request-map>
+    <request-map uri="AddProductStoreToGroup">
+        <security auth="true" https="true"/>
+        <event type="service" invoke="createProductStoreGroupMember"/>
+        <response name="success" type="request" value="json"/>
+        <response name="error" type="request" value="json"/>
+    </request-map>
+    <request-map uri="updateProductStoreGroupRollup">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="updateProductStoreGroupRollup"/>
+        <response name="success" type="view" value="ListParentProductStoreGroup"/>
+        <response name="error" type="view" value="EditProductStoreGroup"/>
+    </request-map>
+
     <!-- ================ ProdCatalog Parties Requests ================= -->
     <request-map uri="EditProdCatalogParties">
         <security https="true" auth="true"/>
@@ -3178,6 +3211,9 @@ under the License.
     <view-map name="EditProductStoreFacility" page="component://product/widget/catalog/StoreScreens.xml#EditProductStoreFacility" type="screen"/>
     <view-map name="EditVendorProduct" type="screen" page="component://product/widget/catalog/ProductScreens.xml#EditVendorProduct"/>
     <view-map name="EditKeywordThesaurus" type="screen" page="component://product/widget/catalog/ThesaurusScreens.xml#EditKeywordThesaurus"/>
+    <view-map name="ListParentProductStoreGroup" type="screen" page="component://product/widget/catalog/StoreScreens.xml#ListParentProductStoreGroup"/>
+    <view-map name="EditProductStoreGroup" type="screen" page="component://product/widget/catalog/StoreScreens.xml#EditProductStoreGroup"/>
+    <view-map name="EditProductStoreGroupAndAssoc" type="screen" page="component://product/widget/catalog/StoreScreens.xml#EditProductStoreGroupAndAssoc"/>
 
     <view-map name="FindReviews" type="screen" page="component://product/widget/catalog/ReviewScreens.xml#FindReviews"/>
 

Added: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl?rev=1381093&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl (added)
+++ ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl Wed Sep  5 09:19:53 2012
@@ -0,0 +1,86 @@
+<#--
+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.
+-->
+
+<script type="text/javascript">
+<#-- some labels are not unescaped in the JSON object so we have to do this manualy -->
+function unescapeHtmlText(text) {
+    return jQuery('<div />').html(text).text()
+}
+
+jQuery(window).load(createTree());
+
+<#-- creating the JSON Data -->
+<#if parentProductStoreGroup?has_content>
+    <#assign parentGroupList = [parentProductStoreGroup]>
+<#else>
+    <#assign parentGroupList = parentProductStoreGroups>
+</#if>
+var rawdata = [
+    <#list parentGroupList as parentGroup>
+                   {
+                    "data": {"title" : unescapeHtmlText("<#if parentGroup.productStoreGroupName?exists>${parentGroup.productStoreGroupName?js_string} [${parentGroup.productStoreGroupId}]</#if>"),
+                                  "attr": {"href" : "<@ofbizUrl>/EditProductStoreGroupAndAssoc</@ofbizUrl>","onClick" : "callDocument('${parentGroup.productStoreGroupId}');"}},
+                    "attr": {"parentGroupId" : "${parentGroup.productStoreGroupId}"},
+                    "state" : "closed"
+                    }<#if parentGroup_has_next>,</#if>
+     </#list>
+     ];
+
+ <#-- create Tree-->
+  function createTree() {
+    jQuery(function () {
+        jQuery("#tree").jstree({
+        "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"],
+            "json_data" : {
+                "data" : rawdata,
+                          "ajax" : { "url" : "<@ofbizUrl>getProductStoreGroupRollupHierarchy</@ofbizUrl>", "type" : "POST",
+                          "data" : function (n) {
+                            return {
+                                "parentGroupId" :  n.attr ? n.attr("parentGroupId").replace("node_","") : 1,
+                                "onclickFunction" : "callDocument"
+                        };
+                    }
+                }
+            },
+            "types" : {
+             "valid_children" : [ "root" ]
+            }
+        });
+    });
+  }
+  
+  function callDocument(id) {
+    //jQuerry Ajax Request
+    var dataSet = {};
+    dataSet = {"productStoreGroupId" : id, "ajaxUpdateEvent" : "Y"};
+    jQuery.ajax({
+        url: 'EditProductStoreGroupAndAssoc',
+        type: 'POST',
+        data: dataSet,
+        error: function(msg) {
+            alert("An error occured loading content! : " + msg);
+        },
+        success: function(msg) {
+            jQuery('#centerdiv').html(msg);
+        }
+    });
+  }
+</script>
+
+<div id="tree"></div>

Propchange: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml Wed Sep  5 09:19:53 2012
@@ -26,6 +26,7 @@ under the License.
         <menu-item name="promos" title="${uiLabelMap.ProductPromos}"><link target="FindProductPromo"/></menu-item>
         <menu-item name="pricerules" title="${uiLabelMap.ProductPriceRules}"><link target="FindProductPriceRules"/></menu-item>
         <menu-item name="store" title="${uiLabelMap.ProductStores}"><link target="FindProductStore"/></menu-item>
+        <menu-item name="storeGroup" title="${uiLabelMap.ProductProductStoreGroups}"><link target="ListParentProductStoreGroup"/></menu-item>
         <menu-item name="thesaurus" title="${uiLabelMap.ProductThesaurus}"><link target="editKeywordThesaurus"/></menu-item>
         <menu-item name="reviews" title="${uiLabelMap.ProductReviews}"><link target="FindReviews"/></menu-item>
         <menu-item name="configs" title="${uiLabelMap.ProductConfigItems}"><link target="FindProductConfigItems"/></menu-item>
@@ -286,6 +287,12 @@ under the License.
         </menu-item>
     </menu>
 
+    <menu name="ProductStoreGroupButtonBar" extends="CommonButtonBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
+        <menu-item name="editstoregroup">
+            <link target="EditProductStoreGroup" text="${uiLabelMap.ProductNewGroup}" style="create"/>
+        </menu-item>
+    </menu>
+
     <menu name="ProductStoreFacility" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
         <menu-item name="AddProductStoreFacility" title="${uiLabelMap.ProductAddFacility}">
             <link target="javascript:ajaxUpdateArea('ProductStoreFacilityEditArea', 'editProductStoreFacility', 'productStoreId=${parameters.productStoreId}');"

Modified: ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml Wed Sep  5 09:19:53 2012
@@ -167,6 +167,37 @@ under the License.
         </section>
     </screen>
 
+    <screen name="CommonProductStoreGroupDecorator">
+        <section>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="left-column">
+                        <include-screen name="ProductStoreGroupTree"/>
+                    </decorator-section>
+                    <decorator-section name="body">
+                        <section>
+                            <condition>
+                                <or>
+                                    <if-has-permission permission="CATALOG" action="_ADMIN"/>
+                                    <if-has-permission permission="CATALOG" action="_CREATE"/>
+                                    <if-has-permission permission="CATALOG" action="_UPDATE"/>
+                                    <if-has-permission permission="CATALOG" action="_VIEW"/>
+                                </or>
+                            </condition>
+                            <widgets>
+                                <include-menu name="ProductStoreGroupButtonBar" location="component://product/widget/catalog/CatalogMenus.xml"/>
+                                <decorator-section-include name="body"/>
+                            </widgets>
+                            <fail-widgets>
+                                <label style="h3">${uiLabelMap.ProductCatalogViewPermissionError}</label>
+                            </fail-widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="CommonShippingDecorator">
         <section>
             <widgets>
@@ -323,7 +354,24 @@ under the License.
             </widgets>
         </section>
     </screen>
-    
+
+    <screen name="ProductStoreGroupTree">
+        <section>
+            <actions>
+                <entity-one value-field="parentProductStoreGroup" entity-name="ProductStoreGroup"/>
+                <entity-condition entity-name="ProductStoreGroup" list="parentProductStoreGroups">
+                    <condition-expr field-name="primaryParentGroupId" from-field="nullField"/>
+                </entity-condition>
+            </actions>
+            <widgets>
+                <screenlet id="ProductStoreGroupPanel" title="${uiLabelMap.ProductParentProductStoreGroups}" collapsible="true">
+                    <container id="EditDocumentTree"/>
+                    <platform-specific><html><html-template location="component://product/webapp/catalog/store/ProductStoreGroupTree.ftl"/></html></platform-specific>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="main">
         <section>
             <actions>

Modified: ofbiz/trunk/applications/product/widget/catalog/StoreForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/StoreForms.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/StoreForms.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/StoreForms.xml Wed Sep  5 09:19:53 2012
@@ -153,4 +153,99 @@ under the License.
         </field>
         <on-event-update-area event-type="submit" area-id="PrdStoreFacilityMgmtArea" area-target="ListProductStoreFacilityFormOnly?portalPortletId=PrdStoreFacilityMgmt&amp;productStoreId=${parameters.productStoreId}"/>
      </form>
+
+     <!-- ProductStoreGroup Forms -->
+     <form name="ListParentProductStoreGroup" type="list" target="EditProductStoreGroup" paginate="false"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <actions>
+            <entity-condition entity-name="ProductStoreGroup">
+                <condition-expr field-name="primaryParentGroupId" from-field="nullField"/>
+                <order-by field-name="productStoreGroupName"/>
+            </entity-condition>
+        </actions>
+        <field name="productStoreGroupId"><hidden/></field>
+        <field name="productStoreGroupName">
+            <hyperlink target="ListParentProductStoreGroup" description="${productStoreGroupName} [${productStoreGroupId}]">
+                <parameter param-name="productStoreGroupId"/>
+            </hyperlink>
+        </field>
+        <field name="productStoreGroupTypeId"><display-entity entity-name="ProductStoreGroupType"/></field>
+        <field name="description"><display/></field>
+        <field name="selectButton" title="${uiLabelMap.CommonSelect}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    <form name="EditProductStoreGroup" target="updateProductStoreGroup" type="single" default-map-name="productStoreGroup">
+        <alt-target use-when="productStoreGroup == null" target="createProductStoreGroup"/>
+        <auto-fields-entity entity-name="ProductStoreGroup"/>
+        <field name="productStoreGroupId"><hidden/></field>
+        <field name="productStoreGroupTypeId">
+            <drop-down>
+                <entity-options description="${description}" entity-name="ProductStoreGroupType"/>
+            </drop-down>
+        </field>
+        <field name="primaryParentGroupId" use-when="productStoreGroup == null"><ignored/></field>
+        <field name="primaryParentGroupId" use-when="productStoreGroup != null">
+            <drop-down allow-empty="true">
+                <entity-options description="${productStoreGroupName} [${productStoreGroupId}]" entity-name="ProductStoreGroup" key-field-name="productStoreGroupId">
+                    <entity-constraint name="productStoreGroupId" operator="not-equals" env-name="productStoreGroup.productStoreGroupId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.Common${groovy: context.productStoreGroup?'Submit':'Create'}" widget-style="smallSubmit"><submit/></field>
+    </form>
+    <form name="ListProductStoreGroupAssoc" type="list"
+           odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <actions>
+            <entity-and entity-name="ProductStoreGroupRollup" filter-by-date="true">
+                <field-map field-name="parentGroupId" from-field="productStoreGroup.productStoreGroupId"/>
+            </entity-and>
+        </actions>
+        <field name="productStoreGroupId">
+            <display-entity entity-name="ProductStoreGroup" description="${productStoreGroupName}">
+                <sub-hyperlink target="EditProductStoreGroupAndAssoc" description=" [${productStoreGroupId}]">
+                    <parameter param-name="productStoreId"/>
+                </sub-hyperlink>
+            </display-entity>
+        </field>
+        <field name="fromDate"><display type="date"/></field>
+        <field name="thruDate"><display type="date"/></field>
+        <field name="submitButton" title=" ">
+            <hyperlink target="updateProductStoreGroupRollup" request-confirmation="true" description="${uiLabelMap.CommonDelete}">
+                <parameter param-name="productStoreGroupId"/>
+                <parameter param-name="parentGroupId"/>
+                <parameter param-name="fromDate"/>
+                <parameter param-name="thruDate" from-field="date:nowTimestamp()"/>
+            </hyperlink>
+        </field>
+    </form>
+    <form name="ListProductStoreAssoc" type="list"
+           odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <actions>
+            <entity-and entity-name="ProductStoreGroupAndMember" filter-by-date="true">
+                <field-map field-name="productStoreGroupId" from-field="productStoreGroup.productStoreGroupId"/>
+            </entity-and>
+        </actions>
+        <field name="productStoreId">
+            <hyperlink target="EditProductStore" description="${productStoreId}">
+                <parameter param-name="productStoreId"/>
+            </hyperlink>
+        </field>
+        <field name="storeName"><display/></field>
+        <field name="fromDate"><display type="date"/></field>
+        <field name="thruDate"><display type="date"/></field>
+    </form>
+    <form name="AddProductStoreAssoc" type="single" target="AddProductStoreToGroup">
+        <field name="productStoreGroupId"><hidden/></field>
+        <field name="productStoreId">
+            <drop-down>
+                <entity-options description="${storeName} [${productStoreId}]" entity-name="ProductStore">
+                    <entity-order-by field-name="storeName"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="fromDate"><date-time type="date" default-value="${nowTimestamp}"/></field>
+        <field name="addButton" widget-style="smallSubmit"><submit/></field>
+        <on-event-update-area area-target="EditProductStoreGroupAndAssoc" event-type="submit" area-id="centerdiv">
+            <parameter param-name="productStoreGroupId" from-field="productStoreGroup.productStoreGroupId"/>
+        </on-event-update-area>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/product/widget/catalog/StoreScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/StoreScreens.xml?rev=1381093&r1=1381092&r2=1381093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/StoreScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/StoreScreens.xml Wed Sep  5 09:19:53 2012
@@ -594,4 +594,65 @@ under the License.
         </section>
     </screen>
 
+    <screen name="ListParentProductStoreGroup">
+        <section>
+            <actions>
+                <set field="titleProperty" value="ProductProductStoreGroup"/>
+                <set field="tabButtonItem" value="storeGroup"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonProductStoreGroupDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.ProductParentProductStoreGroupList}">
+                            <include-form name="ListParentProductStoreGroup" location="component://product/widget/catalog/StoreForms.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="EditProductStoreGroup">
+        <section>
+            <actions>
+                <set field="titleProperty" value="ProductProductStoreGroup"/>
+                <set field="tabButtonItem" value="storeGroup"/>
+                <entity-one entity-name="ProductStoreGroup" value-field="productStoreGroup"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonProductStoreGroupDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.ProductProductStoreGroup}">
+                            <include-form name="EditProductStoreGroup" location="component://product/widget/catalog/StoreForms.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="EditProductStoreGroupAndAssoc">
+        <section>
+            <actions>
+                <property-map map-name="uiLabelMap" resource="CommonUiLabels"/>
+                <property-map map-name="uiLabelMap" resource="ProductUiLabels"/>
+                <entity-one entity-name="ProductStoreGroup" value-field="productStoreGroup"/>
+            </actions>
+            <widgets>
+                <screenlet title="${uiLabelMap.ProductProductStoreGroup} ${productStoreGroup.productStoreGroupName} [${productStoreGroup.productStoreGroupId}]" name="editProductStoreGroup" collapsible="true" initially-collapsed="true">
+                    <include-form name="EditProductStoreGroup" location="component://product/widget/catalog/StoreForms.xml"/>
+                </screenlet>
+                <screenlet title="${uiLabelMap.ProductProductStoreGroupRollup}" id="editProductStoreGroupRollup" name="editProductStoreGroupRollup" collapsible="true" initially-collapsed="true">
+                    <include-form name="ListProductStoreGroupAssoc" location="component://product/widget/catalog/StoreForms.xml"/>
+                </screenlet>
+                <screenlet title="${uiLabelMap.ProductProductStoreMember}">
+                    <include-form name="ListProductStoreAssoc" location="component://product/widget/catalog/StoreForms.xml"/>
+                </screenlet>
+                <screenlet title="${uiLabelMap.ProductAddToProductStoreGroup}">
+                    <include-form name="AddProductStoreAssoc" location="component://product/widget/catalog/StoreForms.xml"/>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
+
 </screens>