email_options_ags.xts 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495
  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, 2022
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!--
  13. =================================================================================================================================
  14. email_options_ags.xts
  15. view email_interface.xml for information on the API.
  16. this legacy email_option file is for those components who are not compitable with Dojo solution (e.g. rich text editor) yet.
  17. =================================================================================================================================
  18. -->
  19. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  20. <!--
  21. ===============================================================================================
  22. processRequestParams - Default any params that weren't passed in. Also this is where we would
  23. do validation (when time permits).
  24. ===============================================================================================
  25. -->
  26. <xts:block id="processRequestParams" processor="XSLT" type="exec" nodeList="/root/*[local-name()='requestParams']">
  27. <xsl:stylesheet version="1.0"
  28. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  29. exclude-result-prefixes="xsl">
  30. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  31. <xsl:template match="/">
  32. <xts:sequence>
  33. <xts:append select="/root/*[local-name()='requestParams']">
  34. <xts:transform src="portal/controls/gen_default_parameters.xslt" processor="XSLT">
  35. <root>
  36. <xts:transform name="XML">
  37. <xts:param name="systemId">portal/emailOptions/email_interface.xml</xts:param>
  38. </xts:transform>
  39. <xsl:copy-of select="/root/*[local-name()='requestParams']"/>
  40. </root>
  41. </xts:transform>
  42. </xts:append>
  43. </xts:sequence>
  44. </xsl:template>
  45. </xsl:stylesheet>
  46. </xts:block>
  47. <!--
  48. ===============================================================================================
  49. returnResult - We're done with the email options morphlet, so return the appropriate response
  50. ===============================================================================================
  51. -->
  52. <xts:block id="returnResult" type="exec" processor="XSLT" dependency="processResponse processRequestParams" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'genDefault' or /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'next' or /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'back' or /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished' or /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'canceled']" mandatory="false">
  53. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  54. <xsl:stylesheet version="1.0"
  55. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  56. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  57. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  58. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  59. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  60. exclude-result-prefixes="xsl xos xtsext">
  61. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  62. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  63. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  64. <xsl:key name="session-param" match="/root/session/param" use="@name"/>
  65. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  66. <xsl:template match="/">
  67. <xts:sequence>
  68. <xts:append select="/root/output">
  69. <!-- build a part -->
  70. <xts:transform name="Null" option="part" mimeType="text/xml">
  71. <xsl:element name="{key('request-param','resultNode')}" namespace="">
  72. <xsl:choose>
  73. <xsl:when test="key('request-param','requestState') = 'canceled'">
  74. <canceled/>
  75. </xsl:when>
  76. <!-- generate default delivery options -->
  77. <xsl:when test="key('request-param','requestState') = 'genDefault'">
  78. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  79. <root>
  80. <xts:transform src="portal/emailOptions/transforms/delivery_items.xslt" processor="XSLT">
  81. <root>
  82. <xsl:if test="key('session-param','e_hp')!='' and key('session-param','e_hp')!='CAMID(&quot;::Anonymous&quot;)'">
  83. <xts:transform src="portal/emailOptions/transforms/generateEmailTo.xslt" processor="XSLT">
  84. <root>
  85. <e_hp><xsl:value-of select="key('session-param','e_hp')"/></e_hp>
  86. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  87. <send:request provider="cm">
  88. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  89. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  90. <search>
  91. <xsl:value-of select="'~'"/>
  92. </search>
  93. <properties>
  94. <cm:property name="email"/>
  95. <cm:property name="notificationEMail"/>
  96. <cm:property name="iconURI"/>
  97. </properties>
  98. </query>
  99. </xts:transform>
  100. </send:request>
  101. </xts:transform>
  102. <xsl:if test="key('request-param','subscription')='true'">
  103. <!-- add another node to say to use the notification email address -->
  104. <subscription/>
  105. </xsl:if>
  106. </root>
  107. </xts:transform>
  108. </xsl:if>
  109. <xsl:choose>
  110. <xsl:when test="key('request-param','defaultEmailAsAttachment')='true' and key('request-param','hideEmailAsAttachment')='false' and not(key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment)"><param name="m_ro_emailAsAttachment">true</param></xsl:when>
  111. <xsl:otherwise><param name="m_ro_emailAsAttachment">false</param></xsl:otherwise>
  112. </xsl:choose>
  113. <xsl:choose>
  114. <xsl:when test="key('request-param','defaultEmailAsAttachment')='true'"><param name="m_ro_emailAsURL">false</param></xsl:when>
  115. <xsl:when test="key('request-param','hideLinkToReport')='false'"><param name="m_ro_emailAsURL">true</param></xsl:when>
  116. <xsl:otherwise><param name="m_ro_emailAsURL">false</param></xsl:otherwise>
  117. </xsl:choose>
  118. <param name="email_subject">
  119. <xsl:choose>
  120. <!-- use the supplied subject when we're given one - else we just make it up -->
  121. <xsl:when test="key('request-param','defaultSubject')">
  122. <xsl:value-of select="key('request-param','defaultSubject')"/>
  123. </xsl:when>
  124. <!-- only time we'd be defaulting the delivery options and we have a step class if for reports -->
  125. <!-- Don't pretty print the following section since it'll add spaces in the default subject -->
  126. <xsl:when test="key('env-param','step-class') != ''"><xts:string id="IDS_EMAIL_OPTIONS_REPORT_PREFIX"/><xsl:value-of select="concat(' ',key('env-param','step_default_name'))"/></xsl:when>
  127. <xsl:when test="key('env-param','m_class')='jobDefinition' or key('env-param','m_new_class')='jobDefinition'"><xts:string id="IDS_EMAIL_OPTIONS_JOB_PREFIX"/><xsl:choose><xsl:when test="key('env-param','m_p_defaultName')"><xsl:value-of select="concat(' ',key('env-param','m_p_defaultName'))"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(' ',key('env-param','m_name'))"/></xsl:otherwise></xsl:choose></xsl:when>
  128. <xsl:otherwise><xts:string id="IDS_EMAIL_OPTIONS_REPORT_PREFIX"/><xsl:choose><xsl:when test="key('env-param','ui.name')"><xsl:value-of select="concat(' ',key('env-param','ui.name'))"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(' ',key('env-param','m_name'))"/></xsl:otherwise></xsl:choose></xsl:otherwise>
  129. </xsl:choose>
  130. </param>
  131. <xsl:copy-of select="/root/*[local-name()='requestParams']"/>
  132. </root>
  133. </xts:transform>
  134. </root>
  135. </xts:transform>
  136. <!-- return the task name -->
  137. <xsl:if test="key('request-param','agentStudio') = 'true' or key('request-param','subscription') = 'true'">
  138. <xsl:call-template name="buildAgentVars"/>
  139. </xsl:if>
  140. </xsl:when>
  141. <xsl:otherwise>
  142. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  143. <root>
  144. <xts:transform src="portal/emailOptions/transforms/delivery_items.xslt" processor="XSLT">
  145. <root>
  146. <xts:transform src="portal/emailOptions/transforms/process_email_address.xslt" processor="XSLT">
  147. <root>
  148. <xsl:copy-of select="/root/env"/>
  149. <xsl:if test="key('env-param','addedRecipients') != ''">
  150. <xsl:choose>
  151. <!-- if the 'to', 'cc' or 'bcc' fields have changed then rebuild the addedRecipients list -->
  152. <xsl:when test="key('env-param','recipientsChanged')='true'">
  153. <xts:transform src="portal/emailOptions/transforms/move_recipients.xslt" processor="XSLT">
  154. <root>
  155. <addedRecipients>
  156. <xts:transform name="XMLDecode">
  157. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','addedRecipients'))), true())"/>
  158. </xts:transform>
  159. </addedRecipients>
  160. <toField><xsl:value-of select="key('env-param','email_to')"/></toField>
  161. <ccField><xsl:value-of select="key('env-param','email_cc')"/></ccField>
  162. <bccField><xsl:value-of select="key('env-param','email_bcc')"/></bccField>
  163. </root>
  164. </xts:transform>
  165. </xsl:when>
  166. <xsl:otherwise>
  167. <addedRecipients>
  168. <xts:transform name="XMLDecode">
  169. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','addedRecipients'))), true())"/>
  170. </xts:transform>
  171. </addedRecipients>
  172. </xsl:otherwise>
  173. </xsl:choose>
  174. </xsl:if>
  175. </root>
  176. </xts:transform>
  177. <!-- links and attachments -->
  178. <xsl:if test="key('env-param','links') != ''">
  179. <links>
  180. <xts:transform src="portal/emailOptions/transforms/delete_links_attachments.xslt" processor="XSLT">
  181. <root>
  182. <xts:transform name="XMLDecode">
  183. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','links'))), true())"/>
  184. </xts:transform>
  185. <deleted>
  186. <xsl:copy-of select="/root/env/param[starts-with(@name,'deleted_link_') and .='true']"/>
  187. </deleted>
  188. </root>
  189. </xts:transform>
  190. </links>
  191. </xsl:if>
  192. <!-- attachments -->
  193. <xsl:if test="key('env-param','attachments') != ''">
  194. <attachments>
  195. <xts:transform src="portal/emailOptions/transforms/delete_links_attachments.xslt" processor="XSLT">
  196. <root>
  197. <xts:transform name="XMLDecode">
  198. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','attachments'))), true())"/>
  199. </xts:transform>
  200. <deleted>
  201. <xsl:copy-of select="/root/env/param[starts-with(@name,'deleted_attachment_') and .='true']"/>
  202. </deleted>
  203. </root>
  204. </xts:transform>
  205. </attachments>
  206. </xsl:if>
  207. <!-- richEditBody - validate HTML for allowed tags only-->
  208. <!-- only perform this transform when we are in Rich Edit Mode -->
  209. <xsl:if test="key('env-param','hidden_richEditBody') != '' and key('env-param','richEditMode')='true'">
  210. <xts:transform xmlns:xts="http://developer.cognos.com/schemas/xts/" name="VALIDATE">
  211. <xsl:choose>
  212. <xsl:when test="key('system-param','allow-email-links')='true'">
  213. <xts:param name="noNamespaceSchemaLocation">portal/emailOptions/schemas/richEditBodyPartial.xsd</xts:param>
  214. </xsl:when>
  215. <xsl:otherwise>
  216. <xts:param name="noNamespaceSchemaLocation">portal/emailOptions/schemas/richEditBodyFull.xsd</xts:param>
  217. </xsl:otherwise>
  218. </xsl:choose>
  219. <!-- use the normalizeEmailBody transform to change all element names to uppercase and all atrributes to lowercase -->
  220. <xts:transform src="portal/emailOptions/transforms/normalizeEmailBody.xslt" processor="XSLT">
  221. <xsl:value-of select="/root/env/param[@name='hidden_richEditBody']" disable-output-escaping="yes"/>
  222. </xts:transform>
  223. </xts:transform>
  224. </xsl:if>
  225. <xsl:copy-of select="/root/*[local-name()='requestParams']"/>
  226. </root>
  227. </xts:transform>
  228. </root>
  229. </xts:transform>
  230. <!-- return the task name -->
  231. <xsl:if test="key('request-param','agentStudio') = 'true' or key('request-param','subscription') = 'true'">
  232. <xsl:call-template name="buildAgentVars"/>
  233. </xsl:if>
  234. </xsl:otherwise>
  235. </xsl:choose>
  236. </xsl:element>
  237. </xts:transform>
  238. </xts:append>
  239. </xts:sequence>
  240. </xsl:template>
  241. <xsl:template name="buildAgentVars">
  242. <!-- taskName isn't shown in the UI anymore (trakker bug 478414). Agent studio wants the email subject
  243. returned as the taskName -->
  244. <xsl:variable name="quote">"</xsl:variable>
  245. <xsl:variable name="apos">'</xsl:variable>
  246. <xsl:variable name="task_name">
  247. <xsl:choose>
  248. <xsl:when test="key('env-param','email_subject') and key('env-param','email_subject')!=''">
  249. <xsl:value-of select="key('env-param','email_subject')"/>
  250. </xsl:when>
  251. <xsl:when test="key('request-param','defaultSubject') and key('request-param','defaultSubject')!=''">
  252. <xsl:value-of select="key('request-param','defaultSubject')"/>
  253. </xsl:when>
  254. <xsl:otherwise>
  255. <xsl:value-of select="key('request-param','taskName')"/>
  256. </xsl:otherwise>
  257. </xsl:choose>
  258. </xsl:variable>
  259. <taskName>
  260. <xsl:choose>
  261. <xsl:when test="contains($task_name,$quote) and contains($task_name,$apos)">
  262. <xsl:value-of select="translate($task_name,$quote,$apos)"/>
  263. </xsl:when>
  264. <xsl:otherwise>
  265. <xsl:value-of select="$task_name"/>
  266. </xsl:otherwise>
  267. </xsl:choose>
  268. </taskName>
  269. <hasAttachment>
  270. <xsl:choose>
  271. <xsl:when test="key('env-param','attachments') != '' or key('env-param','links') != ''">true</xsl:when>
  272. <xsl:otherwise>false</xsl:otherwise>
  273. </xsl:choose>
  274. </hasAttachment>
  275. </xsl:template>
  276. </xsl:stylesheet>
  277. </xts:block>
  278. <!--
  279. ===============================================================================================
  280. callMorphlet - Calls the appropriate morphlet using the passed in params which will return
  281. markup to be displayed or the expected results
  282. ===============================================================================================
  283. -->
  284. <xts:block id="callMorphlet" processor="XSLT" type="exec" dependency="processRequestParams" condition=".[ starts-with(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'],'addEntries') or starts-with(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'],'addLinks') ]" mandatory="false">
  285. <xts:logicsheet path="logicsheets/portal.xsl"/>
  286. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  287. <xsl:stylesheet version="1.0"
  288. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  289. xmlns:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/"
  290. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  291. xmlns:req-params="http://developer.cognos.com/schemas/request/params"
  292. exclude-result-prefixes="xsl dlgctrl xtsext req-params">
  293. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  294. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  295. <xsl:template match="/">
  296. <xts:sequence>
  297. <xsl:choose>
  298. <xsl:when test="starts-with(key('request-param','requestState'),'addEntries')">
  299. <dlgctrl:XTS2Request>
  300. <dlgctrl:target>/portal/addEntries/add_entries.xts</dlgctrl:target>
  301. <dlgctrl:stackName>add_entries</dlgctrl:stackName>
  302. <req-params:param name="defaultTarget"><xsl:value-of select="key('request-param','defaultTarget')"/></req-params:param>
  303. <req-params:param name="titlePostfix"><xsl:value-of select="key('request-param','titlePostfix')"/></req-params:param>
  304. <req-params:param name="defaultSearchPath">/directory</req-params:param>
  305. <req-params:param name="showUsers">true</req-params:param>
  306. <req-params:param name="addEntriesUI"><xsl:value-of select="'recipients'"/></req-params:param>
  307. <req-params:param name="returnProperties">
  308. <req-params:property name="userName"/>
  309. </req-params:param>
  310. <req-params:param name="isPopup"><xsl:value-of select="key('request-param','addEntriesPopUp')"/></req-params:param>
  311. <req-params:param name="agentStudio"><xsl:value-of select="key('request-param','agentStudio')"/></req-params:param>
  312. </dlgctrl:XTS2Request>
  313. </xsl:when>
  314. <xsl:when test="starts-with(key('request-param','requestState'),'addLinks')">
  315. <dlgctrl:XTS2Request>
  316. <dlgctrl:target>/portal/addEntries/add_entries.xts</dlgctrl:target>
  317. <dlgctrl:stackName>add_entries</dlgctrl:stackName>
  318. <req-params:param name="defaultTarget"><xsl:value-of select="key('request-param','defaultTarget')"/></req-params:param>
  319. <req-params:param name="titlePostfix"><xsl:value-of select="key('request-param','titlePostfix')"/></req-params:param>
  320. <req-params:param name="defaultSearchPath">/content</req-params:param>
  321. <req-params:param name="addEntriesUI"><xsl:value-of select="'links'"/></req-params:param>
  322. <req-params:param name="isPopup"><xsl:value-of select="key('request-param','addEntriesPopUp')"/></req-params:param>
  323. <req-params:param name="allowRootBrowsing"><xsl:value-of select="'true'"/></req-params:param>
  324. <req-params:param name="agentStudio"><xsl:value-of select="key('request-param','agentStudio')"/></req-params:param>
  325. </dlgctrl:XTS2Request>
  326. </xsl:when>
  327. </xsl:choose>
  328. </xts:sequence>
  329. </xsl:template>
  330. </xsl:stylesheet>
  331. </xts:block>
  332. <!--
  333. ===============================================================================================
  334. processReponse - Process the response from the callMorphlet block and either displays
  335. the markup or processes the results
  336. ===============================================================================================
  337. -->
  338. <xts:block id="processResponse" processor="XSLT" dependency="callMorphlet processRequestParams" type="exec" condition=".[ starts-with(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'],'addEntries') or starts-with(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'],'addLinks')]" mandatory="false">
  339. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  340. <xts:logicsheet path="logicsheets/portal.xsl"/>
  341. <xsl:stylesheet version="1.0"
  342. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  343. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  344. xmlns:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/"
  345. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  346. exclude-result-prefixes="xsl dlgctrl xtsext pf">
  347. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  348. <xsl:template match="/">
  349. <xts:sequence>
  350. <dlgctrl:processXTS2Response>
  351. <dlgctrl:stackName>add_entries</dlgctrl:stackName>
  352. <!-- if we got markup back, then simply send it back to the calling morphlet.
  353. email options should never have to take care of displaying the add entries markup -->
  354. <dlgctrl:mode match="markup"/>
  355. <!-- got back selected entries -->
  356. <dlgctrl:mode match="selectedEntries">
  357. <xsl:if test="/root/*[local-name()='morphletResponse']/*[local-name()='selectedEntries'] != ''">
  358. <xts:append select="/root">
  359. <selectedEntries>
  360. <xts:transform name="XMLDecode">
  361. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/*[local-name()='morphletResponse']/*[local-name()='selectedEntries'])), true())"/>
  362. </xts:transform>
  363. </selectedEntries>
  364. </xts:append>
  365. </xsl:if>
  366. </dlgctrl:mode>
  367. </dlgctrl:processXTS2Response>
  368. </xts:sequence>
  369. </xsl:template>
  370. </xsl:stylesheet>
  371. </xts:block>
  372. <!--
  373. ===============================================================================================
  374. businessRules - Take care off any business logic to simplify the UI generation
  375. ===============================================================================================
  376. -->
  377. <xts:block id="businessRules" type="exec" processor="XSLT" dependency="processResponse processRequestParams" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup' or /root/*[local-name()='morphletResponse']/*[local-name()='selectedEntries' or local-name()='canceled']]" mandatory="false">
  378. <xts:logicsheet path="logicsheets/portal.xsl"/>
  379. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  380. <xsl:stylesheet version="1.0"
  381. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  382. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  383. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  384. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  385. exclude-result-prefixes="xsl xtsext">
  386. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  387. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  388. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  389. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  390. <pf:variables/>
  391. <xsl:template match="/">
  392. <xts:sequence>
  393. <!-- if it's the first time we hit this page -->
  394. <xsl:if test="not(/root/env/param[@name='email_body']) and not(/root/env/param[@name='hidden_richEditBody'])">
  395. <xts:append select="/root">
  396. <defaultOptions>
  397. <!-- transform the options blob passed in into env params -->
  398. <xsl:if test="key('request-param','options') != ''">
  399. <xts:transform src="portal/emailOptions/transforms/parse_options.xslt" processor="XSLT">
  400. <xts:transform name="XMLDecode">
  401. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('request-param','options'))), true())"/>
  402. </xts:transform>
  403. </xts:transform>
  404. </xsl:if>
  405. </defaultOptions>
  406. </xts:append>
  407. <!-- append all the params to env -->
  408. <xts:append select="/root/env">
  409. <xts:queryNode select="/root/defaultOptions/*[local-name() = 'param']"/>
  410. </xts:append>
  411. </xsl:if>
  412. <!-- if the 'to', 'cc', or 'bcc' fields have changed, then we must update the blob -->
  413. <xsl:if test="key('env-param','recipientsChanged')='true' and key('env-param','addedRecipients')!=''">
  414. <!-- create the new added recipients list -->
  415. <xts:append select="/root">
  416. <xts:transform src="portal/emailOptions/transforms/move_recipients.xslt" processor="XSLT">
  417. <root>
  418. <addedRecipients>
  419. <xts:transform name="XMLDecode">
  420. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','addedRecipients'))), true())"/>
  421. </xts:transform>
  422. </addedRecipients>
  423. <toField><xsl:value-of select="key('env-param','email_to')"/></toField>
  424. <ccField><xsl:value-of select="key('env-param','email_cc')"/></ccField>
  425. <bccField><xsl:value-of select="key('env-param','email_bcc')"/></bccField>
  426. </root>
  427. </xts:transform>
  428. </xts:append>
  429. <!-- delete the old list -->
  430. <xts:delete select="/root/env/param[@name='addedRecipients']"/>
  431. <!-- web64 encode the new list -->
  432. <xts:append select="/root/env">
  433. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  434. <param name="addedRecipients">
  435. <passport><xsl:value-of select="$passport"/></passport>
  436. <markup>
  437. <xts:transform name="XMLEncode">
  438. <xts:queryNode select="/root/addedRecipients/*"/>
  439. </xts:transform>
  440. </markup>
  441. </param>
  442. </xts:transform>
  443. </xts:append>
  444. </xsl:if>
  445. <!-- if we're in Event studio, then deal with the links and attachments -->
  446. <xsl:if test="key('request-param','agentStudio') = 'true'">
  447. <!-- links -->
  448. <xsl:choose>
  449. <!-- if the user delete any links -->
  450. <xsl:when test="key('env-param','links') != '' and /root/env/param[starts-with(@name,'deleted_link_')]='true'">
  451. <xts:append select="/root">
  452. <links>
  453. <xts:transform src="portal/emailOptions/transforms/delete_links_attachments.xslt" processor="XSLT">
  454. <root>
  455. <xts:transform name="XMLDecode">
  456. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','links'))), true())"/>
  457. </xts:transform>
  458. <deleted>
  459. <xsl:copy-of select="/root/env/param[starts-with(@name,'deleted_link_') and .='true']"/>
  460. </deleted>
  461. </root>
  462. </xts:transform>
  463. </links>
  464. </xts:append>
  465. <!-- delete the old list -->
  466. <xts:delete select="/root/env/param[@name='links']"/>
  467. <!-- web64 encode the new list -->
  468. <xts:append select="/root/env">
  469. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  470. <param name="links">
  471. <passport><xsl:value-of select="$passport"/></passport>
  472. <markup>
  473. <xts:transform name="XMLEncode">
  474. <xts:queryNode select="/root/links/*"/>
  475. </xts:transform>
  476. </markup>
  477. </param>
  478. </xts:transform>
  479. </xts:append>
  480. </xsl:when>
  481. <!-- unpack the list of links and attachments -->
  482. <xsl:when test="key('env-param','links') != ''">
  483. <xts:append>
  484. <links>
  485. <xts:transform name="XMLDecode">
  486. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','links'))), true())"/>
  487. </xts:transform>
  488. </links>
  489. </xts:append>
  490. </xsl:when>
  491. </xsl:choose>
  492. <!-- attachments -->
  493. <xsl:choose>
  494. <!-- if the user delete any links -->
  495. <xsl:when test="key('env-param','attachments') != '' and /root/env/param[starts-with(@name,'deleted_attachment_')]='true'">
  496. <xts:append select="/root">
  497. <attachments>
  498. <xts:transform src="portal/emailOptions/transforms/delete_links_attachments.xslt" processor="XSLT">
  499. <root>
  500. <xts:transform name="XMLDecode">
  501. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','attachments'))), true())"/>
  502. </xts:transform>
  503. <deleted>
  504. <xsl:copy-of select="/root/env/param[starts-with(@name,'deleted_attachment_') and .='true']"/>
  505. </deleted>
  506. </root>
  507. </xts:transform>
  508. </attachments>
  509. </xts:append>
  510. <!-- delete the old list -->
  511. <xts:delete select="/root/env/param[@name='attachments']"/>
  512. <!-- web64 encode the new list -->
  513. <xts:append select="/root/env">
  514. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  515. <param name="attachments">
  516. <passport><xsl:value-of select="$passport"/></passport>
  517. <markup>
  518. <xts:transform name="XMLEncode">
  519. <xts:queryNode select="/root/attachments/*"/>
  520. </xts:transform>
  521. </markup>
  522. </param>
  523. </xts:transform>
  524. </xts:append>
  525. </xsl:when>
  526. <!-- unpack the list of links and attachments -->
  527. <xsl:when test="key('env-param','attachments') != ''">
  528. <xts:append>
  529. <attachments>
  530. <xts:transform name="XMLDecode">
  531. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(key('env-param','attachments'))), true())"/>
  532. </xts:transform>
  533. </attachments>
  534. </xts:append>
  535. </xsl:when>
  536. </xsl:choose>
  537. </xsl:if>
  538. <xts:append select="/root">
  539. <businessRules>
  540. <!-- browser title -->
  541. <browserTitle>
  542. <xsl:text/>
  543. <xsl:choose>
  544. <xsl:when test="key('request-param','titlePostfix') != ''">
  545. <xts:string id="IDS_COMBINE_TITLE">
  546. <xts:param name="prefix"><xsl:value-of select="key('request-param','titlePrefix')"/></xts:param>
  547. <xts:param name="postfix"><xsl:value-of select="key('request-param','titlePostfix')"/></xts:param>
  548. </xts:string>
  549. </xsl:when>
  550. <xsl:otherwise>
  551. <xsl:value-of select="key('request-param','titlePrefix')"/>
  552. </xsl:otherwise>
  553. </xsl:choose>
  554. <xsl:text/>
  555. </browserTitle>
  556. <!-- description -->
  557. <description>
  558. <xsl:choose>
  559. <xsl:when test="key('request-param','agentStudio') = 'true' and key('request-param','burst') != 'true'" >
  560. <xsl:text/><xts:string id="IDS_EMAIL_OPTIONS_AGENT_STUDIO_INTRO"/><xsl:text/>
  561. </xsl:when>
  562. <xsl:when test="key('request-param','agentStudio') = 'true' and key('request-param','burst') = 'true'" >
  563. <xsl:text/><xts:string id="IDS_EMAIL_OPTIONS_AGENT_STUDIO_INTRO_BURST"/><xsl:text/>
  564. </xsl:when>
  565. <xsl:when test="key('request-param','burst') = 'true'">
  566. <xsl:text/><xts:string id="IDS_EMAIL_OPTIONS_BURST_INTRO"/><xsl:text/>
  567. </xsl:when>
  568. <xsl:when test="key('request-param','subscription') = 'true'">
  569. <xsl:text/><xts:string id="IDS_EMAIL_OPTIONS_SUBSCRIPTION_INTRO"/><xsl:text/>
  570. </xsl:when>
  571. <xsl:otherwise>
  572. <xsl:text/><xts:string id="IDS_EMAIL_OPTIONS_INTRODUCTION"/><xsl:text/>
  573. </xsl:otherwise>
  574. </xsl:choose>
  575. </description>
  576. <!-- should we show the email as attachment checkbox -->
  577. <allowEmailAsAttachment>
  578. <xsl:variable name="s" select="concat(' ', key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment/@show, ' ')"/>
  579. <xsl:choose>
  580. <xsl:when test="key('request-param', 'agentStudio')='true' and not(key('request-param','hideEmailAsAttachment'))">false</xsl:when>
  581. <xsl:when test="key('request-param','hideEmailAsAttachment') = 'true'">false</xsl:when>
  582. <xsl:when test="
  583. not(key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment)
  584. or
  585. (
  586. key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment
  587. and
  588. (
  589. (contains($s, 'Administrators') and $hasAdminCapability) or
  590. (contains($s, 'QSUsers') and $hasFullQSCapability) or
  591. (contains($s, 'RSUsers') and $hasFullRSCapability) or
  592. (contains($s, 'Consumers') and $is-named='1') or
  593. (contains($s, 'Anonymous') and $is-named='0') or
  594. (key('system-param', 'ui_groups')/group[contains($s, concat(' ', @id, ' ')) and contains( key('session-param', 'uig'), concat(' ', @id, ' '))])
  595. )
  596. )">
  597. <xsl:value-of select="'true'"/>
  598. </xsl:when>
  599. <xsl:otherwise>
  600. <xsl:value-of select="'false'"/>
  601. </xsl:otherwise>
  602. </xsl:choose>
  603. </allowEmailAsAttachment>
  604. <allowLinkToReport>
  605. <xsl:choose>
  606. <xsl:when test="key('request-param','agentStudio')='true' and not(key('request-param','hideLinkToReport'))">false</xsl:when>
  607. <xsl:when test="key('request-param','hideLinkToReport')='false'">true</xsl:when>
  608. <xsl:otherwise>false</xsl:otherwise>
  609. </xsl:choose>
  610. </allowLinkToReport>
  611. <allowAttachMenu>
  612. <xsl:variable name="checkShowParam" select="concat(' ', key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment/@show, ' ')"/>
  613. <xsl:choose>
  614. <xsl:when test="key('request-param','hideAttachMenu')='false' and (not(key('system-param', 'ui_hide')/CC_RUN_OPTIONS_email_attachment) or
  615. (contains($checkShowParam, 'Administrators') and $hasAdminCapability)) or
  616. (contains($checkShowParam, 'QSUsers') and $hasFullQSCapability) or
  617. (contains($checkShowParam, 'RSUsers') and $hasFullRSCapability) or
  618. (key('system-param', 'ui_groups')/group[contains($checkShowParam, concat(' ', @id, ' ')) and contains( key('session-param', 'uig'), concat(' ', @id, ' '))])">true</xsl:when>
  619. <xsl:otherwise>false</xsl:otherwise>
  620. </xsl:choose>
  621. </allowAttachMenu>
  622. <allowAddLinksAction>
  623. <xsl:choose>
  624. <xsl:when test="key('request-param','hideAddLinks')='false'">true</xsl:when>
  625. <xsl:otherwise>false</xsl:otherwise>
  626. </xsl:choose>
  627. </allowAddLinksAction>
  628. </businessRules>
  629. </xts:append>
  630. </xts:sequence>
  631. </xsl:template>
  632. </xsl:stylesheet>
  633. </xts:block>
  634. <!--
  635. ===============================================================================================
  636. queryCMForOptionsInfo - If the options blob passed had recipients which referenced CM, then
  637. we must query for those recipients. Also if the options blob had attachments or links then
  638. query CM for the information need to display the UI
  639. ===============================================================================================
  640. -->
  641. <xts:block id="queryCMForOptionsInfo" type="exec" processor="XSLT" dependency="businessRules" condition=".[/root/*[local-name()='defaultOptions']/*[local-name()='attachments'] or /root/*[local-name()='defaultOptions']/*[local-name()='link'] or /root/*[local-name()='defaultOptions']/*[local-name()='to'] or /root/*[local-name()='defaultOptions']/*[local-name()='cc'] or /root/*[local-name()='defaultOptions']/*[local-name()='bcc']]" mandatory="false">
  642. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  643. <xsl:stylesheet version="1.0"
  644. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  645. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  646. exclude-result-prefixes="xsl send">
  647. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  648. <xsl:key name="recipient-search-paths" match="/root/*[local-name()='defaultOptions']/*[local-name()='to' or local-name()='cc' or local-name()='bcc']/*[local-name()='searchPath']" use="."/>
  649. <xsl:key name="links-search-paths" match="/root/*[local-name()='defaultOptions']/*[local-name()='attachment' or local-name()='link']/*[local-name()='item']/*[local-name()='searchPath']" use="."/>
  650. <xsl:key name="default-options" match="/root/*[local-name()='defaultOptions']/*" use="local-name()"/>
  651. <xsl:variable name="passport">
  652. <xsl:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
  653. </xsl:variable>
  654. <xsl:template match="/">
  655. <!-- recipients -->
  656. <xts:sequence>
  657. <xsl:if test="key('default-options','to') or key('default-options','cc') or key('default-options','bcc')">
  658. <xts:append select="/root">
  659. <xsl:variable name="unique-search-paths" select="/root/*[local-name()='defaultOptions']/*[local-name()='to' or local-name()='cc' or local-name()='bcc']/*[local-name()='searchPath'][generate-id(.)=generate-id(key('recipient-search-paths',.))]"/>
  660. <selectedEntries>
  661. <!-- Make sure we add 'unknown' items in our list for every nil queryReply we got back from CM -->
  662. <xts:transform src="portal/emailOptions/transforms/add-unknown-entries.xslt" processor="XSLT">
  663. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  664. <root>
  665. <!-- transform the CM result into the same structure that the add entries returns. This will allow us to use
  666. the same transforms to update the email fields and the recipients blob -->
  667. <xts:transform src="portal/emailOptions/transforms/gen-standard-list.xslt" processor="XSLT">
  668. <root>
  669. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  670. <send:request provider="cm">
  671. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  672. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  673. <cm:requests>
  674. <xsl:for-each select="$unique-search-paths">
  675. <xsl:if test=". != ''">
  676. <cm:query>
  677. <cm:search>
  678. <xsl:value-of select="."/>
  679. </cm:search>
  680. <cm:properties>
  681. <cm:property name="defaultName"/>
  682. <cm:property name="searchPath"/>
  683. <cm:property name="userName"/>
  684. <cm:property name="iconURI"/>
  685. </cm:properties>
  686. </cm:query>
  687. </xsl:if>
  688. </xsl:for-each>
  689. </cm:requests>
  690. </cm:query>
  691. </xts:transform>
  692. </send:request>
  693. </xts:transform>
  694. <defaultOptions>
  695. <xsl:copy-of select="/root/defaultOptions/*[local-name()='to' or local-name()='cc' or local-name()='bcc']"/>
  696. </defaultOptions>
  697. <action>recipients</action>
  698. </root>
  699. </xts:transform>
  700. <defaultOptions>
  701. <xsl:copy-of select="/root/defaultOptions/*[local-name()='to' or local-name()='cc' or local-name()='bcc']"/>
  702. </defaultOptions>
  703. </root>
  704. </xts:transform>
  705. </selectedEntries>
  706. </xts:append>
  707. </xsl:if>
  708. </xts:sequence>
  709. <!-- links -->
  710. <xts:sequence>
  711. <xsl:if test="key('default-options','link') and /root/*[local-name()='defaultOptions']/*[local-name()='link']/*[local-name()='item']/*[local-name()='searchPath'] != ''">
  712. <xts:append select="/root">
  713. <links>
  714. <!-- transform the CM result into the same structure that the add entries returns. This will allow us to use
  715. the same transforms to update the email fields and the recipients blob -->
  716. <xts:transform src="portal/emailOptions/transforms/gen-standard-list.xslt" processor="XSLT">
  717. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  718. <root>
  719. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  720. <send:request provider="cm">
  721. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  722. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  723. <cm:requests>
  724. <xsl:for-each select="/root/*[local-name()='defaultOptions']/*[local-name()='link']/*[local-name()='item']/*[local-name()='searchPath' and .!='']">
  725. <cm:query>
  726. <cm:search>
  727. <xsl:value-of select="."/><xsl:value-of select="/root/system/param[@name='visible']"/>
  728. </cm:search>
  729. <cm:properties>
  730. <cm:property name="defaultName"/>
  731. <cm:property name="searchPath"/>
  732. <cm:property name="iconURI"/>
  733. </cm:properties>
  734. </cm:query>
  735. </xsl:for-each>
  736. </cm:requests>
  737. </cm:query>
  738. </xts:transform>
  739. </send:request>
  740. </xts:transform>
  741. <action>links</action>
  742. </root>
  743. </xts:transform>
  744. </links>
  745. </xts:append>
  746. <!-- web64 encode the list of links -->
  747. <xts:append select="/root/env">
  748. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  749. <param name="links">
  750. <passport><xsl:value-of select="$passport"/></passport>
  751. <markup>
  752. <xts:transform name="XMLEncode">
  753. <xts:queryNode select="/root/links/*"/>
  754. </xts:transform>
  755. </markup>
  756. </param>
  757. </xts:transform>
  758. </xts:append>
  759. </xsl:if>
  760. </xts:sequence>
  761. <!-- attachments -->
  762. <xts:sequence>
  763. <xsl:if test="key('default-options','attachments') or key('default-options','eventOutput')">
  764. <xts:append select="/root">
  765. <attachments>
  766. <!-- transform the CM result into the same structure that the add entries returns. This will allow us to use
  767. the same transforms to update the email fields and the recipients blob -->
  768. <xts:transform src="portal/emailOptions/transforms/gen-standard-list.xslt" processor="XSLT">
  769. <xts:param name="messageBase">/messages/portalRL.xml</xts:param>
  770. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  771. <root>
  772. <xsl:if test="key('default-options','attachments') and /root/*[local-name()='defaultOptions']/*[local-name()='attachments']/*[local-name()='item']/*[local-name()='searchPath' and not(starts-with(.,'AgentTask-'))] != ''">
  773. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  774. <send:request provider="cm">
  775. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  776. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  777. <cm:requests>
  778. <xsl:for-each select="/root/*[local-name()='defaultOptions']/*[local-name()='attachments']/*[local-name()='item' and ./*[local-name()='format']!='']/*[local-name()='searchPath' and .!='' and not(starts-with(.,'AgentTask-'))]">
  779. <cm:query>
  780. <cm:search>
  781. <xsl:value-of select="."/><xsl:value-of select="/root/system/param[@name='visible']"/>
  782. </cm:search>
  783. <cm:properties>
  784. <cm:property name="defaultName"/>
  785. <cm:property name="searchPath"/>
  786. <cm:property name="iconURI"/>
  787. </cm:properties>
  788. </cm:query>
  789. </xsl:for-each>
  790. </cm:requests>
  791. </cm:query>
  792. </xts:transform>
  793. </send:request>
  794. </xts:transform>
  795. </xsl:if>
  796. <action>attachments</action>
  797. <defaultOptions>
  798. <xsl:copy-of select="/root/defaultOptions/*[local-name()='attachments']"/>
  799. <eventOutput>
  800. <xsl:copy-of select="/root/defaultOptions/*[local-name()='eventOutput']"/>
  801. </eventOutput>
  802. </defaultOptions>
  803. <attachParam>
  804. <xsl:copy-of select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*"/>
  805. </attachParam>
  806. </root>
  807. </xts:transform>
  808. </attachments>
  809. </xts:append>
  810. <!-- web64 encode the list of links -->
  811. <xts:append select="/root/env">
  812. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  813. <param name="attachments">
  814. <passport><xsl:value-of select="$passport"/></passport>
  815. <markup>
  816. <xts:transform name="XMLEncode">
  817. <xts:queryNode select="/root/attachments/*"/>
  818. </xts:transform>
  819. </markup>
  820. </param>
  821. </xts:transform>
  822. </xts:append>
  823. </xsl:if>
  824. </xts:sequence>
  825. </xsl:template>
  826. </xsl:stylesheet>
  827. </xts:block>
  828. <!--
  829. ================================================================================
  830. decode the agent items
  831. ===============================================================================================
  832. -->
  833. <xts:block id="decode_agent_definition" processor="XSLT" type="exec" nodelist="env" dependency="processResponse processRequestParams queryCMForOptionsInfo" condition=".[/root/*[local-name()='selectedEntries'] or /root/env/param[@name='addAttachment']!='']" mandatory="false">
  834. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xts xtsext">
  835. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  836. <xsl:template match="/">
  837. <xts:sequence>
  838. <xsl:if test="/root/env/param[@name = 'agent_definition_blob']">
  839. <xts:append select="/root">
  840. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap_settemplatename_decodeagentdefinition_settemplateid_seqagenttasks001',string( /root/env/param[@name = 'agent_definition_blob'])), true() )" disable-output-escaping="yes"/>
  841. </xts:append>
  842. </xsl:if>
  843. </xts:sequence>
  844. </xsl:template>
  845. </xsl:stylesheet>
  846. </xts:block>
  847. <!--
  848. ===============================================================================================
  849. updateAddedLists
  850. ===============================================================================================
  851. -->
  852. <xts:block id="updateAddedLists" type="exec" processor="XSLT" dependency="decode_agent_definition" condition=".[/root/*[local-name()='selectedEntries'] or /root/env/param[@name='addAttachment']!='']" mandatory="false">
  853. <xts:logicsheet path="logicsheets/portal.xsl"/>
  854. <xsl:stylesheet version="1.0"
  855. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  856. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  857. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  858. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  859. exclude-result-prefixes="xsl send xtsext pf">
  860. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  861. <pf:serialize-xml/>
  862. <!-- Session variables -->
  863. <xsl:variable name="passport">
  864. <xsl:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
  865. </xsl:variable>
  866. <xsl:template match="/">
  867. <xts:sequence>
  868. <xsl:choose>
  869. <!-- adding attachments -->
  870. <xsl:when test="/root/env/param[@name='addAttachment'] != ''">
  871. <xts:delete select="/root/attachments"/>
  872. <xts:append select="/root">
  873. <attachments>
  874. <xts:transform src="portal/emailOptions/transforms/update_entries_list.xslt" processor="XSLT">
  875. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  876. <xts:param name="messageBase">/messages/portalRL.xml</xts:param>
  877. <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
  878. <root>
  879. <createWeb64Param>false</createWeb64Param>
  880. <action>addingAttachments</action>
  881. <attachmentToAdd>
  882. <xsl:copy-of select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*[string(position())=string(/root/env/param[@name='addAttachment'])]/*"/>
  883. <xsl:if test="not(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*[string(position())=string(/root/env/param[@name='addAttachment'])]/*[local-name()='locale'])">
  884. <locale/>
  885. </xsl:if>
  886. <xsl:if test="not(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*[string(position())=string(/root/env/param[@name='addAttachment'])]/*[local-name()='format'])">
  887. <format/>
  888. </xsl:if>
  889. <xsl:if test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*[string(position())=string(/root/env/param[@name='addAttachment']) and local-name()='eventOutput']">
  890. <eventOutput>true</eventOutput>
  891. </xsl:if>
  892. </attachmentToAdd>
  893. <xsl:if test="/root/env/param[@name='attachments'] != ''">
  894. <previouslyAdded>
  895. <xts:transform name="XMLDecode">
  896. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/env/param[@name='attachments'])), true())"/>
  897. </xts:transform>
  898. </previouslyAdded>
  899. </xsl:if>
  900. <defaultFormat><xsl:value-of select="/root/agent_definition/agentOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='outputFormat']/*[local-name()='value']"/></defaultFormat>
  901. <defaultLocale><xsl:value-of select="/root/agent_definition/agentOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='outputLocale']/*[local-name()='value']"/></defaultLocale>
  902. </root>
  903. </xts:transform>
  904. </attachments>
  905. </xts:append>
  906. <!-- web64 the list of links and attachments -->
  907. <xts:delete select="/root/env/param[@name='attachments']"/>
  908. <xts:append select="/root/env">
  909. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  910. <param name="attachments">
  911. <passport><xsl:value-of select="$passport"/></passport>
  912. <markup>
  913. <xts:transform name="XMLEncode">
  914. <xts:queryNode select="/root/attachments/*"/>
  915. </xts:transform>
  916. </markup>
  917. </param>
  918. </xts:transform>
  919. </xts:append>
  920. </xsl:when>
  921. <!-- added links -->
  922. <xsl:when test="/root/env/param[@name='addingLinks']='true'">
  923. <xts:delete select="/root/links"/>
  924. <xts:append select="/root">
  925. <links>
  926. <xts:transform src="portal/emailOptions/transforms/update_entries_list.xslt" processor="XSLT">
  927. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  928. <xts:param name="messageBase">/messages/portalRL.xml</xts:param>
  929. <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
  930. <root>
  931. <createWeb64Param>false</createWeb64Param>
  932. <selectedEntries>
  933. <xts:queryNode select="/root/selectedEntries/*"/>
  934. </selectedEntries>
  935. <action>addingLinks</action>
  936. <xsl:if test="/root/env/param[@name='links'] != ''">
  937. <previouslyAdded>
  938. <xts:transform name="XMLDecode">
  939. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/env/param[@name='links'])), true())"/>
  940. </xts:transform>
  941. </previouslyAdded>
  942. </xsl:if>
  943. </root>
  944. </xts:transform>
  945. </links>
  946. </xts:append>
  947. <!-- web64 the list of links and attachments -->
  948. <xts:delete select="/root/env/param[@name='links']"/>
  949. <xts:append select="/root/env">
  950. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  951. <param name="links">
  952. <passport><xsl:value-of select="$passport"/></passport>
  953. <markup>
  954. <xts:transform name="XMLEncode">
  955. <xts:queryNode select="/root/links/*"/>
  956. </xts:transform>
  957. </markup>
  958. </param>
  959. </xts:transform>
  960. </xts:append>
  961. </xsl:when>
  962. <!-- added recipients -->
  963. <xsl:otherwise>
  964. <xsl:variable name="env" select="/root/env"/>
  965. <xts:delete select="/root/env/param[@name='email_to' or @name='email_cc' or @name='email_bcc' or @name='addedRecipients']"/>
  966. <xts:append select="/root/env">
  967. <xts:transform src="portal/emailOptions/transforms/update_email_recipients.xslt" processor="XSLT">
  968. <xts:param name="messageBase">/messages/portalRL.xml</xts:param>
  969. <root>
  970. <xsl:copy-of select="$env"/>
  971. <selectedEntries>
  972. <xts:queryNode select="/root/selectedEntries/*"/>
  973. </selectedEntries>
  974. <xsl:if test="/root/env/param[@name='addedRecipients'] != ''">
  975. <previouslyAdded>
  976. <xts:transform name="XMLDecode">
  977. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/env/param[@name='addedRecipients'])), true())"/>
  978. </xts:transform>
  979. </previouslyAdded>
  980. </xsl:if>
  981. </root>
  982. </xts:transform>
  983. <xts:transform src="portal/emailOptions/transforms/update_entries_list.xslt" processor="XSLT">
  984. <xts:param name="messageBase">/messages/portalRL.xml</xts:param>
  985. <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
  986. <root>
  987. <passport><xsl:value-of select="$passport"/></passport>
  988. <paramName>addedRecipients</paramName>
  989. <selectedEntries>
  990. <xts:queryNode select="/root/selectedEntries/*"/>
  991. </selectedEntries>
  992. <xsl:if test="/root/env/param[@name='addedRecipients'] != ''">
  993. <previouslyAdded>
  994. <xts:transform name="XMLDecode">
  995. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/env/param[@name='addedRecipients'])), true())"/>
  996. </xts:transform>
  997. </previouslyAdded>
  998. </xsl:if>
  999. <action>addingRecipients</action>
  1000. </root>
  1001. </xts:transform>
  1002. </xts:append>
  1003. <!-- if the user just added recipients to the bcc, then make sure the bcc field will be visible -->
  1004. <xsl:if test="/root/*[local-name()='selectedEntries']/*/*[local-name()='type'] = 'bcc'">
  1005. <xts:append select="/root">
  1006. <showBccField>true</showBccField>
  1007. </xts:append>
  1008. </xsl:if>
  1009. </xsl:otherwise>
  1010. </xsl:choose>
  1011. </xts:sequence>
  1012. </xsl:template>
  1013. </xsl:stylesheet>
  1014. </xts:block>
  1015. <!--
  1016. ===============================================================================================
  1017. genMarkup -
  1018. ===============================================================================================
  1019. -->
  1020. <xts:block id="genMarkup" type="exec" processor="XSLT" dependency="updateAddedLists queryCMForOptionsInfo businessRules processRequestParams" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup' or /root/*[local-name()='morphletResponse']/*[local-name()='selectedEntries' or local-name()='canceled']]" mandatory="false">
  1021. <!-- logicsheets -->
  1022. <!-- portal specific information -->
  1023. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1024. <!-- Dialog specific logicsheets -->
  1025. <xts:logicsheet path="portal/emailOptions/logicsheets/ui-templates.xsl"/>
  1026. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  1027. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  1028. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  1029. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  1030. <!-- Generic logicsheets -->
  1031. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  1032. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  1033. <xts:logicsheet path="logicsheets/validation.xslt"/>
  1034. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  1035. <xsl:stylesheet version="1.0"
  1036. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  1037. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  1038. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  1039. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  1040. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  1041. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  1042. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  1043. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  1044. xmlns:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/"
  1045. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  1046. xmlns:eut="http://developer.cognos.com/schemas/xts/logicsheets/xslt/emailOptions/logicsheets/"
  1047. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  1048. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  1049. exclude-result-prefixes="xts xsl cm pf xtsext lyt dp df cf cp xos dlgctrl eut bus">
  1050. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  1051. <xsl:key name="business-rules" match="/root/businessRules/*" use="local-name()"/>
  1052. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  1053. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  1054. <pf:variables/>
  1055. <pf:gen-icon/>
  1056. <xsl:variable name="agentStudio" select="key('request-param','agentStudio') = 'true'"/>
  1057. <xsl:variable name="inWizard" select="key('request-param','inWizard') = 'true'"/>
  1058. <xsl:variable name="subscription" select="key('request-param','subscription') = 'true'"/>
  1059. <xsl:variable name="hideInsertButton" select="key('request-param','hideInsertButton') = 'true'"/>
  1060. <xsl:variable name="environmentVars" select="/root/header/bus:biBusHeader/bus:hdrSession/*[local-name() = 'environmentVars']"/>
  1061. <xsl:variable name="user-agent1" select="$environmentVars/item[name='HTTP_USER_AGENT']/value"/>
  1062. <xsl:variable name="browsername">
  1063. <xsl:choose>
  1064. <xsl:when test="contains($user-agent1 , 'MSIE')">ie</xsl:when> <!-- IE 4.xx and above -->
  1065. <xsl:when test="contains($user-agent1 , 'Edge')">ie</xsl:when> <!-- Edge -->
  1066. <xsl:when test="contains($user-agent1 , 'Safari/5') and not(contains($user-agent , 'Chrome'))">safari</xsl:when> <!-- Safari user-agent does not contain Chrome -->
  1067. <xsl:when test="contains($user-agent1 , 'Chrome')">chrome</xsl:when> <!-- Chrome user-agent contains Safari also -->
  1068. <xsl:when test="contains($user-agent1 , 'Mozilla/5.0')">moz</xsl:when> <!-- NS 6.xx and 7.xx -->
  1069. <xsl:when test="contains($user-agent1 , 'Mozilla/4.')">ns4</xsl:when> <!-- NS 4.xx -->
  1070. <xsl:when test="string-length($user-agent1) = 0">undefined</xsl:when>
  1071. <xsl:otherwise>other</xsl:otherwise>
  1072. </xsl:choose>
  1073. </xsl:variable>
  1074. <!-- IE, FF and Chrome supported now for rich text editor -->
  1075. <xsl:variable name="richEditMode">
  1076. <xsl:choose>
  1077. <xsl:when test="($browsername = 'ie' or $browsername = 'moz' or $browsername = 'chrome') and not(key('env-param','richEditMode'))">true</xsl:when>
  1078. <xsl:when test="$browsername = 'ie' or $browsername = 'moz' or $browsername = 'chrome'"><xsl:value-of select="key('env-param','richEditMode')"/></xsl:when>
  1079. <xsl:otherwise>false</xsl:otherwise>
  1080. </xsl:choose>
  1081. </xsl:variable>
  1082. <xsl:variable name="bccVisible">
  1083. <xsl:choose>
  1084. <xsl:when test="/root/showBccField = 'true'">true</xsl:when>
  1085. <xsl:when test="key('env-param','bccVisible')!=''"><xsl:value-of select="key('env-param','bccVisible')"/></xsl:when>
  1086. <xsl:when test="key('env-param','email_bcc')!=''">true</xsl:when>
  1087. <xsl:otherwise>false</xsl:otherwise>
  1088. </xsl:choose>
  1089. </xsl:variable>
  1090. <xsl:template match="/">
  1091. <xts:sequence>
  1092. <xts:append select="/root/output">
  1093. <xos:part>
  1094. <xos:entityHeader>
  1095. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  1096. </xos:entityHeader>
  1097. <xos:entityBody>
  1098. <xsl:element name="{key('request-param','resultNode')}" namespace="">
  1099. <markup>
  1100. <xts:transform name="XMLEncode">
  1101. <!-- adds standard hidden inputs and javascript -->
  1102. <dlgctrl:markupHelper/>
  1103. <input type="hidden" name="addedRecipients" value="{key('env-param','addedRecipients')}"/>
  1104. <input type="hidden" name="links" value="{key('env-param','links')}"/>
  1105. <input type="hidden" name="attachments" value="{key('env-param','attachments')}"/>
  1106. <input type="hidden" name="recipientsChanged" value="false"/>
  1107. <input type="hidden" name="addingLinks" value="false"/>
  1108. <input type="hidden" name="addAttachment" value=""/>
  1109. <input type="hidden" name="richEditMode" value="{$richEditMode}"/>
  1110. <input type="hidden" name="bccVisible" value="{$bccVisible}"/>
  1111. <input type="hidden" name="visited_email_options" value="true"/>
  1112. <xsl:if test="key('request-param', 'usePowerPlay8Options') = 'true'">
  1113. <input type="hidden" name="usePowerPlay8Options" value="true"/>
  1114. </xsl:if>
  1115. <xsl:if test="key('request-param','burst') = 'true'">
  1116. <input type="hidden" name="m_ro_burst" value="true"/>
  1117. </xsl:if>
  1118. <pf:help context="HID_DISTRIBUTION"/>
  1119. <xsl:choose>
  1120. <xsl:when test="key('request-param','headerStyle')='page'">
  1121. <eut:header close='false' border='false' help='false'>
  1122. <dp:image>
  1123. <img alt="" border="0">
  1124. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>icon_email_24.gif</xsl:attribute>
  1125. </img>
  1126. </dp:image>
  1127. <dp:title>
  1128. <xsl:value-of select="key('business-rules','browserTitle')"/>
  1129. </dp:title>
  1130. <dp:description>
  1131. <xsl:value-of select="key('business-rules','description')"/>
  1132. </dp:description>
  1133. </eut:header>
  1134. </xsl:when>
  1135. <xsl:otherwise>
  1136. <dp:header>
  1137. <dp:title>
  1138. <xsl:value-of select="key('business-rules','browserTitle')"/>
  1139. </dp:title>
  1140. <dp:description>
  1141. <xsl:value-of select="key('business-rules','description')"/>
  1142. </dp:description>
  1143. <dp:close>
  1144. <a href="#" onclick="controller_changeState('canceled'); controller_submitForm('cancel');">
  1145. <dp:closeMarker/>
  1146. </a>
  1147. </dp:close>
  1148. </dp:header>
  1149. </xsl:otherwise>
  1150. </xsl:choose>
  1151. <xsl:if test="$agentStudio">
  1152. <script type="text/javascript" src="{$webRoot}/ags/dragDropHandler.js"/>
  1153. <script type="text/javascript" src="{$webRoot}/ags/layout.js"/>
  1154. <script type="text/javascript" src="{$webRoot}/ags/AccessibilityHandler.js"/>
  1155. <script type="text/javascript" src="{$webRoot}/ags/RTEHelper.js"/>
  1156. </xsl:if>
  1157. <script type="text/javascript" src="{$webRoot}/bi/lib/ckeditor/4.17.2/ckeditor.js"></script>
  1158. <script language="javascript">
  1159. <xsl:choose>
  1160. <xsl:when test="$agentStudio">
  1161. var textRange;
  1162. function insertDataItemsToRTE()
  1163. {
  1164. var dropText = '';// processSelectedNodes();
  1165. dropText = processSelectedNodes_ForCKEditorRTE();
  1166. if(dropText != null)
  1167. {
  1168. var tempDropText = dropText.toString();
  1169. if(tempDropText != null)
  1170. {
  1171. tempDropText = tempDropText.replace(/\],\[/g, "][");
  1172. CKEDITOR.instances.email_body_iframe.insertHtml(tempDropText);
  1173. }
  1174. }
  1175. }
  1176. function init()
  1177. {
  1178. document.execCommand("AutoUrlDetect", false, false);
  1179. droppy.registerDropZone("email_to","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;,true);
  1180. droppy.registerDropZone("email_cc","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;,true);
  1181. droppy.registerDropZone("email_bcc","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;,true);
  1182. droppy.registerDropZone("email_subject","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;,false);
  1183. if (document.<xsl:value-of select="key('request-param','formName')"/>.richEditMode.value == 'true')
  1184. {
  1185. richEditControl_init();
  1186. }
  1187. else
  1188. {
  1189. var dropZone = new DropZone("email_body","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;);
  1190. droppy.registerDropZoneObject(dropZone);
  1191. //pass the dropzone as a group to let the listener process swaps to the html body
  1192. droppy.registerDropZoneGroup(new Array(dropZone), &quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;);
  1193. }
  1194. }
  1195. function deleteLinksAndAttachments()
  1196. {
  1197. var foundSelectedItems = false;
  1198. <xsl:variable name="linksCount" select="count(/root/*[local-name()='links']/*[local-name()='item'])+1"/>
  1199. frm = document.<xsl:value-of select="key('request-param','formName')"/>;
  1200. for (var i=1; i&lt;<xsl:value-of select="$linksCount"/>; i++)
  1201. {
  1202. tableName = 'linkTable_' + i;
  1203. table = document.getElementById(tableName);
  1204. if (table &amp;&amp; table.className == 'emailItem_active')
  1205. {
  1206. table.className = 'hidden';
  1207. hiddenInputName = 'deleted_link_' + i;
  1208. document.getElementById(hiddenInputName).value = 'true';
  1209. foundSelectedItems = true;
  1210. }
  1211. }
  1212. <xsl:variable name="attachmentCount" select="count(/root/*[local-name()='attachments']/*[local-name()='item'])+1"/>
  1213. for (var i=1; i&lt;<xsl:value-of select="$attachmentCount"/>; i++)
  1214. {
  1215. tableName = 'attachTable_' + i;
  1216. table = document.getElementById(tableName);
  1217. if (table &amp;&amp; table.className == 'emailItem_active')
  1218. {
  1219. table.className = 'hidden';
  1220. hiddenInputName = 'deleted_attachment_' + i;
  1221. document.getElementById(hiddenInputName).value = 'true';
  1222. foundSelectedItems = true;
  1223. }
  1224. }
  1225. return foundSelectedItems;
  1226. }
  1227. function mouseOverLinkAttach(item)
  1228. {
  1229. if (item.className == 'emailItem')
  1230. {
  1231. item.className = 'emailItem_hover';
  1232. }
  1233. }
  1234. function mouseOutLinkAttach(item)
  1235. {
  1236. if (item.className == 'emailItem_hover')
  1237. {
  1238. item.className = 'emailItem';
  1239. }
  1240. }
  1241. function mouseDownLinkAttach(item)
  1242. {
  1243. if (item.className == 'emailItem_active')
  1244. {
  1245. item.className = 'emailItem';
  1246. }
  1247. else if (item.className == 'emailItem' || item.className == 'emailItem_hover')
  1248. {
  1249. item.className = 'emailItem_active';
  1250. }
  1251. }
  1252. function attach(position)
  1253. {
  1254. if (document.<xsl:value-of select="key('request-param','formName')"/>.addAttachment) {
  1255. document.<xsl:value-of select="key('request-param','formName')"/>.addAttachment.value = position;
  1256. }
  1257. controller_submitForm('default');
  1258. }
  1259. </xsl:when>
  1260. <xsl:otherwise>
  1261. function init()
  1262. {
  1263. document.execCommand("AutoUrlDetect", false, false);
  1264. if (document.<xsl:value-of select="key('request-param','formName')"/>.richEditMode.value == 'true') {
  1265. richEditControl_init();
  1266. }
  1267. if (document.<xsl:value-of select="key('request-param','formName')"/>.controller_state)
  1268. {
  1269. document.<xsl:value-of select="key('request-param','formName')"/>.controller_state.value = '<xsl:value-of select="xtsext:javascriptencode(key('env-param','controller_state'))"/>';
  1270. }
  1271. if (document.getElementById("email_to"))
  1272. {
  1273. document.getElementById("email_to").focus();
  1274. }
  1275. }
  1276. </xsl:otherwise>
  1277. </xsl:choose>
  1278. function changedEmailRecipients()
  1279. {
  1280. <!-- update the changed flag so we know that we should regenerate the added entries blob -->
  1281. document.<xsl:value-of select="key('request-param','formName')"/>.recipientsChanged.value = 'true';
  1282. }
  1283. function validate()
  1284. {
  1285. var frm = document.<xsl:value-of select="key('request-param','formName')"/>;
  1286. <xsl:if test="key('request-param','burst')!='true'">
  1287. if ( frm.email_to.value == '' &amp;&amp; frm.email_cc.value == '' &amp;&amp; frm.email_bcc.value == '')
  1288. {
  1289. alert("<xts:string id="IDS_EMAIL_OPTIONS_NO_RECIPIENTS" encode="javascript"/>");
  1290. return false;
  1291. }
  1292. </xsl:if>
  1293. leavingDialog();
  1294. return true;
  1295. }
  1296. <!-- makes sure all the hidden inputs are properlly set before leavingt the
  1297. email options dialog -->
  1298. function leavingDialog()
  1299. {
  1300. var frm = document.<xsl:value-of select="key('request-param','formName')"/>;
  1301. <!-- we need to get the plain text body since the memopart needs both the html and plain text body -->
  1302. if (frm.richEditMode &amp;&amp; frm.richEditMode.value == 'true')
  1303. {
  1304. frm.email_body.value = CKEDITOR.instances.email_body_iframe.document.getBody().getText();
  1305. if (frm.hidden_richEditBody)
  1306. {
  1307. // copy the contents of the edit window into a form field
  1308. frm.hidden_richEditBody.value = richEditControl_convertToXHTML();
  1309. }
  1310. }
  1311. <!-- we're in plain text mode, so make sure the hidden HTML input gets updated -->
  1312. else
  1313. {
  1314. if (frm.hidden_richEditBody)
  1315. {
  1316. frm.hidden_richEditBody.value = replaceCarriageReturns(htmlEncode(frm.email_body.value),'&lt;br/&gt;');
  1317. }
  1318. }
  1319. }
  1320. function setFormTarget()
  1321. {
  1322. <xsl:choose>
  1323. <xsl:when test="key('request-param','addEntriesPopUp')='true' and key('request-param','addEntriesPopUpTarget')!=''">
  1324. document.<xsl:value-of select="key('request-param','formName')"/>.target = '<xsl:value-of select="key('request-param','addEntriesPopUpTarget')"/>';
  1325. </xsl:when>
  1326. <xsl:when test="key('request-param','addEntriesPopUp')='true'">
  1327. document.<xsl:value-of select="key('request-param','formName')"/>.target = 'addEntriesFrame';
  1328. </xsl:when>
  1329. </xsl:choose>
  1330. return;
  1331. }
  1332. function unsetFormTarget()
  1333. {
  1334. <xsl:if test="key('request-param','addEntriesPopUp')='true'">
  1335. document.<xsl:value-of select="key('request-param','formName')"/>.target = '';
  1336. </xsl:if>
  1337. return;
  1338. }
  1339. <!-- convert less than and greater than to text references -->
  1340. function htmlEncode(string)
  1341. {
  1342. var returnString = string.replace(/&amp;/g, "&amp;amp;");
  1343. returnString = returnString.replace(/&quot;/g, "&amp;quot;");
  1344. returnString = returnString.replace(/&lt;/g, "&amp;lt;");
  1345. returnString = returnString.replace(/&gt;/g, "&amp;gt;");
  1346. return returnString;
  1347. }
  1348. <!-- used to replace linefeeds to </br> for the html version of the body -->
  1349. function replaceCarriageReturns(string, replaceWith)
  1350. {
  1351. <!-- encode textarea string's carriage returns -->
  1352. string = escape(string);
  1353. <!--loop through string, replacing carriage return encoding with HTML break tag-->
  1354. for(i=0; i&lt;string.length; i++)
  1355. {
  1356. if(string.indexOf("%0D%0A") > -1)
  1357. {
  1358. <!-- Windows encodes returns as \r\n hex-->
  1359. string=string.replace("%0D%0A",replaceWith);
  1360. }
  1361. else if(string.indexOf("%0A") > -1)
  1362. {
  1363. <!-- Unix encodes returns as \n hex-->
  1364. string=string.replace("%0A",replaceWith);
  1365. }
  1366. else if(string.indexOf("%0D") > -1)
  1367. {
  1368. <!-- Macintosh encodes returns as \r hex -->
  1369. string=string.replace("%0D",replaceWith);
  1370. }
  1371. }
  1372. string=unescape(string) <!-- unescape all other encoded characters -->
  1373. return string;
  1374. }
  1375. function changeModes()
  1376. {
  1377. var frm = document.<xsl:value-of select="key('request-param','formName')"/>;
  1378. if (frm.richEditMode.value == 'true')
  1379. {
  1380. frm.email_body.value = replaceHtmlTags(CKEDITOR.instances.email_body_iframe.document.getBody().getHtml());
  1381. frm.richEditMode.value = 'false';
  1382. }
  1383. else
  1384. {
  1385. frm.hidden_richEditBody.value = replaceCarriageReturns(htmlEncode(frm.email_body.value),'&lt;br/&gt;');
  1386. frm.richEditMode.value = 'true';
  1387. }
  1388. controller_submitForm('default');
  1389. }
  1390. <!--
  1391. - handles showing/hidding the bcc text field
  1392. - we have spans behind the bold, italic and underline since we use letters
  1393. instead of icons for localization. Make sure we move the span when we're showing/hidding
  1394. the bcc field
  1395. -->
  1396. function swapBccVisible()
  1397. {
  1398. if (document.<xsl:value-of select="key('request-param','formName')"/>.bccVisible.value == 'false')
  1399. {
  1400. <!-- change the link text -->
  1401. document.getElementById('showHideAnchor').innerHTML = '<xts:string id="IDS_EMAIL_HIDE_BCC" encode="javascript"/>';
  1402. showDynamicDiv('emailBccDiv');
  1403. document.<xsl:value-of select="key('request-param','formName')"/>.bccVisible.value = 'true';
  1404. }
  1405. else
  1406. {
  1407. <!-- change the link text -->
  1408. document.getElementById('showHideAnchor').innerHTML = '<xts:string id="IDS_EMAIL_SHOW_BCC" encode="javascript"/>';
  1409. hideDynamicDiv('emailBccDiv');
  1410. document.<xsl:value-of select="key('request-param','formName')"/>.bccVisible.value = 'false';
  1411. }
  1412. }
  1413. </script>
  1414. <!-- add a hidden iframe if we must show the added recipients in a popup -->
  1415. <xsl:if test="key('request-param','addEntriesPopUp')='true'">
  1416. <script language="javascript">
  1417. function show_div(div)
  1418. {
  1419. modalDiv = document.getElementById(div);
  1420. modalDiv.style.display = "block";
  1421. modalDiv.style.height = "100%";
  1422. modalDiv.style.width = "100%";
  1423. modalDiv.style.left = 0;
  1424. modalDiv.style.top = 0;
  1425. }
  1426. function show_iFrame(iframe)
  1427. {
  1428. iFrameAddEntries = document.getElementById(iframe);
  1429. iFrameAddEntries.style.display = "block";
  1430. iFrameAddEntries.style.height = "70%";
  1431. iFrameAddEntries.style.width = "85%";
  1432. iFrameAddEntries.style.border = "1px solid";
  1433. if ((document.body.clientWidth - iFrameAddEntries.scrollWidth) &lt; 0)
  1434. {
  1435. iFrameAddEntries.style.left = 0;
  1436. }
  1437. else
  1438. {
  1439. iFrameAddEntries.style.left = ((document.body.clientWidth - iFrameAddEntries.scrollWidth) / 2) + document.body.scrollLeft;
  1440. }
  1441. }
  1442. </script>
  1443. <div id="makeModalDiv" style="z-index:49; display:none; position: absolute;">
  1444. <table width="100%" height="100%">
  1445. <tr>
  1446. <td/>
  1447. </tr>
  1448. </table>
  1449. </div>
  1450. <iframe width="0" height="0" id="addEntriesFrame" src="../common/blank.html" name="addEntriesFrame" frameborder="0" style="display:none; z-index:50; display:block; position: absolute;"></iframe>
  1451. </xsl:if>
  1452. <lyt:layout style="2">
  1453. <lyt:section>
  1454. <xsl:variable name="inputSize">
  1455. <xsl:choose>
  1456. <xsl:when test="$agentStudio">50</xsl:when>
  1457. <xsl:otherwise>55</xsl:otherwise>
  1458. </xsl:choose>
  1459. </xsl:variable>
  1460. <xsl:if test="key('request-param','burst')!='true'">
  1461. <!-- need to put the email to, cc, bcc and links in one table
  1462. to get the links to right align properly -->
  1463. <table border="0" cellspacing="0" cellpadding="0">
  1464. <tr>
  1465. <td>
  1466. <!-- email to -->
  1467. <dp:list>
  1468. <dp:section>
  1469. <dp:label><label for="email_to"><xts:string id="IDS_EMAIL_OPTIONS_TO"/></label></dp:label>
  1470. </dp:section>
  1471. </dp:list>
  1472. <!--display the "To" value as readonly text when part of a subscription -->
  1473. <xsl:if test="$subscription">
  1474. <table border="0" cellspacing="0" cellpadding="1">
  1475. <tr>
  1476. <td nowrap="nowrap">
  1477. <dp:list>
  1478. <dp:section>
  1479. <xsl:value-of select="key('env-param','email_to')"/>
  1480. </dp:section>
  1481. </dp:list>
  1482. </td>
  1483. </tr>
  1484. </table>
  1485. </xsl:if>
  1486. <table border="0" cellspacing="0" cellpadding="1">
  1487. <tr>
  1488. <xsl:if test="$agentStudio and not($hideInsertButton)">
  1489. <td valign="top" nowrap="nowrap">
  1490. <table border="0" cellspacing="0" cellpadding="1" valign="top">
  1491. <tr valign="top">
  1492. <dp:columnButton>
  1493. <img align="middle" height="18" name="insert_to" onclick="javascript:parent.dropFrame=window.name;parent.insertStartMC('email_to');">
  1494. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>insert.gif</xsl:attribute>
  1495. <xsl:attribute name="alt"><xts:string id="IDS_EMAIL_OPTIONS_INSERT_ALT"/></xsl:attribute>
  1496. </img>
  1497. </dp:columnButton>
  1498. </tr>
  1499. </table>
  1500. </td>
  1501. <td nowrap="nowrap">
  1502. <img width="3" src="{$webcontent}/images/space.gif" alt=""></img>
  1503. </td>
  1504. </xsl:if>
  1505. <td nowrap="nowrap">
  1506. <input name="email_to" id="email_to" size="{$inputSize}" onchange="changedEmailRecipients();">
  1507. <!-- make the input hidden if part of a subscription -->
  1508. <xsl:attribute name="type">
  1509. <xsl:choose>
  1510. <xsl:when test="$subscription">
  1511. <xsl:text>hidden</xsl:text>
  1512. </xsl:when>
  1513. <xsl:otherwise>
  1514. <xsl:text>text</xsl:text>
  1515. </xsl:otherwise>
  1516. </xsl:choose>
  1517. </xsl:attribute>
  1518. <xsl:attribute name="value">
  1519. <xsl:value-of select="key('env-param','email_to')"/>
  1520. </xsl:attribute>
  1521. </input>
  1522. </td>
  1523. </tr>
  1524. </table>
  1525. <!-- do not show the CC or BCC section if part of a subscription -->
  1526. <xsl:if test="not($subscription)">
  1527. <!-- email cc -->
  1528. <dp:list>
  1529. <dp:section>
  1530. <dp:label><label for="email_cc"><xts:string id="IDS_EMAIL_OPTIONS_CC"/></label></dp:label>
  1531. </dp:section>
  1532. </dp:list>
  1533. <table border="0" cellspacing="0" cellpadding="1">
  1534. <tr>
  1535. <xsl:if test="$agentStudio and not($hideInsertButton)">
  1536. <td valign="top" nowrap="nowrap">
  1537. <table border="0" cellspacing="0" cellpadding="1" valign="top">
  1538. <tr valign="top">
  1539. <dp:columnButton>
  1540. <img align="middle" height="18" name="insert_cc" onclick="javascript:parent.dropFrame=window.name;parent.insertStartMC('email_cc');">
  1541. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>insert.gif</xsl:attribute>
  1542. <xsl:attribute name="alt"><xts:string id="IDS_EMAIL_OPTIONS_INSERT_ALT"/></xsl:attribute>
  1543. </img>
  1544. </dp:columnButton>
  1545. </tr>
  1546. </table>
  1547. </td>
  1548. <td nowrap="nowrap">
  1549. <img width="3" src="{$webcontent}/images/space.gif" alt=""></img>
  1550. </td>
  1551. </xsl:if>
  1552. <td nowrap="nowrap">
  1553. <input type="text" name="email_cc" id="email_cc" size="{$inputSize}" onchange="changedEmailRecipients();">
  1554. <xsl:attribute name="value">
  1555. <xsl:value-of select="key('env-param','email_cc')"/>
  1556. </xsl:attribute>
  1557. </input>
  1558. </td>
  1559. </tr>
  1560. </table>
  1561. <!-- email bcc -->
  1562. <cf:dynamicDiv name="emailBccDiv" runTimeVisibleCheck="$bccVisible = 'true'">
  1563. <!-- need to put all this in one table since we need the height of table for
  1564. calculations when hiding/showing the bcc field -->
  1565. <table id="bccEmailFieldTable" border="0" cellspacing="0" cellpadding="1">
  1566. <tr>
  1567. <td>
  1568. <xsl:if test="$agentStudio">
  1569. <xsl:attribute name="colspan">3</xsl:attribute>
  1570. </xsl:if>
  1571. <dp:list>
  1572. <dp:section>
  1573. <dp:label><label for="email_bcc"><xts:string id="IDS_EMAIL_OPTIONS_BCC"/></label></dp:label>
  1574. </dp:section>
  1575. </dp:list>
  1576. </td>
  1577. </tr>
  1578. <tr>
  1579. <xsl:if test="$agentStudio and not($hideInsertButton)">
  1580. <td valign="top" nowrap="nowrap">
  1581. <table border="0" cellspacing="0" cellpadding="1" valign="top">
  1582. <tr valign="top">
  1583. <dp:columnButton>
  1584. <img align="middle" height="18" name="insert_bcc" onclick="javascript:parent.dropFrame=window.name;parent.insertStartMC('email_bcc');">
  1585. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>insert.gif</xsl:attribute>
  1586. <xsl:attribute name="alt"><xts:string id="IDS_EMAIL_OPTIONS_INSERT_ALT"/></xsl:attribute>
  1587. </img>
  1588. </dp:columnButton>
  1589. </tr>
  1590. </table>
  1591. </td>
  1592. <td nowrap="nowrap">
  1593. <img width="3" src="{$webcontent}/images/space.gif" alt=""></img>
  1594. </td>
  1595. </xsl:if>
  1596. <td nowrap="nowrap">
  1597. <input type="text" name="email_bcc" id="email_bcc" size="{$inputSize}" onchange="changedEmailRecipients();">
  1598. <xsl:attribute name="value">
  1599. <xsl:value-of select="key('env-param','email_bcc')"/>
  1600. </xsl:attribute>
  1601. </input>
  1602. </td>
  1603. </tr>
  1604. </table>
  1605. </cf:dynamicDiv>
  1606. <table border="0" cellspacing="0" cellpadding="1" width="100%">
  1607. <tr align="right" class="formLink">
  1608. <td nowrap="nowrap" align="right">
  1609. <!-- select recipients -->
  1610. <dp:link align="right">
  1611. <a href="#" onclick="leavingDialog(); setFormTarget(); controller_doSubmit('addEntries', 'navigate', 'stack-up'); unsetFormTarget();">
  1612. <xts:string id="IDS_EMAIL_OPTIONS_SELECT_RECIPIENTS"/>
  1613. </a>
  1614. </dp:link>
  1615. &#160;&#160;
  1616. <!-- show/hide Bcc -->
  1617. <dp:link align="right">
  1618. <a id="showHideAnchor" href="#" onclick="leavingDialog(); swapBccVisible()">
  1619. <xsl:choose>
  1620. <xsl:when test="$bccVisible='true'"><xts:string id="IDS_EMAIL_HIDE_BCC"/></xsl:when>
  1621. <xsl:otherwise><xts:string id="IDS_EMAIL_SHOW_BCC"/></xsl:otherwise>
  1622. </xsl:choose>
  1623. </a>
  1624. </dp:link>
  1625. </td>
  1626. </tr>
  1627. </table>
  1628. </xsl:if>
  1629. </td>
  1630. </tr>
  1631. </table>
  1632. </xsl:if>
  1633. </lyt:section>
  1634. <!-- task name -->
  1635. <lyt:section>
  1636. <xsl:if test="$agentStudio">
  1637. <xsl:value-of select="key('request-param','suppressionDetails')" disable-output-escaping="yes"/>
  1638. </xsl:if>
  1639. </lyt:section>
  1640. </lyt:layout>
  1641. <lyt:layout style="1">
  1642. <lyt:section>
  1643. <xsl:variable name="controlsWidth">
  1644. <xsl:choose>
  1645. <xsl:when test="$agentStudio">650</xsl:when>
  1646. <xsl:otherwise>680</xsl:otherwise>
  1647. </xsl:choose>
  1648. </xsl:variable>
  1649. <!-- subject -->
  1650. <dp:list>
  1651. <dp:section>
  1652. <dp:label><label for="email_subject"><xts:string id="IDS_EMAIL_OPTIONS_SUBJECT"/></label></dp:label>
  1653. </dp:section>
  1654. </dp:list>
  1655. <table border="0" cellspacing="0" cellpadding="1">
  1656. <tr>
  1657. <xsl:if test="$agentStudio and not($hideInsertButton)">
  1658. <td valign="top" nowrap="nowrap">
  1659. <table border="0" cellspacing="0" cellpadding="1" valign="top">
  1660. <tr valign="top">
  1661. <dp:columnButton>
  1662. <img align="middle" height="18" name="insert_subject" onclick="javascript:parent.dropFrame=window.name;parent.insertStartMC('email_subject');">
  1663. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>insert.gif</xsl:attribute>
  1664. <xsl:attribute name="alt"><xts:string id="IDS_EMAIL_OPTIONS_INSERT_ALT"/></xsl:attribute>
  1665. </img>
  1666. </dp:columnButton>
  1667. </tr>
  1668. </table>
  1669. </td>
  1670. <td nowrap="nowrap">
  1671. <img width="3" src="{$webcontent}/images/space.gif" alt=""></img>
  1672. </td>
  1673. </xsl:if>
  1674. <td nowrap="nowrap">
  1675. <input type="text" name="email_subject" id="email_subject" style="width:{$controlsWidth}px">
  1676. <xsl:attribute name="value">
  1677. <xsl:value-of select="key('env-param','email_subject')"/>
  1678. </xsl:attribute>
  1679. </input>
  1680. </td>
  1681. </tr>
  1682. <tr>
  1683. <td nowrap="nowrap">
  1684. <img height="5" width="1" src="{$webcontent}/images/space.gif" alt=""/>
  1685. </td>
  1686. </tr>
  1687. </table>
  1688. <!-- body -->
  1689. <table border="0" cellspacing="0" cellpadding="0">
  1690. <!-- in agent studio we have to take into account the add selected items button -->
  1691. <xsl:attribute name="style">
  1692. <xsl:choose>
  1693. <xsl:when test="$agentStudio">width:<xsl:value-of select="$controlsWidth + 30"/>px</xsl:when>
  1694. <xsl:otherwise>width:<xsl:value-of select="$controlsWidth"/>px</xsl:otherwise>
  1695. </xsl:choose>
  1696. </xsl:attribute>
  1697. <tr>
  1698. <td style="white-space:nowrap;" class="formLabel" valign="bottom"><label for="email_body"><xts:string id="IDS_EMAIL_OPTIONS_BODY"/></label></td>
  1699. <!-- IE, FF and Chrome supported now for rich text editor -->
  1700. <xsl:if test="$browsername = 'ie' or $browsername = 'moz' or $browsername = 'chrome'">
  1701. <xsl:choose>
  1702. <xsl:when test="$richEditMode = 'true'">
  1703. <td width="100%" align="right" class="formLink" nowrap="nowrap" valign="bottom">
  1704. <a href="#" onclick="javascript:changeModes();"><xts:string id="IDS_EMAIL_OPTIONS_PLAIN_TEXT"/></a>
  1705. </td>
  1706. <td valign="bottom" nowrap="nowrap">
  1707. <img height="5" width="3" src="{$webcontent}/images/space.gif" alt=""/>
  1708. <img src="{$skin_images}prompt_option_to_right.gif" alt=""/>
  1709. <img height="5" width="10" src="{$webcontent}/images/space.gif" alt=""/>
  1710. </td>
  1711. </xsl:when>
  1712. <xsl:otherwise>
  1713. <td width="100%" align="right" valign="bottom">
  1714. <img src="{$skin_images}prompt_option_to_left.gif" alt=""/>
  1715. <img height="5" width="3" src="{$webcontent}/images/space.gif" alt=""/>
  1716. </td>
  1717. <td class="formLink" nowrap="nowrap" valign="bottom">
  1718. <a href="#" onclick="javascript:changeModes();"><xts:string id="IDS_EMAIL_OPTIONS_HTML_TEXT"/></a>
  1719. </td>
  1720. </xsl:otherwise>
  1721. </xsl:choose>
  1722. <xsl:if test="$richEditMode = 'true'">
  1723. <xsl:call-template name="richEditControls"/>
  1724. </xsl:if>
  1725. </xsl:if>
  1726. </tr>
  1727. <tr>
  1728. <td>
  1729. <img height="3" width="1" src="{$webcontent}/images/space.gif" alt=""/>
  1730. </td>
  1731. </tr>
  1732. </table>
  1733. <table border="0" cellspacing="0" cellpadding="1">
  1734. <xsl:choose>
  1735. <xsl:when test="$agentStudio">
  1736. <tr>
  1737. <xsl:if test="not($hideInsertButton)">
  1738. <td valign="top" nowrap="nowrap">
  1739. <table border="0" cellspacing="0" cellpadding="1" valign="top">
  1740. <tr valign="top">
  1741. <dp:columnButton>
  1742. <img align="middle" height="18" name="insert_body">
  1743. <xsl:attribute name="onclick">
  1744. <xsl:choose>
  1745. <xsl:when test="$richEditMode = 'true'">javascript:insertDataItemsToRTE();</xsl:when>
  1746. <xsl:otherwise>javascript:parent.dropFrame=window.name;parent.insertStartMC('email_body');</xsl:otherwise>
  1747. </xsl:choose>
  1748. </xsl:attribute>
  1749. <xsl:attribute name="src"><xsl:value-of select="$image_root"/>insert.gif</xsl:attribute>
  1750. <xsl:attribute name="alt"><xts:string id="IDS_EMAIL_OPTIONS_INSERT_ALT"/></xsl:attribute>
  1751. </img>
  1752. </dp:columnButton>
  1753. </tr>
  1754. </table>
  1755. </td>
  1756. <td nowrap="nowrap">
  1757. <img width="3" src="{$webcontent}/images/space.gif" alt=""></img>
  1758. </td>
  1759. </xsl:if>
  1760. <td nowrap="nowrap">
  1761. <table cellspacing="0" cellpadding="0" border="0" width="{$controlsWidth}">
  1762. <tr>
  1763. <!-- body -->
  1764. <td class="emailBodyTableRow">
  1765. <xsl:call-template name="emailBody">
  1766. <xsl:with-param name="inputSize">
  1767. <xsl:value-of select="$controlsWidth"/>
  1768. </xsl:with-param>
  1769. <xsl:with-param name="richEditMode" select="$richEditMode"/>
  1770. </xsl:call-template>
  1771. </td>
  1772. </tr>
  1773. <xsl:if test="/root/*[local-name()='links']/*[local-name()='item']">
  1774. <tr>
  1775. <!-- links -->
  1776. <td class="emailLinksAttachmentTableRow" width="100%">
  1777. <xsl:for-each select="/root/*[local-name()='links']/*[local-name()='item']">
  1778. <input type="hidden" name="deleted_link_{position()}" id="deleted_link_{position()}" value=""/>
  1779. <table id="linkTable_{position()}" class="emailItem" height="20" cellspacing="2" cellpadding="2" border="0" style="text-decoration: underline;float:left;clear:none;cursor:pointer;cursor:hand;position:relative;" onmousedown="mouseDownLinkAttach(this)" onmouseover="mouseOverLinkAttach(this)" onmouseout="mouseOutLinkAttach(this)">
  1780. <tr>
  1781. <td valign="middle" align="center">
  1782. <xsl:call-template name="gen-icon">
  1783. <xsl:with-param name="showAction" select="false()"/>
  1784. <xsl:with-param name="class" select="*[local-name()='objectClass']"/>
  1785. </xsl:call-template>
  1786. </td>
  1787. <td valign="middle" align="center" class="formText" nowrap="nowrap">
  1788. <xsl:value-of select="*[local-name()='displayName']"/>
  1789. </td>
  1790. </tr>
  1791. </table>
  1792. </xsl:for-each>
  1793. </td>
  1794. </tr>
  1795. </xsl:if>
  1796. <xsl:if test="/root/*[local-name()='attachments']/*[local-name()='item']">
  1797. <tr>
  1798. <!-- attachments -->
  1799. <td class="emailLinksAttachmentTableRow" width="100%">
  1800. <xsl:for-each select="/root/*[local-name()='attachments']/*[local-name()='item']">
  1801. <input type="hidden" name="deleted_attachment_{position()}" id="deleted_attachment_{position()}" value=""/>
  1802. <xsl:variable name="format">
  1803. <xsl:choose>
  1804. <xsl:when test="not(normalize-space(*[local-name()='format']))">
  1805. <xsl:value-of select="/root/user/param[@name='format']"/>
  1806. </xsl:when>
  1807. <xsl:otherwise>
  1808. <xsl:value-of select="*[local-name()='format']"/>
  1809. </xsl:otherwise>
  1810. </xsl:choose>
  1811. </xsl:variable>
  1812. <xsl:variable name="locale">
  1813. <xsl:choose>
  1814. <xsl:when test="not(normalize-space(*[local-name()='locale']))">
  1815. <xsl:value-of select="/root/user/param[@name='contentLocale']"/>
  1816. </xsl:when>
  1817. <xsl:otherwise>
  1818. <xsl:value-of select="*[local-name()='locale']"/>
  1819. </xsl:otherwise>
  1820. </xsl:choose>
  1821. </xsl:variable>
  1822. <table id="attachTable_{position()}" border="0" cellspacing="0" cellpadding="0" class="emailItem" style="text-decoration:none;float:left;clear:none;cursor:pointer;cursor:hand;position:relative;" onmousedown="mouseDownLinkAttach(this)" onmouseover="mouseOverLinkAttach(this)" onmouseout="mouseOutLinkAttach(this)" width="40" title="{*[local-name()='defaultName']}">
  1823. <tr>
  1824. <td align="center">
  1825. <img>
  1826. <xsl:attribute name="src">
  1827. <xsl:choose>
  1828. <!-- use the HTML icon for the event list -->
  1829. <xsl:when test="*[local-name()='searchPath']='eventOutput'">
  1830. <xsl:value-of select="concat($image_root,'icon_result_html_32.gif')"/>
  1831. </xsl:when>
  1832. <xsl:otherwise>
  1833. <xsl:choose>
  1834. <xsl:when test="$format = 'singleXLS'">
  1835. <xsl:value-of select="concat($image_root,'icon_result_excel_single_32.gif')"/>
  1836. </xsl:when>
  1837. <xsl:when test="$format= 'XLS'">
  1838. <xsl:value-of select="concat($image_root,'icon_result_excel_32.gif')"/>
  1839. </xsl:when>
  1840. <xsl:when test="$format = 'XLWA'">
  1841. <xsl:value-of select="concat($image_root,'icon_result_excel_web_arch_32.gif')"/>
  1842. </xsl:when>
  1843. <xsl:when test="$format = 'spreadsheetML'">
  1844. <xsl:value-of select="concat($image_root,'icon_result_excel_2007_32.gif')"/>
  1845. </xsl:when>
  1846. <xsl:when test="$format = 'xlsxData'">
  1847. <xsl:value-of select="concat($image_root,'icon_result_xlsxdata_32.gif')"/>
  1848. </xsl:when>
  1849. <xsl:otherwise>
  1850. <!-- need to convert the format to lowercase for linux -->
  1851. <xsl:variable name="convertedFormat">
  1852. <xsl:value-of select="translate( $format, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' )"/>
  1853. </xsl:variable>
  1854. <xsl:value-of select="concat($image_root,'icon_result_', $convertedFormat,'_32.gif')"/>
  1855. </xsl:otherwise>
  1856. </xsl:choose>
  1857. </xsl:otherwise>
  1858. </xsl:choose>
  1859. </xsl:attribute>
  1860. </img>
  1861. </td>
  1862. </tr>
  1863. <tr>
  1864. <td nowrap="nowrap" align="center" class="formText"><xsl:value-of select="*[local-name()='attachmentName']"/></td>
  1865. </tr>
  1866. <tr>
  1867. <td nowrap="nowrap" align="center" class="formText">
  1868. <xsl:choose>
  1869. <xsl:when test="$format !='' and $locale!=''">
  1870. <xts:string id="IDS_EMAIL_OPTIONS_FORMAT_LOCALE">
  1871. <xts:param name="format"><xsl:value-of select="$format"/></xts:param>
  1872. <xts:param name="locale"><xsl:value-of select="$locale"/></xts:param>
  1873. </xts:string>
  1874. </xsl:when>
  1875. <xsl:otherwise>&#160;</xsl:otherwise>
  1876. </xsl:choose>
  1877. </td>
  1878. </tr>
  1879. </table>
  1880. </xsl:for-each>
  1881. </td>
  1882. </tr>
  1883. </xsl:if>
  1884. <!-- attachment and link links -->
  1885. <tr>
  1886. <td>
  1887. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  1888. <tr>
  1889. <td class="formLink" width="100%" align="right">
  1890. <xsl:if test="key('business-rules','allowAttachMenu')='true'">
  1891. <!-- code from agent studio for the flyout -->
  1892. <table border="0" cellpadding="0" cellspacing="0" style="cursor:hand">
  1893. <tr>
  1894. <td id="attachmentDropdown" height="0px" valign="bottom"/>
  1895. <td class="formLink">
  1896. <a href="#" onkeypress="leavingDialog(); if(event.keyCode==9)return true;removeAttachmentMenuListener();showMenu(event);attachmentMenu_cancelBub(event);" onmouseup="leavingDialog();removeAttachmentMenuListener();showMenu(event);attachmentMenu_cancelBub(event);">
  1897. <xts:string id="IDS_ADDENTRIES_ATTACHMENT_COLUMN"/>
  1898. </a>
  1899. </td>
  1900. <td onkeypress="leavingDialog();if(event.keyCode==9)return true;removeAttachmentMenuListener();showMenu(event);attachmentMenu_cancelBub(event);" onmouseup="leavingDialog();removeAttachmentMenuListener();showMenu(event);attachmentMenu_cancelBub(event);">
  1901. <img border="0" title="" src="{$skin_shared_images}dropdown_arrow.gif"/>
  1902. </td>
  1903. </tr>
  1904. </table>
  1905. <script language="Javascript">
  1906. var menuItemStyle = new CUIStyle('menuItem_normal', 'menuItem_hover', '', '', 'task_active');
  1907. var menuStyle = new CUIStyle('menuContainer', '', '', '', '');
  1908. var attachmentMenu = new CMenu('attachmentDropdown1',menuStyle);
  1909. attachmentMenu.setHTMLContainer(document.getElementById('attachmentDropdown'));
  1910. <xsl:for-each select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='attach']/*">
  1911. <xsl:variable name="menuName">
  1912. <xsl:choose>
  1913. <xsl:when test="local-name()='eventOutput'"><xts:string id="IDS_EMAIL_OPTIONS_ATTACH_EVENT_OUTPUT"/></xsl:when>
  1914. <xsl:otherwise>
  1915. <xts:string id="IDS_EMAIL_OPTIONS_ATTACH_REPORT">
  1916. <xts:param name="obj">
  1917. <xsl:value-of select="*[local-name()='defaultName']"/>
  1918. </xts:param>
  1919. </xts:string>
  1920. </xsl:otherwise>
  1921. </xsl:choose>
  1922. </xsl:variable>
  1923. new CMenuItem(attachmentMenu, &quot;<xsl:value-of select="xtsext:javascriptencode(string($menuName))"/>&quot;,&quot;<xsl:value-of select="xtsext:javascriptencode(concat('task', position()))"/>&quot;,"attach('<xsl:value-of select="position()"/>')", '', menuItemStyle, &quot;<xsl:value-of select="xtsext:javascriptencode(string($menuName))"/>&quot;);
  1924. </xsl:for-each>
  1925. //The call to this is done in the onmouseup event only.
  1926. //We cannot put in the function below. Because the function
  1927. //below can be called by the observer.
  1928. function removeAttachmentMenuListener() {
  1929. document.body.getWndObserver().removeListener(attachmentMenu);
  1930. }
  1931. function showMenu(event) {
  1932. if (attachmentMenu &amp;&amp; attachmentMenu.isVisible()) {
  1933. attachmentMenu.remove();
  1934. if (document.body.getWndObserver &amp;&amp; parent.document.body.getWndObserver) {
  1935. document.body.getWndObserver().removeWhenDone(attachmentMenu);
  1936. }
  1937. } else {
  1938. //Must always be first to be able to delete the marked observer, before it shows it.
  1939. if (document.body.getWndObserver &amp;&amp; parent.document.body.getWndObserver) {
  1940. //Notify parent that mouseup occured.
  1941. parent.document.body.getWndObserver().notify(attachmentMenu,"mouseup");
  1942. document.body.getWndObserver().addListener(attachmentMenu, showMenu, "mouseup");
  1943. }
  1944. attachmentMenu.draw();
  1945. attachmentMenu.show();
  1946. }
  1947. }
  1948. function attachmentMenu_cancelBub(evt)
  1949. {
  1950. //get the event in a cross-browser fashion
  1951. evt = (evt) ? evt : ((event) ? event : null);
  1952. //prevent the click from proceeding to other nodes
  1953. if (typeof evt.cancelBubble != 'undefined')
  1954. {
  1955. evt.cancelBubble = true;
  1956. }
  1957. if (typeof evt.stopPropagation != 'undefined')
  1958. {
  1959. evt.stopPropagation();
  1960. }
  1961. }
  1962. </script>
  1963. </xsl:if>
  1964. </td>
  1965. <td class="formLink" nowrap="nowrap">
  1966. <xsl:if test="key('business-rules','allowAddLinksAction')='true'">
  1967. &#160;&#160;
  1968. <a href="#" onclick="leavingDialog(); setFormTarget(); document.{key('request-param','formName')}.addingLinks.value='true'; controller_doSubmit('addLinks', 'navigate', 'stack-up'); unsetFormTarget();">
  1969. <xts:string id="IDS_EMAIL_OPTIONS_SELECT_LINKS"/>
  1970. </a>
  1971. </xsl:if>
  1972. </td>
  1973. </tr>
  1974. </table>
  1975. </td>
  1976. </tr>
  1977. </table>
  1978. </td>
  1979. </tr>
  1980. </xsl:when>
  1981. <xsl:otherwise>
  1982. <tr>
  1983. <td>
  1984. <xsl:if test="$richEditMode = 'true'">
  1985. <xsl:attribute name="class">emailBodyTableRow</xsl:attribute>
  1986. </xsl:if>
  1987. <xsl:call-template name="emailBody">
  1988. <xsl:with-param name="inputSize" select="$controlsWidth"/>
  1989. <xsl:with-param name="richEditMode" select="$richEditMode"/>
  1990. </xsl:call-template>
  1991. </td>
  1992. </tr>
  1993. </xsl:otherwise>
  1994. </xsl:choose>
  1995. <tr>
  1996. <td nowrap="nowrap">
  1997. <img height="5" width="1" src="{$webcontent}/images/space.gif" alt=""/>
  1998. </td>
  1999. </tr>
  2000. </table>
  2001. </lyt:section>
  2002. </lyt:layout>
  2003. <xsl:if test="(key('business-rules','allowLinkToReport')='true') or (key('business-rules','allowEmailAsAttachment')='true' or key('env-param','m_ro_emailAsAttachment')='true')">
  2004. <lyt:layout style="1">
  2005. <lyt:section>
  2006. <dp:choice>
  2007. <xsl:if test="key('business-rules','allowLinkToReport')='true'">
  2008. <dp:section1>
  2009. <input type="checkbox" name="m_ro_emailAsURL" id="m_ro_emailAsURL" value="true">
  2010. <xsl:if test="key('env-param','m_ro_emailAsURL')='true'">
  2011. <xsl:attribute name="checked">checked</xsl:attribute>
  2012. </xsl:if>
  2013. </input>
  2014. </dp:section1>
  2015. <dp:section2>
  2016. <label for="m_ro_emailAsURL">
  2017. <xsl:choose>
  2018. <xsl:when test="key('request-param','objectClass')='jobDefinition'">
  2019. <xts:string id="IDS_EMAIL_OPTIONS_INCLUDE_LINKS"/>
  2020. </xsl:when>
  2021. <xsl:otherwise>
  2022. <xts:string id="IDS_EMAIL_OPTIONS_INCLUDE_LINK"/>
  2023. </xsl:otherwise>
  2024. </xsl:choose>
  2025. </label>
  2026. </dp:section2>
  2027. </xsl:if>
  2028. <xsl:if test="key('business-rules','allowEmailAsAttachment')='true' or key('env-param','m_ro_emailAsAttachment')='true'">
  2029. <dp:section1>
  2030. <input type="checkbox" name="m_ro_emailAsAttachment" id="m_ro_emailAsAttachment" value="true">
  2031. <xsl:if test="key('env-param','m_ro_emailAsAttachment')='true'">
  2032. <xsl:attribute name="checked">checked</xsl:attribute>
  2033. </xsl:if>
  2034. </input>
  2035. </dp:section1>
  2036. <dp:section2>
  2037. <label for="m_ro_emailAsAttachment">
  2038. <xsl:choose>
  2039. <xsl:when test="key('request-param','objectClass')='jobDefinition'">
  2040. <xts:string id="IDS_EMAIL_OPTIONS_INCLUDE_OUTPUTS"/>
  2041. </xsl:when>
  2042. <xsl:otherwise>
  2043. <xts:string id="IDS_EMAIL_OPTIONS_INCLUDE_OUTPUT"/>
  2044. </xsl:otherwise>
  2045. </xsl:choose>
  2046. </label>
  2047. </dp:section2>
  2048. </xsl:if>
  2049. </dp:choice>
  2050. </lyt:section>
  2051. </lyt:layout>
  2052. </xsl:if>
  2053. <!-- footer -->
  2054. <xsl:choose>
  2055. <xsl:when test="key('request-param','displayButtons') != 'false'">
  2056. <dp:footer>
  2057. <xsl:choose>
  2058. <xsl:when test="key('request-param','inWizard') = 'true'">
  2059. <dlgctrl:wizardButtons validateFunction="validate"/>
  2060. </xsl:when>
  2061. <xsl:otherwise>
  2062. <dlgctrl:okCancelButtons validateFunction="validate"/>
  2063. </xsl:otherwise>
  2064. </xsl:choose>
  2065. </dp:footer>
  2066. </xsl:when>
  2067. <xsl:otherwise>
  2068. <dp:emptyFooter/>
  2069. </xsl:otherwise>
  2070. </xsl:choose>
  2071. <xsl:if test="key('env-param','duplicateEntryAdded') = 'true'">
  2072. <script language="javascript">
  2073. window.alert("<xts:string id="IDS_DUPLICATE_ENTRY" encode="javascript"/>");
  2074. </script>
  2075. </xsl:if>
  2076. <xsl:if test="not(key('env-param','visited_email_options')) and /root/selectedEntries/item/unknown='true'">
  2077. <script language="javascript">
  2078. alert("<xts:string id="IDS_OTHERRUN_EMAIL_WARN_UNKNOWN_RECIPIENT" encode="javascript"/>");
  2079. </script>
  2080. </xsl:if>
  2081. </xts:transform>
  2082. </markup>
  2083. <browserTitle>
  2084. <xsl:if test="key('business-rules','browserTitle') != ''">
  2085. <xts:transform name="XMLEncode">
  2086. <xsl:value-of select="key('business-rules','browserTitle')"/>
  2087. </xts:transform>
  2088. </xsl:if>
  2089. </browserTitle>
  2090. </xsl:element>
  2091. </xos:entityBody>
  2092. </xos:part>
  2093. </xts:append>
  2094. </xts:sequence>
  2095. </xsl:template>
  2096. <xsl:template name="emailBody">
  2097. <xsl:param name="inputSize"/>
  2098. <xsl:param name="richEditMode"/>
  2099. <xsl:choose>
  2100. <xsl:when test="$richEditMode = 'true'">
  2101. <iframe id="email_body_iframe" src="../common/blank.html" frameborder="0" contentEditable="true" onblur="richEditControl_doEditBlur();" marginwidth="2" marginheight="2">
  2102. <!-- for rich edit body we're using the table border and not the textarea border -->
  2103. <xsl:attribute name="style">width:<xsl:value-of select="$inputSize - 6"/>px;height:95px;</xsl:attribute>
  2104. </iframe>
  2105. <input type="hidden" name="hidden_richEditBody" value="{key('env-param','hidden_richEditBody')}"/>
  2106. <input type="hidden" name="email_body" value="{key('env-param','email_body')}"/>
  2107. <script>
  2108. CKEDITOR.replace( 'email_body_iframe', {
  2109. height: 260,
  2110. width: 700,
  2111. removePlugins: 'elementspath',
  2112. // Define the toolbar groups as it is a more accessible solution.
  2113. toolbarGroups: [
  2114. {"name":"clipboard", groups: [ "undo"]},
  2115. {"name":"clipboard", groups: [ "clipboard"]},
  2116. {"name":"basicstyles","groups":["basicstyles"]},
  2117. {"name":"paragraph","groups":["align", "list", "indent"]},
  2118. {"name":"insert","groups":["insert"]}
  2119. ],
  2120. // Remove the redundant buttons from toolbar groups defined above.
  2121. removeButtons: 'Strike,Subscript,Superscript,Image,SpecialChar,Flash,Smiley,PageBreak,Iframe,PasteFromWord,PasteText',
  2122. on :
  2123. {
  2124. instanceReady : function( ev )
  2125. {
  2126. ev.editor.document.on('drop',function(){
  2127. insertDataItemsToRTE();
  2128. CKEDITOR.instances.email_body_iframe.focus();
  2129. });
  2130. }
  2131. }
  2132. } );
  2133. CKEDITOR.config.bodyId = 'editbody';
  2134. CKEDITOR.on( 'dialogDefinition', function( evt ) {
  2135. var dialog = evt.data;
  2136. if ( dialog.name == 'table' || dialog.name == 'tableProperties') {
  2137. // Get dialog definition.
  2138. var def = evt.data.definition;
  2139. def.onShow = function() {
  2140. var select = this.getContentElement( 'info', 'selHeaders' );
  2141. select.disable();
  2142. }
  2143. }
  2144. } );
  2145. </script>
  2146. </xsl:when>
  2147. <xsl:otherwise>
  2148. <textarea rows="6" name="email_body" id="email_body">
  2149. <xsl:attribute name="style">
  2150. <xsl:choose>
  2151. <!-- for agent studio we're using the table border and not the textarea border -->
  2152. <xsl:when test="key('request-param','agentStudio')='true'">
  2153. width:<xsl:value-of select="$inputSize - 6"/>px;
  2154. </xsl:when>
  2155. <xsl:otherwise>
  2156. width:<xsl:value-of select="$inputSize"/>px;
  2157. px;</xsl:otherwise>
  2158. </xsl:choose>
  2159. OVERFLOW:auto; PADDING: 2px;
  2160. <xsl:if test="key('request-param','agentStudio')='true'">BORDER-WIDTH: 0px;</xsl:if>
  2161. </xsl:attribute>
  2162. <xsl:value-of select="key('env-param','email_body')"/>
  2163. </textarea>
  2164. <input type="hidden" name="hidden_richEditBody" value=""/>
  2165. </xsl:otherwise>
  2166. </xsl:choose>
  2167. </xsl:template>
  2168. <xsl:template name="richEditControls">
  2169. <script type="text/javascript">
  2170. function richEditControl_removeLinks()
  2171. {
  2172. <xsl:if test="not(key('system-param','allow-email-links')='true')">
  2173. // remove all links from email_body for security reasons
  2174. for (i=0; i &lt; email_body_iframe.document.links.length; i++) {
  2175. var tr = email_body_iframe.document.links[i].parentTextEdit.createTextRange();
  2176. tr.moveToElementText(email_body_iframe.document.links[i]);
  2177. tr.execCommand("Unlink",false);
  2178. tr.execCommand("Unselect",false);
  2179. i--;
  2180. }
  2181. </xsl:if>
  2182. // remove all images from email_body for security reasons
  2183. for (i=0; i &lt; email_body_iframe.document.images.length; i++) {
  2184. var tr = email_body_iframe.document.images[i].parentTextEdit.createTextRange();
  2185. tr.moveToElementText(email_body_iframe.document.images[i]);
  2186. tr.execCommand("Delete",false);
  2187. i--;
  2188. }
  2189. }
  2190. function richEditControl_convertToXHTML()
  2191. {
  2192. var element = getEditorBody();
  2193. return richEditControl_doTree(element);
  2194. }
  2195. function getEditorBody()
  2196. {
  2197. var body = "";
  2198. if(CKEDITOR.instances != null &amp;&amp; CKEDITOR.instances != 'undefined'
  2199. &amp;&amp; CKEDITOR.instances.email_body_iframe != null &amp;&amp; CKEDITOR.instances.email_body_iframe != 'undefined'
  2200. &amp;&amp; CKEDITOR.instances.email_body_iframe.document != null &amp;&amp; CKEDITOR.instances.email_body_iframe.document != 'undefined')
  2201. {
  2202. var element = CKEDITOR.instances.email_body_iframe.document.getBody();
  2203. body = document.createElementNS('http://www.w3.org/1999/xhtml', 'body');
  2204. body.setAttribute('id', 'editbody');
  2205. body.innerHTML = element.getHtml();
  2206. }
  2207. return body;
  2208. }
  2209. function richEditControl_doTree(element)
  2210. {
  2211. var node = "";
  2212. if (element.nodeType == 1) {
  2213. // add the start of the node
  2214. node = "&lt;" + element.tagName;
  2215. for (var i = 0; i &lt; element.attributes.length; ++i) {
  2216. if (element.attributes[i].nodeValue != null &amp;&amp;
  2217. element.attributes[i].nodeValue.length > 0 &amp;&amp;
  2218. element.attributes[i].nodeName != &quot;contentEditable&quot;) {
  2219. node += " " + element.attributes[i].nodeName + "=\&quot;" + htmlEncode(element.attributes[i].nodeValue) + "\&quot;";
  2220. }
  2221. }
  2222. if (element.childNodes != null &amp;&amp; element.childNodes.length > 0) {
  2223. node += ">";
  2224. for (var j = 0; j &lt; element.childNodes.length; ++j) {
  2225. node += richEditControl_doTree(element.childNodes[j]);
  2226. }
  2227. node += "&lt;/" + element.tagName + "&gt;";
  2228. } else {
  2229. node += "/&gt;";
  2230. }
  2231. } else if (element.nodeType == 3) {
  2232. <!-- Make sure we encode special HTML characters (&, ", <, >) -->
  2233. node = htmlEncode(element.data);
  2234. }
  2235. return node;
  2236. }
  2237. function richEditControl_doEditBlur()
  2238. {
  2239. richEditControl_removeLinks();
  2240. // copy the contents of the edit window into a form field
  2241. document.<xsl:value-of select="key('request-param','formName')"/>.hidden_richEditBody.value = richEditControl_convertToXHTML();
  2242. }
  2243. // function to initialize the script for the contents of the screen
  2244. function richEditControl_init()
  2245. {
  2246. // set up the body of the Iframe
  2247. <xsl:choose>
  2248. <xsl:when test="key('env-param','hidden_richEditBody') != ''">
  2249. CKEDITOR.instances.email_body_iframe.setData('<xsl:value-of select="xtsext:javascriptencode(string(key('env-param','hidden_richEditBody')))"/>');
  2250. </xsl:when>
  2251. <xsl:when test="key('env-param','email_body') != ''">
  2252. <!-- encode textarea string's carriage returns -->
  2253. emailBodyString = replaceCarriageReturns(htmlEncode('<xsl:value-of select="xtsext:javascriptencode(string(key('env-param','email_body')))"/>'),'&lt;br/&gt;');
  2254. email_body_iframe.document.write("&lt;BODY id=\&quot;editbody\&quot;&gt;" + emailBodyString + "&lt;/BODY&gt;");
  2255. </xsl:when>
  2256. <xsl:otherwise>
  2257. email_body_iframe.document.write("&lt;BODY id=\&quot;editbody\&quot;&gt;&lt;/BODY&gt;");
  2258. </xsl:otherwise>
  2259. </xsl:choose>
  2260. // set up the drag drop for the HTML edit body too
  2261. <xsl:if test="$agentStudio">
  2262. var dropZone = new DropZone("editbody","","",'true',&quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;);
  2263. droppy.registerDropZoneObject(dropZone);
  2264. //pass the group to a listener in case number of members dynamically changes
  2265. droppy.registerDropZoneGroup(new Array(dropZone), &quot;<xsl:value-of select="xtsext:javascriptencode(key('request-param','tabSelectedID'))"/>&quot;);
  2266. </xsl:if>
  2267. if (document.<xsl:value-of select="key('request-param','formName')"/>.hidden_richEditBody)
  2268. {
  2269. // copy the contents of the edit window into a form field
  2270. document.<xsl:value-of select="key('request-param','formName')"/>.hidden_richEditBody.value = richEditControl_convertToXHTML();
  2271. }
  2272. }
  2273. </script>
  2274. </xsl:template>
  2275. </xsl:stylesheet>
  2276. </xts:block>
  2277. <!--
  2278. ===============================================================================================
  2279. debug - special debug block for nested requests
  2280. ===============================================================================================
  2281. -->
  2282. <xts:block id="debug" type="exec" processor="XSLT" mimeType="text/html" dependency="genMarkup processResponse returnResult" condition=".[/root/session/param[@name='debug']='1']" mandatory="false">
  2283. <!-- get the debug logic sheet -->
  2284. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  2285. <xsl:stylesheet version="1.0"
  2286. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  2287. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2288. xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/"
  2289. exclude-result-prefixes="dbg xos">
  2290. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  2291. <xsl:template match="/">
  2292. <xts:sequence>
  2293. <xsl:variable name="resultNode" select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='resultNode']"/>
  2294. <xts:append select="/root/output/*[local-name() = 'part']/*[local-name() = 'entityBody']/*[local-name()='{$resultNode}']">
  2295. <debugDump>
  2296. <xts:transform name="XMLEncode">
  2297. <dbg:dumpxml select="/root/*[local-name()!='header' and local-name()!='output' and local-name()!='system' and local-name()!='http' and local-name()!='session']">
  2298. <dbg:title>email_options.xts</dbg:title>
  2299. </dbg:dumpxml>
  2300. </xts:transform>
  2301. </debugDump>
  2302. </xts:append>
  2303. </xts:sequence>
  2304. </xsl:template>
  2305. </xsl:stylesheet>
  2306. </xts:block>
  2307. </xts:morphlet>