PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminImage.bjs
1 {
2  "name" : "Pman.Dialog.BAdminImage",
3  "parent" : "",
4  "title" : "Pman.Dialog.BAdminImage",
5  "path" : "/home/benny/gitlive/web.coba/Pman.BAdmin/Pman.Dialog.BAdminImage.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "ef797d5638c2e1c6b6225b2247541ea5" : "Upload Image or File:",
10   "2859a4ae58ae4e25abdfc530f814e42f" : "Upload an Image or File",
11   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
12   "91412465ea9169dfd901dd5e7c96dd99" : "Upload"
13  },
14  "items" : [
15   {
16    "string haveProgress" : false,
17    "xtype" : "Modal",
18    "string uploadComplete" : false,
19    "$ 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",
20    "$ xns" : "Roo.bootstrap",
21    "String title" : "Upload an Image or File",
22    "items" : [
23     {
24      "xtype" : "Container",
25      "$ xns" : "Roo.bootstrap",
26      "String style" : "width: 100%",
27      "items" : [
28       {
29        "listeners" : {
30         "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('<BR/>'));\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}",
31         "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",
32         "render" : "function (_self)\n{\n    _this.form = this;\n}"
33        },
34        "xtype" : "Form",
35        "Number timeout" : 300,
36        "$ xns" : "Roo.bootstrap",
37        "Boolean fileUpload" : true,
38        "String method" : "POST",
39        "$ String url" : "baseURL + '/Roo/Images.php'",
40        "items" : [
41         {
42          "String name" : "imageUpload",
43          "xtype" : "Input",
44          "string fieldLabel" : "Upload Image or File:",
45          "String inputType" : "file",
46          "$ xns" : "Roo.bootstrap",
47          "Number labelWidth" : 4
48         },
49         {
50          "String name" : "UPLOAD_IDENTIFIER",
51          "xtype" : "Input",
52          "String inputType" : "hidden",
53          "$ xns" : "Roo.bootstrap"
54         },
55         {
56          "String name" : "post_max_size",
57          "xtype" : "Input",
58          "String inputType" : "hidden",
59          "$ xns" : "Roo.bootstrap"
60         },
61         {
62          "String name" : "upload_max_filesize",
63          "xtype" : "Input",
64          "String inputType" : "hidden",
65          "$ xns" : "Roo.bootstrap"
66         },
67         {
68          "String name" : "ontable",
69          "xtype" : "Input",
70          "String inputType" : "hidden",
71          "$ xns" : "Roo.bootstrap"
72         },
73         {
74          "String name" : "onid",
75          "xtype" : "Input",
76          "String inputType" : "hidden",
77          "$ xns" : "Roo.bootstrap"
78         },
79         {
80          "String name" : "id",
81          "xtype" : "Input",
82          "String inputType" : "hidden",
83          "$ xns" : "Roo.bootstrap"
84         }
85        ]
86       }
87      ]
88     },
89     {
90      "listeners" : {
91       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
92      },
93      "xtype" : "Button",
94      "html" : "Cancel",
95      "$ string weight" : "'default'",
96      "$ xns" : "Roo.bootstrap",
97      "* prop" : "buttons[]"
98     },
99     {
100      "listeners" : {
101       "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}"
102      },
103      "xtype" : "Button",
104      "html" : "Upload",
105      "$ string weight" : "'primary'",
106      "$ xns" : "Roo.bootstrap",
107      "* prop" : "buttons[]"
108     }
109    ]
110   }
111  ]
112 }