edit.xslt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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, 2014
  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/nav/portlet-impl/search/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:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  19. xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
  20. xmlns:uix="http://developer.cognos.com/schemas/cps/logic/ui-ext/1/"
  21. xmlns:utml="http://developer.cognos.com/schemas/cps/logic/form/1/"
  22. xmlns:trustedSession="java:com.cognos.portal.utils.TrustedSessionHelper"
  23. exclude-result-prefixes="xts xtsext ui uix utml">
  24. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  25. <!-- declare global variables... -->
  26. <xsl:variable name="delete" select="$ui-navigational-params[@name = 'tmp_delete']"/>
  27. <xsl:variable name="consumer-escape" select="$ui-registration-params[@name = 'consumerEscape']"/>
  28. <utml:variables/>
  29. <!-- create portal variable: $ui-consumer-info-->
  30. <ui:consumer/>
  31. <ui:property name="display-max-objects" select="'display_max_objects'"/>
  32. <ui:property name="display-details" select="'display_details'"/>
  33. <ui:property name="display-actions-link" select="'display_actions_link'"/>
  34. <ui:property name="display-maximize" select="'display_maximize'"/>
  35. <xsl:template match="/">
  36. <script language="javascript">
  37. function wsrp_rewrite_validate() {
  38. var cForm = document.wsrp_rewrite_form;
  39. var wsrp_rewrite_err1 = "<xts:string id="IDS_NAV_ERR_NAME_EXISTS" encode="javascript"/>";
  40. var wsrp_rewrite_err2 = "<xts:string id="IDS_NAV_ERR_NAME_BLANK" encode="javascript"/>";
  41. <xsl:variable name="savedSearchNames">
  42. <xsl:choose>
  43. <xsl:when test="key( 'utml-key-params', 'edit_visited' ) = 'true'">
  44. <xsl:for-each select="$utml-params[starts-with( @name, 'p_saved_n' ) and ( @name != string($delete) )]">
  45. <xsl:sort select="." order="ascending"/>
  46. <xsl:text/>"<xsl:value-of select="xtsext:javascriptencode( string( . ) )"/>"<xsl:text/>
  47. <xsl:text/>,<xsl:text/>
  48. </xsl:for-each>
  49. </xsl:when>
  50. <xsl:otherwise>
  51. <xsl:for-each select="$ui-state-params[starts-with( @name, 'saved_n' )]">
  52. <xsl:sort select="." order="ascending"/>
  53. <xsl:text/>"<xsl:value-of select="xtsext:javascriptencode( string( . ) )"/>"<xsl:text/>
  54. <xsl:text/>,<xsl:text/>
  55. </xsl:for-each>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. </xsl:variable>
  59. var savedSearchNamesArray = new Array( <xsl:value-of select="$savedSearchNames"/> "" );
  60. for (var loop = 1; ; loop++) {
  61. var f = cForm.elements["p_saved_n"+loop];
  62. if (f != null) {
  63. f.value = wsrp_rewrite_trim(f.value);
  64. for ( var i=0; i&lt;savedSearchNamesArray.length; i++ ) {
  65. if (f.value == ""){
  66. window.alert(wsrp_rewrite_err2);
  67. f.focus();
  68. return false;
  69. }
  70. else if ( (f.value == savedSearchNamesArray[i]) &amp;&amp; ((i+1) != loop) ) {
  71. window.alert(wsrp_rewrite_err1);
  72. f.focus();
  73. return false;
  74. }
  75. }
  76. } else {
  77. break;
  78. }
  79. }
  80. if (cForm.tmp_saved_n != null &amp;&amp; cForm.tmp_saved_n.value != "") {
  81. // do the save...
  82. cForm.tmp_saved_n.value = wsrp_rewrite_trim(cForm.tmp_saved_n.value);
  83. for ( var i=0; i&lt;savedSearchNamesArray.length; i++ ) {
  84. if ( (cForm.tmp_saved_n.value == savedSearchNamesArray[i]) ) {
  85. window.alert(wsrp_rewrite_err1);
  86. cForm.tmp_saved_n.focus();
  87. return false;
  88. }
  89. }
  90. cForm.tmp_saved_n.name = "p_saved_n"+loop;
  91. cForm.tmp_saved_s.name = "p_saved_s"+loop;
  92. <!--
  93. <HACK_ALERT>
  94. WE MUST BE AWARE THAT THE UTML BELOW COULD HAVE GENERATED AN INPUT FIELD WITH
  95. THE SAME NAME AS THE ABOVE, BUT WITH THE $consumer-escape PREFIX.
  96. -->
  97. <xsl:if test="$consumer-escape != ''">
  98. cForm.<xsl:value-of select="$consumer-escape"/>tmp_saved_n.name = "<xsl:value-of select="$consumer-escape"/>p_saved_n"+loop;
  99. </xsl:if>
  100. <!--</HACK_ALERT> -->
  101. }
  102. if ( !wsrp_rewrite_isValidChannel(cForm.p_target.value, document.getElementById("wsrp_rewrite_radio_target").checked) ) {
  103. window.alert("<xts:string id="IDS_NAV_ERR_INVALID_FRAME_NAME" encode="javascript"/>");
  104. cForm.p_target.focus();
  105. return false;
  106. }
  107. if ( !wsrp_rewrite_isValidChannel(cForm.p_channel.value, document.getElementById("wsrp_rewrite_radio_channel").checked) ) {
  108. window.alert( "<xts:string id="IDS_NAV_ERR_INVALID_CHANNEL_NAME" encode="javascript"/>");
  109. cForm.p_channel.focus();
  110. return false;
  111. }
  112. if ( !wsrp_rewrite_isValidBoundary(cForm.p_display_max_objects.value,1,1000) ) {
  113. window.alert("<xts:string id="IDS_NAV_ERR_NUMBER_BETWEEN" encode="javascript"><xts:param name="min">1</xts:param><xts:param name="max">1000</xts:param></xts:string>");
  114. cForm.p_display_max_objects.focus();
  115. return false;
  116. }
  117. return true;
  118. }
  119. function wsrp_rewrite_doDelete(searchID) {
  120. var cForm = document.wsrp_rewrite_form;
  121. cForm.tmp_delete.value = searchID;
  122. <utml:form-submit
  123. utml:formName="wsrp_rewrite_form"
  124. utml:targetPage="edit"
  125. utml:operation="maintain"
  126. utml:validate="false"/>
  127. }
  128. function wsrp_rewrite_doSaveNew() {
  129. var cForm = document.wsrp_rewrite_form;
  130. var err1 = "<xts:string id="IDS_NAV_ERR_NAME_BLANK" encode="javascript"/>";
  131. cForm.tmp_saved_n.value = wsrp_rewrite_trim(cForm.tmp_saved_n.value);
  132. if ( cForm.tmp_saved_n.value == "" ) {
  133. window.alert(err1);
  134. cForm.tmp_saved_n.focus();
  135. return false;
  136. }
  137. cForm.tmp_save_performed.value = 'true';
  138. <utml:form-submit
  139. utml:formName="wsrp_rewrite_form"
  140. utml:targetPage="edit"
  141. utml:operation="maintain"
  142. utml:validate="true"/>
  143. }
  144. </script>
  145. <uix:script-trim/>
  146. <uix:script-isValidChannel/>
  147. <uix:script-isValidBoundary/>
  148. <ui:about/>
  149. <ui:help/>
  150. <xsl:variable name="searchEditRegion"><xts:string id="IDS_PRO_UIX_EDITMODE_REGION_TITLE_SEARCH" encode="html"/></xsl:variable>
  151. <div role="region" aria-label="{$searchEditRegion}">
  152. <utml:form name="wsrp_rewrite_form" action="wsrp_rewrite?wsrp-urlType=blockingAction/wsrp_rewrite" method="post" utml:escape-prefix="$consumer-escape" utml:maintainPrevNavState="true">
  153. <utml:exclude-prefix>p_saved_</utml:exclude-prefix>
  154. <utml:input type="hidden" name="tmp_save_performed" value="false" utml:update="true"/>
  155. <utml:input type="hidden" name="tmp_delete" value="" utml:update="false"/>
  156. <utml:input type="hidden" name="cps-authToken" utml:update="false">
  157. <utml:value>
  158. <xsl:value-of select="trustedSession:staticGenerateAuthToken(string(/root/cookies/cookie[@name='usersessionid']))"/>
  159. </utml:value>
  160. </utml:input>
  161. <ui:page>
  162. <ui:page-description><xts:string id="IDS_NAV_EDT_DESC_SEARCH"/></ui:page-description>
  163. <xsl:if test="/root/portlet/consumer/supportTitle = 'true'">
  164. <ui:page-section>
  165. <!-- this will generate a ui:page-sub-section-group -->
  166. <uix:title/>
  167. </ui:page-section>
  168. </xsl:if>
  169. <ui:page-section>
  170. <ui:page-section-divider><xts:string id="IDS_NAV_EDT_GROUP_SAVED_SEARCHES"/></ui:page-section-divider>
  171. <ui:page-section-desc><xts:string id="IDS_NAV_EDT_DESC_SAVED_SEARCHES"/></ui:page-section-desc>
  172. <xsl:variable name="saved-searches1" select="$utml-params[starts-with( @name, 'p_saved_n' ) and ( @name != string($delete) )]"/>
  173. <xsl:variable name="saved-searches2" select="$ui-state-params[starts-with( @name, 'saved_n' )]"/>
  174. <ui:page-sub-section-group>
  175. <ui:page-sub-section tailing-space="false">
  176. <ui:page-sub-section-content>
  177. <table border="0" cellspacing="0" cellpadding="3" width="100%" role="presentation">
  178. <tr>
  179. <td class="portlet-form-field-label" width="45%"><xts:string id="IDS_NAV_EDT_LABEL_SAVED_SEARCHES"/></td>
  180. <td class="portlet-form-field" width="10%"><br/></td>
  181. <td class="portlet-form-field-label" width="45%"><xts:string id="IDS_NAV_EDT_LABEL_LAST_SEARCH"/></td>
  182. </tr>
  183. <tr>
  184. <td valign="top">
  185. <table border="0" cellpadding="0" cellspacing="0" role="presentation">
  186. <xsl:choose>
  187. <xsl:when test="( key( 'utml-key-params', 'edit_visited' ) = 'true' ) and $saved-searches1">
  188. <xsl:for-each select="$saved-searches1">
  189. <xsl:sort select="." order="ascending"/>
  190. <xsl:call-template name="render-saved-search"/>
  191. </xsl:for-each>
  192. </xsl:when>
  193. <xsl:when test="not( key( 'utml-key-params', 'edit_visited' )) and $saved-searches2">
  194. <xsl:for-each select="$saved-searches2">
  195. <xsl:sort select="." order="ascending"/>
  196. <xsl:call-template name="render-saved-search"/>
  197. </xsl:for-each>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <tr>
  201. <td class="portlet-form-field"><xts:string id="IDS_NAV_EDT_LABEL_NO_SEARCHES_SAVED"/></td>
  202. </tr>
  203. </xsl:otherwise>
  204. </xsl:choose>
  205. </table>
  206. </td>
  207. <xsl:choose>
  208. <xsl:when test="not( key( 'utml-key-params', 'tmp_save_performed' ) = 'true' ) and ( ( key( 'utml-key-params', 'execute' ) = 'true' ) or ( key( 'utml-key-params', 'last_search' ) != '' ))">
  209. <td class="portlet-form-field" valign="top">
  210. <input class="portlet-form-button" type="button" onclick="javascript:wsrp_rewrite_doSaveNew()">
  211. <xsl:attribute name="value"><xts:string id="IDS_NAV_EDT_LABEL_SAVE"/></xsl:attribute>
  212. </input>
  213. </td>
  214. <td class="portlet-form-field" valign="top">
  215. <xsl:call-template name="render-new-search"/>
  216. </td>
  217. </xsl:when>
  218. <xsl:otherwise>
  219. <td class="portlet-form-field" valign="top">
  220. <br/>
  221. </td>
  222. <td class="portlet-form-field" valign="top"><xts:string id="IDS_NAV_EDT_LABEL_NO_LAST_SEARCH"/></td>
  223. </xsl:otherwise>
  224. </xsl:choose>
  225. </tr>
  226. </table>
  227. </ui:page-sub-section-content>
  228. </ui:page-sub-section>
  229. </ui:page-sub-section-group>
  230. </ui:page-section>
  231. <ui:page-section>
  232. <ui:page-sub-section-group>
  233. <ui:page-sub-section tailing-space="false">
  234. <ui:page-sub-section-title><xts:string id="IDS_PRO_UIX_LABEL_OPEN_LINKS"/></ui:page-sub-section-title>
  235. <ui:page-sub-section-content>
  236. <uix:open-links msgChannel="IDS_NAV_COM_DESC_CHANNEL_VIEWER" rgLabel="IDS_PRO_UIX_LABEL_OPEN_LINKS" />
  237. </ui:page-sub-section-content>
  238. </ui:page-sub-section>
  239. </ui:page-sub-section-group>
  240. </ui:page-section>
  241. <ui:page-section>
  242. <ui:page-section-divider><xts:string id="IDS_NAV_COM_GROUP_VIEWING_OPTIONS"/></ui:page-section-divider>
  243. <ui:page-sub-section-group>
  244. <ui:page-sub-section>
  245. <ui:page-sub-section-title><label for="wsrp_rewrite_p_display_max_objects"><xts:string id="IDS_NAV_EDT_LABEL_SEARCH_DISPLAY_MAX_OBJECTS"/></label></ui:page-sub-section-title>
  246. <ui:page-sub-section-content>
  247. <table border="0" cellspacing="0" cellpadding="1">
  248. <tr>
  249. <td>
  250. <utml:input id="wsrp_rewrite_p_display_max_objects" class="portlet-form-input-field" name="p_display_max_objects" type="text" size="5">
  251. <utml:value>
  252. <xsl:value-of select="$display-max-objects"/>
  253. </utml:value>
  254. </utml:input>
  255. </td>
  256. </tr>
  257. </table>
  258. </ui:page-sub-section-content>
  259. </ui:page-sub-section>
  260. <ui:page-sub-section>
  261. <ui:page-sub-section-title><xts:string id="IDS_NAV_COM_CONTENT_OF_VIEW"/></ui:page-sub-section-title>
  262. <ui:page-sub-section-content>
  263. <table border="0" cellspacing="0" cellpadding="1" role="presentation">
  264. <tr>
  265. <td class="portlet-form-field">
  266. <utml:input name="p_display_details" id="wsrp_rewrite_IDS_NAV_EDT_LABEL_DISPLAY_DETAIL" type="checkbox" value="true">
  267. <xsl:if test="$display-details = 'true'">
  268. <xsl:attribute name="checked"/>
  269. </xsl:if>
  270. </utml:input>
  271. </td>
  272. <td class="portlet-form-field"><label for="wsrp_rewrite_IDS_NAV_EDT_LABEL_DISPLAY_DETAIL"><xts:string id="IDS_NAV_EDT_LABEL_DISPLAY_DETAIL"/></label></td>
  273. </tr>
  274. <tr>
  275. <td class="portlet-form-field">
  276. <utml:input id="wsrp_rewrite_IDS_NAV_EDT_LABEL_DISPLAY_ACTIONS" name="p_display_actions_link" type="checkbox" value="true">
  277. <xsl:if test="$display-actions-link = 'true'">
  278. <xsl:attribute name="checked"/>
  279. </xsl:if>
  280. </utml:input>
  281. </td>
  282. <td class="portlet-form-field"><label for="wsrp_rewrite_IDS_NAV_EDT_LABEL_DISPLAY_ACTIONS"><xts:string id="IDS_NAV_EDT_LABEL_DISPLAY_ACTIONS"/></label></td>
  283. </tr>
  284. </table>
  285. </ui:page-sub-section-content>
  286. </ui:page-sub-section>
  287. <xsl:if test="$ui-markups/wsrp:validNewWindowStates[ .='wsrp:maximized' ]">
  288. <ui:page-sub-section>
  289. <ui:page-sub-section-title><xts:string id="IDS_NAV_EDT_LABEL_SEARCH_RESULTS"/></ui:page-sub-section-title>
  290. <ui:page-sub-section-content>
  291. <table border="0" cellspacing="0" cellpadding="1" role="presentation">
  292. <tr>
  293. <td class="portlet-form-field">
  294. <utml:input id="wsrp_rewrite_IDS_NAV_EDT_LABEL_SEARCH_MAXIMIZE_VIEW" name="p_display_maximize" type="checkbox" value="true">
  295. <xsl:if test="$display-maximize = 'true'">
  296. <xsl:attribute name="checked"/>
  297. </xsl:if>
  298. </utml:input>
  299. </td>
  300. <td class="portlet-form-field"><label for="wsrp_rewrite_IDS_NAV_EDT_LABEL_SEARCH_MAXIMIZE_VIEW"><xts:string id="IDS_NAV_EDT_LABEL_SEARCH_MAXIMIZE_VIEW"/></label></td>
  301. </tr>
  302. </table>
  303. </ui:page-sub-section-content>
  304. </ui:page-sub-section>
  305. </xsl:if>
  306. <!-- SAP-HACK-START -->
  307. <ui:admin-settings/>
  308. <!-- SAP-HACK-END -->
  309. </ui:page-sub-section-group>
  310. </ui:page-section>
  311. </ui:page>
  312. </utml:form>
  313. </div>
  314. </xsl:template>
  315. <xsl:template name="render-saved-search">
  316. <xsl:param name="name" select="@name"/>
  317. <xsl:param name="pos" select="position()"/>
  318. <xsl:variable name="saved-s" select="concat( concat( substring-before( $name, '_n' ), '_s' ), substring-after( $name, '_n' ) )"/>
  319. <tr>
  320. <td class="portlet-form-field">
  321. <utml:input class="portlet-form-input-field" type="text" name="p_saved_n{ $pos }" size="30" maxlength="45" utml:escape="true" utml:escape-prefix="$consumer-escape">
  322. <utml:value>
  323. <xsl:choose>
  324. <xsl:when test="key( 'utml-key-params', string($name) )">
  325. <xsl:value-of select="key( 'utml-key-params', string($name) )"/>
  326. </xsl:when>
  327. <xsl:otherwise>
  328. <xsl:value-of select="$ui-state-params[@name = $name]"/>
  329. </xsl:otherwise>
  330. </xsl:choose>
  331. </utml:value>
  332. <xsl:attribute name="aria-label"><xts:string id="IDS_NAV_EDT_LABEL_SAVED_SEARCHES_INP"><xts:param name="searchNum"><xsl:value-of select="$pos"/></xts:param></xts:string></xsl:attribute>
  333. </utml:input>
  334. <xsl:text>&#160;</xsl:text>
  335. <a xsl:use-attribute-sets="anchor" href="javascript:wsrp_rewrite_doDelete('p_saved_n{ $pos }');"><xts:string id="IDS_NAV_EDT_LABEL_DELETE"/></a>
  336. <utml:input type="hidden" name="p_saved_s{ $pos }">
  337. <utml:value>
  338. <xsl:choose>
  339. <xsl:when test="key( 'utml-key-params', string($saved-s) )">
  340. <xsl:value-of select="key( 'utml-key-params', string($saved-s) )"/>
  341. </xsl:when>
  342. <xsl:otherwise>
  343. <xsl:value-of select="$ui-state-params[@name = string($saved-s)]"/>
  344. </xsl:otherwise>
  345. </xsl:choose>
  346. </utml:value>
  347. </utml:input>
  348. </td>
  349. </tr>
  350. </xsl:template>
  351. <xsl:template name="render-new-search">
  352. <xsl:variable name="inpLabel"><xts:string id="IDS_NAV_EDT_LABEL_LAST_SEARCH"/></xsl:variable>
  353. <utml:input aria-label="{$inpLabel}" class="portlet-form-input-field" type="text" name="tmp_saved_n" size="30" maxlength="45" utml:escape="true" utml:escape-prefix="$consumer-escape"/>
  354. <utml:input type="hidden" name="tmp_saved_s">
  355. <utml:value>
  356. <xsl:choose>
  357. <xsl:when test="key( 'utml-key-params', 'last_search' ) != ''">
  358. <xsl:value-of select="key( 'utml-key-params', 'last_search' )"/>
  359. </xsl:when>
  360. <xsl:otherwise>
  361. <xsl:variable name="saved-search">
  362. <xsl:for-each select="$utml-params[starts-with(@name, 'cps_')]">
  363. <xsl:call-template name="gen-param"/>
  364. </xsl:for-each>
  365. <xsl:call-template name="gen-param">
  366. <xsl:with-param name="name" select="'execute'"/>
  367. <xsl:with-param name="value" select="'true'"/>
  368. </xsl:call-template>
  369. </xsl:variable>
  370. <xsl:value-of select="xtsext:base64encode( string( $saved-search ), true() )"/>
  371. </xsl:otherwise>
  372. </xsl:choose>
  373. </utml:value>
  374. </utml:input>
  375. </xsl:template>
  376. <xsl:template name="gen-param">
  377. <xsl:param name="name" select="@name"/>
  378. <xsl:param name="value" select="."/>
  379. <xsl:text>&lt;param name="</xsl:text>
  380. <xsl:value-of select="$name"/>
  381. <xsl:text>"></xsl:text>
  382. <xsl:value-of select="xtsext:xmlencode(string($value))"/>
  383. <xsl:text>&lt;/param></xsl:text>
  384. </xsl:template>
  385. </xsl:stylesheet>