Administrator
|
Hi Hans,
I did not have time to review, but could it be the reason we have squares instead of letters on trunk demo (lang=en)? Thanks Jacques [hidden email] wrote: > Author: hansbak > Date: Wed Mar 16 03:39:49 2011 > New Revision: 1082041 > > URL: http://svn.apache.org/viewvc?rev=1082041&view=rev > Log: > a new version of the category tree, will now display in IE and blankscreen mostly gone....not perfect yet, we will probably make > the left column about 50% wider in the next version > > Added: > ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (with props) > Modified: > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1082041&r1=1082040&r2=1082041&view=diff > ============================================================================== --- > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Wed Mar 16 03:39:49 2011 @@ -18,14 +18,22 @@ > *******************************************************************************/ > package org.ofbiz.product.category; > > +import java.io.IOException; > +import java.io.UnsupportedEncodingException; > +import java.io.Writer; > import java.sql.Timestamp; > 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 net.sf.json.JSONObject; > + > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.UtilDateTime; > import org.ofbiz.base.util.UtilGenerics; > @@ -391,4 +399,116 @@ public class CategoryServices { > if (productCategoryMembers != null) result.put("productCategoryMembers", productCategoryMembers); > return result; > } > + > + // Please note : the structure of map in this function is according to the JSON data map of the jsTree > + @SuppressWarnings("unchecked") > + public static void getChildCategoryTree(HttpServletRequest request, HttpServletResponse response){ > + Delegator delegator = (Delegator) request.getAttribute("delegator"); > + String productCategoryId = request.getParameter("productCategoryId"); > + String isCatalog = request.getParameter("isCatalog"); > + String entityName = null; > + String primaryKeyName = null; > + > + if (isCatalog.equals("true")) { > + entityName = "ProdCatalog"; > + primaryKeyName = "prodCatalogId"; > + } else { > + entityName = "ProductCategory"; > + primaryKeyName = "productCategoryId"; > + } > + > + List categoryList = FastList.newInstance(); > + List<GenericValue> childOfCats; > + > + try { > + GenericValue category = delegator.findByPrimaryKey(entityName ,UtilMisc.toMap(primaryKeyName, productCategoryId)); > + if (UtilValidate.isNotEmpty(category)) { > + if (isCatalog.equals("true")) { > + CategoryWorker.getRelatedCategories(request, "ChildCatalogList", > CatalogWorker.getCatalogTopCategoryId(request, productCategoryId), true); + childOfCats = (List<GenericValue>) > request.getAttribute("ChildCatalogList"); + } else { > + childOfCats = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( > + "parentProductCategoryId", productCategoryId )); > + } > + if (UtilValidate.isNotEmpty(childOfCats)) { > + for (GenericValue childOfCat : childOfCats ) { > + > + Object catId = null; > + String catNameField = null; > + > + catId = childOfCat.get("productCategoryId"); > + catNameField = "CATEGORY_NAME"; > + > + Map josonMap = FastMap.newInstance(); > + List<GenericValue> childList = null; > + > + // Get the child list of chosen category > + childList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( > + "parentProductCategoryId", catId)); > + > + // Get the chosen category information for the categoryContentWrapper > + GenericValue cate = delegator.findByPrimaryKey("ProductCategory" > ,UtilMisc.toMap("productCategoryId",catId)); + > + // If chosen category's child exists, then put the arrow before category icon > + if (UtilValidate.isNotEmpty(childList)) { > + josonMap.put("state", "closed"); > + } > + Map dataMap = FastMap.newInstance(); > + Map dataAttrMap = FastMap.newInstance(); > + CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(cate, request); > + > + if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField))) { > + dataMap.put("title", categoryContentWrapper.get(catNameField)+"["+catId+"]"); > + } else { > + dataMap.put("title", catId); > + } > + dataAttrMap.put("onClick","window.location.href='EditCategory?productCategoryId="+catId+"'; return > false;"); + > + dataMap.put("attr", dataAttrMap); > + josonMap.put("data", dataMap); > + Map attrMap = FastMap.newInstance(); > + attrMap.put("id", catId); > + attrMap.put("isCatalog", false); > + attrMap.put("rel", "CATEGORY"); > + josonMap.put("attr",attrMap); > + > + categoryList.add(josonMap); > + } > + toJsonObjectList(categoryList,response); > + } > + } > + } catch (GenericEntityException e) { > + e.printStackTrace(); > + } > + } > + > + @SuppressWarnings("unchecked") > + public static void toJsonObjectList(List attrList, HttpServletResponse response){ > + String jsonStr = "["; > + for (Object attrMap : attrList) { > + JSONObject json = JSONObject.fromObject(attrMap); > + jsonStr = jsonStr + json.toString() + ','; > + } > + jsonStr = jsonStr + "{ } ]"; > + if (UtilValidate.isEmpty(jsonStr)) { > + Debug.logError("JSON Object was empty; fatal error!",module); > + } > + // set the X-JSON content type > + response.setContentType("application/json"); > + // jsonStr.length is not reliable for unicode characters > + try { > + response.setContentLength(jsonStr.getBytes("UTF8").length); > + } catch (UnsupportedEncodingException e) { > + Debug.logError("Problems with Json encoding",module); > + } > + // return the JSON String > + Writer out; > + try { > + out = response.getWriter(); > + out.write(jsonStr); > + out.flush(); > + } catch (IOException e) { > + Debug.logError("Unable to get response writer",module); > + } > + } > } > > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy?rev=1082041&r1=1082040&r2=1082041&view=diff > ============================================================================== --- > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy (original) +++ > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy Wed Mar 16 03:39:49 2011 @@ -17,56 > +17,103 @@ > * 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 org.ofbiz.entity.GenericValue; > import javolution.util.FastMap; > import javolution.util.FastList; > -import org.ofbiz.base.util.UtilMisc; > -import org.ofbiz.base.util.UtilValidate; > -import org.ofbiz.entity.GenericValue; > -import org.ofbiz.entity.util.EntityUtil; > -import javax.servlet.http.HttpSession; > +import javolution.util.FastList.*; > +import org.ofbiz.entity.*; > +import java.util.List; > + > +// Put the result of CategoryWorker.getRelatedCategories into the fillTree function as attribute. > +// The fillTree function will return the complete list of category of given catalog. > +// PLEASE NOTE : The structure of the complete list of fillTree function is according to the JSON_DATA plugin of the jsTree. > + > +List fillTree(rootCat) { > + 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(); > + 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["child"] = catChilds; > + rootMap["isCatalog"] = false; > + listTree.add(rootMap); > + > + } > + return listTree; > + } > +} > + > +completedTree = FastList.newInstance(); > > -prodCatalogList = FastList.newInstance(); > +// Get the Catalogs > prodCatalogs = delegator.findByAnd("ProdCatalog"); > + > if (prodCatalogs.size() > 0) { > for (i = 0; i < prodCatalogs.size(); i++) { > > prodCatalogMap = FastMap.newInstance(); > prodCatalog = prodCatalogs[i]; > prodCatalogId = prodCatalog.getString("prodCatalogId"); > - prodCatalogMap.put("prodCatalogId", prodCatalogId); > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); > - > - //root category list of the catalog > - prodCategoryList = CatalogWorker.getProdCatalogCategories(request, prodCatalogId, null); > - rootCategoryList = FastList.newInstance(); > - if (prodCategoryList.size() > 0) { > - for (j = 0; j < prodCategoryList.size(); j++) { > - prodCategory = prodCategoryList[j]; > - rootCategory = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId" : > prodCategory.getString("productCategoryId")]); > - rootCategoryList.add(rootCategory); > - } > - } > - > - if (rootCategoryList) { > - prodCatalogMap.put("rootCategoryList", rootCategoryList); > - prodCatalogList.add(prodCatalogMap); > + prodCatalogMap.put("productCategoryId", prodCatalogId); > + prodCatalogMap.put("categoryName", prodCatalog.getString("catalogName")); > + prodCatalogMap.put("isCatalog", true); > + > + CategoryWorker.getRelatedCategories(request, "CatalogList_"+i, CatalogWorker.getCatalogTopCategoryId(request, > prodCatalogId), true); + categoryList = null; > + categoryList = request.getAttribute("CatalogList_"+i); > + prodCatalogTree = FastList.newInstance(); > + > + if (categoryList) { > + prodCatalogTree = fillTree(categoryList); > + prodCatalogMap.put("child", prodCatalogTree); > + completedTree.add(prodCatalogMap); > } > } > } > +// The complete tree list for the category tree > +context.completedTree = completedTree; > > -context.prodCatalogList = prodCatalogList; > - > -openTree = false; > +stillInCatalogManager = true; > productCategoryId = null; > +prodCatalogId = null; > +showProductCategoryId = null; > + > +// Reset tree condition check. Are we still in the Catalog Manager ?. If not , then reset the tree. > if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) { > - openTree = true; > - productCategoryId = (parameters.productCategoryId != null) ? parameters.productCategoryId : parameters.showProductCategoryId; > + stillInCatalogManager = false; > + productCategoryId = parameters.productCategoryId; > + showProductCategoryId = parameters.showProductCategoryId; > +} else if (parameters.prodCatalogId != null) { > + stillInCatalogManager = false; > + prodCatalogId = parameters.prodCatalogId; > } > - > -context.openTree = openTree; > +context.stillInCatalogManager = stillInCatalogManager; > context.productCategoryId = productCategoryId; > +context.prodCatalogId = prodCatalogId; > +context.showProductCategoryId = showProductCategoryId; > > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1082041&r1=1082040&r2=1082041&view=diff > ============================================================================== --- > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Wed Mar 16 03:39:49 2011 @@ -3076,6 +3076,12 @@ under the > License. <response name="error" type="view" value="EditProductPromoContent"/> > </request-map> > > + <request-map uri="getChild"> > + <security auth="false" https="true"/> > + <event type="java" path="org.ofbiz.product.category.CategoryServices" invoke="getChildCategoryTree"/> > + <response name="success" type="none"/> > + </request-map> > + > <!-- View Mappings --> > <view-map name="main" type="screen" page="component://product/widget/catalog/CommonScreens.xml#main"/> > > > Modified: ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl?rev=1082041&r1=1082040&r2=1082041&view=diff > ============================================================================== --- > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl (original) +++ > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl Wed Mar 16 03:39:49 2011 @@ -16,66 +16,31 @@ KIND, > either express or implied. See th > specific language governing permissions and limitations > under the License. > --> > -<script language="javascript" type="text/javascript" > src="<@ofbizContentUrl>/images/jquery/ui/development-bundle/external/jquery.cookie.js</@ofbizContentUrl>"></script> > -<script language="javascript" type="text/javascript" > src="<@ofbizContentUrl>/images/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script> > > -<script type="application/javascript"> > -<#-- some labels are not unescaped in the JSON object so we have to do this manuely --> > +<script type="text/javascript"> > +<#-- some labels are not unescaped in the JSON object so we have to do this manualy --> > function unescapeHtmlText(text) { > return jQuery('<div />').html(text).text() > } > - > -createTree(); > + > +jQuery(window).load(createTree()); > > <#-- creating the JSON Data --> > var rawdata = [ > - <#if (prodCatalogList?has_content)> > - <@fillCatalogTree prodCatalogs = prodCatalogList/> > - </#if> > - > - <#macro fillCatalogTree prodCatalogs> > - <#if (prodCatalogs?has_content)> > - <#list prodCatalogs as catalog> > - <#assign catalogId = catalog.prodCatalogId/> > - <#if !catalogName?has_content> > - > - </#if> > - <#assign categoryList = catalog.rootCategoryList/> > - { > - <#if catalogId?has_content> > - "data": {"title" : unescapeHtmlText("<#if > catalog.catalogName?has_content>${catalog.catalogName}<#else>${catalogId}</#if> <#if > catalog.catalogName?has_content>[${catalogId}]</#if>"), "attr": {"href": > "<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>", "onClick" : > "callDocument('<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>');"}}, > - "attr": {"id" : "${catalogId}", "rel" : "root"}, > - > - </#if> > - <#if categoryList?has_content> > - "children": [ > - <@fillCategoryTree childCategoryList = categoryList/> > - ] > - </#if> > - <#if catalog_has_next> > - }, > - <#else> > - } > - </#if> > - </#list> > - </#if> > - </#macro> > + <#if (completedTree?has_content)> > + <@fillTree rootCat = completedTree/> > + </#if> > > - <#macro fillCategoryTree childCategoryList> > - <#if childCategoryList?has_content> > - <#list childCategoryList as childCategory> > + <#macro fillTree rootCat> > + <#if (rootCat?has_content)> > + <#list rootCat as root> > { > - <#local productCategoryId = childCategory.productCategoryId/> > - <#local childCategorys = > Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, > true)> > - "data": {"title" : unescapeHtmlText("<#if > childCategory.categoryName?has_content>${childCategory.categoryName}<#else>${productCategoryId}</#if> <#if > childCategory.categoryName?has_content>[${productCategoryId}]</#if>"), "attr": {"href": > "<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>", "onClick" : > "callDocument('<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>');"}}, > - "attr": {"id" : "${productCategoryId}", "rel" : "CATEGORY"}, > - > - <#if childCategoryList?has_content> > - "children": [ > - <@fillCategoryTree childCategoryList = childCategorys/> > - ] > + "data": {"title" : unescapeHtmlText("<#if root.categoryName?exists>${root.categoryName?js_string} > [${root.productCategoryId}]<#else>${root.productCategoryId?js_string}</#if>"), "attr": {"onClick" : > "window.location.href='<@ofbizUrl>/EditProdCatalog?prodCatalogId=${root.productCategoryId}</@ofbizUrl>'; return false;"}}, + > "attr": {"id" : "${root.productCategoryId}", "rel" : "root", "isCatalog" : "${root.isCatalog?string}"} + <#if > root.child?exists> + ,"state" : "closed" </#if> > - <#if childCategory_has_next> > + <#if root_has_next> > }, > <#else> > } > @@ -84,33 +49,39 @@ var rawdata = [ > </#if> > </#macro> > ]; > - > > - <#-------------------------------------------------------------------------------------create Tree--> > + <#-- create Tree--> > function createTree() { > jQuery(function () { > - <#if !openTree> > + <#-- reset the tree when user browsing out of scope of catalog manager --> > + <#if stillInCatalogManager> > $.cookie('jstree_select', null); > $.cookie('jstree_open', null); > <#else> > - $.cookie("jstree_select", "${productCategoryId}"); > + <#-- Coloring the category when type the product categoryId manualy at the url bar --> > + $.cookie('jstree_select', "<#if productCategoryId?exists>${productCategoryId}<#elseif > prodCatalogId?exists>${prodCatalogId}<#elseif showProductCategoryId?exists>${showProductCategoryId}</#if>"); </#if> > jQuery("#tree").jstree({ > - "plugins" : [ "themes", "json_data", "cookies", "ui", "types"], > + "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], > "json_data" : { > - "data" : rawdata > + "data" : rawdata, > + "ajax" : { "url" : "<@ofbizUrl>getChild</@ofbizUrl>", "type" : "POST", > + "data" : function (n) { > + return { > + "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , > + "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1 > + }; > + } > + } > }, > "themes" : { > "icons" : true > }, > - "cookies" : { > - "save_opened" : false > - }, > "types" : { > "valid_children" : [ "root" ], > "types" : { > "CATEGORY" : { > - "icon" : { > + "icon" : { > "image" : "/images/jquery/plugins/jsTree/themes/apple/d.png", > "position" : "10px40px" > } > @@ -118,27 +89,8 @@ var rawdata = [ > } > } > }); > - > }); > - > - } > - > - function callDocument(url) { > - $(location).attr('href', url); > } > - > </script> > > <div id="tree"></div> > -<style type="text/css"> > - .jstree-default a > - { > - white-space:normal !important; > - height: auto; > - } > - .jstree-default .jstree-leaf > ins > - { > - background-position:-36px 0; > - vertical-align: top; > - } > -</style> > > Modified: ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml?rev=1082041&r1=1082040&r2=1082041&view=diff > ============================================================================== --- > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml (original) +++ > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml Wed Mar 16 03:39:49 2011 @@ -41,6 +41,10 @@ under the License. > <set field="applicationMenuName" value="CatalogAppBar" global="true"/> > <set field="applicationMenuLocation" value="component://product/widget/catalog/CatalogMenus.xml" global="true"/> > <set field="applicationTitle" value="${uiLabelMap.ProductCatalogManagerApplication}" global="true"/> > + <set field="layoutSettings.javaScripts[+0]" > value="/images/jquery/ui/development-bundle/external/jquery.cookie.js" global="true"/> + <set > field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jsTree/jquery.jstree.js" global="true"/> + > <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> + <set > field="layoutSettings.styleSheets[+0]" value="/images/catalog/categorytree.css" global="true"/> </actions> > <widgets> > <include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/> > @@ -343,7 +347,6 @@ under the License. > <screen name="categorytree"> > <section> > <actions> > - <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> > <script location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy"></script> > </actions> > <widgets> > > Added: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css?rev=1082041&view=auto > ============================================================================== > --- ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (added) > +++ ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css Wed Mar 16 03:39:49 2011 > @@ -0,0 +1,28 @@ > +/* > + * 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. > + */ > + > +/* THE CUSTOM CSS FOR AJUST THE CATEGORY TREE */ > +.jstree-default a { > +white-space:normal !important; > +height: auto; > +} > +.jstree-default .jstree-leaf > ins { > +background-position:-36px 0; > +vertical-align: top; > +} > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > ------------------------------------------------------------------------------ > svn:eol-style = native > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > ------------------------------------------------------------------------------ > svn:keywords = "Date Rev Author URL Id" > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > ------------------------------------------------------------------------------ > svn:mime-type = text/css |
What is the url? i do not see them?
On Wed, 2011-03-16 at 07:48 +0100, Jacques Le Roux wrote: > Hi Hans, > > I did not have time to review, but could it be the reason we have squares instead of letters on trunk demo (lang=en)? > > Thanks > > Jacques > > > [hidden email] wrote: > > Author: hansbak > > Date: Wed Mar 16 03:39:49 2011 > > New Revision: 1082041 > > > > URL: http://svn.apache.org/viewvc?rev=1082041&view=rev > > Log: > > a new version of the category tree, will now display in IE and blankscreen mostly gone....not perfect yet, we will probably make > > the left column about 50% wider in the next version > > > > Added: > > ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (with props) > > Modified: > > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl > > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml > > > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > > URL: > > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1082041&r1=1082040&r2=1082041&view=diff > > ============================================================================== --- > > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ > > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Wed Mar 16 03:39:49 2011 @@ -18,14 +18,22 @@ > > *******************************************************************************/ > > package org.ofbiz.product.category; > > > > +import java.io.IOException; > > +import java.io.UnsupportedEncodingException; > > +import java.io.Writer; > > import java.sql.Timestamp; > > 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 net.sf.json.JSONObject; > > + > > import org.ofbiz.base.util.Debug; > > import org.ofbiz.base.util.UtilDateTime; > > import org.ofbiz.base.util.UtilGenerics; > > @@ -391,4 +399,116 @@ public class CategoryServices { > > if (productCategoryMembers != null) result.put("productCategoryMembers", productCategoryMembers); > > return result; > > } > > + > > + // Please note : the structure of map in this function is according to the JSON data map of the jsTree > > + @SuppressWarnings("unchecked") > > + public static void getChildCategoryTree(HttpServletRequest request, HttpServletResponse response){ > > + Delegator delegator = (Delegator) request.getAttribute("delegator"); > > + String productCategoryId = request.getParameter("productCategoryId"); > > + String isCatalog = request.getParameter("isCatalog"); > > + String entityName = null; > > + String primaryKeyName = null; > > + > > + if (isCatalog.equals("true")) { > > + entityName = "ProdCatalog"; > > + primaryKeyName = "prodCatalogId"; > > + } else { > > + entityName = "ProductCategory"; > > + primaryKeyName = "productCategoryId"; > > + } > > + > > + List categoryList = FastList.newInstance(); > > + List<GenericValue> childOfCats; > > + > > + try { > > + GenericValue category = delegator.findByPrimaryKey(entityName ,UtilMisc.toMap(primaryKeyName, productCategoryId)); > > + if (UtilValidate.isNotEmpty(category)) { > > + if (isCatalog.equals("true")) { > > + CategoryWorker.getRelatedCategories(request, "ChildCatalogList", > > CatalogWorker.getCatalogTopCategoryId(request, productCategoryId), true); + childOfCats = (List<GenericValue>) > > request.getAttribute("ChildCatalogList"); + } else { > > + childOfCats = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( > > + "parentProductCategoryId", productCategoryId )); > > + } > > + if (UtilValidate.isNotEmpty(childOfCats)) { > > + for (GenericValue childOfCat : childOfCats ) { > > + > > + Object catId = null; > > + String catNameField = null; > > + > > + catId = childOfCat.get("productCategoryId"); > > + catNameField = "CATEGORY_NAME"; > > + > > + Map josonMap = FastMap.newInstance(); > > + List<GenericValue> childList = null; > > + > > + // Get the child list of chosen category > > + childList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( > > + "parentProductCategoryId", catId)); > > + > > + // Get the chosen category information for the categoryContentWrapper > > + GenericValue cate = delegator.findByPrimaryKey("ProductCategory" > > ,UtilMisc.toMap("productCategoryId",catId)); + > > + // If chosen category's child exists, then put the arrow before category icon > > + if (UtilValidate.isNotEmpty(childList)) { > > + josonMap.put("state", "closed"); > > + } > > + Map dataMap = FastMap.newInstance(); > > + Map dataAttrMap = FastMap.newInstance(); > > + CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(cate, request); > > + > > + if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField))) { > > + dataMap.put("title", categoryContentWrapper.get(catNameField)+"["+catId+"]"); > > + } else { > > + dataMap.put("title", catId); > > + } > > + dataAttrMap.put("onClick","window.location.href='EditCategory?productCategoryId="+catId+"'; return > > false;"); + > > + dataMap.put("attr", dataAttrMap); > > + josonMap.put("data", dataMap); > > + Map attrMap = FastMap.newInstance(); > > + attrMap.put("id", catId); > > + attrMap.put("isCatalog", false); > > + attrMap.put("rel", "CATEGORY"); > > + josonMap.put("attr",attrMap); > > + > > + categoryList.add(josonMap); > > + } > > + toJsonObjectList(categoryList,response); > > + } > > + } > > + } catch (GenericEntityException e) { > > + e.printStackTrace(); > > + } > > + } > > + > > + @SuppressWarnings("unchecked") > > + public static void toJsonObjectList(List attrList, HttpServletResponse response){ > > + String jsonStr = "["; > > + for (Object attrMap : attrList) { > > + JSONObject json = JSONObject.fromObject(attrMap); > > + jsonStr = jsonStr + json.toString() + ','; > > + } > > + jsonStr = jsonStr + "{ } ]"; > > + if (UtilValidate.isEmpty(jsonStr)) { > > + Debug.logError("JSON Object was empty; fatal error!",module); > > + } > > + // set the X-JSON content type > > + response.setContentType("application/json"); > > + // jsonStr.length is not reliable for unicode characters > > + try { > > + response.setContentLength(jsonStr.getBytes("UTF8").length); > > + } catch (UnsupportedEncodingException e) { > > + Debug.logError("Problems with Json encoding",module); > > + } > > + // return the JSON String > > + Writer out; > > + try { > > + out = response.getWriter(); > > + out.write(jsonStr); > > + out.flush(); > > + } catch (IOException e) { > > + Debug.logError("Unable to get response writer",module); > > + } > > + } > > } > > > > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy > > URL: > > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy?rev=1082041&r1=1082040&r2=1082041&view=diff > > ============================================================================== --- > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy (original) +++ > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy Wed Mar 16 03:39:49 2011 @@ -17,56 > > +17,103 @@ > > * 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 org.ofbiz.entity.GenericValue; > > import javolution.util.FastMap; > > import javolution.util.FastList; > > -import org.ofbiz.base.util.UtilMisc; > > -import org.ofbiz.base.util.UtilValidate; > > -import org.ofbiz.entity.GenericValue; > > -import org.ofbiz.entity.util.EntityUtil; > > -import javax.servlet.http.HttpSession; > > +import javolution.util.FastList.*; > > +import org.ofbiz.entity.*; > > +import java.util.List; > > + > > +// Put the result of CategoryWorker.getRelatedCategories into the fillTree function as attribute. > > +// The fillTree function will return the complete list of category of given catalog. > > +// PLEASE NOTE : The structure of the complete list of fillTree function is according to the JSON_DATA plugin of the jsTree. > > + > > +List fillTree(rootCat) { > > + 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(); > > + 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["child"] = catChilds; > > + rootMap["isCatalog"] = false; > > + listTree.add(rootMap); > > + > > + } > > + return listTree; > > + } > > +} > > + > > +completedTree = FastList.newInstance(); > > > > -prodCatalogList = FastList.newInstance(); > > +// Get the Catalogs > > prodCatalogs = delegator.findByAnd("ProdCatalog"); > > + > > if (prodCatalogs.size() > 0) { > > for (i = 0; i < prodCatalogs.size(); i++) { > > > > prodCatalogMap = FastMap.newInstance(); > > prodCatalog = prodCatalogs[i]; > > prodCatalogId = prodCatalog.getString("prodCatalogId"); > > - prodCatalogMap.put("prodCatalogId", prodCatalogId); > > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); > > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); > > - > > - //root category list of the catalog > > - prodCategoryList = CatalogWorker.getProdCatalogCategories(request, prodCatalogId, null); > > - rootCategoryList = FastList.newInstance(); > > - if (prodCategoryList.size() > 0) { > > - for (j = 0; j < prodCategoryList.size(); j++) { > > - prodCategory = prodCategoryList[j]; > > - rootCategory = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId" : > > prodCategory.getString("productCategoryId")]); > > - rootCategoryList.add(rootCategory); > > - } > > - } > > - > > - if (rootCategoryList) { > > - prodCatalogMap.put("rootCategoryList", rootCategoryList); > > - prodCatalogList.add(prodCatalogMap); > > + prodCatalogMap.put("productCategoryId", prodCatalogId); > > + prodCatalogMap.put("categoryName", prodCatalog.getString("catalogName")); > > + prodCatalogMap.put("isCatalog", true); > > + > > + CategoryWorker.getRelatedCategories(request, "CatalogList_"+i, CatalogWorker.getCatalogTopCategoryId(request, > > prodCatalogId), true); + categoryList = null; > > + categoryList = request.getAttribute("CatalogList_"+i); > > + prodCatalogTree = FastList.newInstance(); > > + > > + if (categoryList) { > > + prodCatalogTree = fillTree(categoryList); > > + prodCatalogMap.put("child", prodCatalogTree); > > + completedTree.add(prodCatalogMap); > > } > > } > > } > > +// The complete tree list for the category tree > > +context.completedTree = completedTree; > > > > -context.prodCatalogList = prodCatalogList; > > - > > -openTree = false; > > +stillInCatalogManager = true; > > productCategoryId = null; > > +prodCatalogId = null; > > +showProductCategoryId = null; > > + > > +// Reset tree condition check. Are we still in the Catalog Manager ?. If not , then reset the tree. > > if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) { > > - openTree = true; > > - productCategoryId = (parameters.productCategoryId != null) ? parameters.productCategoryId : parameters.showProductCategoryId; > > + stillInCatalogManager = false; > > + productCategoryId = parameters.productCategoryId; > > + showProductCategoryId = parameters.showProductCategoryId; > > +} else if (parameters.prodCatalogId != null) { > > + stillInCatalogManager = false; > > + prodCatalogId = parameters.prodCatalogId; > > } > > - > > -context.openTree = openTree; > > +context.stillInCatalogManager = stillInCatalogManager; > > context.productCategoryId = productCategoryId; > > +context.prodCatalogId = prodCatalogId; > > +context.showProductCategoryId = showProductCategoryId; > > > > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > > URL: > > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1082041&r1=1082040&r2=1082041&view=diff > > ============================================================================== --- > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ > > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Wed Mar 16 03:39:49 2011 @@ -3076,6 +3076,12 @@ under the > > License. <response name="error" type="view" value="EditProductPromoContent"/> > > </request-map> > > > > + <request-map uri="getChild"> > > + <security auth="false" https="true"/> > > + <event type="java" path="org.ofbiz.product.category.CategoryServices" invoke="getChildCategoryTree"/> > > + <response name="success" type="none"/> > > + </request-map> > > + > > <!-- View Mappings --> > > <view-map name="main" type="screen" page="component://product/widget/catalog/CommonScreens.xml#main"/> > > > > > > Modified: ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl > > URL: > > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl?rev=1082041&r1=1082040&r2=1082041&view=diff > > ============================================================================== --- > > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl (original) +++ > > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl Wed Mar 16 03:39:49 2011 @@ -16,66 +16,31 @@ KIND, > > either express or implied. See th > > specific language governing permissions and limitations > > under the License. > > --> > > -<script language="javascript" type="text/javascript" > > src="<@ofbizContentUrl>/images/jquery/ui/development-bundle/external/jquery.cookie.js</@ofbizContentUrl>"></script> > > -<script language="javascript" type="text/javascript" > > src="<@ofbizContentUrl>/images/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script> > > > > -<script type="application/javascript"> > > -<#-- some labels are not unescaped in the JSON object so we have to do this manuely --> > > +<script type="text/javascript"> > > +<#-- some labels are not unescaped in the JSON object so we have to do this manualy --> > > function unescapeHtmlText(text) { > > return jQuery('<div />').html(text).text() > > } > > - > > -createTree(); > > + > > +jQuery(window).load(createTree()); > > > > <#-- creating the JSON Data --> > > var rawdata = [ > > - <#if (prodCatalogList?has_content)> > > - <@fillCatalogTree prodCatalogs = prodCatalogList/> > > - </#if> > > - > > - <#macro fillCatalogTree prodCatalogs> > > - <#if (prodCatalogs?has_content)> > > - <#list prodCatalogs as catalog> > > - <#assign catalogId = catalog.prodCatalogId/> > > - <#if !catalogName?has_content> > > - > > - </#if> > > - <#assign categoryList = catalog.rootCategoryList/> > > - { > > - <#if catalogId?has_content> > > - "data": {"title" : unescapeHtmlText("<#if > > catalog.catalogName?has_content>${catalog.catalogName}<#else>${catalogId}</#if> <#if > > catalog.catalogName?has_content>[${catalogId}]</#if>"), "attr": {"href": > > "<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>", "onClick" : > > "callDocument('<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>');"}}, > > - "attr": {"id" : "${catalogId}", "rel" : "root"}, > > - > > - </#if> > > - <#if categoryList?has_content> > > - "children": [ > > - <@fillCategoryTree childCategoryList = categoryList/> > > - ] > > - </#if> > > - <#if catalog_has_next> > > - }, > > - <#else> > > - } > > - </#if> > > - </#list> > > - </#if> > > - </#macro> > > + <#if (completedTree?has_content)> > > + <@fillTree rootCat = completedTree/> > > + </#if> > > > > - <#macro fillCategoryTree childCategoryList> > > - <#if childCategoryList?has_content> > > - <#list childCategoryList as childCategory> > > + <#macro fillTree rootCat> > > + <#if (rootCat?has_content)> > > + <#list rootCat as root> > > { > > - <#local productCategoryId = childCategory.productCategoryId/> > > - <#local childCategorys = > > Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, > > true)> > > - "data": {"title" : unescapeHtmlText("<#if > > childCategory.categoryName?has_content>${childCategory.categoryName}<#else>${productCategoryId}</#if> <#if > > childCategory.categoryName?has_content>[${productCategoryId}]</#if>"), "attr": {"href": > > "<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>", "onClick" : > > "callDocument('<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>');"}}, > > - "attr": {"id" : "${productCategoryId}", "rel" : "CATEGORY"}, > > - > > - <#if childCategoryList?has_content> > > - "children": [ > > - <@fillCategoryTree childCategoryList = childCategorys/> > > - ] > > + "data": {"title" : unescapeHtmlText("<#if root.categoryName?exists>${root.categoryName?js_string} > > [${root.productCategoryId}]<#else>${root.productCategoryId?js_string}</#if>"), "attr": {"onClick" : > > "window.location.href='<@ofbizUrl>/EditProdCatalog?prodCatalogId=${root.productCategoryId}</@ofbizUrl>'; return false;"}}, + > > "attr": {"id" : "${root.productCategoryId}", "rel" : "root", "isCatalog" : "${root.isCatalog?string}"} + <#if > > root.child?exists> + ,"state" : "closed" </#if> > > - <#if childCategory_has_next> > > + <#if root_has_next> > > }, > > <#else> > > } > > @@ -84,33 +49,39 @@ var rawdata = [ > > </#if> > > </#macro> > > ]; > > - > > > > - <#-------------------------------------------------------------------------------------create Tree--> > > + <#-- create Tree--> > > function createTree() { > > jQuery(function () { > > - <#if !openTree> > > + <#-- reset the tree when user browsing out of scope of catalog manager --> > > + <#if stillInCatalogManager> > > $.cookie('jstree_select', null); > > $.cookie('jstree_open', null); > > <#else> > > - $.cookie("jstree_select", "${productCategoryId}"); > > + <#-- Coloring the category when type the product categoryId manualy at the url bar --> > > + $.cookie('jstree_select', "<#if productCategoryId?exists>${productCategoryId}<#elseif > > prodCatalogId?exists>${prodCatalogId}<#elseif showProductCategoryId?exists>${showProductCategoryId}</#if>"); </#if> > > jQuery("#tree").jstree({ > > - "plugins" : [ "themes", "json_data", "cookies", "ui", "types"], > > + "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], > > "json_data" : { > > - "data" : rawdata > > + "data" : rawdata, > > + "ajax" : { "url" : "<@ofbizUrl>getChild</@ofbizUrl>", "type" : "POST", > > + "data" : function (n) { > > + return { > > + "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , > > + "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1 > > + }; > > + } > > + } > > }, > > "themes" : { > > "icons" : true > > }, > > - "cookies" : { > > - "save_opened" : false > > - }, > > "types" : { > > "valid_children" : [ "root" ], > > "types" : { > > "CATEGORY" : { > > - "icon" : { > > + "icon" : { > > "image" : "/images/jquery/plugins/jsTree/themes/apple/d.png", > > "position" : "10px40px" > > } > > @@ -118,27 +89,8 @@ var rawdata = [ > > } > > } > > }); > > - > > }); > > - > > - } > > - > > - function callDocument(url) { > > - $(location).attr('href', url); > > } > > - > > </script> > > > > <div id="tree"></div> > > -<style type="text/css"> > > - .jstree-default a > > - { > > - white-space:normal !important; > > - height: auto; > > - } > > - .jstree-default .jstree-leaf > ins > > - { > > - background-position:-36px 0; > > - vertical-align: top; > > - } > > -</style> > > > > Modified: ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml > > URL: > > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml?rev=1082041&r1=1082040&r2=1082041&view=diff > > ============================================================================== --- > > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml (original) +++ > > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml Wed Mar 16 03:39:49 2011 @@ -41,6 +41,10 @@ under the License. > > <set field="applicationMenuName" value="CatalogAppBar" global="true"/> > > <set field="applicationMenuLocation" value="component://product/widget/catalog/CatalogMenus.xml" global="true"/> > > <set field="applicationTitle" value="${uiLabelMap.ProductCatalogManagerApplication}" global="true"/> > > + <set field="layoutSettings.javaScripts[+0]" > > value="/images/jquery/ui/development-bundle/external/jquery.cookie.js" global="true"/> + <set > > field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jsTree/jquery.jstree.js" global="true"/> + > > <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> + <set > > field="layoutSettings.styleSheets[+0]" value="/images/catalog/categorytree.css" global="true"/> </actions> > > <widgets> > > <include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/> > > @@ -343,7 +347,6 @@ under the License. > > <screen name="categorytree"> > > <section> > > <actions> > > - <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> > > <script location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy"></script> > > </actions> > > <widgets> > > > > Added: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css?rev=1082041&view=auto > > ============================================================================== > > --- ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (added) > > +++ ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css Wed Mar 16 03:39:49 2011 > > @@ -0,0 +1,28 @@ > > +/* > > + * 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. > > + */ > > + > > +/* THE CUSTOM CSS FOR AJUST THE CATEGORY TREE */ > > +.jstree-default a { > > +white-space:normal !important; > > +height: auto; > > +} > > +.jstree-default .jstree-leaf > ins { > > +background-position:-36px 0; > > +vertical-align: top; > > +} > > > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > > ------------------------------------------------------------------------------ > > svn:eol-style = native > > > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > > ------------------------------------------------------------------------------ > > svn:keywords = "Date Rev Author URL Id" > > > > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css > > ------------------------------------------------------------------------------ > > svn:mime-type = text/css > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Administrator
|
Right,
I don't see them anymore. It was on FF, maybe my machine (XP just upgraded), forget it (hopefully definitively). BTW the tree is really better now :o) Jacques From: "Hans Bakker" <[hidden email]> > What is the url? i do not see them? > > On Wed, 2011-03-16 at 07:48 +0100, Jacques Le Roux wrote: >> Hi Hans, >> >> I did not have time to review, but could it be the reason we have squares instead of letters on trunk demo (lang=en)? >> >> Thanks >> >> Jacques >> >> >> [hidden email] wrote: >> > Author: hansbak >> > Date: Wed Mar 16 03:39:49 2011 >> > New Revision: 1082041 >> > >> > URL: http://svn.apache.org/viewvc?rev=1082041&view=rev >> > Log: >> > a new version of the category tree, will now display in IE and blankscreen mostly gone....not perfect yet, we will probably >> > make >> > the left column about 50% wider in the next version >> > >> > Added: >> > ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (with props) >> > Modified: >> > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl >> > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml >> > >> > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1082041&r1=1082040&r2=1082041&view=diff >> > ============================================================================== --- >> > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ >> > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Wed Mar 16 03:39:49 2011 @@ -18,14 +18,22 >> > @@ >> > *******************************************************************************/ >> > package org.ofbiz.product.category; >> > >> > +import java.io.IOException; >> > +import java.io.UnsupportedEncodingException; >> > +import java.io.Writer; >> > import java.sql.Timestamp; >> > 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 net.sf.json.JSONObject; >> > + >> > import org.ofbiz.base.util.Debug; >> > import org.ofbiz.base.util.UtilDateTime; >> > import org.ofbiz.base.util.UtilGenerics; >> > @@ -391,4 +399,116 @@ public class CategoryServices { >> > if (productCategoryMembers != null) result.put("productCategoryMembers", productCategoryMembers); >> > return result; >> > } >> > + >> > + // Please note : the structure of map in this function is according to the JSON data map of the jsTree >> > + @SuppressWarnings("unchecked") >> > + public static void getChildCategoryTree(HttpServletRequest request, HttpServletResponse response){ >> > + Delegator delegator = (Delegator) request.getAttribute("delegator"); >> > + String productCategoryId = request.getParameter("productCategoryId"); >> > + String isCatalog = request.getParameter("isCatalog"); >> > + String entityName = null; >> > + String primaryKeyName = null; >> > + >> > + if (isCatalog.equals("true")) { >> > + entityName = "ProdCatalog"; >> > + primaryKeyName = "prodCatalogId"; >> > + } else { >> > + entityName = "ProductCategory"; >> > + primaryKeyName = "productCategoryId"; >> > + } >> > + >> > + List categoryList = FastList.newInstance(); >> > + List<GenericValue> childOfCats; >> > + >> > + try { >> > + GenericValue category = delegator.findByPrimaryKey(entityName ,UtilMisc.toMap(primaryKeyName, productCategoryId)); >> > + if (UtilValidate.isNotEmpty(category)) { >> > + if (isCatalog.equals("true")) { >> > + CategoryWorker.getRelatedCategories(request, "ChildCatalogList", >> > CatalogWorker.getCatalogTopCategoryId(request, productCategoryId), true); + childOfCats = >> > (List<GenericValue>) >> > request.getAttribute("ChildCatalogList"); + } else { >> > + childOfCats = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( >> > + "parentProductCategoryId", productCategoryId )); >> > + } >> > + if (UtilValidate.isNotEmpty(childOfCats)) { >> > + for (GenericValue childOfCat : childOfCats ) { >> > + >> > + Object catId = null; >> > + String catNameField = null; >> > + >> > + catId = childOfCat.get("productCategoryId"); >> > + catNameField = "CATEGORY_NAME"; >> > + >> > + Map josonMap = FastMap.newInstance(); >> > + List<GenericValue> childList = null; >> > + >> > + // Get the child list of chosen category >> > + childList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap( >> > + "parentProductCategoryId", catId)); >> > + >> > + // Get the chosen category information for the categoryContentWrapper >> > + GenericValue cate = delegator.findByPrimaryKey("ProductCategory" >> > ,UtilMisc.toMap("productCategoryId",catId)); + >> > + // If chosen category's child exists, then put the arrow before category icon >> > + if (UtilValidate.isNotEmpty(childList)) { >> > + josonMap.put("state", "closed"); >> > + } >> > + Map dataMap = FastMap.newInstance(); >> > + Map dataAttrMap = FastMap.newInstance(); >> > + CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(cate, request); >> > + >> > + if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField))) { >> > + dataMap.put("title", categoryContentWrapper.get(catNameField)+"["+catId+"]"); >> > + } else { >> > + dataMap.put("title", catId); >> > + } >> > + dataAttrMap.put("onClick","window.location.href='EditCategory?productCategoryId="+catId+"'; return >> > false;"); + >> > + dataMap.put("attr", dataAttrMap); >> > + josonMap.put("data", dataMap); >> > + Map attrMap = FastMap.newInstance(); >> > + attrMap.put("id", catId); >> > + attrMap.put("isCatalog", false); >> > + attrMap.put("rel", "CATEGORY"); >> > + josonMap.put("attr",attrMap); >> > + >> > + categoryList.add(josonMap); >> > + } >> > + toJsonObjectList(categoryList,response); >> > + } >> > + } >> > + } catch (GenericEntityException e) { >> > + e.printStackTrace(); >> > + } >> > + } >> > + >> > + @SuppressWarnings("unchecked") >> > + public static void toJsonObjectList(List attrList, HttpServletResponse response){ >> > + String jsonStr = "["; >> > + for (Object attrMap : attrList) { >> > + JSONObject json = JSONObject.fromObject(attrMap); >> > + jsonStr = jsonStr + json.toString() + ','; >> > + } >> > + jsonStr = jsonStr + "{ } ]"; >> > + if (UtilValidate.isEmpty(jsonStr)) { >> > + Debug.logError("JSON Object was empty; fatal error!",module); >> > + } >> > + // set the X-JSON content type >> > + response.setContentType("application/json"); >> > + // jsonStr.length is not reliable for unicode characters >> > + try { >> > + response.setContentLength(jsonStr.getBytes("UTF8").length); >> > + } catch (UnsupportedEncodingException e) { >> > + Debug.logError("Problems with Json encoding",module); >> > + } >> > + // return the JSON String >> > + Writer out; >> > + try { >> > + out = response.getWriter(); >> > + out.write(jsonStr); >> > + out.flush(); >> > + } catch (IOException e) { >> > + Debug.logError("Unable to get response writer",module); >> > + } >> > + } >> > } >> > >> > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy?rev=1082041&r1=1082040&r2=1082041&view=diff >> > ============================================================================== --- >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy (original) +++ >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy Wed Mar 16 03:39:49 2011 @@ -17,56 >> > +17,103 @@ >> > * 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 org.ofbiz.entity.GenericValue; >> > import javolution.util.FastMap; >> > import javolution.util.FastList; >> > -import org.ofbiz.base.util.UtilMisc; >> > -import org.ofbiz.base.util.UtilValidate; >> > -import org.ofbiz.entity.GenericValue; >> > -import org.ofbiz.entity.util.EntityUtil; >> > -import javax.servlet.http.HttpSession; >> > +import javolution.util.FastList.*; >> > +import org.ofbiz.entity.*; >> > +import java.util.List; >> > + >> > +// Put the result of CategoryWorker.getRelatedCategories into the fillTree function as attribute. >> > +// The fillTree function will return the complete list of category of given catalog. >> > +// PLEASE NOTE : The structure of the complete list of fillTree function is according to the JSON_DATA plugin of the jsTree. >> > + >> > +List fillTree(rootCat) { >> > + 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(); >> > + 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["child"] = catChilds; >> > + rootMap["isCatalog"] = false; >> > + listTree.add(rootMap); >> > + >> > + } >> > + return listTree; >> > + } >> > +} >> > + >> > +completedTree = FastList.newInstance(); >> > >> > -prodCatalogList = FastList.newInstance(); >> > +// Get the Catalogs >> > prodCatalogs = delegator.findByAnd("ProdCatalog"); >> > + >> > if (prodCatalogs.size() > 0) { >> > for (i = 0; i < prodCatalogs.size(); i++) { >> > >> > prodCatalogMap = FastMap.newInstance(); >> > prodCatalog = prodCatalogs[i]; >> > prodCatalogId = prodCatalog.getString("prodCatalogId"); >> > - prodCatalogMap.put("prodCatalogId", prodCatalogId); >> > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); >> > - prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName")); >> > - >> > - //root category list of the catalog >> > - prodCategoryList = CatalogWorker.getProdCatalogCategories(request, prodCatalogId, null); >> > - rootCategoryList = FastList.newInstance(); >> > - if (prodCategoryList.size() > 0) { >> > - for (j = 0; j < prodCategoryList.size(); j++) { >> > - prodCategory = prodCategoryList[j]; >> > - rootCategory = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId" : >> > prodCategory.getString("productCategoryId")]); >> > - rootCategoryList.add(rootCategory); >> > - } >> > - } >> > - >> > - if (rootCategoryList) { >> > - prodCatalogMap.put("rootCategoryList", rootCategoryList); >> > - prodCatalogList.add(prodCatalogMap); >> > + prodCatalogMap.put("productCategoryId", prodCatalogId); >> > + prodCatalogMap.put("categoryName", prodCatalog.getString("catalogName")); >> > + prodCatalogMap.put("isCatalog", true); >> > + >> > + CategoryWorker.getRelatedCategories(request, "CatalogList_"+i, CatalogWorker.getCatalogTopCategoryId(request, >> > prodCatalogId), true); + categoryList = null; >> > + categoryList = request.getAttribute("CatalogList_"+i); >> > + prodCatalogTree = FastList.newInstance(); >> > + >> > + if (categoryList) { >> > + prodCatalogTree = fillTree(categoryList); >> > + prodCatalogMap.put("child", prodCatalogTree); >> > + completedTree.add(prodCatalogMap); >> > } >> > } >> > } >> > +// The complete tree list for the category tree >> > +context.completedTree = completedTree; >> > >> > -context.prodCatalogList = prodCatalogList; >> > - >> > -openTree = false; >> > +stillInCatalogManager = true; >> > productCategoryId = null; >> > +prodCatalogId = null; >> > +showProductCategoryId = null; >> > + >> > +// Reset tree condition check. Are we still in the Catalog Manager ?. If not , then reset the tree. >> > if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) { >> > - openTree = true; >> > - productCategoryId = (parameters.productCategoryId != null) ? parameters.productCategoryId : >> > parameters.showProductCategoryId; >> > + stillInCatalogManager = false; >> > + productCategoryId = parameters.productCategoryId; >> > + showProductCategoryId = parameters.showProductCategoryId; >> > +} else if (parameters.prodCatalogId != null) { >> > + stillInCatalogManager = false; >> > + prodCatalogId = parameters.prodCatalogId; >> > } >> > - >> > -context.openTree = openTree; >> > +context.stillInCatalogManager = stillInCatalogManager; >> > context.productCategoryId = productCategoryId; >> > +context.prodCatalogId = prodCatalogId; >> > +context.showProductCategoryId = showProductCategoryId; >> > >> > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1082041&r1=1082040&r2=1082041&view=diff >> > ============================================================================== --- >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ >> > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Wed Mar 16 03:39:49 2011 @@ -3076,6 +3076,12 @@ under >> > the >> > License. <response name="error" type="view" value="EditProductPromoContent"/> >> > </request-map> >> > >> > + <request-map uri="getChild"> >> > + <security auth="false" https="true"/> >> > + <event type="java" path="org.ofbiz.product.category.CategoryServices" invoke="getChildCategoryTree"/> >> > + <response name="success" type="none"/> >> > + </request-map> >> > + >> > <!-- View Mappings --> >> > <view-map name="main" type="screen" page="component://product/widget/catalog/CommonScreens.xml#main"/> >> > >> > >> > Modified: ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl?rev=1082041&r1=1082040&r2=1082041&view=diff >> > ============================================================================== --- >> > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl (original) +++ >> > ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl Wed Mar 16 03:39:49 2011 @@ -16,66 +16,31 @@ KIND, >> > either express or implied. See th >> > specific language governing permissions and limitations >> > under the License. >> > --> >> > -<script language="javascript" type="text/javascript" >> > src="<@ofbizContentUrl>/images/jquery/ui/development-bundle/external/jquery.cookie.js</@ofbizContentUrl>"></script> >> > -<script language="javascript" type="text/javascript" >> > src="<@ofbizContentUrl>/images/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script> >> > >> > -<script type="application/javascript"> >> > -<#-- some labels are not unescaped in the JSON object so we have to do this manuely --> >> > +<script type="text/javascript"> >> > +<#-- some labels are not unescaped in the JSON object so we have to do this manualy --> >> > function unescapeHtmlText(text) { >> > return jQuery('<div />').html(text).text() >> > } >> > - >> > -createTree(); >> > + >> > +jQuery(window).load(createTree()); >> > >> > <#-- creating the JSON Data --> >> > var rawdata = [ >> > - <#if (prodCatalogList?has_content)> >> > - <@fillCatalogTree prodCatalogs = prodCatalogList/> >> > - </#if> >> > - >> > - <#macro fillCatalogTree prodCatalogs> >> > - <#if (prodCatalogs?has_content)> >> > - <#list prodCatalogs as catalog> >> > - <#assign catalogId = catalog.prodCatalogId/> >> > - <#if !catalogName?has_content> >> > - >> > - </#if> >> > - <#assign categoryList = catalog.rootCategoryList/> >> > - { >> > - <#if catalogId?has_content> >> > - "data": {"title" : unescapeHtmlText("<#if >> > catalog.catalogName?has_content>${catalog.catalogName}<#else>${catalogId}</#if> <#if >> > catalog.catalogName?has_content>[${catalogId}]</#if>"), "attr": {"href": >> > "<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>", "onClick" : >> > "callDocument('<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>');"}}, >> > - "attr": {"id" : "${catalogId}", "rel" : "root"}, >> > - >> > - </#if> >> > - <#if categoryList?has_content> >> > - "children": [ >> > - <@fillCategoryTree childCategoryList = categoryList/> >> > - ] >> > - </#if> >> > - <#if catalog_has_next> >> > - }, >> > - <#else> >> > - } >> > - </#if> >> > - </#list> >> > - </#if> >> > - </#macro> >> > + <#if (completedTree?has_content)> >> > + <@fillTree rootCat = completedTree/> >> > + </#if> >> > >> > - <#macro fillCategoryTree childCategoryList> >> > - <#if childCategoryList?has_content> >> > - <#list childCategoryList as childCategory> >> > + <#macro fillTree rootCat> >> > + <#if (rootCat?has_content)> >> > + <#list rootCat as root> >> > { >> > - <#local productCategoryId = childCategory.productCategoryId/> >> > - <#local childCategorys = >> > Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, >> > true)> >> > - "data": {"title" : unescapeHtmlText("<#if >> > childCategory.categoryName?has_content>${childCategory.categoryName}<#else>${productCategoryId}</#if> <#if >> > childCategory.categoryName?has_content>[${productCategoryId}]</#if>"), "attr": {"href": >> > "<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>", "onClick" : >> > "callDocument('<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>');"}}, >> > - "attr": {"id" : "${productCategoryId}", "rel" : "CATEGORY"}, >> > - >> > - <#if childCategoryList?has_content> >> > - "children": [ >> > - <@fillCategoryTree childCategoryList = childCategorys/> >> > - ] >> > + "data": {"title" : unescapeHtmlText("<#if root.categoryName?exists>${root.categoryName?js_string} >> > [${root.productCategoryId}]<#else>${root.productCategoryId?js_string}</#if>"), "attr": {"onClick" : >> > "window.location.href='<@ofbizUrl>/EditProdCatalog?prodCatalogId=${root.productCategoryId}</@ofbizUrl>'; return false;"}}, + >> > "attr": {"id" : "${root.productCategoryId}", "rel" : "root", "isCatalog" : "${root.isCatalog?string}"} + >> > <#if >> > root.child?exists> + ,"state" : "closed" </#if> >> > - <#if childCategory_has_next> >> > + <#if root_has_next> >> > }, >> > <#else> >> > } >> > @@ -84,33 +49,39 @@ var rawdata = [ >> > </#if> >> > </#macro> >> > ]; >> > - >> > >> > - <#-------------------------------------------------------------------------------------create Tree--> >> > + <#-- create Tree--> >> > function createTree() { >> > jQuery(function () { >> > - <#if !openTree> >> > + <#-- reset the tree when user browsing out of scope of catalog manager --> >> > + <#if stillInCatalogManager> >> > $.cookie('jstree_select', null); >> > $.cookie('jstree_open', null); >> > <#else> >> > - $.cookie("jstree_select", "${productCategoryId}"); >> > + <#-- Coloring the category when type the product categoryId manualy at the url bar --> >> > + $.cookie('jstree_select', "<#if productCategoryId?exists>${productCategoryId}<#elseif >> > prodCatalogId?exists>${prodCatalogId}<#elseif showProductCategoryId?exists>${showProductCategoryId}</#if>"); </#if> >> > jQuery("#tree").jstree({ >> > - "plugins" : [ "themes", "json_data", "cookies", "ui", "types"], >> > + "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], >> > "json_data" : { >> > - "data" : rawdata >> > + "data" : rawdata, >> > + "ajax" : { "url" : "<@ofbizUrl>getChild</@ofbizUrl>", "type" : "POST", >> > + "data" : function (n) { >> > + return { >> > + "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , >> > + "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1 >> > + }; >> > + } >> > + } >> > }, >> > "themes" : { >> > "icons" : true >> > }, >> > - "cookies" : { >> > - "save_opened" : false >> > - }, >> > "types" : { >> > "valid_children" : [ "root" ], >> > "types" : { >> > "CATEGORY" : { >> > - "icon" : { >> > + "icon" : { >> > "image" : "/images/jquery/plugins/jsTree/themes/apple/d.png", >> > "position" : "10px40px" >> > } >> > @@ -118,27 +89,8 @@ var rawdata = [ >> > } >> > } >> > }); >> > - >> > }); >> > - >> > - } >> > - >> > - function callDocument(url) { >> > - $(location).attr('href', url); >> > } >> > - >> > </script> >> > >> > <div id="tree"></div> >> > -<style type="text/css"> >> > - .jstree-default a >> > - { >> > - white-space:normal !important; >> > - height: auto; >> > - } >> > - .jstree-default .jstree-leaf > ins >> > - { >> > - background-position:-36px 0; >> > - vertical-align: top; >> > - } >> > -</style> >> > >> > Modified: ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml?rev=1082041&r1=1082040&r2=1082041&view=diff >> > ============================================================================== --- >> > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml (original) +++ >> > ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml Wed Mar 16 03:39:49 2011 @@ -41,6 +41,10 @@ under the >> > License. >> > <set field="applicationMenuName" value="CatalogAppBar" global="true"/> >> > <set field="applicationMenuLocation" value="component://product/widget/catalog/CatalogMenus.xml" >> > global="true"/> >> > <set field="applicationTitle" value="${uiLabelMap.ProductCatalogManagerApplication}" global="true"/> >> > + <set field="layoutSettings.javaScripts[+0]" >> > value="/images/jquery/ui/development-bundle/external/jquery.cookie.js" global="true"/> + <set >> > field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jsTree/jquery.jstree.js" global="true"/> + >> > <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> + <set >> > field="layoutSettings.styleSheets[+0]" value="/images/catalog/categorytree.css" global="true"/> </actions> >> > <widgets> >> > <include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/> >> > @@ -343,7 +347,6 @@ under the License. >> > <screen name="categorytree"> >> > <section> >> > <actions> >> > - <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/> >> > <script location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy"></script> >> > </actions> >> > <widgets> >> > >> > Added: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css >> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css?rev=1082041&view=auto >> > ============================================================================== >> > --- ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css (added) >> > +++ ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css Wed Mar 16 03:39:49 2011 >> > @@ -0,0 +1,28 @@ >> > +/* >> > + * 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. >> > + */ >> > + >> > +/* THE CUSTOM CSS FOR AJUST THE CATEGORY TREE */ >> > +.jstree-default a { >> > +white-space:normal !important; >> > +height: auto; >> > +} >> > +.jstree-default .jstree-leaf > ins { >> > +background-position:-36px 0; >> > +vertical-align: top; >> > +} >> > >> > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css >> > ------------------------------------------------------------------------------ >> > svn:eol-style = native >> > >> > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css >> > ------------------------------------------------------------------------------ >> > svn:keywords = "Date Rev Author URL Id" >> > >> > Propchange: ofbiz/trunk/framework/images/webapp/images/catalog/categorytree.css >> > ------------------------------------------------------------------------------ >> > svn:mime-type = text/css >> >> > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > |
Free forum by Nabble | Edit this page |