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             "height": 500,
10             "modal": true,
11             "title": "Add / Edit Images",
12             "width": 900,
13             "xtype": "LayoutDialog",
14             "|xns": "Roo",
15             "items": [
16                 {
17                     "|xns": "Roo",
18                     "xtype": "LayoutRegion",
19                     "*prop": "center"
20                 },
21                 {
22                     "listeners": {
23                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
24                     },
25                     "region": "center",
26                     "background": true,
27                     "fitContainer": true,
28                     "fitToframe": true,
29                     "tableName": "Images",
30                     "title": "Images",
31                     "xtype": "GridPanel",
32                     "|xns": "Roo",
33                     "items": [
34                         {
35                             "*prop": "grid",
36                             "xtype": "Grid",
37                             "autoExpandColumn": "title",
38                             "loadMask": true,
39                             "listeners": {
40                                 "|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}",
41                                 "|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}"
42                             },
43                             "|xns": "Roo.grid",
44                             "items": [
45                                 {
46                                     "listeners": {
47                                         "|beforeload": "function (_self, o)\n{\n    o.params.ontable = 'Companies';\n    o.params['query[imagesize]'] = '150x150';\n    o.params['query[imageBaseURL]'] = rootURL + '/release.php';\n      \n    var sel = Pman.Tab.PressReleaseCompanies  ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false\n  //   o.params.imgtype = 'PressRelease';\n    o.params.onid = sel ? sel.data.id : 0;\n    if (!o.params.onid) {\n         if (!_this.isBuilder) {\n           _this.panel.el.mask('select company');\n        }\n         return false;\n    }\n    \n    \n}",
48                                         "|load": "function (_self, records, options)\n{\n _this.panel.el.unmask();\n}"
49                                     },
50                                     "*prop": "dataSource",
51                                     "remoteSort": true,
52                                     "xtype": "Store",
53                                     "|sortInfo": "{ field: 'created' , direction: 'DESC' }",
54                                     "|xns": "Roo.data",
55                                     "items": [
56                                         {
57                                             "*prop": "reader",
58                                             "id": "id",
59                                             "root": "data",
60                                             "totalProperty": "total",
61                                             "xtype": "JsonReader",
62                                             "|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]",
63                                             "|xns": "Roo.data"
64                                         },
65                                         {
66                                             "*prop": "proxy",
67                                             "xtype": "HttpProxy",
68                                             "method": "GET",
69                                             "|url": "baseURL + '/Roo/Images.php'",
70                                             "|xns": "Roo.data"
71                                         }
72                                     ]
73                                 },
74                                 {
75                                     "*prop": "footer",
76                                     "xtype": "PagingToolbar",
77                                     "pageSize": 25,
78                                     "displayInfo": true,
79                                     "displayMsg": "Displaying Images  {0} - {1} of {2}",
80                                     "emptyMsg": "No Images found",
81                                     "|xns": "Roo"
82                                 },
83                                 {
84                                     "*prop": "toolbar",
85                                     "xtype": "Toolbar",
86                                     "|xns": "Roo",
87                                     "items": [
88                                         {
89                                             "listeners": {
90                                                 "|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        "
91                                             },
92                                             "cls": "x-btn-text-icon",
93                                             "text": "Add",
94                                             "xtype": "Button",
95                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
96                                             "|xns": "Roo.Toolbar"
97                                         },
98                                         {
99                                             "listeners": {
100                                                 "|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        "
101                                             },
102                                             "cls": "x-btn-text-icon",
103                                             "text": "Edit",
104                                             "xtype": "Button",
105                                             "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
106                                             "|xns": "Roo"
107                                         },
108                                         {
109                                             "listeners": {
110                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, 'Images'); \n        }\n        "
111                                             },
112                                             "cls": "x-btn-text-icon",
113                                             "text": "Delete",
114                                             "xtype": "Button",
115                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
116                                             "|xns": "Roo.Toolbar"
117                                         }
118                                     ]
119                                 },
120                                 {
121                                     "xtype": "ColumnModel",
122                                     "header": "Created",
123                                     "width": 100,
124                                     "dataIndex": "created",
125                                     "|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     ",
126                                     "listeners": {},
127                                     "sortable": true,
128                                     "|xns": "Roo.grid",
129                                     "*prop": "colModel[]"
130                                 },
131                                 {
132                                     "*prop": "colModel[]",
133                                     "dataIndex": "id",
134                                     "header": "Image",
135                                     "width": 100,
136                                     "xtype": "ColumnModel",
137                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" width=\"100\">', baseURL, v, r.data.filename); }",
138                                     "|xns": "Roo.grid"
139                                 },
140                                 {
141                                     "*prop": "colModel[]",
142                                     "dataIndex": "title",
143                                     "header": "Details",
144                                     "width": 100,
145                                     "xtype": "ColumnModel",
146                                     "|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    }",
147                                     "|xns": "Roo.grid"
148                                 }
149                             ]
150                         }
151                     ]
152                 },
153                 {
154                     "*prop": "buttons[]",
155                     "text": "Cancel",
156                     "xtype": "Button",
157                     "|xns": "Roo"
158                 },
159                 {
160                     "|xns": "Roo",
161                     "xtype": "Button",
162                     "*prop": "buttons[]"
163                 }
164             ]
165         }
166     ],
167     "permname": "",
168     "modOrder": "001"
169 }