Pman.Dialog.AdminEnumImages.bjs
[Pman.Admin] / Pman.Dialog.AdminEnumImages.bjs
1 {
2     "id": "roo-file-266",
3     "name": "Pman.Dialog.AdminEnumImages",
4     "parent": "",
5     "title": "",
6     "path": "/home/chris/gitlive/Pman.Admin/Pman.Dialog.AdminEnumImages.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    _this.grid\n}"
11             },
12             "height": 500,
13             "modal": true,
14             "title": "Add / Edit Images",
15             "width": 900,
16             "xtype": "LayoutDialog",
17             "|xns": "Roo",
18             "items": [
19                 {
20                     "|xns": "Roo",
21                     "xtype": "LayoutRegion",
22                     "*prop": "center"
23                 },
24                 {
25                     "listeners": {
26                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
27                     },
28                     "background": false,
29                     "fitContainer": true,
30                     "fitToframe": true,
31                     "region": "center",
32                     "tableName": "Images",
33                     "title": "Images",
34                     "xtype": "GridPanel",
35                     "|xns": "Roo",
36                     "items": [
37                         {
38                             "*prop": "grid",
39                             "xtype": "Grid",
40                             "autoExpandColumn": "title",
41                             "loadMask": true,
42                             "listeners": {
43                                 "|render": "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
44                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n  \n   var s =  _self.getDataSource().getAt(rowIndex);\n     Pman.Dialog.PressReleaseImage.show(s.data, function() {\n                _this.grid.footer.onClick('first');\n               }); \n}"
45                             },
46                             "|xns": "Roo.grid",
47                             "items": [
48                                 {
49                                     "listeners": {
50                                         "|beforeload": "function (_self, o)\n{\n    //o.params.ontable = 'Companies';\n    \n  //   o.params.imgtype = 'PressRelease';\n    \n    o.params = o.params || {};\n    Roo.log(_this);\n    \n}",
51                                         "|load": "function (_self, records, options)\n{\n _this.panel.el.unmask();\n}"
52                                     },
53                                     "*prop": "dataSource",
54                                     "remoteSort": true,
55                                     "xtype": "Store",
56                                     "|sortInfo": "{ field: 'created' , direction: 'DESC' }",
57                                     "|xns": "Roo.data",
58                                     "items": [
59                                         {
60                                             "*prop": "reader",
61                                             "id": "id",
62                                             "root": "data",
63                                             "totalProperty": "total",
64                                             "xtype": "JsonReader",
65                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    }\n]",
66                                             "|xns": "Roo.data"
67                                         },
68                                         {
69                                             "*prop": "proxy",
70                                             "xtype": "HttpProxy",
71                                             "method": "GET",
72                                             "|url": "baseURL + '/Roo/Images.php'",
73                                             "|xns": "Roo.data"
74                                         }
75                                     ]
76                                 },
77                                 {
78                                     "*prop": "footer",
79                                     "xtype": "PagingToolbar",
80                                     "pageSize": 25,
81                                     "displayInfo": true,
82                                     "displayMsg": "Displaying Images  {0} - {1} of {2}",
83                                     "emptyMsg": "No Images found",
84                                     "|xns": "Roo"
85                                 },
86                                 {
87                                     "*prop": "toolbar",
88                                     "xtype": "Toolbar",
89                                     "|xns": "Roo",
90                                     "items": [
91                                         {
92                                             "listeners": {
93                                                 "|click": "function()\n        {\n            \n      var sel = Pman.Tab.PressReleaseCompanies  ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false\n     \n    Pman.Dialog.Image.show( {\n       id : 0, \n        ontable: 'Companies', \n         onid: sel.data.id,\n    imgtype : 'PressRelease'\n     }, \n    function(data) {\n                if (!data) { return; } \n     Pman.Dialog.PressReleaseImage.show( data, function() {\n                  _this.grid.footer.onClick('first');\n\n            }); \n                }); \n\n        }\n        "
94                                             },
95                                             "cls": "x-btn-text-icon",
96                                             "text": "Add",
97                                             "xtype": "Button",
98                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
99                                             "|xns": "Roo.Toolbar"
100                                         },
101                                         {
102                                             "listeners": {
103                                                 "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s || s.length != 1) {\n        Roo.MessageBox.alert(\"Error\", \"Select a single image to edit\");\n       return;\n     }\n     var data = _this.grid.getDataSource().getById(s[0].data.id).data;\n    \n             Pman.Dialog.PressReleaseImage.show(data, function() {\n                _this.grid.footer.onClick('first');\n               }); \n            \n        }\n        "
104                                             },
105                                             "cls": "x-btn-text-icon",
106                                             "text": "Edit",
107                                             "xtype": "Button",
108                                             "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
109                                             "|xns": "Roo"
110                                         },
111                                         {
112                                             "listeners": {
113                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, 'Images'); \n        }\n        "
114                                             },
115                                             "cls": "x-btn-text-icon",
116                                             "text": "Delete",
117                                             "xtype": "Button",
118                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
119                                             "|xns": "Roo.Toolbar"
120                                         }
121                                     ]
122                                 },
123                                 {
124                                     "xtype": "ColumnModel",
125                                     "header": "Created",
126                                     "width": 100,
127                                     "dataIndex": "created",
128                                     "|renderer": "function(v,x,r) {\n       return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',\n            v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n    r.data.width, r.data.height\n    ); \n}\n     ",
129                                     "listeners": {},
130                                     "sortable": true,
131                                     "|xns": "Roo.grid",
132                                     "*prop": "colModel[]"
133                                 },
134                                 {
135                                     "*prop": "colModel[]",
136                                     "dataIndex": "id",
137                                     "header": "Image",
138                                     "width": 100,
139                                     "xtype": "ColumnModel",
140                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" width=\"100\">', baseURL, v, r.data.filename); }",
141                                     "|xns": "Roo.grid"
142                                 },
143                                 {
144                                     "*prop": "colModel[]",
145                                     "dataIndex": "title",
146                                     "header": "Details",
147                                     "width": 100,
148                                     "xtype": "ColumnModel",
149                                     "|renderer": "function(v,x,r) {\n     var surl = r.json.url.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n     var svurl = r.json.url_view.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n      return String.format(\n          'Download Url : <a href=\"http://{0}{1}\" target=\"_new\">http://{0}{1}</a>' + \n          '<br/>View Url : <a href=\"http://{0}{2}\" target=\"_new\">http://{0}{2}</a>' + \n          '<br/><b>{3}</b><br/>{4}</i>', \n          window.location.host, surl, svurl,\n           v, r.json.descript); \n     \n    }",
150                                     "|xns": "Roo.grid"
151                                 }
152                             ]
153                         }
154                     ]
155                 },
156                 {
157                     "listeners": {
158                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n    _this.callback(true);\n}"
159                     },
160                     "*prop": "buttons[]",
161                     "text": "Cancel",
162                     "xtype": "Button",
163                     "|xns": "Roo"
164                 },
165                 {
166                     "listeners": {
167                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n    _this.callback(true);\n}"
168                     },
169                     "*prop": "buttons[]",
170                     "text": "OK",
171                     "xtype": "Button",
172                     "|xns": "Roo"
173                 }
174             ]
175         }
176     ],
177     "permname": "",
178     "modOrder": "001"
179 }