Changeset 24007 for main/branches/64_bit_Greenstone/greenstone3/web/interfaces/default/transform/service-params.xsl
- Timestamp:
- 2011-05-09T14:37:04+12:00 (13 years ago)
- Location:
- main/branches/64_bit_Greenstone/greenstone3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/branches/64_bit_Greenstone/greenstone3
- Property svn:mergeinfo changed
-
main/branches/64_bit_Greenstone/greenstone3/web/interfaces/default/transform/service-params.xsl
r19940 r24007 4 4 xmlns:java="http://xml.apache.org/xslt/java" 5 5 extension-element-prefixes="java"> 6 6 7 7 <!-- handling of the different types of params on a service form 8 - these now only output the selection box/text box etc, not the name -->9 8 - these now only output the selection box/text box etc, not the name --> 9 10 10 <!-- the default param list handling --> 11 11 <xsl:template match="paramList"> … … 13 13 <ul id="queryitemlist"> 14 14 <xsl:for-each select="param"> 15 16 17 18 19 20 21 22 23 15 <xsl:choose> 16 <xsl:when test="@type='multi'"> 17 <li><xsl:apply-templates select='.'><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates></li> 18 </xsl:when> 19 <xsl:otherwise> 20 <xsl:variable name="pvalue"><xsl:apply-templates select="." mode="calculate-default"><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates></xsl:variable> 21 <li><xsl:value-of select="displayItem[@name='name']"/><xsl:apply-templates select="."><xsl:with-param name="default" select="$pvalue"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates></li> 22 </xsl:otherwise> 23 </xsl:choose> 24 24 </xsl:for-each> 25 25 </ul> … … 27 27 28 28 <!-- puts all the params into a=p&p=h type form - need to change this if use 29 multi params -->29 multi params --> 30 30 <xsl:template match="paramList" mode="cgi"> 31 31 <xsl:param name="ns">s1.</xsl:param> … … 35 35 </xsl:for-each> 36 36 </xsl:template> 37 37 38 38 <xsl:template match="param" mode="calculate-default"> 39 39 <xsl:param name="ns">s1.</xsl:param> … … 41 41 <xsl:choose> 42 42 <xsl:when test="/page/pageRequest/paramList/param[@name=$pname]"> 43 44 45 46 47 48 49 50 51 52 43 <xsl:choose> 44 <xsl:when test="@type='enum_multi'"><xsl:text>,</xsl:text> 45 <xsl:for-each select="/page/pageRequest/paramList/param[@name=$pname]"> 46 <xsl:value-of select="@value"/>, 47 </xsl:for-each> 48 </xsl:when> 49 <xsl:otherwise> 50 <xsl:value-of select="/page/pageRequest/paramList/param[@name=$pname]/@value"/> 51 </xsl:otherwise> 52 </xsl:choose> 53 53 </xsl:when> 54 54 <xsl:otherwise> 55 55 <xsl:value-of select="@default"/> 56 56 </xsl:otherwise> 57 57 </xsl:choose> 58 58 </xsl:template> 59 59 60 60 <!-- invisible params - used by other stuff. in the query form, we set to teh default --> 61 61 <xsl:template match="param[@type='invisible']"> 62 62 <xsl:param name="ns">s1.</xsl:param> 63 <input type='hidden' name=' {$ns}{@name}' value='{@default}'/>63 <input type='hidden' name='concat($ns, @name)' value='{@default}'/> 64 64 </xsl:template> 65 65 <!-- boolean params --> … … 67 67 <xsl:param name="ns">s1.</xsl:param> 68 68 <xsl:param name="default"/> 69 69 70 <select name='{$ns}{@name}'> 70 71 <option value="0"><xsl:if test="$default='0'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="option[@name='0']/displayItem[@name='name']"/></option> … … 76 77 <xsl:template match="param[@type='integer']"> 77 78 <xsl:param name="ns">s1.</xsl:param> 78 <xsl:param name="default"/> 79 <xsl:param name="default"/> 80 79 81 <input type="text" name="{$ns}{@name}" size="3" value="{$default}"/> 80 82 </xsl:template> 81 83 82 84 <!-- single selection enum params --> 83 85 <xsl:template match="param[@type='enum_single']"> 84 86 <xsl:param name="ns">s1.</xsl:param> 85 87 <xsl:param name="default"/> 88 86 89 <xsl:choose> 87 90 <xsl:when test="count(option) = 1"> 88 89 91 <xsl:text> </xsl:text><xsl:value-of select="option/displayItem[@name='name']"/> 92 <input type='hidden' name='{$ns}{@name}'><xsl:attribute name='value'><xsl:value-of select='option/@name'/></xsl:attribute></input> 90 93 </xsl:when> 91 94 <xsl:otherwise> 92 <select name="{$ns}{@name}"> 93 <xsl:for-each select="option"> 94 <option value="{@name}"><xsl:if test="@name=$default"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option> 95 </xsl:for-each> 96 </select> 95 96 <select name="{$ns}{@name}"> 97 <xsl:for-each select="option"> 98 <option value="{@name}"><!--<xsl:if test="@name=$default"><xsl:attribute name="selected"></xsl:attribute></xsl:if>--><xsl:value-of select="displayItem[@name='name']"/></option> 99 </xsl:for-each> 100 </select> 97 101 </xsl:otherwise> 98 102 </xsl:choose> 99 103 </xsl:template> 100 101 104 105 102 106 <!-- multiple selection enum params --> 103 107 <!-- how to do defaults for this?? --> 108 <!-- Don't need to do anything here, handled automatically in the list --> 104 109 <xsl:template match="param[@type='enum_multi']"> 105 110 <xsl:param name="ns">s1.</xsl:param> … … 107 112 <select name="{$ns}{@name}" size='2'><xsl:attribute name="multiple"></xsl:attribute> 108 113 <xsl:for-each select="option"> 109 114 <option value="{@name}"><xsl:if test="contains($default, concat(',', @name, ','))"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option> 110 115 </xsl:for-each> 111 116 </select> … … 116 121 <xsl:param name="ns">s1.</xsl:param> 117 122 <xsl:param name="default"/> 123 118 124 <input type="text" name="{$ns}{@name}" size="50" value="{$default}"/> 119 125 </xsl:template> … … 122 128 <xsl:template match="param[@type='text']"> 123 129 <xsl:param name="ns">s1.</xsl:param> 124 <xsl:param name="default"/> 130 <xsl:param name="default"/> 131 125 132 <textarea name="{$ns}{@name}" cols="50" rows="3"><xsl:value-of select='$default'/></textarea> 126 133 </xsl:template> 127 134 128 135 <!-- multi params - params that are combinations of other params --> 129 136 <xsl:template match="param[@type='multi']"> … … 132 139 <table> 133 140 <tr class="queryfieldheading"><xsl:value-of select="displayItem[@name='name']"/> 134 135 136 141 <xsl:for-each select="param"> 142 <td class="queryfieldname"><xsl:value-of select="displayItem[@name='name']"/></td> 143 </xsl:for-each> 137 144 </tr> 138 145 … … 140 147 </table> 141 148 </xsl:template> 142 149 143 150 <xsl:template match="param[@type='multi']" mode="contents"> 144 151 <xsl:param name="ns">s1.</xsl:param> … … 146 153 <xsl:variable name="pos" select="@occurs - $occurs"/> 147 154 <tr class="queryfieldrow"><xsl:for-each select="param"> 148 149 150 151 152 <xsl:apply-templates select='.'><xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($values, $pos)"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>153 154 155 156 157 158 155 <xsl:variable name="pname" select="@name"/> 156 <xsl:variable name="values" select="/page/pageRequest/paramList/param[@name=$pname]/@value"/> 157 <td class="queryfieldcell"><xsl:choose> 158 <xsl:when test="not(@ignore) or @ignore != $pos"> 159 <xsl:apply-templates select='.'><xsl:with-param name="default" select="$values|$pos"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates> 160 </xsl:when> 161 <xsl:otherwise><!-- put in a hidden placeholder --> 162 <input type="hidden" name='{$ns}{@name}' value=''/> 163 </xsl:otherwise> 164 </xsl:choose></td> 165 </xsl:for-each></tr> 159 166 <!-- recursively call this template to get multiple entries --> 160 167 <xsl:if test="$occurs > 1"> … … 162 169 </xsl:if> 163 170 </xsl:template> 164 171 165 172 166 173 </xsl:stylesheet> 167 174 168 175 <!-- a param list that puts params in pairs- wont work as is with new 169 176 param handling stuff --> 170 177 <!-- 171 178 <xsl:template match="paramList"> 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 179 <p/><table width="537"> 180 <xsl:choose> 181 <xsl:when test='count(param)>4'> 182 <xsl:for-each select="param[position() mod 2 = 1]"> 183 <tr><xsl:apply-templates select="."/> 184 <xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr> 185 </xsl:for-each> 186 </xsl:when> 187 <xsl:otherwise> 188 <xsl:for-each select="param"> 189 <tr><xsl:apply-templates select='.'/></tr> 190 </xsl:for-each> 191 </xsl:otherwise> 192 </xsl:choose> 193 </table> 187 194 </xsl:template> 188 195 -->
Note:
See TracChangeset
for help on using the changeset viewer.