version 1.440, 2009/03/31 14:08:20
|
version 1.441, 2009/03/31 17:04:15
|
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 2671 sub crsenv {
|
Line 2668 sub crsenv {
|
); |
); |
|
|
|
|
# The following code is kept to have access to the old version of display order |
|
|
|
# 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'); |
|
# } |
|
# if ($can_categorize) { |
|
# push(@Display_Order,'categories'); |
|
# } |
|
# push (@Display_Order,('grading', |
|
# 'externalsyllabus', |
|
# 'default_xml_style','pageseparators', |
|
# 'question.email','question.email.text','comment.email', |
|
# 'comment.email.text','policy.email','policy.email.text', |
|
# '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', |
|
# 'languages', |
|
# 'timezone', |
|
# '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); |
|
# } |
|
# } |
|
# } |
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------- |
# ---------------------------------------------------------------- |
# Begin: New Version with Parameter Categories |
# Begin: New Version with Parameter Categories |
|
|
sub parameter_row { |
sub parameter_row { |
# Create parameter line for course environment screen |
# Create parameter row for course environment screen |
|
|
my ($parameter, $description) = @_; |
my ($parameter, $description) = @_; |
my $output = ''; |
|
|
|
# Column 1/3: Descritive text of current parameter |
# Start Parameter Row |
$output = &Apache::loncommon::start_data_table_row() |
my $output = &Apache::loncommon::start_data_table_row(); |
.'<td>'.$description.'</td>'; |
|
|
# Column 1/3: Descriptive text of current parameter |
|
$output .= '<td>'.$description.'</td>'; |
|
|
# Column 2/3: Input field (Sometimes special field(s), depending on parameter) |
# Column 2/3: Input field (Sometimes special field(s), depending on parameter) |
# ------------------------------- |
|
# onchange is javascript to automatically check the 'Set' button. |
# onchange is javascript to automatically check the 'Set' button. |
my $onchange = 'onFocus="javascript:window.document.forms' |
my $onchange = 'onFocus="javascript:window.document.forms' |
."['envform'].elements['".$parameter."_setparmval']" |
."['envform'].elements['".$parameter."_setparmval']" |
Line 2817 sub crsenv {
|
Line 2755 sub crsenv {
|
40, |
40, |
$onchange) |
$onchange) |
.'</td>'; |
.'</td>'; |
# ------------------------------- |
|
} |
} |
|
|
# Column 3/3: Check Box (in most cases) |
# Column 3/3: Check Box (in most cases) |
Line 2826 sub crsenv {
|
Line 2763 sub crsenv {
|
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
.'</td>'; |
.'</td>'; |
} |
} |
|
|
|
# End Parameter Row |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
|
|
return $output; |
return $output; |
} |
} # End sub parameter_row |
|
|
|
|
|
|
|
|
# Parameter Category Names |
# Parameter Category Names |
Line 2848 sub crsenv {
|
Line 2785 sub crsenv {
|
'cat_custom' => 'Parameter Category Custom', |
'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 |
# Link Parameter Categories with Parameters |
|
# Order of parameters is display order |
my %parm_cat_parms = ( |
my %parm_cat_parms = ( |
'cat_0' => [ |
'cat_0' => [ |
'url', |
'url', |
Line 2927 sub crsenv {
|
Line 2879 sub crsenv {
|
} |
} |
$parm_cat_parms{'cat_can'} = [@can_cats]; |
$parm_cat_parms{'cat_can'} = [@can_cats]; |
|
|
# Add custom parameters to parameter categories hash |
# Add custom parameters to custom parameter category |
my @custom_cats; |
my @custom_cats; |
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
Line 2943 sub crsenv {
|
Line 2895 sub crsenv {
|
$parm_cat_parms{'cat_custom'} = [@custom_cats]; |
$parm_cat_parms{'cat_custom'} = [@custom_cats]; |
|
|
|
|
# Old output structure: |
# Display Course Parameter Overview |
|
|
#$start_table |
|
#$start_header_row |
|
#<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th> |
|
#$end_header_row |
|
#$output |
|
#$end_table |
|
|
|
|
|
# Display Parameter List Overview |
|
# Provide hyperlinks to detailed parameter settings |
# Provide hyperlinks to detailed parameter settings |
$output_SB .= '<a name="parmlist" />' |
$output_SB .= '<a name="parmlist" />' |
.'<h2>'.&mt('Course Parameter Overview').'</h2>' |
.'<div class="LC_ContentBoxSpecial">' |
.'<div class="LC_ContentBox">' |
.'<h2 class="LC_hcell">'.&mt('Course Parameter Overview').'</h2>' |
.'<ul>'; |
.'<ul>'; |
foreach my $catkey (keys(%parm_cat_names)) { |
foreach my $catkey (@Display_Order) { |
|
if (!@{$parm_cat_parms{$catkey}}) { next; } # Only display non-empty categories |
$output_SB .= '<li>' |
$output_SB .= '<li>' |
.'<a href="#parmlist_'.$catkey.'">' |
.'<a href="#parmlist_'.$catkey.'">' |
.$parm_cat_names{$catkey} |
.$parm_cat_names{$catkey} |
Line 2970 $output_SB .= '</ul>'
|
Line 2913 $output_SB .= '</ul>'
|
.'</div>'; |
.'</div>'; |
|
|
|
|
# Display Parameter Details |
|
my $buttons='<div align="right">' |
my $buttons='<div align="right">' |
.'<input type="submit" name="crsenv" value="'.&mt('Save All').'" />' |
.'<input type="submit" name="crsenv" value="'.&mt('Save All').'" />' |
.'<br /><a href="#parmlist">'.&mt('Back to Parameter List').'</a>' |
.'<br /><a href="#parmlist">'.&mt('Back to Course Parameter Overview').'</a>' |
.'</div>'; |
.'</div>'; |
|
|
|
# Display all Parameters grouped by categories |
$output_SB .= '<h2>'.&mt('Course Parameters').'</h2>'; |
$output_SB .= '<h2>'.&mt('Course Parameters').'</h2>'; |
|
|
foreach my $catkey (keys(%parm_cat_names)) { |
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(); |
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
.'<td colspan="3">' |
.'<td colspan="3">' |
Line 2994 foreach my $catkey (keys(%parm_cat_names
|
Line 2938 foreach my $catkey (keys(%parm_cat_names
|
my $description = $descriptions{$parameter}; |
my $description = $descriptions{$parameter}; |
$output_SB .= ¶meter_row($parameter, $description); |
$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() |
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
.'<td colspan="3">' |
.'<td colspan="3">' |
.$buttons |
.$buttons |
.'</td>' |
.'</td>' |
.&Apache::loncommon::end_data_table_empty_row; |
.&Apache::loncommon::end_data_table_empty_row; |
|
|
$output_SB .= &Apache::loncommon::end_data_table() |
$output_SB .= &Apache::loncommon::end_data_table() |
. '<br />'; |
. '<br />'; |
} |
} |
|
|
$output_SB .= '</div>'; |
|
|
|
# End: New Version with Parameter Categories |
# End: New Version with Parameter Categories |
# ---------------------------------------------------------------- |
# ---------------------------------------------------------------- |
|
|
|
|
# # Display Parameter table |
|
# 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$/) { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::date_setter('envform', |
|
# $parameter.'_value', |
|
# $values{$parameter}, |
|
# $onchange). |
|
# '</td>'; |
|
# } elsif ($parameter eq 'timezone') { |
|
# my $includeempty = 1; |
|
# my $timezone = &Apache::lonlocal::gettimezone(); |
|
# $output .= '<td>'. |
|
# &Apache::loncommon::select_timezone($parameter.'_value', |
|
# $timezone, |
|
# $onchange,$includeempty).'</td>'; |
|
# } elsif ($parameter eq 'datelocale') { |
|
# my $includeempty = 1; |
|
# my $locale_obj = &Apache::lonlocal::getdatelocale(); |
|
# my $currdatelocale; |
|
# if (ref($locale_obj)) { |
|
# $currdatelocale = $locale_obj->id(); |
|
# } |
|
# $output .= '<td>'. |
|
# &Apache::loncommon::select_datelocale($parameter.'_value', |
|
# $currdatelocale, |
|
# $onchange,$includeempty).'</td>'; |
|
# } elsif ($parameter eq 'rolenames') { |
|
# $output.= '<td><table>'; |
|
# foreach my $role ('cc','in','ta','ep','ad','st') { |
|
# my $onchange = 'onFocus="javascript:window.document.forms'. |
|
# "['envform'].elements['". |
|
# $parameter.'_'.$role."_setparmval']". |
|
# '.checked=true;"'; |
|
# $output.= '<tr><td>'.&Apache::lonnet::plaintext($role,$crstype,undef,1). |
|
# '</td><td>'. |
|
# &Apache::lonhtmlcommon::textbox($parameter.'_'.$role.'_value', |
|
# $values{$role.'.plaintext'}, |
|
# 15,$onchange). |
|
# '</td></tr>'; |
|
# } |
|
# $output .= '</table></td><td><table>'; |
|
# foreach my $role ('cc','in','ta','ep','ad','st') { |
|
# $output .= '<tr><td>'.&Apache::lonhtmlcommon::checkbox($parameter.'_'.$role.'_setparmval'). |
|
# '</td></tr>'; |
|
# } |
|
# $output .= '</table></td>'; |
|
# } elsif ($parameter eq 'categories') { |
|
# my $catdisplay; |
|
# if ($values{'categories'} ne '') { |
|
# my @curritems = split(/\&/,$values{'categories'}); |
|
# foreach my $item (@curritems) { |
|
# my ($name,$parent,$pos) = split(/:/,$item); |
|
# $catdisplay .= &unescape($name).'&'; |
|
# } |
|
# $catdisplay =~ s/\&$//; |
|
# } |
|
# $output .= '<td>'. |
|
# '<input type="hidden" name="categories_value" value="'. |
|
# $values{'categories'}.'" />'. |
|
# '<input type="textbox" name="categories_display" value="'. |
|
# $catdisplay.'" readonly="readonly" size="40" /></td>'; |
|
# } else { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::textbox($parameter.'_value', |
|
# $values{$parameter}, |
|
# 40,$onchange).'</td>'; |
|
# } |
|
# ------------------------------- |
|
|
|
|
|
# unless ($parameter eq 'rolenames') { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
|
# '</td>'; |
|
# } |
|
# $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 $Parameter=&mt('Parameter'); |
|
my $Value=&mt('Value'); |
|
my $Set=&mt('Set'); |
|
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 3136 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 |
$output_SB |
$output_SB |
<hr class="LC_edit_problem_divide" /> |
|
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
|
$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 |