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