summaryrefslogtreecommitdiff
path: root/src/main/webapp
diff options
context:
space:
mode:
authorroot <root@appliance.mnt.se>2011-07-25 20:14:02 +0200
committerroot <root@appliance.mnt.se>2011-07-25 20:14:02 +0200
commit3fc853cc1e861f455888a92ff0c9995270d2ba2c (patch)
treeb030abd6c28b314736faf6b4e6ecc830261943f4 /src/main/webapp
parentcb4806cb91b3ea6a01613bbfe68a9e04ed255578 (diff)
imported 1.1.2
Diffstat (limited to 'src/main/webapp')
-rw-r--r--src/main/webapp/Suggest.js146
-rw-r--r--src/main/webapp/wayf.jsp6
-rw-r--r--src/main/webapp/wayferror.jsp4
3 files changed, 75 insertions, 81 deletions
diff --git a/src/main/webapp/Suggest.js b/src/main/webapp/Suggest.js
index 6fd945c..2f17b93 100644
--- a/src/main/webapp/Suggest.js
+++ b/src/main/webapp/Suggest.js
@@ -1,8 +1,3 @@
-// function log(what)
-//{
-// document.getElementById("dbg").innerHTML += what ;
-//}
-
function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
{
//
@@ -31,11 +26,11 @@ function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
i++;
}
//
- // Set up the "dropDown"
+ // Set up the 'dropDown'
//
- this.dropDown = document.createElement("div");
- this.dropDown.className = "dropdown";
- this.dropDown.style.visibility = "hidden";
+ 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);
@@ -43,8 +38,7 @@ function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
//
// mouse listeners for the dropdown box
//
- this.dropDown.onmouseover = function(event)
- {
+ this.dropDown.onmouseover = function(event) {
if (!event) {
event = window.event;
}
@@ -55,8 +49,7 @@ function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
myThis.select(target);
}
- this.dropDown.onmousedown = function(event)
- {
+ this.dropDown.onmousedown = function(event) {
if (-1 != myThis.dropDown.current) {
myThis.textBox.value = myThis.results[myThis.dropDown.current][0];
}
@@ -67,13 +60,13 @@ function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
//
this.textBox.onkeyup = function(event) {
//
- // get window even if needed
+ // get window even if needed (because of browser oddities)
//
if (!event) {
event = window.event;
}
myThis.handleKeyUp(event);
- }
+ };
this.textBox.onkeydown = function(event) {
if (!event) {
@@ -81,22 +74,21 @@ function TypeAheadControl(list, box, orig, submit, optype, ie6hack)
}
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)
-{
+TypeAheadControl.prototype.getPossible = function(name) {
var possibles = [];
var inIndex = 0;
var outIndex = 0;
@@ -129,8 +121,13 @@ TypeAheadControl.prototype.getPossible = function(name)
}
inIndex ++;
}
+ //
+ // reset the cursor to the top
+ //
+ this.dropDown.current = -1;
+
return possibles;
-}
+};
TypeAheadControl.prototype.handleKeyUp = function(event) {
var key = event.keyCode;
@@ -139,7 +136,7 @@ TypeAheadControl.prototype.handleKeyUp = function(event) {
//
// Escape - clear
//
- this.textBox.value = "";
+ this.textBox.value = '';
this.handleChange();
} else if (8 == key || 32 == key || (key >= 46 && key < 112) || key > 123) {
//
@@ -147,7 +144,7 @@ TypeAheadControl.prototype.handleKeyUp = function(event) {
//
this.handleChange();
}
-}
+};
TypeAheadControl.prototype.handleKeyDown = function(event) {
@@ -165,46 +162,44 @@ TypeAheadControl.prototype.handleKeyDown = function(event) {
//
this.downSelect();
}
-}
+};
-TypeAheadControl.prototype.hideDrop = function()
-{
+TypeAheadControl.prototype.hideDrop = function() {
var i = 0;
if (null != this.ie6hack) {
while (i < this.ie6hack.length) {
- this.ie6hack[i].style.visibility = "visible";
+ this.ie6hack[i].style.visibility = 'visible';
i++;
}
}
- this.dropDown.style.visibility = "hidden";
- this.doUnselected();
-}
+ this.dropDown.style.visibility = 'hidden';
+ if (-1 == this.dropDown.current) {
+ this.doUnselected();
+ }
+};
-TypeAheadControl.prototype.showDrop = function()
-{
+TypeAheadControl.prototype.showDrop = function() {
var i = 0;
if (null != this.ie6hack) {
while (i < this.ie6hack.length) {
- this.ie6hack[i].style.visibility = "hidden";
+ this.ie6hack[i].style.visibility = 'hidden';
i++;
}
}
- this.dropDown.style.visibility = "visible";
-}
+ this.dropDown.style.visibility = 'visible';
+};
-TypeAheadControl.prototype.doSelected = function()
-{
- this.submit.value="Select";
- this.optype.value = "selection";
-}
+TypeAheadControl.prototype.doSelected = function() {
+ this.submit.value='Select';
+ this.optype.value = 'selection';
+};
-TypeAheadControl.prototype.doUnselected = function()
-{
- this.submit.value="Search";
+TypeAheadControl.prototype.doUnselected = function() {
+ this.submit.value='Search';
- this.optype.value = "search";
-}
+ this.optype.value = 'search';
+};
TypeAheadControl.prototype.handleChange = function() {
@@ -227,7 +222,7 @@ TypeAheadControl.prototype.handleChange = function() {
this.doUnselected();
}
}
-}
+};
//
// A lot of the stuff below comes from
@@ -235,32 +230,30 @@ TypeAheadControl.prototype.handleChange = function() {
//
// With thanks to Nicholas C Zakas
//
-TypeAheadControl.prototype.populateDropDown = function(list)
-{
- this.dropDown.innerHTML = "";
+TypeAheadControl.prototype.populateDropDown = function(list) {
+ this.dropDown.innerHTML = '';
var i = 0;
var div;
while (i < list.length) {
- div = document.createElement("div");
+ div = document.createElement('div');
div.appendChild(document.createTextNode(list[i][0]));
-// div.style.zIndex = "1000";
+// 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.dropDown.style.left = off[0] + 'px';
+ this.dropDown.style.top = off[1] + 'px';
this.showDrop();
-}
+};
-TypeAheadControl.prototype.getXY = function()
-{
+TypeAheadControl.prototype.getXY = function() {
var node = this.textBox;
var sumX = 0;
var sumY = node.offsetHeight;
- while(node.tagName != "BODY") {
+ while(node.tagName != 'BODY') {
sumX += node.offsetLeft;
sumY += node.offsetTop;
node = node.offsetParent;
@@ -272,10 +265,9 @@ TypeAheadControl.prototype.getXY = function()
sumY += node.offsetTop;
return [sumX, sumY];
-}
+};
-TypeAheadControl.prototype.select = function(selected)
-{
+TypeAheadControl.prototype.select = function(selected) {
var i = 0;
var node;
this.dropDown.current = -1;
@@ -286,7 +278,7 @@ TypeAheadControl.prototype.select = function(selected)
//
// Highlight it
//
- node.className = "current";
+ node.className = 'current';
//
// turn on the button
//
@@ -299,16 +291,16 @@ TypeAheadControl.prototype.select = function(selected)
// and the value for the Server
//
this.origin.value = this.results[i][1];
+ this.origin.textValue = this.results[i][0];
} else {
- node.className = "";
+ node.className = '';
}
i++;
}
this.textBox.focus();
};
-TypeAheadControl.prototype.downSelect = function()
-{
+TypeAheadControl.prototype.downSelect = function() {
if (this.results.length > 0) {
if (-1 == this.dropDown.current) {
@@ -316,48 +308,50 @@ TypeAheadControl.prototype.downSelect = function()
// mimic a select()
//
this.dropDown.current = 0;
- this.dropDown.childNodes[0].className = "current";
+ 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 = "";
+ this.dropDown.childNodes[this.dropDown.current].className = '';
//
// move cursor
//
this.dropDown.current++;
//
- // and "select"
+ // and 'select'
//
- this.dropDown.childNodes[this.dropDown.current].className = "current";
+ 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()
-{
+TypeAheadControl.prototype.upSelect = function() {
if ((this.results.length > 0) &&
(this.dropDown.current > 0)) {
//
// turn off highlight
//
- this.dropDown.childNodes[this.dropDown.current].className = "";
+ this.dropDown.childNodes[this.dropDown.current].className = '';
//
// move cursor
//
this.dropDown.current--;
//
- // and "select"
+ // and 'select'
//
- this.dropDown.childNodes[this.dropDown.current].className = "current";
+ 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
+}; \ No newline at end of file
diff --git a/src/main/webapp/wayf.jsp b/src/main/webapp/wayf.jsp
index 3a9e258..e30fc38 100644
--- a/src/main/webapp/wayf.jsp
+++ b/src/main/webapp/wayf.jsp
@@ -237,14 +237,14 @@ Recently used organizations:
<!-- PROGRAMMING NOTE
- Add the "instant serach" dialogue.
+ Add the "instant search" dialogue.
</logic:present>
<div class="list">
<logic:present name="sites" scope="request">
<h2>
- Enter insititution name:
+ Enter institution name:
</h2>
<form autocomplete="OFF" action="">
<div>
@@ -461,7 +461,7 @@ Search by keyword:
</div>
</form>
-<!-- The end of the old code. Below is where search results go 00>
+<!-- The end of the old code. Below is where search results go -->
</logic:present>
<logic:present name="searchResultsEmpty" scope="request">
diff --git a/src/main/webapp/wayferror.jsp b/src/main/webapp/wayferror.jsp
index a0cb29d..1fd564a 100644
--- 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>