php warnings
[Pman.MTrack] / Pman.Dialog.MTrackMilestone.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.MTrackMilestone = {
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             closable : false,
34             collapsible : false,
35             height : 350,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create Milestone",
39             width : 400,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                         if (_this.data.id) {
54                                            this.load({ method: 'GET', params: { '_id' : _this.data.id }});
55                                        }
56                                        return;
57                                        
58                                     }
59                                     if (action.type == 'load') {
60                                 
61                                         return;
62                                     }
63                                     if (action.type =='submit') {
64                                     
65                                 
66                                         _this.dialog.hide();
67                                     
68                                          if (_this.callback) {
69                                             _this.callback.call(_this, _this.form.getValues());
70                                          }
71                                          _this.form.reset();
72                                          return;
73                                     }
74                                 },
75                                 rendered : function (form)
76                                 {
77                                     _this.form= form;
78                                 }
79                             },
80                             method : 'POST',
81                             style : 'margin:10px;',
82                             url : baseURL + '/Roo/mtrack_milestone.php',
83                             items : [
84                                 {
85                                     xtype: 'TextField',
86                                     xns: Roo.form,
87                                     fieldLabel : 'Name',
88                                     name : 'name',
89                                     width : 200
90                                 },
91                                 {
92                                     xtype: 'ComboBox',
93                                     xns: Roo.form,
94                                     allowBlank : false,
95                                     displayField : 'name',
96                                     editable : false,
97                                     emptyText : "Select Project",
98                                     fieldLabel : 'Project',
99                                     forceSelection : true,
100                                     hiddenName : 'project_id',
101                                     listWidth : 400,
102                                     loadingText : "Searching...",
103                                     minChars : 2,
104                                     name : 'project_id_name',
105                                     pageSize : 50,
106                                     qtip : "Select Projects",
107                                     queryParam : 'query[name]',
108                                     selectOnFocus : true,
109                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> {name}</div>',
110                                     triggerAction : 'all',
111                                     valueField : 'id',
112                                     width : 200,
113                                     store : {
114                                         xtype: 'Store',
115                                         xns: Roo.data,
116                                         listeners : {
117                                             beforeload : function (_self, o){
118                                                 o.params = o.params || {};
119                                                 // set more here
120                                             }
121                                         },
122                                         remoteSort : true,
123                                         sortInfo : { direction : 'ASC', field: 'code' },
124                                         proxy : {
125                                             xtype: 'HttpProxy',
126                                             xns: Roo.data,
127                                             method : 'GET',
128                                             url : baseURL + '/Roo/core_project'
129                                         },
130                                         reader : {
131                                             xtype: 'JsonReader',
132                                             xns: Roo.data,
133                                             id : 'id',
134                                             root : 'data',
135                                             totalProperty : 'total',
136                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
137                                         }
138                                     }
139                                 },
140                                 {
141                                     xtype: 'TextArea',
142                                     xns: Roo.form,
143                                     fieldLabel : 'Description',
144                                     name : 'description',
145                                     width : 200,
146                                     height : 100
147                                 },
148                                 {
149                                     xtype: 'DateField',
150                                     xns: Roo.form,
151                                     altFormats : 'Y-m-d H:i:s',
152                                     fieldLabel : 'Startdate',
153                                     format : 'Y-m-d',
154                                     name : 'startdate',
155                                     width : 100
156                                 },
157                                 {
158                                     xtype: 'DateField',
159                                     xns: Roo.form,
160                                     altFormats : 'Y-m-d H:i:s',
161                                     fieldLabel : 'Duedate',
162                                     format : 'Y-m-d',
163                                     name : 'duedate',
164                                     width : 100
165                                 },
166                                 {
167                                     xtype: 'DateField',
168                                     xns: Roo.form,
169                                     altFormats : 'Y-m-d H:i:s',
170                                     fieldLabel : 'Completed',
171                                     format : 'Y-m-d',
172                                     name : 'completed',
173                                     width : 100
174                                 },
175                                 {
176                                     xtype: 'Checkbox',
177                                     xns: Roo.form,
178                                     boxLabel : 'On hold',
179                                     fieldLabel : 'Status',
180                                     inputValue : 1,
181                                     name : 'on_hold',
182                                     valueOff : 0
183                                 },
184                                 {
185                                     xtype: 'Hidden',
186                                     xns: Roo.form,
187                                     name : 'id'
188                                 }
189                             ]
190                         }
191                     ]
192                 }
193             ],
194             center : {
195                 xtype: 'LayoutRegion',
196                 xns: Roo
197             },
198             buttons : [
199                 {
200                     xtype: 'Button',
201                     xns: Roo,
202                     listeners : {
203                         click : function (_self, e)
204                         {
205                             _this.dialog.hide();
206                         }
207                     },
208                     text : "Cancel"
209                 },
210                 {
211                     xtype: 'Button',
212                     xns: Roo,
213                     listeners : {
214                         click : function (_self, e)
215                         {
216                             // do some checks?
217                              
218                             
219                          
220                             _this.form.doAction("submit");
221                         
222                         }
223                     },
224                     text : "Save"
225                 }
226             ]
227         });
228     }
229 };