version 1.2, 2009/04/26 00:43:14
|
version 1.27, 2010/04/02 21:39:12
|
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; |
} |
} |
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['phase','actions','origin']); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
if ($env{'form.origin'} eq 'params') { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
|
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'}); |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['phase','actions']); |
|
|
|
my $phase = 'pickactions'; |
my $phase = 'pickactions'; |
if ( exists($env{'form.phase'}) ) { |
if ( exists($env{'form.phase'}) ) { |
Line 81 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 92 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', |
ordered => ['owner','co-owners','description','courseid', |
col2 => 'Value'}], |
'categories','hidefromcat','externalsyllabus', |
ordered => ['description','courseid','categories', |
'cloners','url','rolenames'], |
'hidefromcat','cloners','externalsyllabus', |
itemtext => { |
'url','rolenames'], |
'owner' => $lt{'ownr'}, |
|
'co-owners' => $lt{'cown'}, |
|
'description' => $lt{'desc'}, |
|
'courseid' => $lt{'idnu'}, |
|
'categories' => $lt{'catg'}, |
|
'hidefromcat' => $lt{'excc'}, |
|
'cloners' => $lt{'clon'}, |
|
'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', |
|
col2 => 'Value',}], |
|
ordered => ['languages','timezone','datelocale'], |
ordered => ['languages','timezone','datelocale'], |
|
itemtext => { |
|
languages => 'Languages used', |
|
timezone => $lt{'time'}, |
|
datelocale => $lt{'date'}, |
|
}, |
}, |
}, |
'feedback' => |
'feedback' => |
{ text => 'Feedback messages', |
{ text => 'Feedback messages', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Questions about:', |
header => [{col1 => 'Questions about:', |
col2 => 'Recipients'}, |
col2 => 'Recipients'}], |
{col1 => 'Questions about:', |
ordered => ['question.email','comment.email','policy.email'], |
col2 => 'Custom Text'}], |
itemtext => { |
ordered => ['question','comment','policy'], |
'question.email' => 'Resource Content', |
|
'comment.email' => $lt{'coco'}, |
|
'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', |
'allow_discussion_post_editing'], |
'allow_discussion_post_editing'], |
|
itemtext => { |
|
'plc.roles.denied' => 'No Resource Discussion', |
|
'plc.users.denied' => 'No Resource Discussion', |
|
'pch.roles.denied' => 'No Chat room use', |
|
'pch.users.denied' => 'No Chat room use', |
|
allow_limited_html_in_feedback => 'Allow limited HTML in discussion', |
|
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 => { |
|
default_enrollment_start_date => 'Start date', |
|
default_enrollment_end_date => 'End date', |
|
nothideprivileged => $lt{'priv'}, |
|
student_classlist_view => $lt{'stuv'}, |
|
student_classlist_opt_in => $lt{'stul'}, |
|
student_classlist_portfiles => 'Include link to accessible portfolio files', |
|
}, |
}, |
}, |
'appearance' => |
'appearance' => |
{ text => 'Display of resources ', |
{ text => 'Display of resources ', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
col2 => 'Value'}], |
|
ordered => ['default_xml_style','pageseparators', |
ordered => ['default_xml_style','pageseparators', |
'disable_receipt_display','texengine', |
'disable_receipt_display','texengine', |
'tthoptions'], |
'tthoptions'], |
|
itemtext => { |
|
default_xml_style => 'Default XML style file', |
|
pageseparators => 'Visibly Separate Items on Pages', |
|
disable_receipt_display => 'Disable display of problem receipts', |
|
texengine => 'Force use of a specific math rendering engine', |
|
tthoptions => 'Default set of options to pass to tth/m when converting TeX', |
|
}, |
}, |
}, |
'grading' => |
'grading' => |
{ text => 'Grading', |
{ text => 'Grading', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
ordered => ['grading','rndseed', |
ordered => ['grading','rndseed', |
'receiptalg','disablesigfigs'], |
'receiptalg','disablesigfigs'], |
|
itemtext => { |
|
grading => 'Grading', |
|
rndseed => 'Randomization algorithm used', |
|
receiptalg => 'Receipt algorithm used', |
|
disablesigfigs => 'Disable checking of Significant Figures', |
|
}, |
|
|
}, |
}, |
'printouts' => |
'printouts' => |
{ text => 'Printout generation', |
{ text => 'Printout generation', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
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 => { |
|
problem_stream_switch => 'Allow problems to be split over pages', |
|
suppress_tries => 'Suppress number of tries in printing', |
|
default_paper_size => 'Default paper type', |
|
print_header_format => 'Print header format', |
|
disableexampointprint => 'Disable automatically printing point values on exams', |
|
canuse_pdfforms => 'Users can print problems as PDF forms and upload later for grading', |
|
}, |
}, |
}, |
'spreadsheet' => |
'spreadsheet' => |
{ text => 'Spreadsheets', |
{ text => 'Spreadsheets', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
col2 => 'Value'}], |
|
ordered => ['spreadsheet_default_classcalc', |
ordered => ['spreadsheet_default_classcalc', |
'spreadsheet_default_studentcalc', |
'spreadsheet_default_studentcalc', |
'spreadsheet_default_assesscalc','hideemptyrows'], |
'spreadsheet_default_assesscalc','hideemptyrows'], |
|
itemtext => { |
|
spreadsheet_default_classcalc => $lt{'defc'}, |
|
spreadsheet_default_studentcalc => $lt{'defs'}, |
|
spreadsheet_default_assesscalc => 'Default Assessment Spreadsheet', |
|
hideemptyrows => 'Hide Empty Rows in Spreadsheets', |
|
}, |
}, |
}, |
'bridgetasks' => |
'bridgetasks' => |
{ text => 'Bridge tasks', |
{ text => 'Bridge tasks', |
help => 'Course_Environment', |
help => 'Course_Environment', |
header => [{col1 => 'Setting', |
|
col2 => 'Value'}], |
|
ordered => ['task_messages','task_grading', |
ordered => ['task_messages','task_grading', |
'suppress_embed_prompt'], |
'suppress_embed_prompt'], |
|
itemtext => { |
|
task_messages => $lt{'seme'}, |
|
task_grading => 'Bridge Task grading by instructors and TAs in sections' , |
|
suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', |
|
}, |
}, |
}, |
'other' => |
'other' => |
{ text => 'Other settings', |
{ text => 'Other settings', |
Line 192 sub handler {
|
Line 495 sub handler {
|
}, |
}, |
); |
); |
if ($phase eq 'process') { |
if ($phase eq 'process') { |
|
my @allitems = &get_allitems(%prefs); |
&Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
&Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values); |
\@prefs_order,\%prefs,\%values, |
|
$cnum,undef,\@allitems); |
} elsif ($phase eq 'display') { |
} elsif ($phase eq 'display') { |
my $jscript = &get_jscript($cdom); |
my $jscript = &get_jscript($cdom,$phase,$crstype); |
my @allitems; |
my @allitems = &get_allitems(%prefs); |
foreach my $item (keys(%prefs)) { |
|
if (ref($prefs{$item}) eq 'HASH') { |
|
if (ref($prefs{$item}{'ordered'}) eq 'ARRAY') { |
|
push(@allitems,@{$prefs{$item}{'ordered'}}); |
|
if ($item eq 'feedback') { |
|
push(@allitems,(map { $_.'.email'; } @{$prefs{$item}{'ordered'}})); |
|
} |
|
} |
|
} |
|
} |
|
&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 216 sub handler {
|
Line 511 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
sub get_allitems { |
|
my (%prefs) = @_; |
|
my @allitems; |
|
foreach my $item (keys(%prefs)) { |
|
if (ref($prefs{$item}) eq 'HASH') { |
|
if (ref($prefs{$item}{'ordered'}) eq 'ARRAY') { |
|
push(@allitems,@{$prefs{$item}{'ordered'}}); |
|
if ($item eq 'feedback') { |
|
push(@allitems,(map { $_.'.text'; } @{$prefs{$item}{'ordered'}})); |
|
} |
|
} |
|
} |
|
} |
|
return @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 $rowtotal = 0; |
my $rowtotal = 0; |
my $output = |
my $output = |
'<table class="LC_nested_outer"> |
'<h3><a href="#">'.&mt($item->{text}).'</a></h3> |
<tr> |
<div> <span style="float:right">'. |
<th align="left" valign="middle"><span class="LC_font_larger">'. |
&Apache::loncommon::help_open_topic($item->{'help'}).'</span>'; |
&mt($item->{text}).' '. |
|
&Apache::loncommon::help_open_topic($item->{'help'}).'</span></th>'."\n". |
|
'</tr>'; |
|
if (($action eq 'feedback') || ($action eq 'classlists')) { |
if (($action eq 'feedback') || ($action eq 'classlists')) { |
$output .= ' |
$output .= ' |
<tr> |
<table class="LC_nested">'; |
<td> |
if (exists $item->{'header'}->[0]->{'col1'} || |
<table class="LC_nested"> |
exists $item->{'header'}->[0]->{'col2'}) { |
<tr class="LC_info_row"> |
$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,\$rowtotal); |
$output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'classlists') { |
} elsif ($action eq 'classlists') { |
$output .= &print_classlists('top',$cdom,$settings,\$rowtotal); |
$output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype); |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item">'.&mt($item->{'header'}->[1]->{'col1'}).'</td>'; |
<td class="LC_left_item">'.&mt($item->{'header'}->[1]->{'col1'}).'</td>'; |
Line 255 sub print_config_box {
|
Line 562 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,\$rowtotal). |
$output .= &print_classlists('middle',$cdom,$settings,$itemtext,\$rowtotal,$crstype). |
' |
' |
</table> |
</table> |
</td> |
<table class="LC_nested">'; |
</tr> |
if (exists $item->{'header'}->[0]->{'col1'} || |
<tr> |
exists $item->{'header'}->[0]->{'col2'}) { |
<td> |
$output .= ' |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item">'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
<td class="LC_right_item" valign="top">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
} |
} |
} |
} else { |
} else { |
$output .= ' |
$output .= ' |
<tr> |
<table class="LC_nested">'; |
<td> |
if (exists $item->{'header'}->[0]->{'col1'} || |
<table class="LC_nested"> |
exists $item->{'header'}->[0]->{'col2'}) { |
<tr class="LC_info_row"> |
$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,\$rowtotal); |
$output .= &print_courseinfo($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'localization') { |
} elsif ($action eq 'localization') { |
$output .= &print_localization($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_localization($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'feedback') { |
} elsif ($action eq 'feedback') { |
$output .= &print_feedback('bottom',$cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_feedback('bottom',$cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'discussion') { |
} elsif ($action eq 'discussion') { |
$output .= &print_discussion($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal); |
} elsif ($action eq 'classlists') { |
} elsif ($action eq 'classlists') { |
$output .= &print_classlists('bottom',$cdom,$settings,\$rowtotal); |
$output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'appearance') { |
} elsif ($action eq 'appearance') { |
$output .= &print_appearance($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'grading') { |
} elsif ($action eq 'grading') { |
$output .= &print_grading($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'printouts') { |
} elsif ($action eq 'printouts') { |
$output .= &print_printouts($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'spreadsheet') { |
} elsif ($action eq 'spreadsheet') { |
$output .= &print_spreadsheet($cdom,$settings,$ordered,\$rowtotal); |
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype); |
} elsif ($action eq 'bridgetasks') { |
} elsif ($action eq 'bridgetasks') { |
$output .= &print_bridgetasks($cdom,$settings,$ordered,\$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> |
</td> |
</div>'; |
</tr> |
|
</table><br />'; |
|
return ($output,$rowtotal); |
return ($output,$rowtotal); |
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($r,$cdom,$action,$values) = @_; |
my ($cdom,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; |
my %domconfig; |
my %newvalues; |
if (ref($values) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
%domconfig = %{$values}; |
if (ref($changes) eq 'HASH') { |
|
my @ordered; |
|
if ($action eq 'other') { |
|
@ordered = &get_other_items($cdom,$values,$allitems); |
|
if ($env{'form.newp_name'} ne '') { |
|
my $newp = $env{'form.newp_name'}; |
|
if ($env{'form.newp_value'} ne '') { |
|
if (ref($allitems) eq 'ARRAY') { |
|
unless ((grep(/^\Q$newp\E$/,@ordered)) || |
|
(grep(/^\Q$newp\E$/,@{$allitems}))) { |
|
$changes->{$newp} = $env{'form.newp_value'}; |
|
} |
|
} |
|
} |
|
} |
|
} elsif (ref($item->{'ordered'}) eq 'ARRAY') { |
|
@ordered = @{$item->{'ordered'}}; |
|
} |
|
if (@ordered > 0) { |
|
if ($action eq 'feedback') { |
|
foreach my $entry (@ordered) { |
|
my $userstr = ''; |
|
my $total = $env{'form.'.$entry.'_total'}; |
|
if ($total) { |
|
my @deletes = &Apache::loncommon::get_env_multiple('form.'.$entry.'_delete'); |
|
for (my $i=0; $i<$total; $i++) { |
|
unless (grep(/^$i$/,@deletes)) { |
|
$userstr .= $env{'form.'.$entry.'_user_'.$i}. |
|
&get_sec_str($entry,$i).','; |
|
} |
|
} |
|
} else { |
|
$total = 0; |
|
} |
|
if ($env{'form.'.$entry.'_uname_'.$total} ne '') { |
|
my $uname = $env{'form.'.$entry.'_uname_'.$total}; |
|
my $udom = $env{'form.'.$entry.'_udom_'.$total}; |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$userstr =~ s/,$//; |
|
$disallowed->{'feedback'}{$entry} = $uname.':'.$udom; |
|
} else { |
|
$userstr .= $uname.':'.$udom.&get_sec_str($entry,$total); |
|
} |
|
} else { |
|
$userstr =~ s/,$//; |
|
} |
|
$newvalues{$entry} = $userstr; |
|
if ($newvalues{$entry} ne $values->{$entry}) { |
|
$changes->{$entry} = $newvalues{$entry}; |
|
} |
|
my $ext_entry = $entry.'.text'; |
|
$newvalues{$ext_entry} = $env{'form.'.$ext_entry}; |
|
if ($newvalues{$ext_entry} ne $values->{$ext_entry}) { |
|
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
|
} |
|
} |
|
} else { |
|
foreach my $entry (@ordered) { |
|
if ($entry eq 'cloners') { |
|
if ($env{'form.cloners_all'}) { |
|
$newvalues{$entry} = '*'; |
|
} else { |
|
my @clonedoms; |
|
if (exists($env{'form.cloners_activate'})) { |
|
my $actnum = $env{'form.cloners_activate'}; |
|
if ($actnum ne '') { |
|
if ($env{'form.clonersdom_'.$actnum} ne '') { |
|
my $clonedom = $env{'form.clonersdom_'.$actnum}; |
|
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
|
$newvalues{$entry} = '*:'.$clonedom; |
|
push(@clonedoms,$newvalues{$entry}); |
|
} |
|
} |
|
} |
|
} else { |
|
my $num = $env{'form.cloners_total'}; |
|
my @deletes = |
|
&Apache::loncommon::get_env_multiple('form.cloners_delete'); |
|
for (my $i=0; $i<$num; $i++) { |
|
if (!grep(/^$i$/,@deletes)) { |
|
my $clonedom = $env{'form.cloners_dom_'.$i}; |
|
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
|
if (!grep(/^\*:\Q$clonedom\E$/,@clonedoms)) { |
|
push (@clonedoms,'*:'.$clonedom); |
|
} |
|
} |
|
} |
|
} |
|
if (@clonedoms) { |
|
$newvalues{$entry}=join(',',@clonedoms); |
|
} |
|
} |
|
if ($env{'form.cloners_newdom'} ne '') { |
|
my $clonedom = $env{'form.cloners_newdom'}; |
|
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
|
my $newdom = '*:'.$env{'form.cloners_newdom'}; |
|
if (@clonedoms) { |
|
if (!grep(/^\Q$newdom\E$/,@clonedoms)) { |
|
$newvalues{$entry} .= ','.$newdom; |
|
} |
|
} else { |
|
$newvalues{$entry} = $newdom; |
|
} |
|
} |
|
} |
|
if ($env{'form.'.$entry} ne '') { |
|
my @cloners = split(',',$env{'form.'.$entry}); |
|
my @okcloners; |
|
foreach my $cloner (@cloners) { |
|
$cloner =~ s/^\s+//; |
|
$cloner =~ s/\s+$//; |
|
unless ($cloner eq '') { |
|
my ($uname,$udom) = split(':',$cloner); |
|
if (&check_clone($udom,$disallowed,$uname) eq 'ok') { |
|
if (!grep(/^\Q$cloner\E$/,@okcloners)) { |
|
push(@okcloners,$cloner); |
|
} |
|
} |
|
} |
|
} |
|
if (@okcloners) { |
|
my $okclonestr = join(',',@okcloners); |
|
if ($newvalues{$entry} ne '') { |
|
$newvalues{$entry} .= ','.$okclonestr; |
|
} else { |
|
$newvalues{$entry} = $okclonestr; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($disallowed) eq 'HASH') { |
|
if (ref($disallowed->{'cloners'}) eq 'HASH') { |
|
foreach my $key (keys(%{$disallowed->{'cloners'}})) { |
|
$disallowed->{'cloners'}{$key} =~ s/,$//; |
|
} |
|
} |
|
} |
|
} 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$/) { |
|
$newvalues{$entry}=&Apache::lonhtmlcommon::get_date_from_form($entry); |
|
} elsif ($entry eq 'rolenames') { |
|
my %adv_roles = |
|
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); |
|
my @stds; |
|
if ($crstype eq 'Community') { |
|
@stds = ('co'); |
|
} else { |
|
@stds = ('cc'); |
|
} |
|
push(@stds,('in','ta','ep','ad','st')); |
|
my (@replacements,@regulars); |
|
foreach my $role (@stds) { |
|
if ($values->{$role.'.plaintext'} ne '') { |
|
push(@replacements,$role); |
|
} else { |
|
push(@regulars,$role); |
|
} |
|
} |
|
foreach my $stdrole (@stds) { |
|
my $ext_entry = $entry.'_'.$stdrole; |
|
my $stdname = &Apache::lonnet::plaintext($stdrole,$crstype, |
|
$env{'request.course.id'},1); |
|
if ($env{'form.'.$ext_entry} eq $stdname) { |
|
$newvalues{$ext_entry} = ''; |
|
} else { |
|
$newvalues{$ext_entry} = $env{'form.'.$ext_entry}; |
|
} |
|
if ($newvalues{$ext_entry} ne $values->{$stdrole.'.plaintext'}) { |
|
my $dupname = 0; |
|
if ($newvalues{$ext_entry} ne '') { |
|
if (grep(/^\Q$newvalues{$ext_entry}\E$/,@replacements)) { |
|
$dupname = 1; |
|
push(@{$disallowed->{'rolenames'}{'replacements'}},$newvalues{$ext_entry}); |
|
} |
|
if (!$dupname) { |
|
if (grep(/^\Q$newvalues{$ext_entry}\E$/,@regulars)) { |
|
$dupname = 1; |
|
push(@{$disallowed->{rolenames}{'regulars'}},$newvalues{$ext_entry}); |
|
} |
|
} |
|
if (!$dupname) { |
|
foreach my $role (keys(%adv_roles)) { |
|
if ($role =~ m{^cr/$match_domain/$match_name/\Q$newvalues{$ext_entry}\E$}) { |
|
$dupname = 1; |
|
push(@{$disallowed->{rolenames}{'customrole'}},$newvalues{$ext_entry}); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
if (!$dupname) { |
|
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
|
} |
|
} |
|
} |
|
} elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied')) { |
|
my @denied = &Apache::loncommon::get_env_multiple('form.'.$entry); |
|
@denied = sort(@denied); |
|
my $deniedstr = ''; |
|
if (@denied > 0) { |
|
$deniedstr = join(',',@denied); |
|
} |
|
$newvalues{$entry} = $deniedstr; |
|
} elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied')) { |
|
my $total = $env{'form.'.$entry.'_total'}; |
|
my $userstr = ''; |
|
my @denied; |
|
if ($total > 0) { |
|
my @deletes = |
|
&Apache::loncommon::get_env_multiple('form.'.$entry.'_delete'); |
|
for (my $i=0; $i<$total; $i++) { |
|
unless (grep(/^$i$/,@deletes)) { |
|
$userstr .= $env{'form.'.$entry.'_user_'.$i}.','; |
|
push(@denied,$env{'form.'.$entry.'_user_'.$i}); |
|
} |
|
} |
|
} else { |
|
$total = 0; |
|
} |
|
if ($env{'form.'.$entry.'_uname_'.$total} ne '') { |
|
my $uname = $env{'form.'.$entry.'_uname_'.$total}; |
|
my $udom = $env{'form.'.$entry.'_udom_'.$total}; |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$userstr =~ s/,$//; |
|
$disallowed->{'discussion'}{$entry} = $uname.':'.$udom; |
|
} else { |
|
my $newuser .= $uname.':'.$udom; |
|
if (grep(/^\Q$newuser\E$/,@denied)) { |
|
$userstr =~ s/,$//; |
|
} else { |
|
$userstr .= $newuser; |
|
} |
|
} |
|
} else { |
|
$userstr =~ s/,$//; |
|
} |
|
$newvalues{$entry} = $userstr; |
|
} elsif ($entry eq 'allow_discussion_post_editing') { |
|
my @canedit = &Apache::loncommon::get_env_multiple('form.'.$entry); |
|
@canedit = sort(@canedit); |
|
foreach my $role (@canedit) { |
|
my @secs = &Apache::loncommon::get_env_multiple('form.'.$entry.'_sections_'.$role); |
|
if ((grep(/^\s*$/,@secs)) || (@secs == 0)) { |
|
$newvalues{$entry} .= $role.','; |
|
} else { |
|
foreach my $sec (@secs) { |
|
$newvalues{$entry} .= $role.':'.$sec.','; |
|
} |
|
} |
|
} |
|
$newvalues{$entry} =~ s/,$//; |
|
} elsif ($entry eq 'nothideprivileged') { |
|
my @curr_nothide; |
|
my @new_nothide; |
|
if ($values->{$entry} ne '') { |
|
foreach my $user (split(/\s*\,\s*/,$values->{$entry})) { |
|
my $nothide; |
|
if ($user !~ /:/) { |
|
$nothide = join(':',split(/[\@]/,$user)); |
|
} else { |
|
$nothide = $user; |
|
} |
|
if ((defined($nothide)) && |
|
(!grep(/^\Q$nothide\E$/,@curr_nothide))) { |
|
push(@curr_nothide,$nothide); |
|
} |
|
} |
|
} |
|
foreach my $key (keys(%env)) { |
|
if ($key =~ /^form\.\Q$entry\E_($match_username:$match_domain)$/) { |
|
if ($env{$key}) { |
|
my $nothide = $1; |
|
if (!grep(/^\Q$nothide\E$/,@new_nothide)) { |
|
push(@new_nothide,$nothide); |
|
} |
|
} |
|
} |
|
} |
|
@new_nothide = sort(@new_nothide); |
|
my @differences = |
|
&Apache::loncommon::compare_arrays(\@curr_nothide, |
|
\@new_nothide); |
|
if (@differences > 0) { |
|
if (@new_nothide > 0) { |
|
$newvalues{$entry} = join(',',@new_nothide); |
|
} else { |
|
$newvalues{$entry} = ''; |
|
} |
|
} else { |
|
$newvalues{$entry} = $values->{$entry}; |
|
} |
|
} elsif ($entry eq 'print_header_format') { |
|
my $maxnum = $env{'form.printfmthdr_maxnum'}; |
|
my @newhdr; |
|
if ($maxnum > 2) { |
|
for (my $i=0; $i<$maxnum-2; $i++) { |
|
if ($env{'form.printfmthdr_del_'.$i}) { |
|
$newhdr[$env{'form.printfmthdr_pos_'.$i}] = ''; |
|
} else { |
|
my $hdr; |
|
if ($env{'form.printfmthdr_sub_'.$i} =~ /^[nca]$/) { |
|
$hdr = '%'; |
|
if ($env{'form.printfmthdr_limit_'.$i} =~ /^\d+$/) { |
|
$hdr .= $env{'form.printfmthdr_limit_'.$i}; |
|
} |
|
$hdr .= $env{'form.printfmthdr_sub_'.$i}; |
|
} elsif ($env{'form.printfmthdr_sub_'.$i} ne '') { |
|
$hdr = $env{'form.printfmthdr_sub_'.$i}; |
|
} |
|
$newhdr[$env{'form.printfmthdr_pos_'.$i}] = $hdr; |
|
} |
|
} |
|
} |
|
my $newsub = $maxnum-2; |
|
if ($env{'form.printfmthdr_sub_'.$newsub} =~ /^[nca]$/) { |
|
my $hdr = '%'; |
|
if ($env{'form.printfmthdr_limit_'.$newsub} =~ /^\d+$/) { |
|
$hdr .= $env{'form.printfmthdr_limit_'.$newsub}; |
|
} |
|
$hdr .= $env{'form.printfmthdr_sub_'.$newsub}; |
|
$newhdr[$env{'form.printfmthdr_pos_'.$newsub}] = $hdr; |
|
} |
|
my $newtext = $maxnum-1; |
|
$newhdr[$env{'form.printfmthdr_pos_'.$newtext}] = $env{'form.printfmthdr_text_'.$newtext}; |
|
$newvalues{$entry} = join('',@newhdr); |
|
} elsif ($entry eq 'languages') { |
|
my $langstr; |
|
my $total = $env{'form.'.$entry.'_total'}; |
|
if ($total) { |
|
my @deletes = &Apache::loncommon::get_env_multiple('form.'.$entry.'_delete'); |
|
for (my $i=0; $i<$total; $i++) { |
|
unless (grep(/^$i$/,@deletes)) { |
|
$langstr .= $env{'form.'.$entry.'_'.$i}.','; |
|
} |
|
} |
|
} else { |
|
$total = 0; |
|
} |
|
if ($env{'form.'.$entry.'_'.$total} ne '') { |
|
my $newlang = $env{'form.'.$entry.'_'.$total}; |
|
my %langchoices = &get_lang_choices(); |
|
if ($langchoices{$newlang}) { |
|
$langstr .= $newlang; |
|
} else { |
|
$langstr =~ s/,$//; |
|
$disallowed->{'localization'}{$entry} = $newlang; |
|
} |
|
} else { |
|
$langstr =~ s/,$//; |
|
} |
|
$newvalues{$entry} = $langstr; |
|
} else { |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
|
} |
|
unless ($entry eq 'co-owners') { |
|
if ($newvalues{$entry} ne $values->{$entry}) { |
|
$changes->{$entry} = $newvalues{$entry}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
sub get_sec_str { |
|
my ($entry,$num) = @_; |
|
my @secs = &Apache::loncommon::get_env_multiple('form.'.$entry.'_sections_'.$num); |
|
my $secstr; |
|
if (grep(/^\s*$/,@secs)) { |
|
$secstr = ''; |
|
} elsif (@secs > 0) { |
|
$secstr = join(';',@secs); |
|
} |
|
if ($secstr ne '') { |
|
return '('.$secstr.')'; |
|
} |
|
return; |
|
} |
|
|
|
sub check_clone { |
|
my ($clonedom,$disallowed,$clonename) = @_; |
|
return if (ref($disallowed) ne 'HASH'); |
|
if ($clonedom !~ /^$match_domain$/) { |
|
$disallowed->{'cloners'}{'format'} .= $clonedom.','; |
|
return; |
|
} elsif (!&Apache::lonnet::domain($clonedom)) { |
|
$disallowed->{'cloners'}{'domain'} .= $clonedom.','; |
|
return; |
|
} |
|
if ($clonename ne '') { |
|
if ($clonename !~ /^$match_username$/) { |
|
$disallowed->{'cloners'}{'format'} .= $clonename.':'.$clonedom.','; |
|
return; |
|
} else { |
|
if (&Apache::lonnet::homeserver($clonename,$clonedom) eq 'no_host') { |
|
$disallowed->{'cloners'}{'newuser'} .= $clonename.':'.$clonedom.','; |
|
return; |
|
} |
|
} |
|
} |
|
return 'ok'; |
|
} |
|
|
|
sub store_changes { |
|
my ($cdom,$cnum,$prefs_order,$actions,$prefs,$values,$changes,$crstype) = @_; |
|
my ($chome,$output); |
|
my (%storehash,@delkeys,@need_env_update,@oldcloner); |
|
if ((ref($values) eq 'HASH') && (ref($changes) eq 'HASH')) { |
|
%storehash = %{$values}; |
|
} else { |
|
if ($crstype eq 'Community') { |
|
$output = &mt('No changes made to community settings.'); |
|
} else { |
|
$output = &mt('No changes made to course settings.'); |
|
} |
|
return $output; |
|
} |
|
my %yesno = ( |
|
hidefromcat => '1', |
|
problem_stream_switch => '1', |
|
suppress_tries => '1', |
|
disableexampointprint => '1', |
|
hideemptyrows => '1', |
|
suppress_embed_prompt => '1', |
|
); |
|
foreach my $item (@{$prefs_order}) { |
|
if (grep(/^\Q$item\E$/,@{$actions})) { |
|
$output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'; |
|
if (ref($changes->{$item}) eq 'HASH') { |
|
if (keys(%{$changes->{$item}}) > 0) { |
|
$output .= &mt('Changes made:').'<ul style="list-style:none;">'; |
|
if ($item eq 'other') { |
|
foreach my $key (sort(keys(%{$changes->{$item}}))) { |
|
$storehash{$key} = $changes->{$item}{$key}; |
|
if ($changes->{$item}{$key} eq '') { |
|
push(@delkeys,$key); |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]','<i>'.$key.'</i>')).'</li>'; |
|
} else { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]','<i>'.$key.'</i>', |
|
"'$storehash{$key}'")).'</li>'; |
|
} |
|
} |
|
} else { |
|
if (ref($prefs->{$item}->{'ordered'}) eq 'ARRAY') { |
|
my @settings = @{$prefs->{$item}->{'ordered'}}; |
|
if ($item eq 'feedback') { |
|
push(@settings,(map { $_.'.text'; } @settings)); |
|
} |
|
foreach my $key (@settings) { |
|
if ($key eq 'rolenames') { |
|
my $displayname = $prefs->{$item}->{'itemtext'}{$key}; |
|
my $msg; |
|
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})); |
|
my $stdname = &Apache::lonnet::plaintext($role,$crstype,undef,1); |
|
my $newname = $changes->{$item}{$key.'_'.$role}; |
|
$storehash{$role.'.plaintext'} = $newname; |
|
if ($newname eq '') { |
|
$newname = $stdname; |
|
} |
|
$msg .= '<li>'.&mt('[_1] set to [_2]','<i>'.$stdname.'</i>', |
|
"'<b>".$newname."</b>'").'</li>'; |
|
} |
|
if ($msg ne '') { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt($displayname)).'<ul class="LC_success">'.$msg.'</ul></li>'; |
|
} |
|
} else { |
|
next if (!exists($changes->{$item}{$key})); |
|
my ($displayname,$text); |
|
$text = $prefs->{$item}->{'itemtext'}{$key}; |
|
my $displayval; |
|
unless ($key eq 'co-owners') { |
|
$displayval = $changes->{$item}{$key}; |
|
} |
|
if ($item eq 'feedback') { |
|
if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { |
|
$text = $prefs->{$item}->{'itemtext'}{$1.$2}; |
|
$displayname = &mt('Custom text for '.$text.' questions'); |
|
} else { |
|
$displayname = &mt('Recipients of '.$text.' questions'); |
|
} |
|
} elsif ($item eq 'discussion') { |
|
if ($key =~ /^p(lc|ch)\.roles\.denied/) { |
|
$displayname = &mt("$text (role-based)"); |
|
if ($displayval ne '') { |
|
my @roles = split(',',$displayval); |
|
@roles = map { &Apache::lonnet::plaintext($_); } @roles; |
|
$displayval = join(', ',@roles); |
|
} |
|
} elsif ($key =~ /^p(lc|ch)\.users\.denied/) { |
|
$displayname = &mt("$text (specific user(s))"); |
|
} else { |
|
if ($key eq 'allow_discussion_post_editing') { |
|
if ($displayval ne '') { |
|
my @roles = split(',',$displayval); |
|
my @longroles; |
|
foreach my $role (@roles) { |
|
my ($trole,$sec) = split(':',$role); |
|
my $rolename = |
|
&Apache::lonnet::plaintext($trole); |
|
if ($sec ne '') { |
|
$rolename .= ':'.$sec; |
|
} |
|
push(@longroles,$rolename); |
|
} |
|
$displayval = join(', ',@longroles); |
|
} |
|
} |
|
$displayname = &mt($text); |
|
} |
|
} elsif ($item eq 'spreadsheet') { |
|
if ($key =~ /^spreadsheet_default_(studentcalc|assesscalc)$/x) { |
|
my $sheettype = $1; |
|
if ($sheettype eq 'studentcalc') { |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} else { |
|
&Apache::lonnet::expirespread('','','assesscalc'); |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} |
|
} |
|
$displayname = &mt($text); |
|
} else { |
|
$displayname = &mt($text); |
|
} |
|
if (defined($yesno{$key})) { |
|
$displayval = &mt('No'); |
|
if ($changes->{$item}{$key} eq 'yes') { |
|
$displayval = &mt('Yes'); |
|
} |
|
} elsif (($key =~ /^default_enrollment_(start|end)_date$/) && ($displayval)) { |
|
$displayval = &Apache::lonlocal::locallocaltime($displayval); |
|
} elsif ($key eq 'categories') { |
|
$displayval = $env{'form.categories_display'}; |
|
} elsif ($key eq 'canuse_pdfforms') { |
|
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); |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
|
'<i>'.$displayname.'</i>')).'</li>'; |
|
} else { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
|
'<i>'.$displayname.'</i>', |
|
"'<b>$displayval</b>'")); |
|
if ($key eq 'url') { |
|
my $bkuptime=time; |
|
$output .= (' 'x2).&mt('(Previous URL backed up)').': '. |
|
$storehash{'top level map backup '.$bkuptime} => $values->{$key}; |
|
} |
|
$output .= '</li>'; |
|
} |
|
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') || |
|
($key eq 'hidefromcat') || ($key eq 'categories') || |
|
($key eq 'co-owners')) { |
|
push(@need_env_update,$key); |
|
} |
|
} |
|
} |
|
} |
|
$output .= '</ul>'; |
|
} else { |
|
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 (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 (&Apache::lonnet::del('environment',\@delkeys,$cdom,$cnum) ne 'ok') { |
|
$output .= '<br /><span class="LC_error">'; |
|
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) { |
|
$chome = &Apache::lonnet::homeserver($cnum,$cdom); |
|
&update_env($cnum,$cdom,$chome,\@need_env_update,\%storehash); |
|
} |
|
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
|
{'freshen_cache' => 1}); |
|
} else { |
|
$output = '<span class="LC_error">'; |
|
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; |
|
} |
|
|
|
sub update_env { |
|
my ($cnum,$cdom,$chome,$need_env_update,$storehash) = @_; |
|
my $count = 0; |
|
if ((ref($need_env_update) eq 'ARRAY') && (ref($storehash) eq 'HASH')) { |
|
my %crsinfo = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,undef,undef,'.'); |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
foreach my $key (@{$need_env_update}) { |
|
if ($key eq 'description' && defined($storehash->{$key})) { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $storehash->{$key}}); |
|
$crsinfo{$env{'request.course.id'}}{'description'} = $storehash->{$key}; |
|
$count ++; |
|
} elsif (($key eq 'cloners') || ($key eq 'hidefromcat') || ($key eq 'categories')) { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$key => $storehash->{$key}}); |
|
$crsinfo{$env{'request.course.id'}}{$key} = $storehash->{$key}; |
|
$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) { |
|
my $putresult = &Apache::lonnet::courseidput($cdom,\%crsinfo,$chome,'notime'); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
sub display_disallowed { |
|
my ($item,$disallowed,$prefs,$crstype) = @_; |
|
my $output; |
|
if ((ref($disallowed) eq 'HASH') && (ref($prefs) eq 'HASH')) { |
|
if (keys(%{$disallowed})) { |
|
if ($item eq 'cloners') { |
|
my @fails; |
|
my %lt = &Apache::lonlocal::texthash ( |
|
format => 'Invalid format', |
|
domain => 'Domain does not exist', |
|
newuser => 'LON-CAPA user(s) do(es) not exist.', |
|
); |
|
foreach my $error ('format','domain','newuser') { |
|
if (defined($disallowed->{$error})) { |
|
my $msg = '<b>'.$disallowed->{$error}.'</b>, '.&mt('reason').' - '. |
|
$lt{$error}; |
|
if ($error eq 'newuser') { |
|
$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); |
|
} |
|
} |
|
if (@fails) { |
|
$output .= '<span class="LC_warning">'.&mt('Unable to add to allowed cloners: '). |
|
'</span>'.join('; ',@fails).'.<br />'; |
|
} |
|
} elsif ($item eq 'rolenames') { |
|
my %lt = &Apache::lonlocal::texthash ( |
|
replacements => 'Name already used to replace a different standard role name', |
|
regulars => 'Name already used as a standard role name', |
|
customrole => 'Name already used as the name of a custom role', |
|
); |
|
my @fails; |
|
foreach my $error ('replacements','regulars','customrole') { |
|
if (ref($disallowed->{$error}) eq 'ARRAY') { |
|
push(@fails,'<b>'.join(', ',@{$disallowed->{$error}}). |
|
'</b>, '.&mt('reason').' - '.$lt{'error'}); |
|
} |
|
} |
|
if (@fails) { |
|
$output .= '<span class="LC_warning">'. |
|
&mt('Unable to include amongst replacements for role names: '). |
|
'</span>'.join('; ',@fails).'.<br />'; |
|
} |
|
|
|
} elsif (($item eq 'feedback') || ($item eq 'discussion') || ($item eq 'localization')) { |
|
$output .= '<span class="LC_warning">'; |
|
if ($item eq 'feedback') { |
|
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') { |
|
$output .= &mt('Unable to include in user-based access control for:'); |
|
} elsif ($item eq '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>'; |
|
foreach my $key (sort(keys(%{$disallowed}))) { |
|
my $itemtext = $prefs->{$item}{'itemtext'}{$key}; |
|
$output .= '<li><i>'.$itemtext.'</i> - '; |
|
if ($item eq 'localization') { |
|
$output .= &mt('reason - unsupported language: [_1]', |
|
'<b>'.$disallowed->{$key}.'</b>'); |
|
} else { |
|
$output .= &mt('reason - invalid user: [_1]', |
|
'<b>'.$disallowed->{$key}.'</b>').'</li>'; |
|
} |
|
} |
|
$output .= '</ul><br />'; |
|
} |
|
} |
} |
} |
return &modify_crsenv($action,$cdom,%domconfig); |
return $output; |
} |
} |
|
|
sub get_course { |
sub get_course { |
Line 330 sub get_course {
|
Line 1511 sub get_course {
|
} |
} |
|
|
sub get_jscript { |
sub get_jscript { |
my ($cdom) = @_; |
my ($cdom,$phase,$crstype) = @_; |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom); |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($jscript,$categorize_js); |
my ($jscript,$categorize_js); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
|
my $cloners_js = &cloners_javascript($phase); |
if ($can_categorize) { |
if ($can_categorize) { |
$categorize_js = <<ENDSCRIPT; |
$categorize_js = <<ENDSCRIPT; |
function catsbrowser() { |
function catsbrowser() { |
Line 349 function catsbrowser() {
|
Line 1531 function catsbrowser() {
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
$browse_js."\n".$categorize_js."\n".'</script>'."\n".$stubrowse_js."\n"; |
$browse_js."\n".$categorize_js."\n".$cloners_js."\n".'</script>'. |
|
"\n".$stubrowse_js."\n"; |
return $jscript; |
return $jscript; |
} |
} |
|
|
|
sub cloners_javascript { |
|
my ($formname) = @_; |
|
return <<"ENDSCRIPT"; |
|
|
|
function update_cloners(caller,num) { |
|
var delidx = getIndexByName('cloners_delete'); |
|
var actidx = getIndexByName('cloners_activate'); |
|
if (caller == 'cloners_all') { |
|
var selall; |
|
for (var i=0; i<document.$formname.cloners_all.length; i++) { |
|
if (document.$formname.cloners_all[i].checked) { |
|
selall = document.$formname.cloners_all[i].value; |
|
} |
|
} |
|
if (selall == 1) { |
|
if (delidx != -1) { |
|
if (document.$formname.cloners_delete.length) { |
|
for (var j=0; j<document.$formname.cloners_delete.length; j++) { |
|
document.$formname.cloners_delete[j].checked = true; |
|
} |
|
} else { |
|
document.$formname.elements[delidx].checked = true; |
|
} |
|
} |
|
if (actidx != -1) { |
|
if (document.$formname.cloners_activate.length) { |
|
for (var i=0; i<document.$formname.cloners_activate.length; i++) { |
|
if (document.$formname.cloners_activate[i].value == '0') { |
|
document.$formname.cloners_activate[i].checked = false; |
|
} |
|
if (document.$formname.cloners_activate[i].value == '') { |
|
document.$formname.cloners_activate[i].checked = true; |
|
} |
|
} |
|
} |
|
} |
|
document.$formname.cloners_newdom.selectedIndex = 0; |
|
} |
|
} |
|
if (caller == 'cloners_activate') { |
|
if (document.$formname.cloners_activate.length) { |
|
for (var j=0; j<document.$formname.cloners_activate.length; j++) { |
|
if (document.$formname.cloners_activate[j].value == num) { |
|
if (document.$formname.cloners_activate[j].checked) { |
|
for (var i=0; i<document.$formname.cloners_all.length; i++) { |
|
if (document.$formname.cloners_all[i].value == '1') { |
|
document.$formname.cloners_all[i].checked = false; |
|
} |
|
if (document.$formname.cloners_all[i].value == '0') { |
|
document.$formname.cloners_all[i].checked = true; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
for (var i=0; i<document.$formname.cloners_all.length; i++) { |
|
if (document.$formname.cloners_all[i].value == '1') { |
|
document.$formname.cloners_all[i].checked = false; |
|
} |
|
if (document.$formname.cloners_all[i].value == '0') { |
|
document.$formname.cloners_all[i].checked = true; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function getIndexByName(item) { |
|
for (var i=0;i<document.$formname.elements.length;i++) { |
|
if (document.$formname.elements[i].name == item) { |
|
return i; |
|
} |
|
} |
|
return -1; |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
|
sub print_courseinfo { |
sub print_courseinfo { |
my ($cdom,$settings,$ordered,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
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') { |
$categoriesform = |
$categoriesform = |
&Apache::loncommon::assign_categories_table($cathash, |
&Apache::loncommon::assign_categories_table($cathash, |
$settings->{'categories'})."\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); |
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('Top Level Map').'</b>'.(' 'x2). |
text => '<b>'.&mt($itemtext->{'url'}).'</b>'.(' 'x2). |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('display','url','sequence')\">". |
"('display','url','sequence')\">". |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
Line 386 sub print_courseinfo {
|
Line 1659 sub print_courseinfo {
|
'</span>', |
'</span>', |
input => 'textbox', |
input => 'textbox', |
size => '40', |
size => '40', |
|
advanced => 1 |
}, |
}, |
'description' => { |
'description' => { |
text => '<b>'.&mt('Course Description').'</b>', |
text => '<b>'.&mt($itemtext->{'description'}).'</b>', |
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('Course ID or number'). |
text => '<b>'.&mt($itemtext->{'courseid'}).'</b><br />'.'('. |
'</b><br />'. |
&mt('internal, optional').')', |
'('.&mt('internal, optional').')', |
|
input => 'textbox', |
input => 'textbox', |
size => '25', |
size => '25', |
}, |
}, |
'cloners' => { |
'cloners' => { |
text => '<b>'.&mt('Users allowed to clone course').'</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', |
|
advanced => 1 |
}, |
}, |
'rolenames' => { |
'rolenames' => { |
text => '<b>'.&mt('Replacement titles for standard course roles').'</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', |
|
advanced => 1 |
}, |
}, |
'externalsyllabus' => { |
'externalsyllabus' => { |
text => '<b>'.&mt('URL of Syllabus').'</b><br />('.&mt('not using internal handler)'), |
text => '<b>'.&mt($itemtext->{'externalsyllabus'}).'</b><br />('. |
|
&mt('not using syllabus template)'), |
input => 'textbox', |
input => 'textbox', |
size => '40', |
size => '40', |
}, |
}, |
'hidefromcat' => { |
'hidefromcat' => { |
text => '<b>'.&mt('Exclude from course catalog').'</b><br />'. |
text => '<b>'.&mt($itemtext->{'hidefromcat'}).'</b><br />'. |
' ('.&mt('included by default if assigned institutional code, or categorized').')', |
' ('.&mt('included by default if assigned institutional code, or categorized').')', |
input => 'radio', |
input => 'radio', |
}, |
}, |
'categories' => { |
'categories' => { |
text => '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
text => '<b>'.&mt($itemtext->{'categories'}).'</b> <a href="javascript:catsbrowser()">'. |
&mt('Display Categories').'</a>', |
&mt('Display Categories').'</a>', |
input => 'textbox', |
input => 'textbox', |
size => '25', |
size => '25', |
Line 437 sub print_courseinfo {
|
Line 1719 sub print_courseinfo {
|
next if (!$can_categorize); |
next if (!$can_categorize); |
} |
} |
$count ++; |
$count ++; |
$datatable .= &item_table_row_start($items{$item}{text},$count); |
if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) { |
|
$datatable .= &item_table_row_start($items{$item}{text},$count,"advanced"); |
|
} else { |
|
$datatable .= &item_table_row_start($items{$item}{text},$count); |
|
} |
if ($items{$item}{input} eq 'radio') { |
if ($items{$item}{input} eq 'radio') { |
$datatable .= &yesno_radio($item,$settings); |
$datatable .= &yesno_radio($item,$settings); |
} elsif ($item eq 'cloners') { |
} elsif ($item eq 'cloners') { |
Line 472 sub print_courseinfo {
|
Line 1758 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"><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" '. |
'name="cloners_delete" value="'.$num.'" onchange="javascript:update_types('."'cloners_delete','$num'".');" />'. |
'name="cloners_delete" value="'.$num.'" onchange="javascript:update_cloners('."'cloners_delete','$num'".');" />'. |
&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 504 sub print_courseinfo {
|
Line 1799 sub print_courseinfo {
|
$includeempty). |
$includeempty). |
'<input type="hidden" name="cloners_total" value="'.$num.'" />'. |
'<input type="hidden" name="cloners_total" value="'.$num.'" />'. |
'</td>'.&Apache::loncommon::end_data_table_row(). |
'</td>'.&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table().'<br />'. |
&Apache::loncommon::end_data_table(). |
|
'<table><tr><td align="left">'.&mt('And'). |
|
'</td></tr></table>'. |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="left">'. |
'<td align="left">'. |
Line 516 sub print_courseinfo {
|
Line 1813 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 528 sub print_courseinfo {
|
Line 1832 sub print_courseinfo {
|
} |
} |
$datatable .= &Apache::loncommon::end_data_table().'</td>'; |
$datatable .= &Apache::loncommon::end_data_table().'</td>'; |
} elsif ($item eq 'categories') { |
} elsif ($item eq 'categories') { |
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'.&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item},$items{$item}{size}); |
my $launcher = 'onFocus="this.blur();javascript:catsbrowser();";'; |
|
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'. |
|
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item}, |
|
$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 547 sub new_cloners_dom_row {
|
Line 1886 sub new_cloners_dom_row {
|
&mt('Any user in domain:').' <b>'.$newdom.'</b>'. |
&mt('Any user in domain:').' <b>'.$newdom.'</b>'. |
(' 'x2).'<label><input type="radio" '. |
(' 'x2).'<label><input type="radio" '. |
'name="cloners_activate" value="'.$num.'" '. |
'name="cloners_activate" value="'.$num.'" '. |
'onchange="javascript:update_types('. |
'onchange="javascript:update_cloners('. |
"'cloners_activate','$num'".');" />'. |
"'cloners_activate','$num'".');" />'. |
&mt('Yes').'</label>'.(' 'x2). |
&mt('Yes').'</label>'.(' 'x2). |
'<label><input type="radio" '. |
'<label><input type="radio" '. |
'name="cloners_activate" value="" checked="checked" '. |
'name="cloners_activate" value="" checked="checked" '. |
'onchange="javascript:update_types('. |
'onchange="javascript:update_cloners('. |
"'cloners_activate','$num'".');" />'. |
"'cloners_activate','$num'".');" />'. |
&mt('No').'</label></span></td>'. |
&mt('No').'</label><input type="hidden" name="cloners_dom_'. |
|
$num.'" value="'.$newdom.'" /></span></td>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
return $output; |
return $output; |
} |
} |
|
|
sub can_modify_catsettings { |
sub can_modify_catsettings { |
my ($dom) = @_; |
my ($dom,$crstype) = @_; |
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
my ($can_toggle_cat,$can_categorize); |
my ($can_toggle_cat,$can_categorize); |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
if ($crstype eq 'Community') { |
$can_toggle_cat = 1; |
if ($domconf{'coursecategories'}{'togglecatscomm'} eq 'comm') { |
} |
$can_toggle_cat = 1; |
if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { |
} |
$can_categorize = 1; |
if ($domconf{'coursecategories'}{'categorizecomm'} eq 'comm') { |
|
$can_categorize = 1; |
|
} |
|
} else { |
|
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
|
$can_toggle_cat = 1; |
|
} |
|
if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { |
|
$can_categorize = 1; |
|
} |
} |
} |
} |
} |
return ($can_toggle_cat,$can_categorize); |
return ($can_toggle_cat,$can_categorize); |
} |
} |
|
|
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 585 sub assign_course_categories {
|
Line 1934 sub assign_course_categories {
|
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') { |
$hascats = 1; |
foreach my $cat (keys(%{$cathash})) { |
|
next if ($cat eq 'instcode::0'); |
|
unless ($crstype eq 'Community') { |
|
next if ($cat eq 'communities::0'); |
|
} |
|
$hascats ++; |
|
} |
} |
} |
} |
} |
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 628 ENDSCRIPT
|
Line 1988 ENDSCRIPT
|
} else { |
} else { |
my $onload; |
my $onload; |
} |
} |
|
my ($crscat,$catcrs,$assign); |
|
if ($crstype eq 'Community') { |
|
$crscat = 'Community Categories'; |
|
$catcrs = &mt('Categorize Community'); |
|
$assign = &mt('Assign one or more categories to this community.') |
|
} else { |
|
$crscat = 'Course Categories'; |
|
$catcrs = &mt('Categorize Course'); |
|
$assign = &mt('Assign one or more categories to this course.') |
|
} |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Course Categories',$catwin_js, |
&Apache::loncommon::start_page($crscat,$catwin_js, |
{'only_body' => 1,}); |
{'only_body' => 1,}); |
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>'; |
my $categoriesform = '<h3>'.$catcrs.'</h3>'; |
if ($hascats) { |
if ($hascats) { |
my %currsettings = |
my %currsettings = |
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); |
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); |
$categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'. |
my $cattable = &Apache::loncommon::assign_categories_table($cathash, |
|
$currsettings{'categories'},$crstype); |
|
if ($cattable eq '') { |
|
$categoriesform .= &mt('No suitable categories defined for this course type in this domain.'); |
|
} else { |
|
$categoriesform .= $assign.'<br /><br />'. |
'<form name="chgcats" action="/adm/courseprefs" method="post">'."\n". |
'<form name="chgcats" action="/adm/courseprefs" method="post">'."\n". |
&Apache::loncommon::assign_categories_table($cathash, |
$cattable."\n". |
$currsettings{'categories'})."\n". |
|
'<br /><input type="button" name="changes" value="'. |
'<br /><input type="button" name="changes" value="'. |
&mt('Copy to main window').'" '. |
&mt('Copy to main window').'" '. |
'onclick="javascript:updateCategories()" /></form><br />'; |
'onclick="javascript:updateCategories()" /></form><br />'; |
|
} |
} else { |
} else { |
$categoriesform .= &mt('No categories defined for 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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my %items = ( |
my %items = ( |
languages => { |
languages => { |
text => &mt('Languages used').'<br />'.&mt("(will override user's preference)"), |
text => '<b>'.&mt($itemtext->{'languages'}).'</b><br />'. |
|
&mt("(overrides individual user preference)"), |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
timezone => { |
timezone => { |
text => &mt('Timezone in which the course takes place'), |
text => '<b>'.&mt($itemtext->{'timezone'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
datelocale => { |
datelocale => { |
text => &mt('Locale used for course calendar'), |
text => '<b>'.&mt($itemtext->{'datelocale'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
}, |
}, |
); |
); |
Line 693 sub print_localization {
|
Line 2191 sub print_localization {
|
} else { |
} else { |
if ($settings->{$item} eq '') { |
if ($settings->{$item} eq '') { |
$datatable .= |
$datatable .= |
&Apache::loncommon::select_language('language_0','',1); |
&Apache::loncommon::select_language('languages_0','',1); |
} else { |
} else { |
my $num = 0; |
my $num = 0; |
my @languages = split(/\s*(\,|\;|\:)\s*/,$settings->{$item}); |
my @languages = split(/\s*[,;:]\s*/,$settings->{$item}); |
$datatable .= &Apache::loncommon::start_data_table(); |
$datatable .= &Apache::loncommon::start_data_table(); |
if (@languages > 0) { |
if (@languages > 0) { |
|
my %langchoices = &get_lang_choices(); |
foreach my $lang (@languages) { |
foreach my $lang (@languages) { |
my $showlang = $lang; |
my $showlang = $lang; |
my $code = &Apache::loncommon::supportedlanguagecode($lang); |
if (exists($langchoices{$lang})) { |
if ($code) { |
$showlang = $langchoices{$lang}; |
$showlang = &plainlanguagedescription($lang); |
|
} |
} |
$datatable .= |
$datatable .= |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td valign="top"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&mt('Language:').'<b> '.$showlang. |
&mt('Language:').'<b> '.$showlang. |
'</b><input type="hidden" name="languages_'.$num. |
'</b><input type="hidden" name="languages_'.$num. |
'" value="'.$lang.'" /></span><br />'. |
'" value="'.$lang.'" /></span><br />'. |
'<span class="LC_nobreak"><label><input type="checkbox" '. |
'<span class="LC_nobreak"><label><input type="checkbox" '. |
'name="languages_delete" value="'.$num.'" />'. |
'name="languages_delete" value="'.$num.'" />'. |
&mt('Delete').'</label></span></td>'. |
&mt('Delete').'</label></span></td>'. |
&Apache::loncommon::end_data_table_row().'</td>'; |
&Apache::loncommon::end_data_table_row(); |
$num ++; |
$num ++; |
} |
} |
} |
} |
$datatable .= &Apache::loncommon::start_data_table_row(). |
$datatable .= &Apache::loncommon::start_data_table_row(). |
'<td><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&mt('Additional language:').'</span><br />'. |
&mt('Additional language:'). '</span><br />'. |
&Apache::loncommon::select_language($item); |
&Apache::loncommon::select_language('languages_'.$num,'',1). |
'<input type="hidden" name="languages_total" value="'.$num.'" />'. |
'<input type="hidden" name="languages_total" value="'.$num.'" />'. |
'</td>'.&Apache::loncommon::end_data_table_row(). |
'</td>'.&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table(); |
&Apache::loncommon::end_data_table(); |
Line 733 sub print_localization {
|
Line 2231 sub print_localization {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub get_lang_choices { |
|
my %langchoices; |
|
foreach my $id (&Apache::loncommon::languageids()) { |
|
my $code = &Apache::loncommon::supportedlanguagecode($id); |
|
if ($code) { |
|
$langchoices{$code} = &Apache::loncommon::plainlanguagedescription($id); |
|
} |
|
} |
|
return %langchoices; |
|
} |
|
|
sub print_feedback { |
sub print_feedback { |
my ($position,$cdom,$settings,$ordered,$rowtotal) = @_; |
my ($position,$cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my %items = ( |
my %items = ( |
'question' => { |
'question.email' => { |
text => '<b>'.&mt('Resource Content').'</b>', |
text => '<b>'.&mt($itemtext->{'question.email'}).'</b>', |
input => 'textbox', |
input => 'textbox', |
size => '50', |
size => '50', |
}, |
}, |
|
|
'comment' => { |
'comment.email' => { |
text => '<b>'.&mt('Course Content').'</b>', |
text => '<b>'.&mt($itemtext->{'comment.email'}).'</b>', |
input => 'textbox', |
input => 'textbox', |
size => '50', |
size => '50', |
}, |
}, |
|
|
'policy' => { |
'policy.email' => { |
text => '<b>'.&mt('Course Policy').'</b>', |
text => '<b>'.&mt($itemtext->{'policy.email'}).'</b>', |
input => 'textbox', |
input => 'textbox', |
size => '50', |
size => '50', |
}, |
}, |
Line 763 sub print_feedback {
|
Line 2272 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); |
if ($position eq 'top') { |
|
$datatable .= &item_table_row_start($items{$item}{text},$count); |
|
} else { |
|
$datatable .= &item_table_row_start($items{$item}{text}."<br/>(Custom text)",$count, "advanced"); |
|
} |
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.'.email'},\%lt); |
$settings->{$item},\%lt); |
} else { |
} else { |
$datatable .= &Apache::lonhtmlcommon::textbox($item.'_text', |
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text', |
$settings->{$item},$items{$item}{size}); |
$settings->{$item.'.text'},$items{$item}{size}); |
} |
} |
$datatable .= &item_table_row_end(); |
$datatable .= &item_table_row_end(); |
} |
} |
Line 795 sub user_table {
|
Line 2308 sub user_table {
|
} else { |
} else { |
my $num = 0; |
my $num = 0; |
my @curr = split(/,/,$currvalue); |
my @curr = split(/,/,$currvalue); |
$output .= &Apache::loncommon::start_data_table(); |
$output .= '<table class="LC_nested_outer">'; |
my ($currusers); |
my ($currusers); |
foreach my $val (@curr) { |
foreach my $val (@curr) { |
next if ($val eq ''); |
next if ($val eq ''); |
Line 811 sub user_table {
|
Line 2324 sub user_table {
|
'name="'.$item.'_delete" value="'.$num.'" />'. |
'name="'.$item.'_delete" value="'.$num.'" />'. |
$lt->{'del'}.'</label>'. |
$lt->{'del'}.'</label>'. |
'<input type="hidden" name="'.$item.'_user_'. |
'<input type="hidden" name="'.$item.'_user_'. |
$num.'" value="'.$val.'" />'.(' 'x2). |
$num.'" value="'.$uname.':'.$udom.'" />'.(' 'x2). |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($uname,$udom,'firstname'), |
&Apache::loncommon::plainname($uname,$udom,'firstname'), |
$uname,$udom,'aboutuser'); |
$uname,$udom,'aboutuser'); |
Line 826 sub user_table {
|
Line 2339 sub user_table {
|
$num ++; |
$num ++; |
} |
} |
if ($num) { |
if ($num) { |
$output .= &Apache::loncommon::start_data_table_row(). |
$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'}; |
} |
} |
$output .= '</i><br />'. |
$output .= '</i><br />'. |
'<table>'.$currusers.'</table></td>'. |
'<table>'.$currusers.'</table></td>'. |
&Apache::loncommon::end_data_table_row(); |
'</tr>'; |
} |
} |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= '<tr>'. |
'<td align="left"><span class="LC_nobreak"><i>'. |
'<td align="left"><span class="LC_nobreak"><i>'. |
$lt->{'add'}.'</i></span><br />'. |
$lt->{'add'}.'</i></span><br />'. |
&select_recipient($item,$num,$cdom,$sections). |
&select_recipient($item,$num,$cdom,$sections). |
'<input type="hidden" name="'.$item.'_total" value="'.$num.'" />'. |
'<input type="hidden" name="'.$item.'_total" value="'.$num.'" />'. |
'</td>'.&Apache::loncommon::end_data_table_row(). |
'</td></tr></table>'; |
&Apache::loncommon::end_data_table(); |
|
} |
} |
return $output; |
return $output; |
} |
} |
Line 903 sub select_sections {
|
Line 2415 sub select_sections {
|
} |
} |
|
|
sub print_discussion { |
sub print_discussion { |
my ($cdom,$settings,$ordered,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my %items = ( |
my %items = ( |
'plc.roles.denied' => { |
'plc.roles.denied' => { |
text => '<b>'.&mt('No Chat room use').'</b>'. |
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'plc.roles.denied'}).'</b>'. |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
|
&mt('(role-based)'), |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
|
|
'plc.users.denied' => { |
'plc.users.denied' => { |
text => '<b>'.&mt('No Chat room use').'</b>', |
text => '<b>'.&mt($itemtext->{'plc.users.denied'}).'</b><br />'. |
|
&mt('(specific user(s))'), |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
|
|
'pch.roles.denied' => { |
'pch.roles.denied' => { |
text => '<b>'.&mt('No Resource Discussion').'</b>'. |
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'pch.roles.denied'}).'</b>'. |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
&Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'. |
|
&mt('(role-based)'), |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
|
|
'pch.users.denied' => { |
'pch.users.denied' => { |
text => '<b>'.&mt('No Resource Discussion').'</b>', |
text => '<b>'.&mt($itemtext->{'pch.users.denied'}).'</b><br />'. |
|
&mt('(specific user(s))'), |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
'allow_limited_html_in_feedback' => { |
'allow_limited_html_in_feedback' => { |
text => '<b>'.&mt('Allow limited HTML in discussion posts').'</b>', |
text => '<b>'.&mt($itemtext->{'allow_limited_html_in_feedback'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
|
|
'allow_discussion_post_editing' => { |
'allow_discussion_post_editing' => { |
text => '<b>'.&mt('Users can edit/delete own discussion posts').'</b>', |
text => '<b>'.&mt($itemtext->{'allow_discussion_post_editing'}).'</b>', |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
); |
); |
Line 945 sub print_discussion {
|
Line 2461 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 985 sub print_discussion {
|
Line 2501 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 1005 sub role_checkboxes {
|
Line 2526 sub role_checkboxes {
|
if (!grep(/^\Q$sec\E/,@{$currsec{$trole}})) { |
if (!grep(/^\Q$sec\E/,@{$currsec{$trole}})) { |
push(@{$currsec{$trole}},$sec); |
push(@{$currsec{$trole}},$sec); |
} |
} |
|
} else { |
|
$currsec{$trole} = [$sec]; |
} |
} |
} else { |
} else { |
push(@curr_roles,$role); |
push(@curr_roles,$role); |
Line 1021 sub role_checkboxes {
|
Line 2544 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 1092 sub role_checkboxes {
|
Line 2615 sub role_checkboxes {
|
} |
} |
|
|
sub print_classlists { |
sub print_classlists { |
my ($position,$cdom,$settings,$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 1101 sub print_classlists {
|
Line 2624 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('Start date').'</b>', |
text => '<b>'.&mt($itemtext->{'default_enrollment_start_date'}).'</b>', |
input => 'dates', |
input => 'dates', |
}, |
}, |
'default_enrollment_end_date' => { |
'default_enrollment_end_date' => { |
text => '<b>'.&mt('End date').'</b>', |
text => '<b>'.&mt($itemtext->{'default_enrollment_end_date'}).'</b>', |
input => 'dates', |
input => 'dates', |
}, |
}, |
|
|
'nothideprivileged' => { |
'nothideprivileged' => { |
text => '<b>'.&mt('Domain Coodinators in course').'</b>', |
text => '<b>'.&mt($itemtext->{'nothideprivileged'}).'</b>', |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
|
|
'student_classlist_view' => { |
'student_classlist_view' => { |
text => '<b>'.&mt('Student-viewable classlist').'</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('Student agreement needed to be listed').'</b>', |
text => '<b>'.&mt($itemtext->{'student_classlist_opt_in'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
|
|
'student_classlist_portfiles' => { |
'student_classlist_portfiles' => { |
text => '<b>'.&mt('Include link to accessible portfolio files').'</b>', |
text => '<b>'.&mt($itemtext->{'student_classlist_portfiles'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
); |
); |
Line 1142 sub print_classlists {
|
Line 2678 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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
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('Default XML Style File').'</b> '. |
text => '<b>'.&mt($itemtext->{'default_xml_style'}).'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('display','default_xml_style'". |
"('display','default_xml_style'". |
",'sty')".'">'.&mt('Select Style File').'</a>', |
",'sty')".'">'.&mt('Select Style File').'</a>', |
Line 1161 sub print_appearance {
|
Line 2703 sub print_appearance {
|
}, |
}, |
|
|
'pageseparators' => { |
'pageseparators' => { |
text => '<b>'.&mt('Visibly Separate Items on Pages').'</b>', |
text => '<b>'.&mt($itemtext->{'pageseparators'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
'disable_receipt_display' => { |
'disable_receipt_display' => { |
text => '<b>'.&mt('Disable display of problem receipts').'</b>', |
text => '<b>'.&mt($itemtext->{'disable_receipt_display'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
'texengine' => { |
'texengine' => { |
text => '<b>'.&mt('Force use of a specific math rendering engine.').'</b>', |
text => '<b>'.&mt($itemtext->{'texengine'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
jsMath => 'jsMath', |
jsMath => 'jsMath', |
Line 1177 sub print_appearance {
|
Line 2719 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('Default set of options to pass to tth/m when converting TeX').'</b>', |
text => '<b>'.&mt($itemtext->{'tthoptions'}).'</b>', |
input => 'textbox', |
input => 'textbox', |
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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my %items = ( |
my %items = ( |
'grading' => { |
'grading' => { |
text => '<b>'.&mt('Grading').'</b>'. |
text => '<b>'.&mt($itemtext->{'grading'}).'</b>'. |
&Apache::loncommon::help_open_topic('GradingOptions'), |
&Apache::loncommon::help_open_topic('GradingOptions'), |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
standard => &mt('Standard: shows points'), |
standard => &mt('Standard: shows points'), |
external => &mt('External: shows number of completed parts'), |
external => &mt('External: shows number of completed parts and totals'), |
|
externalnototals => &mt('External: shows only number of completed parts'), |
spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'), |
spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'), |
}, |
}, |
order => ['standard','external','spreadsheet'], |
order => ['standard','external','externalnototals','spreadsheet'], |
}, |
}, |
'rndseed' => { |
'rndseed' => { |
text => '<b>'.&mt('Randomization algorithm used').'</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 1222 sub print_grading {
|
Line 2765 sub print_grading {
|
order => ['32bit','64bit','64bit2','64bit3','64bit4','64bit5'], |
order => ['32bit','64bit','64bit2','64bit3','64bit4','64bit5'], |
}, |
}, |
'receiptalg' => { |
'receiptalg' => { |
text => '<b>'.&mt('Receipt algorithm used').'</b><br />'. |
text => '<b>'.&mt($itemtext->{'receiptalg'}).'</b><br />'. |
&mt('This controls how receipt numbers are generated.'), |
&mt('This controls how receipt numbers are generated'), |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
receipt => 'receipt', |
receipt => 'receipt', |
Line 1233 sub print_grading {
|
Line 2776 sub print_grading {
|
order => ['receipt','receipt2','receipt3'], |
order => ['receipt','receipt2','receipt3'], |
}, |
}, |
'disablesigfigs' => { |
'disablesigfigs' => { |
text => '<b>'.&mt('Disable checking of Significant Figures').'</b>', |
text => '<b>'.&mt($itemtext->{'disablesigfigs'}).'</b>', |
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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my %items = ( |
my %items = ( |
problem_stream_switch => { |
problem_stream_switch => { |
text => '<b>'.&mt('Allow problems to be split over pages').'</b>', |
text => '<b>'.&mt($itemtext->{'problem_stream_switch'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
suppress_tries => { |
suppress_tries => { |
text => '<b>'.&mt('Suppress number of tries in printing').'</b>', |
text => '<b>'.&mt($itemtext->{'suppress_tries'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
default_paper_size => { |
default_paper_size => { |
text => '<b>'.&mt('Default paper type').'</b>', |
text => '<b>'.&mt($itemtext->{'default_paper_size'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
Letter => &mt('Letter').' [8 1/2x11 in]', |
Letter => &mt('Letter').' [8 1/2x11 in]', |
Line 1272 sub print_printouts {
|
Line 2815 sub print_printouts {
|
nullval => 'None specified', |
nullval => 'None specified', |
}, |
}, |
print_header_format => { |
print_header_format => { |
text => '<b>'.&mt('Print header format').'</b>', |
text => '<b>'.&mt($itemtext->{'print_header_format'}).'</b>', |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
disableexampointprint => { |
disableexampointprint => { |
text => '<b>'.&mt('Disable automatically printing point values on exams').'</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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my %items = ( |
my %items = ( |
spreadsheet_default_classcalc => { |
spreadsheet_default_classcalc => { |
text => '<b>'.&mt('Default Course Spreadsheet').'</b> '. |
text => '<b>'.&mt($itemtext->{'spreadsheet_default_classcalc'}).'</b> '. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
"('display','spreadsheet_default_classcalc'". |
"('display','spreadsheet_default_classcalc'". |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
input => 'textbox', |
input => 'textbox', |
}, |
}, |
spreadsheet_default_studentcalc => { |
spreadsheet_default_studentcalc => { |
text => '<b>'.&mt('Default Student Spreadsheet').'</b> '. |
text => '<b>'.&mt($itemtext->{'spreadsheet_default_studentcalc'}).'</b> '. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
"('display','spreadsheet_default_calc'". |
"('display','spreadsheet_default_calc'". |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
input => 'textbox', |
input => 'textbox', |
}, |
}, |
spreadsheet_default_assesscalc => { |
spreadsheet_default_assesscalc => { |
text => '<b>'.&mt('Default Assessment Spreadsheet').'</b> '. |
text => '<b>'.&mt($itemtext->{'spreadsheet_default_assesscalc'}).'</b> '. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
'<span class="LC_nobreak"><a href="javascript:openbrowser'. |
"('display','spreadsheet_default_assesscalc'". |
"('display','spreadsheet_default_assesscalc'". |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
",'spreadsheet')".'">'.$SelectSpreadsheetFile.'</a></span>', |
input => 'textbox', |
input => 'textbox', |
}, |
}, |
hideemptyrows => { |
hideemptyrows => { |
text => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b>', |
text => '<b>'.&mt($itemtext->{'hideemptyrows'}).'</b>', |
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,$rowtotal) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
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('Send message to student when clicking Done on Tasks').'</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'), |
}, |
}, |
task_grading => { |
task_grading => { |
text => '<b>'.&mt('Bridge Task grading by instructors and TAs in sections').'</b>', |
text => '<b>'.&mt($itemtext->{'task_grading'}).'</b>', |
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
any => &mt('Grade BTs in any section'), |
any => &mt('Grade BTs in any section'), |
Line 1345 sub print_bridgetasks {
|
Line 2906 sub print_bridgetasks {
|
order => ['any','section'], |
order => ['any','section'], |
}, |
}, |
suppress_embed_prompt => { |
suppress_embed_prompt => { |
text => '<b>'.&mt('Hi$de upload references prompt if uploading file to portfolio').'</b><span class="LC_nobreak"> '. |
text => '<b>'.&mt($itemtext->{'suppress_embed_prompt'}).'</b><span class="LC_nobreak">'. |
&mt('(applies when current role is student)').'</span>', |
' '.&mt('(applies when current role is student)').'</span>', |
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; |
} |
} |
my @ordered; |
my @ordered = &get_other_items($cdom,$settings,$allitems); |
my %items; |
my %items; |
|
foreach my $parameter (@ordered) { |
|
$items{$parameter} = { |
|
text => '<b>'.$parameter.'</b>', |
|
input => 'textbox', |
|
size => '15', |
|
}, |
|
} |
|
push (@ordered,'newp_value'); |
|
$items{'newp_value'} = { |
|
text => '<b>'.&mt('Create New Environment Variable').'</b><br />'. |
|
'<input type="textbox" name="newp_name"'. |
|
' value="" size="30" />', |
|
input => 'textbox', |
|
size => '30', |
|
}; |
|
my $output = &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype); |
|
} |
|
|
|
sub get_other_items { |
|
my ($cdom,$settings,$allitems) = @_; |
|
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) { |
|
return; |
|
} |
|
my @ordered; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $parameter (sort(keys(%{$settings}))) { |
foreach my $parameter (sort(keys(%{$settings}))) { |
next if (grep/^\Q$parameter\E$/,@{$allitems}); |
next if (grep/^\Q$parameter\E$/,@{$allitems}); |
next if (($parameter eq 'course.helper.not.run') && |
next if (($parameter eq 'course.helper.not.run') && |
(!exists($env{'user.role.dc./'.$env{'request.role.domain'}.'/'}))); |
(!exists($env{'user.role.dc./'.$env{'request.role.domain'}.'/'}))); |
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); |
$items{$parameter} = { |
|
text => $parameter, |
|
input => 'textbox', |
|
size => '15', |
|
}, |
|
} |
} |
} |
} |
} |
} |
return &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal); |
return @ordered; |
} |
} |
|
|
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">'; |
'</td><td class="LC_right_item">'; |
return $output; |
return $output; |
Line 1461 sub select_from_options {
|
Line 3039 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 1469 sub make_item_rows {
|
Line 3047 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 1499 sub make_item_rows {
|
Line 3077 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 1517 sub nothidepriv_row {
|
Line 3095 sub nothidepriv_row {
|
my %coursepersonnel = &Apache::lonnet::dump('nohist_userroles',$cdom,$cnum); |
my %coursepersonnel = &Apache::lonnet::dump('nohist_userroles',$cdom,$cnum); |
my $now = time; |
my $now = time; |
my @privusers; |
my @privusers; |
|
my %privileged; |
foreach my $person (keys(%coursepersonnel)) { |
foreach my $person (keys(%coursepersonnel)) { |
my ($role,$user,$usec) = ($person =~ /^([^:]*):([^:]+:[^:]+):([^:]*)/); |
my ($role,$user,$usec) = ($person =~ /^([^:]*):([^:]+:[^:]+):([^:]*)/); |
$user =~ s/:$//; |
$user =~ s/:$//; |
Line 1525 sub nothidepriv_row {
|
Line 3104 sub nothidepriv_row {
|
next; |
next; |
} |
} |
my ($uname,$udom) = split(':',$user); |
my ($uname,$udom) = split(':',$user); |
if (&Apache::lonnet::privileged($uname,$udom)) { |
unless (ref($privileged{$udom}) eq 'HASH') { |
push(@privusers,$user); |
my %dompersonnel = &Apache::lonnet::get_domain_roles($udom,['dc'],undef,$now); |
|
$privileged{$udom} = {}; |
|
if (keys(%dompersonnel)) { |
|
foreach my $server (keys(%dompersonnel)) { |
|
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
|
my ($trole,$uname,$udom) = split(/:/,$user); |
|
$privileged{$udom}{$uname} = $trole; |
|
} |
|
} |
|
} |
|
} |
|
if (exists($privileged{$udom}{$uname})) { |
|
unless (grep(/^\Q$user\E$/,@privusers)) { |
|
push(@privusers,$user); |
|
} |
} |
} |
} |
} |
if (@privusers) { |
if (@privusers) { |
Line 1546 sub nothidepriv_row {
|
Line 3139 sub nothidepriv_row {
|
'</td><td align="left">'. |
'</td><td align="left">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="'.$item.'_'.$user.'"'. |
'<input type="radio" name="'.$item.'_'.$user.'"'. |
$hideon.' value="yes" />'.&mt('Hidden').'</label> '. |
$hideon.' value="" />'.&mt('Hidden').'</label> '. |
'<label><input type="radio" name="'.$item.'_'.$user.'"'. $hideoff.' value="" />'.&mt('Shown').'</label></span></td>'. |
'<label><input type="radio" name="'.$item.'_'.$user.'"'. $hideoff.' value="yes" />'.&mt('Shown').'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
} |
} |
$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 1567 sub print_hdrfmt_row {
|
Line 3164 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 1629 function getIndexByName(item) {
|
Line 3226 function getIndexByName(item) {
|
</script> |
</script> |
|
|
ENDJS |
ENDJS |
$output .= $currstr.&Apache::loncommon::start_data_table(); |
$output .= $currstr.'<table class="LC_nested_outer">'; |
if (@curr > 0) { |
if (@curr > 0) { |
for (my $i=0; $i<@curr; $i++) { |
for (my $i=0; $i<@curr; $i++) { |
my $pos = $i+1; |
my $pos = $i+1; |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= '<tr>'. |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&position_selector($pos,$i,$maxnum).&mt('Delete:'). |
&position_selector($pos,$i,$maxnum).&mt('Delete:'). |
'<input type="checkbox" name="printfmthdr_del_'.$i. |
'<input type="checkbox" name="printfmthdr_del_'.$i. |
Line 1647 ENDJS
|
Line 3244 ENDJS
|
'<input type="textbox" name="printfmthdr_text_'.$i.'"'. |
'<input type="textbox" name="printfmthdr_text_'.$i.'"'. |
' value="'.$curr[$i].'" size="25" /></td>'; |
' value="'.$curr[$i].'" size="25" /></td>'; |
} |
} |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= '</tr>'; |
} |
} |
} |
} |
my $pos = $currnum+1; |
my $pos = $currnum+1; |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= '<tr>'. |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&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>'. |
&Apache::loncommon::end_data_table_row(); |
'</tr>'; |
$pos ++; |
$pos ++; |
$currnum ++; |
$currnum ++; |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= '<tr>'. |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&position_selector($pos,$currnum,$maxnum). |
&position_selector($pos,$currnum,$maxnum). |
'<b>'.&mt('New').'</b></span></td>'. |
'<b>'.&mt('New').'</b></span></td>'. |
'<td colspan="2" align="left">'.&mt('Text').'<br />'. |
'<td colspan="2" align="left">'.&mt('Text').'<br />'. |
'<input type="textbox" name="printfmthdr_text_'.$currnum. |
'<input type="textbox" name="printfmthdr_text_'.$currnum. |
'" value="" size ="25" /></td>'. |
'" value="" size ="25" />'. |
&Apache::loncommon::end_data_table_row(). |
'<input type="hidden" name="printfmthdr_maxnum" value="'. |
&Apache::loncommon::end_data_table(); |
$maxnum.'" /></td>'. |
|
'</tr>'. |
|
'</table>'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1687 sub position_selector {
|
Line 3286 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 />'. |
Line 1712 sub substitution_selector {
|
Line 3319 sub substitution_selector {
|
return $output; |
return $output; |
} |
} |
|
|
sub modify_crsenv { |
sub change_clone { |
my ($action,$cdom,%domconfig) = @_; |
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; |
return; |
} |
} |
|
|
1; |
1; |
|
|