properties_printer.xts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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, 2013
  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" requiredCapability="canUseAdministrationPortal">
  13. <!--
  14. ===============================================================================================
  15. formlogic_init
  16. Standard form logic initialization
  17. ===============================================================================================
  18. -->
  19. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  20. <!-- Load object-specific property tabs map ============================================================== -->
  21. <xts:block id="getTabs" type="exec" mode="interpret" processor="XML" path="/portal/uiobjects_tabs.xml"/>
  22. <!--
  23. ================================================================================
  24. get_content
  25. Retrieve the printer details from Content Manager.
  26. ================================================================================
  27. -->
  28. <xts:block id="get_content" processor="XSLT" type="exec" mode="interpret">
  29. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  30. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  31. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  32. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  33. <xsl:template match="/">
  34. <xts:sequence>
  35. <xts:append>
  36. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  37. <send:request provider="cm">
  38. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  39. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  40. <search>
  41. <xsl:value-of select="key('env-param','m_obj')"/>
  42. <xsl:text>[permission('read')]</xsl:text>
  43. </search>
  44. <properties>
  45. <cm:property name="location"/>
  46. <cm:property name="modelName"/>
  47. <cm:property name="printerAddress"/>
  48. <cm:property name="permissions"/>
  49. </properties>
  50. </query>
  51. </xts:transform>
  52. </send:request>
  53. </xts:transform>
  54. </xts:append>
  55. </xts:sequence>
  56. </xsl:template>
  57. </xsl:stylesheet>
  58. </xts:block>
  59. <!--
  60. ================================================================================
  61. render_page
  62. Render the HTML page.
  63. ================================================================================
  64. -->
  65. <xts:block id="render_page" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="get_content formlogic_init getTabs">
  66. <!-- portal specific information -->
  67. <xts:logicsheet path="logicsheets/portal.xsl"/>
  68. <!-- get the presentation theme -->
  69. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  70. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  71. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  72. <xts:logicsheet path="logicsheets/presentation/dialog/confirm.xslt"/>
  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:pf="http://developer.cognos.com/schemas/xts/pf"
  82. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  83. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  84. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  85. xmlns:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/"
  86. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  87. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  88. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  89. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl cm pf df dp dc lyt utml cp cf 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="'properties_printer.xts'"/>
  93. <!-- add any theme variables -->
  94. <pf:variables/>
  95. <xsl:variable name="object" select="/root/cm:queryResponse/*"/>
  96. <!-- start the output -->
  97. <xsl:template match="/root">
  98. <!-- get passed in parameters -->
  99. <xsl:variable name="canWrite" select="contains(concat(' ',$object/cm:permissions,' '),' write ')"/>
  100. <xsl:variable name="canSetPolicy" select="contains(concat(' ', $object/cm:permissions, ' '), ' setPolicy ')"/>
  101. <xsl:variable name="showOKCancel" select="$canWrite or $canSetPolicy"/>
  102. <xsl:variable name="browserTitle">
  103. <xts:string id="IDS_PROPERTIES_TITLE">
  104. <xts:param name="objectName">
  105. <span lang="{$contentLocale}"><xsl:value-of select="/root/env/param[@name='m_name']"/></span>
  106. </xts:param>
  107. </xts:string>
  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. <!-- Help system -->
  116. <pf:help context="HID_DISTRIB_PRINT"/>
  117. <xsl:if test="$canWrite">
  118. <script language="javascript">
  119. <xsl:variable name="label_printerAddress">
  120. <xts:string id="IDS_PRINTER_ADDRESS" encode="javascript"/>
  121. </xsl:variable>
  122. <xsl:variable name="errmsg">
  123. <xts:string id="IDS_ERR_MANDATORY" encode="javascript">
  124. <xts:param name="field">' + label + '</xts:param>
  125. </xts:string>
  126. </xsl:variable>
  127. function validateInputField(field, label)
  128. {
  129. field.value = trim(field.value);
  130. if (field.value == '')
  131. {
  132. alert('<xsl:value-of select="normalize-space($errmsg)"/>');
  133. field.focus();
  134. return false;
  135. }
  136. return true;
  137. }
  138. function validate()
  139. {
  140. var f = document.pform;
  141. <!-- Validate the printer address -->
  142. if ( !validateInputField(f.m_p_printerAddress, "<xsl:value-of select="normalize-space($label_printerAddress)"/>") )
  143. return false;
  144. return true;
  145. }
  146. </script>
  147. <dc:confirm-cancel/>
  148. <script language="javascript" src="{$webcontent}/{$app}/js/utilities.js"/>
  149. </xsl:if>
  150. </dp:script>
  151. <utml:form name="pform" method="post" action="{$gateway}">
  152. <utml:read-only>
  153. <xsl:choose>
  154. <xsl:when test="$canWrite">false</xsl:when>
  155. <xsl:otherwise>true</xsl:otherwise>
  156. </xsl:choose>
  157. </utml:read-only>
  158. <!--
  159. this defines the form command operation to be performed when all the collected properties are submitted.
  160. -->
  161. <utml:input type="hidden" name="ifrmcmd" value="save" utml:update="false"/>
  162. <!-- dialog header -->
  163. <dp:header useBackURL="not($showOKCancel)">
  164. <!-- header titles-->
  165. <dp:title>
  166. <xsl:copy-of select="$browserTitle"/>
  167. </dp:title>
  168. </dp:header>
  169. <!-- property tabs -->
  170. <df:propertiesTabs select="printer">
  171. <df:hasSetPolicy>
  172. <xsl:value-of select="$canSetPolicy"/>
  173. </df:hasSetPolicy>
  174. </df:propertiesTabs>
  175. <!-- description tabs -->
  176. <dp:description>
  177. <xts:string id="IDS_PROP_PRINTER_INTRO"/>
  178. </dp:description>
  179. <lyt:layout style="1">
  180. <lyt:section>
  181. <dp:input>
  182. <dp:section1 id="label_m_p_printerAddress">
  183. <xts:string id="IDS_PROP_PRINTER_ADDRESS"/>
  184. </dp:section1>
  185. <dp:section2>
  186. <utml:input type="text" name="m_p_printerAddress" class="pInput" size="30" aria-labelledby="label_m_p_printerAddress">
  187. <utml:value>
  188. <xsl:value-of select="/root/cm:queryResponse/child::node()/cm:printerAddress"/>
  189. </utml:value>
  190. </utml:input>
  191. </dp:section2>
  192. </dp:input>
  193. <dp:input>
  194. <dp:section1 id="label_m_p_modelName">
  195. <xts:string id="IDS_PROP_PRINTER_MODEL"/>
  196. </dp:section1>
  197. <dp:section2>
  198. <utml:input type="text" name="m_p_modelName" class="pInput" size="30" aria-labelledby="label_m_p_modelName">
  199. <utml:value>
  200. <xsl:value-of select="/root/cm:queryResponse/child::node()/cm:modelName"/>
  201. </utml:value>
  202. </utml:input>
  203. </dp:section2>
  204. </dp:input>
  205. <dp:input>
  206. <dp:section1 id="label_m_p_location">
  207. <xts:string id="IDS_PROP_PRINTER_LOCATION"/>
  208. </dp:section1>
  209. <dp:section2>
  210. <utml:input type="text" name="m_p_location" class="pInput" size="30" aria-labelledby="label_m_p_location">
  211. <utml:value>
  212. <xsl:value-of select="/root/cm:queryResponse/child::node()/cm:location"/>
  213. </utml:value>
  214. </utml:input>
  215. </dp:section2>
  216. </dp:input>
  217. </lyt:section>
  218. </lyt:layout>
  219. <dp:footer>
  220. <xsl:choose>
  221. <xsl:when test="$showOKCancel">
  222. <df:button df:id="IDS_OK" utml:validate="true" df:style="submit"/>
  223. <xsl:choose>
  224. <xsl:when test="key('env-param', 'ps_nav_stack') and not(key('env-param', 'ps_nav_stack') = '') ">
  225. <df:button df:id="IDS_CANCEL" df:style="stack-down" onclick="{$dc-confirm-cancel}"/>
  226. </xsl:when>
  227. <xsl:otherwise>
  228. <df:button df:id="IDS_CANCEL" df:style="back-url" onclick="{$dc-confirm-cancel}"/>
  229. </xsl:otherwise>
  230. </xsl:choose>
  231. </xsl:when>
  232. <xsl:otherwise>
  233. <df:button df:id="IDS_CLOSE" df:style="back-url"/>
  234. </xsl:otherwise>
  235. </xsl:choose>
  236. </dp:footer>
  237. </utml:form>
  238. </dp:page>
  239. </xsl:template>
  240. </xsl:stylesheet>
  241. </xts:block>
  242. <!--
  243. ===============================================================================================
  244. debug - display debug information
  245. ===============================================================================================
  246. -->
  247. <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">
  248. <!-- get the debug logic sheet -->
  249. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  250. <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">
  251. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  252. <xsl:template match="/">
  253. <dbg:dumpxml select="/root"/>
  254. </xsl:template>
  255. </xsl:stylesheet>
  256. </xts:block>
  257. </xts:morphlet>