dojo.require("dojo.string"); var _THIS_dateFrom=""; var _THIS_dateTo=""; var _THIS_toggler = new hts_toggler(); var _THIS_changedParams; var _THIS_utils = new hts_utils(); var _THIS_menu_strings = new Object(); var _THIS_revert_taskInfo_evt; _THIS_menu_strings["CREATED"] = ''; _THIS_menu_strings["READY"] = ''; _THIS_menu_strings["RESERVED"] = ''; _THIS_menu_strings["IN_PROGRESS"] = ''; _THIS_menu_strings["SUSPENDED"] = ''; _THIS_menu_strings["COMPLETED"] = ''; _THIS_menu_strings["FAILED"] = ''; _THIS_menu_strings["ERROR"] = ''; _THIS_menu_strings["EXITED"] = ''; _THIS_menu_strings["OBSOLETE"] = ''; //Default all to true var _THIS_properties = new Array(); _THIS_properties.push({name:"showSubject",value:'true'}); _THIS_properties.push({name:"showCreator",value:'true'}); _THIS_properties.push({name:"showOwner",value:'true'}); _THIS_properties.push({name:"allowOwnerEdits",value:'true'}); _THIS_properties.push({name:"showHumanRoles",value:'true'}); _THIS_properties.push({name:"allowHumaneRoleEdits",value:'true'}); _THIS_properties.push({name:"showDueDate",value:'true'}); _THIS_properties.push({name:"showStartBy",value:'true'}); _THIS_properties.push({name:"showStatus",value:'true'}); _THIS_properties.push({name:"showPriority",value:'true'}); _THIS_properties.push({name:"showGenericComplete",value:'false'}); _THIS_.addEventListener("fragment.load", "_THIS_init"); function _THIS_init() { //HACK alert, shouldn't have to do this but the booklet subfragment does not send the event so we need to add it to the parent _THIS_.parent.addEventListener('cognos.hts.task_info', '_THIS_handleTaskInfoEvent', false); _THIS_.parent.addEventListener('cognos.hts.changed_subscriptions', '_THIS_handleChangedSubscriptions', false); //the message has already been set so just show the info pane _THIS_.raiseEvent('cognos.hts.hideAll'); } function _THIS_handleChangedSubscriptions(evt) { _THIS_changedParams = evt.payload; } function _THIS_handleTaskInfoEvent(evt) { if (!evt.reflected) { var taskStatus=""; if (evt.payload!=null) { var taskInfo = evt.payload; //keep a ref. of original event, for revert if(_THIS_revert_taskInfo_evt==null) { _THIS_revert_taskInfo_evt = evt; } else if (_THIS_revert_taskInfo_evt.payload.id != taskInfo.payload) { //is possible that we are now dealing with a different payload. //If so cache the new evt details for the revert. _THIS_revert_taskInfo_evt = evt; } _THIS_updateUI(taskInfo); var _THIS_infoButtons = hts_getButtonsInfo(taskInfo); //check to see whether any buttons should be disabled for current user. hts_hideButtons($("_THIS_btnCancel"), _THIS_infoButtons.skip == 'false'); //"cancel" is internally mapped to "skip" on the server side hts_hideButtons($("_THIS_btnCancel_disabled"), _THIS_infoButtons.skip == 'true'); //"cancel" is internally mapped to "skip" on the server side hts_hideButtons($("_THIS_btnComplete"), _THIS_infoButtons.complete == 'false'); hts_hideButtons($("_THIS_btnComplete_disabled"), _THIS_infoButtons.complete == 'true'); hts_hideButtons($("_THIS_btnSaveAndClose"), _THIS_infoButtons.updateTaskDetails == 'false'); hts_hideButtons($("_THIS_btnSaveAndClose_disabled"), _THIS_infoButtons.updateTaskDetails == 'true'); hts_hideButtons($("_THIS_revertTask_disabled"), 'true'); var userName = ''; var taskStatus = taskInfo.status; if (taskInfo.formattedActualOwner == userName) { if (taskStatus==undefined || taskStatus=='COMPLETED' || taskStatus=='ERROR' || taskStatus=='EXITED' || taskStatus=='OBSOLETE') { hts_hideButtons($("_THIS_btnRelease"), true); hts_hideButtons($("_THIS_btnRelease_disabled"), false); //disable the save button //hts_hideButtons($("_THIS_btnSaveAndClose"), true); //hts_hideButtons($("_THIS_btnSaveAndClose_disabled"), false); //disable the revert button hts_hideButtons($("_THIS_revertTask"), true); hts_hideButtons($("_THIS_revertTask_disabled"), false); //disable the startdate and due date hts_disableDatePicker('_THIS_taskOptions_startBy'); hts_disableDatePicker('_THIS_taskOptions_dueDate'); //disable the priority and status select controls $("_THIS_taskOptions_status").disabled = true; $("_THIS_taskOptions_priority").disabled = true; } else { if (taskStatus=='IN_PROGRESS') { hts_hideButtons($("_THIS_btnRelease"), true); hts_hideButtons($("_THIS_btnRelease_disabled"), false); } else { hts_hideButtons($("_THIS_btnRelease"), false); hts_hideButtons($("_THIS_btnRelease_disabled"), true); } //enable the save button //hts_hideButtons($("_THIS_btnSaveAndClose"), false); //hts_hideButtons($("_THIS_btnSaveAndClose_disabled"), true); //enable the revert button hts_hideButtons($("_THIS_revertTask"), false); hts_hideButtons($("_THIS_revertTask_disabled"), true); //enable the startdate and due date if (taskStatus=='IN_PROGRESS') { //in this special case, disable the startDate hts_disableDatePicker('_THIS_taskOptions_startBy'); } else { hts_enableDatePicker('_THIS_taskOptions_startBy'); } hts_enableDatePicker('_THIS_taskOptions_dueDate'); //enable the priority and status select controls $("_THIS_taskOptions_status").disabled = false; $("_THIS_taskOptions_priority").disabled = false; } hts_hideButtons($("_THIS_btnClaim"), true); hts_hideButtons($("_THIS_btnClaim_disabled"), true); } else { hts_hideButtons($("_THIS_btnRelease"), true); hts_hideButtons($("_THIS_btnRelease_disabled"), true); hts_hideButtons($("_THIS_btnClaim"), _THIS_infoButtons.claim == 'false'); hts_hideButtons($("_THIS_btnClaim_disabled"), _THIS_infoButtons.claim == 'true'); //hts_hideButtons($("_THIS_btnSaveAndClose"), false); //hts_hideButtons($("_THIS_btnSaveAndClose_disabled"), true); if (taskStatus==undefined || taskStatus=='COMPLETED' || taskStatus=='ERROR' || taskStatus=='EXITED' || taskStatus=='OBSOLETE') { //disable the revert button hts_hideButtons($("_THIS_revertTask"), true); hts_hideButtons($("_THIS_revertTask_disabled"), false); //disable the priority and status select controls $("_THIS_taskOptions_status").disabled = true; $("_THIS_taskOptions_priority").disabled = true; //disable the startdate and due date hts_disableDatePicker('_THIS_taskOptions_startBy'); hts_disableDatePicker('_THIS_taskOptions_dueDate'); } else { //enable the revert button hts_hideButtons($("_THIS_revertTask"), false); hts_hideButtons($("_THIS_revertTask_disabled"), true); //enable the startdate and due date if (taskStatus=='IN_PROGRESS') { //in this special case, disable the startDate hts_disableDatePicker('_THIS_taskOptions_startBy'); } else { hts_enableDatePicker('_THIS_taskOptions_startBy'); } hts_enableDatePicker('_THIS_taskOptions_dueDate'); //enable the priority and status select controls $("_THIS_taskOptions_status").disabled = false; $("_THIS_taskOptions_priority").disabled = false; } } var utils = new hts_utils(); var content =$('_THIS__ownerEditDisabled'); utils.setUIState(content,_THIS_infoButtons.delegate == 'false'); hts_hideButtons(content, _THIS_infoButtons.delegate == 'true'); hts_hideButtons($("_THIS__ownerEdit"), _THIS_infoButtons.delegate == 'false'); //show the enabled or disabled potential owners link (add/remove recipients) var humanRolesDisabled =$('_THIS_humanRolesDisabled'); utils.setUIState(humanRolesDisabled,_THIS_infoButtons.delegate == 'false'); hts_hideButtons(humanRolesDisabled, _THIS_infoButtons.delegate == 'true'); hts_hideButtons($("_THIS_humanRoles"), _THIS_infoButtons.delegate == 'false'); //Hide parts we should not show. This is done here becuase the lines above //may hide/show parts that user is not allowed to see based on properties //settings. So we do this last to make sure properties are applied last. //effing xsltjsonifier doesnt work when theres only one if(!taskInfo.properties || !taskInfo.properties.length){ //probable only one var temp = new Array(); if(taskInfo.properties && !taskInfo.properties.length){ temp.push(taskInfo.properties); } taskInfo.properties = temp; } dojo.forEach(_THIS_properties, function(node) { var filtered = dojo.filter(taskInfo.properties, function(item){ return node && item && item.property && item.property.name === node.name; }); node.value = (filtered && filtered.length > 0 )?filtered[0].property.value:'true'; var display = node.value==='true'?'':'none'; var visibility = node.value==='true'?'visible':'hidden'; dojo.query('[id^= \"_THIS__'+ node.name +'\"]').style({"display":display,"visibility":visibility}); }); setTimeout(_THIS_setInitialFocus, 200); } } //only react once to this event. the booklet sends it twice, once for each tab in the booklet. this needs to be sorted out properly i.e. a change to the booklet code evt.reflected=true; } function _THIS_setInitialFocus() { var input = null; try { input = dojo.byId('_THIS_btnSaveAndCloseImage'); if (input.parentNode.parentNode.style.visibility!= 'visible') { setTimeout(_THIS_setInitialFocus, 200); } else { input.focus(); } } catch(exception) { //swallow it } } function _THIS_save() { //save the task if (hts_saveTaskOptions(_THIS_,'_THIS_') ) { //if we have changed subscription params do the call. if (_THIS_changedParams) { _THIS_.retrieve(_THIS_changedParams,null,true); } //the poolTaskList is the subbook that contains the inbox and archive tabs, reload the current tab only var _THIS_utils = new hts_utils(_THIS_); _THIS_utils.refreshCurrentTab('poolTaskList'); } } function _THIS_revert() { if(_THIS_revert_taskInfo_evt!=null) { //call the event handling code with the cached original taskInfo _THIS_revert_taskInfo_evt.reflected=false; _THIS_handleTaskInfoEvent(_THIS_revert_taskInfo_evt); } } function _THIS_skip() { if (hts_skipTask(_THIS_,'_THIS_')) { //reload the task viewer to reflect the changes var _THIS_utils = new hts_utils(_THIS_); _THIS_utils.refreshCurrentTab('poolTaskList'); } } function _THIS_claim() { if (hts_claimTask(_THIS_,'_THIS_')) { //reload the task viewer to reflect the changes var _THIS_utils = new hts_utils(_THIS_); _THIS_utils.refreshCurrentTab('poolTaskList'); } } function _THIS_complete() { if (hts_complete(_THIS_,'_THIS_')) { //reload the task viewer to reflect the changes var _THIS_utils = new hts_utils(_THIS_); _THIS_utils.refreshCurrentTab('poolTaskList'); } } function _THIS_release() { if (hts_releaseTask(_THIS_,'_THIS_')) { //reload the task viewer to reflect the changes var _THIS_utils = new hts_utils(_THIS_); _THIS_utils.refreshCurrentTab('poolTaskList'); } } function _THIS_delegate() { ccModalCallBack = function(cmd,sResponse) { if (cmd == "ok") { var xmlDoc = XMLBuilderLoadXMLFromString(xmldecode(sResponse)); var userTokenNode = _F_DOM.selectSingleNode(xmlDoc,"//item[./name[.='searchPath']]/value"); var userNameNode = _F_DOM.selectSingleNode(xmlDoc,"//item[./name[.='defaultName']]/value"); hts_setText($("_THIS__assingnedTo_value"),_F_DOM.text(userNameNode)); hts_setText($("_THIS__assingnedTo_token"),_F_DOM.text(userTokenNode)); } ui_modal_dialog.close(); dojo.query('div#_THIS__ownerEdit a').forEach( function(node, index, arr) { node.focus(); } ); } var sHeaderTitle = ''; ui_modal_dialog.open('?b_action=xts.run&m=portal/select/select.xts&so.select=adminconsole.users&md.callBack=data&md.callBackMode=&m_name=' + sHeaderTitle, false, true, true); } function _THIS_updateUI(taskInfo) { try{ //set the pickers to the current date _THIS_dateFrom=""; _THIS_dateTo=""; hts_clearDatePickers('_THIS_'); //the picker text boxes by default are set to the current date. set them to display nothing. //this fixes the issue of todays date getting displayed when no deadlines exist //also set the correct tab index and the correct label to be read by JAWs screen reader var dueDateEle = $('txtDate'+'_THIS_'+'taskOptions_dueDate'); if (dueDateEle) { dueDateEle.value=""; dijit.setWaiState(dueDateEle,'label',''); } var startByEle = $('txtDate'+'_THIS_'+'taskOptions_startBy'); if (startByEle) { startByEle.value=""; dijit.setWaiState(startByEle,'label',''); } //set the deadlines into the date pickers var deadlines; if (taskInfo.formattedDeadlines) { if(taskInfo.formattedDeadlines && taskInfo.formattedDeadlines.length){ deadlines = taskInfo.formattedDeadlines; }else if(taskInfo.formattedDeadlines){ deadlines = new Array(); deadlines.push(taskInfo.formattedDeadlines); } for (var i=0; i <deadlines.length;i++) { var deadlineInstance = deadlines[i].deadlineInstance; if (deadlineInstance.type=="START") { _THIS_dateFrom = deadlineInstance.formattedDateForDatePicker; } else if (deadlineInstance.type=="COMPLETE") { _THIS_dateTo = deadlineInstance.formattedDateForDatePicker; } } hts_setDatePickers('_THIS_',_THIS_dateFrom,_THIS_dateTo); } var subjectSpan = $("_THIS__subject_value"); if (subjectSpan.childNodes.length == 0) { var subjectText = document.createTextNode(taskInfo.presentationSubject); subjectSpan.appendChild(subjectText) } else { subjectSpan.firstChild.nodeValue = taskInfo.presentationSubject; } hts_setText($("_THIS__creator_value"),taskInfo.formattedCreatedBy); var owner = taskInfo.formattedActualOwner && taskInfo.formattedActualOwner != ''?taskInfo.formattedActualOwner:''; hts_setText($("_THIS__assingnedTo_value"),owner); //set the potential owners. if none exist commit will set empty list. var potentialOwners = new HTSHumanRole("_THIS__potentialOwners"); potentialOwners.parse(taskInfo.formattedPotentialOwners,taskInfo.potentialOwners); potentialOwners.commit(); //set the stakeholders. if none exist commit will set empty list. var stakeHolders = new HTSHumanRole("_THIS__stakeHolders"); stakeHolders.parse(taskInfo.formattedTaskStakeholders,taskInfo.taskStakeholders); stakeHolders.commit(); //set the tasks priority into the combo hts_selectComboItem($("_THIS_taskOptions_priority"),taskInfo.priority); //set the status into the combo hts_populateStatusComboItem($("_THIS_taskOptions_status"),taskInfo, _THIS_menu_strings); //alert('updating the task details UI, pri:'+taskInfo.priority+', stakes:'+taskInfo.formattedTaskStakeholders+', groups:'+taskInfo.taskStakeholders.groups+', owner:'+taskInfo.formattedActualOwner+', name:'+taskInfo.presentationName+', dateFrom:'+_THIS_dateFrom+', dateTo:'+_THIS_dateTo); var img = dojo.byId('_THIS_taskImage'); var srcPath = "_THIS?frag-resource=${0}/THIS_"; var src = dojo.string.substitute(srcPath,["fragments/common/images/space.gif"]); var alt = _THIS_getLocalisedTaskTooltip(taskInfo.presentationName); var title = alt; if (taskInfo.taskIconPath && taskInfo.taskIconPath != '') { src = dojo.string.substitute(srcPath,[escape(taskInfo.taskIconPath)]); } else { if (taskInfo.taskType == 'TASK') { src = dojo.string.substitute(srcPath,["fragments/myinbox/images/icon_task.gif"]); } else if (taskInfo.taskType == 'NOTIFICATION') { src = dojo.string.substitute(srcPath,["fragments/myinbox/images/icon_notification.gif"]); } } dojo.attr(img, {src: src,alt: alt,title: title,style: {cursor: "default"}}); }catch(ex){ alert('' + ex.description); } } //declare the error messages var _THIS_msg_array = new Array(); _THIS_msg_array['MSG_ERR_INCOMPATIBLE_DATES'] = ''; _THIS_msg_array['MSG_ERR_INVALID_END_DATE'] = ''; _THIS_msg_array['MSG_ERR_INVALID_START_DATE'] = ''; _THIS_msg_array['MSG_ERR_INVALID_DATE'] = ''; _THIS_msg_array['MSG_ERR_INVALID_ASSIGNMENT'] = ''; _THIS_msg_array['MSG_ERR_EQUAL_DATES'] = ''; //_THIS_msg_array['MSG_ERR_START_CANNOT_USE_CURRENT_DATE'] = ''; _THIS_msg_array['MSG_ERR_COMPLETE_CANNOT_USE_CURRENT_DATE'] = ''; try{ if (typeof oCV=="undefined") { oCV=window; } } catch(e) { oCV=window; } var G_PM_THIS_ = new C_PromptManager(); oCV.preProcessControlArray=[]; p_sSkinFolder=_F_Config.webContent+"/skins/"; p_sWebContentURI=_F_Config.webContent; oCV.gbPromptRequestSubmitted=false; oCV.bCanFinish=true; oCV.bNextPage=true; oCV.pageNavigationObserverArray=[]; oCV.rangeObserverArray=[]; oCV.multipleObserverArray=[]; oCV.datePickerObserverArray=[]; oCV.hasPromptKeyDown=false; _THIS_monitor = function (evt) { //only want to execute this on downstream events if (evt.eventPhase == evt.AT_TARGET) return; var saveAndClose = $('_THIS_btnSaveAndClose'); var revert = $('_THIS_btnRevert'); var cancel = $('_THIS_btnCancel'); if (evt.name == "fragment.retrieve.before"){ if (saveAndClose) {saveAndClose.disabled = true;} if (cancel) {cancel.disabled = true;} } else { if (saveAndClose) {saveAndClose.disabled = false;} if (cancel) {cancel.disabled = false;} } } _THIS_.parent.addEventListener("fragment.retrieve.before", "_THIS_monitor", true); _THIS_.parent.addEventListener("fragment.retrieve.after", "_THIS_monitor", true);
margin-left:2px var _THIS_startById = '_THIS_taskOptions_startBy'; hts_clearDatePickersIframe(_THIS_startById); genSelectDateHTML({formName:"_THIS_pform",parameterName:"_THIS_taskOptions_startBy",submitType:"",prmtDefaultDate:_THIS_dateFrom,defaultValue:_THIS_dateFrom,startOfWeek:"Sunday",calendar:"Gregorian",selectUI:"editBox",selectDateUI:"editBox",inputOrder:"YMD",firstDate:hts_getCurrentDate(),lastDate:"",dateTime:0,initialState:RANGE_NO_VALUE,required:false,suppressDisabled:true,hideAdornments:false,suppressExtraPromptNames:false,multi:false,range:false,style:"",selectDateEditBoxStyle:"",selectDateYearsStyle:"",selectDateMonthsStyle:"",selectDateDaysOfWeekStyle:"",selectDateDaysStyle:"",CVId:"",id:_THIS_startById}); margin-left:2px var _THIS_dueDateId = "_THIS_taskOptions_dueDate"; hts_clearDatePickersIframe(_THIS_dueDateId); genSelectDateHTML({formName:"_THIS_pform",parameterName:"_THIS_taskOptions_dueDate",submitType:"",prmtDefaultDate:_THIS_dateTo,defaultValue:_THIS_dateTo,startOfWeek:"Sunday",calendar:"Gregorian",selectUI:"editBox",selectDateUI:"editBox",inputOrder:"YMD",firstDate:hts_getCurrentDate(),lastDate:"",dateTime:0,initialState:RANGE_NO_VALUE,required:false,suppressDisabled:true,hideAdornments:false,suppressExtraPromptNames:false,multi:false,range:false,style:"",selectDateEditBoxStyle:"",selectDateYearsStyle:"",selectDateMonthsStyle:"",selectDateDaysOfWeekStyle:"",selectDateDaysStyle:"",CVId:"",id:_THIS_dueDateId}); margin-left:3px margin-left:3px true