leavingAGS.xts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2009
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml,messages/portalRL.xml,messages/AGS.xml" requiredCapability="canUseEventStudio">
  9. <!--
  10. ================================================================================
  11. decode the agent definition blob
  12. ===============================================================================================
  13. -->
  14. <xts:block id="decodeAgentDefinition" processor="XSLT" type="exec" condition=".[not(/root/env/param [@name='controller_state']) or /root/env/param[@name='controller_state']='']" mandatory="false">
  15. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  16. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  17. <xsl:stylesheet version="1.0"
  18. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  19. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  20. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl xtsext xts">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  22. <xsl:template match="/">
  23. <xts:sequence>
  24. <xsl:if test="/root/env/param[@name = 'agent_definition_blob']">
  25. <xts:append select="/root">
  26. <!-- unwrap the puppy-->
  27. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap_settemplatename_decodeagentdefinition_settemplateid_leavingags', string( /root/env/param[@name = 'agent_definition_blob'])), true() )" disable-output-escaping="yes"/>
  28. </xts:append>
  29. </xsl:if>
  30. </xts:sequence>
  31. </xsl:template>
  32. </xsl:stylesheet>
  33. </xts:block>
  34. <!--
  35. ===============================================================================================
  36. Check that the agent exists in content manager
  37. ===============================================================================================
  38. -->
  39. <xts:block id="checkAgentExists" processor="XSLT" type="exec" dependency="decodeAgentDefinition" condition=".[/root/agent_definition/agentDefinition]" mandatory="false">
  40. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  41. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  42. <xsl:stylesheet version="1.0"
  43. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  44. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  45. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  46. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  47. exclude-result-prefixes="xsl xtsext cml send">
  48. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  49. <xsl:template match="/">
  50. <xts:sequence>
  51. <xts:append>
  52. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  53. <send:request provider="cm" requester="AGS:leavingAGS">
  54. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  55. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  56. <cm:requests>
  57. <cm:query>
  58. <cm:search><xsl:value-of select="/root/agent_definition/agentDefinition"/></cm:search>
  59. <cm:properties>
  60. <cm:property name="searchPath"/>
  61. </cm:properties>
  62. </cm:query>
  63. </cm:requests>
  64. </cm:query>
  65. </xts:transform>
  66. </send:request>
  67. </xts:transform>
  68. </xts:append>
  69. <xts:append select="root/env">
  70. <param name="agentSearchPath">
  71. <xts:transform name="XMLEncode">
  72. <xts:queryValue select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='searchPath']"/>
  73. </xts:transform>
  74. </param>
  75. </xts:append>
  76. </xts:sequence>
  77. </xsl:template>
  78. </xsl:stylesheet>
  79. </xts:block>
  80. <xts:block id="page" dependency="checkAgentExists" type="exec" mode="output" processor="XSLT" mimeType="text/html">
  81. <!-- get the debug logic sheet -->
  82. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  83. <!-- get the new theme stuff -->
  84. <xts:logicsheet path="logicsheets/portal.xsl"/>
  85. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  86. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  87. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  88. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  89. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  90. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  91. <!-- apply the form logic -->
  92. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  93. <xsl:stylesheet version="1.0"
  94. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  95. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  96. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  97. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  98. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  99. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  100. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  101. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  102. xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/"
  103. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  104. exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg xtsext">
  105. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  106. <!-- add any theme variables -->
  107. <df:variables/>
  108. <pf:variables/>
  109. <!--check the search path for this agent, if it does not exist then the agent may have been delete
  110. agentLinkBroken has a value of true or false only
  111. SEC_INFO agentLinkBroken is not javascript encoded, it is always a boolean value true|false
  112. -->
  113. <xsl:variable name="agentLinkBroken">
  114. <xsl:value-of select="/root/env/param[@name='agentSearchPath']=''"/>
  115. </xsl:variable>
  116. <!-- start the output -->
  117. <xsl:template match="/root">
  118. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page>
  119. <dp:script>
  120. <meta name="Copyright" content="Copyright (C) 2008 Cognos Incorporated. All Rights Reserved."/>
  121. <meta name="Trademark" content="Cognos and the Cognos logo are trademarks of Cognos Incorporated."/>
  122. <script type="text/javascript" src="../qs/layout.js">//</script>
  123. <script type="text/javascript">
  124. function yesNoSave(bSave) {
  125. var cf = parent.getConfigFrame();
  126. cf.hideDialogFrame();
  127. if (bSave) {
  128. // Find whether to save or saveAs
  129. var saveCommands = cf.getSaveCommandStack();
  130. var currentStack = cf.getCommandStackManager().getCommandStack();
  131. var newStack = currentStack.concat(saveCommands);
  132. //add the appropriate cmds to get a save done
  133. cf.getCommandStackManager().setCommandStack(newStack);
  134. }
  135. //get on with the next command
  136. cf.getCommandStackManager().processCommandStack();
  137. // This is called each time we leave the saved agent to change the schedule icon for
  138. // schedule the agent task to default.
  139. parent.toggleScheduleState(null, true);
  140. }
  141. function cancel(){
  142. var cf = parent.getConfigFrame();
  143. cf.getCommandStackManager().getCommandStack().clear();
  144. cf.hideDialogFrame();
  145. }
  146. //check if the agent has been saved and that the agent link has been broken. If any
  147. //of these conditions are true then popup the 'save' dialog
  148. function init() {
  149. var agentLinkBroken = <xsl:value-of select="string($agentLinkBroken)"/>;
  150. var cf = parent.getConfigFrame();
  151. with(cf) {
  152. var mgr = getCommandStackManager();
  153. //alert('leavingAGS: new agent:'+cfgGet("NewReport")+', link broken?:'+agentLinkBroken+', agent changed?:'+hasAgentChanged());
  154. //check if this agent has a broken link, 'NewReport' means that the agent is new
  155. if(cfgGet("NewReport")==false &amp;&amp; agentLinkBroken) {
  156. //fire the save command, the save template will automatically detect a broken link and show a warning dialog followed by a 'save as' dialog
  157. var saveCommands = mgr.createCommandStack("checkCAF()","commandStackHideDialogFrame()","calcAgentState()","getSaveValidateMessages()", "displayValidateMessages()", 'save()');
  158. var currentStack = mgr.getCommandStack();
  159. var newStack = currentStack.concat(saveCommands);
  160. //add the appropriate cmds to get a save done
  161. mgr.setCommandStack(newStack);
  162. //get on with the next command
  163. mgr.processCommandStack();
  164. }
  165. //show the warning informing the user that the agent has changed in some way
  166. else if (hasAgentChanged()) {
  167. showDialogFrame(160);
  168. }
  169. //just get on with the next command
  170. else {
  171. mgr.processCommandStack();
  172. parent.toggleScheduleState(null, true);
  173. }
  174. }
  175. }
  176. </script>
  177. </dp:script>
  178. <form name="f" method="POST">
  179. <!-- dialog header -->
  180. <dp:header help="false">
  181. <!-- header titles -->
  182. <dp:title>
  183. <xsl:choose>
  184. <xsl:when test="/root/env/param[@name='newAfterSave']">
  185. <xts:string id="SAVE_ERROR_TITLE"/>
  186. </xsl:when>
  187. <xsl:otherwise>
  188. <xts:string id="EXIT"/>
  189. </xsl:otherwise>
  190. </xsl:choose>
  191. </dp:title>
  192. <!-- close link for the header -->
  193. <dp:close>
  194. <a href="#" onclick="cancel()">
  195. <dp:closeMarker/>
  196. </a>
  197. </dp:close>
  198. <!-- description (hint text) -->
  199. <dp:description/>
  200. </dp:header>
  201. <!-- layout -->
  202. <lyt:layout style="1" border="no">
  203. <lyt:section>
  204. <!-- the agent has not been saved-->
  205. <dp:box valign="top">
  206. <dp:boxSection hgap="20">
  207. <img width="32" height="32" align="top" hspace="10">
  208. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  209. </img>
  210. </dp:boxSection>
  211. <dp:boxSection>
  212. <dp:description>
  213. <xts:string id="AGENT_MODIFIED"/><br/><br/>
  214. <xts:string id="SAVE_AGENT_QUESTION"/>
  215. </dp:description>
  216. </dp:boxSection>
  217. </dp:box>
  218. </lyt:section>
  219. </lyt:layout>
  220. <lyt:layout style="1">
  221. <lyt:section>
  222. <dp:buttonGroup>
  223. <df:button df:id="DIALOG_YES_BUTTON" df:style="href" df:href="#" onclick="yesNoSave(true);"/>
  224. <df:button df:id="DIALOG_NO_BUTTON" df:style="href" df:href="#" onclick="yesNoSave(false);"/>
  225. <df:button df:id="DIALOG_CANCEL_BUTTON" df:style="href" df:href="#" onclick="cancel();"/>
  226. </dp:buttonGroup>
  227. </lyt:section>
  228. <lyt:section/>
  229. </lyt:layout>
  230. </form>
  231. </dp:page>
  232. </xsl:template>
  233. </xsl:stylesheet>
  234. </xts:block>
  235. </xts:morphlet>