var oNotificationTaskInfo; _F_config.enableLog = false; _THIS_.addEventListener("fragment.load", "_THIS_init"); _THIS_.addEventListener("fragment.retrieve.after", "_THIS_retrieveAfter"); _THIS_.parent.addEventListener("fragment.unload", "_THIS_unload"); function _THIS_unload(evt) { if(oNotificationTaskInfo) _THIS_.raiseEvent('cognos.hts.showNotificationTaskViewer'); else _THIS_.raiseEvent('cognos.hts.showTaskViewer'); } function _THIS_init() { //update the comments menus initFilter(_THIS_commentsMenu,_THIS_.transientState['Task.Comments']); //get the task info as a JSON string and fire the event //encode the JSON task info object try { var jsonTaskInfo = "({})"; if(jsonTaskInfo && jsonTaskInfo.indexOf("taskType:'NOTIFICATION'") != -1){ oNotificationTaskInfo = eval("({})"); oNotificationTaskInfo = oNotificationTaskInfo.task; } } catch (ex) { alert('' + ex); } } function _THIS_retrieveAfter(evt) { if (evt.target.id == "_THIS_") { //get the selected task, JSONify it and raise the event if(oNotificationTaskInfo && oNotificationTaskInfo.id == _THIS_.transientState['notificationtaskid']) { //pass the task details to those fragments interested _THIS_.raiseEvent('cognos.hts.notification_info',oNotificationTaskInfo); }else{ _THIS_raiseTaskInfo(); } } var taskId = _THIS_.transientState['taskid']; if (taskId && taskId != '') { //This is to hide the waiting div and show the correct div (task details where comment tab is visible) _THIS_.raiseEvent('cognos.hts.showTaskViewer'); } var noteTaskId = _THIS_.transientState['notificationtaskid']; if (noteTaskId && noteTaskId != '') { //This is to hide the waiting div and show the correct div (task details where comment tab is visible) _THIS_.raiseEvent('cognos.hts.showNotificationTaskViewer'); } } function _THIS_action(action) { if(arguments.length==3) { //Call the set filter. This is the same as the one used for toolbar.js menu. setFilter(arguments[0],arguments[1],arguments[2]); } else if (action == 'addComment') { _THIS_addUserComment(); } } function _THIS_action_getItemState(menudef, item) { //TODO Check for capabilities/task status here to determine whether the menu is shown //return "hide" or "show" } function _THIS_addUserComment() { _F_log("D", "User has selected to add a comment."); var dialog_title = ''; var dlg = new ui_dialog(this.fragID + "addComment", dialog_title, ui_dialog.style.BTN_OKCANCEL | ui_dialog.style.CENTER | ui_dialog.style.RESIZABLE, -1, -1, 480, 275); dlg.processCommand = function(cmd) { var comment = $("commentTextArea"); if(comment && comment.value){ comment = comment.value }else{ comment=""; } if ((cmd == ui_dialog.button.OK)) { _THIS_.retrieve("action=addComment&comment="+_F_Strings.urlEncode(comment)); } this.destroy(); return true; }; var markup = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"; markup += "<tr>"; markup += "<td>"; markup += ''; markup += "</td>"; markup += "</tr>"; markup += "<tr>"; markup += "<td style=\"margin: auto\" valign=\"center\" align=\"center\" >"; markup += "<textarea rows='15' cols='75' maxlength='2000' class=\"cogstyle-comment-area\" id=\"commentTextArea\"></textarea>"; markup += "</td>"; markup += "</tr>"; markup += "</table>"; dlg.setContent(markup); dlg.show(); document.getElementById('commentTextArea').focus(); } {$res/tooltip} {$res/tooltip}