#set ($NA = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.na"))) #set ($EDIT_STORY_MENU = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.editstorymenu"))) #set ($COPY_STORY_MENU = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.copystorymenu"))) #set ($DELETE_STORY_MENU = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.deletestorymenu"))) #set ($ADD_STORY_MENU = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.addstorymenu"))) #set ($TEMPLATE_TEXT = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "BacklogTable", "backlogtable.templatetext"))) #set ($NAME = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.name"))) #set ($START_DATE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.startdate"))) #set ($END_DATE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.enddate"))) #set ($STATUS = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.status"))) #set ($LINK = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.link"))) #set ($DIALOG_TITLE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.dialogtitle"))) #set ($DESCRIPTION = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.description"))) #set ($PLANNED_CAPACITY = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.plannedcapacity"))) #set ($SAVE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.save"))) #set ($CANCEL = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.cancel"))) #set ($ADD_TITLE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.addtitle"))) #set ($EDIT_TITLE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.edittitle"))) #set ($LOAD_WAIT = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.loadwait"))) #set ($SAVE_WAIT = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.savewait"))) #set ($ERROR_TITLE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.errortitle"))) #set ($BLANK_ENTRY = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.blankentry"))) #set ($INVALID_START_DATE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.invalidstartdate"))) #set ($INVALID_END_DATE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.invalidenddate"))) #set ($INVALID_ENTRIES = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.invalidentries"))) #set ($SAVE_ERROR_TITLE = $CommonFunctions.encodeJavaScriptString($CommonFunctions.getTermFromResourceBundle($currentUserId, "GSprintDialog", "gsprintdialog.saveerrortitle"))) // ---------- sprint Dialog --------- var SDLabels = { NAME: '$NAME', START_DATE: '$START_DATE', END_DATE: '$END_DATE', STATUS: '$STATUS', LINK: '$LINK', DIALOG_TITLE: '$DIALOG_TITLE', DESCRIPTION: '$DESCRIPTION', PLANNED_CAPACITY: '$PLANNED_CAPACITY', SAVE: '$SAVE', CANCEL: '$CANCEL', ADD_TITLE: '$ADD_TITLE', EDIT_TITLE: '$EDIT_TITLE', LOAD_WAIT: '$LOAD_WAIT', SAVE_WAIT: '$SAVE_WAIT', ERROR_TITLE: '$ERROR_TITLE', BLANK_ENTRY: '$BLANK_ENTRY', INVALID_START_DATE: '$INVALID_START_DATE', INVALID_END_DATE: '$INVALID_END_DATE', INVALID_ENTRIES: '$INVALID_ENTRIES', SAVE_ERROR_TITLE: '$SAVE_ERROR_TITLE' }; var sprintDialog = { init : function() { // alert('$LocaleDateFormat'); // form record sprintDialog.dlgFormRec = Ext.data.Record.create( [ { name:'sprintId' }, { name:'name' }, { name:'desc' }, { name:'startdate' }, { name:'enddate' }, { name:'plancap' }, { name:'actcap' }, { name:'remcap' }, { name:'status' }, { name:'xlinkid' } ]); // title sprintDialog.dlgTitle = new Ext.form.TextField({ autoCreate: {tag: "input", type: "text", id: "sprintDlgName"}, fieldLabel: SDLabels.NAME, name: 'name', anchor:'93%', allowBlank: false, maxLength: 36, validator : function(v) { if(v!= null && v.trim() == '') { return SDLabels.BLANK_ENTRY; } return true; } }); sprintDialog.startDate = new Ext.form.DateField({ id: "sprintDlgStartDate", xtype: 'datefield', fieldLabel: SDLabels.START_DATE, name: 'startdate', anchor: '50%', validator : sprintDialog.dateValidator, format: '$LocaleDateFormat', invalidText : SDLabels.INVALID_START_DATE }); sprintDialog.endDate = new Ext.form.DateField({ id: "sprintDlgEndDate", xtype: 'datefield', fieldLabel: SDLabels.END_DATE, name: 'enddate', anchor: '50%', validator: sprintDialog.dateValidator, format: '$LocaleDateFormat', invalidText : SDLabels.INVALID_END_DATE }); sprintDialog.sprintStatusCombo = new Ext.form.ComboBox({ autoCreate: {tag: "input", type: "combo", id: "sprintDlgStatus"}, xtype: 'combo', fieldLabel: SDLabels.STATUS, name: 'status', store: new Ext.data.SimpleStore ({ id: 0, fields: [ 'value','status'], data: [ [ SprintStatus.PLANNING.value, SprintStatus.PLANNING.status ], [ SprintStatus.ACTIVE.value, SprintStatus.ACTIVE.status ], [ SprintStatus.COMPLETED.value, SprintStatus.COMPLETED.status ] ] }), displayField: 'status', valueField: 'value', value: '', selectOnFocus: true, forceSelection : true, listClass: 'x-combo-list-small', mode: 'local', allowBlank: true, triggerAction: 'all', editable: false, autoWidth: false, anchor: '50%' }); // form control sprintDialog.dlgFormCtrl = new Ext.FormPanel({ buttonAlign: 'right', labelAlign: 'right', labelWidth: 125, frame:true, width: 480, reader: new Ext.data.JsonReader({}, sprintDialog.dlgFormRec), items: [{ layout: 'form', items: [ { xtype: 'textfield', name: 'sprintId', hidden : true, hideLabel : true, height : 0 }, sprintDialog.dlgTitle, { autoCreate: {tag: "textarea", id: "sprintDlgDesc"}, xtype: 'textarea', fieldLabel: SDLabels.DESCRIPTION, name: 'desc', anchor: '93%', height: 92, maxLength: 2000 }, sprintDialog.startDate, sprintDialog.endDate, { autoCreate: { tag: "input", type: "text", size: "20", maxlength: 4, id: "sprintDlgPlanned" }, xtype: 'numberfield', fieldLabel: SDLabels.PLANNED_CAPACITY, allowDecimals: false, allowBlank: true, allowNegative: false, name: 'plancap', anchor: '50%', maxLength: 4, maxValue: 9999 }, sprintDialog.sprintStatusCombo ] }], buttons: [{ id: 'sprintDlgSaveButton', text: SDLabels.SAVE, handler: function(){ sprintDialog.saveSprint(); } }, { id: 'sprintDlgCancelButton', text: SDLabels.CANCEL, handler: function() { sprintDialog.dialog.hide(); } }] }); // form dialog if(!sprintDialog.dialog){ sprintDialog.dialog = new Bxt.BMSWindow({ id: 'sptdlg-win', layout:'fit', width:480, height:360, closeAction:'hide', plain: true, items: sprintDialog.dlgFormCtrl, modal: true, resizable : false, closable: true, renderTo: document.body, saveFunc: sprintDialog.saveSprint, formCtrl: sprintDialog.dlgFormCtrl }); }; // Intercept backspace key on dialog var keymap = new Ext.KeyMap('sptdlg-win', { key: Ext.EventObject.BACKSPACE, fn: function(k, e) { if(!BxtUtil.handleBACKSPACEKey(k,e)) { var tid = e.getTarget().id; if( tid === 'sprintDlgStatus' || tid === 'sprintDlgLink') { // drop downs e.preventDefault(); } } } }); sprintDialog.dialog.on('show', function(){ sprintDialog.dlgTitle.getEl().dom.focus(); }, null, {delay: 100}); }, dateValidator : function() { var sdate = sprintDialog.startDate.getValue(); var edate = sprintDialog.endDate.getValue(); return !sdate || !edate || (edate.getTime() >= sdate.getTime()); }, // ---------- Add/Edit/SaveSprint ---------- addNewSprint : function(el) { sprintDialog.dialog.confirmHide = false; sprintDialog.dlgFormCtrl.form.reset(); sprintDialog.dialog.setTitle(SDLabels.ADD_TITLE); sprintDialog.dialog.show(); }, editSprint : function(sprintId) { sprintDialog.dialog.confirmHide = false; sprintDialog.dlgFormCtrl.form.reset(); sprintDialog.dialog.setTitle(SDLabels.EDIT_TITLE + ' - ' + BxtUtil.formatId(sprintId)); var spUrl = 'pbv/PBVAsyncHandler?action=LOAD-SPRINT&sprintid=' + sprintId ; sprintDialog.dlgFormCtrl.form.load({ url: spUrl, loadMask: {msg:SDLabels.LOAD_WAIT} }); sprintDialog.dialog.show(); }, saveSprint : function() { if (!sprintDialog.dlgFormCtrl.form.isValid()) { BxtUtil.showErrorMsg(SDLabels.INVALID_ENTRIES); return; } sprintDialog.dialog.confirmHide = true; var status = sprintDialog.sprintStatusCombo.getValue(); sprintDialog.dlgFormCtrl.form.submit({url:'pbv/PBVAsyncHandler', waitMsg : ' ', waitTitle : SDLabels.SAVE_WAIT, params : { action:'SAVE-SPRINT', releaseid: sprintplanningrhs.releaseCombobox.getValue(), status: status}, settings: {show: true, title:SDLabels.SAVE_ERROR_TITLE}, success : function(form, action) { sprintDialog.dialog.hide(); sprintplanningrhs.loadSprintRequirements(); }, failure:function(form, action) { sprintDialog.dialog.confirmHide = false; ErrorHandlerLib.onFormFailure(form, action); } }); } };