123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- ##############################################################################
- # Copyright (C) 2011 HPCC Systems.
- #
- # All rights reserved. This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- ##############################################################################
- -->
- <!DOCTYPE xsl:stylesheet [
- <!--define the HTML non-breaking space:-->
- <!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text>">
- ]>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" encoding="utf-8"/>
-
- <xsl:variable name="debugMode" select="0"/>
- <xsl:variable name="filePath">
- <xsl:choose>
- <xsl:when test="$debugMode">c:/development/bin/debug/files</xsl:when>
- <xsl:otherwise>/esp/files_</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="Component" select="/*[1]/Component/text()"/>
- <xsl:variable name="Command" select="/*[1]/Command/text()"/>
- <!--path for componentns.xml must be relative file path oblivious to esp-->
- <xsl:variable name="ComponentsDoc" select="document('../files/components.xml')"/>
- <xsl:variable name="componentNode" select="$ComponentsDoc/Components/*[name()=$Component]"/>
- <xsl:variable name="commandNode" select="$componentNode/Commands/*[name()=$Command]"/>
- <xsl:variable name="apos">'</xsl:variable>
- <xsl:include href="./ui_overrides.xslt"/>
- <xsl:variable name="argsNodeName">
- <xsl:choose>
- <xsl:when test="$commandNode/@argsNode">
- <xsl:value-of select="string($commandNode/@argsNode)"/>
- </xsl:when>
- <xsl:otherwise>Arguments</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="schemaRootNode" select="$commandNode[$argsNodeName='.'] | $commandNode/*[$argsNodeName!='.' and name()=$argsNodeName]"/>
- <xsl:variable name="objRootNode" select="/NavMenuEventResponse/XmlArgument | /*[name() != 'NavMenuEventResponse']"/>
- <xsl:template match="/">
- <xsl:if test="not($ComponentsDoc)">
- <xsl:message terminate="yes">Failed to load file components.xml.</xsl:message>
- </xsl:if>
- <html>
- <head>
- <title>
- <xsl:value-of select="$Command"/>
- </title>
- <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/fonts/fonts-min.css" />
- <link rel="stylesheet" type="text/css" href="/esp/files/css/espdefault.css" />
- <link type="text/css" rel="StyleSheet"
- href="{$filePath}/css/sortabletable.css"/>
- <link type="text/css" rel="StyleSheet" href="{$filePath}/css/tabs.css"/>
- <style type="text/css" media="screen">
- @import url( <xsl:value-of select="$filePath"/>/css/headerFooter.css );
- </style>
- <script type="text/javascript" src="/esp/files/scripts/espdefault.js"> </script>
- <!--style type="text/css"> - not used any more but save for later
- .row-table table {
- table-layout:fixed;
- font: 10pt arial, helvetica, sans-serif;
- border-collapse:collapse;
- padding:0;
- spacing:0;
- margin:0;
- }
- .row-table td {
- padding:0;
- spacing:0;
- margin:0;
- //border:1px solid gray;
- border-collapse:collapse;
- border:0;
- }
- .row-table tr {
- padding:0;
- spacing:0;
- margin:0;
- //border:0;
- //border-collapse:collapse;
- }
- </style-->
- <script type="text/javascript" src="{$filePath}/scripts/CMultiSelect.js">
- </script>
- <script type="text/javascript" src="{$filePath}/scripts/tooltip.js">
- </script>
- <script type="text/javascript" src="{$filePath}/popup.js">
- </script>
- <script type="text/javascript" src="{$filePath}/scripts/ui_engine.js">
- </script>
- <script type="text/javascript">
- <xsl:attribute name="src">
- <xsl:value-of select="concat($filePath, '/scripts/')"/>
- <xsl:choose>
- <xsl:when test="not($commandNode/@nosort='true')">
- <xsl:text>sortabletable.js</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>fixedTables.js</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </script>
- </head>
- <body class="yui-skin-sam" onload="nof5();loadCommandInfo()" onmousemove="overhere()" bgcolor="white">
- <xsl:copy-of select="$commandNode/script"/>
- <xsl:if test="string($commandNode/@selectedTab)">
- <xsl:apply-templates select="$componentNode/TabContainer">
- <xsl:with-param name="selectedTab" select="$commandNode/@selectedTab"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:if test="string($commandNode/@schemaIsland)!='false'">
- <xsl:call-template name="makeSchemaDataIsland"/>
- </xsl:if>
- <xsl:if test="not($commandNode/@objIsland='')">
- <xsl:call-template name="makeArgsDataIsland">
- <xsl:with-param name="elementName" select="string($commandNode/@objIsland)"/>
- </xsl:call-template>
- </xsl:if>
- <form method="post" onsubmit="return onSubmit()">
- <xsl:copy-of select="$schemaRootNode/@enctype"/>
- <xsl:attribute name="action">
- <xsl:choose>
- <xsl:when test="$commandNode/@action">
- <xsl:value-of select="$commandNode/@action"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('/', $Component, '/', $Command)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <div id="pageBody">
- <div id="ToolTip" style="position:absolute;left:0;top:0;visibility:hidden"/>
- <xsl:apply-templates select="$componentNode">
- <xsl:with-param name="ObjNode" select="$objRootNode"/>
- </xsl:apply-templates>
- </div>
- <xsl:for-each select="$commandNode/Buttons[1]">
- <div id="pageFooter">
- <xsl:call-template name="createButtons">
- <xsl:with-param name="btnsNode" select="."/>
- </xsl:call-template>
- </div>
- </xsl:for-each>
- </form>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="TabContainer">
- <xsl:param name="selectedTab"/>
- <div id="pageHeader">
- <div id="tabContainer" width="100%">
- <ul id="tabNavigator">
- <xsl:for-each select="Tab">
- <li>
- <a href="{@url}">
- <xsl:if test="@name=$selectedTab">
- <xsl:attribute name="class">active</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="@name"/>
- </a>
- </li>
- </xsl:for-each>
- </ul>
- </div>
- </div>
- </xsl:template>
- <xsl:template name="makeSchemaDataIsland">
- <xml id="xmlSchema" style="display:none;">
- <xsl:element name="Components">
- <xsl:element name="{$Component}">
- <xsl:apply-templates select="$componentNode/Defaults" mode="copy"/>
- <xsl:element name="Commands">
- <xsl:for-each select="$commandNode">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:choose>
- <xsl:when test="$argsNodeName='.'">
- <xsl:copy-of select="*[name()!='Component' and name() != 'Command' and name()!='script']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[name()!='script' and name()!='Buttons']" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:copy>
- </xsl:for-each>
- </xsl:element>
- </xsl:element>
- </xsl:element>
- </xml>
- <input type="hidden" name="xmlArgs" value=""/>
- </xsl:template>
- <xsl:template name="makeArgsDataIsland">
- <xsl:param name="elementName"/>
- <div style="display:none;">
- <xml id="xmlPrevArgsDoc" >
- <PrevArgsDoc>
- <xsl:for-each select="$objRootNode">
- <xsl:variable name="inputFragment" select="*[$argsNodeName!='.' and name() = $argsNodeName][1]"/>
- <xsl:choose>
- <xsl:when test="$elementName!=''">
- <xsl:copy-of select="*[name()=$elementName]"/>
- </xsl:when>
- <xsl:when test="$inputFragment">
- <xsl:copy-of select="$inputFragment"/>
- </xsl:when>
- <xsl:when test="$argsNodeName='.'">
- <xsl:element name="{$Command}">
- <xsl:copy-of select="@*|*[name() != 'Component' and name() != 'Command']"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="{$argsNodeName}"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </PrevArgsDoc>
- </xml>
- </div>
- </xsl:template>
- <xsl:template match="Components/*">
- <xsl:param name="ObjNode"/>
- <xsl:if test="not($commandNode)">
- <xsl:message terminate="yes">Command '<xsl:value-of select="$Command"/>' is not defined in components.xml file!"/></xsl:message>
- </xsl:if>
-
- <input type="hidden" id="component" name="comp" value="{$Component}"/>
- <input type="hidden" id="command" name="command" value="{$Command}"/>
-
- <br/>
- <!--define a table that is dynamically filled up using DOM / DHTML using javascript -->
- <xsl:if test="$commandNode/@caption">
- <h3 id="pageCaption">
- <xsl:value-of select="$commandNode/@caption"/>
- </h3>
- </xsl:if>
- <xsl:if test="string($commandNode/@subcaption)!=''">
- <h4 id="pageSubCaption">
- <xsl:value-of select="$commandNode/@subcaption"/>
- </h4>
- </xsl:if>
- <xsl:for-each select="$commandNode">
- <xsl:if test="$schemaRootNode/@maxOccurs='unbounded'">
- <xsl:call-template name="createColumnHeaders">
- <xsl:with-param name="tableId" select="'ArgsTable'"/>
- <xsl:with-param name="rowId" select="'ArgsTable.header'"/>
- <xsl:with-param name="targetNode" select="$objRootNode"/>
- <xsl:with-param name="schemaNode" select="$schemaRootNode"/>
- <xsl:with-param name="xpath" select="''"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:call-template name="populateTable">
- <xsl:with-param name="tableId" select="'ArgsTable'"/>
- <xsl:with-param name="schemaNode" select="$schemaRootNode"/>
- <xsl:with-param name="targetNode" select="$objRootNode"/>
- <xsl:with-param name="xPath" select="''"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:template>
- <xsl:template name="populateTable">
- <xsl:param name="tableId"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="xpath"/>
- <xsl:variable name="columnCount">
- <xsl:call-template name="countColumns">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!--display "- none -" if $targetNode is empty-->
- <xsl:variable name="name" select="name($schemaNode)"/>
- <xsl:choose>
- <xsl:when test="not($targetNode/*[name()=$name][1]) and $schemaNode/@maxOccurs='unbounded'">
- <tr>
- <td colspan="{$columnCount}">- none -</td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="addTableRows">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="columnCount" select="$columnCount"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="makeNextXPath">
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:if test="string($xpath)!=''">
- <xsl:value-of select="$xpath"/>
- </xsl:if>
- <xsl:if test="not($schemaNode/@nodeName='')"><!--if not(exists and is '')-->
- <xsl:if test="string($xpath)!=''">
- <xsl:text>.</xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="$schemaNode/@nodeName">
- <xsl:value-of select="$schemaNode/@nodeName"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="name($schemaNode)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
- <xsl:template name="createColumnHeaders">
- <xsl:param name="tableId"/>
- <xsl:param name="rowId"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:param name="nChildElements"/>
- <xsl:variable name="xpath2">
- <xsl:if test="name($schemaNode[1])!=name($schemaRootNode[1])">
- <xsl:call-template name="makeNextXPath">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:variable name="maxOccurs" select="$schemaNode/@maxOccurs"/>
- <xsl:if test="$maxOccurs">
- <xsl:variable name="numCheckColumn">
- <xsl:choose>
- <xsl:when test="string($maxOccurs)='unbounded' and string($schemaNode/@checkboxes)!='false'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:if test="$numCheckColumn=1">
- <th width="35">
- <xsl:choose>
- <xsl:when test="string($schemaNode/@multiselect)='true'">
- <xsl:attribute name="id">
- <xsl:value-of select="concat($tableId, '_ms0_T')"/>
- </xsl:attribute>
- <input type="checkbox" value="1" title="Select or unselect all items">
- <xsl:if test="$schemaNode/@checked">
- <xsl:attribute name="checked">true</xsl:attribute>
- </xsl:if>
- <xsl:attribute name="onclick">
- <xsl:value-of select="concat('ms_setAll(this, ', $apos, $tableId, $apos, ',0)')"/>
- </xsl:attribute>
- <xsl:if test="not($targetNode/*[name()=name($schemaNode)][2])">
- <xsl:attribute name="disabled">true</xsl:attribute>
- </xsl:if>
- </input>
- </xsl:when>
- <xsl:otherwise> </xsl:otherwise>
- </xsl:choose>
- <script type="text/javascript">
- var ms = ms_create('<xsl:value-of select="$tableId"/>', onRowCheck );
- <xsl:if test="string($schemaNode/@multiselect)!='true'">
- ms.b_singleSelect = true;
- </xsl:if>
- </script>
- </th>
- </xsl:if>
-
-
- <xsl:if test="string($maxOccurs)='unbounded' or string($xpath)!=''">
- <xsl:variable name="childObjNode" select="$targetNode/*[name()=name($schemaNode)][1]"/>
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script']">
- <xsl:variable name="name" select="name()"/>
- <!--any of our siblings which is either a visible attribute or a node with the same holds a column so count them-->
- <xsl:choose>
- <xsl:when test="string(@maxOccurs)='1'">
- <xsl:choose>
- <xsl:when test="@table">
- <xsl:if test="@caption and not($argsNodeName='.' and name()=name($schemaRootNode))">
- <th>
- <xsl:copy-of select="@width"/>
- <xsl:value-of select="@caption"/>
- </th>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="createColumnHeaders">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$childObjNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$xpath2"/>
- <xsl:with-param name="nChildElements" select="$nChildElements"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="not(@maxOccurs)"><!--attribute definition-->
- <xsl:variable name="viewType" select="@viewType"/>
- <xsl:if test="string($viewType)!='hidden'">
- <xsl:variable name="caption">
- <xsl:choose>
- <xsl:when test="@caption">
- <xsl:value-of select="@caption"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <th>
- <xsl:copy-of select="@width"/>
- <xsl:variable name="nodeName" select="name()"/>
- <xsl:variable name="dataNode" select="$childObjNode/*[name()=$nodeName][1]"/>
- <xsl:variable name="nRows" select="count($childObjNode/*[name()=current()/@name])"/>
- <xsl:variable name="popupPrefix" select="concat('return showColumnPopup(', $apos, $tableId, $apos, ', this.cellIndex')"/>
- <xsl:choose>
- <xsl:when test="($nRows=0 or $nRows>1) and string(@multiselect)='true'">
- <xsl:variable name="msId" select="concat($tableId, '_ms', string(@column), '_T')"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$msId"/>
- </xsl:attribute>
- <xsl:attribute name="oncontextmenu">
- <xsl:value-of select="concat($popupPrefix, ', toggleMultiSelect)')"/>
- </xsl:attribute>
- <xsl:value-of select="$caption"/>
- <xsl:call-template name="createInputControlForNode">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="idPrefix" select="$xpath"/>
- <xsl:with-param name="node" select="$dataNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="dataType" select="@dataType"/>
- <xsl:with-param name="viewType" select="@viewType"/>
- <xsl:with-param name="multiselect" select="1"/>
- <xsl:with-param name="columnHeader" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="oncontextmenu"><xsl:value-of select="$popupPrefix"/>)</xsl:attribute>
- <xsl:value-of select="$caption"/>
- </xsl:otherwise>
- </xsl:choose>
- </th>
- </xsl:if>
- </xsl:when><!--attribute definition-->
- </xsl:choose>
- </xsl:for-each>
- </xsl:if>
- </xsl:if><!--maxOccurs is defined-->
- </xsl:template>
- <xsl:template name="tallyColumns">
- <xsl:param name="schemaNode"/>
- <xsl:choose>
- <xsl:when test="not($schemaNode/@maxOccurs)">
- <xsl:if test="string($schemaNode/@viewType)!='hidden'">1</xsl:if>
- </xsl:when>
- <xsl:when test="string($schemaNode/@maxOccurs)='1'">
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script']">
- <xsl:call-template name="tallyColumns">
- <xsl:with-param name="schemaNode" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise><!--maxOccurs='unbounded'-->
- <xsl:if test="string($schemaNode/@checkboxes)!='false'">1</xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="countColumns">
- <xsl:param name="schemaNode"/>
- <xsl:variable name="columnTally">
- <xsl:if test="string($schemaNode/@maxOccurs)='unbounded' and string($schemaNode/@checkboxes)!='false'">
- <xsl:text>1</xsl:text>
- </xsl:if>
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script' and not(@break)]">
- <xsl:call-template name="tallyColumns">
- <xsl:with-param name="schemaNode" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$columnTally=''">1</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="string-length($columnTally)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="createButtons">
- <xsl:param name="btnsNode"/>
- <center>
- <xsl:for-each select="$btnsNode/*">
- <xsl:if test="position()!=1"> </xsl:if>
- <xsl:copy>
- <xsl:copy-of select="@*[name()!='override']"/>
- <xsl:if test="@override">
- <xsl:apply-templates select="." mode="override"/>
- </xsl:if>
- <xsl:apply-templates select="*|text()" mode="copy"/>
- </xsl:copy>
- </xsl:for-each>
- </center>
- </xsl:template>
- <xsl:template name="createFixedTableWithHeader">
- <xsl:param name="schemaNode"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="tableId"/>
- <xsl:param name="xpath"/>
- <xsl:param name="width"/>
- <xsl:choose>
- <xsl:when test="not($schemaNode/@splitTable='false')">
- <xsl:if test="$schemaNode/@maxOccurs='unbounded' or $xpath!=''">
- <div class="TableHeaderDiv" id="DH.{$tableId}">
- <script type="text/javascript">
- a_fixedTableNames.push('<xsl:value-of select="$tableId"/>');
- </script>
- <table id="H.{$tableId}">
- <xsl:if test="$width and string($width)!='100%'">
- <xsl:attribute name="style">table-layout:fixed</xsl:attribute>
- <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
- </xsl:if>
- <thead>
- <tr>
- <xsl:call-template name="createColumnHeaders">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="concat($tableId, '.header')"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </tr>
- </thead>
- </table>
- </div>
- </xsl:if>
- <div class="TableBodyDiv" id="DB.{$tableId}">
- <table id="{$tableId}">
- <xsl:if test="$width and string($width)!='100%'">
- <xsl:attribute name="style">table-layout:fixed</xsl:attribute>
- <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
- </xsl:if>
- <tbody>
- <xsl:call-template name="populateTable">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </tbody>
- </table>
- </div>
- </xsl:when>
- <xsl:otherwise>
- <table id="{$tableId}" class="sort-table">
- <xsl:if test="$width and string($width)!='100%'">
- <xsl:attribute name="style">table-layout:fixed</xsl:attribute>
- <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
- </xsl:if>
- <thead>
- <xsl:if test="$schemaNode/@maxOccurs='unbounded' or $xpath!=''">
- <tr style="background:lightgrey">
- <xsl:call-template name="createColumnHeaders">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="concat($tableId, '.header')"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </tr>
- </xsl:if>
- </thead>
- <tbody>
- <xsl:call-template name="populateTable">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </tbody>
- </table>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="createFixedTable">
- <xsl:param name="schemaNode"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="id"/>
- <xsl:param name="tableId"/>
- <xsl:param name="xpath"/>
- <xsl:param name="columnCount"/>
- <xsl:if test="not($schemaNode/@splitTable='false')">
- <xsl:text disable-output-escaping="yes"><div class="TableBodyDiv" id="DB.</xsl:text>
- <xsl:value-of select="$id"/>
- <xsl:text disable-output-escaping="yes">"></xsl:text>
- <script type="text/javascript">
- a_fixedTableNames.push('<xsl:value-of select="$id"/>');
- </script>
- </xsl:if>
- <table id="{$id}">
- <xsl:copy-of select="$schemaNode/@width|$schemaNode/@style"/>
- <tbody>
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script']">
- <xsl:call-template name="addTableRows">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="columnCount" select="$columnCount"/>
- </xsl:call-template>
- </xsl:for-each>
- </tbody>
- </table>
- <xsl:if test="not($schemaNode/@splitTable='false')">
- <xsl:text disable-output-escaping="yes"></div></xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template name="addTableRows">
- <xsl:param name="tableId"/>
- <xsl:param name="objNode"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:param name="columnCount"/>
- <xsl:param name="showTableCaption" select="1"/>
- <xsl:variable name="name" select="name($schemaNode)"/>
- <xsl:variable name="maxOccurs" select="$schemaNode/@maxOccurs"/>
- <xsl:variable name="xpath2">
- <xsl:if test="name($schemaNode)!=name($schemaRootNode) or $argsNodeName!='Arguments'">
- <xsl:call-template name="makeNextXPath">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="string($maxOccurs)='unbounded'">
- <xsl:choose>
- <xsl:when test="string($tableId)!=string($xpath2)">
- <xsl:if test="$schemaNode/@colspan">
- <xsl:text disable-output-escaping="yes"><tr><td colspan="</xsl:text>
- <xsl:value-of select="$schemaNode/@colspan"/>
- <xsl:text disable-output-escaping="yes">" style="text-align:left"></xsl:text>
- </xsl:if>
- <!-- create another table that would occupy entire cell of the parent table's row-->
- <xsl:if test="$schemaNode/@break='true'">
- <br/>
- </xsl:if>
- <xsl:if test="$schemaNode/@caption and not($argsNodeName='.' and name($schemaNode)=name($schemaRootNode))">
- <b align="left"><xsl:value-of select="$schemaNode/@caption"/></b>
- </xsl:if>
- <xsl:variable name="tableWidth">
- <xsl:choose>
- <xsl:when test="$schemaNode/@width and string($schemaNode/@width)!='100%'">
- <xsl:choose>
- <xsl:when test="not($schemaNode/@checkboxes='false')">
- <xsl:value-of select="number($schemaNode/@width)+35"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($schemaNode/@width)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="width">100%</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="createFixedTableWithHeader">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="targetNode" select="$objNode"/>
- <xsl:with-param name="tableId" select="$xpath2"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="width" select="$tableWidth"/>
- </xsl:call-template>
- <xsl:if test="$schemaNode/../@table">
- <xsl:text disable-output-escaping="yes"></td></tr></xsl:text>
- </xsl:if>
- <!--xsl:call-template name="createButtons">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="targetNode" select="$objNode"/>
- </xsl:call-template-->
- </xsl:when>
- <xsl:otherwise><!--tableId == xpath2-->
- <xsl:variable name="rowCheckbox" select="string($schemaNode/@checkboxes)!='false'"/>
- <xsl:variable name="checked" select="string($schemaNode/@checked)='true'"/>
- <xsl:variable name="itemListValue">
- <xsl:text>+</xsl:text>
- <xsl:for-each select="$objNode/*[name()=$name]">
- <xsl:value-of select="position()-1"/>
- <xsl:text>+</xsl:text>
- </xsl:for-each>
- </xsl:variable>
- <input type="hidden" id="{$tableId}.itemlist"
- name="{$tableId}.itemlist" value="{$itemListValue}"/>
-
- <xsl:for-each select="$objNode/*[name()=$name]">
- <xsl:variable name="rowId" select="concat($xpath2, '.', string(position()-1))"/>
- <tr id="{$rowId}">
- <xsl:if test="string($schemaNode/@hover)!='false'">
- <xsl:attribute name="onmouseenter">this.bgColor='#F0F0FF'</xsl:attribute>
- <xsl:choose>
- <xsl:when test="position() mod 2">
- <xsl:attribute name="bgColor">#FFFFFF</xsl:attribute>
- <xsl:attribute name="onmouseleave">this.bgColor = '#FFFFFF'</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="bgColor">#F0F0F0</xsl:attribute>
- <xsl:attribute name="onmouseleave">this.bgColor = '#F0F0F0'</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <!--xsl:choose> - not used any more but save for future
- <xsl:when test="$schemaNode/@tableRows">
- <td colspan="{$columnCount}" class="row-table">
- <table border="0" class="row-table" width="100%">
- <tbody>
- <tr>
- <xsl:call-template name="populateTableRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="domNode" select="."/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath2"/>
- <xsl:with-param name="bRowCheckbox" select="$rowCheckbox"/>
- <xsl:with-param name="bChecked" select="$checked"/>
- </xsl:call-template>
- </tr>
- </tbody>
- </table>
- <xsl:variable name="objNode2" select="."/>
- <xsl:for-each select="$schemaNode/*[@break]">
- <br/>
- <xsl:variable name="columnCount2">
- <xsl:call-template name="countColumns">
- <xsl:with-param name="schemaNode" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="addTableRows">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="objNode" select="$objNode2"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$rowId"/>
- <xsl:with-param name="columnCount" select="$columnCount2"/>
- </xsl:call-template>
- </xsl:for-each>
- </td>
- </xsl:when>
- <xsl:otherwise-->
- <xsl:call-template name="populateTableRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="domNode" select="."/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath2"/>
- <xsl:with-param name="bRowCheckbox" select="$rowCheckbox"/>
- <xsl:with-param name="bChecked" select="$checked"/>
- </xsl:call-template>
- <!--/xsl:otherwise>
- </xsl:choose-->
- </tr>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
- <xsl:when test="string($maxOccurs)='1' or name($schemaNode)=name($schemaRootNode)">
- <xsl:variable name="rootName" select="name($schemaRootNode)"/>
- <xsl:variable name="targetNode"
- select="$objNode/*[name()=$name and ($argsNodeName!='.' or $name!=$rootName)][1]|$objNode[$argsNodeName='.' and $name=$rootName]"/>
- <xsl:if test="not($targetNode)">
- <!--TODO-->
- </xsl:if>
- <xsl:choose>
- <xsl:when test="$schemaNode/@table">
- <!--create another table that would occupy entire cell of parent table's row -->
- <xsl:variable name="nestedTableWidth">
- <xsl:choose>
- <xsl:when test="@width">
- <xsl:value-of select="@width"/>
- </xsl:when>
- <xsl:otherwise>100%</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!--tr-->
- <xsl:choose>
- <xsl:when test="$schemaNode/../@maxOccurs='unbounded'">
- <xsl:text disable-output-escaping="yes"><td style="padding:0" width="</xsl:text>
- <xsl:value-of select="$nestedTableWidth"/>
- <xsl:text disable-output-escaping="yes">"></xsl:text>
- </xsl:when>
- <xsl:when test="$schemaNode/@break">
- <br/>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="tableId2">
- <!--xsl:if test="not($schemaNode/@id='')"--><!--not(exists and is '')-->
- <xsl:choose>
- <xsl:when test="$schemaNode/@id">
- <xsl:value-of select="$schemaNode/@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$xpath2"/>
- </xsl:otherwise>
- </xsl:choose>
- <!--/xsl:if-->
- </xsl:variable>
- <xsl:variable name="caption" select="$schemaNode/@caption"/>
- <xsl:if test="$showTableCaption and $caption and not($argsNodeName='.' and name($schemaNode)=name($schemaRootNode))">
- <b align="left"><xsl:value-of select="$caption"/></b>
- </xsl:if>
- <!--border="0" style="font: 10pt arial, helvetica, sans-serif;"-->
- <xsl:call-template name="createFixedTable">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="id" select="$tableId2"/>
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="xpath" select="$xpath2"/>
- <xsl:with-param name="columnCount" select="$columnCount"/>
- </xsl:call-template>
- <xsl:if test="$schemaNode/@overrideCell='after'">
- <xsl:apply-templates select="$schemaNode" mode="overrideCell">
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="rowId" select="$xpath2"/>
- <xsl:with-param name="columnHeader" select="0"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:if test="$schemaNode/../@maxOccurs='unbounded'">
- <xsl:text disable-output-escaping="yes"></td></xsl:text>
- </xsl:if>
- <!--/tr-->
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script']">
- <xsl:call-template name="addTableRows">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$xpath2"/>
- <xsl:with-param name="columnCount" select="$columnCount"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
- <xsl:otherwise><!--an attribute-->
- <xsl:variable name="targetNode" select="$objNode/*[name()=$name][1]"/>
- <xsl:if test="not($targetNode)">
- <!--TODO-->
- </xsl:if>
- <xsl:variable name="rowId" select="concat($tableId, '.', name($schemaNode))"/>
- <xsl:choose>
- <xsl:when test="string($schemaNode/@viewType)!='hidden'">
- <xsl:variable name="caption">
- <xsl:choose>
- <xsl:when test="$schemaNode/@caption">
- <xsl:value-of select="$schemaNode/@caption"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="name($schemaNode)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <tr><!--id="{$rowId}.row" is this needed?-->
- <th width="1%" style="border:0;text-align:left">
- <xsl:copy-of select="$schemaNode/@noWrap"/>
- <xsl:value-of select="$caption"/>
- </th>
- <td width="1%"><b>:</b></td>
- <td>
- <xsl:call-template name="insertAttribNodeInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="alignment" select="'left'"/>
- </xsl:call-template>
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="insertAttribNodeInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="alignment" select="'left'"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="populateTableRow">
- <xsl:param name="tableId"/>
- <xsl:param name="rowId"/>
- <xsl:param name="domNode"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:param name="bRowCheckbox"/>
- <xsl:param name="bChecked"/>
- <xsl:variable name="nodeName" select="name($domNode)"/>
- <xsl:if test="$bRowCheckbox">
- <td width="35">
- <xsl:variable name="cbName" select="concat($xpath, '.checkbox')"/>
- <input type="checkbox" name="{$cbName}" value="1">
- <xsl:if test="$bChecked">
- <xsl:attribute name="checked">true</xsl:attribute>
- </xsl:if>
- <xsl:attribute name="onclick">
- <xsl:value-of select="concat('ms_onChange(this, ', $apos, $tableId, $apos, ', 0)')"/>
- </xsl:attribute>
- </input>
- </td>
- </xsl:if>
-
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script' and not(@break)]">
- <xsl:choose>
- <xsl:when test="@table">
- <xsl:call-template name="addTableRows">
- <xsl:with-param name="tableId" select="concat($rowId, '.', name())"/>
- <xsl:with-param name="objNode" select="$domNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$rowId"/>
- <xsl:with-param name="columnCount" select="1"/>
- <xsl:with-param name="showTableCaption" select="0"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="insertCellInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$domNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$rowId"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <xsl:if test="$schemaNode/@overrideRow='after'">
- <xsl:apply-templates select="$schemaNode" mode="overrideRow">
- <xsl:with-param name="objNode" select="$domNode"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="columnHeader" select="0"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:template>
- <xsl:template name="insertCellInRow">
- <xsl:param name="tableId"/>
- <xsl:param name="rowId"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:variable name="maxOccurs" select="$schemaNode/@maxOccurs"/>
- <xsl:choose>
- <xsl:when test="string($maxOccurs)='unbounded'">
- <!--create another table that would occupy entire cell of parent table's row-->
- <xsl:variable name="xpath2">
- <xsl:if test="string($xpath)!=''">
- <xsl:value-of select="$xpath"/>
- <xsl:text>.</xsl:text>
- </xsl:if>
- <xsl:value-of select="name($schemaNode)"/>
- </xsl:variable>
- <td style="padding:0;margin:0">
- <xsl:call-template name="createFixedTableWithHeader">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- <xsl:with-param name="tableId" select="$xpath2"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- <xsl:with-param name="width" select="'100%'"/>
- </xsl:call-template>
- <!--border="0" cellspacing="0"-->
- <!--xsl:call-template name="createButtons">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="targetNode" select="$targetNode"/>
- </xsl:call-template-->
- </td>
- </xsl:when><!--unbounded-->
-
- <xsl:when test="string($maxOccurs)='1'">
- <xsl:variable name="name" select="name($schemaNode)"/>
- <xsl:variable name="childNode" select="$targetNode/*[name()=$name][1]"/>
- <xsl:if test="not($childNode)">
- <!--TODO-->
- </xsl:if>
- <xsl:variable name="xpath3">
- <xsl:if test="string($xpath)!=''">
- <xsl:value-of select="$xpath"/>
- <xsl:text>.</xsl:text>
- </xsl:if>
- <xsl:value-of select="$name"/>
- </xsl:variable>
- <xsl:for-each select="$schemaNode/*[name()!='Buttons' and name()!='script']">
- <xsl:call-template name="insertCellInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$childNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="xpath" select="$xpath3"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
-
- <xsl:otherwise><!--attribute or innerText-->
- <xsl:variable name="name" select="name($schemaNode)"/>
- <xsl:variable name="inner" select="$schemaNode/@dataType='innerText'"/>
- <xsl:variable name="childNode"
- select="$targetNode[$inner]|$targetNode/*[not($inner) and name()=$name]"/>
- <xsl:choose>
- <xsl:when test="string($schemaNode/@viewType)!='hidden'">
- <td>
- <xsl:copy-of select="$schemaNode/@width"/>
- <xsl:call-template name="insertAttribNodeInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$childNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="insertAttribNodeInRow">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="targetNode" select="$childNode"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="xpath" select="$xpath"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="insertAttribNodeInRow">
- <xsl:param name="tableId"/>
- <xsl:param name="rowId"/>
- <xsl:param name="targetNode"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="xpath"/>
- <xsl:param name="alignment"/>
-
- <xsl:for-each select="$schemaNode">
- <xsl:if test="string(@viewType)!='hidden'">
- <xsl:if test="@overrideCell='before'">
- <xsl:apply-templates select="." mode="overrideCell">
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="columnHeader" select="0"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:if test="string(@align)!='' or string($alignment)!=''">
- <xsl:attribute name="style"><!--we need to define style since @align cannot override sort-table's style-->
- <xsl:text>text-align:</xsl:text>
- <xsl:choose>
- <xsl:when test="string(@align)!=''">
- <xsl:value-of select="@align"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$alignment"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="@valign"/>
- <xsl:if test="@dataType!='boolean' and @dataType!='file'">
- <xsl:copy-of select="@nowrap|@width"/>
- </xsl:if>
- <xsl:variable name="isStatic"
- select="starts-with(@viewType, 'static') or @viewType='tooltip'"/>
- <xsl:if test="$isStatic">
- <xsl:if test="@span">
- <xsl:text disable-output-escaping="yes"><span id="</xsl:text>
- <xsl:value-of select="concat($xpath, '.', name(), '.span')"/>
- <xsl:text disable-output-escaping="yes">"></xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="@viewType='tooltip'">
- <xsl:variable name="len" select="string-length($targetNode/text())"/>
- <xsl:choose>
- <xsl:when test="$len<8">
- <xsl:value-of select="$targetNode/text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="onmouseover">
- <xsl:text>EnterContent('ToolTip', null, '</xsl:text>
- <xsl:value-of select="$targetNode/text()"/>
- <xsl:text>', true; Activate();</xsl:text>
- </xsl:attribute>
- <xsl:attribute name="onmouseout">deActivate()</xsl:attribute>
- <xsl:value-of select="substring(string($targetNode), 1, 4)"/>
- <xsl:text>...</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when><!--tooltip-->
- <xsl:when test="@dataType='boolean'">
- <xsl:value-of select="$targetNode/text()"/>
- </xsl:when>
- <xsl:when test="string($targetNode)!=''">
- <xsl:choose>
- <xsl:when test="contains(@viewType, ':')">
- <xsl:variable name="options" select="substring-after(@viewType, ':')"/>
- <xsl:call-template name="getIndexedOption">
- <xsl:with-param name="stringOptions" select="$options"/>
- <xsl:with-param name="index" select="number($targetNode)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$targetNode/text()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise> </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="@span">
- <xsl:text disable-output-escaping="yes"></span></xsl:text>
- </xsl:if>
- </xsl:if><!--$isStatic-->
- </xsl:if>
-
- <xsl:if test="string(@dataType) != 'none'">
- <xsl:call-template name="createInputControlForNode">
- <xsl:with-param name="tableId" select="$tableId"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="idPrefix" select="$xpath"/>
- <xsl:with-param name="node" select="$targetNode"/>
- <xsl:with-param name="schemaNode" select="."/>
- <xsl:with-param name="dataType" select="@dataType"/>
- <xsl:with-param name="viewType" select="@viewType"/>
- <xsl:with-param name="columnHeader" select="0"/>
- <xsl:with-param name="multiselect" select="@multiselect='true'"/>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:if test="@overrideCell='after'">
- <xsl:apply-templates select="." mode="overrideCell">
- <xsl:with-param name="objNode" select="$targetNode"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="columnHeader" select="0"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
- <xsl:template name="getIndexedOption">
- <xsl:param name="stringOptions"/>
- <xsl:param name="index"/>
- <xsl:choose>
- <xsl:when test="$index=0">
- <xsl:choose>
- <xsl:when test="contains($stringOptions, '|')">
- <xsl:value-of select="substring-before($stringOptions, '|')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$stringOptions"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$index=0">
- <xsl:value-of select="substring-before($stringOptions, '|')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="getIndexedOption">
- <xsl:with-param name="stringOptions" select="substring-after($stringOptions, '|')"/>
- <xsl:with-param name="index" select="number($index)-1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="createInputControlForNode">
- <xsl:param name="tableId"/>
- <xsl:param name="rowId"/>
- <xsl:param name="idPrefix"/>
- <xsl:param name="node"/>
- <xsl:param name="schemaNode"/>
- <xsl:param name="dataType"/>
- <xsl:param name="viewType"/>
- <xsl:param name="multiselect"/>
- <xsl:param name="columnHeader"/>
-
- <xsl:variable name="id">
- <xsl:if test="string($idPrefix)!=''">
- <xsl:value-of select="$idPrefix"/>
- </xsl:if>
- <xsl:if test="name($schemaNode)!='innerText'">
- <xsl:if test="string($idPrefix)!=''">
- <xsl:text>.</xsl:text>
- </xsl:if>
- <xsl:value-of select="name($schemaNode)"/>
- </xsl:if>
- </xsl:variable>
-
- <xsl:variable name="value">
- <xsl:if test="not($columnHeader)">
- <xsl:choose>
- <xsl:when test="string($node/text())!=''">
- <xsl:value-of select="$node/text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$schemaNode/@default"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:variable>
-
- <xsl:variable name="type">
- <xsl:choose>
- <xsl:when test="$viewType='hidden'">hidden</xsl:when>
- <xsl:when test="starts-with($viewType, 'static')">hidden</xsl:when>
- <xsl:when test="$viewType='tooltip'">hidden</xsl:when>
- <xsl:when test="$viewType='select'">select-one</xsl:when>
- <xsl:when test="$dataType='boolean'">checkbox</xsl:when>
- <xsl:when test="$viewType='showHideRowBtn'">hidden</xsl:when>
- <xsl:when test="$viewType='url'">hidden</xsl:when>
- <xsl:when test="$dataType='file'">file</xsl:when>
- <xsl:otherwise>text</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:if test="$columnHeader and $type='hidden'">
- <xsl:message terminate="yes">
- <xsl:text>Multiple selection is not supported for columns with type </xsl:text>
- <xsl:value-of select="$viewType"/>
- </xsl:message>
- </xsl:if>
-
- <xsl:variable name="inputName">
- <xsl:choose>
- <xsl:when test="$viewType='select'">select</xsl:when>
- <xsl:otherwise>input</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="modifiedHandlerName">
- <xsl:choose>
- <xsl:when test="$type='checkbox' or $type='file'">onclick</xsl:when>
- <xsl:when test="$type='hidden'"></xsl:when>
- <xsl:otherwise>onchange</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="disabled">
- <xsl:if test="$type!='hidden'">
- <xsl:choose>
- <xsl:when test="string($schemaNode/@disabled)='1'">1</xsl:when>
- <xsl:when test="string($node/@disabled)='1'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:variable>
-
- <xsl:if test="$schemaNode/@override">
- <xsl:apply-templates select="$schemaNode" mode="override">
- <xsl:with-param name="objNode" select="$node"/>
- <xsl:with-param name="rowId" select="$rowId"/>
- <xsl:with-param name="columnHeader" select="$columnHeader"/>
- </xsl:apply-templates>
- </xsl:if>
-
- <xsl:element name="{$inputName}">
- <xsl:if test="string($type)!=''">
- <xsl:attribute name="type">
- <xsl:value-of select="$type"/>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="$columnHeader">
- <xsl:attribute name="id">
- <xsl:value-of select="concat($tableId, '_ms', $schemaNode/@column, '_T_I')"/>
- </xsl:attribute>
- <!--TODO set inputTag and inputType of multiselect-->
- <xsl:attribute name="style">display:none</xsl:attribute>
- <xsl:attribute name="title">
- <xsl:choose>
- <xsl:when test="$type='checkbox'">
- <xsl:text>Check or uncheck all items in this column</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Update all items in this column with this value</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
- <xsl:attribute name="name">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
- <!--xsl:if test="string(@viewType)!='showHideRowBtn' or string(@dataType)!='none'">
- <xsl:attribute name="name">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
- </xsl:if-->
- <xsl:if test="string($viewType)!='select'">
- <xsl:attribute name="value">
- <xsl:choose>
- <xsl:when test="string($type)='checkbox'">1</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="$disabled=1">
- <xsl:attribute name="disabled">true</xsl:attribute>
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="$type='checkbox'">
- <xsl:if test="$value='1'">
- <xsl:attribute name="checked">true</xsl:attribute>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$type='text'">
- <xsl:copy-of select="$schemaNode/@size"/>
- </xsl:when>
- </xsl:choose>
-
- <xsl:if test="string($modifiedHandlerName)!=''">
- <xsl:attribute name="{$modifiedHandlerName}">
- <xsl:text>setModified(); </xsl:text>
- <xsl:if test="$multiselect">
- <xsl:choose>
- <xsl:when test="$columnHeader">ms_setAll</xsl:when>
- <xsl:otherwise>ms_onChange</xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="concat('(this, ', $apos, $tableId, $apos, ', ', $schemaNode/@column, ');')"/>
- <xsl:if test="$columnHeader"> <!--ms column > 0 -->
- <xsl:text>; this.style.display='none';</xsl:text>
- </xsl:if>
- </xsl:if>
- <xsl:variable name="handlerAttrib"
- select="$schemaNode/@*[name()=$modifiedHandlerName]"/>
- <xsl:if test="not($columnHeader) and $handlerAttrib">
- <xsl:choose>
- <xsl:when test="$node">
- <xsl:call-template name="expand_embedded_xpaths">
- <xsl:with-param name="str" select="$handlerAttrib"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$handlerAttrib"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:attribute>
- </xsl:if><!--$modifiedHandlerName-->
- <xsl:if test="$type='select-one'">
- <xsl:call-template name="addSelectControlOptions">
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="node" select="$node[not($schemaNode/@xpath)] | $objRootNode[$schemaNode/@xpath='/']/*[name()=name($schemaNode)]"/>
- <xsl:with-param name="value" select="$value"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:element>
-
- <xsl:choose>
- <xsl:when test="$columnHeader">
- <xsl:if test="$multiselect">
- <xsl:variable name="ms_onchange_item" select="string($schemaNode/@ms_onchange_item)"/>
- <xsl:variable name="ms_onchange_item_handler">
- <xsl:choose>
- <xsl:when test="$ms_onchange_item!=''"><xsl:value-of select="$ms_onchange_item"/></xsl:when>
- <xsl:otherwise>null</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <script type="text/javascript">
- <xsl:variable name="msId" select="concat($tableId, '_ms', string(@column), '_T')"/>
- <xsl:value-of select="concat('var input = document.getElementById(', $apos, $msId, '_I', $apos, ');')"/>
- <xsl:value-of select="concat('ms_create(', $apos, $tableId, $apos, ', onColumnCheck, ', $ms_onchange_item_handler, ', ', @column, ', input.tagName, input.type);')"/>
- </script>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="string(@viewType)='showHideRowBtn'">
- <input type="button" id="{$id}.btn" value="Show">
- <xsl:choose>
- <xsl:when test="string($node/text())!=''">
- <xsl:attribute name="onclick">
- <xsl:value-of select="concat('onShowHideRow(', $apos, $tableId, $apos, ',', $apos, $rowId, $apos, ',', 'this)')"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="disabled">true</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </input>
- </xsl:when>
- <xsl:when test="$viewType='url'">
- <a id="{$id}.url">
- <xsl:copy-of select="$schemaNode/@onclick|$schemaNode/@href"/>
- <xsl:value-of select="$value"/>
- </a>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="addSelectControlOptions">
- <xsl:param name="schemaNode"/>
- <xsl:param name="node"/>
- <xsl:param name="value"/>
- <xsl:if test="$schemaNode/@source='object' and not($node)">
- <xsl:attribute name="disabled">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="$schemaNode/@addEmpty='true'">
- <option value="">
- <xsl:if test="$value and string($value)=''">
- <xsl:attribute name="selected">true</xsl:attribute>
- </xsl:if>
- </option>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="$schemaNode/@source='object'">
- <!--optionTag defines tag name of child that defines an option-->
- <xsl:variable name="optionTag">
- <xsl:choose>
- <xsl:when test="$schemaNode/@option">
- <xsl:value-of select="$schemaNode/@option"/>
- </xsl:when>
- <xsl:otherwise>option</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!--
- '@text', '@value' and '@selected' attributes of schemaNode
- hold the needed tag names which are used to populate the drop down list
- these are supposed to be child nodes of option node in object hierarchy
-
- for instance, the following schema node definition creates a select object
- from the object node below and selects second item:
- <NameServices caption="Name Service" viewType="select" source="object"
- option="NameService" text="Name" value="Value" selected="Selected"/>
-
- object node:
- <NameServices>
- <NameService>
- <Name>ns1</Name>
- <Value>val1</Value>
- </NameService>
- <NameService>
- <Name>ns2</Name>
- <Value>val2</Value>
- <Selected>true</Selected>
- </NameService>
- </NameServices>
- -->
- <xsl:variable name="textTag" select="$schemaNode/@text"/>
- <xsl:variable name="valueTag" select="$schemaNode/@value"/>
- <xsl:variable name="selectedTag" select="$schemaNode/@selected"/>
- <xsl:choose>
- <xsl:when test="$node">
- <xsl:for-each select="$node/*[name()=$optionTag]">
- <xsl:variable name="option" select="."/>
- <xsl:variable name="val" select="*[name()=$valueTag][1]/text()"/>
- <option value="{$val}">
- <xsl:variable name="selected" select="*[name()=$selectedTag][1]"/>
- <xsl:if test="$selected=1 or $val=string($value)">
- <xsl:attribute name="selected">true</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="*[name()=$textTag][1]/text()"/>
- </option>
- </xsl:for-each>
- </xsl:when><!--$node-->
- <xsl:otherwise><!--$node is null-->
- <option value="">-undefined-</option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when><!--$schemaNode/@source='object'-->
- <xsl:otherwise><!--$schemaNode/@source!='object'-->
- <xsl:for-each select="$schemaNode/option">
- <option value="{@value}">
- <xsl:if test="$value and string($value)=string(@value)">
- <xsl:attribute name="selected">true</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="text()"/>
- </option>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="expand_embedded_xpaths">
- <xsl:param name="str" select="$handlerAttrib"/>
- <xsl:param name="schemaNode" select="$schemaNode"/>
- <xsl:param name="node" select="$node"/>
- <xsl:choose>
- <xsl:when test="contains($str, '{')">
- <xsl:variable name="prefix" select="substring-before($str, '{')"/>
- <xsl:variable name="suffix" select="substring-after($str, '{')"/>
- <xsl:variable name="embraced" select="substring-before($suffix, '}')"/>
- <xsl:variable name="replacement">
- <xsl:choose>
- <xsl:when test="$pattern='.'"><xsl:value-of select="$node/text()"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$node/*[name()=$embraced]"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:value-of select="$prefix"/>
- <xsl:value-of select="$replacement"/>
- <xsl:call-template name="expand_embedded_xpaths">
- <xsl:with-param name="str" select="substring-after($suffix, '}')"/>
- <xsl:with-param name="schemaNode" select="$schemaNode"/>
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$str"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*|@*" mode="copy">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()" mode="copy"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="text()" mode="copy">
- <xsl:copy-of select="normalize-space(.)"/>
- </xsl:template>
- </xsl:stylesheet>
|