{ "name" : "Pman.Dialog.BAdminImage", "parent" : "", "title" : "Pman.Dialog.BAdminImage", "path" : "/home/benny/gitlive/web.coba/Pman.BAdmin/Pman.Dialog.BAdminImage.bjs", "permname" : "", "modOrder" : "001", "strings" : { "ef797d5638c2e1c6b6225b2247541ea5" : "Upload Image or File:", "2859a4ae58ae4e25abdfc530f814e42f" : "Upload an Image or File", "ea4788705e6873b424c65e91c2846b19" : "Cancel", "91412465ea9169dfd901dd5e7c96dd99" : "Upload" }, "items" : [ { "string haveProgress" : false, "xtype" : "Modal", "string uploadComplete" : false, "$ string uploadProgress" : "function()\n{\n var dlg = this;\n if (!dlg.haveProgress) {\n Roo.MessageBox.progress(\"Uploading\", \"Uploading\");\n }\n \n if (dlg.haveProgress == 2) {\n // it's been closed elsewhere..\n return;\n }\n if (dlg.uploadComplete) {\n Roo.MessageBox.hide();\n return;\n }\n \n dlg.haveProgress = 1;\n\n var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();\n new Pman.Request({\n url : baseURL + '/Core/UploadProgress.php',\n params: {\n id : uid\n },\n method: 'GET',\n success : function(res){\n var data = res.data;\n if (dlg.haveProgress == 2) {\n return;\n }\n \n if (dlg.uploadComplete) {\n Roo.MessageBox.hide();\n return;\n }\n \n if (data){\n Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,\n Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'\n );\n } else {\n Roo.MessageBox.updateProgress(1,\n \"Upload Complete - processing\"\n );\n return;\n }\n dlg.uploadProgress.defer(2000,dlg);\n },\n failure: function(data) {\n }\n })\n \n}\n", "$ xns" : "Roo.bootstrap", "String title" : "Upload an Image or File", "items" : [ { "xtype" : "Container", "$ xns" : "Roo.bootstrap", "String style" : "width: 100%", "items" : [ { "listeners" : { "actionfailed" : "function (_self, action)\n{\n _this.dialog.uploadComplete = true;\n \n _this.dialog.haveProgress = 2;\n \n if (action.type == 'submit') {\n Roo.log(\"Upload error\");\n Roo.log(action);\n \n try {\n \n Roo.MessageBox.alert(\"Error\", action.result.errorMsg.split(/\\n/).join('
'));\n \n } catch(e) {\n \n Roo.MessageBox.alert(\"Error\", \"Saving failed = fix errors and try again\");\n }\n return;\n }\n \n Roo.MessageBox.alert(\"Error\", \"Error loading details\"); \n}", "actioncomplete" : "function(_self,action)\n{\n _this.dialog.uploadComplete = true;\n \n _this.dialog.haveProgress = 2;\n \n Roo.MessageBox.hide();\n \n if (action.type == 'setdata') { \n \n /*\n _this.form.findField('imgtype').hide();\n \n if(_this.data._show_image_type){\n _this.form.findField('imgtype').show();\n }\n */\n \n this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';\n this.el.dom.action = this.url;\n if (typeof(_this.data.timeout) != 'undefined') {\n this.timeout = _this.data.timeout;\n }\n \n this.findField('UPLOAD_IDENTIFIER').setValue(\n (new Date() * 1) + '' + Math.random());\n \n return;\n }\n \n \n if (action.type == 'load') {\n \n _this.data = action.result.data;\n \n return;\n }\n \n \n if (action.type == 'submit') { // only submitted here if we are \n _this.dialog.hide();\n Roo.log(\"Upload success\");\n Roo.log(action);\n if (_this.callback) {\n _this.callback.call(this, action.result.data, action.result.extra);\n }\n return; \n }\n \n\n \n}\n", "render" : "function (_self)\n{\n _this.form = this;\n}" }, "xtype" : "Form", "Number timeout" : 300, "$ xns" : "Roo.bootstrap", "Boolean fileUpload" : true, "String method" : "POST", "$ String url" : "baseURL + '/Roo/Images.php'", "items" : [ { "String name" : "imageUpload", "xtype" : "Input", "string fieldLabel" : "Upload Image or File:", "String inputType" : "file", "$ xns" : "Roo.bootstrap", "Number labelWidth" : 4 }, { "String name" : "UPLOAD_IDENTIFIER", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "post_max_size", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "upload_max_filesize", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "ontable", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "onid", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "id", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" } ] } ] }, { "listeners" : { "click" : "function (_self, e)\n{\n _this.dialog.hide();\n}" }, "xtype" : "Button", "html" : "Cancel", "$ string weight" : "'default'", "$ xns" : "Roo.bootstrap", "* prop" : "buttons[]" }, { "listeners" : { "click" : "function (_self, e)\n{\n // do some checks?\n \n //_this.dialog.el.mask(\"Sending\");\n \n _this.dialog.uploadComplete = false;\n _this.form.doAction('submit', {\n params: {\n ts : Math.random()\n }\n });\n \n _this.dialog.haveProgress = 0; // set to show..\n _this.dialog.uploadProgress.defer(1000, _this.dialog);\n}" }, "xtype" : "Button", "html" : "Upload", "$ string weight" : "'primary'", "$ xns" : "Roo.bootstrap", "* prop" : "buttons[]" } ] } ] }