Author: ashish
Date: Wed Nov  4 12:05:09 2009
New Revision: 832713

URL: http://svn.apache.org/viewvc?rev=832713&view=rev
Log:
Applied patch from jira issue OFBIZ-3149 - Improve Category association in eBay.

Recently multi store support for Ebay has been implemented. For the multi store 
support we need ProductStore > ProdCatalog > ProductCategory association. For 
EBay we define specific categories of type EBAY_CATEGORY, only those products 
that are associated to an EBay category are eligible for eBay export. In the 
current implementation there is no proper prodCatalogCategoryTypeId which can 
be used to associate eBay category to ProdCatalog, one way to associate an eBay 
category to ProdCatalog is as a PCCT_BROWSE_ROOT category, thus we have two 
categories associated to the catalog as BROWSE_ROOT, the other one is for 
online store. Technically, this is wrong, a catalog should be associated with 
only one browse root category. Due to this wrong association the eBay category 
doesn't show up on the advance search page of EBAY webapp, instead online 
store's browse root category is shown which may also contain those products 
which are not meant to be exported to eBay. So this category a
 ssociations need to be fixed, and following is how this can be resolved:

   1. Create a new ProdCatalogCatagoryType PCCT_EBAY_ROOT
   2. Define a worker method in CatalogWorker to derive the top level (root) 
ebay category
   3. Now in the advance search form, first look for top level ebay category 
associated to the selected catalog
          * If found, derive sub category list of the top level ebay category 
and display, else display the top level ebay category itself
          * If not found, derive the top level browse root category 
(PCCT_BROWSE_ROOT) and display the sub category list for it

Thanks Parimal Gain for the contribution.
Special thanks to Mridul Pathak (Zone of Sharp Mind :-)) for discussing 
implementation plans & providing wonderful notes.

Added:
    
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
   (with props)
    
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
   (with props)
Modified:
    ofbiz/trunk/applications/product/data/ProductTypeData.xml
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
    
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy
    ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl
    ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml
    
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl
    ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml
    ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml

Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Wed Nov  4 
12:05:09 2009
@@ -171,6 +171,7 @@
     <ProdCatalogCategoryType description="View Allow (One)" 
prodCatalogCategoryTypeId="PCCT_VIEW_ALLW"/>
     <ProdCatalogCategoryType description="Purchase Allow (One)" 
prodCatalogCategoryTypeId="PCCT_PURCH_ALLW"/>
     <ProdCatalogCategoryType description="Admin Allow (One)" 
prodCatalogCategoryTypeId="PCCT_ADMIN_ALLW"/>
+    <ProdCatalogCategoryType description="Ebay Root (One)" 
prodCatalogCategoryTypeId="PCCT_EBAY_ROOT"/>
 
     <ProductAssocType description="Also Bought" hasTable="N" parentTypeId="" 
productAssocTypeId="ALSO_BOUGHT"/>
     <ProductAssocType description="Upgrade or Up-Sell" hasTable="N" 
parentTypeId="" productAssocTypeId="PRODUCT_UPGRADE"/>

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
 Wed Nov  4 12:05:09 2009
@@ -384,4 +384,18 @@
 
         return categoryIds;
     }
+
+    public static String getCatalogTopEbayCategoryId(ServletRequest request, 
String prodCatalogId) {
+        if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+
+        List<GenericValue> prodCatalogCategories = 
getProdCatalogCategories(request, prodCatalogId, "PCCT_EBAY_ROOT");
+
+        if (UtilValidate.isNotEmpty(prodCatalogCategories)) {
+            GenericValue prodCatalogCategory = 
EntityUtil.getFirst(prodCatalogCategories);
+
+            return prodCatalogCategory.getString("productCategoryId");
+        } else {
+            return null;
+        }
+    }
 }

Modified: 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy
 Wed Nov  4 12:05:09 2009
@@ -18,23 +18,12 @@
  */
 
 import org.ofbiz.entity.condition.*
-import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.product.catalog.*
-import org.ofbiz.product.category.CategoryWorker;
 import org.ofbiz.product.feature.*
 import org.ofbiz.product.product.*
 import org.ofbiz.product.store.ProductStoreWorker;
-
-categoryIds = [];
-prodCatalogList = [];
-categoryList = [];
-
 searchCategoryId = parameters.SEARCH_CATEGORY_ID;
-if (parameters.productStoreId) {
-    productStoreId = parameters.productStoreId;
-} else {
-    productStoreId = ProductStoreWorker.getProductStoreId(request);
-}
+productStoreId = ProductStoreWorker.getProductStoreId(request);
 if ((!searchCategoryId || searchCategoryId.length() == 0) && !productStoreId) {
     currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
     searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, 
currentCatalogId);
@@ -62,39 +51,6 @@
 // get the GoodIdentification types
 goodIdentificationTypes = delegator.findList("GoodIdentificationType", null, 
null, ['description'], null, false);
 
-//get all productStoreIds used in EbayConfig
-ebayConfigList = delegator.findList("EbayConfig", null, null, null, null, 
false);
-
-//get all productStoreIds used in GoogleBaseConfig
-googleBaseConfigList = delegator.findList("GoogleBaseConfig", null, null, 
null, null, false);
-
-if (productStoreId) {
-    productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, 
productStoreId);
-    if (productStoreCatalogs) {
-        productStoreCatalogs.each { productStoreCatalog ->
-            prodCatalog = delegator.findOne("ProdCatalog", [prodCatalogId : 
productStoreCatalog.prodCatalogId], true);
-            prodCatalogList.add(prodCatalog);
-        }
-    }
-}
-if (parameters.SEARCH_CATALOG_ID) {
-    CategoryWorker.getRelatedCategories(request, "topLevelList", 
CatalogWorker.getCatalogTopCategoryId(request, parameters.SEARCH_CATALOG_ID), 
true);
-    if (request.getAttribute("topLevelList")) {
-       categoryList = request.getAttribute("topLevelList");
-    }
-    context.searchCatalogId = parameters.SEARCH_CATALOG_ID;
-} else if (prodCatalogList) {
-    catalog = EntityUtil.getFirst(prodCatalogList);
-    context.searchCatalogId = catalog.prodCatalogId;
-    CategoryWorker.getRelatedCategories(request, "topLevelList", 
CatalogWorker.getCatalogTopCategoryId(request, catalog.prodCatalogId), true);
-    if (request.getAttribute("topLevelList")) {
-       categoryList = request.getAttribute("topLevelList");
-    }
-}
-if (categoryList) {
-    categoryIds = EntityUtil.getFieldListFromEntityList(categoryList, 
"productCategoryId", true);
-}
-
 context.searchCategoryId = searchCategoryId;
 context.searchCategory = searchCategory;
 context.productFeaturesByTypeMap = productFeaturesByTypeMap;
@@ -103,9 +59,4 @@
 context.searchConstraintStrings = searchConstraintStrings;
 context.searchSortOrderString = searchSortOrderString;
 context.supplerPartyRoleAndPartyDetails = supplerPartyRoleAndPartyDetails;
-context.goodIdentificationTypes = goodIdentificationTypes;
-context.ebayConfigList = ebayConfigList;
-context.googleBaseConfigList = googleBaseConfigList;
-context.categoryIds = categoryIds;
-context.productStoreId = productStoreId;
-context.prodCatalogList = prodCatalogList;
\ No newline at end of file
+context.goodIdentificationTypes = goodIdentificationTypes;
\ No newline at end of file

Added: 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy?rev=832713&view=auto
==============================================================================
--- 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
 (added)
+++ 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
 Wed Nov  4 12:05:09 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.product.catalog.CatalogWorker;
+import org.ofbiz.product.category.CategoryWorker;
+import org.ofbiz.product.store.ProductStoreWorker;
+
+categoryIds = [];
+prodCatalogList = [];
+categoryList = [];
+
+if (parameters.productStoreId) {
+    productStoreId = parameters.productStoreId;
+} else {
+    productStoreId = ProductStoreWorker.getProductStoreId(request);
+}
+ebayConfigList = delegator.findList("EbayConfig", null, null, null, null, 
false);
+if (productStoreId) {
+    productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, 
productStoreId);
+    if (productStoreCatalogs) {
+        productStoreCatalogs.each { productStoreCatalog ->
+            prodCatalog = delegator.findOne("ProdCatalog", [prodCatalogId : 
productStoreCatalog.prodCatalogId], true);
+            prodCatalogList.add(prodCatalog);
+        }
+    }
+}
+currentCatalogId = null;
+if (parameters.SEARCH_CATALOG_ID) {
+    currentCatalogId = parameters.SEARCH_CATALOG_ID;
+} else if (prodCatalogList) {
+    catalog = EntityUtil.getFirst(prodCatalogList);
+    currentCatalogId = catalog.prodCatalogId;
+}
+topCategory = CatalogWorker.getCatalogTopEbayCategoryId(request, 
currentCatalogId);
+if (!topCategory) {
+    topCategory = CatalogWorker.getCatalogTopCategoryId(request, 
currentCatalogId);
+}
+if (topCategory) {
+    CategoryWorker.getRelatedCategories(request, "topLevelList", topCategory, 
true);
+    if (request.getAttribute("topLevelList")) {
+        categoryList = request.getAttribute("topLevelList");
+    } else {
+        categoryIds.add(topCategory);
+    }
+}
+if (categoryList) {
+    categoryIds = EntityUtil.getFieldListFromEntityList(categoryList, 
"productCategoryId", true);
+}
+context.ebayConfigList = ebayConfigList;
+context.categoryIds = categoryIds;
+context.productStoreId = productStoreId;
+context.prodCatalogList = prodCatalogList;
+context.searchCatalogId = currentCatalogId;
\ No newline at end of file

Propchange: 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl 
(original)
+++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl Wed 
Nov  4 12:05:09 2009
@@ -19,8 +19,22 @@
 
 <script type="text/javascript">
 //<![CDATA[
-    function selectChange(id) {
-        var formId = id ;
+    function selectChange(formId, elementId) {
+        if (elementId.id == 'searchProductStoreId') {
+           $('searchCatalogId')[$('searchCatalogId').selectedIndex].value = "";
+           if ($('searchCategoryId').selectedIndex) {
+               
$('searchCategoryId')[$('searchCategoryId').selectedIndex].value = "";
+           } else {
+               $('searchCategoryId').value = "";
+           }
+        }
+        if (elementId.id == 'searchCatalogId') {
+            if ($('searchCategoryId').selectedIndex) {
+               
$('searchCategoryId')[$('searchCategoryId').selectedIndex].value = "";
+           } else {
+               $('searchCategoryId').value = "";
+           }
+        }
         formId.action="<@ofbizUrl>main</@ofbizUrl>";
         formId.submit();
     }
@@ -70,7 +84,7 @@
                 ${uiLabelMap.ProductProductStore}:
               </td>
               <td valign="middle">
-                <select name="productStoreId" id="searchProductStoreId" 
onchange="javascript:selectChange($('advToKeywordSearchform'));">
+                <select name="productStoreId" id="searchProductStoreId" 
onchange="javascript:selectChange($('advToKeywordSearchform'), 
$('searchProductStoreId'));">
                   <#if ebayConfigList?has_content>
                     <#list ebayConfigList as ebayConfig>
                       <#assign productStore = 
delegator.findOne("ProductStore", {"productStoreId" : 
ebayConfig.productStoreId}, true) />
@@ -91,7 +105,7 @@
               </td>
               <td valign="middle">
                 <div>
-                  <select name="SEARCH_CATALOG_ID" id="searchCatalogId" 
onchange="javascript:selectChange($('advToKeywordSearchform'));" 
class="required">
+                  <select name="SEARCH_CATALOG_ID" id="searchCatalogId" 
onchange="javascript:selectChange($('advToKeywordSearchform'), 
$('searchCatalogId'));" class="required">
                     <#list prodCatalogList as prodCatalog>
                       <#assign displayDesc = 
prodCatalog.catalogName?default("${uiLabelMap.ProductNoDescription}") />
                       <#if (18 < displayDesc?length)>
@@ -111,7 +125,7 @@
               <td valign="middle">
                 <div>
                   <#if categoryIds?has_content>
-                    <select name="SEARCH_CATEGORY_ID">
+                    <select name="SEARCH_CATEGORY_ID" id="searchCategoryId">
                       <option value="">- ${uiLabelMap.ProductAnyCategory} 
-</option>
                       <#list categoryIds as categoryId>
                         <#assign productCategory = 
delegator.findOne("ProductCategory", {"productCategoryId" : categoryId}, true) 
/>
@@ -123,8 +137,8 @@
                       </#list>
                     </select>
                   <#else>
-                    <input type="text" id="SEARCH_CATEGORY_ID" 
name="SEARCH_CATEGORY_ID" size="20" maxlength="20" 
value="${requestParameters.SEARCH_CATEGORY_ID?if_exists}" />
-                    <a 
href="javascript:call_fieldlookup2($('SEARCH_CATEGORY_ID'),'LookupProductCategory');"><img
 src='/images/fieldlookup.gif' width='15' height='14' border='0' 
alt="${uiLabelMap.CommonClickHereForFieldLookup}" /></a>
+                    <input type="text" id="searchCategoryId" 
name="SEARCH_CATEGORY_ID" size="20" maxlength="20" 
value="${requestParameters.SEARCH_CATEGORY_ID?if_exists}" />
+                    <a 
href="javascript:call_fieldlookup2($('searchCategoryId'),'LookupProductCategory');"><img
 src='/images/fieldlookup.gif' width='15' height='14' border='0' 
alt="${uiLabelMap.CommonClickHereForFieldLookup}" /></a>
                   </#if>
                   ${uiLabelMap.ProductIncludeSubCategories}?
                   ${uiLabelMap.CommonYes}<input type="radio" 
name="SEARCH_SUB_CATEGORIES" value="Y" checked="checked" />

Modified: ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml Wed Nov  4 12:05:09 
2009
@@ -31,6 +31,7 @@
                     <order-by field-name="description"/>
                 </entity-condition>
                 <script 
location="component://product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy"/>
+                <script 
location="component://ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="permission-decorator" 
location="${parameters.mainDecoratorLocation}">

Added: 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy?rev=832713&view=auto
==============================================================================
--- 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
 (added)
+++ 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
 Wed Nov  4 12:05:09 2009
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.product.catalog.CatalogWorker;
+import org.ofbiz.product.category.CategoryWorker;
+import org.ofbiz.product.store.ProductStoreWorker;
+
+categoryIds = [];
+prodCatalogList = [];
+categoryList = [];
+
+if (parameters.productStoreId) {
+    productStoreId = parameters.productStoreId;
+} else {
+    productStoreId = ProductStoreWorker.getProductStoreId(request);
+}
+googleBaseConfigList = delegator.findList("GoogleBaseConfig", null, null, 
null, null, false);
+if (productStoreId) {
+    productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, 
productStoreId);
+    if (productStoreCatalogs) {
+        productStoreCatalogs.each { productStoreCatalog ->
+            prodCatalog = delegator.findOne("ProdCatalog", [prodCatalogId : 
productStoreCatalog.prodCatalogId], true);
+            prodCatalogList.add(prodCatalog);
+        }
+    }
+}
+currentCatalogId = null;
+if (parameters.SEARCH_CATALOG_ID) {
+    currentCatalogId = parameters.SEARCH_CATALOG_ID;
+} else if (prodCatalogList) {
+    catalog = EntityUtil.getFirst(prodCatalogList);
+    currentCatalogId = catalog.prodCatalogId;
+}
+topCategory = CatalogWorker.getCatalogTopCategoryId(request, currentCatalogId);
+if (topCategory) {
+    CategoryWorker.getRelatedCategories(request, "topLevelList", topCategory, 
true);
+    if (request.getAttribute("topLevelList")) {
+        categoryList = request.getAttribute("topLevelList");
+    } else {
+        categoryIds.add(topCategory);
+    }
+}
+if (categoryList) {
+    categoryIds = EntityUtil.getFieldListFromEntityList(categoryList, 
"productCategoryId", true);
+}
+
+context.googleBaseConfigList = googleBaseConfigList;
+context.categoryIds = categoryIds;
+context.productStoreId = productStoreId;
+context.prodCatalogList = prodCatalogList;
+context.searchCatalogId = currentCatalogId;
\ No newline at end of file

Propchange: 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl
 (original)
+++ 
ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl
 Wed Nov  4 12:05:09 2009
@@ -19,8 +19,22 @@
 
 <script type="text/javascript">
 //<![CDATA[
-    function selectChange(id) {
-        var formId = id ;
+    function selectChange(formId, elementId) {
+        if (elementId.id == 'searchProductStoreId') {
+           $('searchCatalogId')[$('searchCatalogId').selectedIndex].value = "";
+           if ($('searchCategoryId').selectedIndex) {
+               
$('searchCategoryId')[$('searchCategoryId').selectedIndex].value = "";
+           } else {
+               $('searchCategoryId').value = "";
+           }
+        }
+        if (elementId.id == 'searchCatalogId') {
+            if ($('searchCategoryId').selectedIndex) {
+               
$('searchCategoryId')[$('searchCategoryId').selectedIndex].value = "";
+           } else {
+               $('searchCategoryId').value = "";
+           }
+        }
         formId.action="<@ofbizUrl>main</@ofbizUrl>";
         formId.submit();
     }
@@ -70,7 +84,7 @@
                 ${uiLabelMap.ProductProductStore}:
               </td>
               <td valign="middle">
-                <select name="productStoreId" id="searchProductStoreId" 
onchange="javascript:selectChange($('advToKeywordSearchform'));">
+                <select name="productStoreId" id="searchProductStoreId" 
onchange="javascript:selectChange($('advToKeywordSearchform'), 
$('searchProductStoreId'));">
                   <#if googleBaseConfigList?has_content>
                     <#list googleBaseConfigList as googleBaseConfig>
                       <#assign productStore = 
delegator.findOne("ProductStore", {"productStoreId" : 
googleBaseConfig.productStoreId}, true) />
@@ -91,7 +105,7 @@
               </td>
               <td valign="middle">
                 <div>
-                  <select name="SEARCH_CATALOG_ID" id="searchCatalogId" 
onchange="javascript:selectChange($('advToKeywordSearchform'));" 
class="required">
+                  <select name="SEARCH_CATALOG_ID" id="searchCatalogId" 
onchange="javascript:selectChange($('advToKeywordSearchform'), 
$('searchCatalogId'));" class="required">
                     <#list prodCatalogList as prodCatalog>
                       <#assign displayDesc = 
prodCatalog.catalogName?default("${uiLabelMap.ProductNoDescription}") />
                       <#if (18 < displayDesc?length)>
@@ -111,7 +125,7 @@
               <td valign="middle">
                 <div>
                   <#if categoryIds?has_content>
-                    <select name="SEARCH_CATEGORY_ID">
+                    <select name="SEARCH_CATEGORY_ID" id="searchCategoryId">
                       <option value="">- ${uiLabelMap.ProductAnyCategory} 
-</option>
                       <#list categoryIds as categoryId>
                         <#assign productCategory = 
delegator.findOne("ProductCategory", {"productCategoryId" : categoryId}, true) 
/>
@@ -123,8 +137,8 @@
                       </#list>
                     </select>
                   <#else>
-                    <input type="text" id="SEARCH_CATEGORY_ID" 
name="SEARCH_CATEGORY_ID" size="20" maxlength="20" 
value="${requestParameters.SEARCH_CATEGORY_ID?if_exists}" />
-                    <a 
href="javascript:call_fieldlookup2($('SEARCH_CATEGORY_ID'),'LookupProductCategory');"><img
 src='/images/fieldlookup.gif' width='15' height='14' border='0' 
alt="${uiLabelMap.CommonClickHereForFieldLookup}" /></a>
+                    <input type="text" id="searchCategoryId" 
name="SEARCH_CATEGORY_ID" size="20" maxlength="20" 
value="${requestParameters.SEARCH_CATEGORY_ID?if_exists}" />
+                    <a 
href="javascript:call_fieldlookup2($('searchCategoryId'),'LookupProductCategory');"><img
 src='/images/fieldlookup.gif' width='15' height='14' border='0' 
alt="${uiLabelMap.CommonClickHereForFieldLookup}" /></a>
                   </#if>
                   ${uiLabelMap.ProductIncludeSubCategories}?
                   ${uiLabelMap.CommonYes}<input type="radio" 
name="SEARCH_SUB_CATEGORIES" value="Y" checked="checked" />

Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml Wed Nov  4 
12:05:09 2009
@@ -34,7 +34,7 @@
         </field>
         <field name="webSiteId" event="onChange" 
action="javascript:$('productsExportToGoogle').action='${persistAction}';$('productsExportToGoogle').submit();">
             <drop-down current="selected">
-                <list-options list-name="webSiteList" key-name="webSiteId" 
description="${siteName}"/>
+                <list-options list-name="webSiteList" key-name="webSiteId" 
description="${siteName}[${webSiteId}]"/>
             </drop-down>
         </field>
         <field name="webSiteUrl"><text size="50" maxlength="250" 
default-value="${webSiteUrl}"/></field>

Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml?rev=832713&r1=832712&r2=832713&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml 
(original)
+++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml Wed Nov  
4 12:05:09 2009
@@ -30,6 +30,7 @@
                     <order-by field-name="description"/>
                 </entity-condition>
                 <script 
location="component://product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy"/>
+                <script 
location="component://googlebase/webapp/googlebase/WEB-INF/actions/GoogleBaseAdvancedSearch.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFindDecorator" 
location="${parameters.mainDecoratorLocation}">


Reply via email to