Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CoreAutoSavePreview = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             background : false,
34             closable : false,
35             collapsible : false,
36             height : 500,
37             modal : true,
38             resizable : false,
39             title : "Saved Version",
40             width : 600,
41             items : [
42                 {
43                     xtype: 'GridPanel',
44                     xns: Roo,
45                     listeners : {
46                         activate : function() {
47                             _this.wpanel = this;
48                             if (_this.wgrid) {
49                                 _this.wgrid.footer.onClick('first');
50                             }
51                         }
52                     },
53                     background : true,
54                     fitContainer : true,
55                     fitToframe : true,
56                     region : 'west',
57                     tableName : 'clipping_journalist',
58                     title : "Publication Lists",
59                     grid : {
60                         xtype: 'Grid',
61                         xns: Roo.grid,
62                         listeners : {
63                             render : function() 
64                             {
65                                 _this.wgrid = this; 
66                                 //_this.dialog = Pman.Dialog.FILL_IN
67                                 if (_this.wpanel.active) {
68                                    this.footer.onClick('first');
69                                 }
70                             }
71                         },
72                         autoExpandColumn : 'publication',
73                         loadMask : true,
74                         dataSource : {
75                             xtype: 'Store',
76                             xns: Roo.data,
77                             listeners : {
78                                 beforeload : function (_self, o)
79                                 {
80                                     o.params = o.params || {};
81                                     o.params._list = 1;
82                                 }
83                             },
84                             remoteSort : true,
85                             sortInfo : { field : 'publication', direction: 'ASC' },
86                             proxy : {
87                                 xtype: 'HttpProxy',
88                                 xns: Roo.data,
89                                 method : 'GET',
90                                 url : baseURL + '/Roo/Groups.php'
91                             },
92                             reader : {
93                                 xtype: 'JsonReader',
94                                 xns: Roo.data,
95                                 totalProperty : 'total',
96                                 root : 'data',
97                                 id : 'id',
98                                 fields : [
99                                     {
100                                         'name': 'id',
101                                         'type': 'int'
102                                     },
103                                     {
104                                         'name': 'name',
105                                         'type': 'string'
106                                     },
107                                     {
108                                         'name': 'type',
109                                         'type': 'int'
110                                     },
111                                     {
112                                         'name': 'leader',
113                                         'type': 'int'
114                                     },
115                                     {
116                                         'name': 'leader_id',
117                                         'type': 'int'
118                                     },
119                                     {
120                                         'name': 'leader_office_id',
121                                         'type': 'int'
122                                     },
123                                     {
124                                         'name': 'leader_name',
125                                         'type': 'string'
126                                     },
127                                     {
128                                         'name': 'leader_phone',
129                                         'type': 'string'
130                                     },
131                                     {
132                                         'name': 'leader_fax',
133                                         'type': 'string'
134                                     },
135                                     {
136                                         'name': 'leader_email',
137                                         'type': 'string'
138                                     },
139                                     {
140                                         'name': 'leader_company_id',
141                                         'type': 'int'
142                                     },
143                                     {
144                                         'name': 'leader_role',
145                                         'type': 'string'
146                                     },
147                                     {
148                                         'name': 'leader_active',
149                                         'type': 'int'
150                                     },
151                                     {
152                                         'name': 'leader_remarks',
153                                         'type': 'string'
154                                     },
155                                     {
156                                         'name': 'leader_passwd',
157                                         'type': 'string'
158                                     },
159                                     {
160                                         'name': 'leader_owner_id',
161                                         'type': 'int'
162                                     },
163                                     {
164                                         'name': 'leader_lang',
165                                         'type': 'string'
166                                     },
167                                     {
168                                         'name': 'leader_no_reset_sent',
169                                         'type': 'int'
170                                     },
171                                     {
172                                         'name': 'leader_action_type',
173                                         'type': 'string'
174                                     },
175                                     {
176                                         'name': 'leader_project_id',
177                                         'type': 'int'
178                                     },
179                                     {
180                                         'name': 'leader_deleted_by',
181                                         'type': 'int'
182                                     },
183                                     {
184                                         'name': 'leader_deleted_dt',
185                                         'type': 'date'
186                                     },
187                                     {
188                                         'name': 'leader_firstname',
189                                         'type': 'string'
190                                     },
191                                     {
192                                         'name': 'leader_lastname',
193                                         'type': 'string'
194                                     },
195                                     {
196                                         'name': 'leader_name_facebook',
197                                         'type': 'string'
198                                     },
199                                     {
200                                         'name': 'leader_url_blog',
201                                         'type': 'string'
202                                     },
203                                     {
204                                         'name': 'leader_url_twitter',
205                                         'type': 'string'
206                                     },
207                                     {
208                                         'name': 'leader_url_linkedin',
209                                         'type': 'string'
210                                     },
211                                     {
212                                         'name': 'leader_crm_lead_percentage',
213                                         'type': 'int'
214                                     },
215                                     {
216                                         'name': 'leader_crm_industry_id',
217                                         'type': 'int'
218                                     },
219                                     {
220                                         'name': 'leader_crm_updated_action_id',
221                                         'type': 'int'
222                                     },
223                                     {
224                                         'name': 'leader_crm_created_action_id',
225                                         'type': 'int'
226                                     },
227                                     {
228                                         'name': 'leader_crm_type_id',
229                                         'type': 'int'
230                                     }
231                                 ]
232                             }
233                         },
234                         footer : {
235                             xtype: 'PagingToolbar',
236                             xns: Roo,
237                             displayInfo : true,
238                             displayMsg : "Displaying Publication{0} - {1} of {2}",
239                             emptyMsg : "Nothing found",
240                             pageSize : 25
241                         },
242                         colModel : [
243                             {
244                                 xtype: 'ColumnModel',
245                                 xns: Roo.grid,
246                                 dataIndex : 'publication',
247                                 header : 'Publication Lists',
248                                 width : 200,
249                                 renderer : function(v) { return String.format('{0}', v); }
250                             }
251                         ]
252                     }
253                 },
254                 {
255                     xtype: 'GridPanel',
256                     xns: Roo,
257                     listeners : {
258                         activate : function() {
259                             _this.panel = this;
260                             if (_this.grid) {
261                                 _this.grid.footer.onClick('first');
262                             }
263                         }
264                     },
265                     background : true,
266                     fitContainer : true,
267                     fitToframe : true,
268                     region : 'center',
269                     tableName : 'clipping_journalist',
270                     title : "Journalist",
271                     grid : {
272                         xtype: 'EditorGrid',
273                         xns: Roo.grid,
274                         listeners : {
275                             render : function() 
276                             {
277                                 _this.grid = this; 
278                                 if (_this.panel.active) {
279                                    this.footer.onClick('first');
280                                 }
281                             }
282                         },
283                         autoExpandColumn : 'name',
284                         clicksToEdit : 1,
285                         loadMask : true,
286                         dataSource : {
287                             xtype: 'Store',
288                             xns: Roo.data,
289                             listeners : {
290                                 beforeload : function (_self, o)
291                                 {
292                                     o.params = o.params || {};
293                                     if (!_this.data.campaign_id) {
294                                         Roo.log('Missing campaign id!?');
295                                         return false;
296                                     }
297                                     o.params.campaign_id = _this.data.campaign_id;
298                                 }
299                             },
300                             remoteSort : true,
301                             sortInfo : { field : 'name', direction: 'ASC' },
302                             proxy : {
303                                 xtype: 'HttpProxy',
304                                 xns: Roo.data,
305                                 method : 'GET',
306                                 url : baseURL + '/Roo/clipping_journalist.php'
307                             },
308                             reader : {
309                                 xtype: 'JsonReader',
310                                 xns: Roo.data,
311                                 id : 'id',
312                                 root : 'data',
313                                 totalProperty : 'total',
314                                 fields : [
315                                     {
316                                         'name': 'id',
317                                         'type': 'int'
318                                     },
319                                     {
320                                         'name': 'name',
321                                         'type': 'string'
322                                     },
323                                     {
324                                         'name': 'publication',
325                                         'type': 'string'
326                                     }
327                                 ]
328                             }
329                         },
330                         footer : {
331                             xtype: 'PagingToolbar',
332                             xns: Roo,
333                             displayInfo : true,
334                             displayMsg : "Displaying Journalist {0} - {1} of {2}",
335                             emptyMsg : "Nothing found",
336                             pageSize : 25
337                         },
338                         colModel : [
339                             {
340                                 xtype: 'ColumnModel',
341                                 xns: Roo.grid,
342                                 dataIndex : 'name',
343                                 header : 'Name',
344                                 width : 100,
345                                 renderer : function(v,x,r) 
346                                 { 
347                                     return String.format('{0}', v ? v : ''); 
348                                 }
349                             },
350                             {
351                                 xtype: 'ColumnModel',
352                                 xns: Roo.grid,
353                                 dataIndex : 'publication',
354                                 header : 'Publication',
355                                 width : 300,
356                                 renderer : function(v,x,r) 
357                                 { 
358                                     return String.format('{0}', v ? v : ''); 
359                                 },
360                                 editor : {
361                                     xtype: 'GridEditor',
362                                     xns: Roo.grid
363                                 }
364                             }
365                         ]
366                     }
367                 }
368             ],
369             center : {
370                 xtype: 'LayoutRegion',
371                 xns: Roo,
372                 split : true,
373                 titlebar : false,
374                 width : 400
375             },
376             west : {
377                 xtype: 'LayoutRegion',
378                 xns: Roo
379             },
380             buttons : [
381                 {
382                     xtype: 'Button',
383                     xns: Roo,
384                     listeners : {
385                         click : function() {
386                             _this.dialog.hide();
387                         }
388                     },
389                     text : "Cancel"
390                 },
391                 {
392                     xtype: 'Button',
393                     xns: Roo,
394                     listeners : {
395                         click : function() {
396                             _this.dialog.hide();
397                         }
398                     },
399                     text : "OK"
400                 }
401             ]
402         });
403     }
404 };