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