edit.xslt 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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, 2012
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. xmlns:pui="http://developer.cognos.com/common/portal/logic/ui/1/"
  16. xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
  17. xmlns:nui="http://developer.cognos.com/schemas/cps/logic/nav/ui/1/"
  18. xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
  19. xmlns:valerr="http://developer.cognos.com/validation/errrormessages/1/"
  20. xmlns:layout="http://developer.cognos.com/common/layout"
  21. xmlns:java="java:com.cognos.portal.utils.CCLLocaleUtils"
  22. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts xtsext ui nui nav">
  23. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  24. <xsl:variable name="useLocale">
  25. <xsl:choose>
  26. <xsl:when test="not(/root/customs/param[@name='title']/value)">
  27. <xsl:value-of select="/root/preferences/param[@name='contentLocale']"/>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <xsl:variable name="langs">
  31. <xsl:for-each select="/root/customs/param[@name='title']/value">
  32. <xsl:value-of select="@xml:lang"/>
  33. <xsl:if test="not(position() = last())">,</xsl:if>
  34. </xsl:for-each>
  35. </xsl:variable>
  36. <xsl:value-of select="java:getBestFitLocale(string(/root/preferences/param[@name='contentLocale']),string($langs))"/>
  37. </xsl:otherwise>
  38. </xsl:choose>
  39. </xsl:variable>
  40. <xsl:variable name="productLocale">
  41. <xsl:value-of select="/root/preferences/param[@name='productLocale']"/>
  42. </xsl:variable>
  43. <xsl:variable name="isBidiEnabled">
  44. <xsl:value-of select="/root/preferences/param[@name='http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#biDirectionalFeaturesEnabled']"/>
  45. </xsl:variable>
  46. <xsl:variable name="baseTextDirection">
  47. <xsl:variable name="ns_name">
  48. <xsl:value-of select="/root/preferences/param[@name='http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#baseTextDirection']"/>
  49. </xsl:variable>
  50. <xsl:choose>
  51. <xsl:when test="$ns_name != ''">
  52. <xsl:value-of select="translate(substring-after($ns_name,'#'),'LTRA','ltra')"/>
  53. </xsl:when>
  54. <xsl:otherwise>auto</xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:variable>
  57. <layout:selectortemplates/>
  58. <xsl:template match="/">
  59. <xsl:choose>
  60. <xsl:when test="/root/interactions/param[@name='formaction'] = 'objectSelect'">
  61. <xsl:call-template name="generateMarkupForObjectSelect"/>
  62. </xsl:when>
  63. <xsl:otherwise>
  64. <div>
  65. <layout formName="form">
  66. <xsl:call-template name="generateMarkupForFullPage"/>
  67. </layout>
  68. </div>
  69. </xsl:otherwise>
  70. </xsl:choose>
  71. </xsl:template>
  72. <xsl:template name="generateMarkupForObjectSelect">
  73. <xsl:variable name="navItemResponse" select="/root/init/objectResponse/nav:getItemResponse"/>
  74. <xsl:variable name="formAction" select="/root/interactions/param[@name='formaction']"/>
  75. <xsl:variable name="selectionId" select="/root/interactions/param[@name='p_navSelectionId']"/>
  76. <xsl:variable name="selectedChannel">
  77. <xsl:choose>
  78. <xsl:when test="/root/interactions/param[@name='tmp_channel'] != ''">
  79. <xsl:value-of select="/root/interactions/param[@name='tmp_channel']"/>
  80. </xsl:when>
  81. <xsl:when test="/root/state/param[@name='channel'] != ''">
  82. <xsl:value-of select="/root/state/param[@name='channel']"/>
  83. </xsl:when>
  84. <xsl:when test="/root/customs/param[@name='channel'] != ''">
  85. <xsl:value-of select="/root/customs/param[@name='channel']"/>
  86. </xsl:when>
  87. </xsl:choose>
  88. </xsl:variable>
  89. <layout:script>
  90. var isBidiEnabled = <xsl:value-of select="boolean($isBidiEnabled='true')"/>;
  91. if (isBidiEnabled){
  92. var bidi = BidiUtils.getInstance();
  93. bidi.setProperties('<xsl:value-of select="$baseTextDirection"/>',
  94. '<xsl:value-of select="xtsext:getBTD('', $baseTextDirection, $productLocale)"/>',
  95. '<xsl:value-of select="$productLocale"/>');
  96. }
  97. </layout:script>
  98. <xsl:choose>
  99. <xsl:when test="((string($navItemResponse/*/nav:internalId) != '') and not($formAction)) or ($formAction and ($selectionId != ''))">
  100. <xsl:variable name="imageSrc" select="$navItemResponse/*/nav:imgURL"/>
  101. <xsl:variable name="hidden" select="$navItemResponse/*/nav:hidden"/>
  102. <xsl:variable name="fullName" select="$navItemResponse/*/nav:fullName"/>
  103. <xsl:variable name="selectedId" select="$navItemResponse/*/nav:internalId"/>
  104. <xsl:variable name="targetId">
  105. <xsl:choose>
  106. <xsl:when test="$navItemResponse/nav:shortcut/*/nav:internalId">
  107. <xsl:value-of select="$navItemResponse/nav:shortcut/*/nav:internalId"/>
  108. </xsl:when>
  109. <xsl:otherwise>
  110. <xsl:value-of select="$navItemResponse/*/nav:internalId"/>
  111. </xsl:otherwise>
  112. </xsl:choose>
  113. </xsl:variable>
  114. <xsl:variable name="objectType">
  115. <xsl:choose>
  116. <xsl:when test="$navItemResponse/nav:shortcut/*/nav:type">
  117. <xsl:value-of select="$navItemResponse/nav:shortcut/*/nav:type"/>
  118. </xsl:when>
  119. <xsl:when test="$navItemResponse/*/nav:type">
  120. <xsl:value-of select="$navItemResponse/*/nav:type"/>
  121. </xsl:when>
  122. </xsl:choose>
  123. </xsl:variable>
  124. <layout:section format="select-dialog">
  125. <layout:label>
  126. <layout:text><xts:string id="IDS_PROP_CVIEW_ENTRY_CAPTION"/></layout:text>
  127. </layout:label>
  128. <layout:row format="select-image">
  129. <layout:img src="{$imageSrc}" alt="{$navItemResponse/nav:item/nav:name}" title="{$navItemResponse/nav:item/nav:name}">
  130. <xsl:if test="$hidden = 'true' ">
  131. <layout:faded/>
  132. </xsl:if>
  133. </layout:img>
  134. <layout:text><xsl:value-of select="$fullName"/></layout:text>
  135. <xsl:if test="$objectType = 'query' or $objectType = 'report' or $objectType = 'reportView' or $objectType = 'analysis' or $objectType = 'shortcut'">
  136. <layout:link href="#" onclick="_THIS_openAdvancedPropEdit();" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_openAdvancedPropEdit(); return false;" class="cogstyle-layout-left">
  137. <xts:string id="IDS_PROP_ADVANCED_PROP_EDIT_PROPERTIES"/>
  138. </layout:link>
  139. </xsl:if>
  140. </layout:row>
  141. <layout:row>
  142. <layout:link href="#" onclick="_THIS_chooseObject('prop', '_THIS_objectSelectionDiv', 'fragments.universalviewer.selection'); return false;" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_chooseObject('prop', '_THIS_objectSelectionDiv', 'fragments.universalviewer.selection'); return false;">
  143. <xts:string id="IDS_PROP_OBJECT_SELECT_CAPTION"/>
  144. </layout:link>
  145. <layout:link href="#" onclick="_THIS_resetObject('_THIS_objectSelectionDiv');" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_resetObject('_THIS_objectSelectionDiv'); return false;">
  146. <xts:string id="IDS_PROP_OBJECT_RESET_CAPTION"/>
  147. </layout:link>
  148. </layout:row>
  149. <layout:hidden id="navSelectId" name="p_navSelectionId" value="{$selectedId}"/>
  150. <layout:hidden id="targetId" name="p_targetId" value="{$targetId}"/>
  151. </layout:section>
  152. <layout:section format="none">
  153. <layout:field id="viewChannel" name="p_channel" type="text" maxlength="1024">
  154. <xsl:attribute name="valerr:message" namespace="http://developer.cognos.com/validation/errrormessages/1/" ><xts:string id='IDS_PROP_ERR_INVALID_CHANNEL_NAME' encode='javascript'/></xsl:attribute>
  155. <xsl:if test="$isBidiEnabled = 'true'">
  156. <xsl:attribute name="dir">
  157. <xsl:value-of select="xtsext:getBTD(string($selectedChannel), $baseTextDirection, $productLocale)"/>
  158. </xsl:attribute>
  159. </xsl:if>
  160. <xsl:if test="$isBidiEnabled = 'true' and $baseTextDirection = 'auto'">
  161. <xsl:attribute name="onfocus">
  162. bidi.onfocus(this)
  163. </xsl:attribute>
  164. </xsl:if>
  165. <layout:label>
  166. <layout:text><xts:string id="IDS_PROP_CHANNEL_CAPTION"/></layout:text>
  167. <xsl:choose>
  168. <xsl:when test="$objectType = 'query' or $objectType = 'report' or $objectType = 'reportView' or $objectType = 'analysis' or $objectType = 'shortcut'">
  169. <xsl:variable name="adprop"><xts:string id="IDS_PROP_ADVANCED_PROP_EDIT_PROPERTIES"/></xsl:variable>
  170. <layout:hint>
  171. <layout:text format="hasLink">
  172. <xts:string id="IDS_PROP_CHANNEL_MESSAGE_CAPTION"/>
  173. <xts:string id="IDS_PROP_CHANNEL_MESSAGE_REPORT_CAPTION">
  174. <xts:param name="link">
  175. <layout:link href="#" onclick="_THIS_openAdvancedPropEdit();" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_openAdvancedPropEdit(); return false;">
  176. <xsl:value-of select="$adprop"/>
  177. </layout:link>
  178. </xts:param>
  179. </xts:string>
  180. </layout:text>
  181. </layout:hint>
  182. </xsl:when>
  183. <xsl:otherwise>
  184. <layout:hint><xts:string id="IDS_PROP_CHANNEL_MESSAGE_CAPTION"/></layout:hint>
  185. </xsl:otherwise>
  186. </xsl:choose>
  187. </layout:label>
  188. <layout:value><xsl:value-of select="$selectedChannel"/></layout:value>
  189. </layout:field>
  190. <layout:hidden id="tempChannel" name="tmp_channel" value="{$selectedChannel}"/>
  191. </layout:section>
  192. </xsl:when>
  193. <xsl:otherwise>
  194. <layout:section format="select-dialog">
  195. <layout:label>
  196. <layout:text><xts:string id="IDS_PROP_CVIEW_ENTRY_CAPTION"/></layout:text>
  197. </layout:label>
  198. <layout:row format="select">
  199. <layout:text><xts:string id="IDS_PROP_OBJECT_NONE"/></layout:text>
  200. </layout:row>
  201. <layout:row>
  202. <layout:link href="#" onclick="_THIS_chooseObject('prop', '_THIS_objectSelectionDiv', 'fragments.universalviewer.selection'); return false;" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_chooseObject('prop', '_THIS_objectSelectionDiv', 'fragments.universalviewer.selection'); return false;">
  203. <xts:string id="IDS_PROP_OBJECT_SELECT_CAPTION"/>
  204. </layout:link>
  205. </layout:row>
  206. <layout:hidden id="navSelectId" name="p_navSelectionId" value=""/>
  207. </layout:section>
  208. <layout:section format="none">
  209. <layout:field id="viewChannel" name="p_channel" type="text" maxlength="1024">
  210. <xsl:attribute name="valerr:message" namespace="http://developer.cognos.com/validation/errrormessages/1/" ><xts:string id='IDS_PROP_ERR_INVALID_CHANNEL_NAME' encode='javascript'/></xsl:attribute>
  211. <xsl:if test="$isBidiEnabled = 'true'">
  212. <xsl:attribute name="dir">
  213. <xsl:value-of select="xtsext:getBTD(string($selectedChannel), $baseTextDirection, $productLocale)"/>
  214. </xsl:attribute>
  215. </xsl:if>
  216. <xsl:if test="$isBidiEnabled = 'true' and $baseTextDirection = 'auto'">
  217. <xsl:attribute name="onfocus">
  218. bidi.onfocus(this)
  219. </xsl:attribute>
  220. </xsl:if>
  221. <layout:label>
  222. <layout:text><xts:string id="IDS_PROP_CHANNEL_CAPTION"/></layout:text>
  223. <layout:hint><layout:text><xts:string id="IDS_PROP_CHANNEL_MESSAGE_CAPTION"/></layout:text></layout:hint>
  224. </layout:label>
  225. <layout:value><xsl:value-of select="$selectedChannel"/></layout:value>
  226. </layout:field>
  227. <layout:hidden id="tempChannel" name="tmp_channel" value="{$selectedChannel}"/>
  228. </layout:section>
  229. </xsl:otherwise>
  230. </xsl:choose>
  231. </xsl:template>
  232. <xsl:template name="generateMarkupForFullPage">
  233. <xsl:variable name="titleOptions">
  234. <xsl:choose>
  235. <xsl:when test="/root/state/param[@name='viewerTitleOptions'] != ''">
  236. <xsl:value-of select="/root/state/param[@name='viewerTitleOptions']"/>
  237. </xsl:when>
  238. <xsl:when test="/root/customs/param[@name='viewerTitleOptions'] != ''">
  239. <xsl:value-of select="/root/customs/param[@name='viewerTitleOptions']"/>
  240. </xsl:when>
  241. </xsl:choose>
  242. </xsl:variable>
  243. <xsl:variable name="selectedChannel">
  244. <xsl:choose>
  245. <xsl:when test="/root/interactions/param[@name='tmp_channel'] != ''">
  246. <xsl:value-of select="/root/interactions/param[@name='tmp_channel']"/>
  247. </xsl:when>
  248. <xsl:when test="/root/state/param[@name='channel'] != ''">
  249. <xsl:value-of select="/root/state/param[@name='channel']"/>
  250. </xsl:when>
  251. <xsl:when test="/root/customs/param[@name='channel'] != ''">
  252. <xsl:value-of select="/root/customs/param[@name='channel']"/>
  253. </xsl:when>
  254. </xsl:choose>
  255. </xsl:variable>
  256. <xsl:variable name="fragHeight">
  257. <xsl:choose>
  258. <xsl:when test="/root/state/param[@name='viewerFragmentHeight'] != ''">
  259. <xsl:value-of select="/root/state/param[@name='viewerFragmentHeight']"/>
  260. </xsl:when>
  261. <xsl:when test="/root/customs/param[@name='viewerFragmentHeight'] != ''">
  262. <xsl:value-of select="/root/customs/param[@name='viewerFragmentHeight']"/>
  263. </xsl:when>
  264. </xsl:choose>
  265. </xsl:variable>
  266. <div>
  267. <pui:aboutscript/>
  268. <pui:helpscript/>
  269. <layout:form name="_THIS_form" action="_THIS?/THIS_" method="get">
  270. <layout:script>
  271. var _THIS_itemList = new Array("title");
  272. function _THIS_refreshEdit(evt)
  273. {
  274. if(evt.eventPhase == evt.AT_TARGET)
  275. {
  276. checkToRefresh("_THIS_form",evt,"<xts:string id="IDS_PROP_REFRESH_LANGUAGE_MSG" encode="javascript"/>");
  277. }
  278. }
  279. _THIS_.addEventListener("fragment.refresh","_THIS_refreshEdit",false);
  280. function _THIS_submitEditForm(formAction)
  281. {
  282. if (_THIS_validateFormFields())
  283. {
  284. var action = $("_THIS_formAction");
  285. action.setAttribute("value", formAction);
  286. if($("_THIS_navSelectId"))
  287. {
  288. if ((formAction == 'save')&amp;&amp;($("_THIS_navSelectId").value != ''))
  289. {
  290. $("_THIS_navSelectId").value = $("_THIS_navSelectId").value;
  291. }
  292. if (_THIS_.removeFragChildren)
  293. _THIS_.removeFragChildren();
  294. }
  295. document._THIS_form.submit();
  296. }
  297. }
  298. function _THIS_uviewReset(evt)
  299. {
  300. if (evt.eventPhase == evt.AT_TARGET){
  301. if (_THIS_.removeFragChildren)
  302. _THIS_.removeFragChildren();
  303. }
  304. }
  305. _THIS_.addEventListener("fragment.reset","_THIS_uviewReset",false);
  306. function _THIS_cancelEdit()
  307. {
  308. _THIS_.setMode('view');
  309. }
  310. function _THIS_validateFormFields()
  311. {
  312. var valid = true;
  313. var titleErr = validateMultiLingualProperty("selectLang", "title", "form", "_THIS_", _THIS_, _THIS_itemList);
  314. if (titleErr != CValidator.RES_VALID)
  315. {
  316. var entryEl = document.getElementById("_THIS_title");
  317. alert(entryEl.getAttribute("valerr:message"));
  318. entryEl.focus();
  319. return false;
  320. }
  321. //check the view channel
  322. var channel = $("_THIS_viewChannel");
  323. if (channel)
  324. {
  325. var channelErr = _THIS_.validate("channel", channel.value);
  326. if (channelErr != CValidator.RES_VALID)
  327. {
  328. alert(channel.getAttribute("valerr:message"));
  329. channel.focus();
  330. return false;
  331. }
  332. }
  333. //check the frag height
  334. var fragHeight = $("_THIS_viewFragHeight");
  335. if (fragHeight)
  336. {
  337. var fragHeightErr = _THIS_.validate("viewerFragmentHeight", fragHeight.value);
  338. if (fragHeightErr != CValidator.RES_VALID)
  339. {
  340. if (fragHeightErr == CValidator.RES_NUMERIC_NAN)
  341. {
  342. alert("<xts:string id='IDS_PROP_INVALID_HEIGHT' encode='javascript'/>");
  343. }
  344. else if (fragHeightErr == CValidator.RES_NUMERIC_MAX)
  345. {
  346. alert("<xts:string id='IDS_PROP_MAX_HEIGHT' encode='javascript'/>");
  347. }
  348. else
  349. {
  350. alert("<xts:string id='IDS_GEN_CLIENT_VALIDATION_ERROR' encode='javascript'/>");
  351. }
  352. fragHeight.focus();
  353. return false;
  354. }
  355. }
  356. return true;
  357. }
  358. function _THIS_createHiddenElement(id, name, value)
  359. {
  360. var hiddenElem;
  361. if ($("_THIS_selectedLanguage"))
  362. {
  363. hiddenElem = $(id);
  364. }
  365. else
  366. {
  367. hiddenElem = xCreateElement("input");
  368. hiddenElem.setAttribute("name", name);
  369. hiddenElem.setAttribute("value", value);
  370. hiddenElem.setAttribute("type", "hidden");
  371. hiddenElem.setAttribute("id", id);
  372. document._THIS_form.appendChild(hiddenElem);
  373. }
  374. hiddenElem.setAttribute("value", value);
  375. }
  376. function _THIS_reloadAfterSelectObject(response)
  377. {
  378. response = _THIS_decode(response);
  379. var xml = new _THIS_XMLBuilderLoadXMLFromString(response);
  380. if(xml)
  381. {
  382. var idNode = _F_DOM.selectSingleNode(xml, "/return/object/item[name= 'id']/value");
  383. var id = _F_DOM.text(idNode);
  384. var tmpChannel = $("_THIS_viewChannel").value;
  385. _THIS_.addEventListener("fragment.retrieve.after","_THIS_closeSelectDialog",false);
  386. var funcParms = "_THIS_.retrieve(\"p_navSelectionId=" + id + "&amp;tmp_channel=" + tmpChannel + "&amp;formaction=objectSelect\",\"" + _THIS_currentObjDiv + "\")";
  387. setTimeout(funcParms,1);
  388. _THIS_clearCustomizations();
  389. return;
  390. }
  391. }
  392. function _THIS_closeSelectDialog(evt)
  393. {
  394. if(evt.eventPhase == evt.AT_TARGET)
  395. setTimeout('_THIS_closeSD()', 350);
  396. }
  397. //CQ234492 To remove the delay in IE when closing the select dialog and focusing back to the main window
  398. function _THIS_closeSD() {
  399. _THIS_modalDialog.hide();
  400. _THIS_modalDialog.destroy();
  401. _THIS_modalDialog = null;
  402. _THIS_.removeEventListener("fragment.retrieve.after","_THIS_closeSelectDialog",false);
  403. }
  404. function _THIS_resetObject( divId)
  405. {
  406. _THIS_.retrieve('p_navSelectionId=&amp;tmp_channel=&amp;formaction=objectSelect', divId);
  407. return;
  408. }
  409. function _THIS_XMLBuilderLoadXMLFromString (markup)
  410. {
  411. var xmlDocument = null;
  412. if (window.ActiveXObject || "ActiveXObject" in window)
  413. {
  414. try
  415. {
  416. xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
  417. xmlDocument.loadXML(markup);
  418. }
  419. catch (e)
  420. {
  421. }
  422. }
  423. else if (typeof DOMParser != 'undefined')
  424. {
  425. xmlDocument = new DOMParser().parseFromString(markup, 'application/xml');
  426. }
  427. return xmlDocument;
  428. }
  429. function _THIS_decode(text)
  430. {
  431. var amp_re = /&amp;amp;/g;
  432. var lt_re = /&amp;lt;/g;
  433. var gt_re = /&amp;gt;/g;
  434. var apos_re = /&amp;apos;/g;
  435. // Decode stuff which has been encoded/escaped out.
  436. // ORDER IS IMPORTANT - amp_re must be the last value to replace!
  437. text = text.replace(lt_re, "&lt;");
  438. text = text.replace(gt_re, "&gt;");
  439. text = text.replace(apos_re, "&apos;");
  440. text = text.replace(amp_re, "&amp;");
  441. return text;
  442. }
  443. function _THIS_ccModalCallBack(cmd,sResponse)
  444. {
  445. if(cmd == 'ok' &amp;&amp; sResponse)
  446. _THIS_reloadAfterSelectObject(sResponse);
  447. else{
  448. _THIS_modalDialog.hide();
  449. _THIS_modalDialog.destroy();
  450. _THIS_modalDialog = null;
  451. }
  452. }
  453. var _THIS_currentObjDiv = "";
  454. var _THIS_currentObjType ="";
  455. var _THIS_currentProperty ="";
  456. var _THIS_modalDialog = null;
  457. function _THIS_chooseObject(propName, updateDivId, objType) {
  458. var defaultPath = "/";
  459. if($("_THIS_navSelectId") !== undefined &amp;&amp; $("_THIS_navSelectId").value != ""){
  460. defaultPath = "storeID(\"" + $("_THIS_navSelectId").value + "\")";
  461. }
  462. var theAmp = "&amp;";
  463. var cForm = document._THIS_form;
  464. _THIS_currentObjDiv = updateDivId;
  465. _THIS_currentObjType = objType;
  466. _THIS_currentProperty = propName;
  467. if (objType =="folder" || objType == "package")
  468. objType += ".container";
  469. var url = "_THIS?frag-urlType=gateway&amp;b_action=xts.run/THIS_" + theAmp +
  470. "m=portal/select/select.xts" + theAmp +
  471. "so.defaultObject=" + defaultPath + theAmp + "so.defaultLocation=" + defaultPath + theAmp + "so.select=" + objType + theAmp +
  472. "md.callBack=xml" + theAmp + "md.displayOptions=h1" + theAmp +
  473. "backURL=javascript:parent.ui_modal_dialog.close()";
  474. var iframeStaticHeight = parseInt(xClientHeight() * .75);
  475. var iframeStaticWidth = parseInt(xClientWidth() * .75);
  476. if (_THIS_modalDialog == null)
  477. _THIS_modalDialog = new ui_dialog("modalDialogViewer", '<xts:string id="IDS_GEN_SELECTION_TITLE" encode="javascript"/>', ui_dialog.style.BTN_NOBUTTONS | ui_dialog.style.CENTER | ui_dialog.style.IFRAME, -1, -1, iframeStaticWidth, iframeStaticHeight, _THIS_.div, url);
  478. _THIS_modalDialog.show();
  479. ccModalCallBack = _THIS_ccModalCallBack;
  480. }
  481. function _THIS_openAdvancedPropEdit() {
  482. var theAmp = "&amp;";
  483. var navId = $("_THIS_targetId").value;
  484. var tmpChannel = $("_THIS_viewChannel").value;
  485. var fragDialog = new ui_dialog("advProps", '<xts:string id="IDS_PROP_ADVANCED_PROP_EDIT_TITLE" encode="javascript"/>', ui_dialog.style.BTN_OKCANCEL | ui_dialog.style.CENTER | ui_dialog.style.RESIZABLE, -1, -1, 600, 400, _THIS_.div);
  486. fragDialog.setContent("&lt;div id=" + _THIS_.id + "dialogPrefcontent&gt;&lt;/div&gt;");
  487. fragDialog.fragment = new fragment("/cm/" + navId, _THIS_.id + "dialogPref");
  488. fragDialog.fragment.modes = ["view", "edit"];
  489. fragDialog.show();
  490. fragDialog.fragment.mode = 'edit';
  491. fragDialog.fragment.retrieve('frag-view=dialog&amp;p_navSelectionId=' + navId + '&amp;tmp_channel=' + tmpChannel);
  492. fragDialog.fragment.ownerFragment = _THIS_;
  493. fragDialog.fragment.ownerDialog = fragDialog;
  494. fragDialog.data = _THIS_getCustomizations();
  495. _THIS_.dialog = fragDialog;
  496. }
  497. function _THIS_getCustomizations()
  498. {
  499. var customizationsHiddenElem = $("_THIS_dlgCustomizations");
  500. var propsObj = null;
  501. if ((customizationsHiddenElem)&amp;&amp;(customizationsHiddenElem.value != ''))
  502. {
  503. propsObj = _THIS_buildObjFromUrl(customizationsHiddenElem.value);
  504. }
  505. return propsObj;
  506. }
  507. function _THIS_saveCustomizations(url)
  508. {
  509. $("_THIS_dlgCustomizations").value = url;
  510. }
  511. function _THIS_clearCustomizations()
  512. {
  513. $("_THIS_dlgCustomizations").value = '';
  514. }
  515. function _THIS_buildObjFromUrl(url)
  516. {
  517. var propsObj = null;
  518. var paramsArray = url.split("&amp;");
  519. if (paramsArray.length &gt; 0)
  520. {
  521. propsObj = new Object();
  522. for (var i=0; i &lt; paramsArray.length; i++)
  523. {
  524. var equalPos = paramsArray[i].indexOf("=");
  525. if (equalPos &gt; 0){
  526. var key = paramsArray[i].substring(0,equalPos);
  527. var val = paramsArray[i].substring(equalPos + 1, paramsArray[i].length);
  528. var decodedVal = decodeURIComponent(val);
  529. propsObj[key] = decodedVal;
  530. }
  531. }
  532. }
  533. return propsObj;
  534. }
  535. function _THIS_handleDialogEvents(evt){
  536. switch(evt.name){
  537. case "cognos.viewer.plugin.preferences.save":
  538. _THIS_saveCustomizations(evt.payload);
  539. _THIS_.dialog.fragment.destroy();
  540. _THIS_.dialog.hide();
  541. _THIS_.dialog.destroy();
  542. break;
  543. case "cognos.viewer.plugin.preferences.close":
  544. _THIS_.dialog.fragment.destroy();
  545. _THIS_.dialog.destroy();
  546. break;
  547. }
  548. evt.stopPropagation();
  549. }
  550. _THIS_.addEventListener("cognos.viewer.plugin.preferences.*", "_THIS_handleDialogEvents", false);
  551. function _THIS_resetRadio(format)
  552. {
  553. if( format == "type")
  554. document._THIS_form._THIS_viewerTitleOptions[1].checked=true;
  555. else
  556. {
  557. document._THIS_form._THIS_viewerTitleOptions[0].checked=true;
  558. }
  559. }
  560. </layout:script>
  561. <layout:section format="header">
  562. <layout:text><xts:string id="IDS_PROP_EDIT_CVIEW_TITLE"/></layout:text>
  563. <layout:actionlist>
  564. <layout:action>
  565. <pui:aboutlink/>
  566. </layout:action>
  567. <layout:action>
  568. <pui:helplink/>
  569. </layout:action>
  570. </layout:actionlist>
  571. </layout:section>
  572. <layout:section>
  573. <layout:label>
  574. <layout:text><xts:string id="IDS_PROP_TITLE_CAPTION"/></layout:text>
  575. </layout:label>
  576. <layout:radio name="p_viewerTitleOptions" id="viewerTitleOptions">
  577. <xsl:if test="($titleOptions = 'entryName')">
  578. <xsl:attribute name="selected">true</xsl:attribute>
  579. </xsl:if>
  580. <layout:text><xts:string id="IDS_PROP_CVIEW_ENTRY_NAME_TEXT"/></layout:text>
  581. <layout:value>entryName</layout:value>
  582. </layout:radio>
  583. <layout:radio name="p_viewerTitleOptions" id="viewerTitleOptions">
  584. <xsl:if test="($titleOptions = 'customTitle') or ($titleOptions = '')">
  585. <xsl:attribute name="selected">true</xsl:attribute>
  586. </xsl:if>
  587. <layout:text><xts:string id="IDS_PROP_CVIEW_TITLE_NAME_TEXT"/></layout:text>
  588. <layout:value>customTitle</layout:value>
  589. <layout:rcsection>
  590. <layout:localeselectorcontrol name="selectLang">
  591. <layout:label>
  592. <layout:text><xts:string id="IDS_PROP_LANGUAGE_CAPTION"/></layout:text>
  593. </layout:label>
  594. <layout:controlparameters>
  595. <formname>_THIS_form</formname>
  596. <contentlocales><xsl:copy-of select="/root/input[@name='configurationResponse']/config/param[@name='contentLocales']/*"/></contentlocales>
  597. <customs><xsl:copy-of select="/root/customs/*"/></customs>
  598. <fieldlist>title</fieldlist>
  599. <preferences><xsl:copy-of select="/root/preferences/*"/></preferences>
  600. </layout:controlparameters>
  601. </layout:localeselectorcontrol>
  602. <layout:field id="title" size="40" name="p_title" type="text" maxlength="256" onblur="savelangitem('_THIS_','form','selectLang',this)" onkeydown="_THIS_resetRadio('type')" >
  603. <xsl:variable name="titleValue">
  604. <xsl:choose>
  605. <xsl:when test="/root/customs/param[@name='title']/value[@xml:lang=$useLocale]">
  606. <xsl:value-of select="/root/customs/param[@name='title']/value[@xml:lang=$useLocale]"/>
  607. </xsl:when>
  608. <xsl:when test="/root/customs/param[@name='title']/value[1]">
  609. <xsl:value-of select="/root/customs/param[@name='title']/value[1]"/>
  610. </xsl:when>
  611. <xsl:otherwise>
  612. <xsl:value-of select="/root/fragment/meta/customProperties[@name='title']/default/value"/>
  613. </xsl:otherwise>
  614. </xsl:choose>
  615. </xsl:variable>
  616. <xsl:attribute name="valerr:message" namespace="http://developer.cognos.com/validation/errrormessages/1/" ><xts:string id="IDS_GEN_TITLE_VALIDATION_ERROR" /></xsl:attribute>
  617. <xsl:if test="$isBidiEnabled = 'true'">
  618. <xsl:attribute name="dir">
  619. <xsl:value-of select="xtsext:getBTD(string($titleValue), $baseTextDirection, $productLocale)"/>
  620. </xsl:attribute>
  621. </xsl:if>
  622. <xsl:if test="$isBidiEnabled = 'true' and $baseTextDirection = 'auto'">
  623. <xsl:attribute name="onfocus">
  624. bidi.onfocus(this)
  625. </xsl:attribute>
  626. </xsl:if>
  627. <layout:label><layout:text><xts:string id="IDS_PROP_TITLE_CAPTION"/></layout:text></layout:label>
  628. <layout:value>
  629. <xsl:value-of select="$titleValue"/>
  630. </layout:value>
  631. </layout:field>
  632. </layout:rcsection>
  633. </layout:radio>
  634. </layout:section>
  635. <layout:section id="objectSelectionDiv">
  636. <xsl:call-template name="generateMarkupForObjectSelect"/>
  637. </layout:section>
  638. <layout:section format="division" divider="true">
  639. <layout:label>
  640. <layout:text><xts:string id="IDS_PROP_CVIEW_VIEW_OPTIONS"/></layout:text>
  641. </layout:label>
  642. <layout:section>
  643. <layout:field id="viewFragHeight" name="p_viewerFragmentHeight" type="text" maxlength="4">
  644. <layout:label>
  645. <layout:text><xts:string id="IDS_PROP_FRAGMENT_FRAGMENT_HEIGHT_CAPTION"/></layout:text>
  646. </layout:label>
  647. <layout:value><xsl:value-of select="$fragHeight"/></layout:value>
  648. </layout:field>
  649. </layout:section>
  650. </layout:section>
  651. <layout:section format="division" divider="true">
  652. <layout:label>
  653. <layout:text><xts:string id="IDS_PROP_CVIEW_ADVANCED_OPTIONS"/></layout:text>
  654. </layout:label>
  655. <layout:section>
  656. <layout:checkbox id="delayExecution" name="p_delayExecution" type="checkbox" selected="{/root/customs/param[@name='delayExecution']}">
  657. <layout:text><xts:string id="IDS_PROP_EDIT_DELAY_EXECUTION_CAPTION"/></layout:text>
  658. <layout:value>true</layout:value>
  659. </layout:checkbox>
  660. </layout:section>
  661. </layout:section>
  662. <layout:section format="footer" divider="true">
  663. <layout:row>
  664. <layout:button onclick="_THIS_submitEditForm('save'); return true;" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_submitEditForm('save'); return false;">
  665. <layout:value><xts:string id="IDS_PROP_OK_BUTTON_TEXT"/></layout:value>
  666. </layout:button>
  667. <layout:button onclick="_THIS_cancelEdit();" onkeypress="if (event.keyCode==9) return true; else if (event.keyCode==13 || event.keyCode==32 || event.charCode==32) _THIS_cancelEdit(); return false;">
  668. <layout:value><xts:string id="IDS_PROP_CANCEL_BUTTON_TEXT"/></layout:value>
  669. </layout:button>
  670. </layout:row>
  671. </layout:section>
  672. <!-- hidden inputs -->
  673. <xsl:variable name="reportParams">
  674. <xsl:choose>
  675. <xsl:when test="/root/state/param[@name='viewerReportParams'] != ''">
  676. <xsl:value-of select="/root/state/param[@name='viewerReportParams']"/>
  677. </xsl:when>
  678. <xsl:when test="/root/customs/param[@name='viewerReportParams'] != ''">
  679. <xsl:value-of select="/root/customs/param[@name='viewerReportParams']"/>
  680. </xsl:when>
  681. </xsl:choose>
  682. </xsl:variable>
  683. <xsl:variable name="displayParams">
  684. <xsl:choose>
  685. <xsl:when test="/root/state/param[@name='displayPromptParams'] != ''">
  686. <xsl:value-of select="/root/state/param[@name='displayPromptParams']"/>
  687. </xsl:when>
  688. <xsl:when test="/root/customs/param[@name='displayPromptParams'] != ''">
  689. <xsl:value-of select="/root/customs/param[@name='displayPromptParams']"/>
  690. </xsl:when>
  691. </xsl:choose>
  692. </xsl:variable>
  693. <xsl:variable name="dialogCustoms">
  694. <xsl:choose>
  695. <xsl:when test="/root/state/param[@name='dialogCustomizations'] != ''">
  696. <xsl:value-of select="/root/state/param[@name='dialogCustomizations']"/>
  697. </xsl:when>
  698. <xsl:when test="/root/customs/param[@name='dialogCustomizations'] != ''">
  699. <xsl:value-of select="/root/customs/param[@name='dialogCustomizations']"/>
  700. </xsl:when>
  701. </xsl:choose>
  702. </xsl:variable>
  703. <layout:hidden id="viewerReportParams" name="p_viewerReportParams" value="{$reportParams}"/>
  704. <layout:hidden id="displayPromptParams" name="p_displayPromptParams" value="{$displayParams}"/>
  705. <layout:hidden id="dlgCustomizations" name="p_dialogCustomizations" value="{$dialogCustoms}" />
  706. <layout:hidden id="formAction" name="formaction" value="init"/>
  707. </layout:form>
  708. </div>
  709. </xsl:template>
  710. </xsl:stylesheet>