Author: hansbak
Date: Mon May 30 02:58:31 2011 New Revision: 1128983 URL: http://svn.apache.org/viewvc?rev=1128983&view=rev Log: add jquery category tree only showing categories which have a related product or have a related category with a product. It has been tested in IE too. The showing of products from the tree is now using ajax and is only updating the middle of the screen. A contributution of Antwebsystems employee Oat Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy (with props) ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy (with props) ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl (with props) ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl (with props) Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml ofbiz/trunk/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ecommerce/widget/CartScreens.xml ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl Mon May 30 02:58:31 2011 @@ -16,27 +16,58 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> +<script type="text/javascript"> + function callDocumentByPaginate(info) { + var str = info.split('~'); + var checkUrl = '<@ofbizUrl>categoryAjaxFired</@ofbizUrl>'; + if(checkUrl.search("http")) + var ajaxUrl = '<@ofbizUrl>categoryAjaxFired</@ofbizUrl>'; + else + var ajaxUrl = '<@ofbizUrl>categoryAjaxFiredSecure</@ofbizUrl>'; + + //jQuerry Ajax Request + jQuery.ajax({ + url: ajaxUrl, + type: 'POST', + data: {"category_id" : str[0], "VIEW_SIZE" : str[1], "VIEW_INDEX" : str[2]}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#div3').html(msg); + } + }); + } +</script> <#macro paginationControls> <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)> <#if (viewIndexMax?int > 0)> <div class="product-prevnext"> <#-- Start Page Select Drop-Down --> - <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;"> + <#-- select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;"> <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option> <#list 0..viewIndexMax as curViewNum> <option value="<@ofbizCatalogAltUrl productCategoryId=productCategoryId viewSize=viewSize viewIndex=(curViewNum?int + 1)/>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option> </#list> + </select --> + <select name="pageSelect" onchange="callDocumentByPaginate(this[this.selectedIndex].value);"> + <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option> + <#list 0..viewIndexMax as curViewNum> + <option value="${productCategoryId}~${viewSize}~${curViewNum?int + 1}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option> + </#list> </select> <#-- End Page Select Drop-Down --> <#if (viewIndex?int > 1)> - <a href="<@ofbizCatalogAltUrl productCategoryId=productCategoryId viewSize=viewSize viewIndex=(viewIndex?int - 1)/>" class="buttontext">${uiLabelMap.CommonPrevious}</a> | + <#-- a href="<@ofbizUrl>category/~category_id=${productCategoryId}/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a --> | + <a href="javascript: void(0);" onclick="callDocumentByPaginate('${productCategoryId}~${viewSize}~${viewIndex?int - 1}');" class="buttontext">${uiLabelMap.CommonPrevious}</a> | </#if> <#if ((listSize?int - viewSize?int) > 0)> <span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span> </#if> <#if highIndex?int < listSize?int> - | <a href="<@ofbizCatalogAltUrl productCategoryId=productCategoryId viewSize=viewSize viewIndex=(viewIndex?int + 1)/>" class="buttontext">${uiLabelMap.CommonNext}</a> + <#-- | <a href="<@ofbizUrl>category/~category_id=${productCategoryId}/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int + 1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a --> + | <a href="javascript: void(0);" onclick="callDocumentByPaginate('${productCategoryId}~${viewSize}~${viewIndex?int + 1}');" class="buttontext">${uiLabelMap.CommonNext}</a> </#if> </div> </#if> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl Mon May 30 02:58:31 2011 @@ -114,6 +114,7 @@ ${virtualJavaScript?if_exists} <input type="hidden" name="add_product_id" value="${product.productId}"/> <input type="text" size="5" name="quantity" value="1"/> <input type="hidden" name="clearSearch" value="N"/> + <input type="hidden" name="mainSubmited" value="Y"/> <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}form.submit()" class="buttontext">${uiLabelMap.OrderAddToCart}</a> <#if mainProducts?has_content> <input type="hidden" name="product_id" value=""/> @@ -131,14 +132,22 @@ ${virtualJavaScript?if_exists} </form> <#if prodCatMem?exists && prodCatMem.quantity?exists && 0.00 < prodCatMem.quantity?double> + <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform" style="margin: 0;"> + <input type="hidden" name="add_product_id" value="${prodCatMem.productId?if_exists}"/> + <input type="hidden" name="quantity" value="${prodCatMem.quantity?if_exists}"/> + <input type="hidden" name="clearSearch" value="N"/> + <input type="hidden" name="mainSubmited" value="Y"/> + <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()" class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number}) ${uiLabelMap.OrderToCart}</a> + </form> <#assign productCategory = delegator.findByPrimaryKey("ProductCategory", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", prodCatMem.productCategoryId))/> <#if productCategory.productCategoryTypeId != "BEST_SELL_CATEGORY"> - <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform" style="margin: 0;"> - <input type="hidden" name="add_product_id" value="${prodCatMem.productId?if_exists}"/> - <input type="hidden" name="quantity" value="${prodCatMem.quantity?if_exists}"/> - <input type="hidden" name="clearSearch" value="N"/> - <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()" class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number}) ${uiLabelMap.OrderToCart}</a> - </form> + <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform" style="margin: 0;"> + <input type="hidden" name="add_product_id" value="${prodCatMem.productId?if_exists}"/> + <input type="hidden" name="quantity" value="${prodCatMem.quantity?if_exists}"/> + <input type="hidden" name="clearSearch" value="N"/> + <input type="hidden" name="mainSubmited" value="Y"/> + <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()" class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number}) ${uiLabelMap.OrderToCart}</a> + </form> </#if> </#if> </#if> @@ -210,6 +219,7 @@ ${virtualJavaScript?if_exists} </#if> <form method="post" action="<@ofbizUrl secure="${request.isSecure()?string}">addToCompare</@ofbizUrl>" name="addToCompare${requestAttributes.listIndex?if_exists}form"> <input type="hidden" name="productId" value="${product.productId}"/> + <input type="hidden" name="mainSubmited" value="Y"/> </form> <a href="javascript:document.addToCompare${requestAttributes.listIndex?if_exists}form.submit()" class="buttontext">${uiLabelMap.ProductAddToCompare}</a> </div> Modified: ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml Mon May 30 02:58:31 2011 @@ -4729,4 +4729,7 @@ <value xml:lang="zh">æµè§è¯¢ä»·</value> <value xml:lang="zh_TW">çè¦½å ±å¹</value> </property> + <property key="ProductCategories"> + <value xml:lang="en">Product Categories</value> + </property> </resource> Modified: ofbiz/trunk/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml Mon May 30 02:58:31 2011 @@ -128,5 +128,8 @@ under the License. </call-service> </simple-method> - + <simple-method method-name="addCheckValue" short-description="Add field to request for investigation purpose" login-required="false"> + <set field="checkValue" value="check" type="PlainString"/> + <field-to-request field="checkValue" request-name="checkValue"/> + </simple-method> </simple-methods> Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy?rev=1128983&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy (added) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy Mon May 30 02:58:31 2011 @@ -0,0 +1,97 @@ +/* + * 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. + */ + +/* + * This script is also referenced by the ecommerce's screens and + * should not contain order component's specific code. + */ +import org.ofbiz.entity.util.EntityUtil; + +import org.ofbiz.base.util.*; +import org.ofbiz.product.catalog.*; +import org.ofbiz.product.category.*; +import javolution.util.FastMap; +import javolution.util.FastList; +import javolution.util.FastList.*; +import org.ofbiz.entity.*; + +List fillTree(rootCat ,CatLvl, parentCategoryId) { + if(rootCat) { + rootCat.sort{ it.productCategoryId } + def listTree = FastList.newInstance(); + for(root in rootCat) { + preCatChilds = delegator.findByAnd("ProductCategoryRollup", ["parentProductCategoryId": root.productCategoryId]); + catChilds = EntityUtil.getRelated("CurrentProductCategory",preCatChilds); + def childList = FastList.newInstance(); + + // CatLvl uses for identify the Category level for display different css class + if(catChilds) { + if(CatLvl==2) + childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId); + // replaceAll and '/' uses for fix bug in the breadcrum for href of category + else if(CatLvl==1) + childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId); + else + childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId); + } + + productsInCat = delegator.findByAnd("ProductCategoryAndMember", ["productCategoryId": root.productCategoryId]); + + // Display the category if this category containing products or contain the category that's containing products + if(productsInCat || childList) { + def rootMap = FastMap.newInstance(); + category = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId": root.productCategoryId]); + categoryContentWrapper = new CategoryContentWrapper(category, request); + context.title = categoryContentWrapper.CATEGORY_NAME; + categoryDescription = categoryContentWrapper.DESCRIPTION; + + if(categoryContentWrapper.CATEGORY_NAME) + rootMap["categoryName"] = categoryContentWrapper.CATEGORY_NAME; + else + rootMap["categoryName"] = root.categoryName; + + if(categoryContentWrapper.DESCRIPTION) + rootMap["categoryDescription"] = categoryContentWrapper.DESCRIPTION; + else + rootMap["categoryDescription"] = root.description; + + rootMap["productCategoryId"] = root.productCategoryId; + rootMap["parentCategoryId"] = parentCategoryId; + rootMap["child"] = childList; + + listTree.add(rootMap); + } + } + return listTree; + } +} + +CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true); +curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: ""; +request.setAttribute("curCategoryId", curCategoryId); +CategoryWorker.setTrail(request, curCategoryId); + +categoryList = request.getAttribute("topLevelList"); +if (categoryList) { + catContentWrappers = FastMap.newInstance(); + CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request); + context.catContentWrappers = catContentWrappers; + completedTree = fillTree(categoryList,1,""); + context.completedTree = completedTree; +} Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy?rev=1128983&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy (added) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy Mon May 30 02:58:31 2011 @@ -0,0 +1,51 @@ +/* + * 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.product.product.ProductContentWrapper; +import org.ofbiz.product.category.*; +import javolution.util.FastMap; +import javolution.util.FastList; +import org.ofbiz.base.util.UtilValidate; + +parentCategoryStr = parameters.parentCategoryStr; +if(!UtilValidate.isEmpty(parentCategoryStr)) { + pathList = parentCategoryStr.split('/'); + cateList = FastList.newInstance(); + pathTemp = ''; + for(path in pathList) { + cateMap = FastMap.newInstance(); + category = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId": path]); + categoryContentWrapper = new CategoryContentWrapper(category, request); + + pathTemp = pathTemp + path; + cateMap.title = categoryContentWrapper.CATEGORY_NAME; + cateMap.productCategoryId = category.productCategoryId; + cateMap.parentCategory = pathTemp; + + cateList.add(cateMap); + + pathTemp = pathTemp + '/'; + } + + context.productCategoryTrail = cateList; +} +currentCategory = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId": productCategoryId]); +currentCategoryContentWrapper = new CategoryContentWrapper(currentCategory, request); +context.currentCategoryName = currentCategoryContentWrapper.CATEGORY_NAME; +context.currentCategoryDescription = currentCategoryContentWrapper.DESCRIPTION; +context.currentCategoryId = productCategoryId; Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Mon May 30 02:58:31 2011 @@ -136,7 +136,7 @@ under the License. <request-map uri="setSessionLocale"> <security https="false" auth="false"/> <event type="java" path="org.ofbiz.common.CommonEvents" invoke="setSessionLocale"/> - <response name="success" type="view-last" value="main"/> + <response name="success" type="request-redirect" value="checkValue"/> <response name="error" type="view" value="main"/> </request-map> @@ -859,7 +859,7 @@ under the License. </request-map> <request-map uri="product"> <security https="false" auth="false"/> - <response name="success" type="view" value="product"/> + <response name="success" type="view" value="product" save-current-view="true"/> </request-map> <request-map uri="detailImage"> <security https="false" auth="false"/> @@ -1949,6 +1949,28 @@ under the License. <response name="success" type="view" value="reloadCaptchaCode"/> </request-map> + <request-map uri="productCategoryList"> + <security https="false" auth="false"/> + <response name="success" type="view" value="productCategoryList" save-current-view="true"/> + </request-map> + <request-map uri="productCategoryListSecure"> + <security https="true" auth="false"/> + <response name="success" type="view" value="productCategoryList" save-current-view="true"/> + </request-map> + <request-map uri="categoryAjaxFired"> + <security https="false" auth="false"/> + <response name="success" type="view" value="productCategoryList" save-current-view="true"/> + </request-map> + <request-map uri="categoryAjaxFiredSecure"> + <security https="true" auth="false"/> + <response name="success" type="view" value="productCategoryList" save-current-view="true"/> + </request-map> + <request-map uri="checkValue"> + <event type="simple" path="component://ecommerce/script/org/ofbiz/ecommerce/misc/AffiliateSimpleEvents.xml" invoke="addCheckValue"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="view" value="main"/> + </request-map> + <!-- End of Request Mappings --> <!-- View Mappings --> @@ -2101,5 +2123,9 @@ under the License. <!-- Captcha --> <view-map name="reloadCaptchaImage" type="screen" page="component://myportal/widget/CommonScreens.xml#reloadCaptchaImage"/> <view-map name="reloadCaptchaCode" type="screen" page="component://myportal/widget/CommonScreens.xml#reloadCaptchaCode"/> + + <!-- Product Category 's Ajax --> + <view-map name="productCategoryList" type="screen" page="component://ecommerce/widget/CatalogScreens.xml#productCategoryList"/> + <!-- End of View Mappings --> </site-conf> Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl?rev=1128983&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl (added) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl Mon May 30 02:58:31 2011 @@ -0,0 +1,205 @@ +<#-- + 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 language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script> +<script type="text/javascript" src="<@ofbizContentUrl>/images/jquery/ui/development-bundle/external/jquery.cookie.js</@ofbizContentUrl>"></script> + +<script type="text/javascript"> +<#-- some labels are not unescaped in the JSON object so we have to do this manuely --> +function unescapeHtmlText(text) { + return jQuery('<div />').html(text).text() +} + +jQuery(window).load(createTree()); + +<#-- creating the JSON Data --> +var rawdata = [ + <#if (requestAttributes.topLevelList)?exists> + <#assign topLevelList = requestAttributes.topLevelList> + </#if> + <#if (topLevelList?has_content)> + <@fillTree rootCat=completedTree/> + </#if> + + <#macro fillTree rootCat> + <#if (rootCat?has_content)> + <#list rootCat?sort_by("productCategoryId") as root> + { + "data": {"title" : unescapeHtmlText("<#if root.categoryName?exists>${root.categoryName?js_string}<#elseif root.categoryDescription?exists>${root.categoryDescription?js_string}<#else>${root.productCategoryId?js_string}</#if>"), "attr": { "href":"javascript: void(0);", "onClick":"callDocument('${root.productCategoryId}', '${root.parentCategoryId}')" , "class" : "${root.cssClass?if_exists}"}}, + "attr": {"id" : "${root.productCategoryId}"} + <#if root.child?has_content> + ,"children": [ + <@fillTree rootCat=root.child/> + ] + </#if> + <#if root_has_next> + }, + <#else> + } + </#if> + </#list> + </#if> +</#macro> + ]; + + <#-------------------------------------------------------------------------------------define Requests--> + var editDocumentTreeUrl = '<@ofbizUrl>/views/EditDocumentTree</@ofbizUrl>'; + var listDocument = '<@ofbizUrl>/views/ListDocument</@ofbizUrl>'; + var editDocumentUrl = '<@ofbizUrl>/views/EditDocument</@ofbizUrl>'; + var deleteDocumentUrl = '<@ofbizUrl>removeDocumentFromTree</@ofbizUrl>'; + + <#-------------------------------------------------------------------------------------create Tree--> + function createTree() { + jQuery(function () { + jQuery("#tree").jstree({ + "themes" : { + "theme" : "classic", + "icons" : false + }, + "cookies" : { + "cookie_options" : {path: '/'} + }, + "plugins" : [ "themes", "json_data", "cookies"], + "json_data" : { + "data" : rawdata + } + }); + }); + } + +<#-------------------------------------------------------------------------------------callDocument function--> + function callDocument(id, parentCategoryStr) { + var checkUrl = '<@ofbizUrl>productCategoryList</@ofbizUrl>'; + if(checkUrl.search("http")) + var ajaxUrl = '<@ofbizUrl>productCategoryList</@ofbizUrl>'; + else + var ajaxUrl = '<@ofbizUrl>productCategoryListSecure</@ofbizUrl>'; + + //jQuerry Ajax Request + jQuery.ajax({ + url: ajaxUrl, + type: 'POST', + data: {"category_id" : id, "parentCategoryStr" : parentCategoryStr}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#div3').html(msg); + } + }); + } +<#-------------------------------------------------------------------------------------callCreateDocumentTree function--> + function callCreateDocumentTree(contentId) { + jQuery.ajax({ + url: editDocumentTreeUrl, + type: 'POST', + data: {contentId: contentId, + contentAssocTypeId: 'TREE_CHILD'}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#Document').html(msg); + } + }); + } +<#-------------------------------------------------------------------------------------callCreateSection function--> + function callCreateDocument(contentId) { + jQuery.ajax({ + url: editDocumentUrl, + type: 'POST', + data: {contentId: contentId}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#Document').html(msg); + } + }); + } +<#-------------------------------------------------------------------------------------callEditSection function--> + function callEditDocument(contentIdTo) { + jQuery.ajax({ + url: editDocumentUrl, + type: 'POST', + data: {contentIdTo: contentIdTo}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#Document').html(msg); + } + }); + + } +<#-------------------------------------------------------------------------------------callDeleteItem function--> + function callDeleteDocument(contentId, contentIdTo, contentAssocTypeId, fromDate) { + jQuery.ajax({ + url: deleteDocumentUrl, + type: 'POST', + data: {contentId : contentId, contentIdTo : contentIdTo, contentAssocTypeId : contentAssocTypeId, fromDate : fromDate}, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + location.reload(); + } + }); + } + <#-------------------------------------------------------------------------------------callRename function--> + function callRenameDocumentTree(contentId) { + jQuery.ajax({ + url: editDocumentTreeUrl, + type: 'POST', + data: { contentId: contentId, + contentAssocTypeId:'TREE_CHILD', + rename: 'Y' + }, + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#Document').html(msg); + } + }); + } + <#------------------------------------------------------pagination function --> + function nextPrevDocumentList(url){ + url= '<@ofbizUrl>'+url+'</@ofbizUrl>'; + jQuery.ajax({ + url: url, + type: 'POST', + error: function(msg) { + alert("An error occured loading content! : " + msg); + }, + success: function(msg) { + jQuery('#Document').html(msg); + } + }); + } + +</script> + + + + +<div id="quickadd" class="screenlet"> + <h3>${uiLabelMap.ProductCategories}</h3> + <div class="screenlet-body" id="tree"> + </div> +</div> Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl?rev=1128983&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl (added) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl Mon May 30 02:58:31 2011 @@ -0,0 +1,57 @@ +<#-- +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. +--> + +<div class="breadcrumbs"> + <ul> + <li> + <a href="<@ofbizUrl>main</@ofbizUrl>" class="linktext">${uiLabelMap.CommonMain}</a> + </li> + <#-- Show the category branch --> + <#if productCategoryTrail?exists> + <#list productCategoryTrail as trail> + <li> + <a href="<@ofbizCatalogUrl currentCategoryId=trail.productCategoryId previousCategoryId=trail.parentCategory/>" class="linktext"> + <#if trail.title?exists> + ${trail.title} + <#else> + ${trail.productCategoryId} + </#if> + </a> + </li> + </#list> + </#if> + <li> + <a href="<@ofbizCatalogUrl currentCategoryId=currentCategoryId previousCategoryId=parameters.parentCategoryStr/>" class="linktext"> + <#if currentCategoryName?exists> + ${currentCategoryName} + <#elseif currentCategoryDescription?exists> + ${currentCategoryDescription} + <#else> + ${currentCategoryId} + </#if> + </a> + </li> + <#-- Show the product, if there is one --> + <#if productContentWrapper?exists> + <li>${productContentWrapper.get("PRODUCT_NAME")?if_exists}</li> + </#if> + </ul> +</div> +<br /> + Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CartScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CartScreens.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/widget/CartScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CartScreens.xml Mon May 30 02:58:31 2011 @@ -65,7 +65,8 @@ under the License. <section> <actions> <set field="leftbarScreenName" value="leftbar"/> - <set field="MainColumnStyle" value="leftonly"/> + <set field="MainColumnStyle" value="center"/> + <!--set field="MainColumnStyle" value="leftonly"/--> <set field="titleProperty" value="PageTitleShoppingCart"/> <set field="headerItem" value="Shopping Cart"/> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml Mon May 30 02:58:31 2011 @@ -168,6 +168,7 @@ under the License. <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/LayeredNavigation.groovy"/> <set field="detailScreen" value="LayeredCategoryDetail"/> --> + <set field="tabButtonItem" value="LookupProductCategories"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> @@ -488,4 +489,73 @@ under the License. </widgets> </section> </screen> + <screen name="productCatagories"> + <section> + <actions> + <set field="tabButtonItem" value="LookupProductCategories"/> + + <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy"/> + </actions> + <widgets> + <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/catalog/ProductCategories.ftl"/></html></platform-specific> + </widgets> + </section> + </screen> + <screen name="productCategoryList"> + <section> + <condition> + <if-empty field="parameters.mainSubmited"/> + </condition> + <actions> + <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> + <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/> + <set field="check" type="PlainString" value="${groovy: return request.getAttribute('checkValue');}"/> + </actions> + <widgets> + <section> + <condition> + <if-compare operator="equals" value="check" field="check" type="PlainString"/> + </condition> + <widgets> + <include-screen name="category"/> + </widgets> + <fail-widgets> + <section> + <condition> + <if-empty field="category_id"/> + </condition> + <widgets> + <include-screen name="newbreadcrumbs" share-scope="true"/> + </widgets> + <fail-widgets> + <include-screen name="breadcrumbs" share-scope="true"/> + </fail-widgets> + </section> + <include-screen name="category-include" share-scope="true"/> + </fail-widgets> + </section> + </widgets> + <fail-widgets> + <section> + <widgets> + <include-screen name="category"/> + </widgets> + </section> + </fail-widgets> + </section> + </screen> + <screen name="newbreadcrumbs"> + <section> + <actions> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> + <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ajaxbreadcrumbs.groovy"/> + </actions> + <widgets> + <platform-specific> + <html><html-template location="component://ecommerce/webapp/ecommerce/catalog/ajaxbreadcrumbs.ftl"/></html> + </platform-specific> + </widgets> + </section> + </screen> </screens> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1128983&r1=1128982&r2=1128983&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Mon May 30 02:58:31 2011 @@ -103,7 +103,8 @@ under the License. <widgets> <include-screen name="choosecatalog" location="component://ecommerce/widget/CatalogScreens.xml"/> <include-screen name="keywordsearchbox" location="component://ecommerce/widget/CatalogScreens.xml"/> - <include-screen name="sidedeepcategory" location="component://ecommerce/widget/CatalogScreens.xml"/> + <!--include-screen name="sidedeepcategory" location="component://ecommerce/widget/CatalogScreens.xml"/--> + <include-screen name="productCatagories" location="component://ecommerce/widget/CatalogScreens.xml"/> <include-screen name="LayeredNavBar" location="component://ecommerce/widget/CatalogScreens.xml"/> <include-screen name="minireorderprods" location="component://ecommerce/widget/CatalogScreens.xml"/> <include-screen name="signupforcontactlist" location="component://ecommerce/widget/EmailContactListScreens.xml"/> |
Free forum by Nabble | Edit this page |