edit.xslt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!-- $Header: //cpscrn/main/templates/cps4/portlets/utility/portlet-impl/bookmarks/edit.xslt#1 $ -->
  13. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  14. <!-- $Change: 25109 $ -->
  15. <xsl:stylesheet version="1.0"
  16. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
  19. xmlns:uix="http://developer.cognos.com/schemas/cps/logic/ui-ext/1/"
  20. xmlns:utml="http://developer.cognos.com/schemas/cps/logic/form/1/"
  21. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  22. xmlns:trustedSession="java:com.cognos.portal.utils.TrustedSessionHelper"
  23. exclude-result-prefixes="xts ui uix utml">
  24. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  25. <!-- declare global variables... -->
  26. <utml:variables/>
  27. <!-- create portal variable: $ui-consumer-info -->
  28. <ui:consumer/>
  29. <xsl:variable name="is-input" select="key( 'utml-key-params', 'edit_visited' ) = 'true'"/>
  30. <xsl:variable name="boo-urls-deleted" select="$utml-params[starts-with( @name, 'tmp_select' ) and ( key( 'utml-key-params', 'tmp_delete' ) = 'true' )]"/>
  31. <xsl:variable name="boo-urls-input" select="$utml-params[starts-with( @name, 'p_boo_url' ) and not( concat( 'tmp_select', substring-after( @name, 'p_boo_url' ) ) = $boo-urls-deleted/@name )]"/>
  32. <xsl:variable name="boo-urls-state" select="$ui-state-params[starts-with( @name, 'boo_url' )]"/>
  33. <xsl:template match="/">
  34. <xsl:variable name="count">
  35. <xsl:choose>
  36. <xsl:when test="$is-input = 'true'">
  37. <xsl:value-of select="count( $boo-urls-input )"/>
  38. </xsl:when>
  39. <xsl:when test="$boo-urls-state">
  40. <xsl:value-of select="count( $boo-urls-state )"/>
  41. </xsl:when>
  42. <xsl:otherwise>5</xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:variable>
  45. <script language="javascript">
  46. function wsrp_rewrite_validate()
  47. {
  48. var cForm = document.wsrp_rewrite_form;
  49. for (var i=1; i&lt;=<xsl:value-of select="$count"/>; i++) {
  50. var f = cForm.elements["p_boo_url"+wsrp_rewrite_format(i)];
  51. var alias = cForm.elements["p_boo_alias"+wsrp_rewrite_format(i)];
  52. if ( !wsrp_rewrite_isValidURL(f.value, wsrp_rewrite_trim(alias.value) != "" )) {
  53. window.alert("<xts:string id="IDS_UTI_ERR_INVALID_URL" encode="javascript"/>");
  54. f.focus();
  55. return false;
  56. }
  57. }
  58. if ( !wsrp_rewrite_isValidChannel(cForm.p_target.value, document.getElementById("wsrp_rewrite_radio_target").checked) ) {
  59. window.alert("<xts:string id="IDS_UTI_ERR_INVALID_FRAME_NAME" encode="javascript"/>");
  60. cForm.p_target.focus();
  61. return false;
  62. }
  63. if ( !wsrp_rewrite_isValidChannel(cForm.p_channel.value, document.getElementById("wsrp_rewrite_radio_channel").checked) ) {
  64. window.alert("<xts:string id="IDS_UTI_ERR_INVALID_CHANNEL_NAME" encode="javascript"/>");
  65. cForm.p_channel.focus();
  66. return false;
  67. }
  68. return true;
  69. }
  70. function wsrp_rewrite_selectall()
  71. {
  72. var cForm = document.wsrp_rewrite_form;
  73. for (var i=1; i&lt;=<xsl:value-of select="$count"/>; i++) {
  74. cForm.elements["tmp_select"+wsrp_rewrite_format(i)].checked = cForm.tmp_all.checked;
  75. }
  76. }
  77. function wsrp_rewrite_format(n)
  78. {
  79. var s = n.toString();
  80. return ("00" + s).substring(s.length);
  81. }
  82. function wsrp_rewrite_add()
  83. {
  84. <xsl:choose>
  85. <xsl:when test="number($count) &gt;= 25">
  86. window.alert("<xts:string id="IDS_UTI_ERR_MAX_ENTRIES_LIMIT" encode="javascript"><xts:param name="count"><xsl:value-of select="$count"/></xts:param></xts:string>");
  87. </xsl:when>
  88. <xsl:otherwise>
  89. var cForm = document.wsrp_rewrite_form;
  90. var n = wsrp_rewrite_format(<xsl:value-of select="number($count)+1"/>);
  91. cForm.tmp_add_url.name = "p_boo_url" + n;
  92. cForm.tmp_add_alias.name = "p_boo_alias" + n;
  93. <utml:form-submit
  94. utml:formName="wsrp_rewrite_form"
  95. utml:targetPage="edit"
  96. utml:operation="maintain"
  97. utml:validate="true"/>
  98. </xsl:otherwise>
  99. </xsl:choose>
  100. }
  101. function wsrp_rewrite_remove()
  102. {
  103. if (!window.confirm("<xts:string id="IDS_UTI_BOO_PROMPT_REMOVE" encode="javascript"/>")) {
  104. return;
  105. }
  106. document.wsrp_rewrite_form.tmp_delete.value="true";
  107. <utml:form-submit
  108. utml:formName="wsrp_rewrite_form"
  109. utml:targetPage="edit"
  110. utml:operation="maintain"
  111. utml:validate="false"/>
  112. }
  113. </script>
  114. <uix:script-trim/>
  115. <uix:script-isValidURL/>
  116. <uix:script-isValidChannel/>
  117. <ui:about/>
  118. <ui:help/>
  119. <utml:form name="wsrp_rewrite_form" method="post" utml:maintainPrevNavState="true">
  120. <utml:exclude-prefix>p_boo_url</utml:exclude-prefix>
  121. <utml:exclude-prefix>p_boo_alias</utml:exclude-prefix>
  122. <utml:exclude-prefix>tmp_select</utml:exclude-prefix>
  123. <utml:input type="hidden" name="cps-authToken" utml:update="false">
  124. <utml:value>
  125. <xsl:value-of select="trustedSession:staticGenerateAuthToken(string(/root/cookies/cookie[@name='usersessionid']))"/>
  126. </utml:value>
  127. </utml:input>
  128. <utml:input name="tmp_add_url" type="hidden" utml:update="false"/>
  129. <utml:input name="tmp_add_alias" type="hidden" utml:update="false"/>
  130. <utml:input name="tmp_delete" type="hidden" utml:update="false"/>
  131. <ui:page>
  132. <ui:page-description><xts:string id="IDS_UTI_BOO_DESC"/></ui:page-description>
  133. <ui:page-section>
  134. <ui:page-sub-section-group>
  135. <ui:page-sub-section>
  136. <ui:page-sub-section-content>
  137. <uix:title />
  138. </ui:page-sub-section-content>
  139. </ui:page-sub-section>
  140. <ui:page-sub-section>
  141. <ui:page-sub-section-title><xts:string id="IDS_UTI_BOO_LABEL_BOOKMARKS"/></ui:page-sub-section-title>
  142. <ui:page-sub-section-content>
  143. <table border="0" cellspacing="0" cellpadding="1">
  144. <tr>
  145. <td class="portlet-msg-info"><xts:string id="IDS_UTI_BOO_DESC_BOOKMARKS"/></td>
  146. </tr>
  147. <tr>
  148. <td>
  149. <table border="0" cellspacing="0" cellpadding="1">
  150. <tr>
  151. <td>
  152. <table border="0" cellspacing="0" cellpadding="1" style="border: 1px solid black">
  153. <tr class="portlet-table-header">
  154. <td class="portlet-font" width="16">
  155. <utml:input name="tmp_all" type="checkbox" onclick="wsrp_rewrite_selectall()" class="portlet-form-field" utml:update="false">
  156. <utml:default-value>false</utml:default-value>
  157. </utml:input>
  158. </td>
  159. <td class="portlet-font" width="12">
  160. <img src="{ $ui-producer-images }sep.gif" alt="" width="12" height="16"/>
  161. </td>
  162. <td class="portlet-table-header" width="280"><xts:string id="IDS_UTI_BOO_HEADER_URLS"/></td>
  163. <td class="portlet-font" width="12">
  164. <img src="{ $ui-producer-images }sep.gif" alt="" width="12" height="16"/>
  165. </td>
  166. <td class="portlet-table-header" width="100"><xts:string id="IDS_UTI_BOO_HEADER_ALIASES"/></td>
  167. </tr>
  168. <xsl:choose>
  169. <xsl:when test="$is-input = 'true'">
  170. <xsl:choose>
  171. <xsl:when test="not($boo-urls-input)">
  172. <tr>
  173. <td class="portlet-table-body" valign="top" align="center" colspan="5">
  174. <br/><xts:string id="IDS_UTI_BOO_NO_ENTRIES"/><br/><br/>
  175. </td>
  176. </tr>
  177. </xsl:when>
  178. <xsl:otherwise>
  179. <xsl:for-each select="$boo-urls-input">
  180. <xsl:sort select="@name" order="ascending"/>
  181. <xsl:call-template name="render-url"/>
  182. </xsl:for-each>
  183. </xsl:otherwise>
  184. </xsl:choose>
  185. </xsl:when>
  186. <xsl:otherwise>
  187. <xsl:choose>
  188. <xsl:when test="$boo-urls-state">
  189. <xsl:for-each select="$boo-urls-state">
  190. <xsl:sort select="@name" order="ascending"/>
  191. <xsl:call-template name="render-url"/>
  192. </xsl:for-each>
  193. </xsl:when>
  194. <xsl:otherwise>
  195. <xsl:call-template name="render-url">
  196. <xsl:with-param name="n">01</xsl:with-param>
  197. </xsl:call-template>
  198. <xsl:call-template name="render-url">
  199. <xsl:with-param name="n">02</xsl:with-param>
  200. </xsl:call-template>
  201. <xsl:call-template name="render-url">
  202. <xsl:with-param name="n">03</xsl:with-param>
  203. </xsl:call-template>
  204. <xsl:call-template name="render-url">
  205. <xsl:with-param name="n">04</xsl:with-param>
  206. </xsl:call-template>
  207. <xsl:call-template name="render-url">
  208. <xsl:with-param name="n">05</xsl:with-param>
  209. </xsl:call-template>
  210. </xsl:otherwise>
  211. </xsl:choose>
  212. </xsl:otherwise>
  213. </xsl:choose>
  214. </table>
  215. </td>
  216. </tr>
  217. <tr>
  218. <td class="portlet-font" align="right">
  219. <a xsl:use-attribute-sets="anchor" href="javascript:wsrp_rewrite_add()"><xts:string id="IDS_UTI_BOO_ADD_BOOKMARK"/></a>
  220. <xsl:text>&#160;&#160;</xsl:text>
  221. <a xsl:use-attribute-sets="anchor" href="javascript:wsrp_rewrite_remove()"><xts:string id="IDS_UTI_BOO_DELETE_BOOKMARK"/></a>
  222. </td>
  223. </tr>
  224. </table>
  225. </td>
  226. </tr>
  227. </table>
  228. </ui:page-sub-section-content>
  229. </ui:page-sub-section>
  230. <ui:page-sub-section>
  231. <ui:page-sub-section-title><xts:string id="IDS_PRO_UIX_LABEL_OPEN_LINKS"/></ui:page-sub-section-title>
  232. <ui:page-sub-section-content>
  233. <uix:open-links msgChannel="IDS_UTI_COM_DESC_CHANNEL_HTML"/>
  234. </ui:page-sub-section-content>
  235. </ui:page-sub-section>
  236. </ui:page-sub-section-group>
  237. </ui:page-section>
  238. </ui:page>
  239. </utml:form>
  240. </xsl:template>
  241. <xsl:template name="render-url">
  242. <xsl:param name="n" select="xtsext:formatNumber( string(position()), '00', 'en', 2)"/>
  243. <tr>
  244. <td>
  245. <utml:input name="tmp_select{ $n }" type="checkbox" class="portlet-form-field">
  246. <utml:default-value>false</utml:default-value>
  247. </utml:input>
  248. </td>
  249. <td class="portlet-font" width="1">
  250. <img width="1" height="1" alt="" src="{ $ui-producer-images }space.gif"/>
  251. </td>
  252. <td>
  253. <utml:input name="p_boo_url{ $n }" type="text" size="60" class="portlet-form-input-field" utml:update="false" stttype="url">
  254. <utml:value>
  255. <xsl:choose>
  256. <xsl:when test="$is-input = 'true'">
  257. <xsl:value-of select="$utml-params[@name = current()/@name ]"/>
  258. </xsl:when>
  259. <xsl:otherwise>
  260. <xsl:value-of select="$ui-state-params[@name = current()/@name ]"/>
  261. </xsl:otherwise>
  262. </xsl:choose>
  263. </utml:value>
  264. </utml:input>
  265. </td>
  266. <td class="portlet-font" width="1">
  267. <img width="1" height="1" alt="" src="{ $ui-producer-images }space.gif"/>
  268. </td>
  269. <td>
  270. <utml:input name="p_boo_alias{ $n }" type="text" size="20" class="portlet-form-input-field" utml:update="false">
  271. <utml:value>
  272. <xsl:choose>
  273. <xsl:when test="$is-input = 'true'">
  274. <xsl:value-of select="$utml-params[@name = concat( 'p_boo_alias', substring-after( current()/@name, 'boo_url' ) ) ]"/>
  275. </xsl:when>
  276. <xsl:otherwise>
  277. <xsl:value-of select="$ui-state-params[@name = concat( 'boo_alias', substring-after( current()/@name, 'boo_url' ) ) ]"/>
  278. </xsl:otherwise>
  279. </xsl:choose>
  280. </utml:value>
  281. </utml:input>
  282. </td>
  283. </tr>
  284. </xsl:template>
  285. </xsl:stylesheet>