3 "name": "Pman.Dialog.CmsProduct",
6 "path": "/home/edward/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 _this.form.findField('id').setValue(_this.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",
87 "name": "category_id",
102 "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}"
105 "title": "Images / PDF",
106 "xtype": "NestedLayoutPanel",
111 "xtype": "BorderLayout",
116 "xtype": "LayoutRegion",
123 "xtype": "LayoutRegion",
128 "fitContainer": true,
131 "xtype": "ContentPanel",
141 "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}"
145 "|xns": "Roo.Toolbar"
148 "|xns": "Roo.Toolbar",
153 "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 }"
155 "text": "Delete File/Image",
157 "|xns": "Roo.Toolbar"
163 "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}"
166 "singleSelect": true,
168 "|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",
174 "|html": "'<div class=\"thumb-wrap\"> ' + \n '<div class=\"thumb\"><img src=\"'+ baseURL + '/Images/Thumb/150/{id}/{filename}\" class=\"thumb-img\"></div>' + \n'</div>'",
183 "xtype": "ContentPanel",
188 "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}",
189 "rendered": "function (form)\n{\n _this.uploadForm = form;\n}"
194 "style": "margin: 10px;",
196 "|url": "baseURL + '/Roo/Images.php'",
205 "fieldLabel": "Upload Image or File",
207 "name": "imageUpload",
209 "xtype": "TextField",
236 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
238 "*prop": "buttons[]",
245 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
247 "*prop": "buttons[]",