diff options
author | Leif Johansson <leifj@sunet.se> | 2011-11-03 10:53:40 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-11-03 10:53:40 +0100 |
commit | b5c41b83249677bf1dec46de4a7ce97fee55729e (patch) | |
tree | 5e894d0a4b132f41a38a7004e8f65d40dcf037be /src/main/webapp | |
parent | 0a90384a9c7d840e88d9636271e8393a514647a0 (diff) |
import 1.1.31.1.3
Diffstat (limited to 'src/main/webapp')
-rwxr-xr-x | src/main/webapp/Suggest.js | 362 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/WEB-INF/tlds/struts-bean.tld | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/WEB-INF/tlds/struts-logic.tld | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/WEB-INF/web.xml | 97 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/images/incommon.gif | bin | 975 -> 975 bytes | |||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/images/internet2.gif | bin | 1204 -> 1204 bytes | |||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/images/logo.jpg | bin | 13660 -> 13660 bytes | |||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/index.htm | 0 | ||||
-rwxr-xr-x | src/main/webapp/static.html | 163 | ||||
-rwxr-xr-x | src/main/webapp/static2.html | 160 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/wayf.css | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/wayf.jsp | 125 | ||||
-rwxr-xr-x[-rw-r--r--] | src/main/webapp/wayferror.jsp | 4 |
13 files changed, 864 insertions, 65 deletions
diff --git a/src/main/webapp/Suggest.js b/src/main/webapp/Suggest.js new file mode 100755 index 0000000..537064b --- /dev/null +++ b/src/main/webapp/Suggest.js @@ -0,0 +1,362 @@ +function TypeAheadControl(list, box, orig, submit, optype, ie6hack) +{ + // + // Squirrel away the parameters we were given + // + this.elementList = list; + this.textBox = box; + this.origin = orig; + this.submit = submit; + this.optype = optype; + this.results = 0; + // + // Change these as needed + // + this.maxResults = 10; // How many to show + this.alwaysShowResult = true; // Show dropdown even if there are more that ,axResult results + this.ie6hack = ie6hack; + var myThis = this; + + // + // Setup the lowercase names + // + var i = 0; + while (i < list.length) { + if (null == list[i]) { + list.length = i; + break; + } + list[i][2] = list[i][0].toLowerCase(); + i++; + } + // + // Set up the 'dropDown' + // + this.dropDown = document.createElement('div'); + this.dropDown.className = 'dropdown'; + this.dropDown.style.visibility = 'hidden'; + this.dropDown.style.width = box.offsetWidth; + this.dropDown.current = -1; + document.body.appendChild(this.dropDown); + + // + // mouse listeners for the dropdown box + // + this.dropDown.onmouseover = function(event) { + if (!event) { + event = window.event; + } + target = event.target; + if (!target) { + target = event.srcElement; + } + myThis.select(target); + } + + this.dropDown.onmousedown = function(event) { + if (-1 != myThis.dropDown.current) { + myThis.textBox.value = myThis.results[myThis.dropDown.current][0]; + } + } + + // + // Add the listeners to the text box + // + this.textBox.onkeyup = function(event) { + // + // get window even if needed (because of browser oddities) + // + if (!event) { + event = window.event; + } + myThis.handleKeyUp(event); + }; + + this.textBox.onkeydown = function(event) { + if (!event) { + event = window.event; + } + + myThis.handleKeyDown(event); + }; + + this.textBox.onblur = function() { + myThis.hideDrop(); + }; + + this.textBox.onfocus = function() { + myThis.handleChange(); + }; + +}; +// +// Given a name return the first maxresults, or all possibles +// +TypeAheadControl.prototype.getPossible = function(name) { + var possibles = []; + var inIndex = 0; + var outIndex = 0; + name = name.toLowerCase(); + var strIndex = 0; + var str; + var ostr; + + while (outIndex <= this.maxResults && inIndex < this.elementList.length) { + strIndex = this.elementList[inIndex][2].indexOf(name); + if (-1 != strIndex) { + // + // a hit + // + str = this.elementList[inIndex][0]; + possibles[outIndex] = new Array(str, this.elementList[inIndex][1]); + outIndex ++; + } else { + // + // Check entityId + strIndex = this.elementList[inIndex][1].indexOf(name); + if (-1 != strIndex) { + // + // a hit + // + str = this.elementList[inIndex][0]; + possibles[outIndex] = new Array(str, this.elementList[inIndex][1]); + outIndex ++; + } + } + inIndex ++; + } + // + // reset the cursor to the top + // + this.dropDown.current = -1; + + return possibles; +}; + +TypeAheadControl.prototype.handleKeyUp = function(event) { + var key = event.keyCode; + + if (27 == key) { + // + // Escape - clear + // + this.textBox.value = ''; + this.handleChange(); + } else if (8 == key || 32 == key || (key >= 46 && key < 112) || key > 123) { + // + // Backspace, Space and >=Del to <F1 and > F12 + // + this.handleChange(); + } +}; + +TypeAheadControl.prototype.handleKeyDown = function(event) { + + var key = event.keyCode; + + if (38 == key) { + // + // up arrow + // + this.upSelect(); + + } else if (40 == key) { + // + // down arrow + // + this.downSelect(); + } +}; + +TypeAheadControl.prototype.hideDrop = function() { + var i = 0; + if (null != this.ie6hack) { + while (i < this.ie6hack.length) { + this.ie6hack[i].style.visibility = 'visible'; + i++; + } + } + this.dropDown.style.visibility = 'hidden'; + if (-1 == this.dropDown.current) { + this.doUnselected(); + } +}; + +TypeAheadControl.prototype.showDrop = function() { + var i = 0; + if (null != this.ie6hack) { + while (i < this.ie6hack.length) { + this.ie6hack[i].style.visibility = 'hidden'; + i++; + } + } + this.dropDown.style.visibility = 'visible'; +}; + + +TypeAheadControl.prototype.doSelected = function() { + this.submit.value='Select'; + this.optype.value = 'selection'; +}; + +TypeAheadControl.prototype.doUnselected = function() { + this.submit.value='Search'; + + this.optype.value = 'search'; +}; + +TypeAheadControl.prototype.handleChange = function() { + + var val = this.textBox.value; + var res = this.getPossible(val); + + if (0 == val.length || + 0 == res.length || + (!this.alwaysShowResult && this.maxResults < res.length)) { + this.hideDrop(); + this.doUnselected(); + this.results = []; + this.dropDown.current = -1; + } else { + this.results = res; + this.populateDropDown(res); + if (1 == res.length) { + this.select(this.dropDown.childNodes[0]); + this.doSelected(); + } else { + this.doUnselected(); + } + } +}; + +// +// A lot of the stuff below comes from +// http://www.webreference.com/programming/javascript/ncz/column2 +// +// With thanks to Nicholas C Zakas +// +TypeAheadControl.prototype.populateDropDown = function(list) { + this.dropDown.innerHTML = ''; + var i = 0; + var div; + while (i < list.length) { + div = document.createElement('div'); + div.appendChild(document.createTextNode(list[i][0])); +// div.style.zIndex = '1000'; + this.dropDown.appendChild(div); + i++; + } + var off = this.getXY(); + this.dropDown.style.left = off[0] + 'px'; + this.dropDown.style.top = off[1] + 'px'; + this.showDrop(); +}; + +TypeAheadControl.prototype.getXY = function() { + + var node = this.textBox; + var sumX = 0; + var sumY = node.offsetHeight; + + while(node.tagName != 'BODY') { + sumX += node.offsetLeft; + sumY += node.offsetTop; + node = node.offsetParent; + } + // + // And add in the offset for the Body + // + sumX += node.offsetLeft; + sumY += node.offsetTop; + + return [sumX, sumY]; +}; + +TypeAheadControl.prototype.select = function(selected) { + var i = 0; + var node; + this.dropDown.current = -1; + this.doUnselected(); + while (i < this.dropDown.childNodes.length) { + node = this.dropDown.childNodes[i]; + if (node == selected) { + // + // Highlight it + // + node.className = 'current'; + // + // turn on the button + // + this.doSelected(); + // + // setup the cursor + // + this.dropDown.current = i; + // + // and the value for the Server + // + this.origin.value = this.results[i][1]; + this.origin.textValue = this.results[i][0]; + } else { + node.className = ''; + } + i++; + } + this.textBox.focus(); +}; + +TypeAheadControl.prototype.downSelect = function() { + if (this.results.length > 0) { + + if (-1 == this.dropDown.current) { + // + // mimic a select() + // + this.dropDown.current = 0; + this.dropDown.childNodes[0].className = 'current'; + this.doSelected(); + this.origin.value = this.results[0][1]; + this.origin.textValue = this.results[0][0]; + + } else if (this.dropDown.current < (this.results.length-1)) { + // + // turn off highlight + // + this.dropDown.childNodes[this.dropDown.current].className = ''; + // + // move cursor + // + this.dropDown.current++; + // + // and 'select' + // + this.dropDown.childNodes[this.dropDown.current].className = 'current'; + this.doSelected(); + this.origin.value = this.results[this.dropDown.current][1]; + this.origin.textValue = this.results[this.dropDown.current][0]; + } + } +}; + + +TypeAheadControl.prototype.upSelect = function() { + if ((this.results.length > 0) && + (this.dropDown.current > 0)) { + + // + // turn off highlight + // + this.dropDown.childNodes[this.dropDown.current].className = ''; + // + // move cursor + // + this.dropDown.current--; + // + // and 'select' + // + this.dropDown.childNodes[this.dropDown.current].className = 'current'; + this.doSelected(); + this.origin.value = this.results[this.dropDown.current][1]; + this.origin.textValue = this.results[this.dropDown.current][0]; + } +};
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/tlds/struts-bean.tld b/src/main/webapp/WEB-INF/tlds/struts-bean.tld index 7e95a46..7e95a46 100644..100755 --- a/src/main/webapp/WEB-INF/tlds/struts-bean.tld +++ b/src/main/webapp/WEB-INF/tlds/struts-bean.tld diff --git a/src/main/webapp/WEB-INF/tlds/struts-logic.tld b/src/main/webapp/WEB-INF/tlds/struts-logic.tld index fe638ae..fe638ae 100644..100755 --- a/src/main/webapp/WEB-INF/tlds/struts-logic.tld +++ b/src/main/webapp/WEB-INF/tlds/struts-logic.tld diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index c938b16..ef5f00e 100644..100755 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -1,55 +1,50 @@ -<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app
- PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
-
-<web-app>
-
- <servlet>
- <servlet-name>WAYF</servlet-name>
- <display-name>Shibboleth WAYF Service</display-name>
- <servlet-class>edu.internet2.middleware.shibboleth.wayf.WayfService</servlet-class>
- <init-param>
- <param-name>WAYFConfigFileLocation</param-name>
- <param-value>$DS_HOME$/conf/wayfconfig.xml</param-value>
- </init-param>
- <init-param>
- <param-name>WAYFLogConfig</param-name>
- <param-value>$DS_HOME$/conf/logging.xml</param-value>
+<?xml version="1.0" encoding="UTF-8"?> +<web-app> + + <servlet> + <servlet-name>WAYF</servlet-name> + <display-name>Shibboleth WAYF Service</display-name> + <servlet-class>edu.internet2.middleware.shibboleth.wayf.WayfService</servlet-class> + <init-param> + <param-name>WAYFConfigFileLocation</param-name> + <param-value>$DS_HOME$/conf/wayfconfig.xml</param-value> + </init-param> + <init-param> + <param-name>WAYFLogConfig</param-name> + <param-value>$DS_HOME$/conf/logging.xml</param-value> </init-param> <init-param> <param-name>WAYFLogConfigPollFrequency</param-name> <param-value>300000</param-value> - </init-param>
- </servlet>
-
-<!-- We specify two mappings - old style http:/host/shibboleth-wayf/WAYF/ and the new style
- whereby the precise name influences the behavior. See the configuration file for
- examples -->
-
- <servlet-mapping>
- <servlet-name>WAYF</servlet-name>
- <url-pattern>/WAYF</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>WAYF</servlet-name>
- <url-pattern>*.wayf</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>WAYF</servlet-name>
- <url-pattern>/DS</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>WAYF</servlet-name>
- <url-pattern>*.ds</url-pattern>
- </servlet-mapping>
-
- <mime-mapping>
- <extension>css</extension>
- <mime-type>text/css</mime-type>
- </mime-mapping>
-</web-app>
+ </init-param> + </servlet> + +<!-- We specify two mappings - old style http:/host/shibboleth-wayf/WAYF/ and the new style + whereby the precise name influences the behavior. See the configuration file for + examples --> + + <servlet-mapping> + <servlet-name>WAYF</servlet-name> + <url-pattern>/WAYF</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>WAYF</servlet-name> + <url-pattern>*.wayf</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>WAYF</servlet-name> + <url-pattern>/DS</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>WAYF</servlet-name> + <url-pattern>*.ds</url-pattern> + </servlet-mapping> + + <mime-mapping> + <extension>css</extension> + <mime-type>text/css</mime-type> + </mime-mapping> +</web-app> diff --git a/src/main/webapp/images/incommon.gif b/src/main/webapp/images/incommon.gif Binary files differindex 01949cf..01949cf 100644..100755 --- a/src/main/webapp/images/incommon.gif +++ b/src/main/webapp/images/incommon.gif diff --git a/src/main/webapp/images/internet2.gif b/src/main/webapp/images/internet2.gif Binary files differindex 74ecbcb..74ecbcb 100644..100755 --- a/src/main/webapp/images/internet2.gif +++ b/src/main/webapp/images/internet2.gif diff --git a/src/main/webapp/images/logo.jpg b/src/main/webapp/images/logo.jpg Binary files differindex c021e7f..c021e7f 100644..100755 --- a/src/main/webapp/images/logo.jpg +++ b/src/main/webapp/images/logo.jpg diff --git a/src/main/webapp/index.htm b/src/main/webapp/index.htm index 8825d6d..8825d6d 100644..100755 --- a/src/main/webapp/index.htm +++ b/src/main/webapp/index.htm diff --git a/src/main/webapp/static.html b/src/main/webapp/static.html new file mode 100755 index 0000000..c35b8a3 --- /dev/null +++ b/src/main/webapp/static.html @@ -0,0 +1,163 @@ +<HTML> +<!-- Collect Stylesheet from the DS - this is needed for the autosuggest stuff --> +<link rel="stylesheet" title="normal" type="text/css" + href="static.css" /> +<title>Static Discovery Service with centralised hinting</title> +<Body> +<p> +This is a boring, but static web page which shows how an signle SP can +configure their own "Discovery Service" without recouse to a Java +Container but taking full advantage of the centralised cookie server +in the Federation Discovery Service. +</p> +<p>This is not meant to be pretty - it is meant to be easy for SP's +(who understand HTML) to understand and develop. It is however +targetted at a single SP. Sites running multiple SPs and wanting a +single Discovery will still need to deploy a real DS, or deploy this +as an embedded wayf on each SP. +</p> +<p> +There is obviously plenty of room for adding all the visual sugar and +branding that we want at the three levels</p> +<ul> +<li>A World Wide "This is a Discovery" look and feel</li> +<li>A Federation branding</li> +<li>"Corporate" Branding</li> +</ul> + +<p>Just for fun, this Discovery service points to the I2Wiki, a Shib 2 +SP (and so with an easier configuration). To make things even more +fun it has access to metadata (mostly statically loaded) for 6 +Federations. (UK, InCommon, MAMS, Switch AcoNet and Renater)</p> + +<!-- This is where the real lifting starts. We start with a +placemarker where the previously visit --> + +<div id="Hints"> </div> + +<h3>Enter Organization Name</h3> + +<!-- The below is for a Shib2 SP. + +In order to make the changes you need two know four things + +1) The EntityID of your SP. + + In this case "https://sh2testsp1.iay.org.uk/shibboleth" + +2) The return address for the disocvery protocol. Dpending on how you + configure your sessioninitiators this may include other garnish (like + &target=cookie) + + In this case "https://sh2testsp1.iay.org.uk/Shibboleth.sso/DS" + +3) The address of the Servlet running the centralized DS + + In this case "https://dlib-adidp.ucs.ed.ac.uk/" + +4) The name of the JS and Browser discovery services ("discovery/i2full.wayf" + and "discovery/jsfull.wayf" respectively. + +You then need to plug them into the form below: + +--> + +<form autocomplete="OFF" action="https://dlib-adidp.ucs.ed.ac.uk/discovery/i2full.wayf"> +<!-- This is where your entity goes --> +<input type="hidden" name="entityID" value="https://sh2testsp1.iay.org.uk/shibboleth" /> +<!-- and your potentially garnished return address --> +<input type="hidden" name="returnX" value="https://sh2testsp1.iay.org.uk/Shibboleth.sso/DS" /> +<!-- the rest is fixed --> +<input type="hidden" name="returnIDParam" value="entityID" /> +<input type="hidden" name="action" value="search" id="selectOrSearch" /> +<input type="hidden" name="cache" value="perm" /> +<input type="hidden" name="origin" value="unspec" id="enterOrigin"/> +<table border="0" cellpadding="0" cellspacing="0" width="400pr"> + <tr> + <td> + <input type="text" name="string" value="" id="enterText" tabindex="50" size="54" /> + </td><td align="right"> + <input type="submit" id="enterSubmit" value="Search"/> + </td> + </tr> +</table> +</form> +<noscript> +<!-- Fallback to Shibboleth DS session initiator for non-JavaScript users. + You construct the URL using the values above --> +<p> +Your browser is not javascript enabled. Go to the Discovery Service <a href="https://dlib-adidp.ucs.ed.ac.uk/discovery/i2full.wayf?entityID=https://spaces.internet2.edu/shibboleth&return=https://spaces.internet2.edu/Shibboleth.sso/Login">here</a> +</p> +</noscript> +<h3>Configuring</h3> + +Details on how to set this up this are embedded as comments in this +web page. Currently a lot of the configuration is manual. Future +versions will be as automatic as possible and the only configuration +required will be the link which is displayed when there is not +javascript enabled. + + +<script language="javascript" + type="text/javascript" + src="https://dlib-adidp.ucs.ed.ac.uk/discovery/jsfull.wayf?entityID=https://spaces.internet2.edu/shibboleth&return=https://spaces.internet2.edu/Shibboleth.sso/Login"> + </script> + +<!-- Collect the autosuggest code --> + +<script language="javascript" + type="text/javascript" + src="https://dlib-adidp.ucs.ed.ac.uk/discovery/Suggest.js"> +</script> + +<!-- And some code to set up the rest of the page. You need to plug the DS base address in below --> + +<script language="javascript" + type="text/javascript"> + +<!-- +window.onload = function() { + + var wayfAddress="https://dlib-adidp.ucs.ed.ac.uk/"; + var i = 0; + var hints = document.getElementById("Hints"); + + // + // Make the hints visible + // + if (theHints.length > 1) { + var h3 = document.createElement("h3"); + h3.innerHTML+="Previously visited sites"; + hints.appendChild(h3); + } + + // + // And populate them + // + while (i < theHints.length) { + var a = document.createElement("a"); + a.href = wayfAddress + theHints[i][0]; + a.innerHTML += theHints[i][1]; + hints.appendChild(a); + hints.appendChild(document.createElement("p")); + i++; + } + + // + // And set up the autohint. NOTE you can set up you own + // site list by providing your own 2 dimensional array + // instead of "theElements" below. + // + var ie6Hack = [ ]; + var control = new TypeAheadControl(theElements, + document.getElementById("enterText"), + document.getElementById("enterOrigin"), + document.getElementById("enterSubmit"), + document.getElementById("selectOrSearch"), + ie6Hack); + document.getElementById("enterText").focus(); +} +--> +</script> +</body> +</html>
\ No newline at end of file diff --git a/src/main/webapp/static2.html b/src/main/webapp/static2.html new file mode 100755 index 0000000..470b099 --- /dev/null +++ b/src/main/webapp/static2.html @@ -0,0 +1,160 @@ +<HTML> +<!-- Collect Stylesheet from the DS - this is needed for the autosuggest stuff --> +<link rel="stylesheet" title="normal" type="text/css" + href="static.css" /> +<title>Static Discovery Service with centralised hinting</title> +<Body> +<p> +This is a boring, but static web page which shows how an signle SP can +configure their own "Discovery Service" without recouse to a Java +Container but taking full advantage of the centralised cookie server +in the Federation Discovery Service. +</p> +<p> +This DS points at a test SP in the UK Federation, and uses the +Shib/SAML1 protocol. It is a lot harder to configure (a lot like +setting up one a "WAYFless URLS". Consider it motivation to upgrade +from SAML1 to SAML2... +</p> + +<!-- This is where the real lifting starts. We start with a placemarker where the previously visit --> +<div id="Hints"> +</div> +<h3>Enter Organization Name</h3> + +<!-- The below is for a Shib2 SP. + +In order to make the changes you need two know five things + +1) The EntityID of your SP. + + In this case "https://sh2testsp1.iay.org.uk/shibboleth" + +2) The return address for the login. Dpending on how you + configure your sessioninitiators this may include other garnish (like + &target=cookie) + + In this case "https://sh2testsp1.iay.org.uk/Shibboleth.sso/DS" + +3) The "shire" (the protocol return address) + + In this case "https://sh2testsp1.iay.org.uk/Shibboleth.sso/SAML/POST" + +4) The address of the Servlet running the centralized DS + + In this case "https://sh2testsp1.iay.org.uk/secure/printenv.cgi" + +5) The name of the JS and Browser discovery services ("discovery/i2.wayf" + and "discovery/js.wayf" respectively. + +You then need to plug them into the form below: + + +--> +<form autocomplete="OFF" action="https://dlib-adidp.ucs.ed.ac.uk/discovery/i2.wayf"> +<!-- This is where your entity goes --> +<input type="hidden" name="providerId" value="https://sh2testsp1.iay.org.uk/shibboleth" /> +<!-- and your potentially garnished return address --> +<input type="hidden" name="target" value="https://sh2testsp1.iay.org.uk/secure/printenv.cgi" /> +<!-- and the "Shire" --> +<input type="hidden" name="shire" value="https://sh2testsp1.iay.org.uk/Shibboleth.sso/SAML/POST" /> + +<!-- the rest is fixed --> +<input type="hidden" name="action" value="search" id="selectOrSearch" /> +<input type="hidden" name="cache" value="perm" /> +<input type="hidden" name="origin" value="unspec" id="enterOrigin"/> +<table border="0" cellpadding="0" cellspacing="0" width="400pr"> + <tr> + <td> + <input type="text" name="string" value="" id="enterText" tabindex="50" size="54" /> + </td><td align="right"> + <input type="submit" id="enterSubmit" value="Search"/> + </td> + </tr> +</table> +</form> +<noscript> +<!-- Fallback to Shibboleth DS session initiator for non-JavaScript users. + You construct the URL using the values above --> +<p> +Your browser is not javascript enabled. Go to the Discovery Service <a href="https://dlib-adidp.ucs.ed.ac.uk/discovery/i2.wayf?entityID=https://spaces.internet2.edu/shibboleth&return=https://spaces.internet2.edu/Shibboleth.sso/Login">here</a> +</p> +</noscript> + + +<h3>Configuring</h3> + +Details on how to set this up this are embedded as comments in this +web page. Currently a lot of the configuration is manual. Although +it would be feasible to automate this just as is planned for Shib2 +SPs, the duplication seems needless given that the product has a 9 +month shelf life. + + + + +<!-- Collect the hints and the IdP list --> + +<script language="javascript" + type="text/javascript" + src="https://dlib-adidp.ucs.ed.ac.uk/discovery/js.wayf?shire=https%3A%2F%2Fsh2testsp1.iay.org.uk%2FShibboleth.sso%2FSAML%2FPOST&time=1249284798&target=https%3A%2F%2Fsh2testsp1.iay.org.uk%2Fsecure%2Fprintenv.cgi&providerId=https%3A%2F%2Fsh2testsp1.iay.org.uk%2Fshibboleth" +</script> + +<!-- Collect the autosuggest code --> + +<script language="javascript" + type="text/javascript" + src="https://dlib-adidp.ucs.ed.ac.uk/discovery/Suggest.js"> +</script> + +<!-- And some code to set up the rest of the page. You need to plug the DS base address in below --> + +<script language="javascript" + type="text/javascript"> + +<!-- +window.onload = function() { + + var wayfAddress="https://dlib-adidp.ucs.ed.ac.uk/"; + var i = 0; + var hints = document.getElementById("Hints"); + + // + // Make the hints visible + // + if (theHints.length > 1) { + var h3 = document.createElement("h3"); + h3.innerHTML+="Previously visited sites"; + hints.appendChild(h3); + } + + // + // And populate them + // + while (i < theHints.length) { + var a = document.createElement("a"); + a.href = wayfAddress + theHints[i][0]; + a.innerHTML += theHints[i][1]; + hints.appendChild(a); + hints.appendChild(document.createElement("p")); + i++; + } + + // + // And set up the autohint + // + var ie6Hack = [ ]; + var control = new TypeAheadControl(theElements, + document.getElementById("enterText"), + document.getElementById("enterOrigin"), + document.getElementById("enterSubmit"), + document.getElementById("selectOrSearch"), + ie6Hack); + document.getElementById("enterText").focus(); + + +} +--> +</script> +</body> +</html>
\ No newline at end of file diff --git a/src/main/webapp/wayf.css b/src/main/webapp/wayf.css index 4056aa3..0eeb26c 100644..100755 --- a/src/main/webapp/wayf.css +++ b/src/main/webapp/wayf.css @@ -102,3 +102,21 @@ span.warning { text-align: center; margin-top: 1.5em; } + +div.dropdown { + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 1px solid black; + position: absolute; +} + +div.dropdown div { + background-color: white; + cursor: default; + padding: 0px 3px; +} + +div.dropdown div.current { + background-color: #3366cc; + color: white; +} diff --git a/src/main/webapp/wayf.jsp b/src/main/webapp/wayf.jsp index 74ba11d..12d72da 100644..100755 --- a/src/main/webapp/wayf.jsp +++ b/src/main/webapp/wayf.jsp @@ -2,6 +2,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <%@ page contentType="text/html;charset=UTF-8" %> +<%@ page language="java" import="java.util.*,edu.internet2.middleware.shibboleth.wayf.*,java.lang.*" %> <html> <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> @@ -123,6 +124,7 @@ 10 - Recently used sites hyperlinks 20 - <clear button for above> + 25 - AutoSuggestion 30 Federation selection 40 IdP within Selection 50 Select button @@ -158,15 +160,14 @@ Select an identity provider <!--CONFIG--> The Service you are trying to reach requires that you -authenticate with your home institution, please select it from the -list below. +authenticate with your home organization, enter the name below. </p> <logic:present name="cookieList" scope="request"> <h2> -Recently used institutions: +Recently used organizations: </h2> @@ -178,6 +179,7 @@ Recently used institutions: simulating the user having specified a permanent cookie --> </logic:present> + <logic:iterate id="site" name="cookieList"> <p class="text"> <logic:present name="entityID" scope="request"> @@ -186,7 +188,8 @@ Recently used institutions: <bean:define id="ei" name="entityID" /> <bean:define id="re" name="returnX"/> - <a tabindex="10" href="<bean:write name="requestURL" />?entityID=<%= java.net.URLEncoder.encode(ei.toString(), "utf-8") %>&return=<%= java.net.URLEncoder.encode(re.toString(), "utf-8") %>&returnIDxParam=<%= java.net.URLEncoder.encode( returnIDParam.toString(), "utf-8" ) %>&cache=perm&action=selection&origin=<jsp:getProperty name="site" property="name" />"> + <a tabindex="10" href="<bean:write name="requestURL" />?entityID=<%= java.net.URLEncoder.encode(ei.toString(), "utf-8") %>&return=<%= java.net.URLEncoder.encode(re.toString(), "utf-8") %>&returnIDxParam=<%= java.net.URLEncoder.encode( returnIDParam.toString(), "utf-8" ) %>&cache=perm&action=selection&origin=<%=java.net.URLEncoder.encode(((IdPSite)site).getName())%> +"> <jsp:getProperty name="site" property="displayName" /> </a> </logic:present> @@ -194,7 +197,7 @@ Recently used institutions: <bean:define id="targ" name="target" /> <bean:define id="shire" name="shire" /> <bean:define id="pid" name="providerId" /> - <a tabindex="10" href="<bean:write name="requestURL" />?target=<%= java.net.URLEncoder.encode(targ.toString(),"utf-8") %>&shire=<%= java.net.URLEncoder.encode(shire.toString(),"utf-8") %>&providerId=<%= java.net.URLEncoder.encode(pid.toString(),"utf-8") %>&time=<bean:write name="time" />&cache=perm&action=selection&origin=<jsp:getProperty name="site" property="name" />"> + <a tabindex="10" href="<bean:write name="requestURL" />?target=<%= java.net.URLEncoder.encode(targ.toString(),"utf-8") %>&shire=<%= java.net.URLEncoder.encode(shire.toString(),"utf-8") %>&providerId=<%= java.net.URLEncoder.encode(pid.toString(),"utf-8") %>&time=<bean:write name="time" />&cache=perm&action=selection&origin=<%=java.net.URLEncoder.encode(((IdPSite)site).getName())%> <jsp:getProperty name="site" property="displayName" /> </a> @@ -230,13 +233,54 @@ Recently used institutions: </div> </form> - </logic:present> + </logic:present> <!-- Previous Selections --> - <div class="list"> +<logic:present name="showComments" scope="Request"> + +<!-- PROGRAMMING NOTE + + Add the "instant search" dialogue. + +</logic:present> + <div class="list"> + <logic:present name="sites" scope="request"> + <h2> + Enter institution name: + </h2> + <form autocomplete="OFF" action=""> + <div> + <logic:notPresent name="entityID" scope="request"> + <input type="hidden" name="shire" value="<bean:write name="shire" />" /> + <input type="hidden" name="target" value="<bean:write name="target" />" /> + <input type="hidden" name="providerId" value="<bean:write name="providerId" />" /> + <logic:present name="time" scope="request"> + <input type="hidden" name="time" value="<bean:write name="time" />" /> + </logic:present> + </logic:notPresent> + <logic:present name="entityID" scope="request"> + <input type="hidden" name="entityID" value="<bean:write name="entityID" />" /> + <input type="hidden" name="returnX" value="<bean:write name="returnX" />" /> + <input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" /> + </logic:present> + <input type="hidden" id="enterOrigin" name="origin" value="unspec" /> + <input type="hidden" id="enterType" name="action" value="search" /> + <input type="text" id="enterText" name="string" value="" tabindex="25" size="54"/> + <input type="submit" id="enterSubmit" value="Search"/> + <input type="hidden" name="cache" value="perm"/> + </div> + </form> + </logic:present> + <h2> -Choose from a list: +<logic:present name="showComments" scope="Request"> + +Provide a static drop down or a dynamically republished one. - you may wish to remove this code + +</logic:present> + +Or choose from a list: </h2> @@ -259,7 +303,7 @@ Choose from a list: <input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" /> </logic:present> <input type="hidden" name="action" value="selection" /> - <select name="origin" tabindex="40"> + <select name="origin" id="hackForie6" tabindex="40"> <logic:iterate id="site" name="sites"> <option value="<jsp:getProperty name="site" property="name" />"> <jsp:getProperty name="site" property="displayName" /> @@ -314,7 +358,7 @@ Choose from a list: <table id="tab"> <tr> <th>Federation </th> - <th>Institution</th> + <th>organization</th> </tr> <tr><td> <select name="FedSelector" size="10" id="FedSelect" tabindex="30" @@ -378,7 +422,14 @@ Choose from a list: </form> </logic:present> </div> + + <div class="search"> + +<logic:present name="showComments" scope="Request"> + +<!-- This is here for completeness - it shows the "old fashioned way" to do search --> + <span class="option">or</span> <h2> @@ -412,6 +463,9 @@ Search by keyword: </div> </form> +<!-- The end of the old code. Below is where search results go --> + +</logic:present> <logic:present name="searchResultsEmpty" scope="request"> <p class="error"> @@ -540,8 +594,55 @@ function changedFed(X, Selected) { --> </script> </logic:present> - + +<logic:present name="sites" scope="request"> + +<logic:present name="showComments" scope="Request"> + <!-- Load the autosuggest code. + + PROGRAMMING NOTE - the "ie6Hack" is to do with an issue in ie6 in which the + psuedo drop down floats below the real dropdown. The hack is that we jsut disable + the real drop down when the pseudo one is about. This can seem weird for some + layouts and so if you are not deploying against ie6 you can just send an + empty array. + --> +</logic:present> + <script language="javascript" type="text/javascript" src="Suggest.js"></script> + <script language="javascript" type="text/javascript"> +<!-- +window.onload = function() { + +<logic:notPresent name="siteLists" scope="request"> + var ie6Hack = [ document.getElementById("hackForie6")]; +</logic:notPresent> + +<logic:present name="siteLists" scope="request"> + var ie6Hack = [ document.getElementById("FedSelect"), document.getElementById("originIdp")]; +</logic:present> + var control = new TypeAheadControl(theElements, + document.getElementById("enterText"), + document.getElementById("enterOrigin"), + document.getElementById("enterSubmit"), + document.getElementById("enterType"), + ie6Hack); + + + document.getElementById("enterText").focus(); +} + + +var theElements = [ + <logic:iterate id="site" name="sites"> + ["<%= ((edu.internet2.middleware.shibboleth.wayf.IdPSite)site).getDisplayName().replace("\n","").toString() %>", + "<jsp:getProperty name="site" property="name" />"], + </logic:iterate> + ]; + +--> + </script> +</logic:present> + </body> </html> -
\ No newline at end of file + diff --git a/src/main/webapp/wayferror.jsp b/src/main/webapp/wayferror.jsp index a0cb29d..1fd564a 100644..100755 --- a/src/main/webapp/wayferror.jsp +++ b/src/main/webapp/wayferror.jsp @@ -25,12 +25,12 @@ <p>Please email <a href="mailto:user@domain"> administrator's name</a> and include the following error message:</p> <logic:notEmpty name="requestURL"> -<p class="error">WAYF failure at (<bean:write name="requestURL" />)</p> +<p class="error">Discovery Service failure at (<bean:write name="requestURL" />)</p> <p><bean:write name="errorText" /></p> </logic:notEmpty> <logic:empty name="requestURL"> -<p class="error">The DiscoveryService should not be called directly</p> +<p class="error">The Discovery Service should not be called directly</p> </logic:empty> |