[23989] | 1 | <xsl:stylesheet version="1.0"
|
---|
| 2 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 3 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
| 4 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
| 5 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
[37627] | 6 | xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
|
---|
[23989] | 7 | extension-element-prefixes="java util"
|
---|
| 8 | exclude-result-prefixes="java util">
|
---|
| 9 |
|
---|
[26366] | 10 | <xsl:template name="param-display">
|
---|
| 11 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 12 | <xsl:variable name="pvalue"><xsl:call-template name="param-calculate-default"><xsl:with-param name="ns" select="$ns"/></xsl:call-template></xsl:variable>
|
---|
| 13 | <div class="paramLabel"><xsl:value-of select="displayItem[@name='name']"/></div>
|
---|
| 14 | <div class="paramValue">
|
---|
| 15 | <xsl:apply-templates select=".">
|
---|
| 16 | <xsl:with-param name="default" select="$pvalue"/>
|
---|
| 17 | <xsl:with-param name="ns" select="$ns"/>
|
---|
| 18 | </xsl:apply-templates>
|
---|
| 19 | </div>
|
---|
[38086] | 20 | <br class="clear br-sharedParamDisplay"/>
|
---|
[26366] | 21 | </xsl:template>
|
---|
| 22 |
|
---|
| 23 | <xsl:template name="param-calculate-default" match="param" mode="calculate-default">
|
---|
[23989] | 24 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 25 | <xsl:variable name="pname"><xsl:value-of select="$ns"/><xsl:value-of select="@name"/></xsl:variable>
|
---|
| 26 | <xsl:choose>
|
---|
| 27 | <xsl:when test="/page/pageRequest/paramList/param[@name=$pname]">
|
---|
| 28 | <xsl:choose>
|
---|
| 29 | <xsl:when test="@type='enum_multi'"><xsl:text>,</xsl:text>
|
---|
| 30 | <xsl:for-each select="/page/pageRequest/paramList/param[@name=$pname]">
|
---|
| 31 | <xsl:value-of select="@value"/>,
|
---|
| 32 | </xsl:for-each>
|
---|
| 33 | </xsl:when>
|
---|
| 34 | <xsl:otherwise>
|
---|
| 35 | <xsl:value-of select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
|
---|
| 36 | </xsl:otherwise>
|
---|
| 37 | </xsl:choose>
|
---|
| 38 | </xsl:when>
|
---|
| 39 | <xsl:otherwise>
|
---|
| 40 | <xsl:value-of select="@default"/>
|
---|
| 41 | </xsl:otherwise>
|
---|
| 42 | </xsl:choose>
|
---|
| 43 | </xsl:template>
|
---|
| 44 |
|
---|
[26366] | 45 | <!-- invisible params - used by other stuff. in the query form, we set to the default -->
|
---|
| 46 | <xsl:template match="param[@type='invisible']">
|
---|
| 47 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 48 | <input type='hidden' name='{$ns}{@name}' value='{@default}'/>
|
---|
| 49 | </xsl:template>
|
---|
| 50 |
|
---|
| 51 | <!-- boolean params -->
|
---|
| 52 | <xsl:template match="param[@type='boolean']">
|
---|
| 53 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 54 | <xsl:param name="default"/>
|
---|
| 55 | <select name='{$ns}{@name}'>
|
---|
[31178] | 56 | <option value="0"><xsl:if test="$default='0'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:value-of select="option[@name='0']/displayItem[@name='name']"/></option>
|
---|
| 57 | <option value="1"><xsl:if test="$default='1'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:value-of select="option[@name='1']/displayItem[@name='name']"/></option>
|
---|
[26366] | 58 | </select>
|
---|
| 59 | </xsl:template>
|
---|
| 60 |
|
---|
| 61 | <!-- integer params -->
|
---|
| 62 | <xsl:template match="param[@type='integer']">
|
---|
| 63 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 64 | <xsl:param name="default"/>
|
---|
[35811] | 65 | <input type="number" name="{$ns}{@name}" value="{$default}"/>
|
---|
[26366] | 66 | </xsl:template>
|
---|
| 67 |
|
---|
[23989] | 68 | <!-- single selection enum params -->
|
---|
| 69 | <xsl:template match="param[@type='enum_single']">
|
---|
| 70 | <xsl:param name="ns">s1.</xsl:param>
|
---|
[26278] | 71 | <xsl:param name="hideSingle">false</xsl:param>
|
---|
[23989] | 72 | <xsl:param name="default"/>
|
---|
[28580] | 73 | <xsl:param name="quickSearch">false</xsl:param>
|
---|
[23989] | 74 | <xsl:choose>
|
---|
| 75 | <xsl:when test="count(option) = 1">
|
---|
[26278] | 76 | <xsl:if test="$hideSingle = 'false'">
|
---|
[28624] | 77 | <xsl:value-of select="option/displayItem[@name='name']"/>
|
---|
[26277] | 78 | </xsl:if>
|
---|
[23989] | 79 | <input type='hidden' name='{$ns}{@name}'><xsl:attribute name='value'><xsl:value-of select='option/@name'/></xsl:attribute></input>
|
---|
| 80 | </xsl:when>
|
---|
| 81 | <xsl:otherwise>
|
---|
| 82 | <select name="{$ns}{@name}">
|
---|
| 83 | <xsl:for-each select="option">
|
---|
[31178] | 84 | <option value="{@name}"><xsl:if test="@name=$default"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
|
---|
[23989] | 85 | </xsl:for-each>
|
---|
| 86 | </select>
|
---|
| 87 | </xsl:otherwise>
|
---|
| 88 | </xsl:choose>
|
---|
| 89 | </xsl:template>
|
---|
[26366] | 90 | <!-- multiple selection enum params -->
|
---|
| 91 | <!-- how to do defaults for this?? -->
|
---|
| 92 | <xsl:template match="param[@type='enum_multi']">
|
---|
| 93 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 94 | <xsl:param name="default"/>
|
---|
[35811] | 95 | <select name="{$ns}{@name}" size="5">
|
---|
[26366] | 96 | <xsl:attribute name="multiple"></xsl:attribute>
|
---|
| 97 | <xsl:for-each select="option">
|
---|
[31178] | 98 | <option value="{@name}"><xsl:if test="contains($default, concat(',', @name, ','))"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
|
---|
[26366] | 99 | </xsl:for-each>
|
---|
| 100 | </select>
|
---|
| 101 | </xsl:template>
|
---|
[23989] | 102 |
|
---|
| 103 | <xsl:template match="param[@type='string']">
|
---|
| 104 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 105 | <xsl:param name="default"/>
|
---|
| 106 | <input type="text" name="{$ns}{@name}" size="30" value="{$default}"/>
|
---|
| 107 | </xsl:template>
|
---|
[26366] | 108 |
|
---|
| 109 |
|
---|
| 110 | <!-- large string params -->
|
---|
| 111 | <xsl:template match="param[@type='text']">
|
---|
| 112 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 113 | <xsl:param name="default"/>
|
---|
| 114 | <textarea name="{$ns}{@name}" cols="50" rows="3"><xsl:value-of select='$default'/></textarea>
|
---|
| 115 | </xsl:template>
|
---|
| 116 |
|
---|
| 117 | <!-- multi params - params that are combinations of other params -->
|
---|
| 118 | <xsl:template match="param[@type='multi']">
|
---|
| 119 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 120 | <xsl:variable name="parent" select="@name"/>
|
---|
| 121 |
|
---|
| 122 | <table>
|
---|
| 123 | <tr class="queryfieldheading">
|
---|
| 124 | <xsl:value-of select="displayItem[@name='name']"/>
|
---|
| 125 | <xsl:for-each select="param">
|
---|
| 126 | <td class="queryfieldname"><xsl:value-of select="displayItem[@name='name']"/></td>
|
---|
| 127 | </xsl:for-each>
|
---|
| 128 | </tr>
|
---|
| 129 | <xsl:apply-templates select="." mode="contents">
|
---|
| 130 | <xsl:with-param name="occurs" select="@occurs"/>
|
---|
| 131 | <xsl:with-param name="ns" select="$ns"/>
|
---|
| 132 | </xsl:apply-templates>
|
---|
| 133 | </table>
|
---|
| 134 |
|
---|
| 135 | </xsl:template>
|
---|
| 136 |
|
---|
| 137 | <xsl:template match="param[@type = 'checkbox_list']">
|
---|
| 138 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 139 | <ul class="checkboxList">
|
---|
| 140 | <xsl:for-each select="option">
|
---|
| 141 | <li><input type="checkbox" name="{$ns}{../@name}" value="{@name}"/><xsl:value-of select="displayItem"/></li>
|
---|
| 142 | </xsl:for-each>
|
---|
| 143 | </ul>
|
---|
| 144 | </xsl:template>
|
---|
| 145 |
|
---|
| 146 | <xsl:template match="param[@type='multi']" mode="contents">
|
---|
| 147 | <xsl:param name="ns">s1.</xsl:param>
|
---|
| 148 | <xsl:param name="occurs">1</xsl:param>
|
---|
| 149 | <xsl:variable name="pos" select="@occurs - $occurs"/>
|
---|
| 150 | <tr class="queryfieldrow">
|
---|
| 151 | <xsl:for-each select="param">
|
---|
| 152 | <xsl:variable name="pname"><xsl:value-of select="$ns"/><xsl:value-of select="@name"/></xsl:variable>
|
---|
| 153 | <xsl:variable name="values" select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
|
---|
| 154 | <td class="queryfieldcell">
|
---|
| 155 | <xsl:choose>
|
---|
| 156 | <xsl:when test="not(@ignore) or @ignore != $pos">
|
---|
| 157 | <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>
|
---|
| 158 | </xsl:when>
|
---|
| 159 | <xsl:otherwise><!-- put in a hidden placeholder -->
|
---|
| 160 | <input type="hidden" name='{$ns}{@name}' value=''/>
|
---|
| 161 | </xsl:otherwise>
|
---|
| 162 | </xsl:choose>
|
---|
| 163 | </td>
|
---|
| 164 | </xsl:for-each>
|
---|
| 165 | </tr>
|
---|
| 166 |
|
---|
| 167 | <!-- recursively call this template to get multiple entries -->
|
---|
| 168 | <xsl:if test="$occurs > 1">
|
---|
| 169 | <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="$occurs - 1"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>
|
---|
| 170 | </xsl:if>
|
---|
| 171 | </xsl:template>
|
---|
| 172 |
|
---|
[31652] | 173 | <xsl:template name="classifierNodeLink">
|
---|
[31658] | 174 | <xsl:param name="link-type"></xsl:param>
|
---|
[31652] | 175 | <xsl:param name="node-id"></xsl:param>
|
---|
| 176 | <xsl:variable name="final-link-type">
|
---|
| 177 | <xsl:choose>
|
---|
| 178 | <xsl:when test="$link-type='static'">static</xsl:when>
|
---|
| 179 | <xsl:when test="$link-type='javascript'">javascript</xsl:when>
|
---|
[38003] | 180 | <xsl:when test="not(/page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']) or /page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']/@value='true'"><xsl:choose><xsl:when test="@classifierStyle = 'HList' and util:oidIsTopChild(@nodeID)">static</xsl:when><xsl:when test="@classifierStyle = 'HList'">hlistjavascript</xsl:when><xsl:otherwise>javascript</xsl:otherwise></xsl:choose></xsl:when>
|
---|
[31652] | 181 | <xsl:otherwise>static</xsl:otherwise>
|
---|
| 182 | </xsl:choose>
|
---|
| 183 | </xsl:variable>
|
---|
| 184 | <xsl:choose>
|
---|
| 185 | <xsl:when test="$final-link-type='static'">
|
---|
| 186 | <xsl:value-of select='$library_name'/>/collection/<xsl:value-of select='/page/pageResponse/collection/@name'/>/browse/<xsl:choose><xsl:when test="$node-id"><xsl:value-of select="$node-id"/></xsl:when><xsl:otherwise><xsl:value-of select='util:replace(@nodeID, ".", "/")'/></xsl:otherwise></xsl:choose>
|
---|
| 187 | </xsl:when>
|
---|
[38003] | 188 | <xsl:when test="$final-link-type='hlistjavascript'">javascript:toggleHListSection('<xsl:value-of select="@nodeID"/>');</xsl:when>
|
---|
[31652] | 189 | <xsl:otherwise>javascript:toggleSection('<xsl:value-of select="@nodeID"/>');</xsl:otherwise>
|
---|
| 190 | </xsl:choose>
|
---|
| 191 | </xsl:template>
|
---|
| 192 |
|
---|
[37627] | 193 | <xsl:template name="loginForm">
|
---|
| 194 | <xsl:param name="action-url"></xsl:param>
|
---|
| 195 |
|
---|
| 196 | <form method="POST" id="login-form" action="{$action-url}">
|
---|
| 197 |
|
---|
| 198 | <table id="loginTable">
|
---|
| 199 | <tr>
|
---|
| 200 | <td colspan="2">
|
---|
| 201 | <input type="text" name="username" style="width:95%;" autocomplete="username">
|
---|
| 202 | <xsl:attribute name="placeholder">
|
---|
| 203 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/>
|
---|
| 204 | </xsl:attribute>
|
---|
| 205 | </input>
|
---|
| 206 | </td>
|
---|
| 207 | </tr>
|
---|
| 208 | <tr>
|
---|
| 209 | <td colspan="2">
|
---|
| 210 | <input type="password" name="password" style="width:95%;" autocomplete="current-password">
|
---|
| 211 | <xsl:attribute name="placeholder">
|
---|
| 212 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password')"/>
|
---|
| 213 | </xsl:attribute>
|
---|
| 214 | </input>
|
---|
| 215 | </td>
|
---|
| 216 | </tr>
|
---|
| 217 | <tr>
|
---|
| 218 | <td colspan="2">
|
---|
| 219 | <input name="googleidentity-signin" type="hidden" value="0" />
|
---|
| 220 | <input type="submit" class="gsloginform"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></xsl:attribute></input>
|
---|
| 221 | </td>
|
---|
| 222 | </tr>
|
---|
| 223 | <xsl:if test="$googlesignin_client_id">
|
---|
| 224 | <tr>
|
---|
| 225 | <td colspan="2">
|
---|
| 226 | <div class="hr-with-text">or</div>
|
---|
| 227 | </td>
|
---|
| 228 | </tr>
|
---|
| 229 | <tr>
|
---|
| 230 | <td colspan="2">
|
---|
| 231 | <gsf:variable name="serlvetProtocol"><xsl:value-of select="/page/pageResponse/interfaceOptions/option[@name='servlet_protocol']/@value"/></gsf:variable>
|
---|
| 232 | <gsf:div id="g_id_onload"
|
---|
| 233 | data-client_id="{$googlesignin_client_id}"
|
---|
| 234 | data-ux_mode="redirect">
|
---|
| 235 | <xsl:attribute name="data-login_uri">
|
---|
| 236 | <xsl:call-template name="generateGoogleIdentityLoginURL">
|
---|
| 237 | <xsl:with-param name="servletProtocol" select="$servletProtocol"></xsl:with-param>
|
---|
| 238 | <!--<xsl:with-param name="baseURL" select="$baseURL"></xsl:with-param>-->
|
---|
| 239 | <xsl:with-param name="baseURL" select="$base-href"></xsl:with-param>
|
---|
| 240 | <!--<xsl:with-param name="redirectURL" select="$redirectURL"></xsl:with-param> -->
|
---|
| 241 | <xsl:with-param name="redirectURL" select="$action-url"></xsl:with-param>
|
---|
| 242 | </xsl:call-template>
|
---|
| 243 |
|
---|
| 244 | </xsl:attribute>
|
---|
| 245 |
|
---|
| 246 |
|
---|
| 247 | </gsf:div>
|
---|
| 248 |
|
---|
| 249 | <gsf:div class="g_id_signin" data-type="standard"/>
|
---|
| 250 |
|
---|
| 251 | </td>
|
---|
| 252 | </tr>
|
---|
| 253 | </xsl:if>
|
---|
| 254 |
|
---|
| 255 | </table>
|
---|
| 256 | </form>
|
---|
| 257 |
|
---|
| 258 | <gsf:variable name="googleSigninClientId"><xsl:value-of select="/page/pageResponse/interfaceOptions/option[@name = 'googlesignin_client_id']/@value"/></gsf:variable>
|
---|
| 259 |
|
---|
| 260 | <gsf:script>
|
---|
| 261 |
|
---|
| 262 | function decodeJwtResponse(jwt) {
|
---|
| 263 | // Split the JWT into its three parts
|
---|
| 264 | var parts = jwt.split('.');
|
---|
| 265 |
|
---|
| 266 | // Decode the header and payload parts using base64
|
---|
| 267 | var header = JSON.parse(atob(parts[0]));
|
---|
| 268 | var payload = JSON.parse(atob(parts[1]));
|
---|
| 269 |
|
---|
| 270 | return payload;
|
---|
| 271 |
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | function googleSigninHandleCredentialResponseUNUSED(response)
|
---|
| 275 | {
|
---|
[37628] | 276 | //console.log("onGoogleSignin() called");
|
---|
[37627] | 277 |
|
---|
| 278 | const responsePayload = decodeJwtResponse(response.credential);
|
---|
| 279 |
|
---|
[37628] | 280 | //console.log("ID: " + responsePayload.sub);
|
---|
| 281 | //console.log('Full Name: ' + responsePayload.name);
|
---|
| 282 | //console.log('Given Name: ' + responsePayload.given_name);
|
---|
| 283 | //console.log('Family Name: ' + responsePayload.family_name);
|
---|
| 284 | //console.log("Image URL: " + responsePayload.picture);
|
---|
| 285 | //console.log("Email: " + responsePayload.email);
|
---|
| 286 | //console.log("Email verified: " + responsePayload.email_verified);
|
---|
[37627] | 287 |
|
---|
| 288 |
|
---|
| 289 | var google_fullname = responsePayload.name;
|
---|
| 290 | console.log('Google-authenicated login as: ' + google_fullname);
|
---|
| 291 |
|
---|
| 292 | }
|
---|
| 293 |
|
---|
| 294 | $(document).ready(function() {
|
---|
| 295 | $("#loginTable input[name=\"username\"]").focus();
|
---|
[37703] | 296 | })
|
---|
[37627] | 297 | </gsf:script>
|
---|
| 298 |
|
---|
| 299 | </xsl:template>
|
---|
| 300 |
|
---|
[26366] | 301 | </xsl:stylesheet>
|
---|