You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/03/14 07:59:17 UTC

svn commit: r1081270 [2/2] - in /ofbiz/trunk/specialpurpose/googlebase: config/ data/ data/helpdata/ script/ script/org/ script/org/ofbiz/ script/org/ofbiz/googlebase/ servicedef/ src/org/ofbiz/googlebase/ webapp/googlebase/WEB-INF/ webapp/googlebase/W...

Added: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsToGooglebase.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsToGooglebase.groovy?rev=1081270&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsToGooglebase.groovy (added)
+++ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsToGooglebase.groovy Mon Mar 14 06:59:16 2011
@@ -0,0 +1,65 @@
+/*
+ * 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 java.util.List;
+
+import org.ofbiz.entity.GenericValue;
+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 = [];
+categoryIdsTemp = []
+
+if (parameters.productStoreId) {
+    productStoreId = parameters.productStoreId;
+}
+googleBaseConfigList = delegator.findByAnd("GoogleBaseConfig",["productStoreId":productStoreId]);
+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;
+prodCatalogList.each { prodCatalogList -> 
+    currentCatalogId = prodCatalogList.prodCatalogId
+    prodCatalogCategoryList = delegator.findByAnd("ProdCatalogCategory",["prodCatalogId":currentCatalogId, "prodCatalogCategoryTypeId":"PCCT_BROWSE_ROOT"]);
+    topCategory = prodCatalogCategoryList.productCategoryId[0];
+    if (topCategory){
+        relatedCategories = dispatcher.runSync("getRelatedCategories", [parentProductCategoryId: topCategory, userLogin: userLogin]);
+        categoryList = relatedCategories.categories
+    } else {
+        categoryIdsTemp.clear()
+    }
+    if (categoryList) {
+        categoryIdsTemp = EntityUtil.getFieldListFromEntityList(categoryList, "productCategoryId", true);
+    }
+    categoryIds.add(categoryIdsTemp)
+}
+
+context.googleBaseConfigList = googleBaseConfigList;
+context.categoryIds = categoryIds;
+context.productStoreId = productStoreId;

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

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

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

Modified: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml?rev=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml Mon Mar 14 06:59:16 2011
@@ -48,6 +48,17 @@ under the License.
         <response name="error" type="view" value="ProductsExportToGoogle"/>
     </request-map>
     
+    <request-map uri="GooglebaseAutoUpdate">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="GooglebaseAutoUpdate"/>
+        <response name="error" type="view" value="GooglebaseAutoUpdate"/>
+    </request-map>
+    <request-map uri="startStopScheduledGbase">
+        <security https="true" auth="true"/>
+        <event type="simple" path="component://googlebase/script/org/ofbiz/googlebase/GooglebaseEvents.xml" invoke="startStopScheduledGbase"/>
+        <response name="success" type="view" value="GooglebaseAutoUpdate"/>
+        <response name="error" type="view" value="GooglebaseAutoUpdate"/>
+    </request-map>
     <!-- Request entries for GoogleBaseConfig UI -->
     <request-map uri="EditGoogleBaseConfigs">
         <security https="true" auth="true"/>
@@ -81,5 +92,6 @@ under the License.
     <view-map name="EditProduct" type="screen" page="component://googlebase/widget/GoogleBaseScreens.xml#EditProduct"/>
     <view-map name="ProductsExportToGoogle" type="screen" page="component://googlebase/widget/GoogleBaseScreens.xml#ProductsExportToGoogle"/>
     <view-map name="EditGoogleBaseConfigs" type="screen" page="component://googlebase/widget/GoogleBaseScreens.xml#EditGoogleBaseConfigs"/>
+    <view-map name="GooglebaseAutoUpdate" type="screen" page="component://googlebase/widget/GoogleBaseScreens.xml#GooglebaseAutoUpdate"/>
     <!-- end of view mappings -->
 </site-conf>

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=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl (original)
+++ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/GoogleBaseAdvancedSearch.ftl Mon Mar 14 06:59:16 2011
@@ -150,6 +150,28 @@ under the License.
             </tr>
           </#if>
           <tr>
+             <td class="label" align="right" valign="top">
+                 Filter Product Status:
+             </td>
+             <td>
+                 <div>
+                     <input type="checkbox" name="ACTIVE_PRODUCT" value="Y"/>Active Product
+                     <br/>
+                     <input type="checkbox" name="GOOGLE_SYNCED" value="Y"/>Product not currently synced with Google Base
+                 </div>
+             </td>
+           </tr>
+           <tr>
+             <td class="label" align="right" valign="top">
+               Discontinued:
+             </td>
+             <td>
+                 <div>
+                     <input type="checkbox" name="DISCONTINUED_PRODUCT" value="Y"/>Exclude sending discontinued product and stock is zero.
+                 </div>
+             </td>
+           </tr>
+           <tr>
             <td class="label" align="right" valign="top">
               ${uiLabelMap.ProductProductName}:
             </td>

Modified: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl?rev=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl (original)
+++ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl Mon Mar 14 06:59:16 2011
@@ -19,8 +19,18 @@ under the License.
 
 <script language="JavaScript" type="text/javascript">
     function exportToGoogle() {
-        document.products.action="<@o...@ofbizUrl>";
-        document.products.submit();
+        var productIds = document.getElementsByName("selectResult");
+        var count = 0;
+        for(var i=0; i<productIds.length; i++){
+            if(productIds[i].checked)
+                count++;
+        }
+        if(count > 0){
+            document.products.action="<@o...@ofbizUrl>";
+            document.products.submit();
+        } else {
+            alert("You have to choose any product(s).");
+        }
     }
 </script>
 

Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml?rev=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml Mon Mar 14 06:59:16 2011
@@ -22,16 +22,14 @@ under the License.
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
     <form id="productsExportToGoogle" name="ProductsExportToGoogle" type="single" target="searchExportProductListToGoogle"
         header-row-style="header-row" default-table-style="basic-table">
+        <actions>
+            <set field="selectResult" type="List"/>
+        </actions>
         <field name="productStoreId"><hidden/></field>
         <field name="selectResult"><hidden/></field>
-        <field name="countryCode" tooltip="${uiLabelMap.GoogleBaseExportCountryCode}">
-            <drop-down no-current-selected-key="US">
-                <option key="US" description="${uiLabelMap.GoogleBaseExportCountryCodeUS}"/>
-                <option key="GB" description="${uiLabelMap.GoogleBaseExportCountryCodeGB}"/>
-                <option key="DE" description="${uiLabelMap.GoogleBaseExportCountryCodeDE}"/>
-                <option key="IT" description="${uiLabelMap.GoogleBaseExportCountryCodeIT}"/>
-            </drop-down>
-        </field>
+        <field name="dummy" title=" " tooltip="Google Base Application is now available for US, UK(GB) and DE"><display/></field>
+        <field name="countryCode"><hidden/></field>
+        <field name="showText" title="Country Code" tooltip="This product store is ${countryCode}"><display/></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}[${webSiteId}]"/>
@@ -69,6 +67,7 @@ under the License.
                 </entity-options>
             </drop-down>
         </field>
+        <field name="allowRecommended" title="${uiLabelMap.GoogleBaseRecommended}"><check/></field>
         <field name="submitButton" title="${uiLabelMap.GoogleBaseExportToGoogle}"><submit button-type="button"/></field>
     </form>
     
@@ -104,4 +103,44 @@ under the License.
         <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
     </form>
     
+    <form name="GooglebaseAutoUpdateConfig" type="list" list-name="configList" header-row-style="header-row-2" 
+        default-table-style="basic-table hover-bar" odd-row-style="alternate-row">
+        <actions>
+            <script location="component://googlebase/webapp/googlebase/WEB-INF/actions/autoUpdateConfig.groovy"/>
+        </actions>
+        <field name="productStoreId"><display/></field>
+        <field name="outOfStock" title="Update if product is out of stock"><display/></field>
+        <field name="backInStock" title="Update if product is back into stock"><display/></field>
+        <field name="webSiteUrl"><display/></field>
+        <field name="actionType"><display/></field>
+        <field name="statusId"><display/></field>
+        <field name="outOfStock"><display/></field>
+        <field name="testMode"><display/></field>
+        <field name="webSiteMountPoint"><display/></field>
+        <field name="countryCode"><display/></field>
+        <field name="trackingCodeId"><display/></field>
+        <field name="allowRecommended"><display/></field>
+    </form>
+    <form name="StartStopScheduled" type="single" target="startStopScheduledGbase" title="">
+        <actions>
+            <entity-and entity-name="JobSandbox" list="pendingList">
+                <field-map field-name="serviceName" value="autoUpdateToGoogleBase"/>
+                <field-map field-name="statusId" value="SERVICE_PENDING"/>
+                <order-by field-name="-lastUpdatedStamp"/>
+            </entity-and>
+            <entity-and entity-name="JobSandbox" list="cancelledList">
+                <field-map field-name="serviceName" value="autoUpdateToGoogleBase"/>
+                <field-map field-name="statusId" value="SERVICE_CANCELLED"/>
+                <order-by field-name="-lastUpdatedStamp"/>
+            </entity-and>
+        </actions>
+        <field name="dummy" title=" " tooltip="Don't forget to add the scheduled job to run autoUpdateToGoogleBase service"><display /></field>
+        <field name="pendingJobId"><display description="${pendingList[0].jobId}"/></field>
+        <field name="status" use-when="${groovy: return context.pendingList[0] != null;}"><display description="RUNNING"/></field>
+        <field name="lastUpdatedStamp" use-when="${groovy: return context.pendingList[0] != null;}"><display description="${pendingList[0].lastUpdatedStamp}"/></field>
+        <field name="runTime" use-when="${groovy: return context.pendingList[0] != null;}"><display description="${pendingList[0].runTime}"/></field>
+        <field name="status" use-when="${groovy: return context.pendingList[0] == null;}"><display description="STOP"/></field>
+        <field name="StoppedTime" use-when="${groovy: return context.pendingList[0] == null;}"><display description="${cancelledList[0].cancelDateTime}"/></field>
+        <field name="Start/Stop Scheduled"><submit button-type="button"/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseMenus.xml?rev=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseMenus.xml Mon Mar 14 06:59:16 2011
@@ -21,5 +21,6 @@ under the License.
     <menu name="GoogleBaseAppBar" title="${uiLabelMap.GoogleBaseApplication}" extends="CommonAppBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
         <menu-item name="GoogleBaseConfigs" title="${uiLabelMap.GoogleBaseConfiguration}"><link target="EditGoogleBaseConfigs"/></menu-item>
         <menu-item name="googlebase" title="${uiLabelMap.GoogleBaseExportToGoogle}"><link target="advancedsearch"/></menu-item>
+        <menu-item name="GooglebaseAutoUpdate" title="${uiLabelMap.GoogleBaseAutoUpdate}"><link target="GooglebaseAutoUpdate"/></menu-item>
     </menu>
 </menus>

Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml?rev=1081270&r1=1081269&r2=1081270&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml Mon Mar 14 06:59:16 2011
@@ -49,6 +49,7 @@ under the License.
             <actions>
                 <set field="titleProperty" value="PageTitleSearchResults"/>
                 <script location="component://product/webapp/catalog/WEB-INF/actions/find/keywordsearch.groovy"/>
+                <script location="component://googlebase/webapp/googlebase/WEB-INF/actions/FilterProducts.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFindDecorator" location="${parameters.mainDecoratorLocation}">
@@ -128,4 +129,29 @@ under the License.
             </widgets>
         </section>
     </screen>
+    <screen name="GooglebaseAutoUpdate">
+        <section>
+            <actions>
+                <set field="titleProperty" value="GooglebaseAutoUpdate"/>
+                <set field="headerItem" value="GooglebaseAutoUpdate"/>
+                <entity-condition entity-name="GoogleBaseConfig" list="googleBaseConfigList"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section>
+                            <widgets>
+                                <screenlet title="Start/Stop Auto Update to Google Base Scheduled">
+                                    <include-form name="StartStopScheduled" location="component://googlebase/widget/GoogleBaseForms.xml"/>
+                                </screenlet>
+                                <screenlet title="Google Base Auto Update Config - setup at [autoUpdateToGoogleBase.properties]">
+                                    <include-form name="GooglebaseAutoUpdateConfig" location="component://googlebase/widget/GoogleBaseForms.xml"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>