version 1.8.2.3, 2010/01/03 01:09:41
|
version 1.28.2.2, 2010/09/17 02:10:42
|
Line 28
|
Line 28
|
############################################################### |
############################################################### |
############################################################## |
############################################################## |
|
|
|
=pod |
|
|
|
=head1 NAME |
|
|
|
courseprefs- Handler to set/modify course configuration |
|
|
|
=head1 SYNOPSIS |
|
|
|
courseprefs provides an interface for setting general course configuration |
|
|
|
=head1 DESCRIPTION |
|
|
|
This module is used for configuration of a course |
|
|
|
=head1 INTERNAL SUBROUTINES |
|
|
|
=over |
|
|
|
=item get_allitems() |
|
|
|
=item print_config_box() |
|
|
|
=item process_changes() |
|
|
|
=item get_sec_str() |
|
|
|
=item check_clone() |
|
|
|
=item store_changes() |
|
|
|
=item update_env() |
|
|
|
=item display_disallowed() |
|
|
|
=item get_course() |
|
|
|
=item get_jscript() |
|
|
|
=item cloners_javascript() |
|
|
|
=item print_courseinfo() |
|
|
|
=item new_cloners_dom_row() |
|
|
|
=item can_modify_catsettings() |
|
|
|
=item assign_course_categories() |
|
|
|
=item print_localization() |
|
|
|
=item get_lang_choices() |
|
|
|
=item print_feedback() |
|
|
|
=item user_table() |
|
|
|
=item select_recipient() |
|
|
|
=item select_sections() |
|
|
|
=item print_discussion() |
|
|
|
=item role_checkboxes() |
|
|
|
=item print_classlists() |
|
|
|
=item print_appearance() |
|
|
|
=item print_grading() |
|
|
|
=item print_printouts() |
|
|
|
=item print_spreadsheet() |
|
|
|
=item print_bridgetasks() |
|
|
|
=item print_other() |
|
|
|
=item get_other_items() |
|
|
|
=item item_table_row_start() |
|
|
|
=item item_table_row_end() |
|
|
|
=item yes_no_radio() |
|
|
|
=item select_from_options() |
|
|
|
=item make_item_rows() |
|
|
|
Creates table used to display and set course configuration items. |
|
|
|
Inputs: $cdom,$items,$ordered,$settings,$rowtotal,$crstype |
|
where $cdom is course's domain, $items is HASH ref for current config |
|
item, $ordered is ARRAY ref of items to include in row in |
|
display order, $settings is HASH ref of current values forrow, |
|
$rowtotal is SCALAR ref used to accumulate row count, $crstype is |
|
course type. |
|
|
|
Returns: $datatable |
|
HTML mark-up of data table which accumulates individual rows. |
|
|
|
=item nothidepriv_row() |
|
|
|
Creates row containing form elements used to display and set |
|
whether Domain coordinators who are currently included in |
|
advanced course user .db file for a course are to be hidden (e.g., |
|
in syllabus, or from course user lists). |
|
|
|
Inputs: $cdom,$item,$settings,$crstype |
|
where $cdom is course domain, item is nothideprivileged, $settings is |
|
HASH ref of the current values for nothideprivileged, $crstype is |
|
course type (Course or Community). |
|
|
|
Return: $datatable |
|
HTML mark-up for Privileged users (Domain Coordinators) in staff listing. |
|
|
|
=item print_hdrfmt_row() |
|
|
|
Creates row containing form elements used to display and set |
|
substitution items and text to be used in the header included |
|
on printouts. |
|
|
|
Inputs: $item,$settings |
|
where $item is print_header_format, and $settings is a HASH ref |
|
of the current values stored for print_header_format. |
|
|
|
Returns: $output |
|
HTML mark-up containing Javascript functions: reOrder() and getIndexByName() |
|
used to dynamically update position selectboxes, and HTML table elements |
|
for the "Print header format" row. |
|
|
|
=item position_selector() |
|
|
|
Creates a select box which can be used to reorder substitutions |
|
and text included in a printout header. |
|
|
|
Inputs: $pos,$num,$maxnum |
|
where $pos is current position, $num is the unique identifier, |
|
and $maxnum is the total number of items (both substitutions |
|
and text in the printout header. |
|
|
|
Returns: $output |
|
HTML mark-up for the selectbox and a hidden form element containing |
|
the current position. |
|
|
|
=item substitution_selector() |
|
|
|
Creates a combination of select box for choosing an item |
|
(student name, course ID or assignment note) to substitute, |
|
and a corresponding size limit in the header used for printouts. |
|
|
|
Inputs: $num,$subst,$limit,$crstype |
|
where $num is the unique identifier, $subst is the current |
|
substitution (n,c or a, for name, course or note respectively, |
|
$limit is the current size limit (integer), and $crstype is |
|
course type - course or community. |
|
|
|
Returns: $output |
|
HTML mark-up for selectbox and textbox (separate table cells). |
|
|
|
=item change_clone() |
|
|
|
Modifies the list of courses a user can clone (stored |
|
in the user's environment.db file), called when a |
|
change is made to the list of users allowed to clone |
|
a course. |
|
|
|
Inputs: $action,$cloner |
|
where $action is add or drop, and $cloner is identity of |
|
user for whom cloning ability is to be changed in course. |
|
|
|
Returns: nothing |
|
|
|
=back |
|
|
|
=cut |
|
|
|
|
package Apache::courseprefs; |
package Apache::courseprefs; |
|
|
use strict; |
use strict; |
Line 57 sub handler {
|
Line 236 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
} else { |
} else { |
if ($navmap) { |
if ($navmap) { |
$env{'user.error.msg'}= |
if ($crstype eq 'Community') { |
"/adm/courseprefs:opa:0:0:Cannot modify course settings"; |
$env{'user.error.msg'}= |
|
"/adm/courseprefs:opa:0:0:Cannot modify community settings"; |
|
} else { |
|
$env{'user.error.msg'}= |
|
"/adm/courseprefs:opa:0:0:Cannot modify course settings"; |
|
} |
} else { |
} else { |
$env{'user.error.msg'}= |
if ($crstype eq 'Community') { |
"/adm/courseprefs::0:1:Course environment gone, reinitialize the course"; |
$env{'user.error.msg'}= |
|
"/adm/courseprefs::0:1:Course environment gone, reinitialize the community"; |
|
} else { |
|
$env{'user.error.msg'}= |
|
"/adm/courseprefs::0:1:Course environment gone, reinitialize the course"; |
|
|
|
} |
} |
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
Line 73 sub handler {
|
Line 263 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
text=>"Parameter Manager"}); |
text=>"Parameter Manager"}); |
} |
} |
|
my ($brtext,$brtitle,$crsinfotext,$crsinfodesc,$crscateg,$crshide); |
|
my %lt; |
|
if ($crstype eq 'Community') { |
|
%lt = ( |
|
conf => 'Community Configuration', |
|
edit => 'Edit Community Configuration', |
|
gens => 'General community settings', |
|
idnu => 'Community ID or number', |
|
desc => 'Community Description', |
|
ownr => 'Community Owner', |
|
cown => 'Community Co-owners', |
|
catg => 'Categorize community', |
|
excc => 'Exclude from community catalog', |
|
clon => 'Users allowed to clone community', |
|
rept => 'Replacement titles for standard community roles', |
|
time => 'Timezone where the community is located', |
|
date => 'Locale used for community calendar', |
|
coco => 'Community Content', |
|
copo => 'Community Policy', |
|
priv => 'Domain Coordinators in community', |
|
defd => 'Default dates for member access', |
|
stuv => 'Member-viewable membership list options', |
|
stul => 'Member agreement needed to be listed', |
|
clas => 'Membership and Facilitator Listing', |
|
priv => 'Privileged users (Domain Coordinators) in facilitator listing', |
|
defc => 'Default Community Spreadsheet', |
|
defs => 'Default User Spreadsheet', |
|
seme => 'Send message to member when clicking Done on Tasks' |
|
); |
|
} else { |
|
%lt = ( |
|
conf => 'Course Configuration', |
|
edit => 'Edit Course Configuration', |
|
gens => 'General course settings', |
|
idnu => 'Course ID or number', |
|
desc => 'Course Description', |
|
ownr => 'Course Owner', |
|
cown => 'Course Co-owners', |
|
catg => 'Categorize course', |
|
excc => 'Exclude from course catalog', |
|
clon => 'Users allowed to clone course', |
|
rept => 'Replacement titles for standard course roles', |
|
time => 'Timezone in which the course takes place', |
|
date => 'Locale used for course calendar', |
|
coco => 'Course Content', |
|
copo => 'Course Policy', |
|
priv => 'Domain Coordinators in course', |
|
defd => 'Default dates for student access', |
|
stuv => 'Student-viewable classlist options', |
|
stul => 'Student agreement needed to be listed', |
|
clas => 'Classlists and Staff Listing', |
|
priv => 'Privileged users (Domain Coordinators) in staff listing', |
|
defc => 'Default Course Spreadsheet', |
|
defs => 'Default Student Spreadsheet', |
|
seme => 'Send message to student when clicking Done on Tasks', |
|
); |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/courseprefs', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/courseprefs', |
text=>"Course Configuration"}); |
text=>$lt{'conf'}}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Configuration'); |
&Apache::lonhtmlcommon::breadcrumbs($lt{'edit'}); |
|
|
my $phase = 'pickactions'; |
my $phase = 'pickactions'; |
if ( exists($env{'form.phase'}) ) { |
if ( exists($env{'form.phase'}) ) { |
Line 84 sub handler {
|
Line 331 sub handler {
|
} |
} |
|
|
if ($phase eq 'categorizecourse') { |
if ($phase eq 'categorizecourse') { |
&assign_course_categories($r); |
&assign_course_categories($r,$crstype); |
return OK; |
return OK; |
} |
} |
|
|
Line 95 sub handler {
|
Line 342 sub handler {
|
|
|
my %prefs = ( |
my %prefs = ( |
'courseinfo' => |
'courseinfo' => |
{ text => 'General course settings', |
{ text => $lt{'gens'}, |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value'}], |
ordered => ['description','courseid','categories', |
ordered => ['owner','co-owners','description','courseid', |
'hidefromcat','cloners','externalsyllabus', |
'categories','hidefromcat','externalsyllabus', |
'url','rolenames'], |
'url','rolenames','cloners'], |
itemtext => { |
itemtext => { |
description => 'Course Description', |
'owner' => $lt{'ownr'}, |
courseid => 'Course ID or number', |
'co-owners' => $lt{'cown'}, |
categories => 'Categorize course', |
'description' => $lt{'desc'}, |
hidefromcat => 'Exclude from course catalog', |
'courseid' => $lt{'idnu'}, |
cloners => 'Users allowed to clone course', |
'categories' => $lt{'catg'}, |
externalsyllabus => 'URL of Syllabus', |
'hidefromcat' => $lt{'excc'}, |
url => 'Top Level Map', |
'cloners' => $lt{'clon'}, |
rolenames => 'Replacement titles for standard course roles', |
'externalsyllabus' => 'URL of Syllabus', |
|
'url' => 'Top Level Map', |
|
'rolenames' => $lt{'rept'}, |
}, |
}, |
}, |
}, |
'localization' => |
'localization' => |
{ text => 'Language/TimeZone/Locale', |
{ text => 'Language and Time Localization', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
ordered => ['languages','timezone','datelocale'], |
ordered => ['languages','timezone','datelocale'], |
itemtext => { |
itemtext => { |
languages => 'Languages used', |
languages => 'Languages used', |
timezone => 'Timezone in which the course takes place', |
timezone => $lt{'time'}, |
datelocale => 'Locale used for course calendar', |
datelocale => $lt{'date'}, |
}, |
}, |
}, |
}, |
'feedback' => |
'feedback' => |
Line 135 sub handler {
|
Line 384 sub handler {
|
ordered => ['question.email','comment.email','policy.email'], |
ordered => ['question.email','comment.email','policy.email'], |
itemtext => { |
itemtext => { |
'question.email' => 'Resource Content', |
'question.email' => 'Resource Content', |
'comment.email' => 'Course Content', |
'comment.email' => $lt{'coco'}, |
'policy.email' => 'Course Policy', |
'policy.email' => $lt{'copo'}, |
}, |
}, |
}, |
}, |
'discussion' => |
'discussion' => |
{ text => 'Discussion and Chat', |
{ text => 'Discussion and Chat', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
ordered => ['plc.roles.denied','plc.users.denied', |
ordered => ['plc.roles.denied','plc.users.denied', |
'pch.roles.denied','pch.users.denied', |
'pch.roles.denied','pch.users.denied', |
'allow_limited_html_in_feedback', |
'allow_limited_html_in_feedback', |
Line 153 sub handler {
|
Line 400 sub handler {
|
'plc.users.denied' => 'No Resource Discussion', |
'plc.users.denied' => 'No Resource Discussion', |
'pch.roles.denied' => 'No Chat room use', |
'pch.roles.denied' => 'No Chat room use', |
'pch.users.denied' => 'No Chat room use', |
'pch.users.denied' => 'No Chat room use', |
allow_limited_html_in_feedback => 'Allow limited HTML in discussion posts', |
allow_limited_html_in_feedback => 'Allow limited HTML in discussion', |
allow_discussion_post_editing => 'Users can edit/delete own discussion posts', |
allow_discussion_post_editing => 'Users can edit/delete own discussion posts', |
}, |
}, |
}, |
}, |
'classlists' => |
'classlists' => |
{ text => 'Classlists and Staff Listing', |
{ text => $lt{'clas'}, |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Type', |
header => [{col1 => 'Type', |
col2 => 'Default dates for student access'}, |
col2 => $lt{'defd'}}, |
{col1 => 'Setting', |
{col1 => 'Setting', |
col2 => 'Privileged users (Domain Coordinators) in staff listing'}, |
col2 => $lt{'priv'}}, |
{col1 => 'Setting', |
{col1 => 'Setting', |
col2 => 'Student-viewable classlist options'}], |
col2 => $lt{'stuv'}}], |
ordered => ['default_enrollment_start_date', |
ordered => ['default_enrollment_start_date', |
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'nothideprivileged','student_classlist_view', |
'nothideprivileged','student_classlist_view', |
'student_opt_in','student_classlist_portfiles'], |
'student_classlist_opt_in','student_classlist_portfiles'], |
itemtext => { |
itemtext => { |
default_enrollment_start_date => 'Start date', |
default_enrollment_start_date => 'Start date', |
default_enrollment_end_date => 'End date', |
default_enrollment_end_date => 'End date', |
nothideprivileged => 'Domain Coodinators in course', |
nothideprivileged => $lt{'priv'}, |
student_classlist_view => 'Student-viewable classlist', |
student_classlist_view => $lt{'stuv'}, |
student_opt_in => 'Student agreement needed to be listed', |
student_classlist_opt_in => $lt{'stul'}, |
student_classlist_portfiles => 'Include link to accessible portfolio files', |
student_classlist_portfiles => 'Include link to accessible portfolio files', |
}, |
}, |
}, |
}, |
Line 183 sub handler {
|
Line 430 sub handler {
|
{ text => 'Display of resources ', |
{ text => 'Display of resources ', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value',}], |
ordered => ['default_xml_style','pageseparators', |
ordered => ['default_xml_style','pageseparators', |
'disable_receipt_display','texengine', |
'disable_receipt_display','texengine', |
'tthoptions'], |
'tthoptions'], |
itemtext => { |
itemtext => { |
default_xml_style => 'Default XML Style File', |
default_xml_style => 'Default XML style file', |
pageseparators => 'Visibly Separate Items on Pages', |
pageseparators => 'Visibly Separate Items on Pages', |
disable_receipt_display => 'Disable display of problem receipts', |
disable_receipt_display => 'Disable display of problem receipts', |
texengine => 'Force use of a specific math rendering engine', |
texengine => 'Force use of a specific math rendering engine', |
Line 217 sub handler {
|
Line 464 sub handler {
|
col2 => 'Value',}], |
col2 => 'Value',}], |
ordered => ['problem_stream_switch','suppress_tries', |
ordered => ['problem_stream_switch','suppress_tries', |
'default_paper_size','print_header_format', |
'default_paper_size','print_header_format', |
'disableexampointprint'], |
'disableexampointprint','canuse_pdfforms'], |
itemtext => { |
itemtext => { |
problem_stream_switch => 'Allow problems to be split over pages', |
problem_stream_switch => 'Allow problems to be split over pages', |
suppress_tries => 'Suppress number of tries in printing', |
suppress_tries => 'Suppress number of tries in printing', |
default_paper_size => 'Default paper type', |
default_paper_size => 'Default paper type', |
print_header_format => 'Print header format', |
print_header_format => 'Print header format', |
disableexampointprint => 'Disable automatically printing point values on exams', |
disableexampointprint => 'Disable automatically printing point values on exams', |
|
canuse_pdfforms => 'Users can print problems as PDF forms and upload later for grading', |
}, |
}, |
}, |
}, |
'spreadsheet' => |
'spreadsheet' => |
Line 235 sub handler {
|
Line 483 sub handler {
|
'spreadsheet_default_studentcalc', |
'spreadsheet_default_studentcalc', |
'spreadsheet_default_assesscalc','hideemptyrows'], |
'spreadsheet_default_assesscalc','hideemptyrows'], |
itemtext => { |
itemtext => { |
spreadsheet_default_classcalc => 'Default Course Spreadsheet', |
spreadsheet_default_classcalc => $lt{'defc'}, |
spreadsheet_default_studentcalc => 'Default Student Spreadsheet', |
spreadsheet_default_studentcalc => $lt{'defs'}, |
spreadsheet_default_assesscalc => 'Default Assessment Spreadsheet', |
spreadsheet_default_assesscalc => 'Default Assessment Spreadsheet', |
hideemptyrows => 'Hide Empty Rows in Spreadsheets', |
hideemptyrows => 'Hide Empty Rows in Spreadsheets', |
}, |
}, |
Line 249 sub handler {
|
Line 497 sub handler {
|
ordered => ['task_messages','task_grading', |
ordered => ['task_messages','task_grading', |
'suppress_embed_prompt'], |
'suppress_embed_prompt'], |
itemtext => { |
itemtext => { |
task_messages => 'Send message to student when clicking Done on Tasks', |
task_messages => $lt{'seme'}, |
task_grading => 'Bridge Task grading by instructors and TAs in sections' , |
task_grading => 'Bridge Task grading by instructors and TAs in sections' , |
suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', |
suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', |
}, |
}, |
Line 271 sub handler {
|
Line 519 sub handler {
|
my $jscript = &get_jscript($cdom,$phase,$crstype); |
my $jscript = &get_jscript($cdom,$phase,$crstype); |
my @allitems = &get_allitems(%prefs); |
my @allitems = &get_allitems(%prefs); |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems); |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype); |
} else { |
} else { |
&Apache::lonconfigsettings::display_choices($r,$phase,$context, |
&Apache::lonconfigsettings::display_choices($r,$phase,$context, |
\@prefs_order,\%prefs); |
\@prefs_order,\%prefs); |
Line 296 sub get_allitems {
|
Line 544 sub get_allitems {
|
} |
} |
|
|
sub print_config_box { |
sub print_config_box { |
my ($r,$cdom,$phase,$action,$item,$settings,$allitems) = @_; |
my ($r,$cdom,$phase,$action,$item,$settings,$allitems,$crstype) = @_; |
my $ordered = $item->{'ordered'}; |
my $ordered = $item->{'ordered'}; |
my $itemtext = $item->{'itemtext'}; |
my $itemtext = $item->{'itemtext'}; |
my $rowtotal = 0; |
my $rowtotal = 0; |
my $output = |
my $output = |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
<tr> |
<tr> |
<th align="left" valign="middle"><span class="LC_font_larger">'. |
<th align="left" valign="middle"><span class="LC_nobreak" style="font-size: larger;" >'. |
&mt($item->{text}).' '. |
&mt($item->{text}).' '. |
&Apache::loncommon::help_open_topic($item->{'help'}).'</span></th>'."\n". |
&Apache::loncommon::help_open_topic($item->{'help'}).'</span></th>'."\n". |
'</tr>'; |
'</tr>'; |
Line 311 sub print_config_box {
|
Line 559 sub print_config_box {
|
$output .= ' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested">'; |
<tr class="LC_info_row"> |
if (exists $item->{'header'}->[0]->{'col1'} || |
|
exists $item->{'header'}->[0]->{'col2'}) { |
|
$output .= ' |
|
<tr class="LC_info_row"> |
<td class="LC_left_item">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_left_item">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
|
} |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'feedback') { |
if ($action eq 'feedback') { |
$output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'classlists') { |
} elsif ($action eq 'classlists') { |
$output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal); |
$output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype); |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 335 sub print_config_box {
|
Line 587 sub print_config_box {
|
<td class="LC_right_item">'.&mt($item->{'header'}->[1]->{'col2'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[1]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
if ($action eq 'classlists') { |
if ($action eq 'classlists') { |
$output .= &print_classlists('middle',$cdom,$settings,$itemtext,\$rowtotal). |
$output .= &print_classlists('middle',$cdom,$settings,$itemtext,\$rowtotal,$crstype). |
' |
' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested">'; |
<tr class="LC_info_row"> |
if (exists $item->{'header'}->[0]->{'col1'} || |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
exists $item->{'header'}->[0]->{'col2'}) { |
<td class="LC_right_item" valign="top">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
$output .= ' |
</tr>'; |
<tr class="LC_info_row"> |
|
<td class="LC_left_item">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
|
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
|
</tr>'; |
|
} |
} |
} |
} else { |
} else { |
$output .= ' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested">'; |
<tr class="LC_info_row"> |
if (exists $item->{'header'}->[0]->{'col1'} || |
|
exists $item->{'header'}->[0]->{'col2'}) { |
|
$output .= ' |
|
<tr class="LC_info_row"> |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_right_item" valign="top">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
<td class="LC_right_item" valign="top">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
|
} |
} |
} |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'courseinfo') { |
if ($action eq 'courseinfo') { |
$output .= &print_courseinfo($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_courseinfo($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'localization') { |
} elsif ($action eq 'localization') { |
$output .= &print_localization($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_localization($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'feedback') { |
} elsif ($action eq 'feedback') { |
Line 368 sub print_config_box {
|
Line 628 sub print_config_box {
|
} elsif ($action eq 'discussion') { |
} elsif ($action eq 'discussion') { |
$output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'classlists') { |
} elsif ($action eq 'classlists') { |
$output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal); |
$output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'appearance') { |
} elsif ($action eq 'appearance') { |
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'grading') { |
} elsif ($action eq 'grading') { |
$output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'printouts') { |
} elsif ($action eq 'printouts') { |
$output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'spreadsheet') { |
} elsif ($action eq 'spreadsheet') { |
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'bridgetasks') { |
} elsif ($action eq 'bridgetasks') { |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'other') { |
} elsif ($action eq 'other') { |
$output .= &print_other($cdom,$settings,$allitems,\$rowtotal); |
$output .= &print_other($cdom,$settings,$allitems,\$rowtotal,$crstype); |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 391 sub print_config_box {
|
Line 651 sub print_config_box {
|
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($cdom,$action,$values,$item,$changes,$allitems,$disallowed) = @_; |
my ($cdom,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; |
my %newvalues; |
my %newvalues; |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
Line 503 sub process_changes {
|
Line 763 sub process_changes {
|
my @cloners = split(',',$env{'form.'.$entry}); |
my @cloners = split(',',$env{'form.'.$entry}); |
my @okcloners; |
my @okcloners; |
foreach my $cloner (@cloners) { |
foreach my $cloner (@cloners) { |
my ($uname,$udom) = split(':',$cloner); |
$cloner =~ s/^\s+//; |
if (&check_clone($udom,$disallowed,$uname) eq 'ok') { |
$cloner =~ s/\s+$//; |
if (!grep(/^\Q$cloner\E$/,@okcloners)) { |
unless ($cloner eq '') { |
push(@okcloners,$cloner); |
my ($uname,$udom) = split(':',$cloner); |
|
if (&check_clone($udom,$disallowed,$uname) eq 'ok') { |
|
if (!grep(/^\Q$cloner\E$/,@okcloners)) { |
|
push(@okcloners,$cloner); |
|
} |
} |
} |
} |
} |
} |
} |
Line 527 sub process_changes {
|
Line 791 sub process_changes {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($entry eq 'co-owners') { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $coowners = $values->{'internal.co-owners'}; |
|
my @currcoown; |
|
if ($coowners) { |
|
@currcoown = split(',',$coowners); |
|
} |
|
if (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
my $autocoowner; |
|
if (($crstype eq 'Course') && |
|
($values->{'internal.coursecode'})) { |
|
my %domconf = |
|
&Apache::lonnet::get_dom('configuration',['autoenroll'],$cdom); |
|
if (ref($domconf{'autoenroll'}) eq 'HASH') { |
|
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
|
} |
|
} |
|
unless ($autocoowner) { |
|
my @keepcoowners = &Apache::loncommon::get_env_multiple('form.coowners'); |
|
my @pendingcoowners = &Apache::loncommon::get_env_multiple('form.pendingcoowners'); |
|
my @invitecoowners = &Apache::loncommon::get_env_multiple('form.invitecoowners'); |
|
if (@invitecoowners) { |
|
push(@pendingcoowners,@invitecoowners); |
|
} |
|
$newvalues{'pendingco-owners'} = join(',',sort(@pendingcoowners)); |
|
$newvalues{'co-owners'} = join(',',sort(@keepcoowners)); |
|
if ($newvalues{'co-owners'} ne $values->{'internal.co-owners'}) { |
|
$changes->{$entry}{'co-owners'} = $newvalues{'co-owners'}; |
|
push(@{$changes->{$entry}{'changed'}},'co-owners'); |
|
} |
|
if ($newvalues{'pendingco-owners'} ne $values->{'internal.pendingco-owners'}) { |
|
$changes->{$entry}{'pendingco-owners'} = $newvalues{'pendingco-owners'}; |
|
push(@{$changes->{$entry}{'changed'}},'pendingco-owners'); |
|
} |
|
} |
|
} else { |
|
my (@newpending,@newcoown); |
|
my $uname = $env{'user.name'}; |
|
my $udom = $env{'user.domain'}; |
|
my $pendingcoowners = $values->{'internal.pendingco-owners'}; |
|
my @pendingcoown = split(',',$pendingcoowners); |
|
if ($env{'form.pending_coowoner'}) { |
|
foreach my $item (@pendingcoown) { |
|
unless ($item eq $uname.':'.$udom) { |
|
push(@newpending,$item); |
|
} |
|
} |
|
@newcoown = @currcoown; |
|
if ($env{'form.pending_coowoner'} eq 'accept') { |
|
unless (grep(/^\Q$uname\E:\Q$udom\E$/,@currcoown)) { |
|
push(@newcoown,$uname.':'.$udom); |
|
} |
|
} |
|
} elsif ($env{'form.remove_coowoner'}) { |
|
foreach my $item (@currcoown) { |
|
unless ($item eq $uname.':'.$udom) { |
|
push(@newcoown,$item); |
|
} |
|
} |
|
if ($pendingcoowners ne '') { |
|
@newpending = @pendingcoown; |
|
} |
|
} |
|
$newvalues{'pendingco-owners'} = join(',',sort(@newpending)); |
|
$newvalues{'co-owners'} = join(',',sort(@newcoown)); |
|
if ($newvalues{'co-owners'} ne $values->{'internal.co-owners'}) { |
|
$changes->{$entry}{'co-owners'} = $newvalues{'co-owners'}; |
|
push(@{$changes->{$entry}{'changed'}},'co-owners'); |
|
} |
|
if ($newvalues{'pendingco-owners'} ne $values->{'internal.pendingco-owners'}) { |
|
$changes->{$entry}{'pendingco-owners'} = $newvalues{'pendingco-owners'}; |
|
push(@{$changes->{$entry}{'changed'}},'pendingco-owners'); |
|
} |
|
} |
} elsif ($entry =~ /^default_enrollment_(start|end)_date$/) { |
} elsif ($entry =~ /^default_enrollment_(start|end)_date$/) { |
$newvalues{$entry}=&Apache::lonhtmlcommon::get_date_from_form($entry); |
$newvalues{$entry}=&Apache::lonhtmlcommon::get_date_from_form($entry); |
} elsif ($entry eq 'rolenames') { |
} elsif ($entry eq 'rolenames') { |
my $crstype = &Apache::loncommon::course_type(); |
|
my %adv_roles = |
my %adv_roles = |
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); |
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); |
my @stds = ('cc','in','ta','ep','ad','st'); |
my @stds; |
|
if ($crstype eq 'Community') { |
|
@stds = ('co'); |
|
} else { |
|
@stds = ('cc'); |
|
} |
|
push(@stds,('in','ta','ep','ad','st')); |
my (@replacements,@regulars); |
my (@replacements,@regulars); |
foreach my $role (@stds) { |
foreach my $role (@stds) { |
if ($values->{$role.'.plaintext'} ne '') { |
if ($values->{$role.'.plaintext'} ne '') { |
push(@replacements,$role); |
push(@replacements,$role); |
} else { |
} else { |
push(@regulars,$role); |
push(@regulars,$role); |
} |
} |
} |
} |
foreach my $stdrole (@stds) { |
foreach my $stdrole (@stds) { |
my $ext_entry = $entry.'_'.$stdrole; |
my $ext_entry = $entry.'_'.$stdrole; |
my $stdname = &Apache::lonnet::plaintext($stdrole,$crstype, |
my $stdname = &Apache::lonnet::plaintext($stdrole,$crstype, |
Line 690 sub process_changes {
|
Line 1033 sub process_changes {
|
$hdr .= $env{'form.printfmthdr_limit_'.$i}; |
$hdr .= $env{'form.printfmthdr_limit_'.$i}; |
} |
} |
$hdr .= $env{'form.printfmthdr_sub_'.$i}; |
$hdr .= $env{'form.printfmthdr_sub_'.$i}; |
} elsif ($env{'form.printfmthdr_sub_'.$i} ne '') { |
} elsif ($env{'form.printfmthdr_text_'.$i} ne '') { |
$hdr = $env{'form.printfmthdr_sub_'.$i}; |
$hdr = $env{'form.printfmthdr_text_'.$i}; |
} |
} |
$newhdr[$env{'form.printfmthdr_pos_'.$i}] = $hdr; |
$newhdr[$env{'form.printfmthdr_pos_'.$i}] = $hdr; |
} |
} |
Line 738 sub process_changes {
|
Line 1081 sub process_changes {
|
} else { |
} else { |
$newvalues{$entry} = $env{'form.'.$entry}; |
$newvalues{$entry} = $env{'form.'.$entry}; |
} |
} |
if ($newvalues{$entry} ne $values->{$entry}) { |
unless ($entry eq 'co-owners') { |
$changes->{$entry} = $newvalues{$entry}; |
if ($newvalues{$entry} ne $values->{$entry}) { |
|
$changes->{$entry} = $newvalues{$entry}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 789 sub check_clone {
|
Line 1134 sub check_clone {
|
} |
} |
|
|
sub store_changes { |
sub store_changes { |
my ($cdom,$cnum,$prefs_order,$actions,$prefs,$values,$changes) = @_; |
my ($cdom,$cnum,$prefs_order,$actions,$prefs,$values,$changes,$crstype) = @_; |
my ($chome,$output); |
my ($chome,$output); |
my (%storehash,@delkeys,@need_env_update); |
my (%storehash,@delkeys,@need_env_update,@oldcloner); |
if ((ref($values) eq 'HASH') && (ref($changes) eq 'HASH')) { |
if ((ref($values) eq 'HASH') && (ref($changes) eq 'HASH')) { |
%storehash = %{$values}; |
%storehash = %{$values}; |
} else { |
} else { |
$output = &mt('No changes made to course settings.'); |
if ($crstype eq 'Community') { |
return; |
$output = &mt('No changes made to community settings.'); |
|
} else { |
|
$output = &mt('No changes made to course settings.'); |
|
} |
|
return $output; |
} |
} |
my %yesno = ( |
my %yesno = ( |
hidefromcat => '1', |
hidefromcat => '1', |
Line 811 sub store_changes {
|
Line 1160 sub store_changes {
|
$output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'; |
$output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'; |
if (ref($changes->{$item}) eq 'HASH') { |
if (ref($changes->{$item}) eq 'HASH') { |
if (keys(%{$changes->{$item}}) > 0) { |
if (keys(%{$changes->{$item}}) > 0) { |
$output .= &mt('Changes made:').'<ul>'; |
$output .= &mt('Changes made:').'<ul style="list-style:none;">'; |
if ($item eq 'other') { |
if ($item eq 'other') { |
foreach my $key (sort(keys(%{$changes->{$item}}))) { |
foreach my $key (sort(keys(%{$changes->{$item}}))) { |
$storehash{$key} = $changes->{$item}{$key}; |
$storehash{$key} = $changes->{$item}{$key}; |
if ($changes->{$item}{$key} eq '') { |
if ($changes->{$item}{$key} eq '') { |
push(@delkeys,$key); |
push(@delkeys,$key); |
$output .= '<li>'.&mt('Deleted setting for [_1]','<i>'.$key.'</i>').'</li>'; |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]','<i>'.$key.'</i>')).'</li>'; |
} else { |
} else { |
$output .= '<li>'.&mt('[_1] set to [_2]','<i>'.$key.'</i>', |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]','<i>'.$key.'</i>', |
"'$storehash{$key}'").'</li>'; |
"'$storehash{$key}'")).'</li>'; |
} |
} |
} |
} |
} else { |
} else { |
Line 832 sub store_changes {
|
Line 1181 sub store_changes {
|
foreach my $key (@settings) { |
foreach my $key (@settings) { |
if ($key eq 'rolenames') { |
if ($key eq 'rolenames') { |
my $displayname = $prefs->{$item}->{'itemtext'}{$key}; |
my $displayname = $prefs->{$item}->{'itemtext'}{$key}; |
my $crstype = &Apache::loncommon::course_type(); |
|
my $msg; |
my $msg; |
foreach my $role ('cc','in','ta','ep','ad','st') { |
my @roles; |
|
if ($crstype eq 'Community') { |
|
@roles = ('co'); |
|
} else { |
|
@roles = ('cc'); |
|
} |
|
push(@roles,('in','ta','ep','ad','st')); |
|
foreach my $role (@roles) { |
next if (!exists($changes->{$item}{$key.'_'.$role})); |
next if (!exists($changes->{$item}{$key.'_'.$role})); |
my $stdname = &Apache::lonnet::plaintext($role,$crstype,undef,1); |
my $stdname = &Apache::lonnet::plaintext($role,$crstype,undef,1); |
my $newname = $changes->{$item}{$key.'_'.$role}; |
my $newname = $changes->{$item}{$key.'_'.$role}; |
Line 846 sub store_changes {
|
Line 1201 sub store_changes {
|
"'<b>".$newname."</b>'").'</li>'; |
"'<b>".$newname."</b>'").'</li>'; |
} |
} |
if ($msg ne '') { |
if ($msg ne '') { |
$output .= '<li>'.&mt($displayname).'<ul>'.$msg.'</ul></li>'; |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt($displayname)).'<ul class="LC_success">'.$msg.'</ul></li>'; |
} |
} |
} else { |
} else { |
next if (!exists($changes->{$item}{$key})); |
next if (!exists($changes->{$item}{$key})); |
my ($displayname,$text); |
my ($displayname,$text); |
$text = $prefs->{$item}->{'itemtext'}{$key}; |
$text = $prefs->{$item}->{'itemtext'}{$key}; |
my $displayval = $changes->{$item}{$key}; |
my $displayval; |
|
unless ($key eq 'co-owners') { |
|
$displayval = $changes->{$item}{$key}; |
|
} |
if ($item eq 'feedback') { |
if ($item eq 'feedback') { |
if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { |
if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { |
$text = $prefs->{$item}->{'itemtext'}{$1.$2}; |
$text = $prefs->{$item}->{'itemtext'}{$1.$2}; |
Line 904 sub store_changes {
|
Line 1262 sub store_changes {
|
$displayname = &mt($text); |
$displayname = &mt($text); |
} |
} |
if (defined($yesno{$key})) { |
if (defined($yesno{$key})) { |
$displayval = 'no'; |
$displayval = &mt('No'); |
if ($changes->{$item}{$key} eq 'yes') { |
if ($changes->{$item}{$key} eq 'yes') { |
$displayval = 'yes'; |
$displayval = &mt('Yes'); |
} |
} |
} elsif (($key =~ /^default_enrollment_(start|end)_date$/) && ($displayval)) { |
} elsif (($key =~ /^default_enrollment_(start|end)_date$/) && ($displayval)) { |
$displayval = &Apache::lonlocal::locallocaltime($displayval); |
$displayval = &Apache::lonlocal::locallocaltime($displayval); |
} elsif ($key eq 'categories') { |
} elsif ($key eq 'categories') { |
$displayval = $env{'form.categories_display'}; |
$displayval = $env{'form.categories_display'}; |
} |
} elsif ($key eq 'canuse_pdfforms') { |
if ($changes->{$item}{$key} eq '') { |
if ($changes->{$item}{$key} eq '1') { |
|
$displayval = &mt('Yes'); |
|
} elsif ($changes->{$item}{$key} eq '0') { |
|
$displayval = &mt('No'); |
|
} |
|
} |
|
if ($key eq 'co-owners') { |
|
if (ref($changes->{$item}{$key}) eq 'HASH') { |
|
if (ref($changes->{$item}{$key}{'changed'}) eq 'ARRAY') { |
|
foreach my $type ('co-owners','pendingco-owners') { |
|
next unless (grep(/^\Q$type\E$/,@{$changes->{$item}{$key}{'changed'}})); |
|
if ($type eq 'pendingco-owners') { |
|
if (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
$displayname = &mt('Invited as co-owners, pending acceptance'); |
|
} |
|
} |
|
if ($changes->{$item}{$key}{$type} eq '') { |
|
push(@delkeys,'internal.'.$type); |
|
if (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
|
'<i>'.$displayname.'</i>')).'</li>'; |
|
} |
|
} elsif (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
$displayval = join(', ',map { &Apache::loncommon::plainname(split(':',$_)); } split(',',$changes->{$item}{$key}{$type})); |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
|
'<i>'.$displayname.'</i>', |
|
"'<b>$displayval</b>'")).'</li>'; |
|
} |
|
} |
|
} |
|
unless (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
if ($env{'form.pending_coowoner'} eq 'accept') { |
|
$displayval = &mt('on'); |
|
} elsif ($env{'form.pending_coowoner'} eq 'decline') { |
|
$displayval = ''; |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Invitation to be co-owner declined')).'</li>'; |
|
} elsif ($env{'form.remove_coowoner'}) { |
|
$displayval = &mt('off'); |
|
} |
|
if ($displayval) { |
|
$displayname = &mt('Your co-ownership status'); |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
|
'<i>'.$displayname.'</i>', |
|
"'<b>$displayval</b>'")).'</li>'; |
|
} |
|
} |
|
} |
|
} elsif ($changes->{$item}{$key} eq '') { |
push(@delkeys,$key); |
push(@delkeys,$key); |
$output .= '<li>'.&mt('Deleted setting for [_1]', |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
'<i>'.$displayname.'</i>').'</li>'; |
'<i>'.$displayname.'</i>')).'</li>'; |
} else { |
} else { |
$output .= '<li>'.&mt('[_1] set to [_2]', |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
'<i>'.$displayname.'</i>', |
'<i>'.$displayname.'</i>', |
"'<b>$displayval</b>'"); |
"'<b>$displayval</b>'")); |
if ($key eq 'url') { |
if ($key eq 'url') { |
my $bkuptime=time; |
my $bkuptime=time; |
$output .= (' 'x2).&mt('(Previous URL backed up)').': '. |
$output .= (' 'x2).&mt('(Previous URL backed up)').': '. |
Line 928 sub store_changes {
|
Line 1333 sub store_changes {
|
} |
} |
$output .= '</li>'; |
$output .= '</li>'; |
} |
} |
$storehash{$key} = $changes->{$item}{$key}; |
if ($key eq 'co-owners') { |
|
if (ref($changes->{$item}{$key}) eq 'HASH') { |
|
if (ref($changes->{$item}{$key}{'changed'}) eq 'ARRAY') { |
|
foreach my $type ('co-owners','pendingco-owners') { |
|
next unless (grep(/^\Q$type\E$/,@{$changes->{$item}{$key}{'changed'}})); |
|
$storehash{'internal.'.$type} = $changes->{$item}{$key}{$type}; |
|
} |
|
} |
|
} |
|
} else { |
|
$storehash{$key} = $changes->{$item}{$key}; |
|
} |
|
} |
|
if ($key eq 'cloners') { |
|
# Get existing cloners |
|
my %clonenames = |
|
&Apache::lonnet::dump('environment',$cdom,$cnum,'cloners'); |
|
if ($clonenames{'cloners'} =~ /,/) { |
|
@oldcloner = split(/\s*\,\s*/,$clonenames{'cloners'}); |
|
} else { |
|
$oldcloner[0] = $clonenames{'cloners'}; |
|
} |
} |
} |
if (($key eq 'description') || ($key eq 'cloners') || |
if (($key eq 'description') || ($key eq 'cloners') || |
($key eq 'hidefromcat') || ($key eq 'categories')) { |
($key eq 'hidefromcat') || ($key eq 'categories') || |
|
($key eq 'co-owners')) { |
push(@need_env_update,$key); |
push(@need_env_update,$key); |
} |
} |
} |
} |
Line 939 sub store_changes {
|
Line 1366 sub store_changes {
|
} |
} |
$output .= '</ul>'; |
$output .= '</ul>'; |
} else { |
} else { |
$output = &mt('No changes made to course settings.'); |
if ($crstype eq 'Community') { |
|
$output = &mt('No changes made to community settings.'); |
|
} else { |
|
$output = &mt('No changes made to course settings.'); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
if (&Apache::lonnet::put('environment',\%storehash,$cdom,$cnum) eq 'ok') { |
if (&Apache::lonnet::put('environment',\%storehash,$cdom,$cnum) eq 'ok') { |
|
if (ref($changes) eq 'HASH') { |
|
if (ref($changes->{'courseinfo'}) eq 'HASH') { |
|
if (exists($changes->{'courseinfo'}{'cloners'})) { |
|
&change_clone($cdom,$cnum,$changes->{'courseinfo'}{'cloners'}, |
|
\@oldcloner); |
|
} |
|
} |
|
} |
if (@delkeys) { |
if (@delkeys) { |
if (&Apache::lonnet::del('environment',\@delkeys,$cdom,$cnum) ne 'ok') { |
if (&Apache::lonnet::del('environment',\@delkeys,$cdom,$cnum) ne 'ok') { |
$output .= '<br /><span class="LC_error">'. |
$output .= '<br /><span class="LC_error">'; |
&mt('An error occurred when removing course settings which are no longer in use.').'</span>'; |
if ($crstype eq 'Community') { |
|
$output .= &mt('An error occurred when removing community settings which are no longer in use.'); |
|
} else { |
|
$output .= &mt('An error occurred when removing course settings which are no longer in use.'); |
|
} |
|
$output .= '</span>'; |
|
} else { |
|
foreach my $key (@delkeys) { |
|
&Apache::lonnet::delenv('course.'.$cdom.'_'.$cnum.'.'.$key); |
|
} |
} |
} |
} |
} |
if (@need_env_update) { |
if (@need_env_update) { |
Line 958 sub store_changes {
|
Line 1406 sub store_changes {
|
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
{'freshen_cache' => 1}); |
{'freshen_cache' => 1}); |
} else { |
} else { |
$output = '<span class="LC_error">'. |
$output = '<span class="LC_error">'; |
&mt('An error occurred when saving changes to course settings, which remain unchanged.').'</span>'; |
if ($crstype eq 'Community') { |
|
$output .= &mt('An error occurred when saving changes to community settings, which remain unchanged.'); |
|
} else { |
|
$output .= &mt('An error occurred when saving changes to course settings, which remain unchanged.'); |
|
} |
|
$output .= '</span>'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 979 sub update_env {
|
Line 1432 sub update_env {
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$key => $storehash->{$key}}); |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$key => $storehash->{$key}}); |
$crsinfo{$env{'request.course.id'}}{$key} = $storehash->{$key}; |
$crsinfo{$env{'request.course.id'}}{$key} = $storehash->{$key}; |
$count ++; |
$count ++; |
|
} elsif ($key eq 'co-owners') { |
|
if ($storehash->{'internal.co-owners'} ne '') { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.internal.co-owners' => $storehash->{'internal.co-owners'}}); |
|
} |
|
if ($storehash->{'internal.pendingco-owners'} ne '') { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.internal.pendingco-owners' => $storehash->{'internal.pendingco-owners'}}); |
|
} |
|
my @coowners = split(',',$storehash->{'internal.'.$key}); |
|
$crsinfo{$env{'request.course.id'}}{'co-owners'} = \@coowners; |
|
$count ++; |
} |
} |
} |
} |
if ($count) { |
if ($count) { |
Line 990 sub update_env {
|
Line 1453 sub update_env {
|
} |
} |
|
|
sub display_disallowed { |
sub display_disallowed { |
my ($item,$disallowed,$prefs) = @_; |
my ($item,$disallowed,$prefs,$crstype) = @_; |
my $output; |
my $output; |
if ((ref($disallowed) eq 'HASH') && (ref($prefs) eq 'HASH')) { |
if ((ref($disallowed) eq 'HASH') && (ref($prefs) eq 'HASH')) { |
if (keys(%{$disallowed})) { |
if (keys(%{$disallowed})) { |
Line 1006 sub display_disallowed {
|
Line 1469 sub display_disallowed {
|
my $msg = '<b>'.$disallowed->{$error}.'</b>, '.&mt('reason').' - '. |
my $msg = '<b>'.$disallowed->{$error}.'</b>, '.&mt('reason').' - '. |
$lt{$error}; |
$lt{$error}; |
if ($error eq 'newuser') { |
if ($error eq 'newuser') { |
$msg .= '<br />'.&mt('Please [_1]add the user(s)[_2] before returning to the [_3]Course Configuration[_2] to add as potential cloners.','<a href="/adm/createuser">','</a>','<a href="/adm/courseprefs">'); |
$msg .= '<br />'.&mt("Please [_1]add the user(s)[_2] before returning to the [_3]$crstype Configuration[_2] to add as potential cloners.",'<a href="/adm/createuser">','</a>','<a href="/adm/courseprefs">'); |
} |
} |
push(@fails,$msg); |
push(@fails,$msg); |
} |
} |
Line 1037 sub display_disallowed {
|
Line 1500 sub display_disallowed {
|
} elsif (($item eq 'feedback') || ($item eq 'discussion') || ($item eq 'localization')) { |
} elsif (($item eq 'feedback') || ($item eq 'discussion') || ($item eq 'localization')) { |
$output .= '<span class="LC_warning">'; |
$output .= '<span class="LC_warning">'; |
if ($item eq 'feedback') { |
if ($item eq 'feedback') { |
$output .= &mt('Unable to include as a recipient of course feedback for:'); |
if ($crstype eq 'Community') { |
|
$output .= &mt('Unable to include as a recipient of community feedback for:'); |
|
} else { |
|
$output .= &mt('Unable to include as a recipient of course feedback for:'); |
|
} |
} elsif ($item eq 'discussion') { |
} elsif ($item eq 'discussion') { |
$output .= &mt('Unable to include in user-based access control for:'); |
$output .= &mt('Unable to include in user-based access control for:'); |
} elsif ($item eq 'localization') { |
} elsif ($item eq 'localization') { |
$output .= &mt('Unable to include in course localization:'); |
if ($crstype eq 'Community') { |
|
$output .= &mt('Unable to include in community localization:'); |
|
} else { |
|
$output .= &mt('Unable to include in course localization:'); |
|
} |
} |
} |
$output .= '</span><ul>'; |
$output .= '</span><ul>'; |
foreach my $key (sort(keys(%{$disallowed}))) { |
foreach my $key (sort(keys(%{$disallowed}))) { |
Line 1181 ENDSCRIPT
|
Line 1652 ENDSCRIPT
|
|
|
|
|
sub print_courseinfo { |
sub print_courseinfo { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my ($cathash,$categoriesform); |
my ($cathash,$categoriesform,$autocoowner); |
my $crstype = &Apache::loncommon::course_type(); |
|
my %domconf = |
my %domconf = |
&Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); |
&Apache::lonnet::get_dom('configuration',['coursecategories','autoenroll'],$cdom); |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
$cathash = $domconf{'coursecategories'}{'cats'}; |
$cathash = $domconf{'coursecategories'}{'cats'}; |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
Line 1197 sub print_courseinfo {
|
Line 1667 sub print_courseinfo {
|
$settings->{'categories'},$crstype)."\n"; |
$settings->{'categories'},$crstype)."\n"; |
} |
} |
} |
} |
|
if (ref($domconf{'autoenroll'}) eq 'HASH') { |
|
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
|
} |
if (!defined($categoriesform)) { |
if (!defined($categoriesform)) { |
$categoriesform = &mt('No categories defined for this domain'); |
$categoriesform = &mt('No categories defined in this domain.'); |
} |
} |
|
|
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
|
|
|
my $replace; |
|
if ($crstype eq 'Community') { |
|
$replace = &mt('To replace the standard title for a course role, enter a title, otherwise leave blank'); |
|
} else { |
|
$replace = &mt('To replace the standard title for a course role, enter a title, otherwise leave blank'); |
|
} |
my %items = ( |
my %items = ( |
'url' => { |
'url' => { |
text => '<b>'.&mt($itemtext->{'url'}).'</b>'.(' 'x2). |
text => '<b>'.&mt($itemtext->{'url'}).'</b>'.(' 'x2). |
Line 1219 sub print_courseinfo {
|
Line 1698 sub print_courseinfo {
|
input => 'textbox', |
input => 'textbox', |
size => '25', |
size => '25', |
}, |
}, |
|
'owner' => { |
|
text => '<b>'.&mt($itemtext->{'owner'}).'</b>', |
|
}, |
|
'co-owners' => { |
|
text => '<b>'.&mt($itemtext->{'co-owners'}).'</b>', |
|
}, |
'courseid' => { |
'courseid' => { |
text => '<b>'.&mt($itemtext->{'courseid'}).'</b><br />'.'('. |
text => '<b>'.&mt($itemtext->{'courseid'}).'</b><br />'.'('. |
&mt('internal, optional').')', |
&mt('internal, optional').')', |
Line 1227 sub print_courseinfo {
|
Line 1712 sub print_courseinfo {
|
}, |
}, |
'cloners' => { |
'cloners' => { |
text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'. |
text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'. |
&mt('Course Coordinators included automatically'), |
&mt('Owner and Coordinators included automatically'), |
input => 'textbox', |
input => 'textbox', |
size => '40', |
size => '40', |
}, |
}, |
'rolenames' => { |
'rolenames' => { |
text => '<b>'.&mt($itemtext->{'rolenames'}).'</b><br />'. |
text => '<b>'.&mt($itemtext->{'rolenames'}).'</b><br />'. |
'('.&mt('To replace the standard title for a course role, enter a title, otherwise leave blank').')', |
'('.$replace.')', |
input => 'textbox', |
input => 'textbox', |
size => '20', |
size => '20', |
}, |
}, |
Line 1299 sub print_courseinfo {
|
Line 1784 sub print_courseinfo {
|
if (@entries > 0) { |
if (@entries > 0) { |
foreach my $entry (@entries) { |
foreach my $entry (@entries) { |
my ($uname,$udom) = split(/:/,$entry); |
my ($uname,$udom) = split(/:/,$entry); |
|
if ($udom =~ /^$match_domain$/) { |
|
unless (&Apache::lonnet::domain($udom)) { |
|
next; |
|
} |
|
} else { |
|
next; |
|
} |
if ($uname eq '*') { |
if ($uname eq '*') { |
$datatable .= |
$datatable .= |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td valign="top" align="left"><span class="LC_nobreak">'. |
'<td valign="top" align="left"><span class="LC_nobreak">'. |
&mt('Domain:').'<b> '.$udom. |
&mt('Any user in domain:').'<b> '.$udom. |
'</b><input type="hidden" name="cloners_dom_'.$num. |
'</b><input type="hidden" name="cloners_dom_'.$num. |
'" value="'.$udom.'" /></span><br />'. |
'" value="'.$udom.'" /></span><br />'. |
'<span class="LC_nobreak"><label><input type="checkbox" '. |
'<span class="LC_nobreak"><label><input type="checkbox" '. |
Line 1311 sub print_courseinfo {
|
Line 1803 sub print_courseinfo {
|
&mt('Delete').'</label></span></td>'. |
&mt('Delete').'</label></span></td>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
$num ++; |
$num ++; |
} else { |
} elsif (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
push(@cloners,$entry); |
unless (grep(/^\Q$entry\E$/,@cloners)) { |
|
push(@cloners,$entry); |
|
} |
} |
} |
} |
} |
} |
} |
Line 1345 sub print_courseinfo {
|
Line 1839 sub print_courseinfo {
|
&Apache::loncommon::end_data_table(); |
&Apache::loncommon::end_data_table(); |
} elsif ($item eq 'rolenames') { |
} elsif ($item eq 'rolenames') { |
$datatable .= &Apache::loncommon::start_data_table(); |
$datatable .= &Apache::loncommon::start_data_table(); |
foreach my $role ('cc','in','ta','ep','ad','st') { |
my @roles; |
|
if ($crstype eq 'Community') { |
|
@roles = ('co'); |
|
} else { |
|
@roles = ('cc'); |
|
} |
|
push (@roles,('in','ta','ep','ad','st')); |
|
foreach my $role (@roles) { |
$datatable .= &Apache::loncommon::start_data_table_row(). |
$datatable .= &Apache::loncommon::start_data_table_row(). |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&Apache::lonnet::plaintext($role,$crstype,undef,1). |
&Apache::lonnet::plaintext($role,$crstype,undef,1). |
Line 1361 sub print_courseinfo {
|
Line 1862 sub print_courseinfo {
|
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'. |
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'. |
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item}, |
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item}, |
$items{$item}{size},$launcher); |
$items{$item}{size},$launcher); |
|
} elsif ($item eq 'owner') { |
|
my $owner = $env{'course.'.$env{'request.course.id'}.'.internal.courseowner'}; |
|
if ($owner =~ /:/) { |
|
my ($ownername,$ownerdom) = split(':',$owner); |
|
$owner = &Apache::loncommon::plainname($ownername,$ownerdom); |
|
} elsif ($owner ne '') { |
|
$owner = &Apache::loncommon::plainname($owner,$cdom); |
|
} else { |
|
$owner = &mt('None specified'); |
|
} |
|
my $domdesc = &Apache::lonnet::domain($cdom,'description'); |
|
$datatable .= $owner; |
|
} elsif ($item eq 'co-owners') { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $coowners = $env{'course.'.$env{'request.course.id'}.'.internal.co-owners'}; |
|
my @currcoown; |
|
if ($coowners) { |
|
@currcoown = split(',',$coowners); |
|
} |
|
if (&Apache::lonnet::is_course_owner($cdom,$cnum)) { |
|
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) { |
|
$datatable .= &show_autocoowners(@currcoown); |
|
} else { |
|
$datatable .= &coowner_invitations($cnum,$cdom,@currcoown); |
|
} |
|
} else { |
|
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) { |
|
$datatable .= &show_autocoowners(@currcoown); |
|
} else { |
|
$datatable .= &manage_coownership($cnum,$cdom,@currcoown); |
|
} |
|
} |
} else { |
} else { |
$datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size}); |
$datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size}); |
} |
} |
Line 1418 sub can_modify_catsettings {
|
Line 1951 sub can_modify_catsettings {
|
} |
} |
|
|
sub assign_course_categories { |
sub assign_course_categories { |
my ($r) = @_; |
my ($r,$crstype) = @_; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $hascats = 0; |
my $hascats = 0; |
Line 1438 sub assign_course_categories {
|
Line 1971 sub assign_course_categories {
|
} |
} |
my $catwin_js; |
my $catwin_js; |
if ($hascats) { |
if ($hascats) { |
my $alert = &mt("Use 'Save' in the main window to save course categories"); |
my $alert; |
|
if ($crstype eq 'Community') { |
|
$alert = &mt("Use 'Save' in the main window to save community categories"); |
|
} else { |
|
$alert = &mt("Use 'Save' in the main window to save course categories"); |
|
} |
$catwin_js = <<ENDSCRIPT; |
$catwin_js = <<ENDSCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
|
Line 1507 ENDSCRIPT
|
Line 2045 ENDSCRIPT
|
'onclick="javascript:updateCategories()" /></form><br />'; |
'onclick="javascript:updateCategories()" /></form><br />'; |
} |
} |
} else { |
} else { |
$categoriesform .= &mt('No categories defined in this domain'); |
$categoriesform .= &mt('No categories defined in this domain.'); |
} |
} |
$r->print($start_page.$categoriesform.$end_page); |
$r->print($start_page.$categoriesform.$end_page); |
return; |
return; |
} |
} |
|
|
|
sub show_autocoowners { |
|
my (@currcoown) = @_; |
|
my $output = '<i>'.&mt('Co-ownership is set automatically when a Course Coordinator role is assigned to official course personnel (from institutional data).').'</i>'; |
|
if (@currcoown > 0) { |
|
$output .= '<br />'.&mt('Current co-owners are:').' '. |
|
join(', ',map { &Apache::loncommon::plainname(split(':',$_)); } (@currcoown)); |
|
} else { |
|
$output .= '<br />'.&mt('Currently no co-owners.'); |
|
} |
|
return $output; |
|
} |
|
|
|
sub coowner_invitations { |
|
my ($cnum,$cdom,@currcoown) = @_; |
|
my ($output,@pendingcoown,@othercoords); |
|
my $pendingcoowners = |
|
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'}; |
|
if ($pendingcoowners) { |
|
@pendingcoown = split(',',$pendingcoowners); |
|
} |
|
my $ccrole = 'cc'; |
|
my %ccroles = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,undef,[$ccrole]); |
|
foreach my $key (sort(keys(%ccroles))) { |
|
my ($ccname,$ccdom,$role) = split(':',$key); |
|
next if ($key eq $env{'user.name'}.':'.$env{'user.domain'}.':'.$ccrole); |
|
unless (grep(/^\Q$ccname\E:\Q$ccdom\E$/,@currcoown,@pendingcoown)) { |
|
push(@othercoords,$ccname.':'.$ccdom); |
|
} |
|
} |
|
my $coowner_rows = @currcoown + @pendingcoown + @othercoords; |
|
if ($coowner_rows) { |
|
$output .= &Apache::loncommon::start_data_table(); |
|
if (@currcoown) { |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Current co-owners').'</i></td><td>'; |
|
foreach my $person (@currcoown) { |
|
my ($co_uname,$co_dom) = split(':',$person); |
|
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="coowners" checked="checked" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' '; |
|
} |
|
$output .= '</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
if ($pendingcoowners) { |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Invited as co-owners [_1](agreement pending)','<br />').'</i></td><td>'; |
|
foreach my $person (@pendingcoown) { |
|
my ($co_uname,$co_dom) = split(':',$person); |
|
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="pendingcoowners" checked="checked" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' '; |
|
} |
|
$output .= '</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
if (@othercoords) { |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Invite other Coordinators [_1]to become co-owners','<br />').'</i></td><td>'; |
|
foreach my $person (@othercoords) { |
|
my ($co_uname,$co_dom) = split(':',$person); |
|
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="invitecoowners" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' '; |
|
} |
|
$output .= '</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
$output .= &Apache::loncommon::end_data_table(); |
|
} else { |
|
$output = &mt('There are no coordinators to select as co-owners'); |
|
} |
|
return $output; |
|
} |
|
|
|
sub manage_coownership { |
|
my ($cnum,$cdom,@currcoown) = @_; |
|
my (@pendingcoown); |
|
my $pendingcoowners = |
|
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'}; |
|
if ($pendingcoowners) { |
|
@pendingcoown = split(',',$pendingcoowners); |
|
} |
|
my ($is_coowner,$is_pending,$output); |
|
my $uname = $env{'user.name'}; |
|
my $udom = $env{'user.domain'}; |
|
if (grep(/^\Q$uname\E:\Q$udom\E$/,@currcoown)) { |
|
$is_coowner = 1; |
|
} |
|
if (grep(/^\Q$uname\E:\Q$udom\E$/,@pendingcoown)) { |
|
$is_pending = 1; |
|
} |
|
if (@currcoown && ($is_coowner || $is_pending)) { |
|
$output = &Apache::loncommon::start_data_table(); |
|
} |
|
if (@currcoown) { |
|
if ($is_coowner || $is_pending) { |
|
$output .= &Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_row().'<td>'; |
|
} |
|
$output .= &mt('Current co-owners are:').' '. |
|
join(', ', map { &Apache::loncommon::plainname(split(':',$_)); } (@currcoown)); |
|
if ($is_coowner || $is_pending) { |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
|
if ($is_coowner || $is_pending) { |
|
if (@currcoown) { |
|
$output .= &Apache::loncommon::start_data_table_row().'<td>'; |
|
} |
|
$output .= '<span class="LC_nobreak">'; |
|
if ($is_coowner) { |
|
$output .= &mt('You are currently a co-owner:').' <label><input type="checkbox" name="remove_coowoner" value="'.$uname.':'.$udom.'" />'.&mt('Discontinue?').'</label>'; |
|
} else { |
|
$output .= &mt('The course owner has invited you to become a co-owner:').' <label><input type="radio" name="pending_coowoner" value="accept" />'.&mt('Accept?').'</label>'.(' 'x2). |
|
'<label><input type="radio" name=pending_coowoner" value="decline" />'.&mt('Decline?').'</label>'; |
|
} |
|
$output .= '</span>'; |
|
if (@currcoown) { |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
|
if (@currcoown && ($is_coowner || $is_pending)) { |
|
$output .= &Apache::loncommon::end_data_table(); |
|
} |
|
return $output; |
|
} |
|
|
sub print_localization { |
sub print_localization { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
Line 1520 sub print_localization {
|
Line 2180 sub print_localization {
|
} |
} |
my %items = ( |
my %items = ( |
languages => { |
languages => { |
text => &mt($itemtext->{'languages'}).'<br />'. |
text => '<b>'.&mt($itemtext->{'languages'}).'</b><br />'. |
&mt("(will override user's preference)"), |
&mt("(overrides individual user preference)"), |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
timezone => { |
timezone => { |
text => &mt($itemtext->{'timezone'}), |
text => '<b>'.&mt($itemtext->{'timezone'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
datelocale => { |
datelocale => { |
text => &mt($itemtext->{'datelocale'}), |
text => '<b>'.&mt($itemtext->{'datelocale'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
); |
); |
Line 1638 sub print_feedback {
|
Line 2298 sub print_feedback {
|
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
my @sections = sort( { $a <=> $b } keys(%sections)); |
my @sections = sort( { $a <=> $b } keys(%sections)); |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
currone => 'Current recipient:', |
currone => 'Current recipient:', |
curmult => 'Current recipients:', |
currmult => 'Current recipients:', |
add => 'Additional recipient:', |
add => 'Additional recipient:', |
del => 'Delete?', |
del => 'Delete?', |
sec => 'Sections:', |
sec => 'Sections:', |
); |
); |
|
|
foreach my $item (@{$ordered}) { |
foreach my $item (@{$ordered}) { |
$count ++; |
$count ++; |
$datatable .= &item_table_row_start($items{$item}{text},$count); |
$datatable .= &item_table_row_start($items{$item}{text},$count); |
if ($position eq 'top') { |
if ($position eq 'top') { |
my $includeempty = 0; |
my $includeempty = 0; |
$datatable .= &user_table($cdom,$item,\@sections, |
$datatable .= &user_table($cdom,$item,\@sections, |
$settings->{$item},\%lt); |
$settings->{$item},\%lt); |
} else { |
} else { |
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text', |
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text', |
$settings->{$item.'.text'},$items{$item}{size}); |
$settings->{$item.'.text'},$items{$item}{size}); |
} |
} |
$datatable .= &item_table_row_end(); |
$datatable .= &item_table_row_end(); |
} |
} |
Line 1703 sub user_table {
|
Line 2363 sub user_table {
|
if ($num) { |
if ($num) { |
$output .= '<tr>'. |
$output .= '<tr>'. |
'<td align="left"><i>'; |
'<td align="left"><i>'; |
if ($num > 1) { |
if ($num == 1) { |
$output .= $lt->{'currone'}; |
$output .= $lt->{'currone'}; |
} else { |
} else { |
$output .= $lt->{'currmult'}; |
$output .= $lt->{'currmult'}; |
Line 1783 sub print_discussion {
|
Line 2443 sub print_discussion {
|
} |
} |
my %items = ( |
my %items = ( |
'plc.roles.denied' => { |
'plc.roles.denied' => { |
text => '<span class="LC_nobreak"><b>'. |
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'plc.roles.denied'}).'</b>'. |
&mt($itemtext->{'plc.roles.denied'}).'</b>'. |
|
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
&mt('(role-based)'), |
&mt('(role-based)'), |
input => 'checkbox', |
input => 'checkbox', |
Line 1797 sub print_discussion {
|
Line 2456 sub print_discussion {
|
}, |
}, |
|
|
'pch.roles.denied' => { |
'pch.roles.denied' => { |
text => '<span class="LC_nobreak"><b>'. |
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'pch.roles.denied'}).'</b>'. |
&mt($itemtext->{'pch.roles.denied'}).'</b>'. |
|
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
&mt('(role-based)'), |
&mt('(role-based)'), |
input => 'checkbox', |
input => 'checkbox', |
Line 1825 sub print_discussion {
|
Line 2483 sub print_discussion {
|
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
my @sections = sort( { $a <=> $b } keys(%sections)); |
my @sections = sort( { $a <=> $b } keys(%sections)); |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
currone => 'Disallowed:', |
currone => 'Disallowed:', |
curmult => 'Disallowed:', |
currmult => 'Disallowed:', |
add => 'Disallow more:', |
add => 'Disallow more:', |
del => 'Delete?', |
del => 'Delete?', |
sec => 'Sections:', |
sec => 'Sections:', |
); |
); |
|
|
foreach my $item (@{$ordered}) { |
foreach my $item (@{$ordered}) { |
Line 1865 sub print_discussion {
|
Line 2523 sub print_discussion {
|
} |
} |
|
|
sub role_checkboxes { |
sub role_checkboxes { |
my ($cdom,$cnum,$item,$settings,$showsections) = @_; |
my ($cdom,$cnum,$item,$settings,$showsections,$crstype) = @_; |
my @roles = ('st','ad','ta','ep','in','cc'); |
my @roles = ('st','ad','ta','ep','in'); |
|
if ($crstype eq 'Community') { |
|
push(@roles,'co'); |
|
} else { |
|
push(@roles,'cc'); |
|
} |
my $output; |
my $output; |
my (@current,@curr_roles,%currsec,@sections); |
my (@current,@curr_roles,%currsec,@sections); |
if ($showsections) { |
if ($showsections) { |
Line 1903 sub role_checkboxes {
|
Line 2566 sub role_checkboxes {
|
if (grep(/^\Q$role\E$/,@current)) { |
if (grep(/^\Q$role\E$/,@current)) { |
$checked = ' checked="checked" '; |
$checked = ' checked="checked" '; |
} |
} |
my $plrole=&Apache::lonnet::plaintext($role); |
my $plrole=&Apache::lonnet::plaintext($role,$crstype); |
if ($showsections) { |
if ($showsections) { |
$output .= &Apache::loncommon::start_data_table_row(); |
$output .= &Apache::loncommon::start_data_table_row(); |
} else { |
} else { |
Line 1915 sub role_checkboxes {
|
Line 2578 sub role_checkboxes {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
} |
} |
$output .= '<td align="left"><span class="LC_nobreak"><label><input type="checkbox" name='. |
$output .= '<td align="left"><span class="LC_nobreak"><label><input type="checkbox" name="'. |
$item.'" value="'.$role.'"'.$checked.'/> '. |
$item.'" value="'.$role.'"'.$checked.'/> '. |
$plrole.'</label></span></td>'; |
$plrole.'</label></span></td>'; |
if ($showsections) { |
if ($showsections) { |
Line 1947 sub role_checkboxes {
|
Line 2610 sub role_checkboxes {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
} |
} |
$output .= '<td><span class="LC_nobreak"><label><input type="checkbox" name='. |
$output .= '<td><span class="LC_nobreak"><label><input type="checkbox" name="'. |
$item.'" value="'.$value.'"'.$checked.' /> '.$rolename. |
$item.'" value="'.$value.'"'.$checked.' /> '.$rolename. |
'</label></span></td>'; |
'</label></span></td>'; |
if ($showsections) { |
if ($showsections) { |
Line 1974 sub role_checkboxes {
|
Line 2637 sub role_checkboxes {
|
} |
} |
|
|
sub print_classlists { |
sub print_classlists { |
my ($position,$cdom,$settings,$itemtext,$rowtotal) = @_; |
my ($position,$cdom,$settings,$itemtext,$rowtotal,$crstype) = @_; |
my @ordered; |
my @ordered; |
if ($position eq 'top') { |
if ($position eq 'top') { |
@ordered = ('default_enrollment_start_date', |
@ordered = ('default_enrollment_start_date', |
Line 1983 sub print_classlists {
|
Line 2646 sub print_classlists {
|
@ordered = ('nothideprivileged'); |
@ordered = ('nothideprivileged'); |
} else { |
} else { |
@ordered = ('student_classlist_view', |
@ordered = ('student_classlist_view', |
'student_opt_in','student_classlist_portfiles'); |
'student_classlist_opt_in', |
|
'student_classlist_portfiles'); |
|
} |
|
my %lt; |
|
|
|
if ($crstype eq 'Community') { |
|
%lt = &Apache::lonlocal::texthash ( |
|
disabled => 'No viewable membership list', |
|
section => "Membership of viewer's section", |
|
all => 'List of all members', |
|
); |
|
} else { |
|
%lt = &Apache::lonlocal::texthash ( |
|
disabled => 'No viewable classlist', |
|
section => "Classlist of viewer's section", |
|
all => 'Classlist of all students', |
|
); |
} |
} |
|
|
my %items = ( |
my %items = ( |
'default_enrollment_start_date' => { |
'default_enrollment_start_date' => { |
text => '<b>'.&mt($itemtext->{'default_enrollment_start_date'}).'</b>', |
text => '<b>'.&mt($itemtext->{'default_enrollment_start_date'}).'</b>', |
Line 2003 sub print_classlists {
|
Line 2683 sub print_classlists {
|
'student_classlist_view' => { |
'student_classlist_view' => { |
text => '<b>'.&mt($itemtext->{'student_classlist_view'}).'</b>', |
text => '<b>'.&mt($itemtext->{'student_classlist_view'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => \%lt, |
disabled => &mt('No viewable classlist'), |
|
section => &mt("Classlist of viewer's section"), |
|
all => &mt('Classlist of all students'), |
|
}, |
|
order => ['disabled','all','section'], |
order => ['disabled','all','section'], |
}, |
}, |
'student_opt_in' => { |
'student_classlist_opt_in' => { |
text => '<b>'.&mt($itemtext->{'student_opt_in'}).'</b>', |
text => '<b>'.&mt($itemtext->{'student_classlist_opt_in'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
|
|
Line 2024 sub print_classlists {
|
Line 2700 sub print_classlists {
|
($settings->{'student_classlist_view'} eq 'section')) { |
($settings->{'student_classlist_view'} eq 'section')) { |
$settings->{'student_classlist_view'} = 'disabled'; |
$settings->{'student_classlist_view'} = 'disabled'; |
} |
} |
return &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_appearance { |
sub print_appearance { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
|
my $mathdef; |
|
if ($crstype eq 'Community') { |
|
$mathdef = &mt("None specified - use member's choice"); |
|
} else { |
|
$mathdef = &mt("None specified - use student's choice"); |
|
} |
my %items = ( |
my %items = ( |
'default_xml_style' => { |
'default_xml_style' => { |
text => '<b>'.&mt($itemtext->{'default_xml_style'}).'</b> '. |
text => '<b>'.&mt($itemtext->{'default_xml_style'}).'</b> '. |
Line 2059 sub print_appearance {
|
Line 2741 sub print_appearance {
|
tth => &mt('TeX to HTML'), |
tth => &mt('TeX to HTML'), |
}, |
}, |
order => ['jsMath','mimetex','tth'], |
order => ['jsMath','mimetex','tth'], |
nullval => &mt("None specified - use student's choice"), |
nullval => $mathdef, |
}, |
}, |
'tthoptions' => { |
'tthoptions' => { |
text => '<b>'.&mt($itemtext->{'tthoptions'}).'</b>', |
text => '<b>'.&mt($itemtext->{'tthoptions'}).'</b>', |
Line 2067 sub print_appearance {
|
Line 2749 sub print_appearance {
|
size => 40, |
size => 40, |
}, |
}, |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_grading { |
sub print_grading { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
Line 2090 sub print_grading {
|
Line 2772 sub print_grading {
|
}, |
}, |
'rndseed' => { |
'rndseed' => { |
text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'. |
text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'. |
'<span class="LC_error">'.'<br />'. |
'<span class="LC_warning">'.'<br />'. |
&mt('Modifying this will make problems have different numbers and answers!'). |
&mt('Modifying this will make problems have different numbers and answers!'). |
'</span>', |
'</span>', |
input => 'selectbox', |
input => 'selectbox', |
Line 2120 sub print_grading {
|
Line 2802 sub print_grading {
|
input => 'radio', |
input => 'radio', |
}, |
}, |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_printouts { |
sub print_printouts { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
Line 2162 sub print_printouts {
|
Line 2844 sub print_printouts {
|
text => '<b>'.&mt($itemtext->{'disableexampointprint'}).'</b>', |
text => '<b>'.&mt($itemtext->{'disableexampointprint'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
|
canuse_pdfforms => { |
|
text => '<b>'.&mt($itemtext->{'canuse_pdfforms'}).'</b>', |
|
input => 'selectbox', |
|
options => { |
|
1 => &mt('Yes'), |
|
0 => &mt('No'), |
|
}, |
|
order => ['1','0'], |
|
nullval => 'None specified - use domain default', |
|
} |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_spreadsheet { |
sub print_spreadsheet { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
Line 2199 sub print_spreadsheet {
|
Line 2891 sub print_spreadsheet {
|
input => 'radio', |
input => 'radio', |
}, |
}, |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_bridgetasks { |
sub print_bridgetasks { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
|
my ($stumsg,$msgnote); |
|
if ($crstype eq 'Community') { |
|
$stumsg = &mt('Send message to member'); |
|
$msgnote = &mt('Message to member and add to user notes'); |
|
} else { |
|
$stumsg = &mt('Send message to student'); |
|
$msgnote = &mt('Message to student and add to user notes'); |
|
} |
my %items = ( |
my %items = ( |
task_messages => { |
task_messages => { |
text => '<b>'.&mt($itemtext->{'task_messages'}).'</b>', |
text => '<b>'.&mt($itemtext->{'task_messages'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
only_student => &mt('Send message to student'), |
only_student => $stumsg, |
student_and_user_notes_screen => &mt('Message to student and add to user notes'), |
student_and_user_notes_screen => $msgnote, |
}, |
}, |
order => ['only_student','student_and_user_notes_screen'], |
order => ['only_student','student_and_user_notes_screen'], |
nullval => &mt('No message or record in user notes'), |
nullval => &mt('No message or record in user notes'), |
Line 2233 sub print_bridgetasks {
|
Line 2933 sub print_bridgetasks {
|
input => 'radio', |
input => 'radio', |
}, |
}, |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub print_other { |
sub print_other { |
my ($cdom,$settings,$allitems,$rowtotal) = @_; |
my ($cdom,$settings,$allitems,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) { |
return; |
return; |
} |
} |
Line 2258 sub print_other {
|
Line 2958 sub print_other {
|
input => 'textbox', |
input => 'textbox', |
size => '30', |
size => '30', |
}; |
}; |
my $output = &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal); |
my $output = &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype); |
} |
} |
|
|
sub get_other_items { |
sub get_other_items { |
Line 2275 sub get_other_items {
|
Line 2975 sub get_other_items {
|
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
|| ($parameter eq 'type') || |
|| ($parameter eq 'type') || |
($parameter =~ m/^(cc|in|ta|ep|ad|st)\.plaintext$/)) { |
($parameter =~ m/^(cc|co|in|ta|ep|ad|st)\.plaintext$/)) { |
push(@ordered,$parameter); |
push(@ordered,$parameter); |
} |
} |
} |
} |
Line 2284 sub get_other_items {
|
Line 2984 sub get_other_items {
|
} |
} |
|
|
sub item_table_row_start { |
sub item_table_row_start { |
my ($text,$count) = @_; |
my ($text,$count,$add_class) = @_; |
my $output; |
my $output; |
if ($count%2) { |
my $css_class = ($count % 2) ? 'LC_odd_row' : 'LC_even_row'; |
$output .= '<tr class="LC_odd_row">'; |
$css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq ''); |
} else { |
$output .= '<tr class="'.$css_class.'">'."\n";; |
$output .= '<tr>'; |
|
} |
|
$output .= '<td class="LC_left_item">'.$text. |
$output .= '<td class="LC_left_item">'.$text. |
'</td><td class="LC_right_item" align="right">'; |
'</td><td class="LC_right_item">'; |
return $output; |
return $output; |
} |
} |
|
|
Line 2363 sub select_from_options {
|
Line 3061 sub select_from_options {
|
} |
} |
|
|
sub make_item_rows { |
sub make_item_rows { |
my ($cdom,$items,$ordered,$settings,$rowtotal) = @_; |
my ($cdom,$items,$ordered,$settings,$rowtotal,$crstype) = @_; |
my $datatable; |
my $datatable; |
if ((ref($items) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
if ((ref($items) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
my $count = 0; |
my $count = 0; |
Line 2371 sub make_item_rows {
|
Line 3069 sub make_item_rows {
|
$count ++; |
$count ++; |
$datatable .= &item_table_row_start($items->{$item}{text},$count); |
$datatable .= &item_table_row_start($items->{$item}{text},$count); |
if ($item eq 'nothideprivileged') { |
if ($item eq 'nothideprivileged') { |
$datatable .= ¬hidepriv_row($cdom,$item,$settings); |
$datatable .= ¬hidepriv_row($cdom,$item,$settings,$crstype); |
} elsif ($item eq 'print_header_format') { |
} elsif ($item eq 'print_header_format') { |
$datatable .= &print_hdrfmt_row($item,$settings); |
$datatable .= &print_hdrfmt_row($item,$settings); |
} elsif ($items->{$item}{input} eq 'dates') { |
} elsif ($items->{$item}{input} eq 'dates') { |
Line 2401 sub make_item_rows {
|
Line 3099 sub make_item_rows {
|
} |
} |
|
|
sub nothidepriv_row { |
sub nothidepriv_row { |
my ($cdom,$item,$settings) = @_; |
my ($cdom,$item,$settings,$crstype) = @_; |
my ($cnum) = &get_course(); |
my ($cnum) = &get_course(); |
my %nothide; |
my %nothide; |
my $datatable; |
my $datatable; |
Line 2469 sub nothidepriv_row {
|
Line 3167 sub nothidepriv_row {
|
} |
} |
$datatable .= '</table>'; |
$datatable .= '</table>'; |
} else { |
} else { |
$datatable .= &mt('No Domain Coordinators have course roles'); |
if ($crstype eq 'Community') { |
|
$datatable .= &mt('No Domain Coordinators have community roles'); |
|
} else { |
|
$datatable .= &mt('No Domain Coordinators have course roles'); |
|
} |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
Line 2484 sub print_hdrfmt_row {
|
Line 3186 sub print_hdrfmt_row {
|
$currstr .= '<b>'.&mt('Current print header:').' <span class="LC_warning"><tt>'. |
$currstr .= '<b>'.&mt('Current print header:').' <span class="LC_warning"><tt>'. |
$settings->{$item}.'</tt></span></b><br />'; |
$settings->{$item}.'</tt></span></b><br />'; |
my @current = split(/(%\d*[nca])/,$settings->{$item}); |
my @current = split(/(%\d*[nca])/,$settings->{$item}); |
foreach my $item (@current) { |
foreach my $val (@current) { |
unless ($item eq '') { |
unless ($val eq '') { |
push(@curr,$item); |
push(@curr,$val); |
} |
} |
} |
} |
$currnum = @curr; |
$currnum = @curr; |
Line 2573 ENDJS
|
Line 3275 ENDJS
|
&position_selector($pos,$currnum,$maxnum). |
&position_selector($pos,$currnum,$maxnum). |
'<b>'.&mt('New').'</b></span></td><td align="left">'. |
'<b>'.&mt('New').'</b></span></td><td align="left">'. |
&substitution_selector($currnum).'</td>'. |
&substitution_selector($currnum).'</td>'. |
'</tr>'; |
'</tr>'; |
$pos ++; |
$pos ++; |
$currnum ++; |
$currnum ++; |
$output .= '<tr>'. |
$output .= '<tr>'. |
Line 2586 ENDJS
|
Line 3288 ENDJS
|
'<input type="hidden" name="printfmthdr_maxnum" value="'. |
'<input type="hidden" name="printfmthdr_maxnum" value="'. |
$maxnum.'" /></td>'. |
$maxnum.'" /></td>'. |
'</tr>'. |
'</tr>'. |
'</table>'; |
'</table>'; |
return $output; |
return $output; |
} |
} |
|
|
Line 2606 sub position_selector {
|
Line 3308 sub position_selector {
|
} |
} |
|
|
sub substitution_selector { |
sub substitution_selector { |
my ($num,$subst,$limit) = @_; |
my ($num,$subst,$limit,$crstype) = @_; |
|
my ($stunametxt,$crsidtxt); |
|
if ($crstype eq 'Community') { |
|
$stunametxt = 'member name'; |
|
$crsidtxt = 'community ID', |
|
} else { |
|
$stunametxt = 'student name'; |
|
$crsidtxt = 'course ID', |
|
} |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
n => 'student name', |
n => $stunametxt, |
c => 'course ID', |
c => $crsidtxt, |
a => 'assignment note', |
a => 'assignment note', |
); |
); |
my $output .= &mt('Substitution').'<br />'. |
my $output .= &mt('Substitution').'<br />'. |
'<select name=""printfmthdr_sub__'.$num.'">'; |
'<select name="printfmthdr_sub_'.$num.'">'; |
if ($subst eq '') { |
if ($subst eq '') { |
$output .= '<option value="" selected="selected"> </option>'; |
$output .= '<option value="" selected="selected"> </option>'; |
} |
} |
Line 2631 sub substitution_selector {
|
Line 3341 sub substitution_selector {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub change_clone { |
|
my ($cdom,$cnum,$clonelist,$oldcloner) = @_; |
|
my $clone_crs = $cnum.':'.$cdom; |
|
if ($cnum && $cdom) { |
|
my $clone_crs = $cnum.':'.$cdom; |
|
my @allowclone; |
|
if ($clonelist =~ /,/) { |
|
@allowclone = split(',',$clonelist); |
|
} else { |
|
$allowclone[0] = $clonelist; |
|
} |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^$currclone$/,@$oldcloner)) { |
|
if ($currclone ne '*') { |
|
my ($uname,$udom) = split(/:/,$currclone); |
|
if ($uname && $udom && $uname ne '*') { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} eq '') { |
|
$currclonecrs{'cloneable'} = $clone_crs; |
|
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
foreach my $oldclone (@$oldcloner) { |
|
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
|
if ($oldclone ne '*') { |
|
my ($uname,$udom) = split(/:/,$oldclone); |
|
if ($uname && $udom && $uname ne '*' ) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
my %newclonecrs = (); |
|
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} =~ /,/) { |
|
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
|
foreach my $crs (@currclonecrs) { |
|
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
1; |
1; |