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 : 800,
41             items : [
42                 {
43                     xtype: 'GridPanel',
44                     xns: Roo,
45                     listeners : {
46                         activate : function() {
47                             _this.panel = this;
48                             if (_this.grid) {
49                             Roo.log(2);
50                                 _this.grid.footer.onClick('first');
51                             }
52                         }
53                     },
54                     background : true,
55                     fitContainer : true,
56                     fitToframe : true,
57                     region : 'west',
58                     tableName : 'Events',
59                     title : "Events",
60                     grid : {
61                         xtype: 'Grid',
62                         xns: Roo.grid,
63                         listeners : {
64                             render : function() { 
65                                 _this.grid = this; 
66                                 //_this.dialog = Pman.Dialog.FILL_IN
67                                 if (_this.panel.active) {
68                                 Roo.log('1');
69                                    this.footer.onClick('first');
70                                 }
71                             }
72                         },
73                         autoExpandColumn : 'event_when',
74                         loadMask : true,
75                         sm : {
76                             xtype: 'RowSelectionModel',
77                             xns: Roo.grid,
78                             listeners : {
79                                 afterselectionchange : function (_self)
80                                 {
81                                     
82                                     if (!this.getSelected()) {
83                                         _this.viewPanel.setContent("Nothing Selected");
84                                         return;
85                                     }
86                                     
87                                     _this.viewPanel.setContent("data");
88                                 }
89                             },
90                             singleSelect : true
91                         },
92                         footer : {
93                             xtype: 'PagingToolbar',
94                             xns: Roo,
95                             pageSize : 25,
96                             displayInfo : true,
97                             displayMsg : "Displaying Images{0} - {1} of {2}",
98                             emptyMsg : "No Images found"
99                         },
100                         dataSource : {
101                             xtype: 'Store',
102                             xns: Roo.data,
103                             listeners : {
104                                 beforeload : function (_self, o)
105                                 {
106                                     Roo.log(_this.data);
107                                     o.params = o.parmas || {};
108                                     o.params.action = 'AUTOSAVE';
109                                     
110                                 }
111                             },
112                             remoteSort : true,
113                             sortInfo : { field: 'event_when', direction: 'DESC'},
114                             reader : {
115                                 xtype: 'JsonReader',
116                                 xns: Roo.data,
117                                 totalProperty : 'total',
118                                 root : 'data',
119                                 id : 'id',
120                                 fields : [
121                                     {
122                                         'name': 'id',
123                                         'type': 'int'
124                                     },
125                                     {
126                                         'name': 'person_name',
127                                         'type': 'string'
128                                     },
129                                     {
130                                         'name': 'event_when',
131                                         'type': 'date',
132                                         'dateFormat': 'Y-m-d'
133                                     },
134                                     {
135                                         'name': 'action',
136                                         'type': 'string'
137                                     },
138                                     {
139                                         'name': 'ipaddr',
140                                         'type': 'string'
141                                     },
142                                     {
143                                         'name': 'on_id',
144                                         'type': 'int'
145                                     },
146                                     {
147                                         'name': 'on_table',
148                                         'type': 'string'
149                                     },
150                                     {
151                                         'name': 'person_id',
152                                         'type': 'int'
153                                     },
154                                     {
155                                         'name': 'remarks',
156                                         'type': 'string'
157                                     },
158                                     {
159                                         'name': 'person_id_id',
160                                         'type': 'int'
161                                     },
162                                     {
163                                         'name': 'person_id_office_id',
164                                         'type': 'int'
165                                     },
166                                     {
167                                         'name': 'person_id_name',
168                                         'type': 'string'
169                                     },
170                                     {
171                                         'name': 'person_id_phone',
172                                         'type': 'string'
173                                     },
174                                     {
175                                         'name': 'person_id_fax',
176                                         'type': 'string'
177                                     },
178                                     {
179                                         'name': 'person_id_email',
180                                         'type': 'string'
181                                     },
182                                     {
183                                         'name': 'person_id_company_id',
184                                         'type': 'int'
185                                     },
186                                     {
187                                         'name': 'person_id_role',
188                                         'type': 'string'
189                                     },
190                                     {
191                                         'name': 'person_id_active',
192                                         'type': 'int'
193                                     },
194                                     {
195                                         'name': 'person_id_remarks',
196                                         'type': 'string'
197                                     },
198                                     {
199                                         'name': 'person_id_passwd',
200                                         'type': 'string'
201                                     },
202                                     {
203                                         'name': 'person_id_owner_id',
204                                         'type': 'int'
205                                     },
206                                     {
207                                         'name': 'person_id_lang',
208                                         'type': 'string'
209                                     },
210                                     {
211                                         'name': 'person_id_no_reset_sent',
212                                         'type': 'int'
213                                     },
214                                     {
215                                         'name': 'person_id_action_type',
216                                         'type': 'string'
217                                     },
218                                     {
219                                         'name': 'person_id_project_id',
220                                         'type': 'int'
221                                     },
222                                     {
223                                         'name': 'person_id_deleted_by',
224                                         'type': 'int'
225                                     },
226                                     {
227                                         'name': 'person_id_deleted_dt',
228                                         'type': 'date'
229                                     }
230                                 ]
231                             },
232                             proxy : {
233                                 xtype: 'HttpProxy',
234                                 xns: Roo.data,
235                                 method : 'GET',
236                                 url : baseURL + '/Roo/Events.php'
237                             }
238                         },
239                         colModel : [
240                             {
241                                 xtype: 'ColumnModel',
242                                 xns: Roo.grid,
243                                 dataIndex : 'event_when',
244                                 header : 'Date',
245                                 width : 100,
246                                 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
247                             }
248                         ]
249                     }
250                 },
251                 {
252                     xtype: 'GridPanel',
253                     xns: Roo,
254                     listeners : {
255                         activate : function() {
256                             _this.panel = this;
257                             if (_this.grid) {
258                                 _this.grid.footer.onClick('first');
259                             }
260                         }
261                     },
262                     background : true,
263                     fitContainer : true,
264                     fitToframe : true,
265                     region : 'west',
266                     tableName : 'Images',
267                     title : "Images",
268                     grid : {
269                         xtype: 'Grid',
270                         xns: Roo.grid,
271                         autoExpandColumn : 'filename',
272                         loadMask : true,
273                         listeners : {
274                             render : function() 
275                             {
276                                 _this.grid = this; 
277                                 //_this.dialog = Pman.Dialog.FILL_IN
278                                 if (_this.panel.active) {
279                                    this.footer.onClick('first');
280                                 }
281                             },
282                             rowdblclick : function (_self, rowIndex, e)
283                             {
284                                 if (!_this.dialog) return;
285                                 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
286                                     _this.grid.footer.onClick('first');
287                                 }); 
288                             }
289                         },
290                         dataSource : {
291                             xtype: 'Store',
292                             xns: Roo.data,
293                             remoteSort : true,
294                             sortInfo : { field : 'filename', direction: 'ASC' },
295                             proxy : {
296                                 xtype: 'HttpProxy',
297                                 xns: Roo.data,
298                                 method : 'GET',
299                                 url : baseURL + '/Roo/Images.php'
300                             },
301                             reader : {
302                                 xtype: 'JsonReader',
303                                 xns: Roo.data,
304                                 totalProperty : 'total',
305                                 root : 'data',
306                                 id : 'id',
307                                 fields : [
308                                     {
309                                         'name': 'id',
310                                         'type': 'int'
311                                     },
312                                     {
313                                         'name': 'filename',
314                                         'type': 'string'
315                                     },
316                                     {
317                                         'name': 'ontable',
318                                         'type': 'string'
319                                     },
320                                     {
321                                         'name': 'onid',
322                                         'type': 'int'
323                                     },
324                                     {
325                                         'name': 'mimetype',
326                                         'type': 'string'
327                                     },
328                                     {
329                                         'name': 'width',
330                                         'type': 'int'
331                                     },
332                                     {
333                                         'name': 'height',
334                                         'type': 'int'
335                                     },
336                                     {
337                                         'name': 'filesize',
338                                         'type': 'int'
339                                     },
340                                     {
341                                         'name': 'displayorder',
342                                         'type': 'int'
343                                     },
344                                     {
345                                         'name': 'language',
346                                         'type': 'string'
347                                     },
348                                     {
349                                         'name': 'parent_image_id',
350                                         'type': 'int'
351                                     },
352                                     {
353                                         'name': 'created',
354                                         'type': 'date',
355                                         'dateFormat': 'Y-m-d'
356                                     },
357                                     {
358                                         'name': 'imgtype',
359                                         'type': 'string'
360                                     },
361                                     {
362                                         'name': 'linkurl',
363                                         'type': 'string'
364                                     },
365                                     {
366                                         'name': 'descript',
367                                         'type': 'string'
368                                     },
369                                     {
370                                         'name': 'title',
371                                         'type': 'string'
372                                     },
373                                     {
374                                         'name': 'parent_image_id_id',
375                                         'type': 'int'
376                                     },
377                                     {
378                                         'name': 'parent_image_id_filename',
379                                         'type': 'string'
380                                     },
381                                     {
382                                         'name': 'parent_image_id_ontable',
383                                         'type': 'string'
384                                     },
385                                     {
386                                         'name': 'parent_image_id_onid',
387                                         'type': 'int'
388                                     },
389                                     {
390                                         'name': 'parent_image_id_mimetype',
391                                         'type': 'string'
392                                     },
393                                     {
394                                         'name': 'parent_image_id_width',
395                                         'type': 'int'
396                                     },
397                                     {
398                                         'name': 'parent_image_id_height',
399                                         'type': 'int'
400                                     },
401                                     {
402                                         'name': 'parent_image_id_filesize',
403                                         'type': 'int'
404                                     },
405                                     {
406                                         'name': 'parent_image_id_displayorder',
407                                         'type': 'int'
408                                     },
409                                     {
410                                         'name': 'parent_image_id_language',
411                                         'type': 'string'
412                                     },
413                                     {
414                                         'name': 'parent_image_id_parent_image_id',
415                                         'type': 'int'
416                                     },
417                                     {
418                                         'name': 'parent_image_id_created',
419                                         'type': 'date'
420                                     },
421                                     {
422                                         'name': 'parent_image_id_imgtype',
423                                         'type': 'string'
424                                     },
425                                     {
426                                         'name': 'parent_image_id_linkurl',
427                                         'type': 'string'
428                                     },
429                                     {
430                                         'name': 'parent_image_id_descript',
431                                         'type': 'string'
432                                     },
433                                     {
434                                         'name': 'parent_image_id_title',
435                                         'type': 'string'
436                                     }
437                                 ]
438                             }
439                         },
440                         footer : {
441                             xtype: 'PagingToolbar',
442                             xns: Roo,
443                             pageSize : 25,
444                             displayInfo : true,
445                             displayMsg : "Displaying Images{0} - {1} of {2}",
446                             emptyMsg : "No Images found"
447                         },
448                         colModel : [
449                             {
450                                 xtype: 'ColumnModel',
451                                 xns: Roo.grid,
452                                 header : 'Id',
453                                 width : 75,
454                                 dataIndex : 'id',
455                                 renderer : function(v) { return String.format('{0}', v); }
456                             },
457                             {
458                                 xtype: 'ColumnModel',
459                                 xns: Roo.grid,
460                                 header : 'Filename',
461                                 width : 200,
462                                 dataIndex : 'filename',
463                                 renderer : function(v) { return String.format('{0}', v); }
464                             },
465                             {
466                                 xtype: 'ColumnModel',
467                                 xns: Roo.grid,
468                                 header : 'Ontable',
469                                 width : 200,
470                                 dataIndex : 'ontable',
471                                 renderer : function(v) { return String.format('{0}', v); }
472                             },
473                             {
474                                 xtype: 'ColumnModel',
475                                 xns: Roo.grid,
476                                 header : 'Onid',
477                                 width : 75,
478                                 dataIndex : 'onid',
479                                 renderer : function(v) { return String.format('{0}', v); }
480                             },
481                             {
482                                 xtype: 'ColumnModel',
483                                 xns: Roo.grid,
484                                 header : 'Mimetype',
485                                 width : 200,
486                                 dataIndex : 'mimetype',
487                                 renderer : function(v) { return String.format('{0}', v); }
488                             },
489                             {
490                                 xtype: 'ColumnModel',
491                                 xns: Roo.grid,
492                                 header : 'Width',
493                                 width : 75,
494                                 dataIndex : 'width',
495                                 renderer : function(v) { return String.format('{0}', v); }
496                             },
497                             {
498                                 xtype: 'ColumnModel',
499                                 xns: Roo.grid,
500                                 header : 'Height',
501                                 width : 75,
502                                 dataIndex : 'height',
503                                 renderer : function(v) { return String.format('{0}', v); }
504                             },
505                             {
506                                 xtype: 'ColumnModel',
507                                 xns: Roo.grid,
508                                 header : 'Filesize',
509                                 width : 75,
510                                 dataIndex : 'filesize',
511                                 renderer : function(v) { return String.format('{0}', v); }
512                             },
513                             {
514                                 xtype: 'ColumnModel',
515                                 xns: Roo.grid,
516                                 header : 'Displayorder',
517                                 width : 75,
518                                 dataIndex : 'displayorder',
519                                 renderer : function(v) { return String.format('{0}', v); }
520                             },
521                             {
522                                 xtype: 'ColumnModel',
523                                 xns: Roo.grid,
524                                 header : 'Language',
525                                 width : 200,
526                                 dataIndex : 'language',
527                                 renderer : function(v) { return String.format('{0}', v); }
528                             },
529                             {
530                                 xtype: 'ColumnModel',
531                                 xns: Roo.grid,
532                                 header : 'Parent image',
533                                 width : 75,
534                                 dataIndex : 'parent_image_id',
535                                 renderer : function(v) { return String.format('{0}', v); }
536                             },
537                             {
538                                 xtype: 'ColumnModel',
539                                 xns: Roo.grid,
540                                 header : 'Created',
541                                 width : 75,
542                                 dataIndex : 'created',
543                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
544                             },
545                             {
546                                 xtype: 'ColumnModel',
547                                 xns: Roo.grid,
548                                 header : 'Imgtype',
549                                 width : 200,
550                                 dataIndex : 'imgtype',
551                                 renderer : function(v) { return String.format('{0}', v); }
552                             },
553                             {
554                                 xtype: 'ColumnModel',
555                                 xns: Roo.grid,
556                                 header : 'Linkurl',
557                                 width : 200,
558                                 dataIndex : 'linkurl',
559                                 renderer : function(v) { return String.format('{0}', v); }
560                             },
561                             {
562                                 xtype: 'ColumnModel',
563                                 xns: Roo.grid,
564                                 header : 'Descript',
565                                 width : 200,
566                                 dataIndex : 'descript',
567                                 renderer : function(v) { return String.format('{0}', v); }
568                             },
569                             {
570                                 xtype: 'ColumnModel',
571                                 xns: Roo.grid,
572                                 header : 'Title',
573                                 width : 200,
574                                 dataIndex : 'title',
575                                 renderer : function(v) { return String.format('{0}', v); }
576                             }
577                         ]
578                     }
579                 },
580                 {
581                     xtype: 'ContentPanel',
582                     xns: Roo,
583                     listeners : {
584                         render : function (_self)
585                         {
586                             _this.viewPanel = _self;
587                         }
588                     },
589                     background : false,
590                     fitContainer : true,
591                     fitToFrame : true,
592                     region : 'center'
593                 }
594             ],
595             center : {
596                 xtype: 'LayoutRegion',
597                 xns: Roo
598             },
599             west : {
600                 xtype: 'LayoutRegion',
601                 xns: Roo,
602                 split : true,
603                 width : 200
604             },
605             buttons : [
606                 {
607                     xtype: 'Button',
608                     xns: Roo,
609                     listeners : {
610                         click : function() {
611                             _this.dialog.hide();
612                         }
613                     },
614                     text : "Cancel"
615                 },
616                 {
617                     xtype: 'Button',
618                     xns: Roo,
619                     listeners : {
620                         click : function() {
621                             _this.dialog.hide();
622                         }
623                     },
624                     text : "OK"
625                 }
626             ]
627         });
628     }
629 };