1 //<script type="text/javascript">
4 Pman.on('beforeload', function()
6 // case 1 : Pman.Tab.Projects.add(this.mainLayout, 'west'); break;
9 if (!Pman.hasPerm('Core.Projects_All', 'E')) {
13 modKey : '010-pman-tab-projectmgr',
14 module : Pman.Tab.ProjectsMgr,
16 parent : Pman.Tab.Admin,
17 name : "Project Manager"
23 Pman.Tab.ProjectsMgr = {
29 add : function(parentLayout, region) {
34 Pman.subMenuItems.push({
37 cls: 'x-btn-text-icon',
38 icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
40 handler : function() {
41 Pman.Dialog.CoreProject.show(
46 Pman.refreshActivePanel();
50 Pman.subMenuItems.push( new Roo.menu.Separator({
56 parentLayout.getRegion(region).showPanel(this.panel);
61 this.innerLayout = new Ext.BorderLayout(
62 parentLayout.getEl().createChild({tag:'div'}),
74 this.tab = parentLayout.add(region, new Ext.NestedLayoutPanel(
75 this.innerLayout, {title: "Projects", background: true}));
77 this.tab.on('activate', function() {
78 // console.log('activate');
79 _this.delayedCreate();
80 _this.paging.onClick('refresh');
83 delayedCreate : function()
89 this.innerLayout.beginUpdate();
90 var refreshPager = function() {
91 _this.paging.onClick('refresh');
94 var frm = this.innerLayout.getEl().createChild({tag:'div'});
95 //this.grid = new Ext.grid.EditorGrid(frm, {
96 this.grid = new Ext.grid.Grid(frm, {
97 id: 'grid-projectsmgr',
98 ds: new Ext.data.Store({
100 proxy: new Ext.data.HttpProxy({
101 url: baseURL + '/Roo/Projects.php',
105 reader: Pman.Readers.Projects,
109 beforeload: function(t, o) {
110 //console.log(o.params);
112 o.params = o.params ? o.params : {};
113 o.params['query[project_search]'] = _this.searchBox.getValue();
114 o.params['query[project_filter]'] = _this.filter;
118 loadexception : Pman.loadException
122 field: 'code', direction: 'DESC'
125 cm: new Ext.grid.ColumnModel(
128 // id : 'Projects-type',
133 renderer : function(v)
135 return _this.typeToString(v)
140 // id : 'Projects-code',
147 // id : 'Projects-name',
148 header : "Project Name",
154 // id : 'Projects-name',
156 dataIndex : 'client_id_name',
161 // id : 'Projects-name',
163 dataIndex : 'team_id_name',
170 id : 'projects-remarks',
172 dataIndex : 'remarks',
177 autoExpandColumn: 'projects-remarks' , // fixme!!!!
184 rowdblclick : function(g, ri, e) {
185 var s = g.getDataSource().getAt(ri).data;
187 _dialog.show(s, refreshPager);
192 this.panel = this.innerLayout.add('center', new Ext.GridPanel(this.grid ,
193 { fitToframe: true,fitContainer: true })
196 var gridFoot = this.grid.getView().getFooterPanel(true);
197 this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
203 var grid = this.grid;
205 var gridHead = this.grid.getView().getHeaderPanel(true);
206 var tb = new Ext.Toolbar(gridHead);
209 this.searchBox = new Ext.form.TextField({
213 specialkey : function(f,e)
216 if (e.getKey() == 13) {
228 var _dialog = Pman.Dialog.CoreProject;
232 cls: 'x-btn-text-icon',
233 icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
234 handler : function(){
235 _dialog.show( { id: 0 }, refreshPager);
240 cls: 'x-btn-text-icon',
241 icon: Ext.rootURL + 'images/default/tree/leaf.gif',
243 handler : function(){
244 var s = grid.getSelectionModel().getSelections();
245 if (!s.length || (s.length > 1)) {
246 Ext.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
249 _dialog.show(s[0].data, refreshPager);
257 icon: rootURL + '/Pman/templates/images/search.gif', // icons can also be specified inline
260 handler : function () {
261 //_this.grid.getSelectionModel().clearSelections();
268 icon: rootURL + '/Pman/templates/images/edit-clear.gif', // icons can also be specified inline
270 qtip: "Reset Search",
271 handler : function () {
272 _this.searchBox.setValue('');
273 //_this.grid.getSelectionModel().clearSelections();
281 toggleGroup : 'pgrp',
284 toggleHandler : function(b, st) { if (st) { _this.filter = 'P,N,U'; } refreshPager();}
288 toggleGroup : 'pgrp',
291 toggleHandler : function(b, st) { if (st) { _this.filter = 'P,U'; } refreshPager();}
294 text: "Non-Projects",
295 toggleGroup : 'pgrp',
298 toggleHandler : function(b, st) { if (st) { _this.filter = 'N'; } refreshPager();}
302 toggleGroup : 'pgrp',
305 toggleHandler : function(b, st) { if (st) { _this.filter = 'X,C'; } refreshPager();}
312 // add stuff to toolbar?
313 this.innerLayout.endUpdate();
315 // _this.paging.onClick('refresh');
318 show: function (parentLayout, region)
320 this.add(parentLayout, region);
321 this.grid.getDataSource().load({
332 //return Pman.Dialog.Projects.getTypes();
333 // we need to decide where this list goes..
335 [ 'U' , "Project (Unconfirmed)" ],
337 [ 'C' , "Project (Closed)" ],
338 [ 'N' , "Non-Project" ],
339 [ 'X' , "Non-Project (Closed)" ]
343 typeToString : function(v)
345 var ar = this.getTypes();
347 Ext.each(ar, function(a) {