version 1.103, 2011/09/01 02:32:50
|
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 133 sub handler {
|
Line 134 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 |
Line 207 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 282 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 292 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 300 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 325 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 335 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 364 sub display_matched_courses {
|
Line 381 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 494 sub display_matched_courses {
|
Line 511 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 645 sub build_filters {
|
Line 662 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 677 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 800 $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; |
Line 856 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 892 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 991 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 1011 sub gochoose_javascript {
|
Line 1002 sub gochoose_javascript {
|
list => 'courselist', |
list => 'courselist', |
}, |
}, |
); |
); |
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 1098 ENDNAMECODE
|
Line 1088 ENDNAMECODE
|
$autosubmit |
$autosubmit |
$lastaction |
$lastaction |
} |
} |
</script> |
|
|; |
|; |
return $output; |
return &Apache::lonhtmlcommon::scripttag($output); |
} |
} |
|
|
1; |
1; |