#set ($SAVE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.save"))) #set ($CANCEL = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.cancel"))) #set ($CLOSE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstacledialog.close"))) #set ($NAME = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.name"))) #set ($ACTIONS = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.actions"))) #set ($ASSIGNED_TO = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.assignedto"))) #set ($STATUS = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.status"))) #set ($TASKID = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstacledialog.taskid"))) #set ($ADD_TOOLTIP = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.addtooltip"))) #set ($DELETE_TOOLTIP = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.deletetooltip"))) #set ($ADD= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.addlabel"))) #set ($DELETE= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.removelabel"))) #set ($TITLE= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.title"))) #set ($ACTIVE_TOOLTIP= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "obstacle.status.000000000001.tooltip"))) #set ($RESOLVED_TOOLTIP= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "obstacle.status.000000000002.tooltip"))) #set ($ACTIVATE_TOOLTIP= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "obstacle.status.activate.tooltip"))) #set ($RESOLVE_TOOLTIP= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "obstacle.status.resolve.tooltip"))) #set ($DELETE_OBSTACLE_MSG= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.deleteobstaclemsg"))) #set ($DELETE_OBSTACLE_TITLE= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.deleteobstacletitle"))) #set ($SPRINT_BLOCKERS= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.sprintobstaclecount"))) #set ($TASK_BLOCKERS= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.taskobstaclecount"))) #set ($OBSTACLE_COUNT= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.obstaclecount"))) #set ($LOAD_OBSTACLE_ERROR= $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "gobstacledialog", "gobstaclemgmt.loaderror"))) var OB_MGMT_Labels = { SAVE: '$SAVE', CANCEL: '$CANCEL', CLOSE: '$CLOSE', NAME: '$NAME', STATUS: '$STATUS', ASSIGNED_TO: '$ASSIGNED_TO', ACTIONS: '$ACTIONS', OBSTACLE: '$OBSTACLE', ADD_TOOLTIP:'$ADD_TOOLTIP', DELETE_TOOLTIP:'$DELETE_TOOLTIP', ADD:'$ADD', DELETE:'$DELETE', TITLE:'$TITLE', ACTIVE_TOOLTIP:'$ACTIVE_TOOLTIP', RESOLVED_TOOLTIP:'$RESOLVED_TOOLTIP', ACTIVATE_TOOLTIP:'$ACTIVATE_TOOLTIP', RESOLVE_TOOLTIP:'$RESOLVE_TOOLTIP', TASKID:'$TASKID' } // HTMLComponent - An extension of BoxComponent to allow inline HTML // while preserving lazy rendering Ext.HTMLComponent = function(config) { Ext.apply(this,config); Ext.HTMLComponent.superclass.constructor.call(this); this.on('beforerender',function() { if ( !this.el ) { this.el = Ext.DomHelper.append(Ext.getBody(),{ tag:'div', html:this.html },true); } return true; },this); } Ext.extend(Ext.HTMLComponent,Ext.BoxComponent); var obstaclemgmt = { bResetTeamboard: false, selectedSprintId: null, selectedObstacleId: null, selectedTaskId:null, selectedProjectId: null, saveSuccessHandlerFn:null, mgmtDialog : null, ds : null, gridCtrl : null, addButton : null, removeButton : null, topText : null, init : function() { obstaclemgmt.createMgmtDialog(); }, // ---------- Obstacle Management Dialog ---------- createMgmtDialog : function() { obstaclemgmt.rec = Ext.data.Record.create( [ { name:'obstacleId' }, { name:'name' }, { name:'desc' }, { name:'status' }, { name:'tasks' }, { name:'taskstext' }, { name:'taskcount' }, { name:'statustext' }, { name:'assignedto' }, { name:'assignedtotext' }, { name:'sprintblocker' }, { name:'resolution' }, { name: 'warningMsg'}, { name: 'errorcodes'}, {name: 'repositoryid'} ]); obstaclemgmt.reader = new Ext.data.JsonReader({}, obstaclemgmt.rec); var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'pbv/PBVAsyncHandler?action=LOAD-OBSTACLES'}), reader: obstaclemgmt.reader, sortInfo:{field: 'status', direction: "ASC"}, listeners : { load : obstaclemgmt.updateTopText } }); ds.on('load', obstaclemgmt.loadHandler); ds.on('loadexception', obstaclemgmt.httpLexHandler); obstaclemgmt.ds = ds; obstaclemgmt.gridCtrl = new Ext.grid.GridPanel({ ds: obstaclemgmt.ds, autoExpandColumn: 'name', autoExpandMin: 100, columns: [ {header: "ID", width: 40, sortable: true, dataIndex: 'obstacleId', renderer: TBLRender.Id }, {id:'name',header: OB_MGMT_Labels.NAME, width: 75, sortable: true, dataIndex: 'name', renderer: obstaclemgmt.renderName }, {header: OB_MGMT_Labels.TASKID, width:90, sortable: true, dataIndex: 'tasks', renderer:obstaclemgmt.renderTaskID }, {header: OB_MGMT_Labels.STATUS, width:60, sortable: true, dataIndex: 'status', renderer:obstaclemgmt.renderStatus }, {header: OB_MGMT_Labels.ASSIGNED_TO, width: 130, sortable: true, dataIndex: 'assignedtotext',renderer: obstaclemgmt.renderUser }, {header: OB_MGMT_Labels.ACTIONS, width: 55, sortable: true, dataIndex: 'status' ,renderer: obstaclemgmt.renderAction} ], loadMask: {msg: '$LOADING'}, frame:true, collapsible: false, animCollapse: false, tbar: [], bbar: [], layout:'fit', headerAsText:false, renderTo: document.body }); if(!obstaclemgmt.mgmtDialog) { obstaclemgmt.addButton = new Ext.Button({id: 'addPBlButton', text:OB_MGMT_Labels.ADD, tooltip:OB_MGMT_Labels.ADD_TOOLTIP, iconCls: 'add'}); obstaclemgmt.addButton.on('click', function() { obstaclemgmt.onAddNewObstacle(obstaclemgmt.addButton.getEl()); }); obstaclemgmt.removeButton = new Ext.Button({text:OB_MGMT_Labels.DELETE, tooltip:OB_MGMT_Labels.DELETE_TOOLTIP, iconCls: 'remove'}); obstaclemgmt.removeButton.on('click', function() { var selections = obstaclemgmt.gridCtrl.selModel.getSelections(); var selectlen = selections.length; if(selectlen > 0) { var msg = '$DELETE_OBSTACLE_MSG'; Ext.Msg.show({ title: '$DELETE_OBSTACLE_TITLE', msg: '' + msg +'', buttons: Ext.Msg.OKCANCEL, fn: obstaclemgmt.onRemoveObstacle, icon: Ext.MessageBox.QUESTION, animEl : obstaclemgmt.removeButton.getEl() }); } }); // Toolbar var toolbar = obstaclemgmt.gridCtrl.getTopToolbar(); obstaclemgmt.topText = new Ext.Toolbar.TextItem(); toolbar.add(obstaclemgmt.topText); toolbar.add('->'); toolbar.add( obstaclemgmt.addButton ); toolbar.add( obstaclemgmt.removeButton ); obstaclemgmt.mgmtDialog = new Ext.Window({ title: '' + OB_MGMT_Labels.TITLE +'', width:700, height:300, closeAction:'hide', plain: true, items: obstaclemgmt.gridCtrl, modal: true, resizable : true, closable: true, layout: 'fit', renderTo: document.body, buttons:[{ text: OB_MGMT_Labels.CLOSE ,handler:function(){ obstaclemgmt.mgmtDialog.hide() } }] }); } }, httpLexHandler : function(proxy, store, response, e) { }, loadHandler : function(store, records, opts) { var errorHandled = false; if(records.length == 1 && (records[0].json.success != undefined)) { if(!records[0].json.success) { errorHandled = true; var msg = records[0].json.data[0].msg; store.removeAll(); store.commitChanges(); BxtUtil.showErrorMsg( msg + ' If the problem persists, please contact your administrator.'); } } if (!errorHandled) { ErrorHandlerLib.OnStoreLoad(store, records, opts, '$LOAD_OBSTACLE_ERROR'); } obstaclemgmt.updateTopText(store, records, opts); }, updateTopText : function(ds, records, opts) { // var sprintblockers = 0; for (var i = 0; i < ds.getCount(); i++) { var record = ds.getAt(i); if( record.data.sprintblocker) { sprintblockers++; } } // calculate and update obstacle count. var text =''; if (obstaclemgmt.selectedTaskId != null) text = '$TASK_BLOCKERS' + ' ' + ds.getCount() + ' '; else { if (sprintblockers>0) { text = '$SPRINT_BLOCKERS' + ' ' + sprintblockers + ' '; } else { text = '$OBSTACLE_COUNT' + ' ' + ds.getCount() + ' '; } } obstaclemgmt.topText.getEl().innerHTML = text; }, renderStatus: function(value, p, record, rowindex, colindex, store) { var status = obstaclemgmt.ds.getAt(rowindex).get('status'); var statustext = obstaclemgmt.ds.getAt(rowindex).get('statustext'); var id = obstaclemgmt.ds.getAt(rowindex).get('obstacleId'); if (OBStatuses.ACTIVE == status) { //Active return "