123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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="/">
- <xsl:variable name="uri" select="/root/input[@name='dep']/queryResponse/text()"/>
- <script language="javascript">
- _THIS_.addEventListener('fragment.unload','_THIS_unload', false);
- _THIS_.addEventListener('fragment.load','_THIS_init', false);
- //This event will be fired when sub fragment is retrieved and done.
- //The calls starts with children first, and when the target of the event
- //is the same as this fragments id it means all children have been done.
- _THIS_.addEventListener("fragment.retrieve.after", "_THIS_retrieveAfter",false);
- /**
- * On refresh subfrag are not notified of the load. So we need
- * to do this explicitly. This is very IMPORTANT. Otherwise
- * the onload is not passed to children.
- */
- function _THIS_init(evt) {
- var _THIS_distList = new Array();
- var _THIS_children = _THIS_.getChildren();
- var i, l = _THIS_children.length;
- for (i = 0; i < l; i++) {
- _THIS_distList[i] = _THIS_children[i].id;
- }
- _F_Event.distribute(_THIS_distList,evt);
- }
- /**
- * This method will be fired when sub fragment is retrieved and done.
- * The calls starts with children first, and when the target of the event
- * is the same as this fragments id it means all children have been done.
- */
- function _THIS_retrieveAfter(evt) {
- if (evt.target.id == "_THIS_") {
- var params = _THIS_getRenderingParams();
- if (params.isValid) {
- //get the 'real' rendering subfragment which is the only child of the current one
- var children = _THIS_.getChildren();
- var subFragment;
- //we are only expected one i.e. the rendering subfragment
- if (children.length>0) {
- subFragment = children[0];
- var utils = new hts_utils(subFragment);
- var subfragContent = $('_THIS_renderingSubFragcontent');
- utils.setUIState(subfragContent,!params.visible,true);
- }
- _THIS_.raiseEvent(params.event);
- }
- }
- }
- /*
- * There are two rendering information parameters, one for tasks and one for notifications. There should be one or the other not both.
- * Both have the same JSON structure : {"id":"ec32f725-dd70-4694-ae8c-f8a0a1671c18","visible":false}
- * This function adds a couple extra properties; event - the event to be raised and isValid - determines whether the parameter is correct
- */
- function _THIS_getRenderingParams() {
- var payload = new Object();
- payload.id="";
- payload.visible="";
- payload.event="";
- payload.isValid=false;
- var notificationParams = '<xsl:value-of select="xtsext:javascriptencode(string(/root/transients/param[@name='renderingNotificationInfo']))"/>';
- var taskParams = '<xsl:value-of select="xtsext:javascriptencode(string(/root/transients/param[@name='renderingTaskInfo']))"/>';
- if(notificationParams != '') {
- eval('payload = ' + _F_Strings.urlDecode(notificationParams));
- payload.event='cognos.hts.showNotificationTaskViewer';
- } else if(taskParams != '') {
- eval('payload = ' + _F_Strings.urlDecode(taskParams));
- payload.event='cognos.hts.showTaskViewer';
- }
- payload.isValid = (payload.id && payload.id !="");
- return payload;
- }
- /*
- this method clears the javascript objects that are associated with the subfragment
- that this class sets and resets dynamically into itself
- without this method, because the subfrag id is constant
- the javascript object for the first sub fragment hangs around
- and causes trouble
- */
- function _THIS_unload(evt) {
- //only deal with this if source and target are the same. This
- //is because when this frag in reloaded it fires an unload
- //event prior to loading. So source and target will be the same.
- //When children are destroyed the unload is fired again, this time
- // source will be child , so this condition will ignore it.
- if (evt.target.id == "_THIS_" && evt.source.id == "_THIS_") {
- var _THIS_distList = new Array();
- var _THIS_children = _THIS_.getChildren();
- var i, l = _THIS_children.length;
- for (i = 0; i < l; i++) {
- //Will cascade to all subchildren recusivley
- //And will fire unload before destroy and fragment.detroyed
- //after the destrcution is complete.
- _THIS_children[i].destroy();
- }
- }
- }
- </script>
- <!--currently this is the rendering and we assume it is a uri -->
- <!-- this is where the subfragment content will go -->
- <div id="_THIS_renderingSubFragcontent">
- <table class="cogstyle-usv-rendering-table">
- <tr>
- <td>_THIS?frag-subfragment=renderingSubFrag/THIS_</td>
- </tr>
- </table>
- </div>
- </xsl:template>
- </xsl:stylesheet>
|