version 1.437, 2009/03/01 03:33:29
|
version 1.442, 2009/04/05 17:31:04
|
Line 2498 sub crsenv {
|
Line 2498 sub crsenv {
|
} |
} |
} |
} |
|
|
my $start_table =&Apache::loncommon::start_data_table(); |
|
my $start_header_row=&Apache::loncommon::start_data_table_header_row(); |
|
my $end_header_row =&Apache::loncommon::end_data_table_header_row(); |
|
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
|
|
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
Line 2512 sub crsenv {
|
Line 2509 sub crsenv {
|
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $output=''; |
my $output=''; |
|
my $output_SB = ''; # will be replaced by "$output" when all changes are done |
my $can_categorize; |
my $can_categorize; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'par' => 'Parameter', |
|
'val' => 'Value', |
|
'set' => 'Set?', |
|
'sav' => 'Save', |
|
); |
if (! exists($values{'con_lost'})) { |
if (! exists($values{'con_lost'})) { |
my %descriptions= |
my %descriptions= |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
Line 2521 sub crsenv {
|
Line 2525 sub crsenv {
|
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Modification may make assessment data inaccessible!'). |
&mt('Modification may make assessment data inaccessible!'). |
'</span>', |
'</span>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'description' => '<b>'.&mt('Course Title').'</b>', |
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
'('.&mt('internal, optional').')', |
'('.&mt('internal, optional').')', |
Line 2662 sub crsenv {
|
Line 2666 sub crsenv {
|
=> '<b>'.&mt('Replacement titles for standard course roles').'</b><br />'. |
=> '<b>'.&mt('Replacement titles for standard course roles').'</b><br />'. |
'('.&mt('To replace the standard title for a course role, enter the title you wish to use, otherwise leave blank.').')', |
'('.&mt('To replace the standard title for a course role, enter the title you wish to use, otherwise leave blank.').')', |
); |
); |
my @Display_Order = ('url','description','courseid','cloners'); |
|
(my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
|
if ($can_toggle_cat) { |
# ---------------------------------------------------------------- |
push(@Display_Order,'hidefromcat'); |
# Begin: New Version with Parameter Categories |
} |
|
if ($can_categorize) { |
sub parameter_row { |
push(@Display_Order,'categories'); |
# Create parameter row for course environment screen |
} |
|
push (@Display_Order,('grading', |
my ($parameter, $description) = @_; |
'externalsyllabus', |
|
'default_xml_style','pageseparators', |
# Start Parameter Row |
'question.email','question.email.text','comment.email', |
my $output = &Apache::loncommon::start_data_table_row(); |
'comment.email.text','policy.email','policy.email.text', |
|
'student_classlist_view', |
# Column 1/3: Descriptive text of current parameter |
'student_classlist_opt_in', |
$output .= '<td>'.$description.'</td>'; |
'student_classlist_portfiles', |
|
'plc.roles.denied','plc.users.denied', |
# Column 2/3: Input field (Sometimes special field(s), depending on parameter) |
'pch.roles.denied','pch.users.denied', |
|
'allow_limited_html_in_feedback', |
# onchange is javascript to automatically check the 'Set' button. |
'allow_discussion_post_editing', |
my $onchange = 'onFocus="javascript:window.document.forms' |
'languages', |
."['envform'].elements['".$parameter."_setparmval']" |
'timezone', |
.'.checked=true;"'; |
'datelocale', |
|
'rolenames', |
|
'nothideprivileged', |
|
'rndseed', |
|
'receiptalg', |
|
'problem_stream_switch', |
|
'suppress_tries', |
|
'suppress_embed_prompt', |
|
'default_paper_size', |
|
'print_header_format', |
|
'disable_receipt_display', |
|
'spreadsheet_default_classcalc', |
|
'spreadsheet_default_studentcalc', |
|
'spreadsheet_default_assesscalc', |
|
'hideemptyrows', |
|
'default_enrollment_start_date', |
|
'default_enrollment_end_date', |
|
'tthoptions', |
|
'texengine', |
|
'disablesigfigs', |
|
'disableexampointprint', |
|
'task_messages','task_grading')); |
|
foreach my $parameter (sort(keys(%values))) { |
|
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
|
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
|
|| ($parameter eq 'type') || |
|
($parameter =~ m/^(cc|in|ta|ep|ad|st)\.plaintext$/)) { |
|
if (! $descriptions{$parameter}) { |
|
$descriptions{$parameter}=$parameter; |
|
push(@Display_Order,$parameter); |
|
} |
|
} |
|
} |
|
|
|
foreach my $parameter (@Display_Order) { |
|
my $description = $descriptions{$parameter}; |
|
# onchange is javascript to automatically check the 'Set' button. |
|
my $onchange = 'onFocus="javascript:window.document.forms'. |
|
"['envform'].elements['".$parameter."_setparmval']". |
|
'.checked=true;"'; |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$description.'</td>'; |
|
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::date_setter('envform', |
&Apache::lonhtmlcommon::date_setter('envform', |
Line 2786 sub crsenv {
|
Line 2748 sub crsenv {
|
$values{'categories'}.'" />'. |
$values{'categories'}.'" />'. |
'<input type="textbox" name="categories_display" value="'. |
'<input type="textbox" name="categories_display" value="'. |
$catdisplay.'" readonly="readonly" size="40" /></td>'; |
$catdisplay.'" readonly="readonly" size="40" /></td>'; |
} else { |
} else { # Display default textbox in all other cases |
$output .= '<td>'. |
$output .= '<td>' |
&Apache::lonhtmlcommon::textbox($parameter.'_value', |
.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
$values{$parameter}, |
$values{$parameter}, |
40,$onchange).'</td>'; |
40, |
|
$onchange) |
|
.'</td>'; |
} |
} |
unless ($parameter eq 'rolenames') { |
|
$output .= '<td>'. |
# Column 3/3: Check Box (in most cases) |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
unless ($parameter eq 'rolenames') { |
'</td>'; |
$output .= '<td>' |
|
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
|
.'</td>'; |
|
} |
|
|
|
# End Parameter Row |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
|
|
return $output; |
|
} # End sub parameter_row |
|
|
|
|
|
# Parameter Category Names |
|
my %parm_cat_names = &Apache::lonlocal::texthash ( |
|
'cat_0' => 'Parameter Category Zero', |
|
'cat_1' => 'Parameter Category One', |
|
'cat_2' => 'Parameter Category Two', |
|
'cat_3' => 'Parameter Category Three', |
|
'cat_4' => 'Parameter Category Four', |
|
'cat_5' => 'Parameter Category Five', |
|
'cat_6' => 'Parameter Category Six', |
|
'cat_7' => 'Parameter Category Seven', |
|
'cat_can' => 'Parameter Category Can', |
|
'cat_custom' => 'Parameter Category Custom', |
|
); |
|
|
|
# Display Order of Parameter Categories |
|
my @Display_Order = ( |
|
'cat_0', |
|
'cat_1', |
|
'cat_2', |
|
'cat_3', |
|
'cat_4', |
|
'cat_5', |
|
'cat_6', |
|
'cat_7', |
|
'cat_can', |
|
'cat_custom', |
|
); |
|
|
|
# Link Parameter Categories with Parameters |
|
# Order of parameters is display order |
|
my %parm_cat_parms = ( |
|
'cat_0' => [ |
|
'url', |
|
'description', |
|
'courseid', |
|
'cloners' |
|
], |
|
'cat_1' => [ |
|
'grading', |
|
'externalsyllabus', |
|
'default_xml_style', |
|
'pageseparators' |
|
], |
|
'cat_2' => [ |
|
'question.email', |
|
'question.email.text', |
|
'comment.email', |
|
'comment.email.text', |
|
'policy.email', |
|
'policy.email.text', |
|
], |
|
'cat_3' => [ |
|
'student_classlist_view', |
|
'student_classlist_opt_in', |
|
'student_classlist_portfiles', |
|
'plc.roles.denied', |
|
'plc.users.denied', |
|
'pch.roles.denied', |
|
'pch.users.denied', |
|
'allow_limited_html_in_feedback', |
|
'allow_discussion_post_editing', |
|
], |
|
'cat_4' => [ |
|
'languages', |
|
'timezone', |
|
'datelocale', |
|
'rolenames', |
|
'nothideprivileged', |
|
'rndseed', |
|
'receiptalg', |
|
'problem_stream_switch', |
|
'suppress_tries', |
|
'suppress_embed_prompt', |
|
'default_paper_size', |
|
'print_header_format', |
|
'disable_receipt_display', |
|
], |
|
'cat_5' => [ |
|
'spreadsheet_default_classcalc', |
|
'spreadsheet_default_studentcalc', |
|
'spreadsheet_default_assesscalc', |
|
'hideemptyrows', |
|
], |
|
'cat_6' => [ |
|
'default_enrollment_start_date', |
|
'default_enrollment_end_date', |
|
], |
|
'cat_7' => [ |
|
'tthoptions', |
|
'texengine', |
|
'disablesigfigs', |
|
'disableexampointprint', |
|
'task_messages', |
|
'task_grading', |
|
], |
|
); |
|
|
|
# Add special parameters depending on special context to parameter categories hash |
|
my @can_cats; |
|
(my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
|
if ($can_toggle_cat) { |
|
push(@can_cats,'hidefromcat'); |
|
} |
|
if ($can_categorize) { |
|
push(@can_cats,'categories'); |
|
} |
|
$parm_cat_parms{'cat_can'} = [@can_cats]; |
|
|
|
# Add custom parameters to custom parameter category |
|
my @custom_cats; |
|
foreach my $parameter (sort(keys(%values))) { |
|
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
|
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
|
|| ($parameter eq 'type') || |
|
($parameter =~ m/^(cc|in|ta|ep|ad|st)\.plaintext$/)) { |
|
if (! $descriptions{$parameter}) { |
|
$descriptions{$parameter}=$parameter; |
|
push(@custom_cats,$parameter); |
} |
} |
$output .= &Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
|
my $onchange = 'onFocus="javascript:window.document.forms'. |
|
'[\'envform\'].elements[\'newp_setparmval\']'. |
|
'.checked=true;"'; |
|
$output.=&Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
|
'<input type="text" size="40" name="newp_name" '. |
|
$onchange.' /></td><td>'. |
|
'<input type="text" size="40" name="newp_value" '. |
|
$onchange.' /></td><td>'. |
|
'<input type="checkbox" name="newp_setparmval" /></td>'. |
|
&Apache::loncommon::end_data_table_row()."\n"; |
|
} |
} |
my %lt=&Apache::lonlocal::texthash( |
$parm_cat_parms{'cat_custom'} = [@custom_cats]; |
'par' => 'Parameter', |
|
'val' => 'Value', |
|
'set' => 'Set?', |
# Display Course Parameter Overview |
'sav' => 'Save' |
# Provide hyperlinks to detailed parameter settings |
); |
$output_SB .= '<a name="parmlist" />' |
|
.'<div class="LC_ContentBoxSpecial">' |
my $Parameter=&mt('Parameter'); |
.'<h2 class="LC_hcell">'.&mt('Course Parameter Overview').'</h2>' |
my $Value=&mt('Value'); |
.'<ul>'; |
my $Set=&mt('Set'); |
foreach my $catkey (@Display_Order) { |
|
if (!@{$parm_cat_parms{$catkey}}) { next; } # Only display non-empty categories |
|
$output_SB .= '<li>' |
|
.'<a href="#parmlist_'.$catkey.'">' |
|
.$parm_cat_names{$catkey} |
|
.'</a>' |
|
.'</li>'; |
|
} |
|
$output_SB .= '</ul>' |
|
.'</div>'; |
|
|
|
|
|
my $buttons='<div align="right">' |
|
.'<input type="submit" name="crsenv" value="'.&mt('Save All').'" />' |
|
.'<br /><a href="#parmlist">'.&mt('Back to Course Parameter Overview').'</a>' |
|
.'</div>'; |
|
|
|
# Display all Parameters grouped by categories |
|
$output_SB .= '<h2>'.&mt('Course Parameters').'</h2>'; |
|
|
|
foreach my $catkey (@Display_Order) { |
|
if (!@{$parm_cat_parms{$catkey}}) { next; } # Only display non-empty categories |
|
$output_SB .= &Apache::loncommon::start_data_table(); |
|
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
|
.'<td colspan="3">' |
|
.'<a name="parmlist_'.$catkey.'" />' |
|
.'<h3>'.$parm_cat_names{$catkey}.'</h3>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_empty_row |
|
.&Apache::loncommon::start_data_table_header_row() |
|
.'<th>'.$lt{'par'}.'</th><th>'.$lt{'val'}.'</th><th>'.$lt{'set'}.'</th>' |
|
.&Apache::loncommon::end_data_table_header_row(); |
|
|
|
foreach my $parameter (@{$parm_cat_parms{$catkey}}) { |
|
my $description = $descriptions{$parameter}; |
|
$output_SB .= ¶meter_row($parameter, $description); |
|
} |
|
# Add special row to custom category |
|
# Offer possibilty to create a new environment variable |
|
if ($catkey eq 'cat_custom') { |
|
my $onchange = 'onFocus="javascript:window.document.forms' |
|
.'[\'envform\'].elements[\'newp_setparmval\']' |
|
.'.checked=true;"'; |
|
$output_SB .= &Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<i>'.&mt('Create New Environment Variable').'</i><br />' |
|
.'<input type="text" size="40" name="newp_name" '.$onchange.' />' |
|
.'</td><td>' |
|
.'<input type="text" size="40" name="newp_value" '.$onchange.' />' |
|
.'</td><td>' |
|
.'<input type="checkbox" name="newp_setparmval" /></td>' |
|
.&Apache::loncommon::end_data_table_row(); |
|
} |
|
# Add buttons row at end of each category |
|
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
|
.'<td colspan="3">' |
|
.$buttons |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_empty_row; |
|
|
|
$output_SB .= &Apache::loncommon::end_data_table() |
|
. '<br />'; |
|
} |
|
|
|
# End: New Version with Parameter Categories |
|
# ---------------------------------------------------------------- |
|
|
|
|
|
} |
|
|
my ($jscript,$categorize_js); |
my ($jscript,$categorize_js); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
if ($can_categorize) { |
if ($can_categorize) { |
Line 2843 ENDSCRIPT
|
Line 2993 ENDSCRIPT
|
$jscript); |
$jscript); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
my $end_table=&Apache::loncommon::end_data_table(); |
|
$r->print(<<ENDENV); |
$r->print(<<ENDENV); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
$output_SB |
$start_table |
|
$start_header_row |
|
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th> |
|
$end_header_row |
|
$output |
|
$end_table |
|
<input type="submit" name="crsenv" value="$lt{'sav'}" /> |
|
</form> |
</form> |
$end_page |
$end_page |
ENDENV |
ENDENV |
Line 4720 sub update_slots {
|
Line 4862 sub update_slots {
|
{"$slot_name\0$wanted" => |
{"$slot_name\0$wanted" => |
\%reservation}, |
\%reservation}, |
$cdom, $cnum); |
$cdom, $cnum); |
|
if ($success eq 'ok') { |
|
my %storehash = ( |
|
symb => $symb, |
|
slot => $slot_name, |
|
action => 'reserve', |
|
context => 'parameter', |
|
); |
|
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
|
'',$uname,$udom,$cnum,$cdom); |
|
|
|
&Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
|
'',$uname,$udom,$uname,$udom); |
|
} |
return $success; |
return $success; |
} |
} |
|
|
Line 4750 sub delete_slots {
|
Line 4905 sub delete_slots {
|
); |
); |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
1,$uname,$udom,$cnum,$cdom); |
1,$uname,$udom,$cnum,$cdom); |
|
&Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
|
1,$uname,$udom,$uname,$udom); |
} |
} |
} |
} |
} |
} |
Line 4785 sub handler {
|
Line 4942 sub handler {
|
text=>"Parameter Manager", |
text=>"Parameter Manager", |
faq=>10, |
faq=>10, |
bug=>'Instructor Interface', |
bug=>'Instructor Interface', |
help => 'Parameter_Manager'}); |
help => |
|
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my $parm_permission = |
my $parm_permission = |