version 1.93.2.1, 2010/06/19 01:38:03
|
version 1.106, 2013/03/01 04:55:35
|
Line 31 package Apache::lonpickcourse;
|
Line 31 package Apache::lonpickcourse;
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::loncommon; |
use Apache::loncommon; |
|
use Apache::lonhtmlcommon; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
Line 105 sub handler {
|
Line 106 sub handler {
|
|
|
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && |
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && |
($env{'form.pickedcourse'})) { |
($env{'form.pickedcourse'})) { |
$loaditem{'onload'} .= 'setRoles();setSections();'; |
$loaditem{'onload'} .= 'setDefaultCredits();setRoles();setSections();'; |
} |
} |
my $js = &js_changer(); |
my $js = &js_changer(); |
$r->print(&Apache::loncommon::start_page($title,$js, |
$r->print(&Apache::loncommon::start_page($title, |
|
&Apache::lonhtmlcommon::scripttag($js), |
{'add_entries' => \%loaditem, |
{'add_entries' => \%loaditem, |
'no_nav_bar' => 1, })); |
'no_nav_bar' => 1, })); |
|
|
Line 133 sub handler {
|
Line 135 sub handler {
|
$onlyown) { |
$onlyown) { |
$r->print(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction)); |
$r->print(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction)); |
} |
} |
$r->print('<script type="text/javascript" language="Javascript">'.$jscript. |
$r->print(&Apache::lonhtmlcommon::scripttag($jscript)); |
'</script>'); |
|
$r->print($submitopener); |
$r->print($submitopener); |
|
|
# ------------------------------------------ Display of filters to limit search |
# ------------------------------------------ Display of filters to limit search |
my $filter = {}; |
my $filter = {}; |
my $action = '/adm/pickcourse'; |
my $action = '/adm/pickcourse'; |
my ($numtitles,$showroles,$nohost); |
my ($numtitles,$showroles,$nohost,@codetitles); |
if (!$onlyown) { |
if (!$onlyown) { |
my $filterlist = ['domainfilter','descriptfilter', |
my $filterlist = ['domainfilter']; |
'instcodefilter']; |
# created filter for DCs only |
|
if ($env{'user.adv'} && $env{'form.domainfilter'} && |
|
exists($env{'user.role.dc./'.$env{'form.domainfilter'}.'/'}) |
|
&& $env{'form.form'} ne 'portform') { |
|
my $loncaparev = &Apache::lonnet::get_server_loncaparev($env{'form.domainfilter'}); |
|
if ($loncaparev ne 'unknown_cmd') { |
|
push(@{$filterlist},'createdfilter'); |
|
} |
|
} |
|
push(@{$filterlist},('descriptfilter','instcodefilter')); |
if ($env{'form.form'} eq 'rules') { |
if ($env{'form.form'} eq 'rules') { |
push(@{$filterlist},'personfilter'); |
push(@{$filterlist},'personfilter'); |
if (($env{'form.personfilter'} ne '') && ($env{'form.persondomfilter'} ne '')) { |
if (($env{'form.personfilter'} ne '') && ($env{'form.persondomfilter'} ne '')) { |
Line 168 sub handler {
|
Line 178 sub handler {
|
|
|
$r->print(&build_filters($filterlist,$type,$roleelement,$multelement, |
$r->print(&build_filters($filterlist,$type,$roleelement,$multelement, |
$filter,$action,\$numtitles,undef,$cloneruname, |
$filter,$action,\$numtitles,undef,$cloneruname, |
$clonerudom,$typeelement)); |
$clonerudom,$typeelement,\@codetitles)); |
} |
} |
|
|
# ---------------------------------------------------------------- Get the data |
# ---------------------------------------------------------------- Get the data |
if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) || |
if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) || |
$onlyown) { |
$onlyown) { |
|
my $domcloner; |
|
if ($env{'form.form'} eq 'ccrs') { |
|
if (($env{'request.role.domain'} eq $env{'form.domainfilter'}) && |
|
(&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) { |
|
$domcloner = 1; |
|
} |
|
} |
my %courses = &search_courses($r,$type,$onlyown,$filter,$numtitles, |
my %courses = &search_courses($r,$type,$onlyown,$filter,$numtitles, |
$cloneruname,$clonerudom); |
$cloneruname,$clonerudom,$domcloner,\@codetitles); |
if ($nohost) { |
if ($nohost) { |
$r->print ('<span class="LC_warning">'. |
$r->print ('<span class="LC_warning">'. |
&mt('User does not exist - username: [_1], domain: [_2].', |
&mt('User does not exist - username: [_1], domain: [_2].', |
Line 191 sub handler {
|
Line 208 sub handler {
|
} |
} |
|
|
sub js_changer { |
sub js_changer { |
return <<"ENDJS"; |
return <<ENDJS; |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function updateFilters(caller) { |
function updateFilters(caller) { |
if (typeof(caller) != "undefined") { |
if (typeof(caller) != "undefined") { |
document.filterpicker.updater.value = caller.name; |
document.filterpicker.updater.value = caller.name; |
} |
} |
document.filterpicker.submit(); |
document.filterpicker.submit(); |
} |
} |
|
// ]] |
</script> |
</script> |
|
|
ENDJS |
ENDJS |
|
|
} |
} |
|
|
sub processpick { |
sub processpick { |
Line 266 sub create_user_javascript {
|
Line 282 sub create_user_javascript {
|
my $cdom = $coursedescription{'domain'}; |
my $cdom = $coursedescription{'domain'}; |
my $cnum = $coursedescription{'num'}; |
my $cnum = $coursedescription{'num'}; |
my $crstype = $coursedescription{'type'}; |
my $crstype = $coursedescription{'type'}; |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
my ($showcredits,$credits); |
|
if (($crstype ne 'Community') && |
|
($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'})) { |
|
$showcredits = 1; |
|
$credits = $coursedescription{'internal.defaultcredits'}; |
|
} |
my $sec_element = 'currsec'; |
my $sec_element = 'currsec'; |
my $grplist_element = 'groups'; |
my $grplist_element = 'groups'; |
my ($sections,$groups) = |
my ($sections,$groups) = |
Line 276 sub create_user_javascript {
|
Line 299 sub create_user_javascript {
|
my $groupslist = join(',',@{$groups}); |
my $groupslist = join(',',@{$groups}); |
$output = qq| |
$output = qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function setSections() { |
function setSections() { |
opener.document.$env{"form.form"}.$grplist_element.value='$groupslist'; |
opener.document.$env{"form.form"}.$grplist_element.value='$groupslist'; |
window.opener.setSect('$seclist'); |
window.opener.setSect('$seclist'); |
Line 284 function setSections() {
|
Line 308 function setSections() {
|
function setRoles() { |
function setRoles() { |
window.opener.setRole('$crstype'); |
window.opener.setRole('$crstype'); |
} |
} |
|
|; |
|
if ($showcredits) { |
|
$output .= qq| |
|
function setDefaultCredits() { |
|
window.opener.setCredits('$credits'); |
|
} |
|
|; |
|
} |
|
$output .= qq| |
|
// ]]> |
</script> |
</script> |
|; |
|; |
; |
|
} |
} |
return $output; |
return $output; |
} |
} |
Line 309 sub display_matched_courses {
|
Line 342 sub display_matched_courses {
|
my $ccrolechk = ' '; |
my $ccrolechk = ' '; |
my $menuchk = ' checked="checked" '; |
my $menuchk = ' checked="checked" '; |
$r->print( |
$r->print( |
'<fieldset>' |
'<div class="LC_left_float">' |
.'<legend>'.&mt('Action').'</legend>' |
.'<fieldset>' |
.'<div class="LC_nobreak"><label>' |
.'<legend>'.&mt('Pick action').'</legend>' |
|
.'<span class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
.' '); |
.' '); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
Line 319 sub display_matched_courses {
|
Line 353 sub display_matched_courses {
|
} else { |
} else { |
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
} |
} |
$r->print('</label></div>' |
$r->print('</label></span><br />' |
.'<div class="LC_nobreak"><label>' |
.'<span class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
} else { |
} else { |
$r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); |
$r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); |
} |
} |
$r->print('</label></div>' |
$r->print('</label></span>' |
.'</fieldset>' |
.'</fieldset></div>' |
.'<br />' |
.'<br clear="all" />' |
); |
); |
} |
} |
} |
} |
Line 348 sub display_matched_courses {
|
Line 382 sub display_matched_courses {
|
} |
} |
|
|
if ($numcourses > 1 && $multiple) { |
if ($numcourses > 1 && $multiple) { |
$r->print('<input type="button" value="check all" |
$r->print('<input type="button" value="'.&mt('check all').'" |
onclick="javascript:checkAll(document.courselist.course_id)" /> |
onclick="javascript:checkAll(document.courselist.course_id)" /> |
<input type="button" value="uncheck all" |
<input type="button" value="'.&mt('uncheck all').'" |
onclick="javascript:uncheckAll(document.courselist.course_id)" /> |
onclick="javascript:uncheckAll(document.courselist.course_id)" /> |
<br /><br />'); |
<br /><br />'); |
} |
} |
Line 396 sub display_matched_courses {
|
Line 430 sub display_matched_courses {
|
$instcode = $courses{$course}{'inst_code'}; |
$instcode = $courses{$course}{'inst_code'}; |
$ttype = $courses{$course}{'type'}; |
$ttype = $courses{$course}{'type'}; |
if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) { |
if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) { |
if ($cc_cloneable{$courses{$course}{'cnum'}.':'.$courses{$course}{'domain'}}) { |
if ($env{'form.form'} eq 'ccrs') { |
$canclone = 1; |
if (($env{'request.role.domain'} eq $cdom) && |
|
(&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) { |
|
$canclone = 1; |
|
} |
|
} |
|
unless ($canclone) { |
|
if ($cc_cloneable{$cnum.':'.$cdom}) { |
|
$canclone = 1; |
|
} |
} |
} |
unless ($canclone) { |
unless ($canclone) { |
my $cloners = $courses{$course}{'cloners'}; |
my $cloners = $courses{$course}{'cloners'}; |
Line 415 sub display_matched_courses {
|
Line 457 sub display_matched_courses {
|
} |
} |
} |
} |
} |
} |
push(@owners,&unescape($courses{$course}{'owner'})); |
push(@owners,$courses{$course}{'owner'}); |
if (ref($courses{$course}{'co-owners'}) eq 'ARRAY') { |
if ($courses{$course}{'co-owners'} ne '') { |
foreach my $item (@{$courses{$course}{'co-owners'}}) { |
foreach my $item (split(/,/,$courses{$course}{'co-owners'})) { |
push(@owners,&unescape($item)); |
push(@owners,$item); |
} |
} |
} |
} |
} else { |
} else { |
Line 470 sub display_matched_courses {
|
Line 512 sub display_matched_courses {
|
} |
} |
|
|
if (!%courses) { |
if (!%courses) { |
$r->print(&mt('None found')); |
$r->print('<p class="LC_info">'.&mt('None found').'</p>'); |
} elsif ($multiple) { |
} elsif ($multiple) { |
$r->print('<input type="button" value="Submit" onClick="gochoose('."'','','')".'" />'); |
$r->print('<input type="button" value="'.&mt('Submit').'" onClick="gochoose('."'','','')".'" />'); |
} |
} |
$r->print('<input type="hidden" name="form" value="'.$env{'form.form'}.'" />'. |
$r->print('<input type="hidden" name="form" value="'.$env{'form.form'}.'" />'. |
"\n".'<input type="hidden" name="pickedcourse" value="" />'."\n". |
"\n".'<input type="hidden" name="pickedcourse" value="" />'."\n". |
Line 519 sub multiples_tag {
|
Line 561 sub multiples_tag {
|
|
|
sub build_filters { |
sub build_filters { |
my ($filterlist,$type,$roleelement,$multelement,$filter,$action, |
my ($filterlist,$type,$roleelement,$multelement,$filter,$action, |
$numtitlesref,$caller,$cloneruname,$clonerudom,$typeelement) = @_; |
$numtitlesref,$caller,$cloneruname,$clonerudom,$typeelement,$codetitlesref) = @_; |
my ($list,$formname,$fixeddom,$codedom,$jscript); |
my ($list,$formname,$fixeddom,$codedom,$jscript); |
$codedom = $env{'request.role.domain'}; |
$codedom = $env{'request.role.domain'}; |
if (defined($env{'form.form'})) { |
if (defined($env{'form.form'})) { |
Line 527 sub build_filters {
|
Line 569 sub build_filters {
|
} else { |
} else { |
$formname = $caller; |
$formname = $caller; |
} |
} |
my $onchange; |
my $onchange = 'javascript:updateFilters(this)'; |
unless ($env{'form.interface'} eq 'textual') { |
my ($domainselectform,$sincefilterform,$createdfilterform, |
$onchange = 'javascript:updateFilters(this)'; |
$ownerdomselectform,$persondomselectform,$instcodeform, |
} |
$typeselectform,$instcodetitle); |
my ($domainselectform,$sincefilterform,$ownerdomselectform,$persondomselectform, |
|
$instcodeform,$typeselectform,$instcodetitle); |
|
foreach my $item (@{$filterlist}) { |
foreach my $item (@{$filterlist}) { |
$filter->{$item} = $env{'form.'.$item}; |
$filter->{$item} = $env{'form.'.$item}; |
if ($item ne 'descriptfilter' && $item ne 'instcodefilter') { |
if ($item ne 'descriptfilter' && $item ne 'instcodefilter') { |
Line 595 sub build_filters {
|
Line 635 sub build_filters {
|
} |
} |
|
|
# last course activity filter and selection |
# last course activity filter and selection |
$filter->{'sincefilter'} = $env{'form.sincefilter'}; |
$sincefilterform = &timebased_select_form('sincefilter',$filter); |
$filter->{'sincefilter'} =~ s/[^\d-]//g; |
|
if (!$filter->{'sincefilter'}) { $filter->{'sincefilter'}=-1; } |
# course created filter and selection |
$sincefilterform=&Apache::loncommon::select_form( |
if (exists($filter->{'createdfilter'})) { |
$filter->{'sincefilter'}, |
$createdfilterform = &timebased_select_form('createdfilter',$filter); |
'sincefilter', |
} |
( '-1' => '', |
|
'86400' => &mt('today'), |
|
'604800' => &mt('last week'), |
|
'2592000' => &mt('last month'), |
|
'7776000' => &mt('last three months'), |
|
'15552000' => &mt('last six months'), |
|
'31104000' => &mt('last year'), |
|
'select_form_order' => |
|
['-1','86400','604800','2592000','7776000', |
|
'15552000','31104000'])); |
|
|
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'cac' => "$type Activity", |
'cac' => "$type Activity", |
|
'ccr' => "$type Created", |
'cde' => "$type Title", |
'cde' => "$type Title", |
'cdo' => "$type Domain", |
'cdo' => "$type Domain", |
'ins' => 'Institutional Code', |
'ins' => 'Institutional Code', |
Line 632 sub build_filters {
|
Line 663 sub build_filters {
|
} else { |
} else { |
$typeselectform = '<select name="type" size="1"'; |
$typeselectform = '<select name="type" size="1"'; |
if ($onchange) { |
if ($onchange) { |
$typeselectform .= 'onchange="'.$onchange.'"'; |
$typeselectform .= ' onchange="'.$onchange.'"'; |
} |
} |
$typeselectform .= '>'."\n"; |
$typeselectform .= '>'."\n"; |
foreach my $posstype ('Course','Community') { |
foreach my $posstype ('Course','Community') { |
Line 664 sub build_filters {
|
Line 695 sub build_filters {
|
|| ($formname eq 'modifycourse')) { |
|| ($formname eq 'modifycourse')) { |
$officialjs = 1; |
$officialjs = 1; |
($instcodeform,$jscript,$$numtitlesref) = |
($instcodeform,$jscript,$$numtitlesref) = |
&instcode_selectors($codedom,'filterpicker',$officialjs); |
&instcode_selectors($codedom,'filterpicker',$officialjs,$codetitlesref); |
if ($jscript) { |
if ($jscript) { |
$jscript = '<script type="text/javascript" language="Javascript">'. |
$jscript = '<script type="text/javascript" language="Javascript">'. |
$jscript.'</script>'."\n"; |
$jscript.'</script>'."\n"; |
Line 719 $typeelement
|
Line 750 $typeelement
|
.$sincefilterform |
.$sincefilterform |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
} |
} |
|
if ($createdfilterform) { |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'ccr'}) |
|
.$createdfilterform |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
} |
if ($domainselectform) { |
if ($domainselectform) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'cdo'}) |
$output .= &Apache::lonhtmlcommon::row_title($lt{'cdo'}) |
.$domainselectform |
.$domainselectform |
Line 782 $typeelement
|
Line 818 $typeelement
|
$output .= '<input type="hidden" name="cc_clone" value="'.$coord_cloneable.'" />'; |
$output .= '<input type="hidden" name="cc_clone" value="'.$coord_cloneable.'" />'; |
} |
} |
} |
} |
$output .= '<input type="hidden" name="updater" value="">'."\n". |
$output .= '<input type="hidden" name="updater" value="" />'."\n". |
'<input type="submit" name="gosearch" value="'. |
'<input type="submit" name="gosearch" value="'. |
&mt('Search').'" /></p>'."\n".'</form>'."\n".'<hr />'."\n"; |
&mt('Search').'" /></p>'."\n".'</form>'."\n".'<hr />'."\n"; |
return $jscript.$warning.$output; |
return $jscript.$warning.$output; |
} |
} |
|
|
|
sub timebased_select_form { |
|
my ($item,$filter) = @_; |
|
if (ref($filter) eq 'HASH') { |
|
$filter->{$item} = $env{'form.'.$item}; |
|
$filter->{$item} =~ s/[^\d-]//g; |
|
if (!$filter->{$item}) { $filter->{$item}=-1; } |
|
return &Apache::loncommon::select_form( |
|
$filter->{$item}, |
|
$item, |
|
{ '-1' => '', |
|
'86400' => &mt('today'), |
|
'604800' => &mt('last week'), |
|
'2592000' => &mt('last month'), |
|
'7776000' => &mt('last three months'), |
|
'15552000' => &mt('last six months'), |
|
'31104000' => &mt('last year'), |
|
'select_form_order' => |
|
['-1','86400','604800','2592000','7776000', |
|
'15552000','31104000']}); |
|
} |
|
} |
|
|
sub get_coordinator_cloneable { |
sub get_coordinator_cloneable { |
my ($cloneruname,$clonerudom,$type) = @_; |
my ($cloneruname,$clonerudom,$type) = @_; |
if (&Apache::lonnet::homeserver($cloneruname,$clonerudom) eq 'no_host') { |
if (($cloneruname!~/\w/) || ($clonerudom!~/\w/)) { |
|
my $warning = '<div class="LC_warning">'.&mt('Intended course owner not specified'). |
|
'</div>'; |
|
return ('',$warning); |
|
} elsif (&Apache::lonnet::homeserver($cloneruname,$clonerudom) eq 'no_host') { |
my $warning = '<div class="LC_error">'.&mt('Intended course owner does not exist'). |
my $warning = '<div class="LC_error">'.&mt('Intended course owner does not exist'). |
'</div>'; |
'</div>'; |
return ('',$warning); |
return ('',$warning); |
Line 813 sub get_coordinator_cloneable {
|
Line 875 sub get_coordinator_cloneable {
|
} |
} |
|
|
sub instcode_selectors { |
sub instcode_selectors { |
my ($codedom,$formname,$officialjs) = @_; |
my ($codedom,$formname,$officialjs,$codetitles) = @_; |
my ($output,@codetitles,%cat_titles,%cat_order,%cat_items); |
my ($output,%cat_titles,%cat_order,%cat_items); |
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname, |
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname, |
\%cat_items,\@codetitles,\%cat_titles,\%cat_order,$officialjs); |
\%cat_items,$codetitles,\%cat_titles,\%cat_order,$officialjs); |
if ($numtitles > 0) { |
if ($numtitles > 0) { |
my $official = ' checked="checked" '; |
my $official = ' checked="checked" '; |
my $unofficial = ''; |
my $unofficial = ''; |
Line 831 sub instcode_selectors {
|
Line 893 sub instcode_selectors {
|
'<input type="radio" name="official" value="off"'.$unofficial. |
'<input type="radio" name="official" value="off"'.$unofficial. |
' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'. |
' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'. |
&Apache::courseclassifier::build_instcode_selectors($numtitles, |
&Apache::courseclassifier::build_instcode_selectors($numtitles, |
$lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order)."\n". |
$lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order)."\n". |
'<input type="hidden" name="numtitles" value="'.$numtitles.'" />'."\n". |
'<input type="hidden" name="numtitles" value="'.$numtitles.'" />'."\n". |
'<input type="hidden" name="state" value="listing" />'."\n"; |
'<input type="hidden" name="state" value="listing" />'."\n"; |
|
|
Line 840 sub instcode_selectors {
|
Line 902 sub instcode_selectors {
|
} |
} |
|
|
sub search_courses { |
sub search_courses { |
my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom) = @_; |
my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_; |
my (%courses,%showcourses,$cloner,$ccrole); |
my (%courses,%showcourses,$cloner,$ccrole); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$ccrole = 'co'; |
$ccrole = 'co'; |
Line 848 sub search_courses {
|
Line 910 sub search_courses {
|
$ccrole = 'cc'; |
$ccrole = 'cc'; |
} |
} |
if (!$onlyown) { |
if (!$onlyown) { |
$r->print(&mt('Searching ...').'<br /> <br />'); |
$r->print('<div id="searching">'.&mt('Searching ...').'</div>'); |
$r->rflush(); |
$r->rflush(); |
if (($filter->{'ownerfilter'} ne '') || |
if (($filter->{'ownerfilter'} ne '') || |
($filter->{'ownerdomfilter'} ne '')) { |
($filter->{'ownerdomfilter'} ne '')) { |
Line 860 sub search_courses {
|
Line 922 sub search_courses {
|
$filter->{$item}='.'; |
$filter->{$item}='.'; |
} |
} |
} |
} |
|
my $now = time; |
my $timefilter = |
my $timefilter = |
($filter->{'sincefilter'}==-1?1:time-$filter->{'sincefilter'}); |
($filter->{'sincefilter'}==-1?1:$now-$filter->{'sincefilter'}); |
|
my ($createdbefore,$createdafter); |
|
if (($filter->{'createdfilter'} ne '') && ($filter->{'createdfilter'} !=-1)) { |
|
$createdbefore = $now; |
|
$createdafter = $now-$filter->{'createdfilter'}; |
|
} |
my ($instcodefilter,$regexpok); |
my ($instcodefilter,$regexpok); |
if ($numtitles) { |
if ($numtitles) { |
if ($env{'form.official'} eq 'on') { |
if ($env{'form.official'} eq 'on') { |
$instcodefilter = |
$instcodefilter = |
&Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles); |
&Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles,$codetitles); |
$regexpok = 1; |
$regexpok = 1; |
} elsif ($env{'form.official'} eq 'off') { |
} elsif ($env{'form.official'} eq 'off') { |
$instcodefilter = &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles); |
$instcodefilter = &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles,$codetitles); |
unless ($instcodefilter eq '') { |
unless ($instcodefilter eq '') { |
$regexpok = -1; |
$regexpok = -1; |
} |
} |
Line 892 sub search_courses {
|
Line 960 sub search_courses {
|
$filter->{'coursefilter'}, |
$filter->{'coursefilter'}, |
undef,undef,$type,$regexpok,undef,undef, |
undef,undef,$type,$regexpok,undef,undef, |
undef,undef,$cloner,$env{'form.cc_clone'}, |
undef,undef,$cloner,$env{'form.cc_clone'}, |
$filter->{'cloneableonly'}); |
$filter->{'cloneableonly'}, |
|
$createdbefore,$createdafter,undef, |
|
$domcloner); |
if (($filter->{'personfilter'} ne '') && ($filter->{'persondomfilter'} ne '')) { |
if (($filter->{'personfilter'} ne '') && ($filter->{'persondomfilter'} ne '')) { |
my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'}, |
my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'}, |
$filter->{'persondomfilter'}, |
$filter->{'persondomfilter'}, |
Line 960 sub gochoose_javascript {
|
Line 1030 sub gochoose_javascript {
|
}, |
}, |
); |
); |
my $output .= qq| |
my $output .= qq| |
<script type="text/javascript"> |
|
function gochoose(cname,cdom,cdesc) { |
function gochoose(cname,cdom,cdesc) { |
var openerForm = "$env{'form.form'}"; |
var openerForm = "$env{'form.form'}"; |
courseCount = 0; |
courseCount = 0; |
Line 1009 ENDSCRIPT
|
Line 1078 ENDSCRIPT
|
} else { |
} else { |
my ($name_code,$type_code); |
my ($name_code,$type_code); |
if ($env{'form.cnameelement'} ne '') { |
if ($env{'form.cnameelement'} ne '') { |
$name_code = 'opener.document.'.$env{'form.form'}.'.'. |
$name_code = <<ENDNAMECODE; |
$env{'form.cnameelement'}.'.value=cdesc;'; |
var showcdesc = cdesc; |
|
if (cdesc.length > 25) { |
|
showcdesc = cdesc.substr(0,25)+' ...'; |
|
} |
|
opener.document.$env{'form.form'}.$env{'form.cnameelement'}.value=showcdesc; |
|
ENDNAMECODE |
} |
} |
if ($env{'form.typeelement'} ne '') { |
if ($env{'form.typeelement'} ne '') { |
$type_code = 'opener.document.'.$env{'form.form'}.'.'. |
$type_code = 'opener.document.'.$env{'form.form'}.'.'. |
Line 1041 ENDSCRIPT
|
Line 1115 ENDSCRIPT
|
$autosubmit |
$autosubmit |
$lastaction |
$lastaction |
} |
} |
</script> |
|
|; |
|; |
return $output; |
return &Apache::lonhtmlcommon::scripttag($output); |
} |
} |
|
|
1; |
1; |
Line 1161 Side Effects: None
|
Line 1234 Side Effects: None
|
|
|
=item * |
=item * |
X<build_filters()> |
X<build_filters()> |
B<build_filters($filterlist,$type,$roleelement,$multelement,$filter,$action,$numfiltersref,$caller,$cloneruname,$clonerudom,$typeelem)>: |
B<build_filters($filterlist,$type,$roleelement,$multelement,$filter,$action,$numfiltersref,$caller,$cloneruname,$clonerudom,$typeelem,$codetitlesref>: |
|
|
|
|
Input: 11 - anonymous array of search criteria; course type; $roleelement ; $multelement ; anonymous hash of criteria and their values; form action; ref to scalar (count of number of elements in institutional codes -- e.g., 4 for year, semester, department, and number); caller context (e.g., set to 'modifycourse' when routine is called from lonmodifycourse.pm), username and domain of new course owner who wants to clone, $tyepelem |
Input: 12 - anonymous array of search criteria; course type; $roleelement ; $multelement ; anonymous hash of criteria and their values; form action; ref to scalar (count of number of elements in institutional codes -- e.g., 4 for year, semester, department, and number); caller context (e.g., set to 'modifycourse' when routine is called from lonmodifycourse.pm); username and domain of new course owner who wants to clone, $typeelem; reference to array of titles of components in institutional codes (official courses). |
|
|
Output: 1 - $output - HTML for display of search criteria, and hidden form elements. |
Output: 1 - $output - HTML for display of search criteria, and hidden form elements. |
|
|
Line 1172 Side Effects: None
|
Line 1245 Side Effects: None
|
|
|
=item * |
=item * |
X<search_courses()> |
X<search_courses()> |
B<search_courses($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom)>: |
B<search_courses($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom, |
|
$domcloner,$codetitles)>: |
|
|
|
|
Input: 7 - request object, course type, search scope: only courses in which user has active role (1), or any course (0); anonymous hash of criteria and their values; for institutional codes - number of categories; optional username of new course owner, optional domain of new course owner). Last two needed when search is for courses to clone from course request form, or course creation form (DC). |
Input: 9 - request object, course type, search scope: only courses in which user has active role (1), or any course (0); anonymous hash of criteria and their values; for institutional codes - number of categories; optional username of new course owner, optional domain of new course owner). Seventh and eighth needed when search is for courses to clone from course request form, or course creation form (DC). Optional "domcloner" flag (has value=1 if user has ccc priv in |
|
domain being filtered by (used when DC is using course creation form). Ninth is reference to array of titles of components in institutional codes (official courses). |
|
|
Output: 1 - %courses - hash of courses satisfying search criteria, keys = course IDs, values are corresponding colon-separated escaped description, institutional code, owner and type. |
Output: 1 - %courses - hash of courses satisfying search criteria, keys = course IDs, values are corresponding colon-separated escaped description, institutional code, owner and type. |
|
|
Line 1235 javascript functions used when user sele
|
Line 1310 javascript functions used when user sele
|
|
|
=item |
=item |
|
|
(g) Scantron Operator uploading a scantron file to a course - course number is written to visible form element in opener window. Child window closes. |
(g) Bubblesheet Scanning Operator uploading a bubblesheet file to a course - course number is written to visible form element in opener window. Child window closes. |
|
|
=item |
=item |
|
|