version 1.558, 2007/08/02 01:07:00
|
version 1.563, 2007/08/15 16:25:14
|
Line 1424 sub select_level_form {
|
Line 1424 sub select_level_form {
|
|
|
=pod |
=pod |
|
|
=item * select_dom_form($defdom,$name,$includeempty) |
=item * select_dom_form($defdom,$name,$includeempty,$showdomdesc) |
|
|
Returns a string containing a <select name='$name' size='1'> form to |
Returns a string containing a <select name='$name' size='1'> form to |
allow a user to select the domain to preform an operation in. |
allow a user to select the domain to preform an operation in. |
Line 1433 See loncreateuser.pm for an example invo
|
Line 1433 See loncreateuser.pm for an example invo
|
If the $includeempty flag is set, it also includes an empty choice ("no domain |
If the $includeempty flag is set, it also includes an empty choice ("no domain |
selected"); |
selected"); |
|
|
|
If the $showdomdesc flag is set, the domain name is followed by the domain description. |
|
|
=cut |
=cut |
|
|
#------------------------------------------- |
#------------------------------------------- |
sub select_dom_form { |
sub select_dom_form { |
my ($defdom,$name,$includeempty) = @_; |
my ($defdom,$name,$includeempty,$showdomdesc) = @_; |
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); |
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); |
if ($includeempty) { @domains=('',@domains); } |
if ($includeempty) { @domains=('',@domains); } |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
foreach my $dom (@domains) { |
foreach my $dom (@domains) { |
$selectdomain.="<option value=\"$dom\" ". |
$selectdomain.="<option value=\"$dom\" ". |
($dom eq $defdom ? 'selected="selected" ' : ''). |
($dom eq $defdom ? 'selected="selected" ' : '').'>'.$dom; |
">$dom</option>\n"; |
if ($showdomdesc) { |
|
if ($dom ne '') { |
|
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
|
if ($domdesc ne '') { |
|
$selectdomain .= ' ('.$domdesc.')'; |
|
} |
|
} |
|
} |
|
$selectdomain .= "</option>\n"; |
} |
} |
$selectdomain.="</select>"; |
$selectdomain.="</select>"; |
return $selectdomain; |
return $selectdomain; |
Line 3397 Inputs:
|
Line 3407 Inputs:
|
|
|
=item * $args, optional argument valid values are |
=item * $args, optional argument valid values are |
no_auto_mt_title -> prevents &mt()ing the title arg |
no_auto_mt_title -> prevents &mt()ing the title arg |
|
inherit_jsmath -> when creating popup window in a page, |
|
should it have jsmath forced on by the |
|
current page |
|
|
=back |
=back |
|
|
Line 3453 sub bodytag {
|
Line 3466 sub bodytag {
|
|
|
# construct main body tag |
# construct main body tag |
my $bodytag = "<body $extra_body_attr>". |
my $bodytag = "<body $extra_body_attr>". |
&Apache::lontexconvert::init_math_support(); |
&Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'}); |
|
|
if ($bodyonly) { |
if ($bodyonly) { |
return $bodytag; |
return $bodytag; |
Line 4711 Inputs: $title - optional title for the
|
Line 4724 Inputs: $title - optional title for the
|
|
|
no_auto_mt_title -> prevent &mt()ing the title arg |
no_auto_mt_title -> prevent &mt()ing the title arg |
|
|
|
inherit_jsmath -> when creating popup window in a page, |
|
should it have jsmath forced on by the |
|
current page |
|
|
=cut |
=cut |
|
|
sub start_page { |
sub start_page { |
Line 5557 sub user_picker {
|
Line 5574 sub user_picker {
|
} |
} |
$srchterm = $srch->{'srchterm'}; |
$srchterm = $srch->{'srchterm'}; |
} |
} |
use Data::Dumper; |
|
&Apache::lonnet::logthis(&Dumper($srch)); |
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'usr' => 'Search for', |
'usr' => 'Search criteria', |
'or' => 'or', |
'doma' => 'Domain/institution to search', |
'doma' => 'domain', |
|
'uname' => 'username', |
'uname' => 'username', |
'lastname' => 'last name', |
'lastname' => 'last name', |
'lastfirst' => 'last name, first name', |
'lastfirst' => 'last name, first name', |
Line 5573 sub user_picker {
|
Line 5587 sub user_picker {
|
'exact' => 'is', |
'exact' => 'is', |
'contains' => 'contains', |
'contains' => 'contains', |
); |
); |
my $domform = &select_dom_form($currdom,'srchdomain',1); |
my $domform = &select_dom_form($currdom,'srchdomain',1,1); |
|
my $srchinsel = ' <select name="srchin">'; |
my $srchin; |
|
|
|
my @srchins = ('crs','dom','alc','instd'); |
my @srchins = ('crs','dom','alc','instd'); |
|
|
Line 5585 sub user_picker {
|
Line 5598 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'}); |
my $checked =($curr_selected{'srchin'} eq $option) ?'checked="checked"' |
if ($curr_selected{'srchin'} eq $option) { |
:''; |
$srchinsel .= ' |
my $extra = ($option eq 'dom') ? $domform |
<option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>'; |
: ''; |
} else { |
$srchin.=<<ROW |
$srchinsel .= ' |
<tr> |
<option value="'.$option.'">'.$lt{$option}.'</option>'; |
<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 5636 function setSearch(createnew) {
|
Line 5646 function setSearch(createnew) {
|
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
if ( document.crtuser.srchin[i].value == 'dom') { |
if ( document.crtuser.srchin.options[i].value == 'dom') { |
document.crtuser.srchin[i].checked = 1; |
document.crtuser.srchin.selectedIndex = i; |
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
Line 5672 function validateEntry() {
|
Line 5682 function validateEntry() {
|
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; |
var srchterm = document.crtuser.srchterm.value; |
var srchterm = document.crtuser.srchterm.value; |
|
var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; |
var msg = ""; |
var msg = ""; |
|
|
if (srchterm == "") { |
if (srchterm == "") { |
Line 5682 function validateEntry() {
|
Line 5693 function validateEntry() {
|
if (srchtype== 'contains') { |
if (srchtype== 'contains') { |
if (srchterm.length < 3) { |
if (srchterm.length < 3) { |
checkok = 0; |
checkok = 0; |
msg += "The text you are searching for must contain at least three characters when using a 'contained in' type search.\\n"; |
msg += "The text you are searching for must contain at least three characters when using a 'contains' type search.\\n"; |
} |
} |
} |
} |
if (srchin == 'instd') { |
if (srchin == 'instd') { |
Line 5724 $new_user_create
|
Line 5735 $new_user_create
|
|
|
<table> |
<table> |
<tr> |
<tr> |
<td> $srchbysel |
<td>$lt{'usr'}:</td> |
$srchtypesel |
<td>$srchbysel |
<input type="text" size="15" name="srchterm" value="$srchterm" /> |
$srchtypesel |
|
<input type="text" size="15" name="srchterm" value="$srchterm" /> |
|
$srchinsel |
|
</td> |
|
</tr> |
|
<tr> |
|
<td align="right">$lt{'doma'}:</td> |
|
<td>$domform</td> |
</td> |
</td> |
</tr> |
</tr> |
$srchin |
|
</table> |
</table> |
<br /> |
<br /> |
END_BLOCK |
END_BLOCK |
Line 5996 sub record_sep {
|
Line 6013 sub record_sep {
|
$i++; |
$i++; |
} |
} |
} else { |
} else { |
my @allfields; |
my $separator=','; |
if ($env{'form.upfiletype'} eq 'semisv') { |
if ($env{'form.upfiletype'} eq 'semisv') { |
@allfields=split(/;/,$record,-1); |
$separator=';'; |
} else { |
|
@allfields=split(/\,/,$record,-1); |
|
} |
} |
my $i=0; |
my $i=0; |
my $j; |
# the character we are looking for to indicate the end of a quote or a record |
for ($j=0;$j<=$#allfields;$j++) { |
my $looking_for=$separator; |
my $field=$allfields[$j]; |
# do not add the characters to the fields |
if ($field=~/^\s*(\"|\')/) { |
my $ignore=0; |
my $delimiter=$1; |
# we just encountered a separator (or the beginning of the record) |
while (($field!~/$delimiter$/) && ($j<$#allfields)) { |
my $just_found_separator=1; |
$j++; |
# store the field we are working on here |
$field.=','.$allfields[$j]; |
my $field=''; |
} |
# work our way through all characters in record |
$field=~s/^\s*$delimiter//; |
foreach my $character ($record=~/(.)/g) { |
$field=~s/$delimiter\s*$//; |
if ($character eq $looking_for) { |
} |
if ($character ne $separator) { |
$components{&takeleft($i)}=$field; |
# Found the end of a quote, again looking for separator |
$i++; |
$looking_for=$separator; |
|
$ignore=1; |
|
} else { |
|
# Found a separator, store away what we got |
|
$components{&takeleft($i)}=$field; |
|
$i++; |
|
$just_found_separator=1; |
|
$ignore=0; |
|
$field=''; |
|
} |
|
next; |
|
} |
|
# single or double quotation marks after a separator indicate beginning of a quote |
|
# we are now looking for the end of the quote and need to ignore separators |
|
if ((($character eq '"') || ($character eq "'")) && ($just_found_separator)) { |
|
$looking_for=$character; |
|
next; |
|
} |
|
# ignore would be true after we reached the end of a quote |
|
if ($ignore) { next; } |
|
if (($just_found_separator) && ($character=~/\s/)) { next; } |
|
$field.=$character; |
|
$just_found_separator=0; |
} |
} |
|
# catch the very last entry, since we never encountered the separator |
|
$components{&takeleft($i)}=$field; |
} |
} |
return %components; |
return %components; |
} |
} |