version 1.555, 2007/07/28 21:38:29
|
version 1.556, 2007/07/30 00:31:28
|
Line 5617 sub user_picker {
|
Line 5617 sub user_picker {
|
} |
} |
$srchtypesel .= "\n </select>\n"; |
$srchtypesel .= "\n </select>\n"; |
|
|
|
my ($newuserscript,$newuservalidate); |
|
|
|
if ($forcenewuser) { |
|
$newuserscript = <<"ENDSCRIPT"; |
|
|
|
function setSearch() { |
|
var createnew = 0; |
|
for (var i=0; i<document.crtuser.forcenew.length; i++) { |
|
if (document.crtuser.forcenew[i].checked) { |
|
if (document.crtuser.forcenew[i].value == 1) { |
|
createnew = 1; |
|
} |
|
} |
|
} |
|
if (createnew == 1) { |
|
for (var i=0; i<document.crtuser.srchby.length; i++) { |
|
if (document.crtuser.srchby.options[i].value == 'uname') { |
|
document.crtuser.srchby.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchin.length; i++) { |
|
if (document.crtuser.srchin.options[i].value == 'dom') { |
|
document.crtuser.srchin.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
|
if (document.crtuser.srchtype.options[i].value == 'exact') { |
|
document.crtuser.srchtype.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchdomain.length; i++) { |
|
if (document.crtuser.srchdomain.options[i].value == '$env{'request.role.domain'}') { |
|
document.crtuser.srchdomain.selectedIndex = i; |
|
} |
|
} |
|
} |
|
} |
|
ENDSCRIPT |
|
$newuservalidate = <<"ENDBLOCK"; |
|
setSearch(); |
|
ENDBLOCK |
|
} |
|
|
my $output = <<"END_BLOCK"; |
my $output = <<"END_BLOCK"; |
|
<script type="text/javascript"> |
|
function validateEntry() { |
|
$newuservalidate |
|
var checkok = 1; |
|
var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; |
|
var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value; |
|
var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value; |
|
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; |
|
var srchterm = document.crtuser.srchterm.value; |
|
var msg = ""; |
|
|
|
if (srchterm == "") { |
|
checkok = 0; |
|
msg += "You must include some text to search for.\\n"; |
|
} |
|
|
|
if (srchtype== 'contains') { |
|
if (srchterm.length < 3) { |
|
checkok = 0; |
|
msg += "The text you are searching for must contain at least three characters when using a 'contained in' type search.\\n"; |
|
} |
|
} |
|
if (srchin == 'instd') { |
|
if (srchdomain == '') { |
|
checkok = 0; |
|
msg += "You must choose a domain when using an institutional directory search.\\n"; |
|
} |
|
} |
|
if (srchin == 'dom') { |
|
if (srchdomain == '') { |
|
checkok = 0; |
|
msg += "You must choose a domain when using a domain search.\\n"; |
|
} |
|
} |
|
if (srchby == 'lastfirst') { |
|
if (srchterm.indexOf(",") == -1) { |
|
checkok = 0; |
|
msg += "When using searching by last,first you must include a comma as separator between last name and first name.\\n"; |
|
} |
|
if (srchterm.indexOf(",") == srchterm.length -1) { |
|
checkok = 0; |
|
msg += "When searching by last,first you must include at least one character in the first name.\\n"; |
|
} |
|
} |
|
if (checkok == 0) { |
|
alert("The following need to be corrected before the search can be run:\\n"+msg); |
|
return; |
|
} |
|
if (checkok == 1) { |
|
document.crtuser.submit(); |
|
} |
|
} |
|
|
|
$newuserscript |
|
|
|
</script> |
<table> |
<table> |
<tr> |
<tr> |
<td align="right">$lt{'usr'}:</td><td><input type="text" size="15" name="srchterm" value="$srchterm" /></td> |
<td align="right">$lt{'usr'}:</td><td><input type="text" size="15" name="srchterm" value="$srchterm" /></td> |
Line 5646 END_BLOCK
|
Line 5745 END_BLOCK
|
return $output; |
return $output; |
} |
} |
|
|
|
|
|
|
=pod |
=pod |
|
|
=back |
=back |