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