123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2009
- 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:agsad="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agentDefinition/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:doc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/doc/" xmlns:out="dummy-uri" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="doc">
- <xsl:output method="html" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <doc:group prefix="agsad">
- <doc:location>
- <doc:namespace>http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agentDefinition/</doc:namespace>
- <doc:ref>ps/ags/logicsheets/agentDefinition.xsl</doc:ref>
- </doc:location>
- </doc:group>
- <!-- +++++++++++++++++++++++
- outputs the relevant suppression state text according to the agent definition in the input dom
- +++++++++++++++++++++++++++++-->
- <doc:template type="ui">
- <doc:name>taskSuppressionStateText</doc:name>
- <doc:desc>This tag creates an "out" template named <getTaskSuppressionStateText> that outputs an label and string for the relevant suppression state</doc:desc>
- <doc:notes>See <getTaskSuppressionStateText></doc:notes>
- </doc:template>
- <xsl:template match="agsad:taskSuppressionStateText" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:agscnd="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/condition/">
- <doc:template type="out">
- <doc:name>getTaskSuppressionStateText</doc:name>
- <doc:desc>This template outputs alabel and text for the relevant suppression state</doc:desc>
- <doc:param>
- <doc:param-name>suppression-node</doc:param-name>
- <doc:param-desc>This points to the suppression node within the action of the agent definition that we want the state gif for i.e. "/root/agent_definition/items/item [./id = 'task_id']/suppression"</doc:param-desc>
- </doc:param>
- </doc:template>
- <out:template name="getTaskSuppressionStateText">
- <out:param name="suppression-node"/>
- <out:variable name="suppressionStates">
- <out:if test="$suppression-node/following-sibling::node()[local-name()='runCondition'] != 'runOnFailure' or $suppression-node/preceding-sibling::node()[local-name()='runCondition'] != 'runOnFailure' ">
- <out:if test="$suppression-node/param[@name='Filter_new']">
- <state>
- <xts:string id="DIALOG_SUPPRESSION_NEW"/>
- </state>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_changed' or @name='Filter_unchanged']">
- <state>
- <xts:string id="DIALOG_SUPPRESSION_ONGOING"/>
- <out:if test="$suppression-node/param[@name='Action_topic_filter'] and not($suppression-node/param[@name='Action_topic_filter']/text() = '')">
- <xts:string id="IDS_LIST_START"/>
- <out:text> </out:text>
- <out:call-template name="translate-filter-topic-list">
- <out:with-param name="keyItems" select="$suppression-node/param[@name='Action_topic_filter']"/>
- </out:call-template>
- <xts:text id="IDS_LIST_END"/>
- </out:if>
- </state>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_deleted']">
- <state>
- <xts:string id="DIALOG_SUPPRESSION_CEASED"/>
- </state>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_nil']">
- <state>
- <xts:string id="DIALOG_SUPPRESSION_NO_EVENTS"/>
- </state>
- </out:if>
- <out:if test="$suppression-node/following-sibling::node()[local-name()='taskLevelFilter']!= ''">
- <state>
- <xts:string id="DIALOG_SUPPRESSION_CONDITION"/>
- </state>
- </out:if>
- </out:if>
- </out:variable>
- <out:if test="count($suppressionStates/state) > 0">
- <!--out put the list to text -->
- <out:for-each select="$suppressionStates/state">
- <out:value-of select="."/>
- <out:if test="not(position() = last())">
- <out:text>; </out:text>
- </out:if>
- </out:for-each>
- </out:if>
- </out:template>
- <out:template name="translate-filter-topic-list">
- <out:param name="keyItems" select="''"/>
- <out:variable name="before">
- <out:value-of select="substring-before(normalize-space($keyItems),';')"/>
- </out:variable>
- <out:variable name="after">
- <out:value-of select="substring-after(normalize-space($keyItems),';')"/>
- </out:variable>
- <out:call-template name="topicFilterDisplayLogic">
- <out:with-param name="topicFilter" select="$before"/>
- </out:call-template>
- <out:if test="string-length($after) > 0">
- <xts:string id="IDS_LIST_SEPARATOR"/>
- <out:text> </out:text>
- <out:call-template name="translate-filter-topic-list">
- <out:with-param name="keyItems">
- <out:value-of select="$after"/>
- </out:with-param>
- </out:call-template>
- </out:if>
- </out:template>
- <!--convert from [beh-bleurgh-blahhh]; to blahhh -->
- <out:template name="topicFilterDisplayLogic">
- <out:param name="topicFilter" select="''"/>
- <out:choose>
- <out:when test="contains($topicFilter,'.')">
- <out:call-template name="topicFilterDisplayLogic">
- <out:with-param name="topicFilter">
- <out:value-of select="substring-after($topicFilter,'.')"/>
- </out:with-param>
- </out:call-template>
- </out:when>
- <out:otherwise>
- <out:value-of select="translate($topicFilter, '[]', '')"/>
- </out:otherwise>
- </out:choose>
- </out:template>
- <!--tem,plate to trim whatever is passed to length -->
- <out:template name="chopText">
- <out:param name="trimSize" select="'45'"/>
- <out:param name="text"/>
- <!--trims the descriptions to length -->
- <out:variable name="ellipsis">
- <xts:string id="IDS_LIST_ELLIPSIS"/>
- </out:variable>
- <out:choose>
- <out:when test="string-length($text) > number($trimSize)">
- <out:value-of select="concat(substring($text,1, number($trimSize) - 3),$ellipsis)"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$text"/>
- </out:otherwise>
- </out:choose>
- </out:template>
- </xsl:template>
- <!-- +++++++++++++++++++++++
- outputs the relevant suppression state gif according to the agent definition in the input dom
- +++++++++++++++++++++++++++++-->
- <doc:template type="ui">
- <doc:name>taskSuppressionState</doc:name>
- <doc:desc>This tag creates an "out" template named <getTaskSuppressionStateGif> that outputs an img tag for the relevant suppression state</doc:desc>
- <doc:notes>See <getTaskSuppressionStateGif></doc:notes>
- </doc:template>
- <xsl:template match="agsad:taskSuppressionState">
- <doc:template type="out">
- <doc:name>getTaskSuppressionStateGif</doc:name>
- <doc:desc>This template outputs an img tag for the relevant suppression state</doc:desc>
- <doc:param>
- <doc:param-name>suppression-node</doc:param-name>
- <doc:param-desc>This points to the suppression node within the action of the agent definition that we want the state gif for i.e. "/root/agent_definition/items/item [./id = 'task_id']/suppression"</doc:param-desc>
- </doc:param>
- </doc:template>
- <out:template name="getTaskSuppressionStateGif">
- <out:param name="suppression-node">
- <suppression_test/>
- </out:param>
- <out:variable name="gif_data">
- <gif state="ongoing" name="icon_ongoing.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_ONGOING"/>
- </out:attribute>
- </gif>
- <gif state="ceased" name="icon_ceased.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_CEASED"/>
- </out:attribute>
- </gif>
- <gif state="new" name="icon_new.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW"/>
- </out:attribute>
- </gif>
- <gif state="none" name="icon_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceased" name="icon_ongoing_ceased.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_ONGOING_CEASED"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnew" name="icon_new_ongoing.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_ONGOING"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnone" name="icon_ongoing_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_ONGOING_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednew" name="icon_new_ongoing_ceased.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_ONGOING_CEASED"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednone" name="icon_ongoing_ceased_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_ONGOING_CEASED_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnewnone" name="icon_new_ongoing_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_ONGOING_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednewnone" name="icon_new_ongoing_ceased_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_ONGOING_CEASED_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ceasednew" name="icon_new_ceased.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_CEASED"/>
- </out:attribute>
- </gif>
- <gif state="ceasednone" name="icon_ceased_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_CEASED_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ceasednewnone" name="icon_new_ceased_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_CEASED_NONE"/>
- </out:attribute>
- </gif>
- <gif state="newnone" name="icon_new_empty.gif">
- <out:attribute name="stateInfo">
- <xts:string id="AGS_TASK_STATE_NEW_NONE"/>
- </out:attribute>
- </gif>
- <gif state="ceasedcondition" name="icon_ceased_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_CEASED_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ceasednonecondition" name="icon_ceased_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_CEASED_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ceasednewcondition" name="icon_new_ceased_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_CEASED_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ceasednewnonecondition" name="icon_new_ceased_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_CEASED_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="newcondition" name="icon_new_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="newnonecondition" name="icon_new_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednewcondition" name="icon_new_ongoing_ceased_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_ONGOING_CEASED_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednewnonecondition" name="icon_new_ongoing_ceased_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_ONGOING_CEASED_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnewcondition" name="icon_new_ongoing_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_ONGOING_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnewnonecondition" name="icon_new_ongoing_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_NEW_ONGOING_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasedcondition" name="icon_ongoing_ceased_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_ONGOING_CEASED_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingceasednonecondition" name="icon_ongoing_ceased_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_ONGOING_CEASED_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingcondition" name="icon_ongoing_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_ONGOING_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="ongoingnonecondition" name="icon_ongoing_empty_condition.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_ONGOING_EMPTY_CONDITION"/>
- </out:attribute>
- </gif>
- <gif state="runonfailure" name="icon_failed.gif">
- <out:attribute name="stateInfo">
- <string id="AGS_TASK_STATE_RUN_ON_FAILURE"/>
- </out:attribute>
- </gif>
- </out:variable>
- <out:variable name="state">
- <out:choose>
- <out:when test="$suppression-node/following-sibling::node()[local-name()='runCondition'] != 'runOnFailure' or $suppression-node/preceding-sibling::node()[local-name()='runCondition'] != 'runOnFailure'">
- <out:if test="$suppression-node/param[@name='Filter_changed' or @name='Filter_unchanged']">
- <out:text>ongoing</out:text>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_deleted']">
- <out:text>ceased</out:text>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_new']">
- <out:text>new</out:text>
- </out:if>
- <out:if test="$suppression-node/param[@name='Filter_nil']">
- <out:text>none</out:text>
- </out:if>
- <out:if test="$suppression-node/following-sibling::node()[local-name()='taskLevelFilter'] != '' or $suppression-node/preceding-sibling::node()[local-name()='taskLevelFilter'] != ''">
- <out:text>condition</out:text>
- </out:if>
- </out:when>
- <out:when test="$suppression-node/following-sibling::node()[local-name()='runCondition'] = 'runOnFailure' or $suppression-node/preceding-sibling::node()[local-name()='runCondition'] = 'runOnFailure'">
- <out:text>runonfailure</out:text>
- </out:when>
- </out:choose>
- </out:variable>
- <out:variable name="selected_gif" select="$gif_data/gif[@state=$state]"/>
- <out:choose>
- <out:when test="$selected_gif">
- <out:attribute name="src">
- <out:value-of select="concat('../ags/images/summary/', $selected_gif/@name)"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="src">../ags/images/spacer.gif</out:attribute>
- </out:otherwise>
- </out:choose>
- </out:template>
- </xsl:template>
- <!-- +++++++++++++++++++++++
- outputs a script that when called converts agent blob to js object
- +++++++++++++++++++++++++++++-->
- <doc:template type="script">
- <doc:name>agentDefinition</doc:name>
- <doc:desc>This writes a java script that will load in the page containing all the params of the agent definition and its actions</doc:desc>
- <doc:attr>
- <doc:attr-name>agent-path</doc:attr-name>
- <doc:attr-desc>this points to wherever the actions of the agent definition are found in the input dom something like "/root/agent_definition/items/item"</doc:attr-desc>
- </doc:attr>
- </doc:template>
- <xsl:template match="agsad:agentDefinition">
- <script type="text/javascript">
- <out:variable name="agent-path" select="{@agent-path}"/>
- <out:variable name="event-key">
- <out:value-of select="{concat(@agent-path, '/summaryEventKey')}"/>
- </out:variable>
- <xsl:variable name="text-area" select="@text-area"/>
- function loadAgentActions() {
-
- var cf = parent.getConfigFrame();
- var agent_action = "";
-
- parent.setAgentDefinition(new parent.AgentDefinition());
-
- <!--
- //window.alert("loading agents with event key : <out:value-of select="$event-key"/> and text-area: <xsl:value-of select="$text-area"/> agent path: <out:value-of select="$agent-path"/>" );
- -->
- parent.getAgentDefinition().summaryEventKey = new parent.NonDuplicationItems();
- <out:if test="$event-key and $event-key != ''">
- parent.getAgentDefinition().setSummaryEventKeyValueFromPortalStyleTopics("<out:value-of select="xtsext:urlencode($event-key)"/>");
- //alert(parent.getAgentDefinition().getSummaryEventKeyValueWithPortalStyleTopics());
- //alert(parent.getAgentDefinition().summaryEventKey.toString());
- </out:if>
- <out:for-each select="$agent-path/items/item">
- <out:variable name="name" select="./name"/>
- <out:variable name="id" select="./id"/>
- <out:variable name="displayDetails">
- <out:call-template name="displayDetails">
- <out:with-param name="type"><out:value-of select="./type"/></out:with-param>
- </out:call-template>
- </out:variable>
- <out:variable name="taskLevelFilter" select="./taskLevelFilter"/>
- <out:variable name="runCondition" select="./runCondition"/>
- agent_action = new parent.ActionDefinition("<out:value-of select="xtsext:javascriptencode(string($name))"/>", "<out:value-of select="$id"/>", "<out:value-of select="xtsext:javascriptencode(string($displayDetails/text))"/>", "<out:value-of select="$displayDetails/image"/>","<out:value-of select="xtsext:javascriptencode(string($taskLevelFilter))"/>","<out:value-of select="xtsext:javascriptencode(string($runCondition))"/>");
- <out:for-each select="./suppression/param">
- <out:variable name="param_name" select="@name"/>
- <out:variable name="param_value" select="text()"/>
- <out:variable name="corrected_param_value" select="xtsext:urlencode($param_value)"/>
- agent_action.addPortalStyleParam('<out:value-of select="$param_name"/>', '<out:value-of select="$corrected_param_value"/>');
- </out:for-each>
- <out:if test="$runCondition != 'runOnFailure' ">
- //set the defaults if there are no params set
- addDefaultFilterValues(agent_action);
- </out:if>
- parent.getAgentDefinition().addAction(agent_action);
- </out:for-each>
- }
- </script>
-
- </xsl:template>
- <!--+++++++++++++++++++++++ js validation methods containing localised messages
- +++++++++++++++++++++++-->
- <doc:template type="script">
- <doc:name>AgentValidation</doc:name>
- <doc:desc>This writes a java script that will validate the current agent and do appropriate warnings</doc:desc>
- </doc:template>
- <xsl:template match="agsad:AgentValidation">
-
- </xsl:template>
- <!--+++++++++++++++++++++++
- decode agent blobs
- +++++++++++++++++++++++-->
- <doc:template type="interpret">
- <doc:name>decodeAgentDefinition</doc:name>
- <doc:desc>This expands out to a set of xts that will extract the agent definition blob and from its env param </doc:desc>
- <doc:attr>
- <doc:attr-name>destination</doc:attr-name>
- <doc:attr-desc>this points to wherever the agent should go</doc:attr-desc>
- </doc:attr>
- <doc:notes>this must be used within an xts:sequence element</doc:notes>
- </doc:template>
- <xsl:template match="agsad:decodeAgentDefinition">
- <xsl:variable name="destination">
- <xsl:choose>
- <xsl:when test="@destination">
- <xsl:value-of select="@destination"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/root</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="clean">
- <xsl:choose>
- <xsl:when test="@clean">
- <xsl:value-of select="@clean"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <out:choose>
- <out:when test="/root/env/param[@name = 'agent_definition_blob']">
- <xts:append select="{$destination}">
- <out:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap_settemplatename_decodeagentdefinition_settemplateid_agentdefinition001', string( /root/env/param[@name = 'agent_definition_blob'] )),true() )" disable-output-escaping="yes"/>
- </xts:append>
- <out:if test="'{$clean}' = 'true'">
- <!-- get rid of the blob for the time being-->
- <xts:delete select="/root/env/param[@name = 'agent_definition_blob']"/>
- </out:if>
- </out:when>
- <out:otherwise>
- <xts:append select="{$destination}">
- <out:element name="agent_definition">
- <deletedItems>
- </deletedItems>
- <items>
- </items>
- </out:element>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </xsl:template>
- <!--+++++++++++++++++++++++
- display condition logic
- +++++++++++++++++++++++-->
- <doc:template type="interpret">
- <doc:name>conditionDisplayLogic</doc:name>
- <doc:desc>This expands out to a template that converts the agent condition to a display form </doc:desc>
- <doc:notes>the resulting template takes a param p1, which is the conditiont</doc:notes>
- </doc:template>
- <xsl:template match="agsad:conditionDisplayLogic">
- <!-- The summary of the condition only shows the actual agent item names,
- and not their path or notation, regardless of what is shown in the condition field.
- For example, if the condition is [Trakker].[Bug].[Product] = 'PowerPlay' and
- [Trakker].[Bug].[Status] = 'Open', Product = 'PowerPlay' and Status = 'Open'
- is displayed in the Condition area.
- -->
- <out:template name="conditionDisplayLogic">
- <out:param name="p1"/>
- <!-- split the string -->
- <out:variable name="before" select="substring-before($p1,'[')"/>
- <out:variable name="after" select="substring-after($p1,'[')"/>
- <!-- what to do ??? -->
- <out:choose>
- <!-- 1) we don't have that character present - this could be the case
- if character is at the end but in that case we still can't go further -->
- <out:when test="not($after)">
- <out:value-of select="$p1"/>
- </out:when>
- <!-- 2) we have the character and it's in the middle -->
- <out:when test="$after">
- <!-- output what came before an then start parsing -->
- <out:value-of select="$before"/>
- <out:call-template name="parseRefObj">
- <out:with-param name="p2" select="$after"/>
- </out:call-template>
- </out:when>
- </out:choose>
- </out:template>
-
- <out:template name="parseRefObj">
- <out:param name="p2"/>
- <out:variable name="before" select="substring-before($p2,']')"/>
- <out:variable name="after" select="substring-after($p2,']')"/>
-
- <!-- what to do -->
- <out:choose>
- <!-- we found a start but no end - leave things alone -->
- <out:when test="not($before) and not($after)">
- <out:value-of select="'['"/>
- <out:value-of select="$p2"/>
- </out:when>
- <!-- not an immediate end - may have a name -->
- <out:when test="$after">
- <out:choose>
- <out:when test="starts-with($after,'.[')">
- <!-- we're not at the end - need to go on -->
- <out:call-template name="conditionDisplayLogic">
- <out:with-param name="p1" select="substring-after($after, '.')"/>
- </out:call-template>
- </out:when>
- <out:otherwise>
- <out:value-of select="$before"/>
- <out:call-template name="conditionDisplayLogic">
- <out:with-param name="p1" select="$after"/>
- </out:call-template>
- </out:otherwise>
- </out:choose>
- </out:when>
- <out:when test="$before and not($after)">
- <!-- end tag is right at the end so use it -->
- <out:value-of select="$before"/>
- </out:when>
- </out:choose>
- </out:template>
- </xsl:template>
- <!--+++++++++++++++++++++++
- Encode agent blob
- +++++++++++++++++++++++-->
- <doc:template type="interpret">
- <doc:name>encodeAgentDefinition</doc:name>
- <doc:desc>This expands out to a set of xts that will encode the agent definition blob to its env param </doc:desc>
- <doc:attr>
- <doc:attr-name>source</doc:attr-name>
- <doc:attr-desc>this points to wherever the agent is</doc:attr-desc>
- </doc:attr>
- <doc:attr>
- <doc:attr-name>name</doc:attr-name>
- <doc:attr-desc>this is an optional tag name for the agent definition</doc:attr-desc>
- </doc:attr>
- <doc:notes>this must be used within an xts:sequence element</doc:notes>
- </doc:template>
- <xsl:template match="agsad:encodeAgentDefinition">
- <xsl:variable name="name">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>agent_definition</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="source">
- <xsl:choose>
- <xsl:when test="@source">
- <xsl:value-of select="@source"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/root</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="clean">
- <xsl:choose>
- <xsl:when test="@clean">
- <xsl:value-of select="@clean"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>true</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <out:variable name="markup">
- <out:call-template name="serialize-xml">
- <out:with-param name="node-set" select="{$source}/{$name}"/>
- </out:call-template>
- </out:variable>
- <xts:append select="/root/env">
- <param name="agent_definition_blob">
- <out:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_encodeagentdefinition_settemplateid_agentdefinition002'), xtsext:web64encode( string( $markup ), true()))"/>
- </param>
- </xts:append>
- <out:if test="'{$clean}' = 'true'">
- <xts:delete select="{$source}/{$name}"/>
- </out:if>
- </xsl:template>
- <!--+++++++++++++++++++++++
- Merge agent blobs
- +++++++++++++++++++++++-->
- <doc:template type="interpret">
- <doc:name>mergeAgentDefinition</doc:name>
- <doc:desc>This expands out to a set of xts that will extract the agent definition blob and from its env param and take a modified or partial agent_definition
- and add to and overwrite any common parts
-
- The target for the merge is always /root/agent_definition, but the tree to merge over can be specified by over
- </doc:desc>
- <doc:attr>
- <doc:attr-name>over</doc:attr-name>
- <doc:attr-desc>this points to wherever the ad to merged over is.... the agent_definition node by name</doc:attr-desc>
- </doc:attr>
- <doc:notes>this must be used within an xts:sequence element</doc:notes>
- </doc:template>
- <xsl:template match="agsad:mergeAgentDefinition">
- <xsl:variable name="under">
- <!-- hard set to the standard location -->
- <xsl:text>/root/agent_definition</xsl:text>
- </xsl:variable>
- <xsl:variable name="over">
- <xsl:choose>
- <xsl:when test="@over">
- <xsl:value-of select="@over"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/root/agent_definition</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- merge the over tree to the temp location -->
- <out:if test="{$over}/summaryEventKey">
- <out:choose>
- <out:when test="{$under}/summaryEventKey">
- <xts:replace select="{$under}/summaryEventKey">
- <out:copy-of select="{$over}/summaryEventKey"/>
- </xts:replace>
- </out:when>
- <out:otherwise>
- <xts:append select="{$under}">
- <out:copy-of select="{$over}/summaryEventKey"/>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </out:if>
- <out:if test="{$over}/condition">
- <out:choose>
- <out:when test="{$under}/condition">
- <xts:replace select="{$under}/condition">
- <out:copy-of select="{$over}/condition"/>
- </xts:replace>
- </out:when>
- <out:otherwise>
- <xts:append select="{$under}">
- <out:copy-of select="{$over}/condition"/>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </out:if>
- <out:if test="{$over}/schedule">
- <out:choose>
- <out:when test="{$under}/schedule">
- <xts:replace select="{$under}/schedule">
- <out:copy-of select="{$over}/schedule"/>
- </xts:replace>
- </out:when>
- <out:otherwise>
- <xts:append select="{$under}">
- <out:copy-of select="{$over}/schedule"/>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </out:if>
- <!-- merge the over keeping the suppression state -->
- <out:if test="{$over}/suppressionSet">
- <out:choose>
- <out:when test="{$under}/suppressionSet">
- <xts:replace select="{$under}/suppressionSet">
- <out:copy-of select="{$over}/suppressionSet"/>
- </xts:replace>
- </out:when>
- <out:otherwise>
- <xts:append select="{$under}">
- <out:copy-of select="{$over}/suppressionSet"/>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </out:if>
- <out:if test="{$over}/items">
- <!-- remove all suppression blocks if they exist-->
- <xts:delete select="{$under}/items/item/suppression" mandatory="false"/>
- <!-- remove all taskLevelFilters blocks if they exist-->
- <xts:delete select="{$under}/items/item/taskLevelFilter" mandatory="false"/>
- <xts:delete select="{$under}/items/item/runCondition" mandatory="false"/>
- <out:for-each select="{$over}/items/item">
- <out:variable name="myid" select="./id"/>
- <!--out:message>over id = <out:value-of select="$myid"/> under ids = <out:value-of select="{$under}/items/item/id"/></out:message-->
- <xts:append select="{$under}/items/item[./id = '{{./id}}']">
- <out:copy-of select="./suppression"/>
- </xts:append>
- <xts:append select="{$under}/items/item[./id = '{{./id}}']">
- <out:copy-of select="./taskLevelFilter"/>
- </xts:append>
- <xts:append select="{$under}/items/item[./id = '{{./id}}']">
- <out:copy-of select="./runCondition"/>
- </xts:append>
- </out:for-each>
- </out:if>
- <!-- clean up -->
- <xts:delete select="{$over}"/>
- </xsl:template>
- <xsl:template match="agsad:displayDetails">
- <out:template name="displayDetails">
- <out:param name="type"/>
- <out:variable name="path">
- <out:value-of select="'../ags/images/tasks/'"/>
- </out:variable>
- <out:choose>
- <out:when test="$type = 'job'"><text><xts:string id="AGS_JOB_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_job.gif'"/></image></out:when>
- <out:when test="$type = 'message'"><text><xts:string id="AGS_EMAIL_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_email.gif'"/></image></out:when>
- <out:when test="$type = 'agent'"><text><xts:string id="AGS_AGENT_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_agent.gif'"/></image></out:when>
- <out:when test="$type = 'sql'"><text><xts:string id="AGS_SQL_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_SQL_writeback.gif'"/></image></out:when>
- <out:when test="$type = 'report'"><text><xts:string id="AGS_REPORT_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_report.gif'"/></image></out:when>
- <out:when test="$type = 'web'"><text><xts:string id="AGS_WEB_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_web_service.gif'"/></image></out:when>
- <out:when test="$type = 'import'"><text><xts:string id="AGS_IMPORT_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_import.gif'"/></image></out:when>
- <out:when test="$type = 'export'"><text><xts:string id="AGS_EXPORT_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_export.gif'"/></image></out:when>
- <out:when test="$type = 'content'"><text><xts:string id="AGS_CONTENT_MANAGEMENT_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_content_maintenance.gif'"/></image></out:when>
- <out:when test="$type = 'url' or $type = 'news'"><text><xts:string id="AGS_URL_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_newsitem.gif'"/></image></out:when>
- <out:when test="$type = 'metric'"><text><xts:string id="AGS_METRICS_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_metrics_maintenance.gif'"/></image></out:when>
- <out:when test="$type = 'index'"><text><xts:string id="AGS_INDEX_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_index_update.gif'"/></image></out:when>
- <out:when test="$type = 'planningMacro'"><text><xts:string id="AGS_PLANNING_MACRO_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_planning_macro.gif'"/></image></out:when>
- <out:when test="$type = 'migration'"><text><xts:string id="AGS_MIGRATION_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_new_migration.gif'"/></image></out:when>
- <out:when test="$type = 'approval'"><text><xts:string id="AGS_APPROVAL_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_approval.gif'"/></image></out:when>
- <out:when test="$type = 'notification'"><text><xts:string id="AGS_NOTIFICATION_TASK"/></text><image><out:value-of select="$path"/><out:value-of select="'action_notification.gif'"/></image></out:when>
- <out:otherwise><text/><image><out:value-of select="'../../images/spacer.gif'"/></image></out:otherwise>
- </out:choose>
- </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>
|