version 1.105, 2013/02/05 17:02:40
|
version 1.110, 2014/03/11 21:42:18
|
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,$js, |
Line 206 sub handler {
|
Line 207 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 281 sub create_user_javascript {
|
Line 281 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'} || $domdefs{'textbookcredits'}))) { |
|
$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 291 sub create_user_javascript {
|
Line 298 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 299 function setSections() {
|
Line 307 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 324 sub display_matched_courses {
|
Line 341 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 334 sub display_matched_courses {
|
Line 352 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 495 sub display_matched_courses {
|
Line 513 sub display_matched_courses {
|
if (!%courses) { |
if (!%courses) { |
$r->print('<p class="LC_info">'.&mt('None found').'</p>'); |
$r->print('<p class="LC_info">'.&mt('None found').'</p>'); |
} elsif ($multiple) { |
} elsif ($multiple) { |
$r->print('<input type="button" value="'.&mt('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 676 sub build_filters {
|
Line 694 sub build_filters {
|
|| ($formname eq 'modifycourse')) { |
|| ($formname eq 'modifycourse')) { |
$officialjs = 1; |
$officialjs = 1; |
($instcodeform,$jscript,$$numtitlesref) = |
($instcodeform,$jscript,$$numtitlesref) = |
&instcode_selectors($codedom,'filterpicker',$officialjs,$codetitlesref); |
&Apache::courseclassifier::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 855 sub get_coordinator_cloneable {
|
Line 874 sub get_coordinator_cloneable {
|
} |
} |
} |
} |
|
|
sub instcode_selectors { |
|
my ($codedom,$formname,$officialjs,$codetitles) = @_; |
|
my ($output,%cat_titles,%cat_order,%cat_items); |
|
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
|
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname, |
|
\%cat_items,$codetitles,\%cat_titles,\%cat_order,$officialjs); |
|
if ($numtitles > 0) { |
|
my $official = ' checked="checked" '; |
|
my $unofficial = ''; |
|
if ($env{'form.official'} eq 'off') { |
|
$unofficial = $official; |
|
$official = ''; |
|
} |
|
$output .= '<span class="LC_nobreak">'.&mt('Official course:').' <label>'. |
|
'<input type="radio" name="official" value="on"'.$official.' />'. |
|
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
|
'<input type="radio" name="official" value="off"'.$unofficial. |
|
' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'. |
|
&Apache::courseclassifier::build_instcode_selectors($numtitles, |
|
$lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order)."\n". |
|
'<input type="hidden" name="numtitles" value="'.$numtitles.'" />'."\n". |
|
'<input type="hidden" name="state" value="listing" />'."\n"; |
|
|
|
} |
|
return ($output,$jscript,$numtitles); |
|
} |
|
|
|
sub search_courses { |
sub search_courses { |
my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_; |
my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_; |
my (%courses,%showcourses,$cloner,$ccrole); |
my (%courses,%showcourses,$cloner,$ccrole); |
Line 891 sub search_courses {
|
Line 883 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 990 sub course_chooser {
|
Line 982 sub course_chooser {
|
$output = &mt('No rights to clone')."\n"; |
$output = &mt('No rights to clone')."\n"; |
} |
} |
} else { |
} else { |
$output = '<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
$output = '<input type="button" value="'.&mt('Select').'" onclick="gochoose('. |
"'".$cnum."','".$cdom."','".$cleandesc."')".'" />'."\n"; |
"'".$cnum."','".$cdom."','".$cleandesc."')".'" />'."\n"; |
} |
} |
return $output; |
return $output; |
Line 1010 sub gochoose_javascript {
|
Line 1002 sub gochoose_javascript {
|
list => 'courselist', |
list => 'courselist', |
}, |
}, |
); |
); |
my $output .= qq| |
my $output = qq| |
function gochoose(cname,cdom,cdesc) { |
function gochoose(cname,cdom,cdesc) { |
var openerForm = "$env{'form.form'}"; |
var openerForm = "$env{'form.form'}"; |
courseCount = 0; |
courseCount = 0; |