1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: HTS
- (C) Copyright IBM Corp. 2005, 2010
- US 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">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
- <xsl:template match="/" mode="common">
- <script type="text/javascript">
-
- /*
- * Retrieve the task information (if available) and convert the XML into a JSON object.
- * Raise a new 'cognos.hts.task_info' event with the JSON payload
- */
- function _THIS_raiseTaskInfo() {
- var oTaskInfo = null;
- //convert the task information into a JSON string
- <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>
-
- //now turn it into a javascript object. The magic of JSON
- <xsl:if test="$jsonTaskInfo != ''">
- try {
- oTaskInfo = eval("({<xsl:value-of select="xtsext:javascriptencode(string($jsonTaskInfo))"/>})");
- oTaskInfo = oTaskInfo.task;
- } catch (ex) {
- alert('<xts:string id="IDS_FRAG_ERROR_MESSAGE" encode="javascript"/>' + ex);
- }
- </xsl:if>
-
- //only fire the event when the transient taskid matches the task info response. This fixes the issue
- //of multiple firings of the task_info event when a task is selected. Once when the current task is
- //cleared and then again for the new selected task
- if(oTaskInfo && oTaskInfo.id == _THIS_.transientState['taskid']){
- //pass the task details to those fragments interested
- _THIS_.raiseEvent('cognos.hts.task_info',oTaskInfo);
- }
- }
- </script>
- </xsl:template>
- </xsl:stylesheet>
|