Return-Path: Delivered-To: apmail-ofbiz-commits-archive@www.apache.org Received: (qmail 13006 invoked from network); 3 Feb 2010 03:17:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2010 03:17:33 -0000 Received: (qmail 30446 invoked by uid 500); 3 Feb 2010 03:17:33 -0000 Delivered-To: apmail-ofbiz-commits-archive@ofbiz.apache.org Received: (qmail 30392 invoked by uid 500); 3 Feb 2010 03:17:32 -0000 Mailing-List: contact commits-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list commits@ofbiz.apache.org Received: (qmail 30383 invoked by uid 99); 3 Feb 2010 03:17:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 03:17:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 03:17:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7739C2388A9C; Wed, 3 Feb 2010 03:16:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r905876 [6/7] - in /ofbiz/trunk: applications/commonext/documents/ specialpurpose/ specialpurpose/ebay/ specialpurpose/ebay/config/ specialpurpose/ebay/data/ specialpurpose/ebay/data/helpdata/ specialpurpose/ebay/entitydef/ specialpurpose/e... Date: Wed, 03 Feb 2010 03:16:40 -0000 To: commits@ofbiz.apache.org From: hansbak@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100203031642.7739C2388A9C@eris.apache.org> Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java Wed Feb 3 03:16:07 2010 @@ -0,0 +1,283 @@ +package org.ofbiz.ebaystore; + +import java.util.Locale; +import java.util.Map; +import javolution.util.FastMap; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.ServiceUtil; +import com.ebay.sdk.ApiException; +import com.ebay.sdk.SdkException; +import com.ebay.sdk.SdkSoapException; +import com.ebay.sdk.call.AddSellingManagerInventoryFolderCall; +import com.ebay.sdk.call.AddSellingManagerProductCall; +import com.ebay.sdk.call.GetSellingManagerInventoryCall; +import com.ebay.sdk.call.GetSellingManagerInventoryFolderCall; +import com.ebay.sdk.call.ReviseSellingManagerProductCall; +import com.ebay.soap.eBLBaseComponents.AddSellingManagerInventoryFolderRequestType; +import com.ebay.soap.eBLBaseComponents.AddSellingManagerInventoryFolderResponseType; +import com.ebay.soap.eBLBaseComponents.AddSellingManagerProductRequestType; +import com.ebay.soap.eBLBaseComponents.AddSellingManagerProductResponseType; +import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryFolderRequestType; +import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryFolderResponseType; +import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryRequestType; +import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType; +import com.ebay.soap.eBLBaseComponents.ReviseSellingManagerProductRequestType; +import com.ebay.soap.eBLBaseComponents.ReviseSellingManagerProductResponseType; +import com.ebay.soap.eBLBaseComponents.SellingManagerFolderDetailsType; +import com.ebay.soap.eBLBaseComponents.SellingManagerProductDetailsType; +import com.ebay.soap.eBLBaseComponents.SellingManagerProductType; + +public class EbayStoreInventoryServices { + private static final String resource = "EbayUiLabels"; + private static final String module = EbayStoreInventoryServices.class.getName(); + private static final String defaultFolderName = "OFBizProducts"; + private static String folderId = null; + public EbayStoreInventoryServices() { + // TODO Auto-generated constructor stub + } + /*update inventory on ebay site*/ + public static Map updateEbayStoreInventory(DispatchContext dctx, Map context){ + Map result = FastMap.newInstance(); + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + GetSellingManagerInventoryRequestType invenReq = null; + GetSellingManagerInventoryResponseType invenResp = null; + boolean checkProd = false; + boolean status = false; + try { + if(context.get("productStoreId") == null || context.get("productId") == null || context.get("folderId") == null){ + result = ServiceUtil.returnError("The process was required productStoreId, productId and ebay inventory folderId."); + result.put("productStoreId", context.get("productStoreId")); + result.put("facilityId", context.get("facilityId")); + result.put("folderId", context.get("folderId")); + return result; + } + + String productId = (String)context.get("productId"); + String folderId = (String)context.get("folderId"); + // start upload/update products which selected to an ebay inventory + if(folderId != null){ + GetSellingManagerInventoryCall invenCall = new GetSellingManagerInventoryCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + invenReq = new GetSellingManagerInventoryRequestType(); + invenResp = (GetSellingManagerInventoryResponseType) invenCall.execute(invenReq); + if(invenResp != null && "SUCCESS".equals(invenResp.getAck().toString())){ + GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId"))); + + SellingManagerProductType[] sellingManagerProductTypeList = invenResp.getSellingManagerProduct(); + for(SellingManagerProductType sellingManagerProductType : sellingManagerProductTypeList){ + SellingManagerProductDetailsType sellingManagerProductDetailsType = sellingManagerProductType.getSellingManagerProductDetails(); + if(String.valueOf(sellingManagerProductDetailsType.getFolderID()).equals(folderId) && String.valueOf(sellingManagerProductDetailsType.getProductID()).equals(String.valueOf(ebayProductStoreInventory.getLong("ebayProductId"))) && String.valueOf(sellingManagerProductDetailsType.getCustomLabel()).equals(productId)){ + checkProd = true; + break; + } + } + } + + // checkProduct is true then update detail but is false do create new one. + if(checkProd == true){ + status = updateProductInEbayInventoryFolder(dctx,context); + }else { + status = createNewProductInEbayInventoryFolder(dctx,context); + } + if(status == true){ + Debug.logInfo("Done to updated product ".concat(context.get("productId").toString()), module); + result = ServiceUtil.returnSuccess("Updated ebay store inventory in folder "+context.get("folderId")+" success.."); + }else{ + result = ServiceUtil.returnError("Fail to update ebay store inventory."); + } + } + }catch (ApiException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } catch (SdkSoapException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } catch (SdkException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } catch (GenericEntityException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } + result.put("productStoreId", context.get("productStoreId")); + result.put("facilityId", context.get("facilityId")); + result.put("folderId", context.get("folderId")); + return result; + } + + /* add new product and quantity to ebay inventory */ + public static boolean createNewProductInEbayInventoryFolder(DispatchContext dctx, Map context){ + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + AddSellingManagerProductRequestType productReq = null; + AddSellingManagerProductResponseType productResp = null; + boolean flag = false; + + try { + if(context.get("productStoreId") != null && context.get("productId")!=null && context.get("folderId")!=null){ + String productId = (String)context.get("productId"); + String folderId = (String)context.get("folderId"); + AddSellingManagerProductCall productCall = new AddSellingManagerProductCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + productReq = new AddSellingManagerProductRequestType(); + productReq.setFolderID(new Long(folderId)); + SellingManagerProductDetailsType sellingManagerProductDetailsType = new SellingManagerProductDetailsType(); + GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId"))); + + sellingManagerProductDetailsType.setProductName((delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId))).getString("internalName")); + //Must keep productId in SKU NUMBER because ebay allow productId field only long value. + sellingManagerProductDetailsType.setCustomLabel(productId); + if(ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); + + productReq.setSellingManagerProductDetails(sellingManagerProductDetailsType); + productResp = (AddSellingManagerProductResponseType) productCall.execute(productReq); + if(productResp != null && "SUCCESS".equals(productResp.getAck().toString())){ + flag = true; + ebayProductStoreInventory.put("ebayProductId", productResp.getSellingManagerProductDetails().getProductID()); + ebayProductStoreInventory.put("folderId", folderId); + ebayProductStoreInventory.store(); + }else{ + Debug.logError("Fail to create inventory product ".concat(productId).concat("in productStore ").concat(context.get("productStoreId").toString()).concat(" message from ebay : ").concat(productResp.getMessage()), module); + } + } + } catch (ApiException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkSoapException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkException e) { + Debug.logError(e.getMessage(), module); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + return flag; + } + + /* update product and quantity to ebay inventory */ + public static boolean updateProductInEbayInventoryFolder(DispatchContext dctx, Map context){ + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + ReviseSellingManagerProductRequestType req = null; + ReviseSellingManagerProductResponseType resp = null; + boolean flag = false; + + try { + if(context.get("productStoreId") != null && context.get("productId")!=null && context.get("folderId")!=null){ + String productId = (String)context.get("productId"); + String folderId = (String)context.get("folderId"); + ReviseSellingManagerProductCall call = new ReviseSellingManagerProductCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + req = new ReviseSellingManagerProductRequestType(); + SellingManagerProductDetailsType sellingManagerProductDetailsType = new SellingManagerProductDetailsType(); + GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId,"facilityId",context.get("facilityId"),"productStoreId",context.get("productStoreId"))); + Long ebayProductId = null; + if(ebayProductStoreInventory !=null && ebayProductStoreInventory.getLong("ebayProductId")==null){ + Debug.logError("Can not update product "+productId+" has no ebay product Id in EbayProductStoreInventory. ", module); + return flag; + } + if(ebayProductStoreInventory!=null && ebayProductStoreInventory.getLong("ebayProductId")!=null){ + ebayProductId = ebayProductStoreInventory.getLong("ebayProductId"); + } + sellingManagerProductDetailsType.setProductID(ebayProductId); + + sellingManagerProductDetailsType.setProductName((delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId))).getString("internalName")); + //Must keep productId in SKU NUMBER because ebay allow productId field only long value. + sellingManagerProductDetailsType.setCustomLabel(productId); + if(ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); + + req.setSellingManagerProductDetails(sellingManagerProductDetailsType); + resp = (ReviseSellingManagerProductResponseType) call.execute(req); + if(resp != null && "SUCCESS".equals(resp.getAck().toString())){ + flag = true; + ebayProductStoreInventory.put("ebayProductId", ebayProductId); + ebayProductStoreInventory.put("folderId", folderId); + ebayProductStoreInventory.store(); + }else{ + Debug.logError("Fail to update inventory product ".concat(productId).concat("in productStore ").concat(context.get("productStoreId").toString()).concat(" message from ebay : ").concat(resp.getMessage()), module); + } + } + } catch (ApiException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkSoapException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkException e) { + Debug.logError(e.getMessage(), module); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + return flag; + } + + public static Map getFolderInEbayStoreInventory(DispatchContext dctx, Map context){ + Map result = FastMap.newInstance(); + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + GetSellingManagerInventoryFolderRequestType req = null; + GetSellingManagerInventoryFolderResponseType resp = null; + boolean flag = false; + + try { + if(context.get("productStoreId") != null){ + GetSellingManagerInventoryFolderCall call = new GetSellingManagerInventoryFolderCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + req = new GetSellingManagerInventoryFolderRequestType(); + resp = (GetSellingManagerInventoryFolderResponseType) call.execute(req); + if(resp != null && "SUCCESS".equals(resp.getAck().toString())){ + SellingManagerFolderDetailsType sellingManagerFolderDetailsType = resp.getFolder(); + if(sellingManagerFolderDetailsType!=null){ + SellingManagerFolderDetailsType[] SellingManagerFolderDetailsTypeList = sellingManagerFolderDetailsType.getChildFolder(); + for(SellingManagerFolderDetailsType sellingManagerFolderDetails : SellingManagerFolderDetailsTypeList){ + Debug.logInfo("ebay inventory folders name ".concat(sellingManagerFolderDetails.getFolderName()), module); + if(sellingManagerFolderDetails.getFolderName().equals(defaultFolderName)){ + folderId = String.valueOf(sellingManagerFolderDetails.getFolderID()); + flag = true; + break; + } + } + } + if(flag == false){ + folderId = createNewFolderInEbayStoreInventory(dctx,context); + } + } + result = ServiceUtil.returnSuccess("load ebay store folderId "+folderId+" success.."); + } + } catch (ApiException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } catch (SdkSoapException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } catch (SdkException e) { + result = ServiceUtil.returnFailure(e.getMessage()); + } + if(result.get("responseMessage")!=null && result.get("responseMessage").equals("fail")) folderId = null; + result.put("folderId", folderId); + Debug.logInfo("service return result "+ result, module); + return result; + } + + /*create new folder for export product into inventory.*/ + public static String createNewFolderInEbayStoreInventory(DispatchContext dctx, Map context){ + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + AddSellingManagerInventoryFolderRequestType req = null; + AddSellingManagerInventoryFolderResponseType resp = null; + + try { + if(context.get("productStoreId") != null){ + AddSellingManagerInventoryFolderCall call = new AddSellingManagerInventoryFolderCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + req = new AddSellingManagerInventoryFolderRequestType(); + req.setFolderName(defaultFolderName);//req.setComment(value);//req.setParentFolderID(value) + resp = (AddSellingManagerInventoryFolderResponseType) call.execute(req); + if(resp != null && "SUCCESS".equals(resp.getAck().toString())) { + folderId = String.valueOf(resp.getFolderID()); + }else { + Debug.logError("The problem with create new folder on ebay site.", module); + return folderId; + } + } + } catch (ApiException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkSoapException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkException e) { + Debug.logError(e.getMessage(), module); + } + return folderId; + } +} Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java Wed Feb 3 03:16:07 2010 @@ -0,0 +1,145 @@ +package org.ofbiz.ebaystore; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import javolution.util.FastList; +import javolution.util.FastMap; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.entity.Delegator; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.ServiceUtil; +import org.ofbiz.webapp.event.EventHandlerException; + +import com.ebay.sdk.ApiException; +import com.ebay.sdk.SdkException; +import com.ebay.sdk.SdkSoapException; +import com.ebay.sdk.call.GetStoreOptionsCall; +import com.ebay.soap.eBLBaseComponents.GetStoreOptionsRequestType; +import com.ebay.soap.eBLBaseComponents.GetStoreOptionsResponseType; +import com.ebay.soap.eBLBaseComponents.StoreColorSchemeType; +import com.ebay.soap.eBLBaseComponents.StoreColorType; +import com.ebay.soap.eBLBaseComponents.StoreFontFaceCodeType; +import com.ebay.soap.eBLBaseComponents.StoreFontSizeCodeType; +import com.ebay.soap.eBLBaseComponents.StoreFontType; +import com.ebay.soap.eBLBaseComponents.StoreThemeArrayType; +import com.ebay.soap.eBLBaseComponents.StoreThemeType; + +import net.sf.json.JSONObject; + +public class EbayStoreOptions { + + public static String retrieveThemeColorSchemeByThemeId(HttpServletRequest request,HttpServletResponse response){ + + Locale locale = UtilHttp.getLocale(request); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + GetStoreOptionsRequestType req = null; + GetStoreOptionsResponseType resp = null; + StoreThemeArrayType returnedBasicThemeArray = null; + + try { + Map paramMap = UtilHttp.getCombinedMap(request); + if(paramMap.get("productStoreId") != null){ + String themeId = (String)paramMap.get("themeId"); + + GetStoreOptionsCall call = new GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)paramMap.get("productStoreId"), locale, delegator)); + req = new GetStoreOptionsRequestType(); + + resp = (GetStoreOptionsResponseType) call.execute(req); + if(resp != null && "SUCCESS".equals(resp.getAck().toString())){ + + returnedBasicThemeArray = resp.getBasicThemeArray(); + StoreThemeType[] storeBasicTheme = returnedBasicThemeArray.getTheme(); + + int i=0; + String colorSchemeId = themeId.substring(themeId.indexOf("-")+1); + themeId = themeId.substring(0,themeId.indexOf("-")); + + Map storeColorSchemeMap = FastMap.newInstance(); + while(i attrMap, HttpServletResponse response) throws EventHandlerException{ + JSONObject json = JSONObject.fromObject(attrMap); + String jsonStr = json.toString(); + if (jsonStr == null) { + throw new EventHandlerException("JSON Object was empty; fatal error!"); + } + // 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) { + throw new EventHandlerException("Problems with Json encoding", e); + } + // return the JSON String + Writer out; + try { + out = response.getWriter(); + out.write(jsonStr); + out.flush(); + } catch (IOException e) { + throw new EventHandlerException("Unable to get response writer", e); + } + } + +} Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy Wed Feb 3 03:16:07 2010 @@ -0,0 +1,31 @@ +/* + * 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.base.util.*; + +jobSandboxs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("authUserLoginId", userLoginId)); +job = null +jobId = null; +if(jobSandboxs){ + job = jobSandboxs.get(0); +}else{ + jobId = delegator.getNextSeqId("JobSandbox"); +} +context.jobId = jobId; +context.job = job; \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy Wed Feb 3 03:16:07 2010 @@ -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. + */ + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.*; +import java.sql.Timestamp; +import java.util.Map; + +import javolution.util.FastMap; + +partyId = null +inMap = FastMap.newInstance(); +inMap.put("productStoreId", parameters.productStoreId); +inMap.put("userLogin", context.get("userLogin")); +resultUser = dispatcher.runSync("getEbayStoreUser", inMap); +ownerUser = resultUser.get("userLoginId"); +userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", ownerUser)); +if(userLogin){ + partyId = userLogin.get("partyId"); +} +expr = [] +cond = null; + +contentId = request.getParameter("contentId"); +fromDate = request.getParameter("fromDate"); +thruDate = request.getParameter("thruDate"); +if(contentId){ + expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId)); +} +if(fromDate && thruDate){ + exprSub = []; + condSub = null; + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); + condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND); + expr.add(condSub); +}else if(fromDate && !thruDate){ + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); +}else if(!fromDate && thruDate){ + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); +} +contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("roleTypeId","OWNER", "partyId", partyId)); +contentIds = []; +contentRoles.each{content-> + contentIds.add(content.getString("contentId")); +} +expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds)); +cond = EntityCondition.makeCondition(expr, EntityOperator.AND); +contents = delegator.findList("Content", cond, null, null, null, false); + +recentFeedbackList = []; +ownerUser = null; +commentator = null; +contents.each{content-> + commentatorContents = delegator.findByAnd("ContentRole", UtilMisc.toMap("contentId",content.contentId, "roleTypeId","COMMENTATOR")); + if(commentatorContents){ + commentatorPartyId = commentatorContents.get(0).get("partyId"); + commentatorUsers = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", commentatorPartyId)); + if(commentatorUsers){ + commentator = commentatorUsers.get(0).get("userLoginId"); + } + } + entry = [contentId : content.contentId, + dataResourceId : content.dataResourceId, + createdDate : content.createdDate, + ownerUser : ownerUser, + commentator : commentator]; + recentFeedbackList.add(entry); +} +context.recentFeedbackList = recentFeedbackList; \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy Wed Feb 3 03:16:07 2010 @@ -0,0 +1,69 @@ +/* + * 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. + */ + +productStoreId = parameters.productStoreId; + +storeThemeId = null; +if(parameters.ebayStore){ + ebayStore = parameters.get("ebayStore"); + storeThemeId = ebayStore.get("storeThemeId"); +} + +if(productStoreId!=null){ + flag = null; + storeBasicThemes = null; + resultsBasicThemes = dispatcher.runSync("retrieveBasicThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]); + if(resultsBasicThemes){ + storeBasicThemes = resultsBasicThemes.get("storeThemeList"); + //check what kind of theme? + context.put("storeThemeOptList",storeBasicThemes); + if(storeThemeId!=null && storeBasicThemes!=null){ + storeBasicThemes.each { storeTheme -> + if(storeThemeId == storeTheme.storeThemeId){ + flag = "Basic"; + } + } + } + } + + storeAdvanceThemes = null; + storeAdvancedThemeColorOptList = null; + resultsAdvanceThemes = dispatcher.runSync("retrieveAdvancedThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]); + if(resultsAdvanceThemes){ + storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList"); + storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList"); + context.put("storeAdvanceThemeOptList",storeAdvanceThemes); + context.put("storeAdvancedThemeColorOptList",storeAdvancedThemeColorOptList); + + if(storeThemeId!=null && storeAdvanceThemes!=null){ + storeAdvanceThemes.each { storeAdvanceTheme -> + if(storeThemeId == storeAdvanceTheme.storeThemeId){ + flag = "Advanced"; + } + } + } + } + resultsFontTheme = dispatcher.runSync("retrieveStoreFontTheme",["productStoreId":productStoreId, "userLogin": userLogin]); + if(resultsFontTheme){ + storeFontTheme = resultsFontTheme.get("advanceFontTheme"); + context.put("storeFontTheme",storeFontTheme); + } + context.put("themeType",flag); + +} Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy Wed Feb 3 03:16:07 2010 @@ -0,0 +1,90 @@ +/* + * 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.base.util.*; +import javolution.util.FastList; +import javolution.util.FastMap; + + + +results = FastList.newInstance(); +ebayAccountList = delegator.findByAnd("PartyRoleAndPartyDetail",["roleTypeId":"EBAY_ACCOUNT"]); +productStoreRoles = delegator.findByAnd("ProductStoreRole",["roleTypeId":"EBAY_ACCOUNT"]); + +if(productStoreRoles!=null && ebayAccountList != null){ + ebayAccountList.each{ebayAccount-> + partyId = ebayAccount.partyId; + productStoreRoles.each{productStoreRole -> + if(partyId.equals(productStoreRole.partyId)){ + storeMap = FastMap.newInstance(); + storeMap.partyId = ebayAccount.partyId; + storeMap.firstName = ebayAccount.firstName; + storeMap.lastName = ebayAccount.lastName; + storeMap.productStoreId = productStoreRole.productStoreId; + results.add(storeMap); + } + } + } + context.put("stores",results); +} +/* + * 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.base.util.*; +import javolution.util.FastList; +import javolution.util.FastMap; + + + +results = FastList.newInstance(); +ebayAccountList = delegator.findByAnd("PartyRoleAndPartyDetail",["roleTypeId":"EBAY_ACCOUNT"]); +productStoreRoles = delegator.findByAnd("ProductStoreRole",["roleTypeId":"EBAY_ACCOUNT"]); + +if(productStoreRoles!=null && ebayAccountList != null){ + ebayAccountList.each{ebayAccount-> + partyId = ebayAccount.partyId; + productStoreRoles.each{productStoreRole -> + if(partyId.equals(productStoreRole.partyId)){ + storeMap = FastMap.newInstance(); + storeMap.partyId = ebayAccount.partyId; + storeMap.firstName = ebayAccount.firstName; + storeMap.lastName = ebayAccount.lastName; + storeMap.productStoreId = productStoreRole.productStoreId; + results.add(storeMap); + } + } + } + context.put("stores",results); +} Modified: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml?rev=905876&r1=905875&r2=905876&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Wed Feb 3 03:16:07 2010 @@ -21,6 +21,7 @@ + eBay Component Site Configuration File @@ -28,9 +29,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl Wed Feb 3 03:16:07 2010 @@ -0,0 +1,538 @@ +<#-- +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. +--> +<#if results.itemsAwaitingFeedback?has_content> + +
+ + + + + + + + + <#assign row = "alternate-row"> + <#assign FeedbackSize = 0> + <#assign feedbackCounter = 0> + <#assign role = ""> + <#if parameters.role?has_content> + <#assign role = parameters.role> + + <#list results.itemsAwaitingFeedback as leaveFeedback> + <#if !leaveFeedback.commentType?has_content> + <#if parameters.role?has_content && parameters.transactionId?has_content && parameters.targetUser?has_content && parameters.commentingUser?has_content> + <#if parameters.transactionId == leaveFeedback.transactionID && parameters.itemId == leaveFeedback.itemID> + <#if role == "buyer"> + <#assign feedbackCounter = feedbackCounter + 1> + <#if row == ""> + <#assign row = "alternate-row"> + <#else> + <#assign row = ""> + + + + + + + + + + + + <#else> + <#assign feedbackCounter = feedbackCounter + 1> + <#if row == ""> + <#assign row = "alternate-row"> + <#else> + <#assign row = ""> + + + + + + + + + + + + + + <#elseif role=="buyer"> + <#if leaveFeedback.role == "buyer"> + <#assign feedbackCounter = feedbackCounter + 1> + <#if row == ""> + <#assign row = "alternate-row"> + <#else> + <#assign row = ""> + + + + + + + + + + + + + <#elseif role == "seller"> + <#if leaveFeedback.role == "seller"> + <#assign feedbackCounter = feedbackCounter + 1> + <#if row == ""> + <#assign row = "alternate-row"> + <#else> + <#assign row = ""> + + + + + + + + + + + + + <#else> + <#assign feedbackCounter = feedbackCounter + 1> + <#if row == ""> + <#assign row = "alternate-row"> + <#else> + <#assign row = ""> + + + + + + + + + + + + + + + +
ItemRate this transactionRole
+ ${leaveFeedback.itemID} - ${leaveFeedback.title} + order details + + Positive + I'll leave Feedback later + + + Buyer:${leaveFeedback.userID} +
+ ${leaveFeedback.itemID} - ${leaveFeedback.title} + order details + + Positive + Neutral + Negative + I'll leave Feedback later + + + Seller:${leaveFeedback.userID} +
+ ${leaveFeedback.itemID}]${leaveFeedback.title} + order details + + Positive + I'll leave Feedback later + + + Buyer:${leaveFeedback.userID} +
+ ${leaveFeedback.itemID} - ${leaveFeedback.title} + order details + + Positive + Neutral + Negative + I'll leave Feedback later + + + Seller:${leaveFeedback.userID} +
+ ${leaveFeedback.itemID} - ${leaveFeedback.title} + order details + + <#if leaveFeedback.role == "seller"> + Positive + Neutral + Negative + I'll leave Feedback later + <#else> + Positive + I'll leave Feedback later + + <#if leaveFeedback.role == "seller"> + + <#else> + + + + <#if leaveFeedback.role == "buyer"> + Buyer:${leaveFeedback.userID} + <#else> + Seller:${leaveFeedback.userID} + +
+
+ + +
+<#else> +No Leave Feedback. + \ No newline at end of file