123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2014
- 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:agspmt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/promptValues/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:out="dummy-uri" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:agsad="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agentDefinition/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" xmlns:req-params="http://developer.cognos.com/schemas/request/params" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="agspmt xtscm xsi cf bus pf xtsext lyt dp df cp cm agsad utml agsdlg req-params xts xos">
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
- <!--pf:variables/>
- <pf:serialize-xml/-->
- <!-- start the output -->
- <xsl:template match="agspmt:promptValues">
- <out:template name="promptValues">
- <out:variable name="connection_type">
- <out:text><xts:string id="DIALOG_PROMPT_CONNECTION"/></out:text>
- </out:variable>
- <input type="hidden" id="m_obj" name="m_obj">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name='selected_path']"/>
- </out:attribute>
- </input>
- <!-- taskParameters is stored in here too but as an updated mirror of taskParameters
- this is because we must capture them in the parent page and update them here
- so that if you move off the page quickly..... you dont loose the saved task parameter values-->
- <input type="hidden" id="updatedTaskParameters" name="updatedTaskParameters">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name='taskParameters']"/>
- </out:attribute>
- </input>
- <input type="hidden" id="method" name="method" value="" utml:update="false"/>
- <input type="hidden" id="cleared_prompts" name="cleared_prompts" value="false"/>
- <input type="hidden" id="has_prompts" name="has_prompts">
- <out:attribute name="value">
- <out:value-of select="count(/root/parametersDisplay/parameter)>0"/>
- </out:attribute>
- </input>
- <dp:list width="100%" section3_align="right">
- <dp:section width="100%">
- <dp:text align="right">
- <out:if test="count(/root/parametersDisplay/parameter)>0">
- <xts:string align="right" id="IDS_ENTRIES"/>1 - <out:value-of select="count(/root/parametersDisplay/parameter)"/>
- </out:if>
- </dp:text>
- </dp:section>
- <dp:section width="100%">
- <cp:table name="parameterTable" showEmptyMsg="true" iterate="/root/parametersDisplay/parameter">
- <cp:tableHeader>
- <cp:columnHeader width="20%" align="middle">
- <!-- no effect with align - all to left-->
- <xts:string id="IDS_ADV_NAME"/>
- </cp:columnHeader>
- <cp:columnHeader width="10%" align="left">
- <xts:string id="IDS_TYPE"/>
- </cp:columnHeader>
- <cp:columnHeader width="2%" align="left">
- <xts:string id="DIALOG_PROMPT_REQUIRED"/>
- </cp:columnHeader>
- <cp:columnHeader width="8%" align="left">
- <xts:string id="DIALOG_PROMPT_MULTI_SELECT"/>
- </cp:columnHeader>
- <cp:columnHeader width="1%" align="left"/>
- <cp:columnHeader width="0%" align="middle">
- <xts:string id="DIALOG_PROMPT_METHOD"/>
- </cp:columnHeader>
- <cp:columnHeader width="100%" align="left">
- <xts:string id="DIALOG_PROMPT_VALUE"/>
- </cp:columnHeader>
- </cp:tableHeader>
- <cp:tableContent>
- <cp:common-render-variables>
- <out:variable name="drop_zone_name">
- <out:value-of select="concat('pv_dz_', @name, '_pv_dz')"/>
- </out:variable>
- <out:variable name="literalDiv" select="concat('literalDiv', position())"/>
- <out:variable name="modelDiv" select="concat('modelDiv', position())"/>
- <out:variable name="method_display">
- <out:choose>
- <!-- If both are there then model takes over.-->
- <out:when test="@modelValue">
- <literal>none</literal>
- </out:when>
- <out:otherwise>
- <model>none</model>
- </out:otherwise>
- </out:choose>
- </out:variable>
- </cp:common-render-variables>
- <cp:columnContent>
- <out:choose>
- <out:when test="@caption != ''"><out:value-of select="@caption"/></out:when>
- <out:otherwise>@name</out:otherwise>
- </out:choose>
-
- </cp:columnContent>
- <cp:columnContent>
- <out:value-of select="@type"/>
- </cp:columnContent>
- <cp:columnContent>
- <out:choose>
- <out:when test="@required = 'true'">
- <img alt="" border="0">
- <out:attribute name="src"><out:value-of select="$webcontent"/>/../ps/portal/images/active_namespace.gif</out:attribute>
- </img>
- <!--img src="{$webcontent}/../ps/portal/images/active_namespace.gif"!-->
- <!-- tick icon -->
- </out:when>
- <out:otherwise>
- <img alt="" border="0">
- <out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
- </img>
- <!--img src="{$webcontent}/images/space.gif"-->
- </out:otherwise>
- </out:choose>
- </cp:columnContent>
- <cp:columnContent>
- <!-- Multi-select? -->
- <out:choose>
- <out:when test="@multivalued='true'">
- <img alt="" border="0">
- <out:attribute name="src"><out:value-of select="$webcontent"/>/../ps/portal/images/active_namespace.gif</out:attribute>
- </img>
- </out:when>
- <out:otherwise>
- <img alt="" border="0">
- <out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
- </img>
- </out:otherwise>
- </out:choose>
- </cp:columnContent>
- <cp:columnContent>
- <img alt="" border="0">
- <out:attribute name="src"><out:value-of select="$webcontent"/>/../ags/images/summary/icon_prompt_values.gif</out:attribute>
- <out:attribute name="title"><xts:string id="DIALOG_REPORT_PROMPT_VALUE"/></out:attribute>
- </img>
- </cp:columnContent>
- <cp:columnContent>
- <select name="pv_selection_{'{@name}'}" id="pv_selection_{'{@name}'}" onchange="toggleDiv({'{position()}'},'{'{$drop_zone_name}'}')">
- <out:if test="@type=$connection_type or starts-with(/root/parametersDisplay/objectClass, 'powerPlay')" >
- <out:attribute name="disabled">
- <out:text>disabled</out:text>
- </out:attribute>
- </out:if>
- <option value="1">
- <!-- select this option is the value of the select is the value of the option -->
- <out:if test="not($method_display/model)">
- <out:attribute name="selected">true</out:attribute>
- </out:if>
- <xts:string id="DIALOG_PARAMETER_USE_ITEM"/>
- </option>
- <option value="2">
- <out:if test="not($method_display/literal)">
- <out:attribute name="selected">true</out:attribute>
- </out:if>
- <xts:string id="DIALOG_PARAMETER_USE_VALUE"/>
- </option>
- </select>
- <img height="15" width="5" border="0">
- <out:attribute name="src">
- <out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
- </img>
- <!--img height="15" width="1" src="{$webcontent}/images/space.gif"-->
- </cp:columnContent>
- <cp:columnContent>
- <div id="{'{$literalDiv}'}" name="{'{$literalDiv}'}" style="display:{'{$method_display/literal}'}">
- <out:choose>
- <out:when test="@literalValue and not(@literalValue = '')">
- <out:value-of select="@literalValue"/>
- </out:when>
- <out:otherwise>
- <xts:string id="IDS_OTHERRUN_DEFAULT"/>
- </out:otherwise>
- </out:choose>
- </div>
- <div id="{'{$modelDiv}'}" name="{'{$modelDiv}'}" style="display:{'{$method_display/model}'}">
- <agsdlg:insertButton width="80%" targetId="{'{$drop_zone_name}'}" value="{'{@modelValue}'}">
- <input type="text" oncontextmenu="event.cancelBubble=true;event.returnValue=false;return false;" closePrevious="true" onKeyPress="event.cancelBubble=true;event.returnValue=false;return false;" onblur="event.cancelBubble=true;event.returnValue=false;return false;" onkeydown="event.cancelBubble=true;event.returnValue=false;return false;" id="{'{$drop_zone_name}'}" name="{'{$drop_zone_name}'}" value="{'{@modelValue}'}"/>
- </agsdlg:insertButton>
- </div>
- </cp:columnContent>
- </cp:tableContent>
- </cp:table>
- </dp:section>
- <!-- Only if we have any parameters we show the section below -->
- <dp:section width="100%">
- <dp:text align="right">
- <out:choose>
- <out:when test="starts-with(/root/parametersDisplay/objectClass, 'powerPlay')">
- <out:choose>
- <out:when test="count(/root/parametersDisplay/parameter) = 0">
- <a href="#" onclick="doPowerPlayPrompts('prompt_set');">
- <xts:string id="DIALOG_SPECIFY_VALUES"/>
- </a>
- </out:when>
- <out:otherwise>
- <!-- prompts for PowerPlay8 are handled differently -->
- <a href="#" onclick="doPowerPlayPrompts('prompt_edit');">
- <xts:string id="DIALOG_SPECIFY_VALUES"/>
- </a>
- <img height="15" width="5" border="0" src="../ags/images/space.gif"/>
- <a href="#" onclick="doPowerPlayPrompts('clear');">
- <xts:string id="DIALOG_PROMPT_RESET_DEFAULT_VALUES"/>
- </a>
- </out:otherwise>
- </out:choose>
- </out:when>
- <out:otherwise>
- <out:if test="count(/root/parametersDisplay/parameter) > 0">
- <out:if test="not(/root/env/param[@name='doSkip'])">
- <a href="#" align="right" onclick="doPrompts('edit');">
- <xts:string id="DIALOG_SPECIFY_VALUES"/>
- </a>
- </out:if>
- <out:if test="/root/parametersDisplay//parameter[@literalValue != '']">
- <img height="15" width="5" border="0" src="../ags/images/space.gif"/>
- <a align="right" href="#" onclick="clearModelPrompts()">
- <xts:string align="right" id="DIALOG_PROMPT_RESET_DEFAULT_VALUES"/>
- </a>
- </out:if>
- </out:if>
- </out:otherwise>
- </out:choose>
- </dp:text>
- </dp:section>
- </dp:list>
- </out:template>
- </xsl:template>
- <xsl:template match="agspmt:promptValuesScript">
- <out:template name="promptValuesScript">
- <script type="text/javascript">
- function initPromptPage(parameterArray)
- {
- var dropZones = new Array();
- var dropZone;
- for (var i = 0; i < parameterArray.length; i++) {
- var dropzone_name = "pv_dz_" + parameterArray[i].name + "_pv_dz";
- if (parameterArray[i].modelValue) {
- document.getElementById(dropzone_name).value = parameterArray[i].modelValue;
- }
- dropZone = new DropZone(dropzone_name,"","",'true',"<out:value-of select="key('request-param','tabSelectedID')"/>",true);
- droppy.registerDropZoneObject(dropZone);
-
- dropZones.push(dropZone);
-
- // define a function which is going to handle the data from the drop
- //droppy.registerPreEventHandler(dropzone_name,"ondrop", clearBeforeDrop);
- }
-
- //pass the group to a listener in case number of members dynamically changes
- droppy.registerDropZoneGroup(dropZones, "<out:value-of select="key('request-param','tabSelectedID')"/>");
- }
-
- /*
- this is called afetr the asynch get parameters html is injected into the waiting div
- the asynch getParametersResponse has an updated value for taskParameters that must
- be used to change the original value that is stored in the parent page.
- */
- function initInjectedHtml(){
-
- var cf = parent.getConfigFrame();
-
- cf.showDialogFrame(0);
-
- if(document.pform.updatedTaskParameters){
- var tps = document.getElementById('taskParameters');
- var utps = document.getElementById('updatedTaskParameters');
-
- //update the real task parameters
- tps.value = utps.value;
-
- utps.parentNode.removeChild(utps);
-
- //update the event handlers
-
- cf.attachHandlers(document.forms);
- }
- }
- /*
- // only the last item dropped visible but previous selections left in the agent tree
- function clearBeforeDrop()
- {
- //the id is a global generated by the drag drop handler before this method is called
- //and is the correct id for whatever dropzone is being used
- droppy.setDropZoneValue("");
- }
- */
- function validatePromptPage()
- {
- return true;
- }
-
- function toggleDiv(position, dz_name)
- {
- var modelDiv = "modelDiv" + position;
- var literalDiv = "literalDiv" + position;
- var displayName;
- var hideName;
-
- if(document.getElementById(modelDiv).style.display == 'none')
- {
- displayName = modelDiv;
- hideName = literalDiv;
- }
- else
- {
- displayName = literalDiv;
- hideName = modelDiv;
- //model item div is being hidden, clear it
- droppy.setDropZoneValue("",dz_name);
- }
-
- showDiv(displayName );
- hideDiv(hideName );
- }
-
- function showDiv(name)
- {
- document.getElementById(name).style.display='';
- }
-
- function hideDiv(name)
- {
- document.getElementById(name).style.display='none';
- }
-
- function clearModelPrompts()
- {
- document.getElementById('cleared_prompts').value='true';
- document.getElementById('taskParameters').value = '';
-
- var frm = document.pform;
- //we must resubmit to ourselves
- frm.m.value = 'ags/dialogAdapter.xts';
- frm.ps_nav_op.value = "maintain";
- window.setTimeout('document.pform.submit();', 1 );
- }
-
- function doPrompts(cmd)
- {
- var frm = document.pform;
- //we must resubmit to ourselves
- frm.m.value = 'ags/promptValuesProxy.xts';
- frm.ps_nav_op.value = "maintain";
- if (cmd == 'clear')
- {
- frm.cleared_prompts.value = 'true';
- if (frm.m_rp_parameters)
- {
- frm.m_rp_parameters.value = '';
- }
- }
- else
- {
- frm.method.value=cmd;
- }
- window.setTimeout('document.pform.submit();', 1 );
- }
-
- function doPowerPlayPrompts(cmd)
- {
- if (cmd == 'clear')
- {
- if (pform.taskParameters) {
- pform.taskParameters.value = '';
- }
- if (pform.m_parameter) {
- pform.m_parameter.value = '';
- }
- window.setTimeout('document.pform.submit();', 1 );
- }
- else if (cmd == 'prompt_set' || cmd == 'prompt_edit' ) {
- // have to call powerplay prompts - need to get the saved state and m_parameter first -
- // need to setup a controller stack
- parent.getConfigFrame().getCommandStackManager().initiateCommandStack("parent.getConfigFrame().savePPState();","parent.getMessageIFrame().callPowerPlayPrompts();");
- }
- }
-
- function callPowerPlayPrompts()
- {
- var cf = parent.getConfigFrame();
- // build the form dynamically
- cf.dlgReset();
- cf.dlgSetParm('ui.backURL','<out:value-of select="xtsext:javascriptencode(string(concat($gateway,'?b_action=xts.run&m=ags/dialogAdapter.xts&ccstate=')))"/>'+cf.cfgGet("savedEnv")+'&cafcontextid='+cf.cafContextId);
- cf.dlgSetParm('PP_BACK','<out:value-of select="xtsext:javascriptencode(string(concat($gateway,'?b_action=xts.run&m=ags/dialogAdapter.xts&ccstate=')))"/>'+cf.cfgGet("savedEnv")+'&cafcontextid='+cf.cafContextId);
- cf.dlgSetParm('b_action','<out:value-of select="'powerPlayService'"/>');
- cf.dlgSetParm('ui.action','<out:value-of select="'setPowerPlay8Prompt'"/>');
- cf.dlgSetParm('m','<out:value-of select="'ags/dialogAdapter.xts'"/>');
- cf.dlgSetParm('crnobj','<out:value-of select="xtsext:javascriptencode(string(/root/cm:queryResponse/cm:queryReply[2]//cm:searchPath))"/>');
- cf.dlgSetParm('ui.crnfrm','<out:value-of select="'PDF'"/>');
- cf.dlgSetParm('opaque', cf.cfgGet("savedEnv"));
- cf.dlgSetParm('store_ID','<out:value-of select="xtsext:javascriptencode(string(/root/cm:queryResponse/cm:queryReply[2]//cm:storeID))"/>');
- if (cf.cfgGet("m_parameter") != '') {
- cf.dlgSetParm('m_parameter', cf.cfgGet("m_parameter"));
- }
- // want to submit this to this to the message frame
- cf.dlgSubmit("messageIFrame");
- }
- </script>
- </out:template>
- </xsl:template>
- <!--
- * - This next template is required to copy all other elements into the result.
- -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|