email_options.xts 133 KB

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