php warnings
[Pman.MTrack] / Pman.Tab.MTrackTicket.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.MTrackTicket = new Roo.XComponent({
8
9  _strings : {
10   '340c2ee497b85d5954b01c64de7f44f6' :"Select Person ",
11   'b9dd47d69178dbf735bfcd2733fd4ea6' :"Add Comment / Update",
12   '290612199861c31d1036b185b4e69b75' :"Summary",
13   '8a223eb0008a86f053b2a7eac0fa6eac' :"Select priority",
14   '04720e14ddfde3154a120fdd0ae73d19' :"Action Required By",
15   'ef6703d6c606526cece4a9eda9d49045' :"Your comment",
16   'c76a5e84e4bdee527e274ea30c680d79' :"active",
17   '502996d9790340c5fd7b86a5b93b1c9f' :"Priority",
18   '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' :"Person ",
19   '5c9335b28e6277ddbe0137f04e5e58a7' :"Classification",
20   '7e5ddb4ca31c30e778f4d9c57b9577b1' :"Change Status",
21   '1fd968087e03faeb2e87df1e9849d983' :"Spent",
22   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
23   'b6f4a2ec6356bbd56d49f2096bf9d3d3' :"Owner",
24   '672caf27f5363dc833bda5099775e891' :"Developer",
25   '6a7e73161603d87b26a8eac49dab0a9c' :"Hours",
26   'ff0a3b7f3daef040faf89a88fdac01b7' :"Updated",
27   '340c2ee497b85d5954b01c64de7f44f6' :"Select Person",
28   'b1550c2a1a5eb0d078d92eef8a0ef883' :"ID#",
29   '9e727fdd3aec8274f46685441900280d' :"Project",
30   'ec53a8c4f07baed5d8825072c89799be' :"Status",
31   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
32   'a3edc4e7beafdcd450f339ec414b7508' :"Developer / Action Required By",
33   'c1c694bd849d91d0eb34bfef8c2d8894' :"Tickets",
34   'a5ffb2a210f259195a75e5abca8db4a2' :"Select mtrack_milestone",
35   '3efbc55730fd4af147b96183d8afbd3b' :"mtrack_ticket",
36   'a3a1edf91a3157dad9417dedb4af500d' :"Add New Ticket",
37   'df25de42c84837baf5fa15049a8bc764' :"View:",
38   '423570be9f14a39fe88384797ee376fd' :"Select severity",
39   '5bf7a37a56bdea44d9b2b69201e91fbd' :"Edit original ticket",
40   'd10e7195b9d5009f7b8e6bb25a099e84' :"Add Attachment / Patch",
41   'e9c626b8a8b62de7562dfbf51a576ae5' :"Milestone",
42   'b26917587d98330d93f87808fc9d7267' :"Subscribe",
43   'f691f042a559b1c1a4f89826c6f75760' :"Resolved",
44   '007cc9547ae8884ad597cd92ba505422' :"Severity",
45   'c9cc8cce247e49bae79f15173ce97354' :"Save",
46   '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel",
47   '887950755a62e33c26209bdcbdc1d3d3' :"Bulk Change",
48   '7025046a3448dfea367705b884148992' :"Select classification"
49  },
50  _named_strings : {
51   'priority_id_name_qtip' : '8a223eb0008a86f053b2a7eac0fa6eac' /* Select priority */ ,
52   'severity_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
53   'developer_id_emptyText' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
54   'developer_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
55   'status_name_emptyText' : '7e5ddb4ca31c30e778f4d9c57b9577b1' /* Change Status */ ,
56   'severity_id_name_emptyText' : '423570be9f14a39fe88384797ee376fd' /* Select severity */ ,
57   'classification_id_name_emptyText' : '7025046a3448dfea367705b884148992' /* Select classification */ ,
58   'status_name_fieldLabel' : 'ec53a8c4f07baed5d8825072c89799be' /* Status */ ,
59   'developer_id_qtip' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
60   'developer_id_name_emptyText' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
61   'classification_id_name_qtip' : '7025046a3448dfea367705b884148992' /* Select classification */ ,
62   'developer_id_fieldLabel' : '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' /* Person  */ ,
63   'developer_id_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
64   'cm_status_name_value' : 'c76a5e84e4bdee527e274ea30c680d79' /* active */ ,
65   'milestone_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
66   'priority_id_name_emptyText' : '8a223eb0008a86f053b2a7eac0fa6eac' /* Select priority */ ,
67   'status_name_qtip' : '7e5ddb4ca31c30e778f4d9c57b9577b1' /* Change Status */ ,
68   'status_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
69   'milestone_id_name_emptyText' : 'a5ffb2a210f259195a75e5abca8db4a2' /* Select mtrack_milestone */ ,
70   'developer_id_name_qtip' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
71   'reason_fieldLabel' : 'ef6703d6c606526cece4a9eda9d49045' /* Your comment */ ,
72   'cm_status_name_fieldLabel' : 'ec53a8c4f07baed5d8825072c89799be' /* Status */ ,
73   'priority_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
74   'milestone_id_name_qtip' : 'a5ffb2a210f259195a75e5abca8db4a2' /* Select mtrack_milestone */ ,
75   'developer_id_name_fieldLabel' : 'a3edc4e7beafdcd450f339ec414b7508' /* Developer / Action Required By */ ,
76   'severity_id_name_qtip' : '423570be9f14a39fe88384797ee376fd' /* Select severity */ ,
77   'classification_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ 
78  },
79
80   part     :  ["MTrack", "Ticket" ],
81   order    : '001-Pman.Tab.MTrackTicket',
82   region   : 'center',
83   parent   : 'Pman.Tab.DocumentsTab',
84   name     : "MTrackWeb.Ticket",
85   disabled : false, 
86   permname : '', 
87   _tree : function(_data)
88   {
89    var _this = this;
90    var MODULE = this;
91    return {
92    xtype : 'NestedLayoutPanel',
93    background : true,
94    fitContainer : true,
95    fitToFrame : true,
96    region : 'center',
97    title : _this._strings['c1c694bd849d91d0eb34bfef8c2d8894'] /* Tickets */,
98    listeners : {
99     activate : function (_self)
100      {
101          _this.panel = _self;
102          (function () {
103              if (_this.tpanel) {
104                  _this.panel.layout.getRegion('south').hide();
105                  //_this.panel.layout.getRegion('north').hide();
106              }
107          }).defer(100);
108          try {
109              if (!_this.url || !_this.project || (_this.project != MTrack.projectCombo.getValue())) {
110                  (function() { 
111                      if (_this.tpanel) { 
112                       //   _this.tpanel.mload("/Report/1"); 
113                      }
114                  }).defer(300);
115              }
116              
117              
118          } catch(e) {Roo.log("activate fail" + e.toString()); }
119      }
120    },
121    xns : Roo,
122    '|xns' : 'Roo',
123    layout : {
124     xtype : 'BorderLayout',
125     xns : Roo,
126     '|xns' : 'Roo',
127     center : {
128      xtype : 'LayoutRegion',
129      tabPosition : 'top',
130      xns : Roo,
131      '|xns' : 'Roo'
132     },
133     south : {
134      xtype : 'LayoutRegion',
135      height : 170,
136      split : true,
137      xns : Roo,
138      '|xns' : 'Roo'
139     },
140     north : {
141      xtype : 'LayoutRegion',
142      collapsible : true,
143      height : 300,
144      split : true,
145      tabPosition : 'top',
146      xns : Roo,
147      '|xns' : 'Roo'
148     },
149     items  : [
150      {
151       xtype : 'GridPanel',
152       background : true,
153       fitContainer : true,
154       fitToframe : true,
155       region : 'north',
156       tableName : 'mtrack_ticket',
157       title : _this._strings['3efbc55730fd4af147b96183d8afbd3b'] /* mtrack_ticket */,
158       listeners : {
159        activate : function() {
160             _this.gpanel = this;
161             if (_this.grid) {
162                 _this.grid.ds.load({});
163             }
164         }
165       },
166       xns : Roo,
167       '|xns' : 'Roo',
168       grid : {
169        xtype : 'EditorGrid',
170        autoExpandColumn : 'summary',
171        clicksToEdit : 1,
172        ddGroup : 'mtrack_ticket',
173        enableDragDrop : true,
174        getProjectId : function() {
175        
176              if (typeof(MTrack) != 'undefined') {
177                return  MTrack.projectCombo.getValue();
178              }
179              
180            //       project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
181            //      project_id_name : _this.grid.getProjectId(), //MTrack.projectCombo.el.dom.value,
182          
183          
184         
185            try {
186                 var pr = Pman.Tab.Projects; // shuld be documentsProjects
187                 if (!pr || !pr.grid) {
188                    return false;
189                }
190            } catch (e) {
191                return false;
192            }
193            var sels = pr.grid.getSelectionModel().getSelections();
194            var prids = [];
195            if (sels.length) {
196                Roo.each(sels,function(s) {
197                    prids.push(s.data.id);
198                 });
199                 // multi support later..
200                return   prids[0];
201             }
202             
203            
204             
205            return 0;
206          
207          
208        },
209        getProjectName : function() {
210             //  project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
211              
212              if (typeof(MTrack) != 'undefined') {
213              
214                return MTrack.projectCombo.el.dom.value;
215              }
216                
217                
218              
219            try {
220                 var pr = Pman.Tab.Projects; // shuld be documentsProjects
221                 if (!pr || !pr.grid) {
222                    return false;
223                }
224            } catch (e) {
225                return false;
226            }
227            var sels = pr.grid.getSelectionModel().getSelections();
228            var prids = [];
229            if (sels.length) {
230                Roo.each(sels,function(s) {
231                    prids.push(s.data.name);
232                 });
233                 // multi support later..
234                return   prids[0];
235             }
236             
237            
238             
239            return '';  
240        },
241        loadMask : true,
242        listeners : {
243         afteredit : function (e)
244          {
245              Roo.log(e);
246              e.record.commit();
247          },
248         celldblclick : function (_self, rowIndex, columnIndex, e)
249          {
250               var c = _this.grid.colModel.getDataIndex(columnIndex);
251              
252              
253              if (c.match(/_id$/) ) {
254                  return;
255              }
256              var rec = _this.grid.ds.getAt(rowIndex);
257              Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
258                  // update row, and re-render..
259              
260              });
261              
262              
263          },
264         render : function() 
265          {
266              _this.grid = this; 
267              _this.panel.grid = this; // works with doc manager...
268              //_this.dialog = Pman.Dialog.FILL_IN
269              if (_this.gpanel.active) {
270                 _this.grid.ds.load({});
271              }
272          }
273        },
274        xns : Roo.grid,
275        '|xns' : 'Roo.grid',
276        toolbar : {
277         xtype : 'Toolbar',
278         xns : Roo,
279         '|xns' : 'Roo',
280         items  : [
281          {
282           xtype : 'Button',
283           text : _this._strings['a3a1edf91a3157dad9417dedb4af500d'] /* Add New Ticket */,
284           listeners : {
285            click : function (_self, e)
286             {
287               Pman.Dialog.MTrackTicket.show({
288                     project_id :  Pman.Tab.DocumentsTab.panel.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
289                     project_id_name : Pman.Tab.DocumentsTab.panel.getProjectName(), //MTrack.projectCombo.el.dom.value,
290                     owner_id : Pman.Login.authUser.id,
291                     owner_id_name : Pman.Login.authUser.name
292             
293               }, function() { 
294                 _this.grid.ds.load({}); 
295                 });
296                 
297             }
298           },
299           xns : Roo.Toolbar,
300           '|xns' : 'Roo.Toolbar'
301          },
302          {
303           xtype : 'Button',
304           text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
305           listeners : {
306            click : function (_self, e)
307             {
308                 params =    {};
309                 params.project_id =  Pman.Tab.DocumentsTab.panel.getProjectId(); // testing.
310                 params.limit = 999;
311                 // columns...
312                 params['query[viewtype]'] = 'active';
313                 
314                 for (var k in _this.filterBtn) {
315                     if (_this.filterBtn[k].pressed) {
316                         params['query[viewtype]'] = k;
317                     }
318                 }
319                 var ii =0;
320                 params['csvCols['+ii+']'] = 'jira_ref';
321                 params['csvTitles['+ii+']'] = "Jira ID";
322                 ii++;
323                 
324                 Roo.each(_this.grid.colModel.config, function(c,i) {
325                     params['csvCols['+ii+']'] = c.dataIndex;
326                     params['csvTitles['+ii+']'] = c.header;
327                     try {
328                         if (typeof( c.editor.field.name) != 'undefined') {
329                             params['csvCols['+ii+']'] = c.editor.field.name;
330                         }
331                     } catch(e) {}
332                     ii++;
333                 });
334                 
335                 params['csvCols['+ii+']'] = 'description';
336                 params['csvTitles['+ii+']'] = "Details";
337                     
338                 
339             
340                     
341                
342                 new Pman.Download({
343                     url: baseURL + '/Roo/mtrack_ticket',
344                     method: 'GET' ,
345                     params: params
346                     
347                 });
348                 
349                     
350             }
351           },
352           xns : Roo.Toolbar,
353           '|xns' : 'Roo.Toolbar'
354          },
355          {
356           xtype : 'Button',
357           text : _this._strings['887950755a62e33c26209bdcbdc1d3d3'] /* Bulk Change */,
358           listeners : {
359            click : function (_self, e)
360             {
361                 var sels = _this.grid.selModel.getSelections();
362             
363                 var pid = 0;
364                 var ids = [];
365                 Roo.each(sels, function(s) {
366                     ids.push(s.data.id);
367                     if (pid && s.data.project_id != pid) {
368                         pid = -1;
369                         return false;
370                     }
371                     pid = s.data.project_id ;
372                     
373                 });
374                 if (pid < 1) {
375                     Roo.MessageBox.alert("Error", "selected tickets must be of the same project");
376                     return;
377                 }
378                 
379                 // permission based?
380                 
381                 Pman.Dialog.MTrackBulkChange.show({
382                     project_id : sels[0].data.project_id,
383                     project_id_name : sels[0].data.project_id_name,
384                     ids : ids.join(',')
385                 }, function(res) {
386                     Roo.log(res);
387                     var tks = {};
388                     
389                     Roo.each(res.data, function(d) {
390                         tks[d.id*1] = d;
391                     });
392                     
393                     Roo.each(sels, function(sel) {
394                         var record = _this.grid.ds.getById(sel.data.id);
395                         record.modified = record.modified || {};
396             
397                         Roo.log(tks[record.data.id*1]);
398                         
399                         for (var k in tks[record.data.id*1]) {
400                             // update the 
401                             
402                             
403                             if (k.match(/_id$/) || k.match(/_id_/) || k.match(/^status_/)) {
404             
405             
406                                 Roo.log("SET " + k + "=" +  tks[record.data.id*1][k]);
407                                 record.data[k] = tks[record.data.id*1][k];
408                                 record.modified[k] = tks[record.data.id*1][k];
409                             }
410                         }
411                         record.store.afterEdit(record);
412                   });
413                 
414                 });
415             
416                 
417                     
418             }
419           },
420           xns : Roo.Toolbar,
421           '|xns' : 'Roo.Toolbar'
422          },
423          {
424           xtype : 'Fill',
425           xns : Roo.Toolbar,
426           '|xns' : 'Roo.Toolbar'
427          },
428          {
429           xtype : 'TextItem',
430           text : _this._strings['df25de42c84837baf5fa15049a8bc764'] /* View: */,
431           xns : Roo.Toolbar,
432           '|xns' : 'Roo.Toolbar'
433          },
434          {
435           xtype : 'TextField',
436           listeners : {
437            render : function (_self)
438             {
439             _this.searchBox=  _self;
440             },
441            specialkey : function (_self, e)
442             {
443                 _this.grid.ds.load({});
444             }
445           },
446           xns : Roo.form,
447           '|xns' : 'Roo.form'
448          },
449          {
450           xtype : 'ComboBox',
451           allowBlank : true,
452           displayField : 'developer_id_name',
453           editable : true,
454           emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person  */,
455           fieldLabel : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person  */,
456           forceSelection : true,
457           hiddenName : 'developer_id',
458           listWidth : 600,
459           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
460           minChars : 2,
461           name : 'developer_id',
462           pageSize : 20,
463           qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person  */,
464           queryParam : 'query[name]',
465           selectOnFocus : true,
466           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{developer_id_name}</b></div>',
467           triggerAction : 'all',
468           typeAhead : true,
469           valueField : 'developer_id',
470           width : 150,
471           listeners : {
472            render : function (_self)
473             {
474                 _this.personSel = _self;
475                 if (Pman.Login.authUser.id) {
476                     this.setFromData({
477                         developer_id : Pman.Login.authUser.id,
478                         developer_id_name : Pman.Login.authUser.name
479                     });
480                 
481                 }
482             },
483            select : function (combo, record, index)
484             {
485               _this.grid.ds.load({});
486               
487             }
488           },
489           xns : Roo.form,
490           '|xns' : 'Roo.form',
491           store : {
492            xtype : 'Store',
493            sortInfo : { field : 'developer_id_name' , dir : 'ASC' },
494            listeners : {
495             beforeload : function (_self, o)
496              {
497                  o.params = o.params || {};
498                  o.params._distinct = 'developer_id';
499                  o.params._columns = 'developer_id,developer_id_name';
500              },
501             load : function (_self, records, options)
502              {
503                  Roo.log(records);
504                  var ua = _this.personSel.store.reader.newRow({
505                      developer_id : -1,
506                      developer_id_name : '-- Un-assigned --'
507                  });
508                  this.insert(0,[ua]);
509              //    records.unshift(ua);
510              }
511            },
512            xns : Roo.data,
513            '|xns' : 'Roo.data',
514            proxy : {
515             xtype : 'HttpProxy',
516             method : 'GET',
517             url : baseURL + '/Roo/Mtrack_ticket.php',
518             xns : Roo.data,
519             '|xns' : 'Roo.data'
520            },
521            reader : {
522             xtype : 'JsonReader',
523             fields : [
524                 {
525                     'name': 'developer_id',
526                     'type': 'int'
527                 } ,
528                 {
529                     'name': 'developer_id_name',
530                     'type' : 'text'
531                 }
532                 
533                 
534             ],
535             id : 'id',
536             root : 'data',
537             totalProperty : 'total',
538             xns : Roo.data,
539             '|xns' : 'Roo.data'
540            }
541           }
542          },
543          {
544           xtype : 'ComboBox',
545           allowBlank : false,
546           displayField : 'fname',
547           editable : false,
548           fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
549           hiddenName : 'cm_status',
550           listWidth : 200,
551           mode : 'local',
552           name : 'cm_status_name',
553           triggerAction : 'all',
554           value : _this._strings['c76a5e84e4bdee527e274ea30c680d79'] /* active */,
555           valueField : 'ftype',
556           width : 150,
557           listeners : {
558            render : function (_self)
559             {
560               _this.status = _self;
561             },
562            select : function (combo, record, index)
563             {
564                 Roo.log('select');
565                 _this.grid.ds.load({});
566             }
567           },
568           xns : Roo.form,
569           '|xns' : 'Roo.form',
570           store : {
571            xtype : 'SimpleStore',
572            data : [ 
573                [ 'active', "Active"],
574                [ 'me' , "Assigned to me"],
575                [ 'me-all' , "Assigned to me (All projects)"],    
576                [ 'closed' , "Closed"],
577                [ 'on-hold' , "On Hold"],
578                [ 'pending' , "Pending Review / Resolved"],
579                [ 'in-progress' , "In Progress"],
580                [ 'all' , "All States"]
581                 
582            ],
583            fields : [  'ftype', 'fname'],
584            xns : Roo.data,
585            '|xns' : 'Roo.data'
586           }
587          },
588          {
589           xtype : 'Button',
590           cls : 'x-btn-icon',
591           icon : rootURL + '/Pman/templates/images/search.gif',
592           listeners : {
593            click : function (_self, e)
594             {
595                 _this.grid.ds.load({});
596             }
597           },
598           xns : Roo.Toolbar,
599           '|xns' : 'Roo.Toolbar'
600          },
601          {
602           xtype : 'Button',
603           cls : 'x-btn-icon',
604           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
605           listeners : {
606            click : function (_self, e)
607             {
608                 _this.searchBox.setValue('');
609                 
610                     _this.grid.ds.load({});
611             }
612           },
613           xns : Roo.Toolbar,
614           '|xns' : 'Roo.Toolbar'
615          }
616         ]
617        },
618        dataSource : {
619         xtype : 'Store',
620         remoteSort : true,
621         sortInfo : { field : 'summary', direction: 'ASC' },
622         listeners : {
623          beforeload : function (_self, options)
624           {
625               
626              if (Pman.building) { return false; }
627               options.params =     options.params || {};
628               options.params['query[search]'] = _this.searchBox.getValue();
629               var sq =        options.params['query[viewtype]'] = _this.status.getValue(); 
630               var pc = false;
631               var ps = false;
632               try {
633                    pc = _this.grid.colModel.getIndexByDataIndex('project_id_name');
634                   
635               } catch(e) {} 
636               
637           
638               if (!options.params['query[search]'].length || isNaN(options.params['query[search]'])) {
639                       
640                   
641                   ps = _this.personSel.getValue();
642                   ps = ps ? ps : 0;
643                   if (ps ) {
644                       options.params.developer_id = ps <0 ? 0 : ps;
645                   }
646           
647                    
648                   
649                   
650                   try { 
651                       options.params.project_id  = Pman.Tab.DocumentsTab.panel.getProjectId();
652                   } catch(e) {
653                       options.params.project_id  = typeof(MTrack) != 'undefined' ? MTrack.projectCombo.getValue(): 0;
654                   }
655                   options.params.project_id =      options.params.project_id || undefined;
656                }
657                
658           
659                    
660                      
661               if (  ps < 1 && pc !== false) {
662                   _this.grid.colModel.setHidden(pc, true);
663                   
664               }
665               
666               // project column
667               if (pc!== false) {
668                    _this.grid.colModel.setHidden(pc, true);
669                }
670                
671               if (pc !== false && !options.params.project_id) {
672           
673                    _this.grid.colModel.setHidden(pc, false);       
674           
675               }
676           
677               options.params.limit = 999;
678               // columns...
679           
680               
681               
682           },
683          update : function (_self, record, operation)
684           {
685               Roo.log('update: ' + JSON.stringify(operation));
686               if (operation != 'commit') {
687                   return;
688               }
689               // send things that might change..
690               new Pman.Request({
691                   url : baseURL + '/Roo/mtrack_ticket',
692                   method : 'POST',
693                   params : {
694                       id : record.data.id,
695                       milestone_id : record.data.milestone_id,
696                       priority_id : record.data.priority_id,
697                       severity_id : record.data.severity_id,
698                       classification_id : record.data.classification_id,
699                       estimated : record.data.estimated,
700                       developer_id : record.data.developer_id
701                   },
702                   success : function(res)
703                   {
704                       var r = res.data;
705                       //Roo.log(r);
706                       // do nothing?
707                       record.modified = record.modified || {};
708                       for (var k in r) {
709                           // update the 
710                            
711                           if (k.match(/_id$/) || k.match(/_id_/) || k.match(/^status_/)) {
712                
713                               record.data[k] = r[k];
714                               record.modified[k] = r[k];
715                           }
716                       }
717                       record.store.afterEdit(record);
718                   }
719                   // we should really have a failure - to reset to the old value.
720               });
721                
722               
723               
724           }
725         },
726         xns : Roo.data,
727         '|xns' : 'Roo.data',
728         proxy : {
729          xtype : 'HttpProxy',
730          method : 'GET',
731          url : baseURL + '/Roo/mtrack_ticket.php',
732          xns : Roo.data,
733          '|xns' : 'Roo.data'
734         },
735         reader : {
736          xtype : 'JsonReader',
737          fields : [
738              {
739                  'name': 'id',
740                  'type': 'int'
741              },
742              {
743                  'name': 'project_id',
744                  'type': 'int'
745              },
746              {
747                  'name': 'summary',
748                  'type': 'string'
749              },
750              {
751                  'name': 'description',
752                  'type': 'string'
753              },
754              {
755                  'name': 'changelog',
756                  'type': 'string'
757              },
758              {
759                  'name': 'created',
760                  'type': 'int'
761              },
762              {
763                  'name': 'updated',
764                  'type': 'int'
765              },
766              {
767                  'name': 'owner_id',
768                  'type': 'int'
769              },
770              {
771                  'name': 'priority_id',
772                  'type': 'int'
773              },
774              {
775                  'name': 'severity_id',
776                  'type': 'int'
777              },
778              {
779                  'name': 'classification_id',
780                  'type': 'int'
781              },
782              {
783                  'name': 'resolution_id',
784                  'type': 'int'
785              },
786              {
787                  'name': 'cc',
788                  'type': 'string'
789              },
790              {
791                  'name': 'status',
792                  'type': 'int'
793              },
794              {
795                  'name': 'estimated',
796                  'type': 'float'
797              },
798              {
799                  'name': 'spent',
800                  'type': 'float'
801              },
802              {
803                  'name': 'x_fieldname',
804                  'type': 'string'
805              },
806              {
807                  'name': 'developer_id',
808                  'type': 'int'
809              },
810              {
811                  'name': 'milestone_id',
812                  'type': 'int'
813              },
814              {
815                  'name': 'updated_id',
816                  'type': 'int'
817              },
818              {
819                  'name': 'updated_person_id',
820                  'type': 'int'
821              },
822              {
823                  'name': 'updated_ontable',
824                  'type': 'string'
825              },
826              {
827                  'name': 'updated_onid',
828                  'type': 'int'
829              },
830              {
831                  'name': 'updated_changedate',
832                  'type': 'date'
833              },
834              {
835                  'name': 'updated_reason',
836                  'type': 'string'
837              },
838              {
839                  'name': 'created_id',
840                  'type': 'int'
841              },
842              {
843                  'name': 'created_person_id',
844                  'type': 'int'
845              },
846              {
847                  'name': 'created_ontable',
848                  'type': 'string'
849              },
850              {
851                  'name': 'created_onid',
852                  'type': 'int'
853              },
854              {
855                  'name': 'created_changedate',
856                  'type': 'date'
857              },
858              {
859                  'name': 'created_reason',
860                  'type': 'string'
861              },
862              {
863                  'name': 'owner_id_id',
864                  'type': 'int'
865              },
866              {
867                  'name': 'owner_id_office_id',
868                  'type': 'int'
869              },
870              {
871                  'name': 'owner_id_name',
872                  'type': 'string'
873              },
874              {
875                  'name': 'owner_id_phone',
876                  'type': 'string'
877              },
878              {
879                  'name': 'owner_id_fax',
880                  'type': 'string'
881              },
882              {
883                  'name': 'owner_id_email',
884                  'type': 'string'
885              },
886              {
887                  'name': 'owner_id_company_id',
888                  'type': 'int'
889              },
890              {
891                  'name': 'owner_id_role',
892                  'type': 'string'
893              },
894              {
895                  'name': 'owner_id_active',
896                  'type': 'int'
897              },
898              {
899                  'name': 'owner_id_remarks',
900                  'type': 'string'
901              },
902              {
903                  'name': 'owner_id_passwd',
904                  'type': 'string'
905              },
906              {
907                  'name': 'owner_id_owner_id',
908                  'type': 'int'
909              },
910              {
911                  'name': 'owner_id_lang',
912                  'type': 'string'
913              },
914              {
915                  'name': 'owner_id_no_reset_sent',
916                  'type': 'int'
917              },
918              {
919                  'name': 'owner_id_action_type',
920                  'type': 'string'
921              },
922              {
923                  'name': 'owner_id_project_id',
924                  'type': 'int'
925              },
926              {
927                  'name': 'owner_id_deleted_by',
928                  'type': 'int'
929              },
930              {
931                  'name': 'owner_id_deleted_dt',
932                  'type': 'date'
933              },
934              {
935                  'name': 'developer_id_id',
936                  'type': 'int'
937              },
938              {
939                  'name': 'developer_id_office_id',
940                  'type': 'int'
941              },
942              {
943                  'name': 'developer_id_name',
944                  'type': 'string'
945              },
946              {
947                  'name': 'developer_id_phone',
948                  'type': 'string'
949              },
950              {
951                  'name': 'developer_id_fax',
952                  'type': 'string'
953              },
954              {
955                  'name': 'developer_id_email',
956                  'type': 'string'
957              },
958              {
959                  'name': 'developer_id_company_id',
960                  'type': 'int'
961              },
962              {
963                  'name': 'developer_id_role',
964                  'type': 'string'
965              },
966              {
967                  'name': 'developer_id_active',
968                  'type': 'int'
969              },
970              {
971                  'name': 'developer_id_remarks',
972                  'type': 'string'
973              },
974              {
975                  'name': 'developer_id_passwd',
976                  'type': 'string'
977              },
978              {
979                  'name': 'developer_id_owner_id',
980                  'type': 'int'
981              },
982              {
983                  'name': 'developer_id_lang',
984                  'type': 'string'
985              },
986              {
987                  'name': 'developer_id_no_reset_sent',
988                  'type': 'int'
989              },
990              {
991                  'name': 'developer_id_action_type',
992                  'type': 'string'
993              },
994              {
995                  'name': 'developer_id_project_id',
996                  'type': 'int'
997              },
998              {
999                  'name': 'developer_id_deleted_by',
1000                  'type': 'int'
1001              },
1002              {
1003                  'name': 'developer_id_deleted_dt',
1004                  'type': 'date'
1005              },
1006              {
1007                  'name': 'priority_id_id',
1008                  'type': 'int'
1009              },
1010              {
1011                  'name': 'priority_id_etype',
1012                  'type': 'string'
1013              },
1014              {
1015                  'name': 'priority_id_name',
1016                  'type': 'string'
1017              },
1018              {
1019                  'name': 'priority_id_active',
1020                  'type': 'int'
1021              },
1022              {
1023                  'name': 'priority_id_seqid',
1024                  'type': 'int'
1025              },
1026              {
1027                  'name': 'severity_id_id',
1028                  'type': 'int'
1029              },
1030              {
1031                  'name': 'severity_id_etype',
1032                  'type': 'string'
1033              },
1034              {
1035                  'name': 'severity_id_name',
1036                  'type': 'string'
1037              },
1038              {
1039                  'name': 'severity_id_active',
1040                  'type': 'int'
1041              },
1042              {
1043                  'name': 'severity_id_seqid',
1044                  'type': 'int'
1045              },
1046              {
1047                  'name': 'classification_id_id',
1048                  'type': 'int'
1049              },
1050              {
1051                  'name': 'classification_id_etype',
1052                  'type': 'string'
1053              },
1054              {
1055                  'name': 'classification_id_name',
1056                  'type': 'string'
1057              },
1058              {
1059                  'name': 'classification_id_active',
1060                  'type': 'int'
1061              },
1062              {
1063                  'name': 'classification_id_seqid',
1064                  'type': 'int'
1065              },
1066              {
1067                  'name': 'resolution_id_id',
1068                  'type': 'int'
1069              },
1070              {
1071                  'name': 'resolution_id_etype',
1072                  'type': 'string'
1073              },
1074              {
1075                  'name': 'resolution_id_name',
1076                  'type': 'string'
1077              },
1078              {
1079                  'name': 'resolution_id_active',
1080                  'type': 'int'
1081              },
1082              {
1083                  'name': 'resolution_id_seqid',
1084                  'type': 'int'
1085              },
1086              {
1087                  'name': 'status_id',
1088                  'type': 'int'
1089              },
1090              {
1091                  'name': 'status_etype',
1092                  'type': 'string'
1093              },
1094              {
1095                  'name': 'status_name',
1096                  'type': 'string'
1097              },
1098              {
1099                  'name': 'status_active',
1100                  'type': 'int'
1101              },
1102              {
1103                  'name': 'status_seqid',
1104                  'type': 'int'
1105              },
1106              {
1107                  'name': 'project_id_id',
1108                  'type': 'int'
1109              },
1110              {
1111                  'name': 'project_id_name',
1112                  'type': 'string'
1113              },
1114              {
1115                  'name': 'project_id_remarks',
1116                  'type': 'string'
1117              },
1118              {
1119                  'name': 'project_id_owner_id',
1120                  'type': 'int'
1121              },
1122              {
1123                  'name': 'project_id_code',
1124                  'type': 'string'
1125              },
1126              {
1127                  'name': 'project_id_active',
1128                  'type': 'int'
1129              },
1130              {
1131                  'name': 'project_id_type',
1132                  'type': 'string'
1133              },
1134              {
1135                  'name': 'project_id_client_id',
1136                  'type': 'int'
1137              },
1138              {
1139                  'name': 'project_id_team_id',
1140                  'type': 'int'
1141              },
1142              {
1143                  'name': 'project_id_file_location',
1144                  'type': 'string'
1145              },
1146              {
1147                  'name': 'project_id_open_date',
1148                  'type': 'date'
1149              },
1150              {
1151                  'name': 'project_id_open_by',
1152                  'type': 'int'
1153              },
1154              {
1155                  'name': 'project_id_close_date',
1156                  'type': 'date'
1157              },
1158              {
1159                  'name': 'project_id_countries',
1160                  'type': 'string'
1161              },
1162              {
1163                  'name': 'project_id_languages',
1164                  'type': 'string'
1165              },
1166              {
1167                  'name': 'project_id_agency_id',
1168                  'type': 'int'
1169              },
1170              {
1171                  'name': 'milestone_id_id',
1172                  'type': 'int'
1173              },
1174              {
1175                  'name': 'milestone_id_name',
1176                  'type': 'string'
1177              },
1178              {
1179                  'name': 'milestone_id_description',
1180                  'type': 'string'
1181              },
1182              {
1183                  'name': 'milestone_id_startdate',
1184                  'type': 'date'
1185              },
1186              {
1187                  'name': 'milestone_id_duedate',
1188                  'type': 'date'
1189              },
1190              {
1191                  'name': 'milestone_id_completed',
1192                  'type': 'date'
1193              },
1194              {
1195                  'name': 'milestone_id_deleted',
1196                  'type': 'int'
1197              },
1198              {
1199                  'name': 'milestone_id_created',
1200                  'type': 'int'
1201              },
1202              {
1203                  'name': 'milestone_id_updated',
1204                  'type': 'int'
1205              },
1206              {
1207                  'name': 'milestone_id_project_id',
1208                  'type': 'int'
1209              }
1210          ],
1211          id : 'id',
1212          root : 'data',
1213          totalProperty : 'total',
1214          xns : Roo.data,
1215          '|xns' : 'Roo.data'
1216         }
1217        },
1218        dropTarget : {
1219         xtype : 'DropTarget',
1220         ddGroup : 'mtrack_ticket',
1221         expandRow : function(ri,pos)
1222         {
1223             var dom = _this.grid.view.getRow(ri);
1224             //Roo.log(dom);
1225             //if (this.activeDom == dom) {
1226             //    return;
1227             //}
1228             if (this.activeDom) {
1229                 Roo.get(this.activeDom).removeClass('x-grid-dd-above');
1230                 Roo.get(this.activeDom).removeClass('x-grid-dd-below');
1231                 
1232                 this.activeDom = false;
1233             }
1234             
1235             if (ri === false) {
1236                 return;
1237             }
1238             Roo.get(dom).addClass('x-grid-dd-' + pos);
1239              
1240             this.activeDom = dom;
1241         
1242         
1243         },
1244         getDropPoint : function(e, data)
1245         {
1246             //var tn = n.node;
1247            // data is from griddragzone
1248            
1249             var te = Roo.lib.Event.getTarget(e); 
1250             
1251             // use grid??
1252             var ri =  Roo.fly(te).findParent("td", 6);
1253                 
1254            
1255             var dragEl = ri;
1256             var t = Roo.lib.Dom.getY(dragEl),
1257                 b = t + dragEl.offsetHeight;
1258             var y = Roo.lib.Event.getPageY(e);
1259             //var noAppend = tn.allowChildren === false || tn.isLeaf();
1260             
1261             // we may drop nodes anywhere, as long as allowChildren has not been set to false..
1262             
1263               
1264             var q = (b - t) / 2;
1265             
1266             
1267             if(y >= t && y < (t + q)){
1268                 return "above";
1269             }
1270             if(y >= b-q && y <= b){
1271                 return "below";
1272             }
1273             //Roo.log( JSON.stringify( {pos: y, dragtop : t, mid : q, drabgot: b }));
1274             
1275             
1276             return false;
1277         },
1278         listeners : {
1279          drop : function (source, e, data)
1280           {
1281                   var grid = _this.grid;
1282                   var t = Roo.lib.Event.getTarget(e); 
1283                   var t = Roo.lib.Event.getTarget(e); 
1284                   var ri = grid.view.findRowIndex(t);
1285                  //Roo.log(e);
1286                  //Roo.log(data);
1287                   var dp = this.getDropPoint(e,data);
1288                 // at this point should have above or below..
1289                   var os = grid.selModel.getSelectedCell();
1290                   grid.ds.remove(data.selections[0]);
1291                   var new_row = ri + (dp == 'below' ? 1 : 0);
1292                   grid.ds.insert(new_row , data.selections);
1293                   grid.selModel.select(new_row , os[1]);
1294                   this.expandRow(false);
1295                   
1296                   
1297                   var above_id = 0;
1298                   var above_row = new_row-1;
1299                   if (above_row > -1) {
1300                       above_id = grid.ds.getAt(above_row).data.id;
1301                   }
1302                   new Pman.Request({
1303                       method : 'POST',
1304                       url : baseURL + '/Roo/Mtrack_ticket',
1305                       params : { 
1306                           id : grid.ds.getAt(new_row).data.id,
1307                           _reorder : above_id
1308                       }
1309                       
1310                   });
1311                   
1312                   
1313                   
1314           },
1315          over : function (source, e, data)
1316           {
1317           
1318               Roo.log('over');
1319           // if drag point == drop point...
1320               var grid = _this.grid;
1321                  var t = Roo.lib.Event.getTarget(e); 
1322                  var ri = grid.view.findRowIndex(t);
1323                  var dp = this.getDropPoint(e,data);
1324                  Roo.log(dp);
1325                  //Roo.log(JSON.stringify({ dp: dp,  ri: ri, src_ri: data.rowIndex}));
1326                  if(ri == data.rowIndex ||
1327                       (dp == 'above' && ri-1 == data.rowIndex) ||
1328                       (dp == 'below' && ri+1 == data.rowIndex) 
1329                    ) {
1330                      this.expandRow(false);
1331                 
1332                       this.valid = false;
1333                       return;
1334                  }
1335                  this.expandRow(ri, dp);
1336                  
1337                
1338                 this.valid = 'ok-add'; 
1339           }
1340         },
1341         xns : Roo.dd,
1342         '|xns' : 'Roo.dd'
1343        },
1344        sm : {
1345         xtype : 'RowSelectionModel',
1346         listeners : {
1347          afterselectionchange : function (_self, rowIndex, colIndex)
1348           {
1349               
1350               var   sels =   _this.grid.selModel.getSelections();
1351               
1352               if (!sels || sels.length > 1) {
1353               
1354                   return;
1355               }
1356               
1357               var rec = sels[0];
1358               
1359               // verify nothing has chagned.. 
1360                
1361               // load the ticked, and render a view of it...
1362               new Pman.Request({
1363                   url : baseURL + '/Roo/mtrack_ticket',
1364                   method : 'GET',
1365                   params : { 
1366                       _id : rec.data.id
1367                   },
1368                   success : function(res) {
1369                       //Roo.log(res.data);
1370                       // render it into a template..
1371                       _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
1372                       _this.tpanel.el.scrollTo('top',0);
1373                        
1374                       //... ehh
1375                        Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
1376                    
1377                       
1378                      
1379                       new Pman.Request({
1380                           url : baseURL + '/Roo/Images',
1381                           method : 'GET',
1382                           params : { 
1383                               onid : rec.data.id,
1384                               ontable : 'mtrack_ticket'
1385                           },
1386                           success : function(ares) {
1387                               Roo.log(ares.data);
1388                               var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
1389                               // fill in the attachement area with data from this..
1390                               el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
1391                           }
1392                       });
1393                        
1394                       
1395                       _this.form.reset();
1396           
1397                       _this.form.setValues({
1398                           id : rec.data.id,
1399                           owner_id : rec.data.owner_id,
1400                           owner_id_name : rec.data.owner_id_name,
1401                           status : rec.data.status,
1402                           status_name : "No Change"
1403                       }); 
1404                       
1405                       
1406                       for(var k in res.data) {
1407                           rec.set(k,res.data[k]);
1408                       }
1409                       
1410                   }
1411               });
1412                   
1413               
1414               
1415           },
1416          cellselect : function (_self, rowIndex, colIndex)
1417           {
1418               return false;
1419               var rec = _this.grid.ds.getAt(rowIndex);
1420               
1421               // verify nothing has chagned.. 
1422                
1423               // load the ticked, and render a view of it...
1424               new Pman.Request({
1425                   url : baseURL + '/Roo/mtrack_ticket',
1426                   method : 'GET',
1427                   params : { 
1428                       _id : rec.data.id
1429                   },
1430                   success : function(res) {
1431                       //Roo.log(res.data);
1432                       // render it into a template..
1433                       _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
1434                       _this.tpanel.el.scrollTo('top',0);
1435                        
1436                       //... ehh
1437                        Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
1438                    
1439                       new Pman.Request({
1440                           url : baseURL + '/Roo/Images',
1441                           method : 'GET',
1442                           params : { 
1443                               onid : rec.data.id,
1444                               ontable : 'mtrack_ticket'
1445                           },
1446                           success : function(ares) {
1447                               Roo.log(ares.data);
1448                               var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
1449                               // fill in the attachement area with data from this..
1450                               el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
1451                           }
1452                       });
1453                        
1454                       
1455                       _this.form.reset();
1456           
1457                       _this.form.setValues({
1458                           id : rec.data.id,
1459                           owner_id : rec.data.owner_id,
1460                           owner_id_name : rec.data.owner_id_name,
1461                           status : rec.data.status,
1462                           status_name : "No Change"
1463                       }); 
1464                       
1465                       
1466                       for(var k in res.data) {
1467                           rec.set(k,res.data[k]);
1468                       }
1469                       
1470                   }
1471               });
1472                   
1473               
1474               
1475           }
1476         },
1477         xns : Roo.grid,
1478         '|xns' : 'Roo.grid'
1479        },
1480        colModel : [
1481         {
1482          xtype : 'ColumnModel',
1483          dataIndex : 'id',
1484          header : _this._strings['b1550c2a1a5eb0d078d92eef8a0ef883'] /* ID# */,
1485          renderer : function(v) { return String.format('#{0}', v); },
1486          sortable : true,
1487          width : 50,
1488          xns : Roo.grid,
1489          '|xns' : 'Roo.grid'
1490         },
1491         {
1492          xtype : 'ColumnModel',
1493          dataIndex : 'project_id_name',
1494          header : _this._strings['9e727fdd3aec8274f46685441900280d'] /* Project */,
1495          hidden : true,
1496          renderer : function(v) { return String.format('{0}', v); },
1497          width : 75,
1498          xns : Roo.grid,
1499          '|xns' : 'Roo.grid'
1500         },
1501         {
1502          xtype : 'ColumnModel',
1503          dataIndex : 'milestone_id',
1504          header : _this._strings['e9c626b8a8b62de7562dfbf51a576ae5'] /* Milestone */,
1505          renderer : function(v, x,r ) { return String.format('{0}', r.data.milestone_id_name); },
1506          sortable : true,
1507          width : 75,
1508          xns : Roo.grid,
1509          '|xns' : 'Roo.grid',
1510          editor : {
1511           xtype : 'GridEditor',
1512           listeners : {
1513            complete : function (_self, value, startValue)
1514             {
1515               Roo.log('complete');
1516             }
1517           },
1518           xns : Roo.grid,
1519           '|xns' : 'Roo.grid',
1520           field : {
1521            xtype : 'ComboBox',
1522            allowBlank : false,
1523            alwaysQuery : true,
1524            displayField : 'name',
1525            editable : false,
1526            emptyText : _this._strings['a5ffb2a210f259195a75e5abca8db4a2'] /* Select mtrack_milestone */,
1527            forceSelection : true,
1528            hiddenName : 'milestone_id',
1529            listWidth : 400,
1530            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1531            minChars : 2,
1532            name : 'milestone_id_name',
1533            pageSize : 20,
1534            qtip : _this._strings['a5ffb2a210f259195a75e5abca8db4a2'] /* Select mtrack_milestone */,
1535            queryParam : '',
1536            selectOnFocus : true,
1537            tpl : '<div class=\"x-grid-cell-text\"><b>{name}</b> - {startdate:date(\"d/m/Y\")} - {duedate:date(\"d/m/Y\")} </div>',
1538            triggerAction : 'all',
1539            typeAhead : true,
1540            valueField : 'id',
1541            width : 300,
1542            listeners : {
1543             select : function (combo, record, index)
1544              {
1545                  Roo.log('selected');
1546                  
1547                  (function() { 
1548                      _this.grid.stopEditing();
1549                  }).defer(100);
1550              }
1551            },
1552            xns : Roo.form,
1553            '|xns' : 'Roo.form',
1554            store : {
1555             xtype : 'Store',
1556             remoteSort : true,
1557             sortInfo : { direction : 'ASC', field: 'duedate' },
1558             listeners : {
1559              beforeload : function (_self, o){
1560                   o.params = o.params || {};
1561                   // set more here
1562                  var rec =   _this.grid.activeEditor.record;
1563               
1564                   o.params.project_id = rec.data.project_id;
1565                   //o.params._viewtype = 'ACTIVE';
1566                   o.params._viewtype
1567               }
1568             },
1569             xns : Roo.data,
1570             '|xns' : 'Roo.data',
1571             proxy : {
1572              xtype : 'HttpProxy',
1573              method : 'GET',
1574              url : baseURL + '/Roo/mtrack_milestone.php',
1575              xns : Roo.data,
1576              '|xns' : 'Roo.data'
1577             },
1578             reader : {
1579              xtype : 'JsonReader',
1580              fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1581              id : 'id',
1582              root : 'data',
1583              totalProperty : 'total',
1584              xns : Roo.data,
1585              '|xns' : 'Roo.data'
1586             }
1587            }
1588           }
1589          }
1590         },
1591         {
1592          xtype : 'ColumnModel',
1593          dataIndex : 'status_name',
1594          header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
1595          hidden : true,
1596          width : 80,
1597          xns : Roo.grid,
1598          '|xns' : 'Roo.grid'
1599         },
1600         {
1601          xtype : 'ColumnModel',
1602          dataIndex : 'resolution_id_name',
1603          header : _this._strings['f691f042a559b1c1a4f89826c6f75760'] /* Resolved */,
1604          hidden : true,
1605          width : 80,
1606          xns : Roo.grid,
1607          '|xns' : 'Roo.grid'
1608         },
1609         {
1610          xtype : 'ColumnModel',
1611          dataIndex : 'summary',
1612          header : _this._strings['290612199861c31d1036b185b4e69b75'] /* Summary */,
1613          renderer : function(v,x,r) { 
1614              
1615              var col = '#000'; // closed?
1616              switch (r.data.status_name) {
1617                  case 'REVIEW_BY_ADMIN':
1618                      col = '#0cc'; break; // blue
1619                  case 'TODO':
1620                  case 'CLIENT_NEW_REQUEST':        
1621                  case 'CLIENT_SAY_NEED_MORE_WORK':                
1622                      col = '#c00'; break; // redish
1623                  case 'CLOSED':                
1624                      col = '#999'; break; // grey
1625             }
1626             
1627             var sn = r.data.status_name.toLowerCase().split('_').join(' ');
1628             
1629              return String.format(
1630                  r.data.status_name == 'CLOSED'  ?
1631                        '</span><s style="color:{2}">[{1}]</s> {0}':
1632                        '<span style="color:{2}">[{1}]</span> {0}',
1633                      v,
1634                      r.data.status_name == 'CLOSED'  ?
1635                           r.data.resolution_id_name : 
1636                           sn , col
1637                      ); 
1638          },
1639          width : 200,
1640          xns : Roo.grid,
1641          '|xns' : 'Roo.grid'
1642         },
1643         {
1644          xtype : 'ColumnModel',
1645          dataIndex : 'owner_id_name',
1646          header : _this._strings['b6f4a2ec6356bbd56d49f2096bf9d3d3'] /* Owner */,
1647          renderer : function(v) { return String.format('{0}', v); },
1648          width : 75,
1649          xns : Roo.grid,
1650          '|xns' : 'Roo.grid'
1651         },
1652         {
1653          xtype : 'ColumnModel',
1654          dataIndex : 'developer_id',
1655          header : _this._strings['672caf27f5363dc833bda5099775e891'] /* Developer */,
1656          renderer : function(v,x,r) { return String.format('{0}', r.data.developer_id_name); },
1657          width : 75,
1658          xns : Roo.grid,
1659          '|xns' : 'Roo.grid',
1660          editor : {
1661           xtype : 'GridEditor',
1662           xns : Roo.grid,
1663           '|xns' : 'Roo.grid',
1664           field : {
1665            xtype : 'ComboBox',
1666            allowBlank : true,
1667            alwaysQuery : true,
1668            displayField : 'name',
1669            editable : false,
1670            emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1671            fieldLabel : _this._strings['04720e14ddfde3154a120fdd0ae73d19'] /* Action Required By */,
1672            forceSelection : true,
1673            hiddenName : 'developer_id',
1674            listWidth : 400,
1675            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1676            minChars : 2,
1677            name : 'developer_id_name',
1678            qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1679            queryParam : 'query[name]',
1680            selectOnFocus : true,
1681            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt;</div>',
1682            triggerAction : 'all',
1683            typeAhead : true,
1684            valueField : 'id',
1685            width : 200,
1686            listeners : {
1687             select : function (combo, record, index)
1688              {
1689                
1690                  (function() { 
1691                      _this.grid.stopEditing();
1692                  }).defer(100);
1693              }
1694            },
1695            xns : Roo.form,
1696            '|xns' : 'Roo.form',
1697            store : {
1698             xtype : 'Store',
1699             remoteSort : true,
1700             sortInfo : { direction : 'ASC', field: 'name' },
1701             listeners : {
1702              beforeload : function (_self, o){
1703                   o.params = o.params || {};
1704                   // set more here
1705                  var rec =   _this.grid.activeEditor.record;
1706               
1707                   
1708                   o.params['query[ticket_id]'] = rec.data.id;
1709                   
1710                   o.params['query[project_id]']=  rec.data.project_id;
1711                  o.params._anyrole = 1;
1712                   o.params.limit = 99;
1713               }
1714             },
1715             xns : Roo.data,
1716             '|xns' : 'Roo.data',
1717             proxy : {
1718              xtype : 'HttpProxy',
1719              method : 'GET',
1720              url : baseURL + '/Roo/Person.php',
1721              xns : Roo.data,
1722              '|xns' : 'Roo.data'
1723             },
1724             reader : {
1725              xtype : 'JsonReader',
1726              fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1727              id : 'id',
1728              root : 'data',
1729              totalProperty : 'total',
1730              xns : Roo.data,
1731              '|xns' : 'Roo.data'
1732             }
1733            }
1734           }
1735          }
1736         },
1737         {
1738          xtype : 'ColumnModel',
1739          dataIndex : 'priority_id',
1740          header : _this._strings['502996d9790340c5fd7b86a5b93b1c9f'] /* Priority */,
1741          renderer : function(v,x,r) { 
1742              x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.priority_id_seqid % 10, r.data.priority_id_seqmax % 10 ); 
1743              return String.format('{0}', r.data.priority_id_name); 
1744          },
1745          sortable : true,
1746          width : 75,
1747          xns : Roo.grid,
1748          '|xns' : 'Roo.grid',
1749          editor : {
1750           xtype : 'GridEditor',
1751           listeners : {
1752            complete : function (_self, value, startValue)
1753             {
1754               Roo.log('complete');
1755             }
1756           },
1757           xns : Roo.grid,
1758           '|xns' : 'Roo.grid',
1759           field : {
1760            xtype : 'ComboBox',
1761            allowBlank : false,
1762            alwaysQuery : true,
1763            displayField : 'name',
1764            editable : false,
1765            emptyText : _this._strings['8a223eb0008a86f053b2a7eac0fa6eac'] /* Select priority */,
1766            forceSelection : true,
1767            hiddenName : 'priority_id',
1768            listWidth : 400,
1769            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1770            minChars : 2,
1771            name : 'priority_id_name',
1772            pageSize : 20,
1773            qtip : _this._strings['8a223eb0008a86f053b2a7eac0fa6eac'] /* Select priority */,
1774            queryParam : '',
1775            selectOnFocus : true,
1776            tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
1777            triggerAction : 'all',
1778            typeAhead : true,
1779            valueField : 'id',
1780            width : 300,
1781            listeners : {
1782             select : function (combo, record, index)
1783              {
1784                  Roo.log('selected');
1785                  
1786                  (function() { 
1787                      _this.grid.stopEditing();
1788                  }).defer(100);
1789              }
1790            },
1791            xns : Roo.form,
1792            '|xns' : 'Roo.form',
1793            store : {
1794             xtype : 'Store',
1795             remoteSort : true,
1796             sortInfo : { direction : 'ASC', field: 'seqid' },
1797             listeners : {
1798              beforeload : function (_self, o){
1799                   o.params = o.params || {};
1800                  o.params.etype='priority'
1801                   // set more here
1802                   
1803               }
1804             },
1805             xns : Roo.data,
1806             '|xns' : 'Roo.data',
1807             proxy : {
1808              xtype : 'HttpProxy',
1809              method : 'GET',
1810              url : baseURL + '/Roo/core_enum.php',
1811              xns : Roo.data,
1812              '|xns' : 'Roo.data'
1813             },
1814             reader : {
1815              xtype : 'JsonReader',
1816              fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1817              id : 'id',
1818              root : 'data',
1819              totalProperty : 'total',
1820              xns : Roo.data,
1821              '|xns' : 'Roo.data'
1822             }
1823            }
1824           }
1825          }
1826         },
1827         {
1828          xtype : 'ColumnModel',
1829          dataIndex : 'severity_id',
1830          header : _this._strings['007cc9547ae8884ad597cd92ba505422'] /* Severity */,
1831          renderer : function(v,x,r) { 
1832              x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.severity_id_seqid, r.data.severity_id_seqmax ); 
1833              return String.format('{0}', r.data.severity_id_name); 
1834              },
1835          sortable : true,
1836          width : 75,
1837          xns : Roo.grid,
1838          '|xns' : 'Roo.grid',
1839          editor : {
1840           xtype : 'GridEditor',
1841           listeners : {
1842            complete : function (_self, value, startValue)
1843             {
1844               Roo.log('complete');
1845             }
1846           },
1847           xns : Roo.grid,
1848           '|xns' : 'Roo.grid',
1849           field : {
1850            xtype : 'ComboBox',
1851            allowBlank : false,
1852            alwaysQuery : true,
1853            displayField : 'name',
1854            editable : false,
1855            emptyText : _this._strings['423570be9f14a39fe88384797ee376fd'] /* Select severity */,
1856            forceSelection : true,
1857            hiddenName : 'severity_id',
1858            listWidth : 400,
1859            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1860            minChars : 2,
1861            name : 'severity_id_name',
1862            pageSize : 20,
1863            qtip : _this._strings['423570be9f14a39fe88384797ee376fd'] /* Select severity */,
1864            queryParam : '',
1865            selectOnFocus : true,
1866            tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
1867            triggerAction : 'all',
1868            typeAhead : true,
1869            valueField : 'id',
1870            width : 300,
1871            listeners : {
1872             select : function (combo, record, index)
1873              {
1874                  Roo.log('selected');
1875                  
1876                  (function() { 
1877                      _this.grid.stopEditing();
1878                  }).defer(100);
1879              }
1880            },
1881            xns : Roo.form,
1882            '|xns' : 'Roo.form',
1883            store : {
1884             xtype : 'Store',
1885             remoteSort : true,
1886             sortInfo : { direction : 'ASC', field: 'seqid' },
1887             listeners : {
1888              beforeload : function (_self, o){
1889                   o.params = o.params || {};
1890                  o.params.etype='severity'
1891                   // set more here
1892                   
1893               }
1894             },
1895             xns : Roo.data,
1896             '|xns' : 'Roo.data',
1897             proxy : {
1898              xtype : 'HttpProxy',
1899              method : 'GET',
1900              url : baseURL + '/Roo/core_enum.php',
1901              xns : Roo.data,
1902              '|xns' : 'Roo.data'
1903             },
1904             reader : {
1905              xtype : 'JsonReader',
1906              fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1907              id : 'id',
1908              root : 'data',
1909              totalProperty : 'total',
1910              xns : Roo.data,
1911              '|xns' : 'Roo.data'
1912             }
1913            }
1914           }
1915          }
1916         },
1917         {
1918          xtype : 'ColumnModel',
1919          dataIndex : 'classification_id',
1920          header : _this._strings['5c9335b28e6277ddbe0137f04e5e58a7'] /* Classification */,
1921          renderer : function(v,x,r) { 
1922              x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.classification_id_seqid, r.data.classification_id_seqmax ); 
1923              return String.format('{0}', r.data.classification_id_name); 
1924              },
1925          sortable : true,
1926          width : 75,
1927          xns : Roo.grid,
1928          '|xns' : 'Roo.grid',
1929          editor : {
1930           xtype : 'GridEditor',
1931           listeners : {
1932            complete : function (_self, value, startValue)
1933             {
1934               Roo.log('complete');
1935             }
1936           },
1937           xns : Roo.grid,
1938           '|xns' : 'Roo.grid',
1939           field : {
1940            xtype : 'ComboBox',
1941            allowBlank : false,
1942            alwaysQuery : true,
1943            displayField : 'name',
1944            editable : false,
1945            emptyText : _this._strings['7025046a3448dfea367705b884148992'] /* Select classification */,
1946            forceSelection : true,
1947            hiddenName : 'classification_id',
1948            listWidth : 400,
1949            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1950            minChars : 2,
1951            name : 'classification_id_name',
1952            pageSize : 20,
1953            qtip : _this._strings['7025046a3448dfea367705b884148992'] /* Select classification */,
1954            queryParam : '',
1955            selectOnFocus : true,
1956            tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
1957            triggerAction : 'all',
1958            typeAhead : true,
1959            valueField : 'id',
1960            width : 300,
1961            listeners : {
1962             select : function (combo, record, index)
1963              {
1964                  Roo.log('selected');
1965                  
1966                  (function() { 
1967                      _this.grid.stopEditing();
1968                  }).defer(100);
1969              }
1970            },
1971            xns : Roo.form,
1972            '|xns' : 'Roo.form',
1973            store : {
1974             xtype : 'Store',
1975             remoteSort : true,
1976             sortInfo : { direction : 'ASC', field: 'seqid' },
1977             listeners : {
1978              beforeload : function (_self, o){
1979                   o.params = o.params || {};
1980                  o.params.etype='classification'
1981                   // set more here
1982                   
1983               }
1984             },
1985             xns : Roo.data,
1986             '|xns' : 'Roo.data',
1987             proxy : {
1988              xtype : 'HttpProxy',
1989              method : 'GET',
1990              url : baseURL + '/Roo/core_enum.php',
1991              xns : Roo.data,
1992              '|xns' : 'Roo.data'
1993             },
1994             reader : {
1995              xtype : 'JsonReader',
1996              fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1997              id : 'id',
1998              root : 'data',
1999              totalProperty : 'total',
2000              xns : Roo.data,
2001              '|xns' : 'Roo.data'
2002             }
2003            }
2004           }
2005          }
2006         },
2007         {
2008          xtype : 'ColumnModel',
2009          dataIndex : 'estimated',
2010          header : _this._strings['6a7e73161603d87b26a8eac49dab0a9c'] /* Hours */,
2011          renderer : function(v,x,r) { 
2012              return String.format('{0}/{1}', r.data.spent, v); 
2013          },
2014          width : 50,
2015          xns : Roo.grid,
2016          '|xns' : 'Roo.grid',
2017          editor : {
2018           xtype : 'GridEditor',
2019           xns : Roo.grid,
2020           '|xns' : 'Roo.grid',
2021           field : {
2022            xtype : 'NumberField',
2023            allowDecimals : true,
2024            decimalPrecision : 1,
2025            xns : Roo.form,
2026            '|xns' : 'Roo.form'
2027           }
2028          }
2029         },
2030         {
2031          xtype : 'ColumnModel',
2032          dataIndex : 'spent',
2033          header : _this._strings['1fd968087e03faeb2e87df1e9849d983'] /* Spent */,
2034          hidden : true,
2035          renderer : function(v,x,r) { 
2036              return String.format('{0}',v); 
2037          },
2038          width : 50,
2039          xns : Roo.grid,
2040          '|xns' : 'Roo.grid'
2041         },
2042         {
2043          xtype : 'ColumnModel',
2044          dataIndex : 'updated_changedate',
2045          header : _this._strings['ff0a3b7f3daef040faf89a88fdac01b7'] /* Updated */,
2046          renderer : function(v,x,r) { 
2047          
2048              
2049              var str= Date.parseDate( r.data.updated ? r.json.updated_changedate : r.json.created_changedate, 'Y-m-d H:i:s');
2050              
2051              
2052              return String.format('{0}', str ? str.format('d/M/Y') : '?');
2053           },
2054          sortable : true,
2055          width : 75,
2056          xns : Roo.grid,
2057          '|xns' : 'Roo.grid'
2058         }
2059        ]
2060       }
2061      },
2062      {
2063       xtype : 'ContentPanel',
2064       autoScroll : true,
2065       background : false,
2066       fitContainer : true,
2067       fitToFrame : true,
2068       mload : function(url) {
2069           if (typeof(MTrack) == 'undefined') {
2070               return;
2071           }
2072           this._url = url;
2073           this._project = MTrack.projectCombo.getValue();
2074           if (!_this.tpanel) {
2075               return;
2076           }
2077           MTrack.ajaxLoad(url, this);
2078           MTrackWeb.pushState({
2079               url : url,
2080               title : "Browse : " + url,
2081               href : baseURL + url
2082           });
2083            
2084       },
2085       region : 'center',
2086       title : _this._strings['c1c694bd849d91d0eb34bfef8c2d8894'] /* Tickets */,
2087       listeners : {
2088        activate : function (_self)
2089         {
2090             _this.tpanel = _self;
2091         },
2092        resize : function (_self, width, height)
2093         {
2094             // create and update the CSS style
2095             
2096             if (!_this.css) {
2097                 _this.css = Roo.util.CSS;
2098             
2099                 _this.css.createStyleSheet(
2100                     
2101                         ".ticket-view-main .ticket-left-col {  }\n" +
2102                         ".ticket-view-main .readonly-tkt-description { }\n" +
2103                         ".ticket-view-main .mtrack-ticket-events {} \n"
2104                     ,
2105                     Roo.id()
2106                 );   
2107                  
2108             }
2109             var w = width - 400;
2110             Roo.log("new width: " + Math.max(0,w));
2111             
2112             _this.css.updateRule(
2113                 ".ticket-view-main .ticket-left-col", 
2114                     "width", Math.max(0, w) +  'px'
2115             );
2116              _this.css.updateRule(
2117                 ".ticket-view-main .readonly-tkt-description",
2118                     "width", Math.max(0, w-10) +  'px'
2119             );
2120              _this.css.updateRule(
2121                 ".ticket-view-main .mtrack-ticket-events",
2122                     "width", Math.max(0, w-10) +  'px'
2123             );
2124         }
2125       },
2126       xns : Roo,
2127       '|xns' : 'Roo',
2128       toolbar : {
2129        xtype : 'Toolbar',
2130        xns : Roo,
2131        '|xns' : 'Roo',
2132        items  : [
2133         {
2134          xtype : 'Button',
2135          text : _this._strings['b9dd47d69178dbf735bfcd2733fd4ea6'] /* Add Comment / Update */,
2136          listeners : {
2137           click : function (_self, e)
2138            {
2139                
2140                
2141                
2142                var sels = _this.grid.getSelectionModel().getSelections();
2143                if (!sels || sels.length > 1) {
2144                    Roo.MessageBox.alert("Error", "Select a ticket");
2145                    return;
2146                }
2147                var rec = sels[0];
2148                
2149                function ok()
2150                {
2151                    _this.panel.layout.getRegion('south').show();
2152                    _this.panel.layout.getRegion('north').hide();
2153                    _this.form.reset();
2154                    
2155                    _this.form.setValues({
2156                        id : rec.data.id,
2157                        developer_id : rec.data.developer_id,
2158                        developer_id_name : rec.data.developer_id_name
2159                    });
2160                        
2161                }
2162                
2163                if (_this.panel.layout.getRegion('south').isVisible() && _this.form.isDirty()) {
2164                    Roo.MessageBox.confirm("Cancel", "Are you sure you want to cancel editing", function(r) {
2165                        if (r !='yes') {
2166                            return;
2167                        }
2168                        ok();    
2169                        
2170                    });
2171                    return;
2172                }
2173                
2174                ok();
2175                
2176            
2177            
2178            }
2179          },
2180          xns : Roo.Toolbar,
2181          '|xns' : 'Roo.Toolbar'
2182         },
2183         {
2184          xtype : 'Button',
2185          text : _this._strings['5bf7a37a56bdea44d9b2b69201e91fbd'] /* Edit original ticket */,
2186          listeners : {
2187           click : function (_self, e)
2188            {
2189                  var sels = _this.grid.getSelectionModel().getSelections();
2190                if (!sels || sels.length > 1) {
2191                    Roo.MessageBox.alert("Error", "Select a ticket");
2192                    return;
2193                }
2194                var rec = sels[0];
2195                
2196                
2197              
2198                Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
2199                    // apply the data to the current row, and reload the display part..
2200                
2201                });
2202                
2203                
2204                
2205            }
2206          },
2207          xns : Roo.Toolbar,
2208          '|xns' : 'Roo.Toolbar'
2209         },
2210         {
2211          xtype : 'Button',
2212          text : _this._strings['d10e7195b9d5009f7b8e6bb25a099e84'] /* Add Attachment / Patch */,
2213          listeners : {
2214           click : function (_self, e)
2215            {
2216                  var sels = _this.grid.getSelectionModel().getSelections();
2217                if (!sels || sels.length > 1) {
2218                    Roo.MessageBox.alert("Error", "Select a ticket");
2219                    return;
2220                }
2221                var rec = sels[0];
2222                
2223                Pman.Dialog.Image.show( {
2224                         onid : rec.data.id,
2225                         ontable : 'mtrack_ticket'
2226                     } ,
2227                     function(res) {
2228                         // update the body part..
2229                
2230                    }
2231                );
2232                
2233                
2234                
2235                
2236            }
2237          },
2238          xns : Roo.Toolbar,
2239          '|xns' : 'Roo.Toolbar'
2240         },
2241         {
2242          xtype : 'Button',
2243          text : _this._strings['b26917587d98330d93f87808fc9d7267'] /* Subscribe */,
2244          xns : Roo.Toolbar,
2245          '|xns' : 'Roo.Toolbar'
2246         }
2247        ]
2248       }
2249      },
2250      {
2251       xtype : 'ContentPanel',
2252       region : 'south',
2253       xns : Roo,
2254       '|xns' : 'Roo',
2255       toolbar : {
2256        xtype : 'Toolbar',
2257        xns : Roo,
2258        '|xns' : 'Roo',
2259        items  : [
2260         {
2261          xtype : 'Button',
2262          text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
2263          listeners : {
2264           click : function (_self, e)
2265            {
2266               if (!_this.form.findField('status').getValue()) {
2267                    Roo.MessageBox.alert("Error", "Fill in the new status");
2268                    return;
2269                }
2270                
2271               
2272                _this.form.submit();
2273            }
2274          },
2275          xns : Roo.Toolbar,
2276          '|xns' : 'Roo.Toolbar'
2277         },
2278         {
2279          xtype : 'Fill',
2280          xns : Roo.Toolbar,
2281          '|xns' : 'Roo.Toolbar'
2282         },
2283         {
2284          xtype : 'Button',
2285          text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
2286          listeners : {
2287           click : function (_self, e)
2288            {
2289                _this.form.reset();
2290                _this.panel.layout.getRegion('south').hide();
2291                _this.panel.layout.getRegion('north').show();
2292                _this.panel.layout.getRegion('north').expand();
2293            }
2294          },
2295          xns : Roo.Toolbar,
2296          '|xns' : 'Roo.Toolbar'
2297         }
2298        ]
2299       },
2300       items  : [
2301        {
2302         xtype : 'Form',
2303         method : 'POST',
2304         style : 'margin:10px;',
2305         url : baseURL + '/Roo/mtrack_ticket.php',
2306         listeners : {
2307          actioncomplete : function(_self,action)
2308           {
2309               if (action.type == 'setdata') {
2310                  //_this.dialog.el.mask("Loading");
2311                  //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
2312                  return;
2313               }
2314               if (action.type == 'load') {
2315            
2316                   return;
2317               }
2318               if (action.type =='submit') {
2319               
2320                    // refresh body..
2321                   
2322                    
2323                    var sm = _this.grid.getSelectionModel();
2324           
2325                   sm.fireEvent('afterselectionchange', sm);
2326           
2327                     
2328                    // hide stuff.
2329           
2330                    _this.panel.layout.getRegion('south').hide();
2331                    _this.panel.layout.getRegion('north').show();
2332                    _this.panel.layout.getRegion('north').expand();
2333                    
2334                    _this.form.reset();
2335                    return;
2336               }
2337           },
2338          rendered : function (form)
2339           {
2340               _this.form= form;
2341           }
2342         },
2343         xns : Roo.form,
2344         '|xns' : 'Roo.form',
2345         items  : [
2346          {
2347           xtype : 'Row',
2348           width : 900,
2349           xns : Roo.form,
2350           '|xns' : 'Roo.form',
2351           items  : [
2352            {
2353             xtype : 'Column',
2354             labelAlign : 'top',
2355             width : 500,
2356             xns : Roo.form,
2357             '|xns' : 'Roo.form',
2358             items  : [
2359              {
2360               xtype : 'TextArea',
2361               fieldLabel : _this._strings['ef6703d6c606526cece4a9eda9d49045'] /* Your comment */,
2362               height : 100,
2363               name : 'reason',
2364               width : 400,
2365               xns : Roo.form,
2366               '|xns' : 'Roo.form'
2367              }
2368             ]
2369            },
2370            {
2371             xtype : 'Column',
2372             labelAlign : 'right',
2373             labelWidth : 160,
2374             width : 400,
2375             xns : Roo.form,
2376             '|xns' : 'Roo.form',
2377             items  : [
2378              {
2379               xtype : 'ComboBox',
2380               allowBlank : true,
2381               alwaysQuery : true,
2382               displayField : 'name',
2383               editable : false,
2384               emptyText : _this._strings['7e5ddb4ca31c30e778f4d9c57b9577b1'] /* Change Status */,
2385               fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
2386               forceSelection : true,
2387               hiddenName : 'status',
2388               listWidth : 300,
2389               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2390               minChars : 2,
2391               name : 'status_name',
2392               qtip : _this._strings['7e5ddb4ca31c30e778f4d9c57b9577b1'] /* Change Status */,
2393               queryParam : 'query[name]',
2394               selectOnFocus : true,
2395               tpl : '<div class=\"x-combo-list-item \">{display_name_mixed} </div>',
2396               triggerAction : 'all',
2397               typeAhead : true,
2398               valueField : 'id',
2399               width : 200,
2400               xns : Roo.form,
2401               '|xns' : 'Roo.form',
2402               store : {
2403                xtype : 'Store',
2404                remoteSort : true,
2405                sortInfo : { direction : 'ASC', field: 'id' },
2406                listeners : {
2407                 beforeload : function (_self, o){
2408                      o.params = o.params || {};
2409                      // set more here
2410                      o.params['query[ticket_change]'] = _this.form.findField('id').getValue();
2411                  },
2412                 load : function (_self, records, options)
2413                  {
2414                      var cs = _this.grid.getSelectionModel().getSelectedCell();
2415                      var status  = _this.grid.ds.getAt(cs[0]).data.status;
2416                      
2417                      Roo.each(records, function(r) {
2418                          
2419                          if (r.data.id == status) {
2420                              r.set('name', "No Change");
2421                              return;
2422                          }
2423                          
2424                          // me... ??
2425                          
2426                          // 
2427                          if (r.data.etype == 'resolution') {
2428                              r.set('name',   "Close as " + r.data.name);
2429                              return;
2430                          }
2431                          r.set('name',  'Change to ' + r.data.name);
2432                      });
2433                  }
2434                },
2435                xns : Roo.data,
2436                '|xns' : 'Roo.data',
2437                proxy : {
2438                 xtype : 'HttpProxy',
2439                 method : 'GET',
2440                 url : baseURL + '/Roo/Mtrack_ticket.php',
2441                 xns : Roo.data,
2442                 '|xns' : 'Roo.data'
2443                },
2444                reader : {
2445                 xtype : 'JsonReader',
2446                 fields : [{"name":"id","type":"int"},{"name":"display_name_mixed","type":"string"}, 'name'],
2447                 id : 'id',
2448                 root : 'data',
2449                 totalProperty : 'total',
2450                 xns : Roo.data,
2451                 '|xns' : 'Roo.data'
2452                }
2453               }
2454              },
2455              {
2456               xtype : 'ComboBox',
2457               allowBlank : true,
2458               alwaysQuery : true,
2459               displayField : 'name',
2460               editable : false,
2461               emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
2462               fieldLabel : _this._strings['a3edc4e7beafdcd450f339ec414b7508'] /* Developer / Action Required By */,
2463               forceSelection : true,
2464               hiddenName : 'developer_id',
2465               listWidth : 400,
2466               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2467               minChars : 2,
2468               name : 'developer_id_name',
2469               qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
2470               queryParam : 'query[name]',
2471               selectOnFocus : true,
2472               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt;</div>',
2473               triggerAction : 'all',
2474               typeAhead : true,
2475               valueField : 'id',
2476               width : 200,
2477               xns : Roo.form,
2478               '|xns' : 'Roo.form',
2479               store : {
2480                xtype : 'Store',
2481                remoteSort : true,
2482                sortInfo : { direction : 'ASC', field: 'name' },
2483                listeners : {
2484                 beforeload : function (_self, o){
2485                      o.params = o.params || {};
2486                      // set more here
2487                      o.params['query[ticket_id]'] =_this.grid.sm.getSelected().data.id;
2488                      
2489                      o.params['query[project_id]']= _this.grid.sm.getSelected().data.project_id;
2490                      o.params._anyrole = 1;
2491                      
2492                      o.params.limit = 999;
2493                  }
2494                },
2495                xns : Roo.data,
2496                '|xns' : 'Roo.data',
2497                proxy : {
2498                 xtype : 'HttpProxy',
2499                 method : 'GET',
2500                 url : baseURL + '/Roo/core_person.php',
2501                 xns : Roo.data,
2502                 '|xns' : 'Roo.data'
2503                },
2504                reader : {
2505                 xtype : 'JsonReader',
2506                 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
2507                 id : 'id',
2508                 root : 'data',
2509                 totalProperty : 'total',
2510                 xns : Roo.data,
2511                 '|xns' : 'Roo.data'
2512                }
2513               }
2514              }
2515             ]
2516            }
2517           ]
2518          },
2519          {
2520           xtype : 'Hidden',
2521           name : 'id',
2522           xns : Roo.form,
2523           '|xns' : 'Roo.form'
2524          }
2525         ]
2526        }
2527       ]
2528      }
2529     ]
2530    }
2531   };  }
2532 });