3 "name": "Pman.Dialog.CmsProduct",
6 "path": "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsProduct.bjs",
13 "title": "Edit / Create Product",
15 "xtype": "LayoutDialog",
20 "xtype": "LayoutRegion",
26 "xtype": "LayoutRegion",
31 "xtype": "ContentPanel",
36 "|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 \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",
37 "|rendered": "function (form)\n{\n _this.form= form;\n}\n"
40 "style": "margin:10px;",
42 "|url": "baseURL + '/Roo/Product.php'",
61 "valid": "function (_self)\n{\n\n}"
63 "fieldLabel": "Visible",
76 "fieldLabel": "Description",
78 "name": "description",
96 "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.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}"
99 "title": "Images / PDF",
100 "xtype": "NestedLayoutPanel",
105 "xtype": "BorderLayout",
110 "xtype": "LayoutRegion",
117 "xtype": "LayoutRegion",
122 "fitContainer": true,
125 "xtype": "ContentPanel",
135 "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}"
139 "|xns": "Roo.Toolbar"
142 "|xns": "Roo.Toolbar",
147 "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 }"
149 "text": "Delete File/Image",
151 "|xns": "Roo.Toolbar"
157 "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}"
160 "singleSelect": true,
162 "|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",
168 "|html": "'<div class=\"thumb-wrap\"> ' + \n '<div class=\"thumb\"><img src=\"'+ baseURL + '/Images/Thumb/150/{id}/{filename}\" class=\"thumb-img\"></div>' + \n'</div>'",
177 "xtype": "ContentPanel",
182 "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}",
183 "rendered": "function (form)\n{\n _this.uploadForm = form;\n}"
188 "style": "margin: 10px;",
190 "|url": "baseURL + '/Roo/Images.php'",
199 "fieldLabel": "Upload Image or File",
201 "name": "imageUpload",
203 "xtype": "TextField",
230 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
232 "*prop": "buttons[]",
239 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
241 "*prop": "buttons[]",