#parse("/focus/strings_pbx.vm") Bxt.GroupingView = function(config) { Ext.apply(this, config); Bxt.GroupingView.superclass.constructor.call(this); }; Ext.extend(Bxt.GroupingView, Ext.grid.GroupingView, {}); Ext.override(Bxt.GroupingView, { interceptMouse : function(e){ e.stopEvent(); var hd = e.getTarget('.x-grid-group-hd', this.mainBody); if(hd){ var hd1 = e.getTarget(); var hdcls = hd1.parentNode.className; if (hdcls != 'tbHover' && hdcls != '') { this.toggleGroup(hd.parentNode); } } } }); // ---------- PBV backlog ---------- var backlogtable = { gridDS : null, // main grid ds gridCtrl : null, isLoaded : false, ddTarget : null, reader : null, projectComboDS: null, projectCombobox: null, projectComboRec: null, projectComboboxLoaded: null, pbCombods : null, // backlog combo box datastore pbCombobox : null, // backlog combobox productBacklog : null, // selected backlog pbComboboxLoaded : false, toolbar : null, // toolbar addButton : null, // toolbar buttons removeButton : null, refreshButton : null, renumberButton : null, exportButton : null, contextMenu : null, // context menu contextMenuReqId : null, comboRec : null, // combo record for active backlog list and rdialog backlog list. storyRec : null, contextMenu:null, loadMask : null, init : function() { Ext.QuickTips.init(); // create requirements table backlogtable.createGrid(); // setup tool bar backlogtable.createToolbar(); // Init Backlog management backlogmgmt.init(); backlogtable.loadProjectList(); // fix for displaying 'Choose...' //backlogtable.projectCombobox.setValue(); //backlogtable.pbCombobox.setValue(); //backlogtable.loadUserSettingsProject(); backlogtable.loadMask = new Ext.LoadMask(backlogtable.gridCtrl.getEl(),{}); backlogtable.viewPort = new Ext.Viewport({ layout:'fit', items:[backlogtable.gridCtrl], renderTo: document.body }); }, createGrid: function(){ var tmpl = "" + '{[(values.rs[0].data.ranked == "1$UNRANKED_GROUP") ? "$UNRANKED_GROUP" : "$RANKED_GROUP"]}' + '{[values.rs[0].data.id.length > 1 ? " (" + values.rs.length + [ values.rs.length > 1 ? " Stories" + ")" : " Story" + ")" ] : ""]}' + ""; var v = new Bxt.GroupingView({ forceFit: true, enableGroupingMenu: false, enableNoGroups: false, hideGroupedColumn: true, showGroupName: false, enableRowBody: true, groupTextTpl: tmpl }); backlogtable.storyRec = Ext.data.Record.create([ { name: 'id' }, { name: 'name', sortType: 'asUCString' }, { name: 'status' }, { name: 'rank', type: 'float', sortType: BxtUtil.rankSort }, { name: 'size', type: 'int' }, { name: 'confidence' }, { name: 'submittedby', sortType: 'asUCString' }, { name: 'category', sortType: 'asUCString' }, { name: 'lastupdated' }, { name: 'ranked' }, { name: 'dummy' }, { name: 'sorton', type: 'float'} ]); // create table with desired columns var g = new Bxt.StoryTable({ id: 'backlogtableGrid', columns: [{ header: "ID", width: 40, sortable: false, dataIndex: 'id', renderer: TBLRender.Id }, { id: 'name', header: "$NAME", width: 200, sortable: false, dataIndex: 'name', renderer: backlogtable.renderName }, { header: "$STATUS", width: 105, sortable: false, dataIndex: 'status' }, { header: "$RANK", width: 70, hidden: true, sortable: false, dataIndex: 'rank', renderer: TBLRender.Rank }, { header: "$SIZE", width: 60, sortable: false, dataIndex: 'size', renderer: TBLRender.Number }, { header: "$CONFIDENCE", width: 70, sortable: false, dataIndex: 'confidence' } ,{ header: "$CATEGORY", width: 70, sortable: false, dataIndex: 'category' }, { header: "$SUBMITTEDBY", width: 80, sortable: false, dataIndex: 'submittedby' }, { header: "$LASTUPDATED", width: 90, sortable: false, dataIndex: 'lastupdated' }, { header: "Sorton", width: 120, sortable: false, hidden: true, dataIndex: 'sorton' }, { header: "Ranked", width: 120, sortable: false, dataIndex: 'ranked' } ], view: v, ds: new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: 'ajax2/Gemini?action=focus.web.ajax.LoadPBxBacklogTableAction&userid=$currentUserId&group=YES' }), reader: new Ext.data.JsonReader({}, backlogtable.storyRec), sortInfo: { field: 'sorton', direction: "ASC" }, groupField: 'ranked' }) }); backlogtable.editReq = new Ext.menu.Item({id: 'editReq',text: '$EDIT_STORY_MENU',handler: backlogtable.contextMenuHandler}); backlogtable.copyReq = new Ext.menu.Item({ id: 'copyReq', text: '$COPY_STORY_MENU', handler: backlogtable.contextMenuHandler }); backlogtable.deleteReq = new Ext.menu.Item({ id: 'deleteReq', text: '$DELETE_STORY_MENU', handler: backlogtable.contextMenuHandler }); backlogtable.addNewReq = new Ext.menu.Item({ id: 'addNewReq', text: '$ADD_STORY_MENU', handler: backlogtable.contextMenuHandler }); // context menu backlogtable.contextMenu = new Ext.menu.Menu(); backlogtable.contextMenu.add(backlogtable.editReq); backlogtable.contextMenu.add(backlogtable.copyReq); backlogtable.contextMenu.add(backlogtable.deleteReq); backlogtable.contextMenu.add('-'); backlogtable.contextMenu.add(backlogtable.addNewReq); g.setContextMenu(backlogtable.contextMenu); #if ($canManageBacklogs) // Dragdrop g.setDragDropHandler(backlogtable.chgDDState, backlogtable.pbxNotifyDrop, null); #end // gridCtrl property and grid store property backlogtable.gridCtrl = g; backlogtable.gridDS = g.getStore(); backlogtable.gridDS.on({ 'load': backlogtable.updateStorySize }); backlogtable.gridCtrl.addListener('rowcontextmenu', function (grid, rowIndex, e) { e.stopEvent(); var mitems = backlogtable.contextMenu.items; var sel = grid.getSelectionModel().getSelections(); var selectionCount = sel.length; var selectedRecord = backlogtable.gridDS.getAt(rowIndex); var isInSelection = false; for (i = 0; i < sel.length; i++) { var record = sel[i]; if (record.get("id") == selectedRecord.get("id")) { isInSelection = true; break; } } if (!isInSelection) { grid.getSelectionModel().selectRow(rowIndex); selectionCount = 1; } if(selectionCount <= 1) { mitems.get(0).enable(); backlogtable.selectedItem = grid.getStore().getAt(rowIndex).data; //enable/disable var id = backlogtable.selectedItem['id']; if (id != '-') { backlogtable.editReq.enable(); backlogtable.copyReq.enable(); backlogtable.deleteReq.enable(); } else { backlogtable.editReq.disable(); backlogtable.copyReq.disable(); backlogtable.deleteReq.disable(); } } else if (isInSelection) { mitems.get(0).disable(); backlogtable.editReq.disable(); backlogtable.copyReq.disable(); backlogtable.deleteReq.enable(); } #if (!$canManageStories) backlogtable.copyReq.disable(); backlogtable.deleteReq.disable(); backlogtable.addNewReq.disable(); #end var coords = e.getXY(); backlogtable.contextMenu.showAt([coords[0], coords[1]]); } ); }, renderName : function(value, p, record, rowindex, colindex, store) { //p.attr = 'ext:qtip="' + value + '"'; var reqId = backlogtable.gridDS.getAt(rowindex).get('id'); if(reqId == '-') { return ''; } return "" + value + ""; }, contextMenuHandler : function(item, e) { switch (item.id) { case 'addNewReq': backlogtable.addNewRequirement(item.getEl()); break; case 'copyReq' : var contextMenuReqId = backlogtable.gridCtrl.selectedContextMenuItem.get('id'); backlogtable.showRequirementDetails(contextMenuReqId, true, item.getEl()); break; case 'deleteReq' : backlogtable.removeButtonClicked(); break; case 'editReq' : var contextMenuReqId = backlogtable.gridCtrl.selectedContextMenuItem.get('id'); backlogtable.showRequirementDetails(contextMenuReqId, false, item.getEl()); } }, pbxNotifyDrop : function (dd, e, data) { var ddat = dd.getDragData(e); if(!ddat) { return false; } var ds = ddat.grid.getStore(); var rows = data.selections; var cindex = ddat.rowIndex; if(cindex == undefined) { return; } BxtRanks.buildPBxRankString(backlogtable.updateRankPosition, cindex, rows, ds); }, updateRankPosition : function(indexArray, rankArray, destIndex, paramString, destRecord) { backlogtable.loadMask.show(); Ext.Ajax.request({ url: 'pbv/PBVAsyncHandler?action=SAVE-RANKS', success: backlogtable.reqReinsertHandler, failure: backlogtable.saveRankFailure , settings: {show: true, msg:'Failed to update ranks.'}, localvars: {indexArray: indexArray, rankArray: rankArray, destindex: destIndex, destRecord: destRecord}, params: {start:0, limit:25, paramString: paramString, reqbacklogid: backlogtable.productBacklog} }); }, saveRankFailure : function(response, options) { backlogtable.loadMask.hide(); ErrorHandlerLib.onAjaxFailure(response,options); }, // handler to remove and re-insert a requirement reqReinsertHandler : function(response, options) { backlogtable.loadMask.hide(); if (response.responseText != undefined) { if(BxtUtil.checkErrorInResponse(response)) { return; } var indexArray = options.localvars.indexArray; var rankArray = options.localvars.rankArray; var destIndex = options.localvars.destindex; var destRecord = options.localvars.destRecord; var destIndex2 = destIndex; //alert( 'reqReinsertHandler ' + destIndex2); if (indexArray.length == rankArray.length) { var ds = backlogtable.gridDS; var removeDummy = null; var addDummy = null; var addDummyIdx = null; var dummyidx = 0; var removedDummy = false; for (i = 0; i < indexArray.length; i++) { var index = indexArray[i]; if (index < ds.indexOf(destRecord)) { index -= i; destIndex2 = destIndex -1; //alert( 'update index ' + destIndex2); } var v = ds.getAt(index); var srcidx = ds.indexOf(v); if (v.get('dummy') == '1') { continue; } var vsp = v.get('ranked'); var vInsp = ds.query('ranked', vsp); var tsp = destRecord.get('ranked'); var tInsp = ds.query('ranked', tsp); // remove story from source if (vInsp.getCount() == 1) { // create a dummy record if there are no more records for the group(ranked/unranked) after the move. // this dummy record is a place holder and cannot be drag-dropped. addDummy = new backlogtable.storyRec({ id: '-', name: '', rank: '', size: '', owner: '', ranked: vsp, dummy: '1', status: '', sorton: '0' }); addDummyIdx = srcidx; if (srcidx >= ds.indexOf(destRecord)) { addDummyIdx++; } } ds.remove(v); //alert( 'removeed ' ); // insert story to destination if (tInsp.getCount() == 1) { if (null != destRecord && destRecord.get('dummy') == '1') { // It the a dummy record, remove it before insertion a real one. removeDummy = destRecord; } } ds.insert(destIndex2, v); //alert( 'inserted ' + destIndex2); // update story attributes v.set('ranked', tsp); v.set('rank', rankArray[i]); //alert("rankArray[" + i + "] is " + rankArray[i] ); if (rankArray[i] === "") { v.set("ranked", "1$UNRANKED_GROUP");// we are using 1 char to make unranked appear first var floatId = parseFloat(BxtUtil.formatId(v.get('id'))); v.set("sorton", 0.0 - floatId); //alert("rankArray[" + i + "] is empty: sorton " + v.get('id') + ' ' + (0.0 - floatId)); } else { v.set("ranked", "$RANKED_GROUP"); v.set("sorton", rankArray[i]); //alert("sorton" + rankArray[i]); } } if (null != addDummy && null != addDummyIdx) { ds.insert(addDummyIdx, addDummy); } if (null != removeDummy) { ds.remove(removeDummy); } var state = ds.getSortState(); ds.sort(state.field ,state.direction); ds.commitChanges(); if (destRecord.get('ranked') == '$RANKED_GROUP') { for (i = 0; i < rankArray.length; i++) { if(BxtUtil.getDecimalDigits(rankArray[i]) > 7) { backlogtable.reNumberRankedRequirments(); break; } } } backlogtable.gridCtrl.view.refresh(); } else { BxtUtil.showErrorMsg('$ERROR_SPRINT_UPDATE'); } } return true; }, createBacklogToolbarCombo : function() { backlogtable.comboRec = Ext.data.Record.create( [ { name:'id' }, { name:'name', sortType:'asUCString' }, { name:'xlinkid' } ]); backlogtable.pbCombods = new Ext.data.Store({ id : 0, proxy: new Ext.data.HttpProxy({url:'ajax2/Gemini?action=focus.web.ajax.SavePBXProjectSettingAction'}), reader: new Ext.data.JsonReader({id:'id'}, backlogtable.comboRec), sortInfo:{field: 'name', direction: "ASC"} }); backlogtable.pbCombobox = new Ext.form.ComboBox({ id: 'pbx_backlogCombobox', tpl: '
{name}
', store : backlogtable.pbCombods, displayField :'name', valueField :'id', typeAhead : true, forceSelection : true, mode : 'local', emptyText :'$CHOOSE', selectOnFocus :true, //autoWidth : true, width : 220, editable : false, triggerAction : 'all', listClass :'x-combo-list-small', listeners : { select : onBacklogSelect } }); function onBacklogSelect(combo, rec, index) { backlogtable.productBacklog = rec.data.id; backlogtable.toggleAddStory(); backlogtable.loadPBxTable(backlogtable.onLoadStories); } }, createProjectToolbarCombo : function() { backlogtable.projectComboRec = Ext.data.Record.create( [ { name:'id' }, { name:'name', sortType:'asUCString' } ]); // project toolbar combo ds backlogtable.projectComboDS = new Ext.data.Store({ id : 0, proxy: new Ext.data.HttpProxy({url:'pbv/PBVAsyncHandler?action=PROJECTLIST'}), reader: new Ext.data.JsonReader({id:'id'}, backlogtable.projectComboRec), sortInfo:{field: 'name', direction: "ASC"} }); // backlog toolbar combo box backlogtable.projectCombobox = new Ext.form.ComboBox({ id: "pbx_projectCombobox", tpl: '
{name}
', store : backlogtable.projectComboDS, displayField :'name', valueField :'id', //typeAhead : true, forceSelection : true, mode : 'local', emptyText :'$CHOOSE', selectOnFocus :true, width : 220, editable : false, triggerAction : 'all', listWidth: 220, listClass :'x-combo-list-small' , listeners : { select : backlogtable.onProjectSelect, loadexception: BxtUtil.lexHandler } }); }, loadPBxTable : function(cbFunction) { if (!cbFunction) cbFunction = null; var projectCtrlId = backlogtable.projectCombobox.getValue(); var backlogCtrlId = backlogtable.pbCombobox.getValue(); backlogtable.gridDS.load({ waitMsg:'$LOADING', params:{start:0, limit:50, backlogid: backlogtable.productBacklog, group:'YES', userid:'$currentUserId', pbxprojectid: projectCtrlId, pbxbacklogid: backlogCtrlId}, callback: cbFunction }); }, onProjectSelect : function (combo, rec, index) { document.location.href = '../common/application/itimpact/loadpagepbx.html?projectId=' + rec.get('id'); }, createToolbar : function() { backlogtable.toolbar = backlogtable.gridCtrl.getTopToolbar(); backlogtable.createProjectToolbarCombo(); backlogtable.createBacklogToolbarCombo(); backlogtable.backlogMgmtButton = new Ext.Toolbar.Button( { id: 'backlogMgmtButton', iconCls: 'manage', #if (!$canManageBacklogs) disabled: true, #end text: '$MANAGE_BACKLOGS', tooltip: '$MANAGE_BACKLOGS' }); backlogtable.addButton = new Ext.Toolbar.Button({ id: 'backlogTableAddStoryButton', text:'$ADD_STORY_BUTTON_TEXT', tooltip:'$ADD_DISABLED_TOOLTIP', iconCls:'add', disabled: true }); backlogtable.removeButton = new Ext.Toolbar.Button({ text:'$DELETE_STORY_BUTTON_TEXT', tooltip:'$DELETE_DISABLED_TOOLTIP', iconCls:'remove', disabled: true }); backlogtable.exportButton = new Ext.Toolbar.Button({ text:'$EXPORT_STORIES_BUTTON_TEXT', disabled: true, tooltip:'$EXPORT_DISABLED_TOOLTIP', iconCls:'export' }); backlogtable.storySizeText = new Ext.Toolbar.TextItem(''); backlogtable.refreshButton = new Ext.Toolbar.Button({ id: 'backlogTableRefreshButton', text:'$REFRESH', tooltip:'$REFRESH_TITLE', iconCls:'refresh' }); backlogtable.backlogMgmtButton.on('click', function() { backlogmgmt.showBacklogMgmtDialog(backlogtable.backlogMgmtButton.getEl()); }); backlogtable.addButton.on('click', function(){ if(backlogtable.productBacklog == null || backlogtable.productBacklog == "") { return; } backlogtable.addNewRequirement(backlogtable.addButton.getEl()); }); backlogtable.removeButtonClicked = function() { var selections = backlogtable.gridCtrl.selModel.getSelections(); var selectlen = selections.length; if(selectlen > 0) { var title = ''; var msg = ''; if(selectlen == 1) { var srow = selections[0]; var story = BxtUtil.formatId(srow.get('id')) + ': ' + srow.get('name'); msg = '$DELETE_STORY_MSG' + '

' + story; title = '$DELETE_STORY_TITLE'; } else { msg = '$DELETE_STORIES_MSG'; title = '$DELETE_STORIES_TITLE'; } Ext.Msg.show({ title:title, msg: '' + msg + '', buttons: Ext.Msg.YESNO, fn: backlogtable.onRemove, icon: Ext.MessageBox.QUESTION, animEl : backlogtable.removeButton.getEl() }); } } backlogtable.removeButton.on('click', function(){ backlogtable.removeButtonClicked(); }); backlogtable.refreshButton.on('click', function(){ //backlogtable.loadProjectList(); backlogtable.loadPBxTable(backlogtable.onLoadStories); }); backlogtable.refreshPBx = function() { backlogtable.projectCombobox.setValue() backlogtable.loadProjectList(); } backlogtable.exportButton.on('click', function(){ var pId = backlogtable.projectCombobox.getValue(); var bId = backlogtable.pbCombobox.getValue(); exportStoryDialog.showExportStoryDialog(pId,bId); }); backlogtable.toolbar.add(new Ext.Toolbar.TextItem('$PROJECT:')); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.add(backlogtable.projectCombobox); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.add(new Ext.Toolbar.TextItem('$BACKLOG:')); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.addSpacer(); backlogtable.toolbar.add(backlogtable.pbCombobox); backlogtable.toolbar.add('->'); backlogtable.toolbar.add(backlogtable.addButton); backlogtable.toolbar.add(backlogtable.removeButton); backlogtable.toolbar.add(backlogtable.refreshButton); backlogtable.toolbar.add(backlogtable.exportButton); backlogtable.gridCtrl.getBottomToolbar().add( backlogtable.backlogMgmtButton ); backlogtable.gridCtrl.getBottomToolbar().addSpacer(); backlogtable.gridCtrl.getBottomToolbar().addSpacer(); backlogtable.gridCtrl.getBottomToolbar().add('->'); backlogtable.gridCtrl.getBottomToolbar().add( backlogtable.storySizeText); }, onRemove : function(val) { if(val == 'yes'){ var selections = backlogtable.gridCtrl.selModel.getSelections(); var ids = ""; for (i = 0; i < selections.length; i++) { var record = selections[i]; if (ids != "") { ids += ","; } ids += record.data.id; } backlogtable.gridDS.load({ waitMsg: '$DELETING', params:{start:0, limit:25, backlogid: backlogtable.productBacklog, group:'YES', subaction: 'DELETE', deleteids:ids}, callback: backlogtable.onLoadStories}); } }, // ----- project combobox loading with user settings ----- loadProjectList : function() { backlogtable.projectComboDS.load({ waitinMsg:'$LOADING', params:{start:0, limit: 30}, callback: backlogtable.projectsLoaded}); }, projectsLoaded : function(rec, options, success) { if(!success) { BxtUtil.showErrorMsg('$PROJECT_LIST_LOAD_ERROR'); return; } if (rec.length == 1) { backlogtable.setProjectValue(rec[0].get('id')); } else { backlogtable.loadUserSettingsProject(); } }, loadUserSettingsProject : function() { BxtUserSettings.load('$_FOCUS_PBV_VIEW', '$_FOCUS_PROJECT_SELECTION', backlogtable.setProjectSettingValue, null); }, setProjectSettingValue : function(response, options) { var r = Ext.decode(response.responseText); backlogtable.setProjectValue(r.selection); }, setProjectValue : function(sel) { var cb = backlogtable.projectCombobox; var ret = BxtUserSettings.setComboboxValue(cb, sel); if( ret == BxtUserSettings.cbNEW) { backlogtable.pbCombobox.clearValue(); backlogtable.gridDS.removeAll(); backlogtable.loadBacklogList(); } else if( ret == BxtUserSettings.cbSET) { backlogtable.loadUserSettingsBacklog(); } }, // ----- backlog combobox loading with user settings ----- loadBacklogList : function() { var pId = backlogtable.projectCombobox.getValue(); if ( pId != '') { backlogtable.pbCombods.load({ waitMsg:'$LOADING', params:{start:0, limit:25, projectid: pId, userId:'$currentUserId', viewId:'$_FOCUS_PBV_VIEW', keyId:'$_FOCUS_PROJECT_SELECTION', selection: pId }, callback: backlogtable.updaterdlgBklogCombods }); } }, updaterdlgBklogCombods : function(rec, options, success) { if(success) { if(rec.length == 1) { var backlogid = rec[0].get('id'); backlogtable.setBacklogValue(rec[0].get('id')); } else if(rec.length < 1) { backlogtable.productBacklog = null; backlogtable.gridDS.removeAll(); backlogtable.pbCombobox.setValue(); backlogtable.toggleAddStory(); } else { backlogtable.loadUserSettingsBacklog(); } } else { BxtUtil.showErrorMsg('$BACKLOG_LIST_LOAD_ERROR'); } }, loadUserSettingsBacklog : function() { if (backlogtable.pbCombods.getCount() == 1) { var backlogId = backlogtable.pbCombods.getAt(0).get('id'); backlogtable.setBacklogValue(backlogId); backlogtable.selBacklog = backlogId; } else { BxtUserSettings.load('$_FOCUS_PBV_VIEW', '$_FOCUS_BACKLOG_SELECTION', backlogtable.setBacklogSettingValue, null); } }, setBacklogSettingValue : function(response, options) { var r = Ext.decode(response.responseText); backlogtable.setBacklogValue(r.selection); }, setBacklogValue : function(selection) { var cb = backlogtable.pbCombobox; var ret = BxtUserSettings.setComboboxValue(cb, selection); if( ret == BxtUserSettings.cbNEW) { backlogtable.productBacklog = selection; } else if( ret == BxtUserSettings.cbNONE) { backlogtable.productBacklog = null; backlogtable.gridDS.removeAll(); cb.setValue(); } else { cb.setValue(selection); } if (ret == BxtUserSettings.cbNEW) { backlogtable.loadPBxTable(backlogtable.onLoadStories); } backlogtable.toggleAddStory(); }, onLoadStories : function(rec, options, success) { if(!success){ BxtUtil.showErrorMsg("Error in loading stories from the server. If the problem persists, please contact your system administrator."); backlogtable.gridDS.removeAll(); } }, toggleAddStory : function() { var addBtn = backlogtable.addButton; var removeBtn = backlogtable.removeButton; var exportButton = backlogtable.exportButton; var refreshButton = backlogtable.refreshButton; #if (!$canManageStories) addBtn.setDisabled(true); addBtn.getEl().child(addBtn.buttonSelector).dom[addBtn.tooltipType] = ''; removeBtn.setDisabled(true); removeBtn.getEl().child(removeBtn.buttonSelector).dom[removeBtn.tooltipType] = ''; exportButton.setDisabled(true); exportButton.getEl().child(exportButton.buttonSelector).dom[exportButton.tooltipType] = ''; #else var productBacklog = backlogtable.productBacklog; if (productBacklog == null || productBacklog == '') { addBtn.getEl().child(addBtn.buttonSelector).dom[addBtn.tooltipType] = '$ADD_DISABLED_TOOLTIP'; addBtn.setDisabled(true); removeBtn.getEl().child(removeBtn.buttonSelector).dom[removeBtn.tooltipType] = '$DELETE_DISABLED_TOOLTIP'; removeBtn.setDisabled(true); exportButton.getEl().child(exportButton.buttonSelector).dom[exportButton.tooltipType] = '$EXPORT_DISABLED_TITLE'; exportButton.setDisabled(true); refreshButton.getEl().child(refreshButton.buttonSelector).dom[refreshButton.tooltipType] = ''; refreshButton.setDisabled(true); } else { addBtn.getEl().child(addBtn.buttonSelector).dom[addBtn.tooltipType] = '$ADD_STORY_TITLE'; addBtn.setDisabled(false); removeBtn.getEl().child(removeBtn.buttonSelector).dom[removeBtn.tooltipType] = '$DELETE_STORY_TITLE'; removeBtn.setDisabled(false); exportButton.getEl().child(exportButton.buttonSelector).dom[exportButton.tooltipType] = '$EXPORT_STORIES_TITLE'; exportButton.setDisabled(false); refreshButton.getEl().child(refreshButton.buttonSelector).dom[refreshButton.tooltipType] = '$REFRESH_TITLE'; refreshButton.setDisabled(false); } #end }, // ---------- Edit Requirement ---------- showRequirementDetails : function(reqId, copy, el) { backlogtable.setupStoryDialog(); storyDialog.showRequirementDetails(reqId, copy, el, backlogtable.loadMask); }, setupStoryDialog : function() { storyDialog.resetDialog(); storyDialog.projectId = backlogtable.projectCombobox.getValue(); storyDialog.productBacklog = backlogtable.productBacklog; storyDialog.saveSuccessHandlerFn = backlogtable.reloadRequirements; storyDialog.tabx = 'pbx'; }, reloadRequirements : function() { backlogtable.loadPBxTable(); }, // ---------- Add Requirement ---------- addNewRequirement : function(el) { backlogtable.setupStoryDialog(); storyDialog.addNewRequirement(el, backlogtable.loadMask); }, // ---------- Delete Requirement ---------- onDeleteRequirement : function(reqId, name, el) { var story =BxtUtil.formatId(reqId) + ': ' + name; Ext.Msg.show({ title:'$DELETE_STORY_TITLE', msg: '$DELETE_STORY_MSG
' + story +'
', buttons: Ext.Msg.YESNO, fn: backlogtable.deleteRequirement, icon: Ext.MessageBox.QUESTION, animEl : el }); }, deleteRequirement : function(val) { if(val == 'yes'){ backlogtable.gridDS.load({waitMsg:'$DELETING', params:{start:0, limit:25, backlogid: backlogtable.productBacklog,group:'YES', subaction: 'DELETE', deleteids:backlogtable.contextMenuReqId}, callback: backlogtable.onLoadStories}); } }, chgDDState : function ( grid, columnIndex, evt) { var ddt = backlogtable.gridCtrl.ddTarget; if(columnIndex == 3) { // rank ddt.unlock(); } else { ddt.lock(); // disable drop target } }, reNumberRankedRequirments : function() { var ds = backlogtable.gridDS; var count = ds.getCount(); var index = 1; var paramString = ""; for (i = 0; i < count; i++) { var rec = ds.getAt(i); var ranked = rec.get('ranked'); if (ranked == '$RANKED_GROUP') { if (paramString != "") { paramString += "|" ; } var reqId = rec.get('id'); paramString += reqId + "," + index; rec.set('rank',index); rec.set('sorton', index); index ++; } } if (paramString.length > 0) { ds.commitChanges(); backlogtable.loadMask.show(); Ext.Ajax.request({ url: 'pbv/PBVAsyncHandler?action=SAVE-RANKS', success: backlogtable.reNumberSuccess, failure: backlogtable.saveRankFailure, settings: {show: true, msg:'Failed to save rank.'}, params: { start: 0, limit: 25, paramString: paramString, reqbacklogid: backlogtable.productBacklog } }); } }, reNumberSuccess : function(response, options) { backlogtable.loadMask.hide(); }, checkStatus : function(rec, options, success) { if(!success) { BxtUtil.showErrorMsg('Error in saving newly set rank.'); return; } if(rec.length == 1) { var success = rec[0].get('success'); if((success != undefined) && (!success)) { var mdat = rec[0].get('data'); BxtUtil.showErrorMsg(mdat[0].msg); } } }, updateStorySize: function(){ var ds = backlogtable.gridDS; var count =backlogtable.gridDS.getCount(); var str = ""; var sum = ""; if(count>0) { sum = ds.sum('size',0,count-1); str = "$STORY_SIZE: " ; } //backlogtable.storySizeText.destroy(); backlogtable.storySizeText = new Ext.Toolbar.TextItem(''+ str + '' + sum + ''); backlogtable.gridCtrl.getBottomToolbar().add( backlogtable.storySizeText); }, //WATIR support //used by watir rankToBottom : function(storyid) { return backlogtable.rankUnRankStory(storyid,'$RANKED_GROUP','9999'); }, //used by watir unrankStory : function(storyid) { return backlogtable.rankUnRankStory(storyid,'1$UNRANKED_GROUP','') ; }, //used by watir rankUnRankStory : function(storyid,group,newrank) { var ds = backlogtable.gridCtrl.getStore(); var paramString = ''; var rankArray = new Array(1); var indexArray = new Array(1); rankArray[0] = newrank; var destIndex = 0; var destRecord; var bfound = false; for(var i=0; i < ds.getCount(); i++) { var rec = ds.getAt(i); var story_id = rec.get('id'); if(storyid == story_id ) { indexArray[0] = i; paramString = story_id + "," + rankArray[0]; backlogtable.gridCtrl.selModel.selectRow(i,true ); bfound = true; } var ranked = rec.get('ranked'); if (ranked == group) { destIndex = i; destRecord = rec; } } if(bfound ) { backlogtable.updateRankPosition(indexArray, rankArray, destIndex, paramString, destRecord) ; } return; } };