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