| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 | <?xml version="1.0" encoding="UTF-8"?><!--Licensed Materials - Property of IBMIBM Cognos Products: HTS(C) Copyright IBM Corp. 2005, 2010US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.--><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:hts="http://developer.cognos.com/myinbox/common/hts_ui" exclude-result-prefixes="xts hts">	<xsl:import href="../../menu/render-toolbar.xslt"/>	<xsl:import href="../../common/json-converter.xslt"/>	<xsl:import href="../../common/task-info.xslt"/>	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>	<xsl:template match="/">		<xsl:apply-templates select="/" mode="common"/>		<hts:script language="javascript">			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			<xsl:variable name="jsonTaskInfo">				<xsl:call-template name="convertToJSON">					<xsl:with-param name="taskInfo" select="/root/input[@name='dep']/queryResponse/*[local-name()='getTaskInfoResponse']"/>				</xsl:call-template>			</xsl:variable>			//encode the JSON task info object			<xsl:if test="$jsonTaskInfo != ''">				try {				var jsonTaskInfo = "({<xsl:value-of select="xtsext:javascriptencode(string($jsonTaskInfo))"/>})";				if(jsonTaskInfo && jsonTaskInfo.indexOf("taskType:'NOTIFICATION'") != -1){				oNotificationTaskInfo = eval("({<xsl:value-of select="xtsext:javascriptencode(string($jsonTaskInfo))"/>})");				oNotificationTaskInfo = oNotificationTaskInfo.task;				}				} catch (ex) {				alert('<xts:string id="IDS_FRAG_ERROR_MESSAGE" encode="javascript"/>' + ex);				}			</xsl:if>			}			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 = '<xts:string id="IDS_FRAG_COMMENT_VIEWER_ADD_COMMENT_PROMPT" encode="javascript"/>';			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  +=              '<xts:string id="IDS_FRAG_COMMENT_VIEWER_ADD_COMMENT_HINT" encode="javascript"/>';			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();			}		</hts:script>		<hts:section format="select-dialog">			<hts:rowset cellpadding="3" cellspacing="2" width="100%">				<hts:row>					<hts:action colspan="3">						<xsl:call-template name="renderToolbar">							<xsl:with-param name="toolbar" select="/root/input/commentsMenu"/>						</xsl:call-template>					</hts:action>				</hts:row>				<hts:row format="header" class="tableHeader">					<hts:text width="1%"/>					<hts:text width="15%">						<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_AUTHOR"/>					</hts:text>					<hts:text width="67%">						<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_COMMENT"/>					</hts:text>					<hts:text width="17%">						<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_DATE"/>					</hts:text>				</hts:row>				<xsl:call-template name="displayComment" />			</hts:rowset>		</hts:section>	</xsl:template>	<xsl:template name="displayComment">		<xsl:for-each select ="/root/input[@name='dep']/queryResponse/*[local-name()='getCommentsByTypeResponse']/*[local-name()='getCommentsByTypeGroup']/*[local-name()='comment']">			<xsl:variable name="type" select="./../*[local-name()='commentType']"/>			<xsl:variable name="res">				<xsl:choose>					<xsl:when test="$type = 'AUDIT'" >						<src>							<xsl:value-of select='"_THIS?frag-resource=/fragments/myinbox/images/audit_comments.gif/THIS_"'/>						</src>						<tooltip>							<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_AUDIT_COMMENTS"/>						</tooltip>					</xsl:when>					<xsl:otherwise>						<src>							<xsl:value-of select='"_THIS?frag-resource=/fragments/myinbox/images/user_comments.gif/THIS_"'/>						</src>						<tooltip>							<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_USER_COMMENTS"/>						</tooltip>					</xsl:otherwise>				</xsl:choose>			</xsl:variable>			<hts:row>				<hts:action tabindex="0">					<img id="{./*[local-name()='id']}_img" border="0" src="{$res/src}" alt="{$res/tooltip}" title="{$res/tooltip}"/>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='formattedAddedBy']"/>					</hts:text>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='text']"/>					</hts:text>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='addedAt']"/>					</hts:text>				</hts:action>			</hts:row>		</xsl:for-each>		<xsl:for-each select ="/root/input[@name='dep']/queryResponse/*[local-name()='getCommentsResponse']/*[local-name()='comment']">			<xsl:variable name="type" select="./*[local-name()='commentType']"/>			<xsl:variable name="res">				<xsl:choose>					<xsl:when test="$type = 'AUDIT'" >						<src>							<xsl:value-of select='"_THIS?frag-resource=/fragments/myinbox/images/audit_comments.gif/THIS_"'/>						</src>						<tooltip>							<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_AUDIT_COMMENTS"/>						</tooltip>					</xsl:when>					<xsl:otherwise>						<src>							<xsl:value-of select='"_THIS?frag-resource=/fragments/myinbox/images/user_comments.gif/THIS_"'/>						</src>						<tooltip>							<xts:string id="IDS_FRAG_COMMENT_VIEWER_LABEL_USER_COMMENTS"/>						</tooltip>					</xsl:otherwise>				</xsl:choose>			</xsl:variable>			<hts:row>				<hts:action tabindex="0">					<img id="{./*[local-name()='id']}_img" border="0" src="{$res/src}" alt="{$res/tooltip}" title="{$res/tooltip}"/>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='formattedAddedBy']"/>					</hts:text>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='text']"/>					</hts:text>				</hts:action>				<hts:action tabindex="0">					<hts:text>						<xsl:value-of select="./*[local-name()='addedAt']"/>					</hts:text>				</hts:action>			</hts:row>		</xsl:for-each>	</xsl:template></xsl:stylesheet>
 |