3 "name": "Pman.Tab.CmsProductCategory",
4 "parent": "Pman.Tab.CmsProductMgr",
5 "title": "Pman.Tab.CmsProductCategory",
6 "path": "/home/alan/gitlive/Pman.Cms/Pman.Tab.CmsProductCategory.bjs",
10 "activate": "function (_self)\n{\n \n _this.panel = _self;\n}"
15 "title": "Category Tree",
25 "text": "Manage Categories",
27 "|xns": "Roo.Toolbar",
36 "click": "function (_self, e)\n{\n\n var sel = _this.panel.tree.getSelectionModel().getSelectedNode();\n var id = (!sel || isNaN(parseInt(sel.attributes.id))) ? 0 : sel.attributes.id;\n\n if (!id) {\n var sel = _this.panel.tree.root;\n }\n \n \n Pman.Dialog.CmsCategory.show( { id : 0 , parent_id : id, parent_id_title: sel.text }, function(r)\n {\n if (r && r.title) {\n if(sel.reload) {\n sel.reload();\n return;\n }\n // otherwise it's a treenode, and needs replacing...\n var attr = sel.attributes;\n attr.leaf = false;\n var repnode = new Roo.tree.AsyncTreeNode(attr);\n sel.parentNode.replaceChild(repnode, sel);\n repnode.expand();\n }\n });\n}"
40 "|icon": "Roo.rootURL + 'images/default/tree/drop-add.gif'",
45 "click": "function (_self, e)\n{\n\n var sel = _this.panel.tree.getSelectionModel().getSelectedNode();\n if (!sel || isNaN(parseInt(sel.id))) {\n Roo.MessageBox.alert(\"Error\", \"select a category to edit\");\n return;\n }\n var ats = sel.attributes;\n\n Pman.Dialog.CmsCategory.show( ats , function(r)\n {\n if (r && r.title) {\n sel.setText(r.display_order + '. ' + r.title);\n }\n sel.attributes = r;\n });\n}"
49 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
58 "click": "function (_self, e)\n{\n var sel = _this.panel.tree.getSelectionModel().getSelectedNode();\n if (!sel || isNaN(parseInt(sel.id))) {\n Roo.MessageBox.alert(\"Error\", \"you can not delete that category\");\n return;\n }\n var par = sel.parentNode;\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that?\", function(b)\n {\n // console.log(b);\n if (b!='yes') {\n return;\n }\n Roo.Ajax.request({\n method : 'GET',\n params : {\n _delete : sel.id\n },\n url : baseURL + '/Roo/Category.php',\n success : function(r, o) { \n par.removeChild(sel);\n // do nothing..\n },\n failure : function () {\n Roo.messageBox.alert('Error', 'Error updating categories');\n _this.root.reload();\n }\n });\n \n });\n \n \n \n \n}"
70 "click": "function (_self, e)\n{\n _this.panel.tree.root.reload();\n}"
84 "click": "function (node, e)\n{\n (function() {\n Pman.Tab.CmsProduct.grid.footer.onClick('first');\n }).defer(200);\n}",
85 "nodedragover": "function (dragOverEvent)\n{\n //console.log('nodedragover');\n // console.log(dragOverEvent.point); \n \n if (dragOverEvent.data.grid) {\n // comming from grid..\n if (!dragOverEvent.data.selections.length) {\n return false;\n }\n \n if (isNaN(parseInt(dragOverEvent.target.id))) {\n return false;\n }\n\n if (dragOverEvent.point !='append') {\n return false; \n }\n return true;\n }\n // only allow append..\n if (dragOverEvent.point !='append') {\n return false; \n }\n \n \n}",
86 "beforenodedrop": "function (dropEvent)\n{\n console.log('beforenodedrop');\n console.log(dropEvent);\n if (dropEvent.data.grid) {\n // comming from grid..\n if (!dropEvent.data.selections.length) {\n return false;\n }\n \n if (isNaN(parseInt(dropEvent.target.id))) {\n return false;\n }\n\n if (dropEvent.point !='append') {\n return false; \n }\n var ids = [];\n Roo.each(dropEvent.data.selections, function(d) {\n ids.push(d.data.id)\n });\n Roo.Ajax.request({\n method : 'POST',\n params : {\n _ids : ids.join(','),\n category_id : dropEvent.target.id\n },\n url : baseURL + '/Roo/Product.php',\n success : function(r, o) { \n dropEvent.data.grid.footer.onClick('refresh');\n },\n failure : function () {\n Roo.messageBox.alert('Error', 'Error updating categories');\n }\n });\n \n \n \n return true;\n }\n \n \n \n \n \n \n return true;\n}",
87 "nodedrop": "function (dropEvent)\n{\n // now handle node drop..\n // if it fails, we just reload the tree.. a bit messy, but acceptable..\n var _t = this;\n \n Roo.Ajax.request({\n method : 'POST',\n params : {\n id : dropEvent.dropNode.id,\n parent_id : dropEvent.target.id\n },\n url : baseURL + '/Roo/Category.php',\n success : function(r, o) { \n \n // do nothing..\n },\n failure : function () {\n Roo.messageBox.alert('Error', 'Error updating categories');\n _this.root.reload()\n }\n });\n \n}",
88 "contextmenu": "function (node, e)\n{\n this.selModel.select(node);\n _this.panel.menu = Roo.factory(_this.panel.menu, Roo.menu);\n Roo.log(node);\n _this.panel.menu.show(node.ui.textNode);\n}"
91 "ddGroup": "products",
100 "xtype": "AsyncTreeNode",
105 "create": "function (This, attr)\n{\n //Roo.log(attr);\n attr.text = attr.display_order + '. ' + attr.title;\n \n attr.allowChildren = true;\n}"
108 "queryParam": "parent_id",
109 "requestMethod": "GET",
111 "xtype": "TreeLoader",
112 "|baseParams": "{ _tree: 1, 'sort': 'display_order,title', 'dir': 'ASC' }",
113 "|dataUrl": "baseURL + '/Roo/Category.php'",
125 "click": "function (_self, e)\n{\n\n var sel = _this.panel.tree.getSelectionModel().getSelectedNode();\n if (!sel || isNaN(parseInt(sel.id))) {\n Roo.MessageBox.alert(\"Error\", \"select a category to edit\");\n return;\n }\n var ats = sel.attributes;\n\n Pman.Dialog.CmsCategory.show( ats , function(r)\n {\n Roo.log(r);\n if (r && r.title) {\n sel.setText(r.display_order + '. ' + r.title);\n }\n sel.attributes = r;\n });\n}"
129 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",