3 "name": "Pman.Dialog.CmsProduct",
6 "path": "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsProduct.bjs",
14 "title": "Edit / Create Product",
16 "xtype": "LayoutDialog",
21 "xtype": "LayoutRegion",
27 "xtype": "LayoutRegion",
32 "xtype": "ContentPanel",
37 "|actioncomplete": "function(_self,action)\n{\n if (action.type == 'setdata') {\n \n if (_this.data.id) {\n _this.dialog.el.mask(\"Loading\");\n this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n return;\n }\n _this.imageView.loadImages();\n return;\n }\n if (action.type == 'load') {\n _this.imageView.loadImages();\n _this.dialog.el.unmask();\n return;\n }\n if (action.type =='submit') {\n \n _this.dialog.el.unmask();\n \n _this.data.id = (action.result.data.id);\n if (_this.callback) {\n var res = _this.callback.call(_this, _this.form.getValues());\n if (res === false) {\n return;\n }\n }\n _this.dialog.hide();\n _this.form.reset();\n return;\n }\n}\n",
38 "|rendered": "function (form)\n{\n _this.form= form;\n}\n"
41 "style": "margin:10px;",
43 "|url": "baseURL + '/Roo/Product.php'",
62 "valid": "function (_self)\n{\n\n}"
64 "fieldLabel": "Visible",
77 "fieldLabel": "Description",
79 "name": "description",
97 "activate": "function (_self)\n{\n //console.log('activate');\n if ( _this.imageView ){ \n _this.imageView.loadImages();\n }\n\n if (_this.hasUploadWatch) {\n return;\n }\n _this.hasUploadWatch =true;\n _this.uploadSending =false;\n window.setInterval( function()\n {\n var val = _this.uploadForm.findField('imageUpload').getValue();\n if (!val || !val.length) {\n return;\n }\n \n if (_this.uploadSending) {\n return;\n }\n \n if (!_this.data.id) {\n // trigger a save..\n var cb = _this.callback;\n _this.callback = function() {\n _this.uploadSending = false;\n _this.callback = cb;\n return false;\n }\n _this.uploadSending = true;\n _this.form.doAction(\"submit\");\n return;\n }\n \n _this.uploadSending =true;\n _this.uploadForm.findField('onid').setValue(_this.data.id);\n _this.uploadForm.el.mask(\"Sending\");\n _this.uploadForm.submit.defer(100, _this.uploadForm);\n \n }, 1000) \n \n}"
100 "title": "Images / PDF",
101 "xtype": "NestedLayoutPanel",
106 "xtype": "BorderLayout",
111 "xtype": "LayoutRegion",
118 "xtype": "LayoutRegion",
123 "fitContainer": true,
126 "xtype": "ContentPanel",
136 "click": "function (_self, e)\n{\n \n if (!_this.imageView.getSelectedNodes().length) {\n Roo.MessageBox.alert(\"Error\", \"Select an Image\");\n return;\n }\n var n = _this.imageView.getNodeData(_this.imageView.getSelectedNodes()[0]);\n\n // open a new window with this file in..\n Pman.download( {\n url: baseURL + '/Images/Download/' + n.id + '/' + n.filename\n });\n}"
140 "|xns": "Roo.Toolbar"
143 "|xns": "Roo.Toolbar",
148 "click": "function (_self, e)\n{\n if (!_this.imageView.getSelectedNodes().length) {\n Roo.MessageBox.alert(\"Error\", \"Select an Image\");\n return;\n }\n var id = _this.imageView.getNodeData(_this.imageView.getSelectedNodes()[0]).id;\n _this.imageView.el.mask('Deleting');\n \n Roo.Ajax.request({\n url : baseURL + '/Roo/Images.php',\n params : {\n _delete : id\n },\n method : 'GET',\n success : function() {\n _this.imageView.el.unmask();\n _this.imageView.loadImages();\n },\n failure : function() {\n _this.imageView.el.unmask();\n Roo.MessageBox.alert(\"Error\", \"Error deleting image\");\n return;\n }\n });\n }"
150 "text": "Delete File/Image",
152 "|xns": "Roo.Toolbar"
158 "beforerender": "function (_self, data)\n{\n _this.imageView = _self;\n \n if (this.stylesheet) {\n return;\n }\n this.el.addClass('thumb-browser');\n\n \n this.stylesheet = Roo.util.CSS.createStyleSheet(\n {\n '.thumb-browser .thumb-wrap' : {\n border:'3px solid #EEE',\n 'float':'left',\n height:'160px',\n margin:'2px',\n 'padding-left':'5px',\n 'padding-top':'5px',\n width:'160px'\n },\n '.thumb-browser .x-view-selected' : {\n border:'3px solid #333'\n \n }\n\n\n }, Roo.id()\n );\n \n}"
161 "singleSelect": true,
163 "|loadImages": "function() {\n if (!_this.data.id) {\n this.clearSelections();\n this.el.update(\"\");\n this.jsonData = [];\n return; \n } \n\n this.load({\n url : baseURL + '/Roo/Images.php',\n method : 'GET',\n params : {\n ontable : 'Product',\n onid : _this.data.id,\n 'query[imagesize]' : 150\n },\n text : 'Loading'\n });\n \n}\n",
169 "|html": "'<div class=\"thumb-wrap\"> ' + \n '<div class=\"thumb\"><img src=\"'+ baseURL + '/Images/Thumb/150/{id}/{filename}\" class=\"thumb-img\"></div>' + \n'</div>'",
178 "xtype": "ContentPanel",
183 "actioncomplete": "function (_self, action)\n{\n// only action this will handle is submit?\n// should test for errors..\n if (action.failureType) {\n _this.uploadForm.el.unmask();\n _this.uploadSending = false;\n Roo.MessageBox.alert(\"Error\", \"Upload Failed\");\n return false;\n \n }\n \n \n if (action.type =='submit') {\n _this.uploadForm.reset();\n _this.uploadSending = false;\n _this.uploadForm.el.unmask(); \n _this.imageView.loadImages();\n return;\n }\n \n}",
184 "rendered": "function (form)\n{\n _this.uploadForm = form;\n}"
189 "style": "margin: 10px;",
191 "|url": "baseURL + '/Roo/Images.php'",
200 "fieldLabel": "Upload Image or File",
202 "name": "imageUpload",
204 "xtype": "TextField",
231 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
233 "*prop": "buttons[]",
240 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
242 "*prop": "buttons[]",