new_printer.xts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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, 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. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" messageBase="messages/portal.xml, messages/portalRL.xml">
  13. <!--
  14. ===============================================================================================
  15. formlogic_init - standard form logic initialization
  16. ===============================================================================================
  17. -->
  18. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  19. <!--
  20. ===============================================================================================
  21. getContent
  22. ===============================================================================================
  23. -->
  24. <xts:block id="getContent" processor="XSLT" type="exec" dependency="formlogic_init">
  25. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  26. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  27. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  28. <xsl:template match="/">
  29. <xsl:variable name="path">
  30. <xsl:choose>
  31. <xsl:when test=" /root/env/param[@name='x_path'] ">
  32. <xsl:value-of select="/root/env/param[@name='x_path']"/>
  33. </xsl:when>
  34. <xsl:otherwise>
  35. <xsl:value-of select="'CAMID(&quot;:&quot;)'"/>
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:variable>
  39. <xts:sequence>
  40. <xts:append>
  41. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  42. <send:request provider="cm">
  43. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  44. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  45. <cm:search>
  46. <xsl:value-of select="$path"/>
  47. </cm:search>
  48. <cm:properties>
  49. <cm:property name="defaultName"/>
  50. <cm:property name="searchPath"/>
  51. <cm:property name="ancestors"/>
  52. </cm:properties>
  53. </cm:query>
  54. </xts:transform>
  55. </send:request>
  56. </xts:transform>
  57. </xts:append>
  58. </xts:sequence>
  59. </xsl:template>
  60. </xsl:stylesheet>
  61. </xts:block>
  62. <!--
  63. ===============================================================================================
  64. renderPage - render the page
  65. ===============================================================================================
  66. -->
  67. <xts:block id="render_page" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="formlogic_init getContent">
  68. <!-- get the presentation theme -->
  69. <xts:logicsheet path="logicsheets/portal.xsl"/>
  70. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  71. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  72. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  73. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  74. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  75. <!-- apply the form logic -->
  76. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  77. <xts:logicsheet path="logicsheets/validation.xslt"/> <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  78. <xsl:stylesheet version="1.0"
  79. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  80. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  81. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  82. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  83. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  84. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  85. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  86. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  87. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  88. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  89. exclude-result-prefixes="xsl cm pf df dp lyt utml cf cp xtsext">
  90. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  91. <!-- current file name -->
  92. <xsl:variable name="mname" select="'new_printer.xts'"/>
  93. <!-- add any theme variables -->
  94. <pf:variables/>
  95. <!-- start the output -->
  96. <xsl:template match="/root">
  97. <xsl:variable name="wizardTitle">
  98. <xts:string id="IDS_NEW_PRINTER_TITLE"/>
  99. </xsl:variable>
  100. <xsl:variable name="browserTitle">
  101. <xsl:text/>
  102. <xts:string id="IDS_NEW_TITLE_NAME_LOCATION">
  103. <xts:param name="wizardTitle">
  104. <xsl:value-of select="$wizardTitle"/>
  105. </xts:param>
  106. </xts:string>
  107. <xsl:text/>
  108. </xsl:variable>
  109. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  110. <dp:meta>
  111. <!-- Standard meta tags -->
  112. <pf:meta/>
  113. </dp:meta>
  114. <dp:script>
  115. <script language="javascript">
  116. function init()
  117. {
  118. if (document.pform.x_p_defaultName)
  119. document.pform.x_p_defaultName.focus();
  120. }
  121. function doCancelNew()
  122. {
  123. history.back();
  124. }
  125. function validateInputField(field, label)
  126. {
  127. field.value = trim(field.value);
  128. if (field.value == '')
  129. {
  130. <xsl:variable name="errmsg">
  131. <xts:string id="IDS_ERR_MANDATORY" encode="javascript">
  132. <xts:param name="field">" + label + "</xts:param>
  133. </xts:string>
  134. </xsl:variable>
  135. alert("<xsl:value-of select="normalize-space($errmsg)"/>");
  136. field.focus();
  137. return false;
  138. }
  139. return true;
  140. }
  141. function validate()
  142. {
  143. var f = document.pform;
  144. <!-- Validate the name -->
  145. <xsl:variable name="label_name">
  146. <xts:string id="IDS_NEW_NAME" encode="javascript"/>
  147. </xsl:variable>
  148. if ( !validateInputField(f.x_p_defaultName, "<xsl:value-of select="normalize-space($label_name)"/>") )
  149. return false;
  150. <!-- Validate the printer address -->
  151. <xsl:variable name="label_address">
  152. <xts:string id="IDS_PROP_PRINTER_ADDRESS" encode="javascript"/>
  153. </xsl:variable>
  154. if ( !validateInputField(f.x_p_printerAddress, "<xsl:value-of select="normalize-space($label_address)"/>") )
  155. return false;
  156. if (!f.x_p_printerAddress.value.match('^(\s+)?[^&amp;;$*?`^{}|"&lt;>]{1,512}(\s+)?$')) {
  157. alert('<xts:string id="IDS_ERR_NETWORKADDRESS_RESERVED_CHARS" encode="javascript"/>');
  158. return false;
  159. }
  160. return true;
  161. }
  162. </script>
  163. <script language="javascript" src="{$webcontent}/{$app}/js/utilities.js"/>
  164. <!-- Help system -->
  165. <pf:help context="HID_DISTRIB_PRINT"/>
  166. </dp:script>
  167. <utml:form name="pform" method="post" action="{$gateway}">
  168. <utml:input type="hidden" name="ifrmcmd" value="create" utml:update="false"/>
  169. <utml:input type="hidden" name="x_new_class" value="printer" utml:update="false"/>
  170. <utml:input type="hidden" name="x_return" utml:update="false">
  171. <utml:value>
  172. <xsl:value-of select="key('env-param','x_return')"/>
  173. </utml:value>
  174. </utml:input>
  175. <!-- Following type used by faultHandler when cannot create folder. Performs faultHandler's doCancel function. -->
  176. <utml:input type="hidden" name="errURL" utml:update="false">
  177. <utml:value>
  178. <xsl:value-of select="'javascript:doCancel();'"/>
  179. </utml:value>
  180. </utml:input>
  181. <utml:input type="hidden" name="m_return" utml:update="false">
  182. <utml:value>
  183. <xsl:if test="key('env-param', 'm_return')">
  184. <xsl:value-of select="key('env-param', 'm_return')"/>
  185. </xsl:if>
  186. </utml:value>
  187. </utml:input>
  188. <utml:input type="hidden" name="x_path" utml:update="false">
  189. <utml:value>
  190. <xsl:value-of select="key('env-param', 'x_path')"/>
  191. </utml:value>
  192. </utml:input>
  193. <!-- ================================================================ -->
  194. <!-- H E A D E R -->
  195. <!-- ================================================================ -->
  196. <dp:header>
  197. <dp:title>
  198. <xsl:value-of select="$browserTitle"/>
  199. </dp:title>
  200. <dp:description>
  201. <xts:string id="IDS_NEW_PRINTER_INTRO"/>
  202. </dp:description>
  203. <dp:close>
  204. <a href="javascript:doCancelNew()">
  205. <dp:closeMarker/>
  206. </a>
  207. </dp:close>
  208. </dp:header>
  209. <!-- ================================================================ -->
  210. <!-- B O D Y -->
  211. <!-- ================================================================ -->
  212. <lyt:layout style="1">
  213. <lyt:section>
  214. <dp:input>
  215. <dp:section1>
  216. <xts:string id="IDS_NEW_NAME"/>
  217. </dp:section1>
  218. <dp:section2>
  219. <utml:input type="text" class="pInput" size="30" name="x_p_defaultName" value="" maxlength="256"/>
  220. </dp:section2>
  221. </dp:input>
  222. <dp:input>
  223. <dp:section1>
  224. <xts:string id="IDS_NEW_DESCRIPTION"/>
  225. </dp:section1>
  226. <dp:section2>
  227. <utml:textarea rows="4" cols="30" class="pTextarea" name="x_p_defaultDescription"/>
  228. </dp:section2>
  229. </dp:input>
  230. <!-- ScreenTip -->
  231. <dp:input>
  232. <dp:section1>
  233. <xts:string id="IDS_NEW_SCREENTIP"/>
  234. </dp:section1>
  235. <dp:section2>
  236. <utml:input type="text" name="x_p_defaultScreenTip" class="pInput" maxlength="100" size="30"/>
  237. </dp:section2>
  238. </dp:input>
  239. <dp:input>
  240. <dp:section1>
  241. <xts:string id="IDS_PROP_PRINTER_ADDRESS"/>
  242. </dp:section1>
  243. <dp:section2>
  244. <utml:input type="text" name="x_p_printerAddress" size="30" class="pInput"/>
  245. </dp:section2>
  246. </dp:input>
  247. </lyt:section>
  248. </lyt:layout>
  249. <lyt:layout style="1">
  250. <lyt:section>
  251. <dp:input>
  252. <dp:section1>
  253. <xts:string id="IDS_NEW_DESTINATION"/>
  254. </dp:section1>
  255. </dp:input>
  256. <dp:list>
  257. <dp:section>
  258. <dp:text wrap="wrap">
  259. <cf:do-the-path-link>
  260. <cf:param name="familytree">/root/cm:queryResponse/*/cm:ancestors</cf:param>
  261. <cf:param name="familymember">/root/cm:queryResponse/*/cm:defaultName</cf:param>
  262. </cf:do-the-path-link>
  263. </dp:text>
  264. </dp:section>
  265. </dp:list>
  266. </lyt:section>
  267. </lyt:layout>
  268. <!-- ================================================================ -->
  269. <!-- F O O T E R -->
  270. <!-- ================================================================ -->
  271. <dp:footer>
  272. <df:button df:id="IDS_CANCEL" df:style="href" df:href="javascript:doCancelNew()"/>
  273. <df:button df:id="IDS_BACK"/>
  274. <df:button df:id="IDS_NEXT"/>
  275. <df:button df:id="IDS_FINISH" utml:validate="true" df:style="submit" df:nav_op="maintain"/>
  276. </dp:footer>
  277. </utml:form>
  278. </dp:page>
  279. </xsl:template>
  280. </xsl:stylesheet>
  281. </xts:block>
  282. <!--
  283. ===============================================================================================
  284. debug - display debug information
  285. ===============================================================================================
  286. -->
  287. <xts:block id="debug" dependency="render_page" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  288. <!-- get the debug logic sheet -->
  289. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  290. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
  291. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  292. <xsl:template match="/">
  293. <dbg:dumpxml select="/root"/>
  294. </xsl:template>
  295. </xsl:stylesheet>
  296. </xts:block>
  297. </xts:morphlet>