php warnings
[Pman.MTrack] / Pman.Tab.MTrackTicket.js
index f3d116c..f2c647b 100644 (file)
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.MTrackTicket = new Roo.XComponent({
-    part     :  ["MTrack","Ticket"],
-    order    : '001-Pman.Tab.MTrackTicket',
-    region   : 'center',
-    parent   : 'Pman.Tab.DocumentsTab',
-    name     : "MTrackWeb.Ticket",
-    disabled : false, 
-    permname : '', 
-    _tree : function()
-    {
-        var _this = this;
-        var MODULE = this;
-        return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            listeners : {
-                activate : function (_self)
-                {
-                    _this.panel = _self;
-                    (function () {
-                        if (_this.tpanel) {
-                            _this.panel.layout.getRegion('south').hide();
-                            //_this.panel.layout.getRegion('north').hide();
-                        }
-                    }).defer(100);
+
+ _strings : {
+  '340c2ee497b85d5954b01c64de7f44f6' :"Select Person ",
+  'b9dd47d69178dbf735bfcd2733fd4ea6' :"Add Comment / Update",
+  '290612199861c31d1036b185b4e69b75' :"Summary",
+  '8a223eb0008a86f053b2a7eac0fa6eac' :"Select priority",
+  '04720e14ddfde3154a120fdd0ae73d19' :"Action Required By",
+  'ef6703d6c606526cece4a9eda9d49045' :"Your comment",
+  'c76a5e84e4bdee527e274ea30c680d79' :"active",
+  '502996d9790340c5fd7b86a5b93b1c9f' :"Priority",
+  '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' :"Person ",
+  '5c9335b28e6277ddbe0137f04e5e58a7' :"Classification",
+  '7e5ddb4ca31c30e778f4d9c57b9577b1' :"Change Status",
+  '1fd968087e03faeb2e87df1e9849d983' :"Spent",
+  '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+  'b6f4a2ec6356bbd56d49f2096bf9d3d3' :"Owner",
+  '672caf27f5363dc833bda5099775e891' :"Developer",
+  '6a7e73161603d87b26a8eac49dab0a9c' :"Hours",
+  'ff0a3b7f3daef040faf89a88fdac01b7' :"Updated",
+  '340c2ee497b85d5954b01c64de7f44f6' :"Select Person",
+  'b1550c2a1a5eb0d078d92eef8a0ef883' :"ID#",
+  '9e727fdd3aec8274f46685441900280d' :"Project",
+  'ec53a8c4f07baed5d8825072c89799be' :"Status",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'a3edc4e7beafdcd450f339ec414b7508' :"Developer / Action Required By",
+  'c1c694bd849d91d0eb34bfef8c2d8894' :"Tickets",
+  'a5ffb2a210f259195a75e5abca8db4a2' :"Select mtrack_milestone",
+  '3efbc55730fd4af147b96183d8afbd3b' :"mtrack_ticket",
+  'a3a1edf91a3157dad9417dedb4af500d' :"Add New Ticket",
+  'df25de42c84837baf5fa15049a8bc764' :"View:",
+  '423570be9f14a39fe88384797ee376fd' :"Select severity",
+  '5bf7a37a56bdea44d9b2b69201e91fbd' :"Edit original ticket",
+  'd10e7195b9d5009f7b8e6bb25a099e84' :"Add Attachment / Patch",
+  'e9c626b8a8b62de7562dfbf51a576ae5' :"Milestone",
+  'b26917587d98330d93f87808fc9d7267' :"Subscribe",
+  'f691f042a559b1c1a4f89826c6f75760' :"Resolved",
+  '007cc9547ae8884ad597cd92ba505422' :"Severity",
+  'c9cc8cce247e49bae79f15173ce97354' :"Save",
+  '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel",
+  '887950755a62e33c26209bdcbdc1d3d3' :"Bulk Change",
+  '7025046a3448dfea367705b884148992' :"Select classification"
+ },
+ _named_strings : {
+  'priority_id_name_qtip' : '8a223eb0008a86f053b2a7eac0fa6eac' /* Select priority */ ,
+  'severity_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'developer_id_emptyText' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
+  'developer_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'status_name_emptyText' : '7e5ddb4ca31c30e778f4d9c57b9577b1' /* Change Status */ ,
+  'severity_id_name_emptyText' : '423570be9f14a39fe88384797ee376fd' /* Select severity */ ,
+  'classification_id_name_emptyText' : '7025046a3448dfea367705b884148992' /* Select classification */ ,
+  'status_name_fieldLabel' : 'ec53a8c4f07baed5d8825072c89799be' /* Status */ ,
+  'developer_id_qtip' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
+  'developer_id_name_emptyText' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
+  'classification_id_name_qtip' : '7025046a3448dfea367705b884148992' /* Select classification */ ,
+  'developer_id_fieldLabel' : '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' /* Person  */ ,
+  'developer_id_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'cm_status_name_value' : 'c76a5e84e4bdee527e274ea30c680d79' /* active */ ,
+  'milestone_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'priority_id_name_emptyText' : '8a223eb0008a86f053b2a7eac0fa6eac' /* Select priority */ ,
+  'status_name_qtip' : '7e5ddb4ca31c30e778f4d9c57b9577b1' /* Change Status */ ,
+  'status_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'milestone_id_name_emptyText' : 'a5ffb2a210f259195a75e5abca8db4a2' /* Select mtrack_milestone */ ,
+  'developer_id_name_qtip' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
+  'reason_fieldLabel' : 'ef6703d6c606526cece4a9eda9d49045' /* Your comment */ ,
+  'cm_status_name_fieldLabel' : 'ec53a8c4f07baed5d8825072c89799be' /* Status */ ,
+  'priority_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'milestone_id_name_qtip' : 'a5ffb2a210f259195a75e5abca8db4a2' /* Select mtrack_milestone */ ,
+  'developer_id_name_fieldLabel' : 'a3edc4e7beafdcd450f339ec414b7508' /* Developer / Action Required By */ ,
+  'severity_id_name_qtip' : '423570be9f14a39fe88384797ee376fd' /* Select severity */ ,
+  'classification_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ 
+ },
+
+  part     :  ["MTrack", "Ticket" ],
+  order    : '001-Pman.Tab.MTrackTicket',
+  region   : 'center',
+  parent   : 'Pman.Tab.DocumentsTab',
+  name     : "MTrackWeb.Ticket",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'NestedLayoutPanel',
+   background : true,
+   fitContainer : true,
+   fitToFrame : true,
+   region : 'center',
+   title : _this._strings['c1c694bd849d91d0eb34bfef8c2d8894'] /* Tickets */,
+   listeners : {
+    activate : function (_self)
+     {
+         _this.panel = _self;
+         (function () {
+             if (_this.tpanel) {
+                 _this.panel.layout.getRegion('south').hide();
+                 //_this.panel.layout.getRegion('north').hide();
+             }
+         }).defer(100);
+         try {
+             if (!_this.url || !_this.project || (_this.project != MTrack.projectCombo.getValue())) {
+                 (function() { 
+                     if (_this.tpanel) { 
+                      //   _this.tpanel.mload("/Report/1"); 
+                     }
+                 }).defer(300);
+             }
+             
+             
+         } catch(e) {Roo.log("activate fail" + e.toString()); }
+     }
+   },
+   xns : Roo,
+   '|xns' : 'Roo',
+   layout : {
+    xtype : 'BorderLayout',
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     tabPosition : 'top',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    south : {
+     xtype : 'LayoutRegion',
+     height : 170,
+     split : true,
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    north : {
+     xtype : 'LayoutRegion',
+     collapsible : true,
+     height : 300,
+     split : true,
+     tabPosition : 'top',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    items  : [
+     {
+      xtype : 'GridPanel',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'north',
+      tableName : 'mtrack_ticket',
+      title : _this._strings['3efbc55730fd4af147b96183d8afbd3b'] /* mtrack_ticket */,
+      listeners : {
+       activate : function() {
+            _this.gpanel = this;
+            if (_this.grid) {
+                _this.grid.ds.load({});
+            }
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      grid : {
+       xtype : 'EditorGrid',
+       autoExpandColumn : 'summary',
+       clicksToEdit : 1,
+       ddGroup : 'mtrack_ticket',
+       enableDragDrop : true,
+       getProjectId : function() {
+       
+             if (typeof(MTrack) != 'undefined') {
+               return  MTrack.projectCombo.getValue();
+             }
+             
+           //       project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
+           //      project_id_name : _this.grid.getProjectId(), //MTrack.projectCombo.el.dom.value,
+         
+         
+        
+           try {
+                var pr = Pman.Tab.Projects; // shuld be documentsProjects
+                if (!pr || !pr.grid) {
+                   return false;
+               }
+           } catch (e) {
+               return false;
+           }
+           var sels = pr.grid.getSelectionModel().getSelections();
+           var prids = [];
+           if (sels.length) {
+               Roo.each(sels,function(s) {
+                   prids.push(s.data.id);
+                });
+                // multi support later..
+               return   prids[0];
+            }
+            
+           
+            
+           return 0;
+         
+         
+       },
+       getProjectName : function() {
+            //  project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
+             
+             if (typeof(MTrack) != 'undefined') {
+             
+               return MTrack.projectCombo.el.dom.value;
+             }
+               
+               
+             
+           try {
+                var pr = Pman.Tab.Projects; // shuld be documentsProjects
+                if (!pr || !pr.grid) {
+                   return false;
+               }
+           } catch (e) {
+               return false;
+           }
+           var sels = pr.grid.getSelectionModel().getSelections();
+           var prids = [];
+           if (sels.length) {
+               Roo.each(sels,function(s) {
+                   prids.push(s.data.name);
+                });
+                // multi support later..
+               return   prids[0];
+            }
+            
+           
+            
+           return '';  
+       },
+       loadMask : true,
+       listeners : {
+        afteredit : function (e)
+         {
+             Roo.log(e);
+             e.record.commit();
+         },
+        celldblclick : function (_self, rowIndex, columnIndex, e)
+         {
+              var c = _this.grid.colModel.getDataIndex(columnIndex);
+             
+             
+             if (c.match(/_id$/) ) {
+                 return;
+             }
+             var rec = _this.grid.ds.getAt(rowIndex);
+             Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
+                 // update row, and re-render..
+             
+             });
+             
+             
+         },
+        render : function() 
+         {
+             _this.grid = this; 
+             _this.panel.grid = this; // works with doc manager...
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.gpanel.active) {
+                _this.grid.ds.load({});
+             }
+         }
+       },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       toolbar : {
+        xtype : 'Toolbar',
+        xns : Roo,
+        '|xns' : 'Roo',
+        items  : [
+         {
+          xtype : 'Button',
+          text : _this._strings['a3a1edf91a3157dad9417dedb4af500d'] /* Add New Ticket */,
+          listeners : {
+           click : function (_self, e)
+            {
+              Pman.Dialog.MTrackTicket.show({
+                    project_id :  Pman.Tab.DocumentsTab.panel.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
+                    project_id_name : Pman.Tab.DocumentsTab.panel.getProjectName(), //MTrack.projectCombo.el.dom.value,
+                    owner_id : Pman.Login.authUser.id,
+                    owner_id_name : Pman.Login.authUser.name
+            
+              }, function() { 
+                _this.grid.ds.load({}); 
+                });
+                
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
+          listeners : {
+           click : function (_self, e)
+            {
+                params =    {};
+                params.project_id =  Pman.Tab.DocumentsTab.panel.getProjectId(); // testing.
+                params.limit = 999;
+                // columns...
+                params['query[viewtype]'] = 'active';
+                
+                for (var k in _this.filterBtn) {
+                    if (_this.filterBtn[k].pressed) {
+                        params['query[viewtype]'] = k;
+                    }
+                }
+                var ii =0;
+                params['csvCols['+ii+']'] = 'jira_ref';
+                params['csvTitles['+ii+']'] = "Jira ID";
+                ii++;
+                
+                Roo.each(_this.grid.colModel.config, function(c,i) {
+                    params['csvCols['+ii+']'] = c.dataIndex;
+                    params['csvTitles['+ii+']'] = c.header;
                     try {
-                        if (!_this.url || !_this.project || (_this.project != MTrack.projectCombo.getValue())) {
-                            (function() { 
-                                if (_this.tpanel) { 
-                                 //   _this.tpanel.mload("/Report/1"); 
-                                }
-                            }).defer(300);
+                        if (typeof( c.editor.field.name) != 'undefined') {
+                            params['csvCols['+ii+']'] = c.editor.field.name;
                         }
-                        
-                        
-                    } catch(e) {Roo.log("activate fail" + e.toString()); }
+                    } catch(e) {}
+                    ii++;
+                });
+                
+                params['csvCols['+ii+']'] = 'description';
+                params['csvTitles['+ii+']'] = "Details";
+                    
+                
+            
+                    
+               
+                new Pman.Download({
+                    url: baseURL + '/Roo/mtrack_ticket',
+                    method: 'GET' ,
+                    params: params
+                    
+                });
+                
+                    
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          text : _this._strings['887950755a62e33c26209bdcbdc1d3d3'] /* Bulk Change */,
+          listeners : {
+           click : function (_self, e)
+            {
+                var sels = _this.grid.selModel.getSelections();
+            
+                var pid = 0;
+                var ids = [];
+                Roo.each(sels, function(s) {
+                    ids.push(s.data.id);
+                    if (pid && s.data.project_id != pid) {
+                        pid = -1;
+                        return false;
+                    }
+                    pid = s.data.project_id ;
+                    
+                });
+                if (pid < 1) {
+                    Roo.MessageBox.alert("Error", "selected tickets must be of the same project");
+                    return;
                 }
-            },
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "Tickets",
-            layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
-                items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.gpanel = this;
-                                if (_this.grid) {
-                                    _this.grid.ds.load({});
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'north',
-                        tableName : 'mtrack_ticket',
-                        title : "mtrack_ticket",
-                        grid : {
-                            xtype: 'EditorGrid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    _this.panel.grid = this; // works with doc manager...
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.gpanel.active) {
-                                       _this.grid.ds.load({});
-                                    }
-                                },
-                                afteredit : function (e)
-                                {
-                                    Roo.log(e);
-                                    e.record.commit();
-                                },
-                                celldblclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                     var c = _this.grid.colModel.getDataIndex(columnIndex);
-                                    
-                                    
-                                    if (c.match(/_id$/) ) {
-                                        return;
-                                    }
-                                    var rec = _this.grid.ds.getAt(rowIndex);
-                                    Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
-                                        // update row, and re-render..
-                                    
-                                    });
-                                    
-                                    
-                                }
-                            },
-                            autoExpandColumn : 'summary',
-                            clicksToEdit : 1,
-                            ddGroup : 'mtrack_ticket',
-                            enableDragDrop : true,
-                            loadMask : true,
-                            getProjectId : function() {
+                
+                // permission based?
+                
+                Pman.Dialog.MTrackBulkChange.show({
+                    project_id : sels[0].data.project_id,
+                    project_id_name : sels[0].data.project_id_name,
+                    ids : ids.join(',')
+                }, function(res) {
+                    Roo.log(res);
+                    var tks = {};
+                    
+                    Roo.each(res.data, function(d) {
+                        tks[d.id*1] = d;
+                    });
+                    
+                    Roo.each(sels, function(sel) {
+                        var record = _this.grid.ds.getById(sel.data.id);
+                        record.modified = record.modified || {};
+            
+                        Roo.log(tks[record.data.id*1]);
+                        
+                        for (var k in tks[record.data.id*1]) {
+                            // update the 
                             
-                                  if (typeof(MTrack) != 'undefined') {
-                                    return  MTrack.projectCombo.getValue();
-                                  }
-                                  
-                                //       project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
-                                //      project_id_name : _this.grid.getProjectId(), //MTrack.projectCombo.el.dom.value,
-                              
-                              
-                             
-                                try {
-                                     var pr = Pman.Tab.Projects; // shuld be documentsProjects
-                                     if (!pr || !pr.grid) {
-                                        return false;
-                                    }
-                                } catch (e) {
-                                    return false;
-                                }
-                                var sels = pr.grid.getSelectionModel().getSelections();
-                                var prids = [];
-                                if (sels.length) {
-                                    Roo.each(sels,function(s) {
-                                        prids.push(s.data.id);
-                                     });
-                                     // multi support later..
-                                    return   prids[0];
-                                 }
-                                 
-                                
-                                 
-                                return 0;
-                              
-                              
-                            },
-                            getProjectName : function() {
-                                 //  project_id :  _this.grid.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
-                                  
-                                  if (typeof(MTrack) != 'undefined') {
-                                  
-                                    return MTrack.projectCombo.el.dom.value;
-                                  }
-                                    
-                                    
-                                  
-                                try {
-                                     var pr = Pman.Tab.Projects; // shuld be documentsProjects
-                                     if (!pr || !pr.grid) {
-                                        return false;
-                                    }
-                                } catch (e) {
-                                    return false;
-                                }
-                                var sels = pr.grid.getSelectionModel().getSelections();
-                                var prids = [];
-                                if (sels.length) {
-                                    Roo.each(sels,function(s) {
-                                        prids.push(s.data.name);
-                                     });
-                                     // multi support later..
-                                    return   prids[0];
-                                 }
-                                 
-                                
-                                 
-                                return '';  
-                            },
-                            sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
-                                listeners : {
-                                    cellselect : function (_self, rowIndex, colIndex)
-                                    {
-                                        return false;
-                                        var rec = _this.grid.ds.getAt(rowIndex);
-                                        
-                                        // verify nothing has chagned.. 
-                                         
-                                        // load the ticked, and render a view of it...
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/mtrack_ticket',
-                                            method : 'GET',
-                                            params : { 
-                                                _id : rec.data.id
-                                            },
-                                            success : function(res) {
-                                                //Roo.log(res.data);
-                                                // render it into a template..
-                                                _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
-                                                _this.tpanel.el.scrollTo('top',0);
-                                                 
-                                                //... ehh
-                                                 Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
-                                             
-                                                
-                                               
-                                                new Pman.Request({
-                                                    url : baseURL + '/Roo/Images',
-                                                    method : 'GET',
-                                                    params : { 
-                                                        onid : rec.data.id,
-                                                        ontable : 'mtrack_ticket'
-                                                    },
-                                                    success : function(ares) {
-                                                        Roo.log(ares.data);
-                                                        var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
-                                                        // fill in the attachement area with data from this..
-                                                        el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
-                                                    }
-                                                });
-                                                 
-                                                
-                                                _this.form.reset();
-                                    
-                                                _this.form.setValues({
-                                                    id : rec.data.id,
-                                                    owner_id : rec.data.owner_id,
-                                                    owner_id_name : rec.data.owner_id_name,
-                                                    status : rec.data.status,
-                                                    status_name : "No Change"
-                                                }); 
-                                                
-                                                
-                                                for(var k in res.data) {
-                                                    rec.set(k,res.data[k]);
-                                                }
-                                                
-                                            }
-                                        });
-                                            
-                                        
-                                        
-                                    },
-                                    afterselectionchange : function (_self, rowIndex, colIndex)
-                                    {
-                                        
-                                        var   sels =   _this.grid.selModel.getSelections();
-                                        
-                                        if (!sels || sels.length > 1) {
-                                        
-                                            return;
-                                        }
-                                        
-                                        var rec = sels[0];
-                                        
-                                        // verify nothing has chagned.. 
-                                         
-                                        // load the ticked, and render a view of it...
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/mtrack_ticket',
-                                            method : 'GET',
-                                            params : { 
-                                                _id : rec.data.id
-                                            },
-                                            success : function(res) {
-                                                //Roo.log(res.data);
-                                                // render it into a template..
-                                                _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
-                                                _this.tpanel.el.scrollTo('top',0);
-                                                 
-                                                //... ehh
-                                                 Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
-                                             
-                                                
-                                               
-                                                new Pman.Request({
-                                                    url : baseURL + '/Roo/Images',
-                                                    method : 'GET',
-                                                    params : { 
-                                                        onid : rec.data.id,
-                                                        ontable : 'mtrack_ticket'
-                                                    },
-                                                    success : function(ares) {
-                                                        Roo.log(ares.data);
-                                                        var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
-                                                        // fill in the attachement area with data from this..
-                                                        el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
-                                                    }
-                                                });
-                                                 
-                                                
-                                                _this.form.reset();
-                                    
-                                                _this.form.setValues({
-                                                    id : rec.data.id,
-                                                    owner_id : rec.data.owner_id,
-                                                    owner_id_name : rec.data.owner_id_name,
-                                                    status : rec.data.status,
-                                                    status_name : "No Change"
-                                                }); 
-                                                
-                                                
-                                                for(var k in res.data) {
-                                                    rec.set(k,res.data[k]);
-                                                }
-                                                
-                                            }
-                                        });
-                                            
-                                        
-                                        
-                                    }
-                                }
-                            },
-                            dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, options)
-                                    {
-                                        
-                                       if (Pman.building) { return false; }
-                                        options.params =     options.params || {};
-                                        options.params['query[search]'] = _this.searchBox.getValue();
-                                        var sq =        options.params['query[viewtype]'] = _this.status.getValue(); 
-                                        var pc = false;
-                                        var ps = false;
-                                        try {
-                                             pc = _this.grid.colModel.getIndexByDataIndex('project_id_name');
-                                            
-                                        } catch(e) {} 
-                                        
-                                    
-                                        if (!options.params['query[search]'].length || isNaN(options.params['query[search]'])) {
-                                                
-                                            
-                                            ps = _this.personSel.getValue();
-                                            ps = ps ? ps : 0;
-                                            if (ps ) {
-                                                options.params.developer_id = ps <0 ? 0 : ps;
-                                            }
-                                    
-                                             
-                                            
-                                            
-                                            try { 
-                                                options.params.project_id  = Pman.Tab.DocumentsTab.panel.getProjectId();
-                                            } catch(e) {
-                                                options.params.project_id  = MTrack.projectCombo.getValue();
-                                            }
-                                            options.params.project_id =      options.params.project_id || undefined;
-                                         }
-                                         
-                                    
-                                             
-                                               
-                                        if (  ps < 1 && pc !== false) {
-                                            _this.grid.colModel.setHidden(pc, true);
-                                            
-                                        }
-                                        
-                                        // project column
-                                        if (pc!== false) {
-                                             _this.grid.colModel.setHidden(pc, true);
-                                         }
-                                         
-                                        if (pc !== false && !options.params.project_id) {
-                                    
-                                             _this.grid.colModel.setHidden(pc, false);       
-                                    
-                                        }
-                                    
-                                        options.params.limit = 999;
-                                        // columns...
-                                    
-                                        
-                                        
-                                    },
-                                    update : function (_self, record, operation)
-                                    {
-                                        Roo.log('update: ' + JSON.stringify(operation));
-                                        if (operation != 'commit') {
-                                            return;
-                                        }
-                                        // send things that might change..
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/mtrack_ticket',
-                                            method : 'POST',
-                                            params : {
-                                                id : record.data.id,
-                                                milestone_id : record.data.milestone_id,
-                                                priority_id : record.data.priority_id,
-                                                severity_id : record.data.severity_id,
-                                                classification_id : record.data.classification_id,
-                                                estimated : record.data.estimated,
-                                                developer_id : record.data.developer_id
-                                            },
-                                            success : function(res)
-                                            {
-                                                var r = res.data;
-                                                //Roo.log(r);
-                                                // do nothing?
-                                                record.modified = record.modified || {};
-                                                for (var k in r) {
-                                                    // update the 
-                                                    if (!k.match(/_id$/) && !k.match(/_id_/)) {
-                                                        continue;
-                                                    }
-                                                    record.data[k] = r[k];
-                                                    record.modified[k] = r[k];
-                                                }
-                                                record.store.afterEdit(record);
-                                            }
-                                            // we should really have a failure - to reset to the old value.
-                                        });
-                                         
-                                        
-                                        
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'summary', direction: 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Roo/mtrack_ticket.php'
-                                },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    totalProperty : 'total',
-                                    root : 'data',
-                                    id : 'id',
-                                    fields : [
-                                        {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'summary',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'description',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'changelog',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'created',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'updated',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'priority_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'severity_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'classification_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'resolution_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'cc',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'status',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'estimated',
-                                            'type': 'float'
-                                        },
-                                        {
-                                            'name': 'spent',
-                                            'type': 'float'
-                                        },
-                                        {
-                                            'name': 'x_fieldname',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'updated_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'updated_person_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'updated_ontable',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'updated_onid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'updated_changedate',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'updated_reason',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'created_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'created_person_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'created_ontable',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'created_onid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'created_changedate',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'created_reason',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_deleted_dt',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'developer_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'developer_id_project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'developer_id_deleted_dt',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'priority_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'priority_id_etype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'priority_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'priority_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'priority_id_seqid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'severity_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'severity_id_etype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'severity_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'severity_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'severity_id_seqid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'classification_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'classification_id_etype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'classification_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'classification_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'classification_id_seqid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'resolution_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'resolution_id_etype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'resolution_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'resolution_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'resolution_id_seqid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'status_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'status_etype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'status_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'status_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'status_seqid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_code',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_client_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_team_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_file_location',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_open_date',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'project_id_open_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_close_date',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'project_id_countries',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_languages',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_agency_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'milestone_id_description',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'milestone_id_startdate',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'milestone_id_duedate',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'milestone_id_completed',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'milestone_id_deleted',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id_created',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id_updated',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'milestone_id_project_id',
-                                            'type': 'int'
-                                        }
-                                    ]
-                                }
-                            },
-                            toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
-                                items : [
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                              Pman.Dialog.MTrackTicket.show({
-                                                    project_id :  Pman.Tab.DocumentsTab.panel.getProjectId(), //MTrack.projectCombo ? MTrack.projectCombo.getValue() :2830 , // testing.
-                                                    project_id_name : Pman.Tab.DocumentsTab.panel.getProjectName(), //MTrack.projectCombo.el.dom.value,
-                                                    owner_id : Pman.Login.authUser.id,
-                                                    owner_id_name : Pman.Login.authUser.name
-                                            
-                                              }, function() { 
-                                                _this.grid.ds.load({}); 
-                                                });
-                                                
-                                            }
-                                        },
-                                        text : "Add New Ticket"
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                params =    {};
-                                                params.project_id =  Pman.Tab.DocumentsTab.panel.getProjectId(); // testing.
-                                                params.limit = 999;
-                                                // columns...
-                                                params['query[viewtype]'] = 'active'
-                                                
-                                                for (var k in _this.filterBtn) {
-                                                    if (_this.filterBtn[k].pressed) {
-                                                        params['query[viewtype]'] = k;
-                                                    }
-                                                }
-                                                var ii =0;
-                                                params['csvCols['+ii+']'] = 'jira_ref';
-                                                params['csvTitles['+ii+']'] = "Jira ID";
-                                                ii++;
-                                                
-                                                Roo.each(_this.grid.colModel.config, function(c,i) {
-                                                    params['csvCols['+ii+']'] = c.dataIndex;
-                                                    params['csvTitles['+ii+']'] = c.header;
-                                                    try {
-                                                        if (typeof( c.editor.field.name) != 'undefined') {
-                                                            params['csvCols['+ii+']'] = c.editor.field.name;
-                                                        }
-                                                    } catch(e) {}
-                                                    ii++;
-                                                });
-                                                
-                                                params['csvCols['+ii+']'] = 'description';
-                                                params['csvTitles['+ii+']'] = "Details";
-                                                    
-                                                
-                                            
-                                                    
-                                               
-                                                new Pman.Download({
-                                                    url: baseURL + '/Roo/mtrack_ticket',
-                                                    method: 'GET' ,
-                                                    params: params
-                                                    
-                                                });
-                                                
-                                                    
-                                            }
-                                        },
-                                        text : "Download to Excel"
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                var sels = _this.grid.selModel.getSelections()
-                                            
-                                                var pid = 0;
-                                                var ids = [];
-                                                Roo.each(sels, function(s) {
-                                                    ids.push(s.data.id);
-                                                    if (pid && s.data.project_id != pid) {
-                                                        pid = -1;
-                                                        return false;
-                                                    }
-                                                    pid = s.data.project_id ;
-                                                    
-                                                });
-                                                if (pid < 1) {
-                                                    Roo.MessageBox.alert("Error", "selected tickets must be of the same project");
-                                                    return;
-                                                }
-                                                
-                                                // permission based?
-                                                
-                                                Pman.Dialog.MTrackBulkChange.show({
-                                                    project_id : sels[0].data.project_id,
-                                                    project_id_name : sels[0].data.project_id_name,
-                                                    ids : ids.join(',')
-                                                });
-                                            
-                                                
-                                                    
-                                            }
-                                        },
-                                        text : "Bulk Change"
-                                    },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
-                                    },
-                                    {
-                                        xtype: 'TextItem',
-                                        xns: Roo.Toolbar,
-                                        text : "View:"
-                                    },
-                                    {
-                                        xtype: 'TextField',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                            _this.searchBox=  _self;
-                                            },
-                                            specialkey : function (_self, e)
-                                            {
-                                                _this.grid.ds.load({});
-                                            }
-                                        }
-                                    },
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            select : function (combo, record, index)
-                                            {
-                                              _this.grid.ds.load({});
-                                              
-                                            },
-                                            render : function (_self)
-                                            {
-                                                _this.personSel = _self;
-                                                if (Pman.Login.authUser.id) {
-                                                    this.setFromData({
-                                                        developer_id : Pman.Login.authUser.id,
-                                                        developer_id_name : Pman.Login.authUser.name
-                                                    });
-                                                
-                                                }
-                                            }
-                                        },
-                                        allowBlank : true,
-                                        displayField : 'developer_id_name',
-                                        editable : true,
-                                        emptyText : "Select Person ",
-                                        fieldLabel : 'Person ',
-                                        forceSelection : true,
-                                        hiddenName : 'developer_id',
-                                        listWidth : 600,
-                                        loadingText : "Searching...",
-                                        minChars : 2,
-                                        name : 'developer_id',
-                                        pageSize : 20,
-                                        qtip : "Select Person ",
-                                        queryParam : 'query[name]',
-                                        selectOnFocus : true,
-                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{developer_id_name}</b></div>',
-                                        triggerAction : 'all',
-                                        typeAhead : true,
-                                        valueField : 'developer_id',
-                                        width : 150,
-                                        store : {
-                                            xtype: 'Store',
-                                            xns: Roo.data,
-                                            listeners : {
-                                                beforeload : function (_self, o)
-                                                {
-                                                    o.params = o.params || {};
-                                                    o.params._distinct = 'developer_id';
-                                                    o.params._columns = 'developer_id,developer_id_name';
-                                                },
-                                                load : function (_self, records, options)
-                                                {
-                                                    Roo.log(records);
-                                                    var ua = _this.personSel.store.reader.newRow({
-                                                        developer_id : -1,
-                                                        developer_id_name : '-- Un-assigned --'
-                                                    });
-                                                    this.insert(0,[ua]);
-                                                //    records.unshift(ua);
-                                                }
-                                            },
-                                            sortInfo : { field : 'developer_id_name' , dir : 'ASC' },
-                                            proxy : {
-                                                xtype: 'HttpProxy',
-                                                xns: Roo.data,
-                                                method : 'GET',
-                                                url : baseURL + '/Roo/Mtrack_ticket.php'
-                                            },
-                                            reader : {
-                                                xtype: 'JsonReader',
-                                                xns: Roo.data,
-                                                id : 'id',
-                                                root : 'data',
-                                                totalProperty : 'total',
-                                                fields : [
-                                                    {
-                                                        'name': 'developer_id',
-                                                        'type': 'int'
-                                                    } ,
-                                                    {
-                                                        'name': 'developer_id_name',
-                                                        'type' : 'text'
-                                                    }
-                                                    
-                                                    
-                                                ]
-                                            }
-                                        }
-                                    },
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                              _this.status = _self;
-                                            },
-                                            select : function (combo, record, index)
-                                            {
-                                                Roo.log('select');
-                                                _this.grid.ds.load({});
-                                            }
-                                        },
-                                        allowBlank : false,
-                                        displayField : 'fname',
-                                        editable : false,
-                                        fieldLabel : 'Status',
-                                        hiddenName : 'cm_status',
-                                        listWidth : 200,
-                                        mode : 'local',
-                                        name : 'cm_status_name',
-                                        triggerAction : 'all',
-                                        value : "active",
-                                        valueField : 'ftype',
-                                        width : 150,
-                                        store : {
-                                            xtype: 'SimpleStore',
-                                            xns: Roo.data,
-                                            data : [ 
-                                                [ 'active', "Active"],
-                                                [ 'me' , "Assigned to me"],
-                                                [ 'me-all' , "Assigned to me (All projects)"],    
-                                                [ 'closed' , "Closed"],
-                                                [ 'pending' , "Pending Review / Resolved"],
-                                                [ 'in-progress' , "In Progress"],
-                                                [ 'all' , "All States"]
-                                                 
-                                            ],
-                                            fields : [  'ftype', 'fname']
-                                        }
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.grid.ds.load({});
-                                            }
-                                        },
-                                        cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/search.gif'
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.searchBox.setValue('');
-                                                
-                                                    _this.grid.ds.load({});
-                                            }
-                                        },
-                                        cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif'
-                                    }
-                                ]
-                            },
-                            colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'id',
-                                    header : 'ID#',
-                                    sortable : true,
-                                    width : 50,
-                                    renderer : function(v) { return String.format('#{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'project_id_name',
-                                    header : 'Project',
-                                    hidden : true,
-                                    width : 75,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'milestone_id',
-                                    header : 'Milestone',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v, x,r ) { return String.format('{0}', r.data.milestone_id_name); },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        listeners : {
-                                            complete : function (_self, value, startValue)
-                                            {
-                                              Roo.log('complete');
-                                            }
-                                        },
-                                        field : {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                select : function (combo, record, index)
-                                                {
-                                                    Roo.log('selected');
-                                                    
-                                                    (function() { 
-                                                        _this.grid.stopEditing();
-                                                    }).defer(100);
-                                                }
-                                            },
-                                            allowBlank : false,
-                                            alwaysQuery : true,
-                                            displayField : 'name',
-                                            editable : false,
-                                            emptyText : "Select mtrack_milestone",
-                                            forceSelection : true,
-                                            hiddenName : 'milestone_id',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
-                                            minChars : 2,
-                                            name : 'milestone_id_name',
-                                            pageSize : 20,
-                                            qtip : "Select mtrack_milestone",
-                                            queryParam : '',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text"><b>{name}</b> - {startdate:date("d/m/Y")} - {duedate:date("d/m/Y")} </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'id',
-                                            width : 300,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                        // set more here
-                                                       var rec =   _this.grid.activeEditor.record;
-                                                    
-                                                        o.params.project_id = rec.data.project_id;
-                                                        //o.params._viewtype = 'ACTIVE';
-                                                        o.params._viewtype
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'duedate' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/mtrack_milestone.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                }
-                                            }
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'status_name',
-                                    header : 'Status',
-                                    hidden : true,
-                                    width : 80
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'resolution_id_name',
-                                    header : 'Resolved',
-                                    hidden : true,
-                                    width : 80
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'summary',
-                                    header : 'Summary',
-                                    width : 200,
-                                    renderer : function(v,x,r) { 
-                                        
-                                        var col = '#000'; // closed?
-                                        switch (r.data.status_name) {
-                                            case 'resolved':
-                                                col = '#0cc'; break; // blue
-                                            case 'open':
-                                            case 'reopened':        
-                                            case 'new':                
-                                                col = '#c00'; break; // redish
-                                            case 'closed':                
-                                                col = '#999'; break; // grey
-                                       }
-                                        
-                                        return String.format(
-                                            r.data.status_name == 'closed'  ?
-                                                  '{2}</span><s style="color:{3}">[{1}]</s> {0}':
-                                                  '{2}<span style="color:{3}">[{1}]</span> {0}',
-                                                v,
-                                                r.data.status_name == 'closed'  ?
-                                                    r.data.resolution_id_name : 
-                                                     r.data.status_name ,
-                                                r.json.jira_ref ?  (r.json.jira_ref+ ' ')  : '',
-                                                col
-                                                ); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'owner_id_name',
-                                    header : 'Owner',
-                                    width : 75,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'developer_id',
-                                    header : 'Developer',
-                                    width : 75,
-                                    renderer : function(v,x,r) { return String.format('{0}', r.data.developer_id_name); },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                select : function (combo, record, index)
-                                                {
-                                                  
-                                                    (function() { 
-                                                        _this.grid.stopEditing();
-                                                    }).defer(100);
-                                                }
-                                            },
-                                            allowBlank : true,
-                                            alwaysQuery : true,
-                                            displayField : 'name',
-                                            editable : 'false',
-                                            emptyText : "Select Person",
-                                            fieldLabel : 'Action Required By',
-                                            forceSelection : true,
-                                            hiddenName : 'developer_id',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
-                                            minChars : 2,
-                                            name : 'developer_id_name',
-                                            qtip : "Select Person",
-                                            queryParam : 'query[name]',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> &lt;{email}&gt;</div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'id',
-                                            width : 200,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                        // set more here
-                                                       var rec =   _this.grid.activeEditor.record;
-                                                    
-                                                        
-                                                        o.params['query[ticket_id]'] = rec.data.id;
-                                                        
-                                                        o.params['query[project_id]']=  rec.data.project_id;
-                                                       o.params._anyrole = 1;
-                                                        o.params.limit = 99;
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'name' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/Person.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                }
-                                            }
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'priority_id',
-                                    header : 'Priority',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v,x,r) { 
-                                        x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.priority_id_seqid, r.data.priority_id_seqmax ); 
-                                        return String.format('{0}', r.data.priority_id_name); 
-                                        
-                                    },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        listeners : {
-                                            complete : function (_self, value, startValue)
-                                            {
-                                              Roo.log('complete');
-                                            }
-                                        },
-                                        field : {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                select : function (combo, record, index)
-                                                {
-                                                    Roo.log('selected');
-                                                    
-                                                    (function() { 
-                                                        _this.grid.stopEditing();
-                                                    }).defer(100);
-                                                }
-                                            },
-                                            allowBlank : false,
-                                            alwaysQuery : true,
-                                            displayField : 'name',
-                                            editable : false,
-                                            emptyText : "Select priority",
-                                            forceSelection : true,
-                                            hiddenName : 'priority_id',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
-                                            minChars : 2,
-                                            name : 'priority_id_name',
-                                            pageSize : 20,
-                                            qtip : "Select priority",
-                                            queryParam : '',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}"><b>{name}</b>  </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'id',
-                                            width : 300,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                       o.params.etype='priority'
-                                                        // set more here
-                                                        
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'seqid' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/core_enum.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                }
-                                            }
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'severity_id',
-                                    header : 'Severity',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v,x,r) { 
-                                        x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.severity_id_seqid, r.data.severity_id_seqmax ); 
-                                        return String.format('{0}', r.data.severity_id_name); 
-                                        },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        listeners : {
-                                            complete : function (_self, value, startValue)
-                                            {
-                                              Roo.log('complete');
-                                            }
-                                        },
-                                        field : {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                select : function (combo, record, index)
-                                                {
-                                                    Roo.log('selected');
-                                                    
-                                                    (function() { 
-                                                        _this.grid.stopEditing();
-                                                    }).defer(100);
-                                                }
-                                            },
-                                            allowBlank : false,
-                                            alwaysQuery : true,
-                                            displayField : 'name',
-                                            editable : false,
-                                            emptyText : "Select severity",
-                                            forceSelection : true,
-                                            hiddenName : 'severity_id',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
-                                            minChars : 2,
-                                            name : 'severity_id_name',
-                                            pageSize : 20,
-                                            qtip : "Select severity",
-                                            queryParam : '',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}"><b>{name}</b>  </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'id',
-                                            width : 300,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                       o.params.etype='severity'
-                                                        // set more here
-                                                        
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'seqid' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/core_enum.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                }
-                                            }
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'classification_id',
-                                    header : 'Classification',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v,x,r) { 
-                                        x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.classification_id_seqid, r.data.classification_id_seqmax ); 
-                                        return String.format('{0}', r.data.classification_id_name); 
-                                        },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        listeners : {
-                                            complete : function (_self, value, startValue)
-                                            {
-                                              Roo.log('complete');
-                                            }
-                                        },
-                                        field : {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                select : function (combo, record, index)
-                                                {
-                                                    Roo.log('selected');
-                                                    
-                                                    (function() { 
-                                                        _this.grid.stopEditing();
-                                                    }).defer(100);
-                                                }
-                                            },
-                                            allowBlank : false,
-                                            alwaysQuery : true,
-                                            displayField : 'name',
-                                            editable : false,
-                                            emptyText : "Select classification",
-                                            forceSelection : true,
-                                            hiddenName : 'classification_id',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
-                                            minChars : 2,
-                                            name : 'classification_id_name',
-                                            pageSize : 20,
-                                            qtip : "Select classification",
-                                            queryParam : '',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}"><b>{name}</b>  </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'id',
-                                            width : 300,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                       o.params.etype='classification'
-                                                        // set more here
-                                                        
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'seqid' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/core_enum.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                }
-                                            }
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'estimated',
-                                    header : 'Hours',
-                                    width : 50,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}/{1}', r.data.spent, v); 
-                                    },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'NumberField',
-                                            xns: Roo.form,
-                                            allowDecimals : true,
-                                            decimalPrecision : 1
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'spent',
-                                    header : 'Spent',
-                                    hidden : true,
-                                    width : 50,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}',v); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'updated_changedate',
-                                    header : 'Updated',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v,x,r) { 
-                                    
-                                        
-                                        var str= Date.parseDate( r.data.updated ? r.json.updated_changedate : r.json.created_changedate, 'Y-m-d H:i:s');
-                                        
-                                        
-                                        return String.format('{0}', str ? str.format('d/M/Y') : '?');
-                                     }
-                                }
-                            ],
-                            dropTarget : {
-                                xtype: 'DropTarget',
-                                xns: Roo.dd,
-                                listeners : {
-                                    over : function (source, e, data)
-                                    {
-                                    
-                                        Roo.log('over');
-                                    // if drag point == drop point...
-                                        var grid = _this.grid;
-                                           var t = Roo.lib.Event.getTarget(e); 
-                                           var ri = grid.view.findRowIndex(t);
-                                           var dp = this.getDropPoint(e,data);
-                                           Roo.log(dp);
-                                           //Roo.log(JSON.stringify({ dp: dp,  ri: ri, src_ri: data.rowIndex}));
-                                           if(ri == data.rowIndex ||
-                                                (dp == 'above' && ri-1 == data.rowIndex) ||
-                                                (dp == 'below' && ri+1 == data.rowIndex) 
-                                             ) {
-                                               this.expandRow(false);
-                                          
-                                                this.valid = false;
-                                                return;
-                                           }
-                                           this.expandRow(ri, dp);
-                                           
-                                         
-                                          this.valid = 'ok-add'; 
-                                    },
-                                    drop : function (source, e, data)
-                                    {
-                                            var grid = _this.grid;
-                                            var t = Roo.lib.Event.getTarget(e); 
-                                            var t = Roo.lib.Event.getTarget(e); 
-                                            var ri = grid.view.findRowIndex(t);
-                                           //Roo.log(e);
-                                           //Roo.log(data);
-                                            var dp = this.getDropPoint(e,data);
-                                          // at this point should have above or below..
-                                            var os = grid.selModel.getSelectedCell()
-                                            grid.ds.remove(data.selections[0]);
-                                            var new_row = ri + (dp == 'below' ? 1 : 0);
-                                            grid.ds.insert(new_row , data.selections);
-                                            grid.selModel.select(new_row , os[1])
-                                            this.expandRow(false);
-                                            
-                                            
-                                            var above_id = 0;
-                                            var above_row = new_row-1;
-                                            if (above_row > -1) {
-                                                above_id = grid.ds.getAt(above_row).data.id;
-                                            }
-                                            new Pman.Request({
-                                                method : 'POST',
-                                                url : baseURL + '/Roo/Mtrack_ticket',
-                                                params : { 
-                                                    id : grid.ds.getAt(new_row).data.id,
-                                                    _reorder : above_id
-                                                }
-                                                
-                                            });
-                                            
-                                            
-                                            
-                                    }
-                                },
-                                ddGroup : 'mtrack_ticket',
-                                expandRow : function(ri,pos)
-                                {
-                                    var dom = _this.grid.view.getRow(ri);
-                                    //Roo.log(dom);
-                                    //if (this.activeDom == dom) {
-                                    //    return;
-                                    //}
-                                    if (this.activeDom) {
-                                        Roo.get(this.activeDom).removeClass('x-grid-dd-above');
-                                        Roo.get(this.activeDom).removeClass('x-grid-dd-below');
-                                        
-                                        this.activeDom = false;
-                                    }
-                                    
-                                    if (ri === false) {
-                                        return;
-                                    }
-                                    Roo.get(dom).addClass('x-grid-dd-' + pos);
-                                     
-                                    this.activeDom = dom;
-                                
-                                
-                                },
-                                getDropPoint : function(e, data)
-                                {
-                                    //var tn = n.node;
-                                   // data is from griddragzone
-                                   
-                                    var te = Roo.lib.Event.getTarget(e); 
-                                    
-                                    // use grid??
-                                    var ri =  Roo.fly(te).findParent("td", 6);
-                                        
-                                   
-                                    var dragEl = ri;
-                                    var t = Roo.lib.Dom.getY(dragEl),
-                                        b = t + dragEl.offsetHeight;
-                                    var y = Roo.lib.Event.getPageY(e);
-                                    //var noAppend = tn.allowChildren === false || tn.isLeaf();
-                                    
-                                    // we may drop nodes anywhere, as long as allowChildren has not been set to false..
-                                    
-                                      
-                                    var q = (b - t) / 2;
-                                    
-                                    
-                                    if(y >= t && y < (t + q)){
-                                        return "above";
-                                    }
-                                    if(y >= b-q && y <= b){
-                                        return "below";
-                                    }
-                                    //Roo.log( JSON.stringify( {pos: y, dragtop : t, mid : q, drabgot: b }));
-                                    
-                                    
-                                    return false;
-                                }
-                            }
-                        }
-                    },
-                    {
-                        xtype: 'ContentPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function (_self)
-                            {
-                                _this.tpanel = _self;
-                            },
-                            resize : function (_self, width, height)
-                            {
-                                // create and update the CSS style
-                                
-                                if (!_this.css) {
-                                    _this.css = Roo.util.CSS;
-                                
-                                    _this.css.createStyleSheet(
-                                        
-                                            ".ticket-view-main .ticket-left-col {  }\n" +
-                                            ".ticket-view-main .readonly-tkt-description { }\n" +
-                                            ".ticket-view-main .mtrack-ticket-events {} \n"
-                                        ,
-                                        Roo.id()
-                                    );   
-                                     
-                                }
-                                var w = width - 400;
-                                Roo.log("new width: " + Math.max(0,w));
-                                
-                                _this.css.updateRule(
-                                    ".ticket-view-main .ticket-left-col", 
-                                        "width", Math.max(0, w) +  'px'
-                                );
-                                 _this.css.updateRule(
-                                    ".ticket-view-main .readonly-tkt-description",
-                                        "width", Math.max(0, w-10) +  'px'
-                                );
-                                 _this.css.updateRule(
-                                    ".ticket-view-main .mtrack-ticket-events",
-                                        "width", Math.max(0, w-10) +  'px'
-                                );
-                            }
-                        },
-                        autoScroll : true,
-                        background : false,
-                        fitContainer : true,
-                        fitToFrame : true,
-                        region : 'center',
-                        title : "Tickets",
-                        mload : function(url) {
-                            if (typeof(MTrack) == 'undefined') {
-                                return;
-                            }
-                            this._url = url;
-                            this._project = MTrack.projectCombo.getValue();
-                            if (!_this.tpanel) {
-                                return;
-                            }
-                            MTrack.ajaxLoad(url, this);
-                            MTrackWeb.pushState({
-                                url : url,
-                                title : "Browse : " + url,
-                                href : baseURL + url
-                            });
-                             
-                        },
-                        toolbar : {
-                            xtype: 'Toolbar',
-                            xns: Roo,
-                            items : [
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            
-                                            
-                                            
-                                            var sels = _this.grid.getSelectionModel().getSelections()
-                                            if (!sels || sels.length > 1) {
-                                                Roo.MessageBox.alert("Error", "Select a ticket");
-                                                return;
-                                            }
-                                            var rec = sels[0];
-                                            
-                                            function ok()
-                                            {
-                                                _this.panel.layout.getRegion('south').show();
-                                                _this.panel.layout.getRegion('north').hide();
-                                                _this.form.reset();
-                                                
-                                                _this.form.setValues({
-                                                    id : rec.data.id,
-                                                    developer_id : rec.data.developer_id,
-                                                    developer_id_name : rec.data.developer_id_name
-                                                });
-                                                    
-                                            }
-                                            
-                                            if (_this.panel.layout.getRegion('south').isVisible() && _this.form.isDirty()) {
-                                                Roo.MessageBox.confirm("Cancel", "Are you sure you want to cancel editing", function(r) {
-                                                    if (r !='yes') {
-                                                        return;
-                                                    }
-                                                    ok();    
-                                                    
-                                                });
-                                                return;
-                                            }
-                                            
-                                            ok();
-                                            
-                                        
-                                        
-                                        }
-                                    },
-                                    text : "Add Comment / Update"
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            var rc = _this.grid.getSelectionModel().getSelectedCell()
-                                            if (!rc) {
-                                                Roo.MessageBox.alert("Error", "Select a ticket");
-                                                return;
-                                            }
-                                            var rec = _this.grid.ds.getAt(rc[0]);
-                                            Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
-                                                // apply the data to the current row, and reload the display part..
-                                            
-                                            });
-                                            
-                                            
-                                            
-                                        }
-                                    },
-                                    text : "Edit original ticket"
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            var rc = _this.grid.getSelectionModel().getSelectedCell()
-                                            if (!rc) {
-                                                Roo.MessageBox.alert("Error", "Select a ticket");
-                                                return;
-                                            }
-                                            var rec = _this.grid.ds.getAt(rc[0]);
-                                            Pman.Dialog.Image.show( {
-                                                     onid : rec.data.id,
-                                                     ontable : 'mtrack_ticket'
-                                                 } ,
-                                                 function(res) {
-                                                     // update the body part..
-                                            
-                                                }
-                                            );
-                                            
-                                            
-                                            
-                                            
-                                        }
-                                    },
-                                    text : "Add Attachment / Patch"
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    text : "Subscribe"
-                                }
-                            ]
-                        }
-                    },
-                    {
-                        xtype: 'ContentPanel',
-                        xns: Roo,
-                        region : 'south',
-                        items : [
-                            {
-                                xtype: 'Form',
-                                xns: Roo.form,
-                                listeners : {
-                                    actioncomplete : function(_self,action)
-                                    {
-                                        if (action.type == 'setdata') {
-                                           //_this.dialog.el.mask("Loading");
-                                           //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
-                                           return;
-                                        }
-                                        if (action.type == 'load') {
-                                     
-                                            return;
-                                        }
-                                        if (action.type =='submit') {
-                                        
-                                             // refresh body..
-                                            
-                                             
-                                             var sm = _this.grid.getSelectionModel();
-                                             var cs = sm.getSelectedCell();
-                                             sm.fireEvent('cellselect',  sm, cs[0], cs[1] );
-                                              
-                                             // hide stuff.
-                                    
-                                             _this.panel.layout.getRegion('south').hide();
-                                             _this.panel.layout.getRegion('north').show();
-                                             _this.panel.layout.getRegion('north').expand();
-                                             
-                                             _this.form.reset();
-                                             return;
-                                        }
-                                    },
-                                    rendered : function (form)
-                                    {
-                                        _this.form= form;
-                                    }
-                                },
-                                method : 'POST',
-                                style : 'margin:10px;',
-                                url : baseURL + '/Roo/mtrack_ticket.php',
-                                items : [
-                                    {
-                                        xtype: 'Row',
-                                        xns: Roo.form,
-                                        width : 900,
-                                        items : [
-                                            {
-                                                xtype: 'Column',
-                                                xns: Roo.form,
-                                                labelAlign : 'top',
-                                                width : 500,
-                                                items : [
-                                                    {
-                                                        xtype: 'TextArea',
-                                                        xns: Roo.form,
-                                                        fieldLabel : 'Your comment',
-                                                        height : 100,
-                                                        name : 'reason',
-                                                        width : 400
-                                                    }
-                                                ]
-                                            },
-                                            {
-                                                xtype: 'Column',
-                                                xns: Roo.form,
-                                                labelAlign : 'right',
-                                                labelWidth : 160,
-                                                width : 400,
-                                                items : [
-                                                    {
-                                                        xtype: 'ComboBox',
-                                                        xns: Roo.form,
-                                                        allowBlank : true,
-                                                        alwaysQuery : true,
-                                                        displayField : 'name',
-                                                        editable : false,
-                                                        emptyText : "Change Status",
-                                                        fieldLabel : 'Status',
-                                                        forceSelection : true,
-                                                        hiddenName : 'status',
-                                                        listWidth : 200,
-                                                        loadingText : "Searching...",
-                                                        minChars : 2,
-                                                        name : 'status_name',
-                                                        qtip : "Change Status",
-                                                        queryParam : 'query[name]',
-                                                        selectOnFocus : true,
-                                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                                        triggerAction : 'all',
-                                                        typeAhead : true,
-                                                        valueField : 'id',
-                                                        width : 200,
-                                                        store : {
-                                                            xtype: 'Store',
-                                                            xns: Roo.data,
-                                                            listeners : {
-                                                                beforeload : function (_self, o){
-                                                                    o.params = o.params || {};
-                                                                    // set more here
-                                                                    o.params['query[ticket_change]'] = _this.form.findField('id').getValue();
-                                                                },
-                                                                load : function (_self, records, options)
-                                                                {
-                                                                    var cs = _this.grid.getSelectionModel().getSelectedCell();
-                                                                    var status  = _this.grid.ds.getAt(cs[0]).data.status;
-                                                                    
-                                                                    Roo.each(records, function(r) {
-                                                                        
-                                                                        if (r.data.id == status) {
-                                                                            r.set('name', "No Change");
-                                                                            return;
-                                                                        }
-                                                                        
-                                                                        // me... ??
-                                                                        
-                                                                        // 
-                                                                        if (r.data.etype == 'resolution') {
-                                                                            r.set('name',   "Close as " + r.data.name);
-                                                                            return;
-                                                                        }
-                                                                        r.set('name',  'Change to ' + r.data.name);
-                                                                    });
-                                                                }
-                                                            },
-                                                            remoteSort : true,
-                                                            sortInfo : { direction : 'ASC', field: 'id' },
-                                                            proxy : {
-                                                                xtype: 'HttpProxy',
-                                                                xns: Roo.data,
-                                                                method : 'GET',
-                                                                url : baseURL + '/Roo/core_enum.php'
-                                                            },
-                                                            reader : {
-                                                                xtype: 'JsonReader',
-                                                                xns: Roo.data,
-                                                                id : 'id',
-                                                                root : 'data',
-                                                                totalProperty : 'total',
-                                                                fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                            }
-                                                        }
-                                                    },
-                                                    {
-                                                        xtype: 'ComboBox',
-                                                        xns: Roo.form,
-                                                        allowBlank : true,
-                                                        alwaysQuery : true,
-                                                        displayField : 'name',
-                                                        editable : 'false',
-                                                        emptyText : "Select Person",
-                                                        fieldLabel : 'Developer / Action Required By',
-                                                        forceSelection : true,
-                                                        hiddenName : 'developer_id',
-                                                        listWidth : 400,
-                                                        loadingText : "Searching...",
-                                                        minChars : 2,
-                                                        name : 'developer_id_name',
-                                                        qtip : "Select Person",
-                                                        queryParam : 'query[name]',
-                                                        selectOnFocus : true,
-                                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> &lt;{email}&gt;</div>',
-                                                        triggerAction : 'all',
-                                                        typeAhead : true,
-                                                        valueField : 'id',
-                                                        width : 200,
-                                                        store : {
-                                                            xtype: 'Store',
-                                                            xns: Roo.data,
-                                                            listeners : {
-                                                                beforeload : function (_self, o){
-                                                                    o.params = o.params || {};
-                                                                    // set more here
-                                                                    o.params['query[ticket_id]'] =_this.grid.getSelected().data.id;
-                                                                    
-                                                                    o.params['query[project_id]']= _this.grid.getSelected().data.project_id;
-                                                                    o.params._anyrole = 1;
-                                                                    
-                                                                    o.params.limit = 999;
-                                                                }
-                                                            },
-                                                            remoteSort : true,
-                                                            sortInfo : { direction : 'ASC', field: 'name' },
-                                                            proxy : {
-                                                                xtype: 'HttpProxy',
-                                                                xns: Roo.data,
-                                                                method : 'GET',
-                                                                url : baseURL + '/Roo/Person.php'
-                                                            },
-                                                            reader : {
-                                                                xtype: 'JsonReader',
-                                                                xns: Roo.data,
-                                                                id : 'id',
-                                                                root : 'data',
-                                                                totalProperty : 'total',
-                                                                fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                                            }
-                                                        }
-                                                    }
-                                                ]
-                                            }
-                                        ]
-                                    },
-                                    {
-                                        xtype: 'Hidden',
-                                        xns: Roo.form,
-                                        name : 'id'
-                                    }
-                                ]
+                            
+                            if (k.match(/_id$/) || k.match(/_id_/) || k.match(/^status_/)) {
+            
+            
+                                Roo.log("SET " + k + "=" +  tks[record.data.id*1][k]);
+                                record.data[k] = tks[record.data.id*1][k];
+                                record.modified[k] = tks[record.data.id*1][k];
                             }
-                        ],
-                        toolbar : {
-                            xtype: 'Toolbar',
-                            xns: Roo,
-                            items : [
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                           if (!_this.form.findField('status').getValue()) {
-                                                Roo.MessageBox.alert("Error", "Fill in the new status");
-                                                return;
-                                            }
-                                            
-                                           
-                                            _this.form.submit();
-                                        }
-                                    },
-                                    text : "Save"
-                                },
-                                {
-                                    xtype: 'Fill',
-                                    xns: Roo.Toolbar
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            _this.form.reset();
-                                            _this.panel.layout.getRegion('south').hide();
-                                            _this.panel.layout.getRegion('north').show();
-                                            _this.panel.layout.getRegion('north').expand();
-                                        }
-                                    },
-                                    text : "Cancel"
-                                }
-                            ]
                         }
-                    }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    tabPosition : 'top'
-                },
-                north : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    collapsible : true,
-                    height : 300,
-                    split : true,
-                    tabPosition : 'top'
-                },
-                south : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    height : 170,
-                    split : true
+                        record.store.afterEdit(record);
+                  });
+                
+                });
+            
+                
+                    
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Fill',
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'TextItem',
+          text : _this._strings['df25de42c84837baf5fa15049a8bc764'] /* View: */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'TextField',
+          listeners : {
+           render : function (_self)
+            {
+            _this.searchBox=  _self;
+            },
+           specialkey : function (_self, e)
+            {
+                _this.grid.ds.load({});
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'ComboBox',
+          allowBlank : true,
+          displayField : 'developer_id_name',
+          editable : true,
+          emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person  */,
+          fieldLabel : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person  */,
+          forceSelection : true,
+          hiddenName : 'developer_id',
+          listWidth : 600,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+          minChars : 2,
+          name : 'developer_id',
+          pageSize : 20,
+          qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person  */,
+          queryParam : 'query[name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{developer_id_name}</b></div>',
+          triggerAction : 'all',
+          typeAhead : true,
+          valueField : 'developer_id',
+          width : 150,
+          listeners : {
+           render : function (_self)
+            {
+                _this.personSel = _self;
+                if (Pman.Login.authUser.id) {
+                    this.setFromData({
+                        developer_id : Pman.Login.authUser.id,
+                        developer_id_name : Pman.Login.authUser.name
+                    });
+                
+                }
+            },
+           select : function (combo, record, index)
+            {
+              _this.grid.ds.load({});
+              
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'Store',
+           sortInfo : { field : 'developer_id_name' , dir : 'ASC' },
+           listeners : {
+            beforeload : function (_self, o)
+             {
+                 o.params = o.params || {};
+                 o.params._distinct = 'developer_id';
+                 o.params._columns = 'developer_id,developer_id_name';
+             },
+            load : function (_self, records, options)
+             {
+                 Roo.log(records);
+                 var ua = _this.personSel.store.reader.newRow({
+                     developer_id : -1,
+                     developer_id_name : '-- Un-assigned --'
+                 });
+                 this.insert(0,[ua]);
+             //    records.unshift(ua);
+             }
+           },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           proxy : {
+            xtype : 'HttpProxy',
+            method : 'GET',
+            url : baseURL + '/Roo/Mtrack_ticket.php',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           },
+           reader : {
+            xtype : 'JsonReader',
+            fields : [
+                {
+                    'name': 'developer_id',
+                    'type': 'int'
+                } ,
+                {
+                    'name': 'developer_id_name',
+                    'type' : 'text'
                 }
+                
+                
+            ],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           }
+          }
+         },
+         {
+          xtype : 'ComboBox',
+          allowBlank : false,
+          displayField : 'fname',
+          editable : false,
+          fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+          hiddenName : 'cm_status',
+          listWidth : 200,
+          mode : 'local',
+          name : 'cm_status_name',
+          triggerAction : 'all',
+          value : _this._strings['c76a5e84e4bdee527e274ea30c680d79'] /* active */,
+          valueField : 'ftype',
+          width : 150,
+          listeners : {
+           render : function (_self)
+            {
+              _this.status = _self;
+            },
+           select : function (combo, record, index)
+            {
+                Roo.log('select');
+                _this.grid.ds.load({});
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'SimpleStore',
+           data : [ 
+               [ 'active', "Active"],
+               [ 'me' , "Assigned to me"],
+               [ 'me-all' , "Assigned to me (All projects)"],    
+               [ 'closed' , "Closed"],
+               [ 'on-hold' , "On Hold"],
+               [ 'pending' , "Pending Review / Resolved"],
+               [ 'in-progress' , "In Progress"],
+               [ 'all' , "All States"]
+                
+           ],
+           fields : [  'ftype', 'fname'],
+           xns : Roo.data,
+           '|xns' : 'Roo.data'
+          }
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/search.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.grid.ds.load({});
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.searchBox.setValue('');
+                
+                    _this.grid.ds.load({});
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
+       },
+       dataSource : {
+        xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field : 'summary', direction: 'ASC' },
+        listeners : {
+         beforeload : function (_self, options)
+          {
+              
+             if (Pman.building) { return false; }
+              options.params =     options.params || {};
+              options.params['query[search]'] = _this.searchBox.getValue();
+              var sq =        options.params['query[viewtype]'] = _this.status.getValue(); 
+              var pc = false;
+              var ps = false;
+              try {
+                   pc = _this.grid.colModel.getIndexByDataIndex('project_id_name');
+                  
+              } catch(e) {} 
+              
+          
+              if (!options.params['query[search]'].length || isNaN(options.params['query[search]'])) {
+                      
+                  
+                  ps = _this.personSel.getValue();
+                  ps = ps ? ps : 0;
+                  if (ps ) {
+                      options.params.developer_id = ps <0 ? 0 : ps;
+                  }
+          
+                   
+                  
+                  
+                  try { 
+                      options.params.project_id  = Pman.Tab.DocumentsTab.panel.getProjectId();
+                  } catch(e) {
+                      options.params.project_id  = typeof(MTrack) != 'undefined' ? MTrack.projectCombo.getValue(): 0;
+                  }
+                  options.params.project_id =      options.params.project_id || undefined;
+               }
+               
+          
+                   
+                     
+              if (  ps < 1 && pc !== false) {
+                  _this.grid.colModel.setHidden(pc, true);
+                  
+              }
+              
+              // project column
+              if (pc!== false) {
+                   _this.grid.colModel.setHidden(pc, true);
+               }
+               
+              if (pc !== false && !options.params.project_id) {
+          
+                   _this.grid.colModel.setHidden(pc, false);       
+          
+              }
+          
+              options.params.limit = 999;
+              // columns...
+          
+              
+              
+          },
+         update : function (_self, record, operation)
+          {
+              Roo.log('update: ' + JSON.stringify(operation));
+              if (operation != 'commit') {
+                  return;
+              }
+              // send things that might change..
+              new Pman.Request({
+                  url : baseURL + '/Roo/mtrack_ticket',
+                  method : 'POST',
+                  params : {
+                      id : record.data.id,
+                      milestone_id : record.data.milestone_id,
+                      priority_id : record.data.priority_id,
+                      severity_id : record.data.severity_id,
+                      classification_id : record.data.classification_id,
+                      estimated : record.data.estimated,
+                      developer_id : record.data.developer_id
+                  },
+                  success : function(res)
+                  {
+                      var r = res.data;
+                      //Roo.log(r);
+                      // do nothing?
+                      record.modified = record.modified || {};
+                      for (var k in r) {
+                          // update the 
+                           
+                          if (k.match(/_id$/) || k.match(/_id_/) || k.match(/^status_/)) {
+               
+                              record.data[k] = r[k];
+                              record.modified[k] = r[k];
+                          }
+                      }
+                      record.store.afterEdit(record);
+                  }
+                  // we should really have a failure - to reset to the old value.
+              });
+               
+              
+              
+          }
+        },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        proxy : {
+         xtype : 'HttpProxy',
+         method : 'GET',
+         url : baseURL + '/Roo/mtrack_ticket.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        },
+        reader : {
+         xtype : 'JsonReader',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'summary',
+                 'type': 'string'
+             },
+             {
+                 'name': 'description',
+                 'type': 'string'
+             },
+             {
+                 'name': 'changelog',
+                 'type': 'string'
+             },
+             {
+                 'name': 'created',
+                 'type': 'int'
+             },
+             {
+                 'name': 'updated',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'priority_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'severity_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'classification_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'resolution_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'cc',
+                 'type': 'string'
+             },
+             {
+                 'name': 'status',
+                 'type': 'int'
+             },
+             {
+                 'name': 'estimated',
+                 'type': 'float'
+             },
+             {
+                 'name': 'spent',
+                 'type': 'float'
+             },
+             {
+                 'name': 'x_fieldname',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'updated_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'updated_person_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'updated_ontable',
+                 'type': 'string'
+             },
+             {
+                 'name': 'updated_onid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'updated_changedate',
+                 'type': 'date'
+             },
+             {
+                 'name': 'updated_reason',
+                 'type': 'string'
+             },
+             {
+                 'name': 'created_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'created_person_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'created_ontable',
+                 'type': 'string'
+             },
+             {
+                 'name': 'created_onid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'created_changedate',
+                 'type': 'date'
+             },
+             {
+                 'name': 'created_reason',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_office_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_phone',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_fax',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_email',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_company_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_role',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_remarks',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_passwd',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_owner_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_lang',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_no_reset_sent',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_action_type',
+                 'type': 'string'
+             },
+             {
+                 'name': 'owner_id_project_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_deleted_by',
+                 'type': 'int'
+             },
+             {
+                 'name': 'owner_id_deleted_dt',
+                 'type': 'date'
+             },
+             {
+                 'name': 'developer_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_office_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_phone',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_fax',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_email',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_company_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_role',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_remarks',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_passwd',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_owner_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_lang',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_no_reset_sent',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_action_type',
+                 'type': 'string'
+             },
+             {
+                 'name': 'developer_id_project_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_deleted_by',
+                 'type': 'int'
+             },
+             {
+                 'name': 'developer_id_deleted_dt',
+                 'type': 'date'
+             },
+             {
+                 'name': 'priority_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'priority_id_etype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'priority_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'priority_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'priority_id_seqid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'severity_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'severity_id_etype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'severity_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'severity_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'severity_id_seqid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'classification_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'classification_id_etype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'classification_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'classification_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'classification_id_seqid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'resolution_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'resolution_id_etype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'resolution_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'resolution_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'resolution_id_seqid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'status_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'status_etype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'status_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'status_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'status_seqid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_remarks',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_owner_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_code',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_type',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_client_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_team_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_file_location',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_open_date',
+                 'type': 'date'
+             },
+             {
+                 'name': 'project_id_open_by',
+                 'type': 'int'
+             },
+             {
+                 'name': 'project_id_close_date',
+                 'type': 'date'
+             },
+             {
+                 'name': 'project_id_countries',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_languages',
+                 'type': 'string'
+             },
+             {
+                 'name': 'project_id_agency_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'milestone_id_description',
+                 'type': 'string'
+             },
+             {
+                 'name': 'milestone_id_startdate',
+                 'type': 'date'
+             },
+             {
+                 'name': 'milestone_id_duedate',
+                 'type': 'date'
+             },
+             {
+                 'name': 'milestone_id_completed',
+                 'type': 'date'
+             },
+             {
+                 'name': 'milestone_id_deleted',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id_created',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id_updated',
+                 'type': 'int'
+             },
+             {
+                 'name': 'milestone_id_project_id',
+                 'type': 'int'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        }
+       },
+       dropTarget : {
+        xtype : 'DropTarget',
+        ddGroup : 'mtrack_ticket',
+        expandRow : function(ri,pos)
+        {
+            var dom = _this.grid.view.getRow(ri);
+            //Roo.log(dom);
+            //if (this.activeDom == dom) {
+            //    return;
+            //}
+            if (this.activeDom) {
+                Roo.get(this.activeDom).removeClass('x-grid-dd-above');
+                Roo.get(this.activeDom).removeClass('x-grid-dd-below');
+                
+                this.activeDom = false;
+            }
+            
+            if (ri === false) {
+                return;
+            }
+            Roo.get(dom).addClass('x-grid-dd-' + pos);
+             
+            this.activeDom = dom;
+        
+        
+        },
+        getDropPoint : function(e, data)
+        {
+            //var tn = n.node;
+           // data is from griddragzone
+           
+            var te = Roo.lib.Event.getTarget(e); 
+            
+            // use grid??
+            var ri =  Roo.fly(te).findParent("td", 6);
+                
+           
+            var dragEl = ri;
+            var t = Roo.lib.Dom.getY(dragEl),
+                b = t + dragEl.offsetHeight;
+            var y = Roo.lib.Event.getPageY(e);
+            //var noAppend = tn.allowChildren === false || tn.isLeaf();
+            
+            // we may drop nodes anywhere, as long as allowChildren has not been set to false..
+            
+              
+            var q = (b - t) / 2;
+            
+            
+            if(y >= t && y < (t + q)){
+                return "above";
+            }
+            if(y >= b-q && y <= b){
+                return "below";
+            }
+            //Roo.log( JSON.stringify( {pos: y, dragtop : t, mid : q, drabgot: b }));
+            
+            
+            return false;
+        },
+        listeners : {
+         drop : function (source, e, data)
+          {
+                  var grid = _this.grid;
+                  var t = Roo.lib.Event.getTarget(e); 
+                  var t = Roo.lib.Event.getTarget(e); 
+                  var ri = grid.view.findRowIndex(t);
+                 //Roo.log(e);
+                 //Roo.log(data);
+                  var dp = this.getDropPoint(e,data);
+                // at this point should have above or below..
+                  var os = grid.selModel.getSelectedCell();
+                  grid.ds.remove(data.selections[0]);
+                  var new_row = ri + (dp == 'below' ? 1 : 0);
+                  grid.ds.insert(new_row , data.selections);
+                  grid.selModel.select(new_row , os[1]);
+                  this.expandRow(false);
+                  
+                  
+                  var above_id = 0;
+                  var above_row = new_row-1;
+                  if (above_row > -1) {
+                      above_id = grid.ds.getAt(above_row).data.id;
+                  }
+                  new Pman.Request({
+                      method : 'POST',
+                      url : baseURL + '/Roo/Mtrack_ticket',
+                      params : { 
+                          id : grid.ds.getAt(new_row).data.id,
+                          _reorder : above_id
+                      }
+                      
+                  });
+                  
+                  
+                  
+          },
+         over : function (source, e, data)
+          {
+          
+              Roo.log('over');
+          // if drag point == drop point...
+              var grid = _this.grid;
+                 var t = Roo.lib.Event.getTarget(e); 
+                 var ri = grid.view.findRowIndex(t);
+                 var dp = this.getDropPoint(e,data);
+                 Roo.log(dp);
+                 //Roo.log(JSON.stringify({ dp: dp,  ri: ri, src_ri: data.rowIndex}));
+                 if(ri == data.rowIndex ||
+                      (dp == 'above' && ri-1 == data.rowIndex) ||
+                      (dp == 'below' && ri+1 == data.rowIndex) 
+                   ) {
+                     this.expandRow(false);
+                
+                      this.valid = false;
+                      return;
+                 }
+                 this.expandRow(ri, dp);
+                 
+               
+                this.valid = 'ok-add'; 
+          }
+        },
+        xns : Roo.dd,
+        '|xns' : 'Roo.dd'
+       },
+       sm : {
+        xtype : 'RowSelectionModel',
+        listeners : {
+         afterselectionchange : function (_self, rowIndex, colIndex)
+          {
+              
+              var   sels =   _this.grid.selModel.getSelections();
+              
+              if (!sels || sels.length > 1) {
+              
+                  return;
+              }
+              
+              var rec = sels[0];
+              
+              // verify nothing has chagned.. 
+               
+              // load the ticked, and render a view of it...
+              new Pman.Request({
+                  url : baseURL + '/Roo/mtrack_ticket',
+                  method : 'GET',
+                  params : { 
+                      _id : rec.data.id
+                  },
+                  success : function(res) {
+                      //Roo.log(res.data);
+                      // render it into a template..
+                      _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
+                      _this.tpanel.el.scrollTo('top',0);
+                       
+                      //... ehh
+                       Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
+                   
+                      
+                     
+                      new Pman.Request({
+                          url : baseURL + '/Roo/Images',
+                          method : 'GET',
+                          params : { 
+                              onid : rec.data.id,
+                              ontable : 'mtrack_ticket'
+                          },
+                          success : function(ares) {
+                              Roo.log(ares.data);
+                              var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
+                              // fill in the attachement area with data from this..
+                              el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
+                          }
+                      });
+                       
+                      
+                      _this.form.reset();
+          
+                      _this.form.setValues({
+                          id : rec.data.id,
+                          owner_id : rec.data.owner_id,
+                          owner_id_name : rec.data.owner_id_name,
+                          status : rec.data.status,
+                          status_name : "No Change"
+                      }); 
+                      
+                      
+                      for(var k in res.data) {
+                          rec.set(k,res.data[k]);
+                      }
+                      
+                  }
+              });
+                  
+              
+              
+          },
+         cellselect : function (_self, rowIndex, colIndex)
+          {
+              return false;
+              var rec = _this.grid.ds.getAt(rowIndex);
+              
+              // verify nothing has chagned.. 
+               
+              // load the ticked, and render a view of it...
+              new Pman.Request({
+                  url : baseURL + '/Roo/mtrack_ticket',
+                  method : 'GET',
+                  params : { 
+                      _id : rec.data.id
+                  },
+                  success : function(res) {
+                      //Roo.log(res.data);
+                      // render it into a template..
+                      _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));
+                      _this.tpanel.el.scrollTo('top',0);
+                       
+                      //... ehh
+                       Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());
+                   
+                      new Pman.Request({
+                          url : baseURL + '/Roo/Images',
+                          method : 'GET',
+                          params : { 
+                              onid : rec.data.id,
+                              ontable : 'mtrack_ticket'
+                          },
+                          success : function(ares) {
+                              Roo.log(ares.data);
+                              var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();
+                              // fill in the attachement area with data from this..
+                              el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;
+                          }
+                      });
+                       
+                      
+                      _this.form.reset();
+          
+                      _this.form.setValues({
+                          id : rec.data.id,
+                          owner_id : rec.data.owner_id,
+                          owner_id_name : rec.data.owner_id_name,
+                          status : rec.data.status,
+                          status_name : "No Change"
+                      }); 
+                      
+                      
+                      for(var k in res.data) {
+                          rec.set(k,res.data[k]);
+                      }
+                      
+                  }
+              });
+                  
+              
+              
+          }
+        },
+        xns : Roo.grid,
+        '|xns' : 'Roo.grid'
+       },
+       colModel : [
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'id',
+         header : _this._strings['b1550c2a1a5eb0d078d92eef8a0ef883'] /* ID# */,
+         renderer : function(v) { return String.format('#{0}', v); },
+         sortable : true,
+         width : 50,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'project_id_name',
+         header : _this._strings['9e727fdd3aec8274f46685441900280d'] /* Project */,
+         hidden : true,
+         renderer : function(v) { return String.format('{0}', v); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'milestone_id',
+         header : _this._strings['e9c626b8a8b62de7562dfbf51a576ae5'] /* Milestone */,
+         renderer : function(v, x,r ) { return String.format('{0}', r.data.milestone_id_name); },
+         sortable : true,
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          listeners : {
+           complete : function (_self, value, startValue)
+            {
+              Roo.log('complete');
+            }
+          },
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'ComboBox',
+           allowBlank : false,
+           alwaysQuery : true,
+           displayField : 'name',
+           editable : false,
+           emptyText : _this._strings['a5ffb2a210f259195a75e5abca8db4a2'] /* Select mtrack_milestone */,
+           forceSelection : true,
+           hiddenName : 'milestone_id',
+           listWidth : 400,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           name : 'milestone_id_name',
+           pageSize : 20,
+           qtip : _this._strings['a5ffb2a210f259195a75e5abca8db4a2'] /* Select mtrack_milestone */,
+           queryParam : '',
+           selectOnFocus : true,
+           tpl : '<div class=\"x-grid-cell-text\"><b>{name}</b> - {startdate:date(\"d/m/Y\")} - {duedate:date(\"d/m/Y\")} </div>',
+           triggerAction : 'all',
+           typeAhead : true,
+           valueField : 'id',
+           width : 300,
+           listeners : {
+            select : function (combo, record, index)
+             {
+                 Roo.log('selected');
+                 
+                 (function() { 
+                     _this.grid.stopEditing();
+                 }).defer(100);
+             }
+           },
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           store : {
+            xtype : 'Store',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'duedate' },
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                  // set more here
+                 var rec =   _this.grid.activeEditor.record;
+              
+                  o.params.project_id = rec.data.project_id;
+                  //o.params._viewtype = 'ACTIVE';
+                  o.params._viewtype
+              }
+            },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            proxy : {
+             xtype : 'HttpProxy',
+             method : 'GET',
+             url : baseURL + '/Roo/mtrack_milestone.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            reader : {
+             xtype : 'JsonReader',
+             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'status_name',
+         header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+         hidden : true,
+         width : 80,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'resolution_id_name',
+         header : _this._strings['f691f042a559b1c1a4f89826c6f75760'] /* Resolved */,
+         hidden : true,
+         width : 80,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'summary',
+         header : _this._strings['290612199861c31d1036b185b4e69b75'] /* Summary */,
+         renderer : function(v,x,r) { 
+             
+             var col = '#000'; // closed?
+             switch (r.data.status_name) {
+                 case 'REVIEW_BY_ADMIN':
+                     col = '#0cc'; break; // blue
+                 case 'TODO':
+                 case 'CLIENT_NEW_REQUEST':        
+                 case 'CLIENT_SAY_NEED_MORE_WORK':                
+                     col = '#c00'; break; // redish
+                 case 'CLOSED':                
+                     col = '#999'; break; // grey
+            }
+            
+            var sn = r.data.status_name.toLowerCase().split('_').join(' ');
+            
+             return String.format(
+                 r.data.status_name == 'CLOSED'  ?
+                       '</span><s style="color:{2}">[{1}]</s> {0}':
+                       '<span style="color:{2}">[{1}]</span> {0}',
+                     v,
+                     r.data.status_name == 'CLOSED'  ?
+                          r.data.resolution_id_name : 
+                          sn , col
+                     ); 
+         },
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'owner_id_name',
+         header : _this._strings['b6f4a2ec6356bbd56d49f2096bf9d3d3'] /* Owner */,
+         renderer : function(v) { return String.format('{0}', v); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'developer_id',
+         header : _this._strings['672caf27f5363dc833bda5099775e891'] /* Developer */,
+         renderer : function(v,x,r) { return String.format('{0}', r.data.developer_id_name); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'ComboBox',
+           allowBlank : true,
+           alwaysQuery : true,
+           displayField : 'name',
+           editable : false,
+           emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
+           fieldLabel : _this._strings['04720e14ddfde3154a120fdd0ae73d19'] /* Action Required By */,
+           forceSelection : true,
+           hiddenName : 'developer_id',
+           listWidth : 400,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           name : 'developer_id_name',
+           qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
+           queryParam : 'query[name]',
+           selectOnFocus : true,
+           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt;</div>',
+           triggerAction : 'all',
+           typeAhead : true,
+           valueField : 'id',
+           width : 200,
+           listeners : {
+            select : function (combo, record, index)
+             {
+               
+                 (function() { 
+                     _this.grid.stopEditing();
+                 }).defer(100);
+             }
+           },
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           store : {
+            xtype : 'Store',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'name' },
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                  // set more here
+                 var rec =   _this.grid.activeEditor.record;
+              
+                  
+                  o.params['query[ticket_id]'] = rec.data.id;
+                  
+                  o.params['query[project_id]']=  rec.data.project_id;
+                 o.params._anyrole = 1;
+                  o.params.limit = 99;
+              }
+            },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            proxy : {
+             xtype : 'HttpProxy',
+             method : 'GET',
+             url : baseURL + '/Roo/Person.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            reader : {
+             xtype : 'JsonReader',
+             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'priority_id',
+         header : _this._strings['502996d9790340c5fd7b86a5b93b1c9f'] /* Priority */,
+         renderer : function(v,x,r) { 
+             x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.priority_id_seqid % 10, r.data.priority_id_seqmax % 10 ); 
+             return String.format('{0}', r.data.priority_id_name); 
+         },
+         sortable : true,
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          listeners : {
+           complete : function (_self, value, startValue)
+            {
+              Roo.log('complete');
+            }
+          },
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'ComboBox',
+           allowBlank : false,
+           alwaysQuery : true,
+           displayField : 'name',
+           editable : false,
+           emptyText : _this._strings['8a223eb0008a86f053b2a7eac0fa6eac'] /* Select priority */,
+           forceSelection : true,
+           hiddenName : 'priority_id',
+           listWidth : 400,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           name : 'priority_id_name',
+           pageSize : 20,
+           qtip : _this._strings['8a223eb0008a86f053b2a7eac0fa6eac'] /* Select priority */,
+           queryParam : '',
+           selectOnFocus : true,
+           tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
+           triggerAction : 'all',
+           typeAhead : true,
+           valueField : 'id',
+           width : 300,
+           listeners : {
+            select : function (combo, record, index)
+             {
+                 Roo.log('selected');
+                 
+                 (function() { 
+                     _this.grid.stopEditing();
+                 }).defer(100);
+             }
+           },
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           store : {
+            xtype : 'Store',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'seqid' },
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                 o.params.etype='priority'
+                  // set more here
+                  
+              }
+            },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            proxy : {
+             xtype : 'HttpProxy',
+             method : 'GET',
+             url : baseURL + '/Roo/core_enum.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            reader : {
+             xtype : 'JsonReader',
+             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'severity_id',
+         header : _this._strings['007cc9547ae8884ad597cd92ba505422'] /* Severity */,
+         renderer : function(v,x,r) { 
+             x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.severity_id_seqid, r.data.severity_id_seqmax ); 
+             return String.format('{0}', r.data.severity_id_name); 
+             },
+         sortable : true,
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          listeners : {
+           complete : function (_self, value, startValue)
+            {
+              Roo.log('complete');
+            }
+          },
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'ComboBox',
+           allowBlank : false,
+           alwaysQuery : true,
+           displayField : 'name',
+           editable : false,
+           emptyText : _this._strings['423570be9f14a39fe88384797ee376fd'] /* Select severity */,
+           forceSelection : true,
+           hiddenName : 'severity_id',
+           listWidth : 400,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           name : 'severity_id_name',
+           pageSize : 20,
+           qtip : _this._strings['423570be9f14a39fe88384797ee376fd'] /* Select severity */,
+           queryParam : '',
+           selectOnFocus : true,
+           tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
+           triggerAction : 'all',
+           typeAhead : true,
+           valueField : 'id',
+           width : 300,
+           listeners : {
+            select : function (combo, record, index)
+             {
+                 Roo.log('selected');
+                 
+                 (function() { 
+                     _this.grid.stopEditing();
+                 }).defer(100);
+             }
+           },
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           store : {
+            xtype : 'Store',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'seqid' },
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                 o.params.etype='severity'
+                  // set more here
+                  
+              }
+            },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            proxy : {
+             xtype : 'HttpProxy',
+             method : 'GET',
+             url : baseURL + '/Roo/core_enum.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            reader : {
+             xtype : 'JsonReader',
+             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'classification_id',
+         header : _this._strings['5c9335b28e6277ddbe0137f04e5e58a7'] /* Classification */,
+         renderer : function(v,x,r) { 
+             x.css +=  " " + String.format('RdYlGn-q{0}-{1}', r.data.classification_id_seqid, r.data.classification_id_seqmax ); 
+             return String.format('{0}', r.data.classification_id_name); 
+             },
+         sortable : true,
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          listeners : {
+           complete : function (_self, value, startValue)
+            {
+              Roo.log('complete');
+            }
+          },
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'ComboBox',
+           allowBlank : false,
+           alwaysQuery : true,
+           displayField : 'name',
+           editable : false,
+           emptyText : _this._strings['7025046a3448dfea367705b884148992'] /* Select classification */,
+           forceSelection : true,
+           hiddenName : 'classification_id',
+           listWidth : 400,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           name : 'classification_id_name',
+           pageSize : 20,
+           qtip : _this._strings['7025046a3448dfea367705b884148992'] /* Select classification */,
+           queryParam : '',
+           selectOnFocus : true,
+           tpl : '<div class=\"x-grid-cell-text  RdYlGn-q{seqid}-{seqmax}\"><b>{name}</b>  </div>',
+           triggerAction : 'all',
+           typeAhead : true,
+           valueField : 'id',
+           width : 300,
+           listeners : {
+            select : function (combo, record, index)
+             {
+                 Roo.log('selected');
+                 
+                 (function() { 
+                     _this.grid.stopEditing();
+                 }).defer(100);
+             }
+           },
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           store : {
+            xtype : 'Store',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'seqid' },
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                 o.params.etype='classification'
+                  // set more here
+                  
+              }
+            },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            proxy : {
+             xtype : 'HttpProxy',
+             method : 'GET',
+             url : baseURL + '/Roo/core_enum.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            reader : {
+             xtype : 'JsonReader',
+             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'estimated',
+         header : _this._strings['6a7e73161603d87b26a8eac49dab0a9c'] /* Hours */,
+         renderer : function(v,x,r) { 
+             return String.format('{0}/{1}', r.data.spent, v); 
+         },
+         width : 50,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         editor : {
+          xtype : 'GridEditor',
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          field : {
+           xtype : 'NumberField',
+           allowDecimals : true,
+           decimalPrecision : 1,
+           xns : Roo.form,
+           '|xns' : 'Roo.form'
+          }
+         }
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'spent',
+         header : _this._strings['1fd968087e03faeb2e87df1e9849d983'] /* Spent */,
+         hidden : true,
+         renderer : function(v,x,r) { 
+             return String.format('{0}',v); 
+         },
+         width : 50,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'updated_changedate',
+         header : _this._strings['ff0a3b7f3daef040faf89a88fdac01b7'] /* Updated */,
+         renderer : function(v,x,r) { 
+         
+             
+             var str= Date.parseDate( r.data.updated ? r.json.updated_changedate : r.json.created_changedate, 'Y-m-d H:i:s');
+             
+             
+             return String.format('{0}', str ? str.format('d/M/Y') : '?');
+          },
+         sortable : true,
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        }
+       ]
+      }
+     },
+     {
+      xtype : 'ContentPanel',
+      autoScroll : true,
+      background : false,
+      fitContainer : true,
+      fitToFrame : true,
+      mload : function(url) {
+          if (typeof(MTrack) == 'undefined') {
+              return;
+          }
+          this._url = url;
+          this._project = MTrack.projectCombo.getValue();
+          if (!_this.tpanel) {
+              return;
+          }
+          MTrack.ajaxLoad(url, this);
+          MTrackWeb.pushState({
+              url : url,
+              title : "Browse : " + url,
+              href : baseURL + url
+          });
+           
+      },
+      region : 'center',
+      title : _this._strings['c1c694bd849d91d0eb34bfef8c2d8894'] /* Tickets */,
+      listeners : {
+       activate : function (_self)
+        {
+            _this.tpanel = _self;
+        },
+       resize : function (_self, width, height)
+        {
+            // create and update the CSS style
+            
+            if (!_this.css) {
+                _this.css = Roo.util.CSS;
+            
+                _this.css.createStyleSheet(
+                    
+                        ".ticket-view-main .ticket-left-col {  }\n" +
+                        ".ticket-view-main .readonly-tkt-description { }\n" +
+                        ".ticket-view-main .mtrack-ticket-events {} \n"
+                    ,
+                    Roo.id()
+                );   
+                 
             }
-        };
-    }
+            var w = width - 400;
+            Roo.log("new width: " + Math.max(0,w));
+            
+            _this.css.updateRule(
+                ".ticket-view-main .ticket-left-col", 
+                    "width", Math.max(0, w) +  'px'
+            );
+             _this.css.updateRule(
+                ".ticket-view-main .readonly-tkt-description",
+                    "width", Math.max(0, w-10) +  'px'
+            );
+             _this.css.updateRule(
+                ".ticket-view-main .mtrack-ticket-events",
+                    "width", Math.max(0, w-10) +  'px'
+            );
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      toolbar : {
+       xtype : 'Toolbar',
+       xns : Roo,
+       '|xns' : 'Roo',
+       items  : [
+        {
+         xtype : 'Button',
+         text : _this._strings['b9dd47d69178dbf735bfcd2733fd4ea6'] /* Add Comment / Update */,
+         listeners : {
+          click : function (_self, e)
+           {
+               
+               
+               
+               var sels = _this.grid.getSelectionModel().getSelections();
+               if (!sels || sels.length > 1) {
+                   Roo.MessageBox.alert("Error", "Select a ticket");
+                   return;
+               }
+               var rec = sels[0];
+               
+               function ok()
+               {
+                   _this.panel.layout.getRegion('south').show();
+                   _this.panel.layout.getRegion('north').hide();
+                   _this.form.reset();
+                   
+                   _this.form.setValues({
+                       id : rec.data.id,
+                       developer_id : rec.data.developer_id,
+                       developer_id_name : rec.data.developer_id_name
+                   });
+                       
+               }
+               
+               if (_this.panel.layout.getRegion('south').isVisible() && _this.form.isDirty()) {
+                   Roo.MessageBox.confirm("Cancel", "Are you sure you want to cancel editing", function(r) {
+                       if (r !='yes') {
+                           return;
+                       }
+                       ok();    
+                       
+                   });
+                   return;
+               }
+               
+               ok();
+               
+           
+           
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        },
+        {
+         xtype : 'Button',
+         text : _this._strings['5bf7a37a56bdea44d9b2b69201e91fbd'] /* Edit original ticket */,
+         listeners : {
+          click : function (_self, e)
+           {
+                 var sels = _this.grid.getSelectionModel().getSelections();
+               if (!sels || sels.length > 1) {
+                   Roo.MessageBox.alert("Error", "Select a ticket");
+                   return;
+               }
+               var rec = sels[0];
+               
+               
+             
+               Pman.Dialog.MTrackTicket.show({ id : rec.data.id } , function(res) {
+                   // apply the data to the current row, and reload the display part..
+               
+               });
+               
+               
+               
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        },
+        {
+         xtype : 'Button',
+         text : _this._strings['d10e7195b9d5009f7b8e6bb25a099e84'] /* Add Attachment / Patch */,
+         listeners : {
+          click : function (_self, e)
+           {
+                 var sels = _this.grid.getSelectionModel().getSelections();
+               if (!sels || sels.length > 1) {
+                   Roo.MessageBox.alert("Error", "Select a ticket");
+                   return;
+               }
+               var rec = sels[0];
+               
+               Pman.Dialog.Image.show( {
+                        onid : rec.data.id,
+                        ontable : 'mtrack_ticket'
+                    } ,
+                    function(res) {
+                        // update the body part..
+               
+                   }
+               );
+               
+               
+               
+               
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        },
+        {
+         xtype : 'Button',
+         text : _this._strings['b26917587d98330d93f87808fc9d7267'] /* Subscribe */,
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        }
+       ]
+      }
+     },
+     {
+      xtype : 'ContentPanel',
+      region : 'south',
+      xns : Roo,
+      '|xns' : 'Roo',
+      toolbar : {
+       xtype : 'Toolbar',
+       xns : Roo,
+       '|xns' : 'Roo',
+       items  : [
+        {
+         xtype : 'Button',
+         text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
+         listeners : {
+          click : function (_self, e)
+           {
+              if (!_this.form.findField('status').getValue()) {
+                   Roo.MessageBox.alert("Error", "Fill in the new status");
+                   return;
+               }
+               
+              
+               _this.form.submit();
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        },
+        {
+         xtype : 'Fill',
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        },
+        {
+         xtype : 'Button',
+         text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+         listeners : {
+          click : function (_self, e)
+           {
+               _this.form.reset();
+               _this.panel.layout.getRegion('south').hide();
+               _this.panel.layout.getRegion('north').show();
+               _this.panel.layout.getRegion('north').expand();
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
+        }
+       ]
+      },
+      items  : [
+       {
+        xtype : 'Form',
+        method : 'POST',
+        style : 'margin:10px;',
+        url : baseURL + '/Roo/mtrack_ticket.php',
+        listeners : {
+         actioncomplete : function(_self,action)
+          {
+              if (action.type == 'setdata') {
+                 //_this.dialog.el.mask("Loading");
+                 //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                 return;
+              }
+              if (action.type == 'load') {
+           
+                  return;
+              }
+              if (action.type =='submit') {
+              
+                   // refresh body..
+                  
+                   
+                   var sm = _this.grid.getSelectionModel();
+          
+                  sm.fireEvent('afterselectionchange', sm);
+          
+                    
+                   // hide stuff.
+          
+                   _this.panel.layout.getRegion('south').hide();
+                   _this.panel.layout.getRegion('north').show();
+                   _this.panel.layout.getRegion('north').expand();
+                   
+                   _this.form.reset();
+                   return;
+              }
+          },
+         rendered : function (form)
+          {
+              _this.form= form;
+          }
+        },
+        xns : Roo.form,
+        '|xns' : 'Roo.form',
+        items  : [
+         {
+          xtype : 'Row',
+          width : 900,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          items  : [
+           {
+            xtype : 'Column',
+            labelAlign : 'top',
+            width : 500,
+            xns : Roo.form,
+            '|xns' : 'Roo.form',
+            items  : [
+             {
+              xtype : 'TextArea',
+              fieldLabel : _this._strings['ef6703d6c606526cece4a9eda9d49045'] /* Your comment */,
+              height : 100,
+              name : 'reason',
+              width : 400,
+              xns : Roo.form,
+              '|xns' : 'Roo.form'
+             }
+            ]
+           },
+           {
+            xtype : 'Column',
+            labelAlign : 'right',
+            labelWidth : 160,
+            width : 400,
+            xns : Roo.form,
+            '|xns' : 'Roo.form',
+            items  : [
+             {
+              xtype : 'ComboBox',
+              allowBlank : true,
+              alwaysQuery : true,
+              displayField : 'name',
+              editable : false,
+              emptyText : _this._strings['7e5ddb4ca31c30e778f4d9c57b9577b1'] /* Change Status */,
+              fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+              forceSelection : true,
+              hiddenName : 'status',
+              listWidth : 300,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+              minChars : 2,
+              name : 'status_name',
+              qtip : _this._strings['7e5ddb4ca31c30e778f4d9c57b9577b1'] /* Change Status */,
+              queryParam : 'query[name]',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-combo-list-item \">{display_name_mixed} </div>',
+              triggerAction : 'all',
+              typeAhead : true,
+              valueField : 'id',
+              width : 200,
+              xns : Roo.form,
+              '|xns' : 'Roo.form',
+              store : {
+               xtype : 'Store',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'id' },
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                     o.params['query[ticket_change]'] = _this.form.findField('id').getValue();
+                 },
+                load : function (_self, records, options)
+                 {
+                     var cs = _this.grid.getSelectionModel().getSelectedCell();
+                     var status  = _this.grid.ds.getAt(cs[0]).data.status;
+                     
+                     Roo.each(records, function(r) {
+                         
+                         if (r.data.id == status) {
+                             r.set('name', "No Change");
+                             return;
+                         }
+                         
+                         // me... ??
+                         
+                         // 
+                         if (r.data.etype == 'resolution') {
+                             r.set('name',   "Close as " + r.data.name);
+                             return;
+                         }
+                         r.set('name',  'Change to ' + r.data.name);
+                     });
+                 }
+               },
+               xns : Roo.data,
+               '|xns' : 'Roo.data',
+               proxy : {
+                xtype : 'HttpProxy',
+                method : 'GET',
+                url : baseURL + '/Roo/Mtrack_ticket.php',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
+               },
+               reader : {
+                xtype : 'JsonReader',
+                fields : [{"name":"id","type":"int"},{"name":"display_name_mixed","type":"string"}, 'name'],
+                id : 'id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
+               }
+              }
+             },
+             {
+              xtype : 'ComboBox',
+              allowBlank : true,
+              alwaysQuery : true,
+              displayField : 'name',
+              editable : false,
+              emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
+              fieldLabel : _this._strings['a3edc4e7beafdcd450f339ec414b7508'] /* Developer / Action Required By */,
+              forceSelection : true,
+              hiddenName : 'developer_id',
+              listWidth : 400,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+              minChars : 2,
+              name : 'developer_id_name',
+              qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
+              queryParam : 'query[name]',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt;</div>',
+              triggerAction : 'all',
+              typeAhead : true,
+              valueField : 'id',
+              width : 200,
+              xns : Roo.form,
+              '|xns' : 'Roo.form',
+              store : {
+               xtype : 'Store',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'name' },
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                     o.params['query[ticket_id]'] =_this.grid.sm.getSelected().data.id;
+                     
+                     o.params['query[project_id]']= _this.grid.sm.getSelected().data.project_id;
+                     o.params._anyrole = 1;
+                     
+                     o.params.limit = 999;
+                 }
+               },
+               xns : Roo.data,
+               '|xns' : 'Roo.data',
+               proxy : {
+                xtype : 'HttpProxy',
+                method : 'GET',
+                url : baseURL + '/Roo/core_person.php',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
+               },
+               reader : {
+                xtype : 'JsonReader',
+                fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+                id : 'id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
+               }
+              }
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Hidden',
+          name : 'id',
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }
+  };  }
 });