version 1.104, 2009/11/12 15:58:22
|
version 1.114, 2010/01/20 16:46:23
|
Line 386 sub javascript_validations {
|
Line 386 sub javascript_validations {
|
if (($context eq 'course') || ($context eq 'domain')) { |
if (($context eq 'course') || ($context eq 'domain')) { |
if ($context eq 'course') { |
if ($context eq 'course') { |
if ($env{'request.course.sec'} eq '') { |
if ($env{'request.course.sec'} eq '') { |
$setsection_call = 'setSections(document.'.$param{'formname'}."'$crstype'".');'; |
$setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; |
$setsections_js = |
$setsections_js = |
&setsections_javascript($param{'formname'},$groupslist, |
&setsections_javascript($param{'formname'},$groupslist, |
$mode,'',$crstype); |
$mode,'',$crstype); |
Line 1446 sub print_userlist {
|
Line 1446 sub print_userlist {
|
'<input type="hidden" name="phase" value="" /></form>'); |
'<input type="hidden" name="phase" value="" /></form>'); |
return; |
return; |
} |
} |
if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { |
if (!(($context eq 'domain') && |
$r->print(' '.&list_submit_button(&mt('Update Display')). |
(($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { |
"\n</p>\n"); |
$r->print( |
|
"\n</p>\n" |
|
.'<p>' |
|
.&list_submit_button(&mt('Update Display')) |
|
."</p>\n" |
|
); |
} |
} |
my ($indexhash,$keylist) = &make_keylist_array(); |
my ($indexhash,$keylist) = &make_keylist_array(); |
my (%userlist,%userinfo); |
my (%userlist,%userinfo,$clearcoursepick); |
if (($context eq 'domain') && |
if (($context eq 'domain') && |
($env{'form.roletype'} eq 'course') || |
($env{'form.roletype'} eq 'course') || |
($env{'form.roletype'} eq 'community')) { |
($env{'form.roletype'} eq 'community')) { |
Line 1476 sub print_userlist {
|
Line 1481 sub print_userlist {
|
$courseform."\n". |
$courseform."\n". |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'</p>'. |
&Apache::lonhtmlcommon::end_pick_box().'</p>'. |
'<p>'.&list_submit_button(&mt('Update Display')). |
'<p><input type="hidden" name="origroletype" value="'.$env{'form.roletype'}.'" />'. |
|
&list_submit_button(&mt('Update Display')). |
"\n".'</p><span class="LC_warning">'.$warning.'</span>'."\n"); |
"\n".'</p><span class="LC_warning">'.$warning.'</span>'."\n"); |
if ($env{'form.coursepick'}) { |
$clearcoursepick = 0; |
|
if (($env{'form.origroletype'} ne '') && |
|
($env{'form.origroletype'} ne $env{'form.roletype'})) { |
|
$clearcoursepick = 1; |
|
} |
|
if (($env{'form.coursepick'}) && (!$clearcoursepick)) { |
$r->print('<hr />'.&mt('Searching').' ...<br /> <br />'); |
$r->print('<hr />'.&mt('Searching').' ...<br /> <br />'); |
} |
} |
} else { |
} else { |
Line 1553 sub print_userlist {
|
Line 1564 sub print_userlist {
|
} |
} |
} elsif (($env{'form.roletype'} eq 'course') || |
} elsif (($env{'form.roletype'} eq 'course') || |
($env{'form.roletype'} eq 'community')) { |
($env{'form.roletype'} eq 'community')) { |
if ($env{'form.coursepick'}) { |
if (($env{'form.coursepick'}) && (!$clearcoursepick)) { |
my %courses = &process_coursepick(); |
my %courses = &process_coursepick(); |
my %allusers; |
my %allusers; |
my $hidepriv = 1; |
my $hidepriv = 1; |
Line 1681 sub role_filter {
|
Line 1692 sub role_filter {
|
$role_select .= '</select>'; |
$role_select .= '</select>'; |
$output = '<label><span class="LC_nobreak">' |
$output = '<label><span class="LC_nobreak">' |
.&mt('Role: [_1]',$role_select) |
.&mt('Role: [_1]',$role_select) |
.'</span></label>'; |
.'</span></label> '; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 1721 sub section_group_filter {
|
Line 1732 sub section_group_filter {
|
} |
} |
if (@options > 0) { |
if (@options > 0) { |
my $currsel; |
my $currsel; |
$markup = '<select name="'.$name{$item}.'" />'."\n"; |
$markup = '<select name="'.$name{$item}.'">'."\n"; |
foreach my $option ('all','none',@options) { |
foreach my $option ('all','none',@options) { |
$currsel = ''; |
$currsel = ''; |
if ($env{'form.'.$name{$item}} eq $option) { |
if ($env{'form.'.$name{$item}} eq $option) { |
Line 1736 sub section_group_filter {
|
Line 1747 sub section_group_filter {
|
$markup .= '</option>'."\n"; |
$markup .= '</option>'."\n"; |
} |
} |
$markup .= '</select>'."\n"; |
$markup .= '</select>'."\n"; |
$output .= (' 'x3).'<label>'.$title{$item}.': '.$markup.'</label>'; |
$output .= (' 'x3).'<span class="LC_nobreak">' |
|
.'<label>'.$title{$item}.': '.$markup.'</label>' |
|
.'</span> '; |
} |
} |
} |
} |
return $output; |
return $output; |
Line 1956 sub process_coursepick {
|
Line 1969 sub process_coursepick {
|
my $coursefilter = $env{'form.coursepick'}; |
my $coursefilter = $env{'form.coursepick'}; |
my $cdom = $env{'request.role.domain'}; |
my $cdom = $env{'request.role.domain'}; |
my %courses; |
my %courses; |
|
my $crssrch = 'Course'; |
|
if ($env{'form.roletype'} eq 'community') { |
|
$crssrch = 'Community'; |
|
} |
if ($coursefilter eq 'all') { |
if ($coursefilter eq 'all') { |
%courses = &Apache::lonnet::courseiddump($cdom,'.','.','.','.','.', |
%courses = &Apache::lonnet::courseiddump($cdom,'.','.','.','.','.', |
undef,undef,'Course'); |
undef,undef,$crssrch); |
} elsif ($coursefilter eq 'category') { |
} elsif ($coursefilter eq 'category') { |
my $instcode = &instcode_from_coursefilter(); |
my $instcode = &instcode_from_coursefilter(); |
%courses = &Apache::lonnet::courseiddump($cdom,'.','.',$instcode,'.','.', |
%courses = &Apache::lonnet::courseiddump($cdom,'.','.',$instcode,'.','.', |
undef,undef,'Course'); |
undef,undef,$crssrch); |
} elsif ($coursefilter eq 'specific') { |
} elsif ($coursefilter eq 'specific') { |
if ($env{'form.coursetotal'} > 1) { |
if ($env{'form.coursetotal'} > 1) { |
my @course_ids = split(/&&/,$env{'form.courselist'}); |
my @course_ids = split(/&&/,$env{'form.courselist'}); |
Line 2147 END
|
Line 2164 END
|
} elsif ($context eq 'domain') { |
} elsif ($context eq 'domain') { |
if ($setting eq 'community') { |
if ($setting eq 'community') { |
$crstype = 'Community'; |
$crstype = 'Community'; |
} elsif ($crstype eq 'course') { |
} elsif ($setting eq 'course') { |
$crstype = 'Course'; |
$crstype = 'Course'; |
} |
} |
} |
} |
Line 2298 END
|
Line 2315 END
|
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') { |
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') { |
if ($mode ne 'autoenroll' && $mode ne 'pickauthor') { |
if ($mode ne 'autoenroll' && $mode ne 'pickauthor') { |
if ($permission->{'cusr'}) { |
if ($permission->{'cusr'}) { |
$actionselect = &select_actions($context,$setting,$statusmode,$formname); |
unless (($context eq 'domain') && |
|
(($setting eq 'course') || ($setting eq 'community'))) { |
|
$actionselect = |
|
&select_actions($context,$setting,$statusmode,$formname); |
|
} |
} |
} |
$r->print(<<END); |
$r->print(<<END); |
<input type="hidden" name="srchby" value="uname" /> |
<input type="hidden" name="srchby" value="uname" /> |
Line 2382 END
|
Line 2403 END
|
if ($env{'form.userwin'}) { |
if ($env{'form.userwin'}) { |
$checkwin = ' checked="checked"'; |
$checkwin = ' checked="checked"'; |
} |
} |
$output .= '</td><td valign="top"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>'; |
$output .= '</td><td valign="top" style="border-left: 1px solid;"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>'; |
} |
} |
$output .= "\n".'<div class="LC_clear_float_footer"> </div>'."\n". |
$output .= "\n".'<div class="LC_clear_float_footer"> </div>'."\n". |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
Line 2392 END
|
Line 2413 END
|
<th><a href=\"javascript:document.$formname.sortby.value='type';document.$formname.submit();\">$lt{'type'}</a></th> |
<th><a href=\"javascript:document.$formname.sortby.value='type';document.$formname.submit();\">$lt{'type'}</a></th> |
"; |
"; |
} else { |
} else { |
if ($mode eq 'pickauthor') { |
$output .= "\n".'<th> </th>'."\n"; |
$output .= "\n".'<th> </th>'."\n"; |
|
} else { |
|
$output .= "\n".'<th>'.&mt('Count').'</th>'."\n"; |
|
} |
|
if ($actionselect) { |
if ($actionselect) { |
$output .= '<th>'.&mt('Select').'</th>'."\n"; |
$output .= '<th>'.&mt('Select').'</th>'."\n"; |
} |
} |
Line 2451 END
|
Line 2468 END
|
time.'_'.rand(1000000000).'.csv'; |
time.'_'.rand(1000000000).'.csv'; |
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { |
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { |
$r->log_error("Couldn't open $CSVfilename for output $!"); |
$r->log_error("Couldn't open $CSVfilename for output $!"); |
$r->print(&mt('Problems occurred in writing the CSV file. ' |
$r->print( |
.'This error has been logged. ' |
'<p class="LC_error">' |
.'Please alert your LON-CAPA administrator.')); |
.&mt('Problems occurred in writing the CSV file.') |
|
.' '.&mt('This error has been logged.') |
|
.' '.&mt('Please alert your LON-CAPA administrator.') |
|
.'</p>' |
|
); |
$CSVfile = undef; |
$CSVfile = undef; |
} |
} |
# |
# |
Line 2922 sub print_username_link {
|
Line 2943 sub print_username_link {
|
$output = $in->{'username'}; |
$output = $in->{'username'}; |
} else { |
} else { |
$output = '<a href="javascript:username_display_launch('. |
$output = '<a href="javascript:username_display_launch('. |
"'$in->{'username'}','$in->{'domain'}'".')" />'. |
"'$in->{'username'}','$in->{'domain'}'".')">'. |
$in->{'username'}.'</a>'; |
$in->{'username'}.'</a>'; |
} |
} |
return $output; |
return $output; |
Line 3176 ENDJS
|
Line 3197 ENDJS
|
$date_items; |
$date_items; |
if ($context eq 'course' && $env{'form.bulkaction'} eq 'chgsec') { |
if ($context eq 'course' && $env{'form.bulkaction'} eq 'chgsec') { |
my ($cnum,$cdom) = &get_course_identity(); |
my ($cnum,$cdom) = &get_course_identity(); |
my $crstype = &Apache::loncommon::course_type(); |
|
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$lt{'fors'} = &mt('For member roles changing the section, will result in a section switch as members may only be in one section of a community at a time.'); |
$lt{'fors'} = &mt('For member roles changing the section, will result in a section switch as members may only be in one section of a community at a time.'); |
$lt{'forn'} = &mt('For a role in a community that is not a member role, a user may have roles in more than one section of a community at a time.'); |
$lt{'forn'} = &mt('For a role in a community that is not a member role, a user may have roles in more than one section of a community at a time.'); |
Line 3643 sub print_first_users_upload_form {
|
Line 3663 sub print_first_users_upload_form {
|
$str .= '<h2>'.&mt('Upload a file containing information about users').'</h2>'."\n"; |
$str .= '<h2>'.&mt('Upload a file containing information about users').'</h2>'."\n"; |
|
|
# Excel and CSV Help |
# Excel and CSV Help |
$str .= '<p>' |
$str .= '<div class="LC_left_float">' |
.&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
.&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
&mt("How do I create a users list from a spreadsheet")) |
&mt("How do I create a users list from a spreadsheet")) |
."<br />\n" |
.'</div><div class="LC_left_float">'."\n" |
.&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
.&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
&mt("How do I create a CSV file from a spreadsheet")) |
&mt("How do I create a CSV file from a spreadsheet")) |
."</p>\n"; |
.'</div><br clear="all" />'."\n"; |
|
|
$str .= &Apache::lonhtmlcommon::start_pick_box() |
$str .= &Apache::lonhtmlcommon::start_pick_box() |
.&Apache::lonhtmlcommon::row_title(&mt('File')); |
.&Apache::lonhtmlcommon::row_title(&mt('File')); |
if (&Apache::lonlocal::current_language() ne 'en') { |
if (&Apache::lonlocal::current_language() ne 'en') { |
Line 3674 sub print_first_users_upload_form {
|
Line 3693 sub print_first_users_upload_form {
|
.'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' |
.'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' |
.'</p>'; |
.'</p>'; |
|
|
$str .= &Apache::loncommon::end_page(); |
|
|
|
$r->print($str); |
$r->print($str); |
return; |
return; |
} |
} |
Line 4815 sub setsections_javascript {
|
Line 4832 sub setsections_javascript {
|
plch => 'Please choose a different section name.', |
plch => 'Please choose a different section name.', |
mnot => 'may not be used as a section name, as it is the name of a course group.', |
mnot => 'may not be used as a section name, as it is the name of a course group.', |
secn => 'Section names and group names must be distinct. Please choose a different section name.', |
secn => 'Section names and group names must be distinct. Please choose a different section name.', |
|
nonw => 'Section names may only contain letters or numbers.', |
); |
); |
$setsection_js .= <<"ENDSECCODE"; |
$setsection_js .= <<"ENDSECCODE"; |
|
|
function setSections(formname,crstype) { |
function setSections(formname,crstype) { |
var re1 = /^currsec_/; |
var re1 = /^currsec_/; |
|
var re2 =/\\W/; |
var groups = new Array($groupslist); |
var groups = new Array($groupslist); |
for (var i=0;i<formname.elements.length;i++) { |
for (var i=0;i<formname.elements.length;i++) { |
var str = formname.elements[i].name; |
var str = formname.elements[i].name; |
Line 4863 function setSections(formname,crstype) {
|
Line 4882 function setSections(formname,crstype) {
|
} |
} |
var newsecs = formname.elements[i+1].value; |
var newsecs = formname.elements[i+1].value; |
var numsplit; |
var numsplit; |
|
var validsecs = new Array(); |
|
var badsecs = new Array(); |
if (newsecs != null && newsecs != "") { |
if (newsecs != null && newsecs != "") { |
numsplit = newsecs.split(/,/g); |
numsplit = newsecs.split(/,/g); |
numsec = numsec + numsplit.length; |
for (var i=0; i<numsplit.length; i++) { |
|
if (re2.test(numsplit[i]) == true) { |
|
badsecs.push(numsplit[i]); |
|
} else { |
|
validsecs.push(numsplit[i]); |
|
} |
|
} |
|
if (badsecs.length > 0) { |
|
alert("$alerts{'nonw'}\\n$alerts{'plch'}"); |
|
return; |
|
} |
|
numsec = numsec + validsecs.length; |
} |
} |
|
|
if ((role == 'st') && (numsec > 1)) { |
if ((role == 'st') && (numsec > 1)) { |