version 1.88, 2009/10/31 14:27:48
|
version 1.89, 2009/11/03 14:32:44
|
Line 102 sub handler {
|
Line 102 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'})) { |
if ($env{'form.form'} eq 'cu') { |
$loaditem{'onload'} .= 'setRoles();setSections();'; |
$loaditem{'onload'} .= 'setRoles();'; |
|
} |
|
$loaditem{'onload'} .= '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 300 sub display_matched_courses {
|
Line 297 sub display_matched_courses {
|
$r->print('<form name="courselist" method="post" action="'.$action.'">'); |
$r->print('<form name="courselist" method="post" action="'.$action.'">'); |
if ($env{'form.form'} eq 'modifycourse') { |
if ($env{'form.form'} eq 'modifycourse') { |
if ($numcourses > 0) { |
if ($numcourses > 0) { |
my $cctitle = &Apache::lonnet::plaintext('cc',$type); |
my $ccrole = 'cc'; |
|
if ($type eq 'Community') { |
|
$ccrole = 'co'; |
|
} |
|
my $cctitle = &Apache::lonnet::plaintext($ccrole,$type); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $ccrolechk = ' checked="checked" '; |
my $ccrolechk = ' checked="checked" '; |
my $menuchk = ' '; |
my $menuchk = ' '; |
Line 313 sub display_matched_courses {
|
Line 314 sub display_matched_courses {
|
.'<legend>'.&mt('Action').'</legend>' |
.'<legend>'.&mt('Action').'</legend>' |
.'<div class="LC_nobreak"><label>' |
.'<div class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
.' '.&mt('Enter the course with the role of [_1].',$cctitle) |
.' '); |
.'</label></div>' |
if ($type eq 'Community') { |
|
$r->print(&mt('Enter the community with the role of [_1].',$cctitle)); |
|
} else { |
|
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
|
} |
|
$r->print('</label></div>' |
.'<div class="LC_nobreak"><label>' |
.'<div class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> ' |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
.&mt('View or modify course settings which only a [_1] may modify.',$dctitle) |
if ($type eq 'Community') { |
.'</label></div>' |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
|
} else { |
|
$r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); |
|
} |
|
$r->print('</label></div>' |
.'</fieldset>' |
.'</fieldset>' |
.'<br />' |
.'<br />' |
); |
); |
Line 349 sub display_matched_courses {
|
Line 359 sub display_matched_courses {
|
if (%courses) { |
if (%courses) { |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table_header_row()); |
$r->print(&Apache::loncommon::start_data_table_header_row()); |
|
my $titlehdr = &mt('Course Title'); |
|
if ($type eq 'Community') { |
|
$titlehdr = &mt('Community Title'); |
|
} |
$r->print('<th>'.&mt('Select').'</th>' |
$r->print('<th>'.&mt('Select').'</th>' |
.'<th>'.&mt('Course Title').'</th>' |
.'<th>'.$titlehdr.'</th>' |
.'<th>'.&mt('Domain').'</th>' |
.'<th>'.&mt('Domain').'</th>'); |
.'<th>'.&mt('Course Code').'</th>' |
unless ($type eq 'Community') { |
.'<th>'.&mt('Owner/Co-owner(s)').'</th>' |
$r->print('<th>'.&mt('Course Code').'</th>'); |
.'<th>'.&mt('Type').'</th>' |
} |
); |
$r->print('<th>'.&mt('Owner/Co-owner(s)').'</th>'); |
if ($showroles) { |
if ($showroles) { |
$r->print('<th>'.&mt("Role(s) for [_1]", |
$r->print('<th>'.&mt("Role(s) for [_1]", |
&Apache::loncommon::plainname($env{'form.personfilter'}, |
&Apache::loncommon::plainname($env{'form.personfilter'}, |
Line 407 sub display_matched_courses {
|
Line 421 sub display_matched_courses {
|
$r->print(&Apache::lonnet::domain($cdom,'description')? |
$r->print(&Apache::lonnet::domain($cdom,'description')? |
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom); |
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom); |
$r->print('</td>'); |
$r->print('</td>'); |
$r->print('<td>'); |
unless ($type eq 'Community') { |
if ($instcode ne '') { |
$r->print('<td>'); |
$r->print(&unescape($instcode)); |
if ($instcode ne '') { |
} else { |
$r->print(&unescape($instcode)); |
$r->print(' '); |
} else { |
|
$r->print(' '); |
|
} |
|
$r->print('</td>'); |
} |
} |
$r->print('</td>'); |
|
$r->print('<td>'.$ownerstr.'</td>'); |
$r->print('<td>'.$ownerstr.'</td>'); |
$r->print('<td>'); |
|
if ($ttype ne '') { |
|
$r->print(&mt(&unescape($ttype))); |
|
} else { |
|
$r->print(' '); |
|
} |
|
$r->print('</td>'); |
|
if ($showroles) { |
if ($showroles) { |
$r->print('<td>'); |
$r->print('<td>'); |
my $rolestr; |
my $rolestr; |
Line 432 sub display_matched_courses {
|
Line 441 sub display_matched_courses {
|
my (undef,$crdom,$crname,$crtitle) = split('/',$role); |
my (undef,$crdom,$crname,$crtitle) = split('/',$role); |
$rolestr .= $crtitle.', '; |
$rolestr .= $crtitle.', '; |
} else { |
} else { |
$rolestr .= &Apache::lonnet::plaintext($role,$ttype).', '; |
$rolestr .= &Apache::lonnet::plaintext($role,$type).', '; |
} |
} |
} |
} |
$rolestr =~ s/\, $//; |
$rolestr =~ s/\, $//; |
Line 595 sub build_filters {
|
Line 604 sub build_filters {
|
'cog' => &mt('Type') |
'cog' => &mt('Type') |
); |
); |
|
|
$typeselectform = '<select name="type" size="1"'; |
if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) { |
if ($onchange) { |
my $typeval = 'Course'; |
$typeselectform .= 'onchange="'.$onchange.'"'; |
if ($type eq 'Community') { |
|
$typeval = 'Community'; |
|
} |
|
$typeselectform = '<input type="hidden" name="type" value="'.$typeval.'" />'; |
|
} else { |
|
$typeselectform = '<select name="type" size="1"'; |
|
if ($onchange) { |
|
$typeselectform .= 'onchange="'.$onchange.'"'; |
|
} |
|
$typeselectform .= '>'."\n"; |
|
foreach my $posstype ('Course','Community') { |
|
$typeselectform.='<option value="'.$posstype.'"'. |
|
($posstype eq $type ? ' selected="selected" ' : ''). ">".&mt($posstype)."</option>\n"; |
|
} |
|
$typeselectform.="</select>"; |
} |
} |
$typeselectform .= '>'."\n"; |
|
|
|
my ($cloneableonlyform,$cloneabletitle); |
my ($cloneableonlyform,$cloneabletitle); |
if (exists($filter->{'cloneableonly'})) { |
if (exists($filter->{'cloneableonly'})) { |
Line 643 sub build_filters {
|
Line 665 sub build_filters {
|
} |
} |
} |
} |
|
|
foreach my $posstype ('Course','Community') { |
|
$typeselectform.='<option value="'.$posstype.'"'. |
|
($posstype eq $type ? ' selected="selected" ' : ''). ">".&mt($posstype)."</option>\n"; |
|
} |
|
$typeselectform.="</select>"; |
|
my $output = qq| |
my $output = qq| |
<form method="post" name="filterpicker" action="$action"> |
<form method="post" name="filterpicker" action="$action"> |
<input type="hidden" name="form" value="$formname" /> |
<input type="hidden" name="form" value="$formname" /> |
Line 688 $multelement
|
Line 705 $multelement
|
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
} |
} |
if ($typeselectform) { |
if ($typeselectform) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'cog'}) |
if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) { |
.$typeselectform |
$output .= $typeselectform; |
.&Apache::lonhtmlcommon::row_closure(); |
} else { |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'cog'}) |
|
.$typeselectform |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
} |
} |
} |
if ($instcodeform) { |
if ($instcodeform) { |
$output .= &Apache::lonhtmlcommon::row_title($instcodetitle) |
$output .= &Apache::lonhtmlcommon::row_title($instcodetitle) |
Line 738 $multelement
|
Line 759 $multelement
|
$warning = '<div class="LC_error">'.&mt('Intended course owner does not exist'). |
$warning = '<div class="LC_error">'.&mt('Intended course owner does not exist'). |
'</div>'; |
'</div>'; |
} else { |
} else { |
|
my $ccrole; |
|
if ($type eq 'Community') { |
|
$ccrole = 'co'; |
|
} elsif ($type eq 'Course') { |
|
$ccrole = 'cc'; |
|
} |
if ($env{'form.form'} eq 'ccrs') { |
if ($env{'form.form'} eq 'ccrs') { |
$output .= '<input type="hidden" name="cloner" value="'.$env{'form.cloner'}.'" />'."\n"; |
$output .= '<input type="hidden" name="cloner" value="'.$env{'form.cloner'}.'" />'."\n"; |
} |
} |
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom, |
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom, |
'userroles',['active'], ['cc']); |
'userroles',['active'], [$ccrole]); |
foreach my $key (sort(keys(%ccroles))) { |
foreach my $key (sort(keys(%ccroles))) { |
my ($cnum,$cdom,$role) = split(':',$key); |
my ($cnum,$cdom,$role) = split(':',$key); |
$cc_clone .= $cdom.':'.$cnum.'&'; |
$cc_clone .= $cdom.':'.$cnum.'&'; |
Line 788 sub instcode_selectors {
|
Line 815 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) = @_; |
my (%courses,%showcourses,$cloner); |
my (%courses,%showcourses,$cloner,$ccrole); |
|
if ($type eq 'Community') { |
|
$ccrole = 'co'; |
|
} else { |
|
$ccrole = 'cc'; |
|
} |
if (!$onlyown) { |
if (!$onlyown) { |
$r->print(&mt('Searching ...').'<br /> <br />'); |
$r->print(&mt('Searching ...').'<br /> <br />'); |
$r->rflush(); |
$r->rflush(); |
Line 839 sub search_courses {
|
Line 871 sub search_courses {
|
my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'}, |
my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'}, |
$filter->{'persondomfilter'}, |
$filter->{'persondomfilter'}, |
'userroles',undef, |
'userroles',undef, |
['cc','in','ad','ep','ta','cr'], |
[$ccrole,'in','ad','ep','ta','cr'], |
$filter->{'domainfilter'}); |
$filter->{'domainfilter'}); |
foreach my $role (keys(%rolehash)) { |
foreach my $role (keys(%rolehash)) { |
my ($cnum,$cdom,$courserole) = split(':',$role); |
my ($cnum,$cdom,$courserole) = split(':',$role); |