php7 fixes
[Pman.Builder] / Pman.Dialog.BuilderAddTable.bjs
1 {
2     "id": "roo-file-184",
3     "name": "Pman.Dialog.BuilderAddTable",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/Pman.Builder/Pman.Dialog.BuilderAddTable.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    _this.grid.ds.load({});\n}"
11             },
12             "closable": false,
13             "collapsible": false,
14             "height": 500,
15             "modal": true,
16             "resizable": false,
17             "title": "Select columns to use",
18             "width": 900,
19             "xtype": "LayoutDialog",
20             "|xns": "Roo",
21             "items": [
22                 {
23                     "|xns": "Roo",
24                     "xtype": "LayoutRegion",
25                     "*prop": "center"
26                 },
27                 {
28                     "listeners": {
29                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
30                     },
31                     "background": false,
32                     "fitContainer": true,
33                     "fitToframe": true,
34                     "region": "center",
35                     "tableName": "Images",
36                     "title": "Images",
37                     "xtype": "GridPanel",
38                     "|xns": "Roo",
39                     "items": [
40                         {
41                             "listeners": {
42                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.ds.load({});\n    }\n}",
43                                 "cellclick": "function (_self, ri, ci , e)\n{\n   if (ci > 1) {return; }\n   \n    var rec = this.ds.getAt(ri);\n    var di = this.cm.getDataIndex(ci);\n    rec.set(di, (rec.data[di] * 1) ? 0 : 1);\n     rec.commit();\n     \n      \n      \n}"
44                             },
45                             "*prop": "grid",
46                             "autoExpandColumn": "desc",
47                             "clicksToEdit": 1,
48                             "loadMask": true,
49                             "xtype": "EditorGrid",
50                             "|xns": "Roo.grid",
51                             "items": [
52                                 {
53                                     "listeners": {
54                                         "beforeload": "function (_self, options)\n{\n    if (typeof(_this.data) == 'undefined') {\n        return false;\n    \n    }\n    options.params = options.params || {};\n    options.params.table = _this.data.table;\n}",
55                                         "load": "function (_self, records, options)\n{\n    // after load, if we have configuration already, overlay that \n    if (typeof(_this.data.cols) == 'undefined') {\n        return;\n    }\n    _this.data.cols_ex = _this.data.cols_ex || [];\n    var cmap = {}\n    Roo.each(_this.data.cols, function (col) {\n        cmap[col.column] = col;\n    \n    });\n    Roo.each(records, function (col) {\n        col.set('use_ex', _this.data.cols_ex.indexOf(col.data.column) > -1 ? 1 : 0);\n\n        if (typeof(cmap[col.data.column]) != 'undefined') {\n\n            col.set('title',  typeof(cmap[col.data.column].title) == 'undefined' ? '' : cmap[col.data.column].title);\n            col.set('use', 1);\n        }\n        if (!col.data.title.length) {\n        \n            if (col.data.columnshort.substring(0, col.data.table.length) == col.data.table) {\n                // it's prefixed with table name..\n                col.set('title', col.data.columnshort.substring(col.data.table.length+1));\n            } else {\n                col.set('title', col.data.columnshort);\n            }\n        } \n       \n\n        // what about descption..\n    });\n      \n        \n        \n}"
56                                     },
57                                     "*prop": "dataSource",
58                                     "remoteSort": true,
59                                     "xtype": "Store",
60                                     "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
61                                     "|xns": "Roo.data",
62                                     "items": [
63                                         {
64                                             "*prop": "proxy",
65                                             "method": "GET",
66                                             "xtype": "HttpProxy",
67                                             "|url": "baseURL + '/Builder/ERM.php'",
68                                             "|xns": "Roo.data"
69                                         },
70                                         {
71                                             "*prop": "reader",
72                                             "id": "id",
73                                             "root": "data",
74                                             "totalProperty": "total",
75                                             "xtype": "JsonReader",
76                                             "|fields": "[\n    { name: 'use', type: 'int'} , \n    { name: 'use_ex', type: 'int'}, \n    'table', 'column', 'ctype', 'desc', 'columnshort', 'title'\n]",
77                                             "|xns": "Roo.data"
78                                         }
79                                     ]
80                                 },
81                                 {
82                                     "*prop": "toolbar",
83                                     "xtype": "Toolbar",
84                                     "|xns": "Roo",
85                                     "items": [
86                                         {
87                                             "listeners": {
88                                                 "|click": "function()\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    // Pman.genericDelete(_this, 'Images'); \n}\n        "
99                                             },
100                                             "cls": "x-btn-text-icon",
101                                             "text": "Delete",
102                                             "xtype": "Button",
103                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
104                                             "|xns": "Roo.Toolbar"
105                                         }
106                                     ]
107                                 },
108                                 {
109                                     "*prop": "colModel[]",
110                                     "dataIndex": "use",
111                                     "header": "Use",
112                                     "width": 50,
113                                     "xtype": "ColumnModel",
114                                     "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
115                                     "|xns": "Roo.grid"
116                                 },
117                                 {
118                                     "*prop": "colModel[]",
119                                     "dataIndex": "use_ex",
120                                     "header": "Display/Expand",
121                                     "width": 100,
122                                     "xtype": "ColumnModel",
123                                     "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
124                                     "|xns": "Roo.grid"
125                                 },
126                                 {
127                                     "*prop": "colModel[]",
128                                     "dataIndex": "column",
129                                     "header": "Column",
130                                     "width": 150,
131                                     "xtype": "ColumnModel",
132                                     "|renderer": "function(v,x,r) { \n    if (r.data.table == _this.data.table) {\n    \n        return String.format('<B>{0}</B>', v); \n    }\n    return String.format('{0}...{1}', r.data.table, r.data.columnshort); \n}",
133                                     "|xns": "Roo.grid"
134                                 },
135                                 {
136                                     "*prop": "colModel[]",
137                                     "dataIndex": "title",
138                                     "header": "Title",
139                                     "width": 150,
140                                     "xtype": "ColumnModel",
141                                     "|renderer": "function(v,x,r) { \n     \n    var u = r.data.use * 1;\n     u += (r.data.use_ex*1);\n    \n    return String.format('{0}', u ? v : ''); \n}",
142                                     "|xns": "Roo.grid",
143                                     "items": [
144                                         {
145                                             "|xns": "Roo.grid",
146                                             "xtype": "GridEditor",
147                                             "*prop": "editor",
148                                             "items": [
149                                                 {
150                                                     "|xns": "Roo.form",
151                                                     "xtype": "TextField",
152                                                     "*prop": "field"
153                                                 }
154                                             ]
155                                         }
156                                     ]
157                                 },
158                                 {
159                                     "*prop": "colModel[]",
160                                     "dataIndex": "ctype",
161                                     "header": "Type",
162                                     "width": 50,
163                                     "xtype": "ColumnModel",
164                                     "|renderer": "function(v) {\n\n   return v;\n }",
165                                     "|xns": "Roo.grid"
166                                 },
167                                 {
168                                     "*prop": "colModel[]",
169                                     "dataIndex": "desc",
170                                     "header": "Description",
171                                     "width": 200,
172                                     "xtype": "ColumnModel",
173                                     "|renderer": "function(v) { return String.format('{0}', v); }",
174                                     "|xns": "Roo.grid"
175                                 }
176                             ]
177                         }
178                     ]
179                 },
180                 {
181                     "listeners": {
182                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
183                     },
184                     "*prop": "buttons[]",
185                     "text": "Cancel",
186                     "xtype": "Button",
187                     "|xns": "Roo"
188                 },
189                 {
190                     "listeners": {
191                         "click": "function (_self, e)\n{\n     var ret = Roo.applyIf({ cols : [], cols_ex: [] },  _this.data);\n      \n     _this.grid.ds.each(function(r) {\n     \n        if (r.data.use*1) {\n        \n            var d = Roo.apply({}, r.json);\n            Roo.apply(d, r.data);\n            ret.cols.push(d);\n                \n        }\n         if (r.data.use_ex*1) {\n             ret.cols_ex.push( r.data.column );\n         }\n\n     });\n     \n     if (!ret.cols_ex.length) {\n        Roo.MessageBox.alert(\"Error\", \"Select at least one Display/expand col\");\n        return;\n    }\n     Roo.log(ret);\n\n    _this.dialog.hide();\n     _this.callback(ret);\n     \n\n}"
192                     },
193                     "*prop": "buttons[]",
194                     "text": "Next",
195                     "xtype": "Button",
196                     "|xns": "Roo"
197                 }
198             ]
199         }
200     ],
201     "permname": "",
202     "modOrder": "001"
203 }