fix #8131 - chinese translations
[Pman.Core] / Pman.Dialog.Image.bjs
1 {
2  "gen_extended" : false,
3  "items" : [
4   {
5    "$ uploadProgress" : [
6     "function()",
7     "{",
8     "    var dlg = this;",
9     "   if (!dlg.haveProgress) {",
10     "        Roo.MessageBox.progress(\"Uploading\", \"Uploading\");",
11     "    }",
12     "    ",
13     "    if (dlg.haveProgress == 2) {",
14     "        // it's been closed elsewhere..",
15     "        return;",
16     "    }",
17     "    if (dlg.uploadComplete) {",
18     "        Roo.MessageBox.hide();",
19     "        return;",
20     "    }",
21     "    ",
22     "    dlg.haveProgress = 1;",
23     "",
24     "    var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();",
25     "    new Pman.Request({",
26     "        url : baseURL + '/Core/UploadProgress.php',",
27     "        params: {",
28     "            id : uid",
29     "        },",
30     "        method: 'GET',",
31     "        success : function(res){",
32     "            //console.log(data);",
33     "            var data = res.data;",
34     "            if (dlg.haveProgress == 2) {",
35     "                // it's been closed elsewhere..",
36     "                return;",
37     "            }",
38     "            ",
39     "            if (dlg.uploadComplete) {",
40     "                Roo.MessageBox.hide();",
41     "                return;",
42     "            }",
43     "                ",
44     "            if (data){",
45     "                Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,",
46     "                    Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'",
47     "                );",
48     "            } else {",
49     "                Roo.MessageBox.updateProgress(1,",
50     "                    \"Upload Complete - processing\"",
51     "                );",
52     "                return;",
53     "            }",
54     "            dlg.uploadProgress.defer(2000,dlg);",
55     "        },",
56     "        failure: function(data) {",
57     "          //  console.log('fail');",
58     "         //   console.log(data);",
59     "        }",
60     "    })",
61     "    ",
62     "}",
63     ""
64    ],
65    "$ xns" : "Roo",
66    "closable" : false,
67    "collapsible" : false,
68    "haveProgress" : false,
69    "height" : 140,
70    "items" : [
71     {
72      "$ xns" : "Roo",
73      "* prop" : "center",
74      "xtype" : "LayoutRegion"
75     },
76     {
77      "$ xns" : "Roo",
78      "Boolean fitContainer" : true,
79      "fitToFrame" : true,
80      "items" : [
81       {
82        "$ url" : "baseURL + '/Roo/Images.php'",
83        "$ xns" : "Roo.form",
84        "fileUpload" : true,
85        "items" : [
86         {
87          "$ xns" : "Roo.form",
88          "name" : "UPLOAD_IDENTIFIER",
89          "xtype" : "Hidden"
90         },
91         {
92          "$ xns" : "Roo.form",
93          "name" : "post_max_size",
94          "value" : "32M",
95          "xtype" : "Hidden"
96         },
97         {
98          "$ xns" : "Roo.form",
99          "name" : "upload_max_filesize",
100          "value" : "32M",
101          "xtype" : "Hidden"
102         },
103         {
104          "$ xns" : "Roo.form",
105          "Boolean allowBlank" : false,
106          "fieldLabel" : "Upload Image or File",
107          "inputType" : "file",
108          "name" : "imageUpload",
109          "width" : 200,
110          "xtype" : "TextField"
111         },
112         {
113          "$ xns" : "Roo.form",
114          "String actionMode" : "fieldEl",
115          "allowBlank" : true,
116          "alwaysQuery" : true,
117          "displayField" : "display_name",
118          "emptyText" : "Select image type",
119          "fieldLabel" : "Image Type",
120          "forceSelection" : true,
121          "hiddenName" : "imgtype",
122          "items" : [
123           {
124            "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
125            "$ xns" : "Roo.data",
126            "* prop" : "store",
127            "items" : [
128             {
129              "$ url" : "baseURL + '/Roo/Core_enum'",
130              "$ xns" : "Roo.data",
131              "* prop" : "proxy",
132              "method" : "GET",
133              "xtype" : "HttpProxy"
134             },
135             {
136              "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
137              "$ xns" : "Roo.data",
138              "* prop" : "reader",
139              "id" : "id",
140              "root" : "data",
141              "totalProperty" : "total",
142              "xtype" : "JsonReader"
143             }
144            ],
145            "listeners" : {
146             "|beforeload" : [
147              "function (_self, o){",
148              "    o.params = o.params || {};",
149              "    ",
150              "    o.params.etype = 'ImageType';",
151              "    ",
152              "    o.params.active = 1;",
153              "}",
154              ""
155             ]
156            },
157            "remoteSort" : true,
158            "xtype" : "Store"
159           }
160          ],
161          "listWidth" : 400,
162          "loadingText" : "Searching...",
163          "minChars" : 2,
164          "name" : "imgtype_name",
165          "pageSize" : 20,
166          "qtip" : "Select image type",
167          "queryParam" : "query[search]",
168          "selectOnFocus" : true,
169          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>",
170          "triggerAction" : "all",
171          "typeAhead" : true,
172          "valueField" : "name",
173          "width" : 250,
174          "xtype" : "ComboBox"
175         },
176         {
177          "$ xns" : "Roo.form",
178          "name" : "ontable",
179          "xtype" : "Hidden"
180         },
181         {
182          "$ xns" : "Roo.form",
183          "name" : "onid",
184          "xtype" : "Hidden"
185         },
186         {
187          "$ xns" : "Roo.form",
188          "name" : "id",
189          "xtype" : "Hidden"
190         }
191        ],
192        "labelWidth" : 140,
193        "listeners" : {
194         "actionfailed" : [
195          "function (_self, act)",
196          "{",
197          "   ",
198          "   ",
199          "    _this.dialog.uploadComplete = true;",
200          "   // _this.dialog.el.unmask();",
201          "    // error msg???",
202          "     _this.dialog.haveProgress = 2; ",
203          "    if (act.type == 'submit') {",
204          "        Roo.log(\"Upload error\");",
205          "        Roo.log(act);",
206          "        ",
207          "        try {",
208          "            Roo.MessageBox.alert(\"Error\", act.result.errorMsg.split(/\\n/).join('<BR/>'));",
209          "        } catch(e) {",
210          "          //  Roo.log(e);",
211          "            Roo.MessageBox.alert(\"Error\", \"Saving failed = fix errors and try again\");        ",
212          "        }",
213          "        return;",
214          "    }",
215          "    ",
216          "    // what about load failing..",
217          "    Roo.MessageBox.alert(\"Error\", \"Error loading details\"); ",
218          "}"
219         ],
220         "|actioncomplete" : [
221          "function(_self,act)",
222          "{",
223          "    _this.dialog.uploadComplete = true;",
224          "    _this.dialog.haveProgress = 2; ",
225          "    Roo.MessageBox.hide(); // force hiding",
226          "    //_this.dialog.el.unmask();",
227          "     ",
228          "    if (act.type == 'setdata') { ",
229          "    ",
230          "        _this.form.findField('imgtype').hide();",
231          "        ",
232          "        _this.dialog.resizeTo(500, 140);",
233          "        ",
234          "        if(_this.data._show_image_type){",
235          "            _this.form.findField('imgtype').show();",
236          "            _this.dialog.resizeTo(500, 170);",
237          "        }",
238          "        ",
239          "        this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';",
240          "        this.el.dom.action = this.url;",
241          "        if (typeof(_this.data.timeout) != 'undefined') {",
242          "            this.timeout = _this.data.timeout;",
243          "        }",
244          "        ",
245          "        this.findField('UPLOAD_IDENTIFIER').setValue(",
246          "            (new Date() * 1) + '' + Math.random());",
247          "            ",
248          "        return;",
249          "    }",
250          "     ",
251          "   ",
252          "    if (act.type == 'load') {",
253          "      // should this happen?  ",
254          "        _this.data = act.result.data;",
255          "       // _this.loaded();",
256          "        return;",
257          "    }",
258          "    ",
259          "    ",
260          "    if (act.type == 'submit') { // only submitted here if we are ",
261          "        _this.dialog.hide();",
262          "        Roo.log(\"Upload success\");",
263          "        Roo.log(act);",
264          "        //console.log(act);",
265          "        if (_this.callback) {",
266          "            _this.callback.call(this, act.result.data, act.result.extra);",
267          "        }",
268          "        return; ",
269          "    }",
270          " ",
271          "",
272          "    ",
273          "}",
274          ""
275         ],
276         "|rendered" : [
277          "function (form)",
278          "{",
279          "    _this.form= form;",
280          "}",
281          ""
282         ]
283        },
284        "method" : "POST",
285        "style" : "margin:10px;",
286        "timeout" : 300,
287        "xtype" : "Form"
288       }
289      ],
290      "region" : "center",
291      "xtype" : "ContentPanel"
292     },
293     {
294      "$ xns" : "Roo",
295      "* prop" : "buttons[]",
296      "listeners" : {
297       "click" : [
298        "function (_self, e)",
299        "{",
300        "    _this.dialog.hide();",
301        "}"
302       ]
303      },
304      "text" : "Cancel",
305      "xtype" : "Button"
306     },
307     {
308      "$ xns" : "Roo",
309      "* prop" : "buttons[]",
310      "listeners" : {
311       "click" : [
312        "function (_self, e)",
313        "{",
314        "    // do some checks?",
315        "     ",
316        "    //_this.dialog.el.mask(\"Sending\");",
317        "    _this.dialog.uploadComplete = false;",
318        "    _this.form.doAction('submit', {",
319        "        params: {",
320        "            ts : Math.random()",
321        "        }",
322        "    });",
323        "    _this.dialog.haveProgress = 0; // set to show..",
324        "    _this.dialog.uploadProgress.defer(1000, _this.dialog);",
325        "",
326        "}"
327       ]
328      },
329      "text" : "Upload",
330      "xtype" : "Button"
331     }
332    ],
333    "listeners" : {
334     "show" : [
335      "function (_self)",
336      "{",
337      "",
338      "    // this does not really work - escape on the borders works..",
339      "    // resize to fit.. if we have styled stuff...",
340      "    ",
341      "    ",
342      "    ",
343      "    ",
344      "    var d = this;",
345      "    ",
346      "    var pad =     d.el.getSize().height - (d.header.getSize().height +",
347      "        d.footer.getSize().height +        ",
348      "        d.layout.getRegion('center').getPanel(0).el.getSize().height",
349      "        );",
350      "    ",
351      "    var height = (",
352      "        pad + ",
353      "        d.header.getSize().height +",
354      "        d.footer.getSize().height +        ",
355      "        d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height",
356      "    );",
357      "    this.resizeTo(d.el.getSize().width, height);",
358      "    ",
359      "    if (this.keylistener) {",
360      "        return;",
361      "    }",
362      "    this.keylistener = this.addKeyListener(27, this.hide, this);",
363      "    ",
364      "}"
365     ]
366    },
367    "modal" : true,
368    "resizable" : false,
369    "shadow" : true,
370    "title" : "Upload an Image or File",
371    "uploadComplete" : false,
372    "width" : 500,
373    "xtype" : "LayoutDialog"
374   }
375  ],
376  "modOrder" : "001",
377  "name" : "Pman.Dialog.Image",
378  "named_strings" : {
379   "imageUpload_fieldLabel" : "ea72bacd2fdfa818907bb9559e6905a1",
380   "imgtype_name_emptyText" : "dff0c70e4c11953e4e3ee1cf268fb96d",
381   "imgtype_name_fieldLabel" : "8e16a71b3d8217eb80b39b7d8dec4296",
382   "imgtype_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
383   "imgtype_name_qtip" : "dff0c70e4c11953e4e3ee1cf268fb96d",
384   "post_max_size_value" : "eb5d45750c7ab13aa8e6bacc80315a30",
385   "upload_max_filesize_value" : "eb5d45750c7ab13aa8e6bacc80315a30"
386  },
387  "parent" : "",
388  "permname" : "",
389  "strings" : {
390   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
391   "2859a4ae58ae4e25abdfc530f814e42f" : "Upload an Image or File",
392   "8e16a71b3d8217eb80b39b7d8dec4296" : "Image Type",
393   "91412465ea9169dfd901dd5e7c96dd99" : "Upload",
394   "dff0c70e4c11953e4e3ee1cf268fb96d" : "Select image type",
395   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
396   "ea72bacd2fdfa818907bb9559e6905a1" : "Upload Image or File",
397   "eb5d45750c7ab13aa8e6bacc80315a30" : "32M"
398  },
399  "title" : ""
400 }