X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Dialog.Image.bjs;h=32f560f2236a202615ab6f127024d9d6cb428f2e;hp=e1dd4ea4a3c2c0466a6b00f17a8aff23d25d14f8;hb=586e4eb470252d837ba18b67e4c3c1702131fd1d;hpb=e121c32b6e12f6223f18c1b5403ebf2f1ca77104 diff --git a/Pman.Dialog.Image.bjs b/Pman.Dialog.Image.bjs index e1dd4ea4..32f560f2 100644 --- a/Pman.Dialog.Image.bjs +++ b/Pman.Dialog.Image.bjs @@ -2,17 +2,28 @@ "name" : "Pman.Dialog.Image", "parent" : "", "title" : "", - "path" : "/home/alan/gitlive/Pman.Core/Pman.Dialog.Image.bjs", + "path" : "/home/edward/gitlive/Pman.Core/Pman.Dialog.Image.bjs", "permname" : "", "modOrder" : "001", "strings" : { "eb5d45750c7ab13aa8e6bacc80315a30" : "32M", "2859a4ae58ae4e25abdfc530f814e42f" : "Upload an Image or File", - "c4ca4238a0b923820dcc509a6f75849b" : "1", + "1243daf593fa297e07ab03bf06d925af" : "Searching...", "ea4788705e6873b424c65e91c2846b19" : "Cancel", + "8e16a71b3d8217eb80b39b7d8dec4296" : "Image Type", + "dff0c70e4c11953e4e3ee1cf268fb96d" : "Select image type", "91412465ea9169dfd901dd5e7c96dd99" : "Upload", "ea72bacd2fdfa818907bb9559e6905a1" : "Upload Image or File" }, + "named_strings" : { + "imgtype_name_fieldLabel" : "8e16a71b3d8217eb80b39b7d8dec4296", + "imgtype_name_loadingText" : "1243daf593fa297e07ab03bf06d925af", + "imgtype_name_emptyText" : "dff0c70e4c11953e4e3ee1cf268fb96d", + "upload_max_filesize_value" : "eb5d45750c7ab13aa8e6bacc80315a30", + "imgtype_name_qtip" : "dff0c70e4c11953e4e3ee1cf268fb96d", + "post_max_size_value" : "eb5d45750c7ab13aa8e6bacc80315a30", + "imageUpload_fieldLabel" : "ea72bacd2fdfa818907bb9559e6905a1" + }, "items" : [ { "listeners" : { @@ -29,7 +40,7 @@ "closable" : false, "resizable" : false, "haveProgress" : false, - "height" : 200, + "height" : 140, "$ 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 //console.log(data);\n var data = res.data;\n if (dlg.haveProgress == 2) {\n // it's been closed elsewhere..\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 // console.log('fail');\n // console.log(data);\n }\n })\n \n}\n", "items" : [ { @@ -40,13 +51,14 @@ { "fitToFrame" : true, "region" : "center", + "Boolean fitContainer" : true, "xtype" : "ContentPanel", "$ xns" : "Roo", "items" : [ { "listeners" : { "actionfailed" : "function (_self, act)\n{\n \n \n _this.dialog.uploadComplete = true;\n // _this.dialog.el.unmask();\n // error msg???\n _this.dialog.haveProgress = 2; \n if (act.type == 'submit') {\n Roo.log(\"Upload error\");\n Roo.log(act);\n \n try {\n Roo.MessageBox.alert(\"Error\", act.result.errorMsg.split(/\\n/).join('
'));\n } catch(e) {\n // Roo.log(e);\n Roo.MessageBox.alert(\"Error\", \"Saving failed = fix errors and try again\"); \n }\n return;\n }\n \n // what about load failing..\n Roo.MessageBox.alert(\"Error\", \"Error loading details\"); \n}", - "|actioncomplete" : "function(_self,act)\n{\n _this.dialog.uploadComplete = true;\n _this.dialog.haveProgress = 2; \n Roo.MessageBox.hide(); // force hiding\n //_this.dialog.el.unmask();\n \n if (act.type == 'setdata') { \n this.url = _this.data._url ? _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 (act.type == 'load') {\n // should this happen? \n _this.data = act.result.data;\n // _this.loaded();\n return;\n }\n \n \n if (act.type == 'submit') { // only submitted here if we are \n _this.dialog.hide();\n Roo.log(\"Upload success\");\n Roo.log(act);\n //console.log(act);\n if (_this.callback) {\n _this.callback.call(this, act.result.data, act.result.extra);\n }\n return; \n }\n \n\n \n}\n", + "|actioncomplete" : "function(_self,act)\n{\n _this.dialog.uploadComplete = true;\n _this.dialog.haveProgress = 2; \n Roo.MessageBox.hide(); // force hiding\n //_this.dialog.el.unmask();\n \n if (act.type == 'setdata') { \n \n _this.form.findField('imgtype').hide();\n \n _this.dialog.resizeTo(500, 140);\n \n if(_this.data._show_image_type){\n _this.form.findField('imgtype').show();\n _this.dialog.resizeTo(500, 170);\n }\n \n this.url = _this.data._url ? _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 (act.type == 'load') {\n // should this happen? \n _this.data = act.result.data;\n // _this.loaded();\n return;\n }\n \n \n if (act.type == 'submit') { // only submitted here if we are \n _this.dialog.hide();\n Roo.log(\"Upload success\");\n Roo.log(act);\n //console.log(act);\n if (_this.callback) {\n _this.callback.call(this, act.result.data, act.result.extra);\n }\n return; \n }\n \n\n \n}\n", "|rendered" : "function (form)\n{\n _this.form= form;\n}\n" }, "$ url" : "baseURL + '/Roo/Images.php'", @@ -84,30 +96,74 @@ "name" : "imageUpload" }, { - "xtype" : "Hidden", + "listWidth" : 400, + "String actionMode" : "fieldEl", + "alwaysQuery" : true, + "triggerAction" : "all", + "fieldLabel" : "Image Type", + "forceSelection" : true, + "selectOnFocus" : true, + "pageSize" : 20, + "displayField" : "display_name", + "emptyText" : "Select image type", + "hiddenName" : "imgtype", + "minChars" : 2, + "valueField" : "name", + "xtype" : "ComboBox", + "allowBlank" : true, + "typeAhead" : true, + "width" : 250, "$ xns" : "Roo.form", - "name" : "ontable" + "name" : "imgtype_name", + "qtip" : "Select image type", + "queryParam" : "query[search]", + "tpl" : "
{display_name} {name}
", + "loadingText" : "Searching...", + "items" : [ + { + "listeners" : { + "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n \n o.params.etype = 'ImageType';\n \n o.params.active = 1;\n}\n" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ direction : 'ASC', field: 'name' }", + "$ xns" : "Roo.data", + "* prop" : "store", + "items" : [ + { + "$ url" : "baseURL + '/Roo/Core_enum'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" + }, + { + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]", + "$ xns" : "Roo.data", + "* prop" : "reader", + "totalProperty" : "total" + } + ] + } + ] }, { "xtype" : "Hidden", "$ xns" : "Roo.form", - "name" : "onid" + "name" : "ontable" }, { "xtype" : "Hidden", "$ xns" : "Roo.form", - "name" : "id" - }, - { - "String name" : "fred", - "xtype" : "Text", - "Mixed value" : 1, - "$ xns" : "Roo.form" + "name" : "onid" }, { "xtype" : "Hidden", "$ xns" : "Roo.form", - "name" : "imgtype" + "name" : "id" } ] } @@ -124,7 +180,7 @@ }, { "listeners" : { - "click" : "function (_self, e)\n{\n // do some checks?\n \n //_this.dialog.el.mask(\"Sending\");\n _this.dialog.uploadComplete = false;\n _this.form.doAction('submit', {\n params: {\n ts : Math.random()\n } \n });\n _this.dialog.haveProgress = 0; // set to show..\n _this.dialog.uploadProgress.defer(1000, _this.dialog);\n\n}" + "click" : "function (_self, e)\n{\n // do some checks?\n \n //_this.dialog.el.mask(\"Sending\");\n _this.dialog.uploadComplete = false;\n _this.form.doAction('submit', {\n params: {\n ts : Math.random()\n }\n });\n _this.dialog.haveProgress = 0; // set to show..\n _this.dialog.uploadProgress.defer(1000, _this.dialog);\n\n}" }, "text" : "Upload", "xtype" : "Button",