svn commit: r1057075 - in /ofbiz/trunk/applications/product/webapp/catalog: WEB-INF/actions/category/CategoryTree.groovy category/CategoryTree.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1057075 - in /ofbiz/trunk/applications/product/webapp/catalog: WEB-INF/actions/category/CategoryTree.groovy category/CategoryTree.ftl

hansbak-2
Author: hansbak
Date: Mon Jan 10 02:35:35 2011
New Revision: 1057075

URL: http://svn.apache.org/viewvc?rev=1057075&view=rev
Log:
fix a conflict in the new category tree which conflicted with the lookup buttons in the catalog mainscreen. reported by Jacques.

Modified:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy
    ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl

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=1057075&r1=1057074&r2=1057075&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 Mon Jan 10 02:35:35 2011
@@ -53,12 +53,20 @@ if (prodCatalogs.size() > 0) {
         }
 
         if (rootCategoryList) {
-            catContentWrappers = [:];
-            CategoryWorker.getCategoryContentWrappers(catContentWrappers, rootCategoryList, request);
             prodCatalogMap.put("rootCategoryList", rootCategoryList);
-            prodCatalogMap.put("catContentWrappers", catContentWrappers);
             prodCatalogList.add(prodCatalogMap);
         }
     }
 }
+
 context.prodCatalogList = prodCatalogList;
+
+openTree = false;
+productCategoryId = null;
+if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) {
+    openTree = true;
+    productCategoryId = (parameters.productCategoryId != null) ? parameters.productCategoryId : parameters.showProductCategoryId;
+}
+
+context.openTree = openTree;
+context.productCategoryId = productCategoryId;

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=1057075&r1=1057074&r2=1057075&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/category/CategoryTree.ftl Mon Jan 10 02:35:35 2011
@@ -17,8 +17,8 @@ specific language governing permissions
 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 language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/jquery/ui/development-bundle/external/jquery.cookie.js</@ofbizContentUrl>"></script>
 
 <script type="application/javascript">
 <#-- some labels are not unescaped in the JSON object so we have to do this manuely -->
@@ -26,7 +26,8 @@ function unescapeHtmlText(text) {
     return jQuery('<div />').html(text).text()
 }
 
-jQuery(document).ready(createTree());
+createTree();
+
 <#-- creating the JSON Data -->
 var rawdata = [
       <#if (prodCatalogList?has_content)>
@@ -39,13 +40,12 @@ var rawdata = [
                 <#assign catalogId = catalog.prodCatalogId/>
                 <#assign catalogName = catalog.catalogName/>
                 <#assign categoryList = catalog.rootCategoryList/>
-                <#assign catContentWrappers = catalog.catContentWrappers/>
                 {
                 <#if catalogId?has_content>
                     "data": {"title" : unescapeHtmlText("${catalogName!catalogId}"), "attr": {"href": "<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>", "onClick" : "callDocument('<@ofbizUrl>/EditProdCatalog?prodCatalogId=${catalogId}</@ofbizUrl>');"}},
                     "attr": {"id" : "${catalogId}", "contentId" : "${catalogId}", "AssocType" : "${catalogId}", "fromDate" : "${catalogId}"},
                 </#if>
-                <#if categoryList?has_content && catContentWrappers?has_content>
+                <#if categoryList?has_content>
                     "children": [
                         <@fillCategoryTree childCategoryList = categoryList/>
                     ]
@@ -60,7 +60,7 @@ var rawdata = [
         </#macro>
         
         <#macro fillCategoryTree childCategoryList>
-            <#if childCategoryList?exists>
+            <#if childCategoryList?has_content>
                 <#list childCategoryList as childCategory>
                     {
                     <#local productCategoryId = childCategory.productCategoryId/>
@@ -74,7 +74,7 @@ var rawdata = [
                     <#local childCategorys = Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true)>
                     "data": {"title" : unescapeHtmlText("${categoryName}"), "attr": {"href": "<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>", "onClick" : "callDocument('<@ofbizUrl>/EditCategory?productCategoryId=${productCategoryId}</@ofbizUrl>');"}},
                     "attr": {"id" : "${productCategoryId}", "contentId" : "${productCategoryId}", "AssocType" : "${productCategoryId}", "fromDate" : "${productCategoryId}"},
-                    <#if childCategoryList?exists>
+                    <#if childCategoryList?has_content>
                         "children": [
                             <@fillCategoryTree childCategoryList = childCategorys/>
                         ]
@@ -88,15 +88,17 @@ var rawdata = [
             </#if>
         </#macro>
      ];
+    
 
  <#-------------------------------------------------------------------------------------create Tree-->
   function createTree() {
     jQuery(function () {
-        var pageUrl = window.location.href
-        if ((pageUrl.indexOf("productCategoryId") == -1) && (pageUrl.indexOf("showProductCategoryId") == -1)) {
+        <#if !openTree>
             $.cookie('jstree_select', null);
             $.cookie('jstree_open', null);
-        }
+        <#else>
+            $.cookie("jstree_select", "${productCategoryId}");
+        </#if>
         jQuery("#tree").jstree({
         "plugins" : [ "themes", "json_data", "cookies", "ui"],
             "json_data" : {
@@ -109,7 +111,9 @@ var rawdata = [
                 "save_opened" : false
             }
         });
+        
     });
+    
   }
   
   function callDocument(url) {
@@ -118,15 +122,4 @@ var rawdata = [
 
 </script>
 
-<style>
-<#if tabButtonItem?has_content>
-    <#if tabButtonItem=="LookupContentTree"||tabButtonItem=="LookupDetailContentTree">
-        body{background:none;}
-        .left-border{float:left;width:25%;}
-        .contentarea{margin: 0 0 0 0.5em;padding:0 0 0 0.5em;}
-        .leftonly{float:none;min-height:25em;}
-    </#if>
-</#if>
-</style>
-
 <div id="tree"></div>