version 1.556, 2007/07/30 00:31:28
|
version 1.560, 2007/08/11 14:22:14
|
Line 334 sub studentbrowser_javascript {
|
Line 334 sub studentbrowser_javascript {
|
return (<<'ENDSTDBRW'); |
return (<<'ENDSTDBRW'); |
<script type="text/javascript" language="Javascript" > |
<script type="text/javascript" language="Javascript" > |
var stdeditbrowser; |
var stdeditbrowser; |
function openstdbrowser(formname,uname,udom,roleflag) { |
function openstdbrowser(formname,uname,udom,roleflag,ignorefilter) { |
var url = '/adm/pickstudent?'; |
var url = '/adm/pickstudent?'; |
var filter; |
var filter; |
eval('filter=document.'+formname+'.'+uname+'.value;'); |
if (!ignorefilter) { |
|
eval('filter=document.'+formname+'.'+uname+'.value;'); |
|
} |
if (filter != null) { |
if (filter != null) { |
if (filter != '') { |
if (filter != '') { |
url += 'filter='+filter+'&'; |
url += 'filter='+filter+'&'; |
Line 365 sub selectstudent_link {
|
Line 367 sub selectstudent_link {
|
return ''; |
return ''; |
} |
} |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
'","'.$udomele.'");'."'>".&mt('Select User')."</a>"; |
'","'.$udomele.'","","1");'."'>".&mt('Select User')."</a>"; |
} |
} |
if ($env{'request.role'}=~/^(au|dc|su)/) { |
if ($env{'request.role'}=~/^(au|dc|su)/) { |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
Line 5555 sub user_picker {
|
Line 5557 sub user_picker {
|
} |
} |
$srchterm = $srch->{'srchterm'}; |
$srchterm = $srch->{'srchterm'}; |
} |
} |
|
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'usr' => 'Search for', |
'usr' => 'Search for', |
'or' => 'or', |
'or' => 'or', |
'in' => 'in', |
'doma' => 'domain', |
'doma' => 'domain', |
'uname' => 'username', |
'uname' => 'username', |
'lastname' => 'last name', |
'lastname' => 'last name', |
|
'lastfirst' => 'last name, first name', |
'lastfirst' => 'last name, first name', |
'crs' => 'this course', |
'crs' => 'in this course', |
'dom' => 'this domain', |
'dom' => 'in this domain', |
'alc' => 'all LON-CAPA', |
'alc' => 'all LON-CAPA', |
'instd' => 'institutional directory', |
'instd' => 'in institutional directory', |
'exact' => 'as exact match to', |
'exact' => 'is', |
'contains' => 'contained in', |
'contains' => 'contains', |
); |
); |
my $domform = &select_dom_form($currdom,'srchdomain',1); |
my $domform = &select_dom_form($currdom,'srchdomain',1); |
|
|
my $srchinsel = ' <select name="srchin">'; |
my $srchin; |
|
|
my @srchins = ('crs','dom','alc','instd'); |
my @srchins = ('crs','dom','alc','instd'); |
|
|
Line 5583 sub user_picker {
|
Line 5583 sub user_picker {
|
# has been completed. |
# has been completed. |
next if ($option eq 'alc'); |
next if ($option eq 'alc'); |
next if ($option eq 'crs' && !$env{'request.course.id'}); |
next if ($option eq 'crs' && !$env{'request.course.id'}); |
if ($curr_selected{'srchin'} eq $option) { |
my $checked =($curr_selected{'srchin'} eq $option) ?'checked="checked"' |
$srchinsel .= ' |
:''; |
<option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>'; |
my $extra = ($option eq 'dom') ? $domform |
} else { |
: ''; |
$srchinsel .= ' |
$srchin.=<<ROW |
<option value="'.$option.'">'.$lt{$option}.'</option>'; |
<tr> |
} |
<td> |
|
<label><input type="radio" name="srchin" value="$option" $checked /> $lt{$option}</label> $extra |
|
</td> |
|
</tr> |
|
ROW |
} |
} |
$srchinsel .= "\n </select>\n"; |
|
|
|
my $srchbysel = ' <select name="srchby">'; |
my $srchbysel = ' <select name="srchby">'; |
foreach my $option ('uname','lastname','lastfirst') { |
foreach my $option ('uname','lastname','lastfirst') { |
Line 5617 sub user_picker {
|
Line 5620 sub user_picker {
|
} |
} |
$srchtypesel .= "\n </select>\n"; |
$srchtypesel .= "\n </select>\n"; |
|
|
my ($newuserscript,$newuservalidate); |
my ($newuserscript,$new_user_create); |
|
|
if ($forcenewuser) { |
if ($forcenewuser) { |
|
$new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\');" /> </p>'; |
$newuserscript = <<"ENDSCRIPT"; |
$newuserscript = <<"ENDSCRIPT"; |
|
|
function setSearch() { |
function setSearch(createnew) { |
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) { |
if (createnew == 1) { |
for (var i=0; i<document.crtuser.srchby.length; i++) { |
for (var i=0; i<document.crtuser.srchby.length; i++) { |
if (document.crtuser.srchby.options[i].value == 'uname') { |
if (document.crtuser.srchby.options[i].value == 'uname') { |
Line 5638 function setSearch() {
|
Line 5634 function setSearch() {
|
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
if (document.crtuser.srchin.options[i].value == 'dom') { |
if ( document.crtuser.srchin[i].value == 'dom') { |
document.crtuser.srchin.selectedIndex = i; |
document.crtuser.srchin[i].checked = 1; |
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
Line 5655 function setSearch() {
|
Line 5651 function setSearch() {
|
} |
} |
} |
} |
ENDSCRIPT |
ENDSCRIPT |
$newuservalidate = <<"ENDBLOCK"; |
|
setSearch(); |
|
ENDBLOCK |
|
} |
} |
|
|
my $output = <<"END_BLOCK"; |
my $output = <<"END_BLOCK"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function validateEntry() { |
function validateEntry() { |
$newuservalidate |
|
var checkok = 1; |
var checkok = 1; |
var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; |
var srchin; |
|
for (var i=0; i<document.crtuser.srchin.length; i++) { |
|
if ( document.crtuser.srchin[i].checked ) { |
|
srchin = document.crtuser.srchin[i].value; |
|
} |
|
} |
|
|
var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.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 srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value; |
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; |
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; |
Line 5717 function validateEntry() {
|
Line 5717 function validateEntry() {
|
$newuserscript |
$newuserscript |
|
|
</script> |
</script> |
|
|
|
$new_user_create |
|
|
<table> |
<table> |
<tr> |
<tr> |
<td align="right">$lt{'usr'}:</td><td><input type="text" size="15" name="srchterm" value="$srchterm" /></td> |
<td> $srchbysel |
<td> |
$srchtypesel |
$srchtypesel |
<input type="text" size="15" name="srchterm" value="$srchterm" /> |
</td> |
</td> |
<td> |
</tr> |
$srchbysel |
$srchin |
</td> |
|
</tr> |
|
<tr> |
|
<td align="right">$lt{'in'}:</td> |
|
<td colspan="2"> |
|
$srchinsel |
|
</td> |
|
</tr> |
|
<tr> |
|
<td align="right">$lt{'doma'}:</td><td colspan="2">$domform</td> |
|
</tr> |
|
</table> |
</table> |
<br /> |
<br /> |
END_BLOCK |
END_BLOCK |
if ($forcenewuser) { |
|
$output .= '<span class="LC_nobreak">'.&mt('Make new user if no match found: ').'<input type="radio" name="forcenew" value="1" onclick="javascript:setSearch()" />'.&mt('Yes').' <input type="radio" name="forcenew" value="0" checked="checked" />'.&mt('No').'</span><br />'; |
|
} |
|
return $output; |
return $output; |
} |
} |
|
|
Line 6006 sub record_sep {
|
Line 5996 sub record_sep {
|
} else { |
} else { |
my @allfields; |
my @allfields; |
if ($env{'form.upfiletype'} eq 'semisv') { |
if ($env{'form.upfiletype'} eq 'semisv') { |
@allfields=split(/;/,$record,-1); |
@allfields=split(/\s*;\s*/,$record,-1); |
} else { |
} else { |
@allfields=split(/\,/,$record,-1); |
@allfields=split(/\s*\,\s*/,$record,-1); |
} |
} |
my $i=0; |
my $i=0; |
my $j; |
my $j; |