version 1.276, 2006/02/09 22:11:54
|
version 1.339, 2006/10/07 20:02:16
|
Line 63 use Apache::lonhomework;
|
Line 63 use Apache::lonhomework;
|
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
|
use Apache::longroup; |
|
use Apache::lonrss; |
|
use LONCAPA; |
|
|
# --- Caches local to lonparmset |
# --- Caches local to lonparmset |
|
|
Line 90 Inputs: $what - a parameter spec (inclu
|
Line 93 Inputs: $what - a parameter spec (inclu
|
|
|
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels |
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels |
|
|
14 - General Course |
14- General Course |
13 - Map or Folder level in course |
13- Map or Folder level in course |
12- resource default |
12- resource default |
11- map default |
11- map default |
10 - resource level in course |
10- resource level in course |
9 - General for section |
9 - General for section |
8 - Map or Folder level for section |
8 - Map or Folder level for section |
7 - resource level in section |
7 - resource level in section |
Line 117 sub parmval {
|
Line 120 sub parmval {
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
# load caches |
# load caches |
|
|
&cacheparmhash(); |
&cacheparmhash(); |
|
|
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
Line 126 sub parmval_by_symb {
|
Line 128 sub parmval_by_symb {
|
my @outpar=(); |
my @outpar=(); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
Line 293 sub preset_defaults {
|
Line 296 sub preset_defaults {
|
} |
} |
|
|
################################################## |
################################################## |
|
|
|
sub date_sanity_info { |
|
my $checkdate=shift; |
|
unless ($checkdate) { return ''; } |
|
my $result=''; |
|
my $crsprefix='course.'.$env{'request.course.id'}.'.'; |
|
if ($env{$crsprefix.'default_enrollment_end_date'}) { |
|
if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { |
|
$result.='<br />'.&mt('After course enrollment end!'); |
|
} |
|
} |
|
if ($env{$crsprefix.'default_enrollment_start_date'}) { |
|
if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { |
|
$result.='<br />'.&mt('Before course enrollment start!'); |
|
} |
|
} |
|
return $result; |
|
} |
|
################################################## |
################################################## |
################################################## |
# |
# |
# Store a parameter by ID |
# Store a parameter by ID |
Line 375 sub storeparm_by_symb {
|
Line 397 sub storeparm_by_symb {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub log_parmset { |
|
return &Apache::lonnet::instructor_log('parameterlog',@_); |
|
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
# ---------------------------------------------------------- Get symb, map, etc |
# ---------------------------------------------------------- Get symb, map, etc |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
# ---------------------------------------------------------- Construct prefixes |
# ---------------------------------------------------------- Construct prefixes |
$spnam=~s/\_([^\_]+)$/\.$1/; |
$spnam=~s/\_([^\_]+)$/\.$1/; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$spnam; |
my $symbparm=$symb.'.'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
|
|
Line 431 sub storeparm_by_symb_inner {
|
Line 459 sub storeparm_by_symb_inner {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
|
&log_parmset(\%storecontent,1); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$cdom,$cnum); |
('resourcedata',\%storecontent,$cdom,$cnum); |
|
&log_parmset(\%storecontent); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
} else { |
} else { |
Line 454 sub storeparm_by_symb_inner {
|
Line 484 sub storeparm_by_symb_inner {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
|
&log_parmset(\%storecontent,1,$uname,$udom); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
|
&log_parmset(\%storecontent,0,$uname,$udom); |
} |
} |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
|
|
if ($reply=~/^error\:(.*)/) { |
if ($reply=~/^error\:(.*)/) { |
return "<font color=red>Write Error: $1</font>"; |
return "<span class=\"LC_error\">Write Error: $1</span>"; |
} |
} |
return ''; |
return ''; |
} |
} |
Line 476 sub storeparm_by_symb_inner {
|
Line 508 sub storeparm_by_symb_inner {
|
|
|
Format a value for output. |
Format a value for output. |
|
|
Inputs: $value, $type |
Inputs: $value, $type, $editable |
|
|
Returns: $value, formatted for output. If $type indicates it is a date, |
Returns: $value, formatted for output. If $type indicates it is a date, |
localtime($value) is returned. |
localtime($value) is returned. |
|
$editable will return an icon to click on |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
sub valout { |
sub valout { |
my ($value,$type)=@_; |
my ($value,$type,$editable)=@_; |
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
$result = ' '; |
if ($editable) { |
|
$result = '<span class="LC_clickhere">*</span>'; |
|
} else { |
|
$result=' '; |
|
} |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
Line 516 sub valout {
|
Line 553 sub valout {
|
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value); |
$result = localtime($value).&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
} |
} |
Line 558 sub plink {
|
Line 595 sub plink {
|
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type).'</a></td></tr></table>'; |
&valout($value,$type,1).'</a></td></tr></table>'; |
} |
} |
|
|
sub startpage { |
sub page_js { |
my $r=shift; |
|
my $loaditems = qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|; |
|
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
|
$loaditems); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting'); |
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDHEAD); |
return(<<ENDJS); |
$html |
<script type="text/javascript"> |
<head> |
|
<title>LON-CAPA Course Parameters</title> |
|
<script> |
|
|
|
function pclose() { |
function pclose() { |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
Line 616 $html
|
Line 646 $html
|
} |
} |
</script> |
</script> |
$selscript |
$selscript |
</head> |
ENDJS |
$bodytag |
|
|
} |
|
sub startpage { |
|
my ($r) = @_; |
|
|
|
my %loaditems = ('onunload' => "pclose()", |
|
'onload' => "group_or_section('cgroup')",); |
|
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
|
&page_js(), |
|
{'add_entries' => \%loaditems,}); |
|
my $breadcrumbs = |
|
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
|
$r->print(<<ENDHEAD); |
|
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_value" /> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_type" /> |
<input type="hidden" value='' name="pres_marker"> |
<input type="hidden" value='' name="pres_marker" /> |
<input type="hidden" value='1' name="prevvisit"> |
<input type="hidden" value='1' name="prevvisit" /> |
ENDHEAD |
ENDHEAD |
} |
} |
|
|
Line 662 sub print_row {
|
Line 707 sub print_row {
|
} |
} |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
if ($automatic) { |
if ($automatic) { |
$parm.='<font color="red"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</font>'; |
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>'; |
} |
} |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
|
|
Line 1017 sub parmmenu {
|
Line 1062 sub parmmenu {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
$r->print(); |
$r->print("\n<table><tr>"); |
$r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>"); |
my $cnt=0; |
my $cnt=0; |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print("\n<td><font size='-1'><label><input type='checkbox' name='pscat' "); |
$r->print("\n<td><label><input type='checkbox' name='pscat' "); |
$r->print('value="'.$tempkey.'"'); |
$r->print('value="'.$tempkey.'"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked'); |
} |
} |
$r->print('>'.$$allparms{$tempkey}.'</label></font></td>'); |
$r->print('>'.$$allparms{$tempkey}.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 1033 ENDSCRIPT
|
Line 1078 ENDSCRIPT
|
} |
} |
} |
} |
$r->print(' |
$r->print(' |
</tr><tr><td> |
</tr><tr id=\"LC_parm_overview_parm_menu_selectors\"><td> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkstandard()">Select Common Only</a> |
<a href="javascript:checkstandard()">Select Common Only</a> |
</td><td> |
</td><td> |
Line 1083 sub usermenu {
|
Line 1128 sub usermenu {
|
'oi' => "or ID", |
'oi' => "or ID", |
'ad' => "at Domain" |
'ad' => "at Domain" |
); |
); |
my %sectionhash=(); |
|
my $sections=''; |
my $sections=''; |
my $numsec = &Apache::loncommon::get_sections( |
my %sectionhash = &Apache::loncommon::get_sections(); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}, |
|
\%sectionhash); |
|
my $groups; |
my $groups; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
my $numgrp = &Apache::loncommon::coursegroups( |
|
\%grouphash, |
if (%sectionhash) { |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
if ($numsec > 0) { |
|
$sections=$lt{'se'}.': <select name="csec"'; |
$sections=$lt{'se'}.': <select name="csec"'; |
if ($numsec && $numgrp && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
$sections .= '>'; |
$sections .= '>'; |
Line 1108 sub usermenu {
|
Line 1147 sub usermenu {
|
} |
} |
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
if ($numsec && $numgrp && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
$sections .= ' or '; |
$sections .= ' or '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1134 function group_or_section(caller) {
|
Line 1173 function group_or_section(caller) {
|
</script> |
</script> |
|; |
|; |
} |
} |
if ($numgrp > 0) { |
|
|
if (%grouphash) { |
$groups=$lt{'gr'}.': <select name="cgroup"'; |
$groups=$lt{'gr'}.': <select name="cgroup"'; |
if ($numsec && $numgrp && $env{'form.action'} eq 'settable') { |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
Line 1213 sub levelmenu {
|
Line 1253 sub levelmenu {
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($r,$selectedsections)=@_; |
my %sectionhash=(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
my $sections=''; |
return if (!%sectionhash); |
my $numsec = &Apache::loncommon::get_sections( |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$r->print('<select name="Section" multiple="true" size="8" >'); |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
foreach my $s ('all',sort keys %sectionhash) { |
\%sectionhash); |
$r->print(' <option value="'.$s.'"'); |
if ($numsec) { |
foreach (@{$selectedsections}) { |
$r->print('<select name="Section" multiple="true" size="8" >'); |
if ($s eq $_) { |
foreach my $s ('all',sort keys %sectionhash) { |
$r->print(' selected'); |
$r->print(' <option value="'.$s.'"'); |
last; |
foreach (@{$selectedsections}) { |
|
if ($s eq $_) { |
|
$r->print(' selected'); |
|
last; |
|
} |
|
} |
} |
$r->print('>'.$s."</option>\n"); |
|
} |
} |
$r->print("</select>\n"); |
$r->print('>'.$s."</option>\n"); |
} |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($r,$selectedgroups)=@_; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
my $numgrp = &Apache::loncommon::coursegroups( |
return if (!%grouphash); |
\%grouphash, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$r->print('<select name="Group" multiple="true" size="8" >'); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
foreach my $group (sort(keys(%grouphash))) { |
if ($numgrp) { |
$r->print(' <option value="'.$group.'"'); |
$r->print('<select name="Group" multiple="true" size="8" >'); |
foreach (@{$selectedgroups}) { |
foreach my $group (sort(keys(%grouphash))) { |
if ($group eq $_) { |
$r->print(' <option value="'.$group.'"'); |
$r->print(' selected'); |
foreach (@{$selectedgroups}) { |
last; |
if ($group eq $_) { |
} |
$r->print(' selected'); |
} |
last; |
$r->print('>'.$group."</option>\n"); |
} |
|
} |
|
$r->print('>'.$group."</option>\n"); |
|
} |
|
$r->print("</select>\n"); |
|
} |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
|
|
Line 1380 sub assessparms {
|
Line 1411 sub assessparms {
|
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
my $cgroup; |
my $cgroup; |
my $grouplist; |
|
my @usersgroups = (); |
my @usersgroups = (); |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
Line 1452 sub assessparms {
|
Line 1482 sub assessparms {
|
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
"<font color=red>".&mt("Unknown ID")." '$id' ". |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
&mt('at domain')." '$udom'</font>"; |
&mt('at domain')." '$udom'</span>"; |
} |
} |
} else { |
} else { |
$uname=$env{'form.uname'}; |
$uname=$env{'form.uname'}; |
Line 1464 sub assessparms {
|
Line 1494 sub assessparms {
|
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
"<font color=red>".&mt("Unknown user")." '$uname' ". |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
&mt("at domain")." '$udom'</font>"; |
&mt("at domain")." '$udom'</span>"; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
|
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message="<font color=red>". |
$message='<span class="LC_error">'. |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("not in this course")."</font>"; |
&mt("not in this course")."</span>"; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
Line 1484 sub assessparms {
|
Line 1514 sub assessparms {
|
$message="\n<p>\n".&mt("Full Name").": ". |
$message="\n<p>\n".&mt("Full Name").": ". |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br />\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
$grouplist = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if ($grouplist) { |
if (@usersgroups > 0) { |
@usersgroups = &Apache::lonnet::sort_course_groups($grouplist, |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
$env{'request.course.id'}); |
|
unless (grep/^\Q$cgroup\E$/,@usersgroups) { |
|
$cgroup = $usersgroups[0]; |
$cgroup = $usersgroups[0]; |
} |
} |
} else { |
|
$cgroup = ''; |
|
} |
} |
} |
} |
} |
} |
Line 1536 sub assessparms {
|
Line 1562 sub assessparms {
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'" />'); |
} |
} |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
Line 1551 sub assessparms {
|
Line 1577 sub assessparms {
|
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&mt('Specific Resource').": ".$resource. |
my $title = &Apache::lonnet::gettitle($pssymb); |
'<input type="hidden" value="'.$pssymb.'" name="symb">'. |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
|
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
} |
} |
Line 1612 sub assessparms {
|
Line 1639 sub assessparms {
|
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan=3>$lt{'csv'}<br>($csuname $lt{'at'} $csudom)</th> |
<th rowspan=3>$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th> |
<th colspan=1>$lt{'ic'}</th> |
<th colspan=1>$lt{'ic'}</th> |
|
|
Line 1712 ENDTABLEHEADFOUR
|
Line 1739 ENDTABLEHEADFOUR
|
'</font></tt><p><b>'. |
'</font></tt><p><b>'. |
"<a href=\"javascript:openWindow('". |
"<a href=\"javascript:openWindow('". |
&Apache::lonnet::clutter($uri).'?symb='. |
&Apache::lonnet::clutter($uri).'?symb='. |
&Apache::lonnet::escape($symbp{$rid}). |
&escape($symbp{$rid}). |
"', 'metadatafile', '450', '500', 'no', 'yes')\";". |
"', 'metadatafile', '450', '500', 'no', 'yes');\"". |
" TARGET=_self>$title"); |
" target=\"_self\">$title"); |
|
|
if ($thistitle) { |
if ($thistitle) { |
$r->print(' ('.$thistitle.')'); |
$r->print(' ('.$thistitle.')'); |
Line 1911 ENDMAPONE
|
Line 1938 ENDMAPONE
|
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
Line 1928 ENDMAPONE
|
Line 1955 ENDMAPONE
|
$r->print("</table></center>"); |
$r->print("</table></center>"); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
Line 1953 Returns: nothing
|
Line 1980 Returns: nothing
|
sub crsenv { |
sub crsenv { |
my $r=shift; |
my $r=shift; |
my $setoutput=''; |
my $setoutput=''; |
my $bodytag=&Apache::loncommon::bodytag( |
|
'Set Course Environment Parameters'); |
my $breadcrumbs = |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
'Edit Course Environment'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
Line 1979 sub crsenv {
|
Line 2005 sub crsenv {
|
('environment', |
('environment', |
{'top level map backup '.$bkuptime => $tmp[1] }, |
{'top level map backup '.$bkuptime => $tmp[1] }, |
$dom,$crs). |
$dom,$crs). |
'<br>'; |
'<br />'; |
} |
} |
# |
# |
# Deal with modified default spreadsheets |
# Deal with modified default spreadsheets |
Line 2057 sub crsenv {
|
Line 2083 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'}, |
|
{'freshen_cache' => 1}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
|
|
Line 2072 sub crsenv {
|
Line 2103 sub crsenv {
|
('url' => '<b>'.&mt('Top Level Map').'</b> '. |
('url' => '<b>'.&mt('Top Level Map').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','url','sequence')\">". |
"('envform','url','sequence')\">". |
&mt('Select Map').'</a><br /><font color=red> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Modification may make assessment data inaccessible'). |
&mt('Modification may make assessment data inaccessible'). |
'</font>', |
'</span>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
Line 2085 sub crsenv {
|
Line 2116 sub crsenv {
|
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','default_xml_style'". |
"('envform','default_xml_style'". |
",'sty')\">$SelectStyleFile</a><br>", |
",'sty')\">$SelectStyleFile</a><br />", |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'</b><br />(<tt>user:domain,'. |
'</b><br />(<tt>user:domain,'. |
'user:domain(section;section;...;*;...),...</tt>)', |
'user:domain(section;section;...;*;...),...</tt>)', |
Line 2145 sub crsenv {
|
Line 2176 sub crsenv {
|
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
'rndseed' |
'rndseed' |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
'<font color="red">'.&mt('Modifying this will make problems').' '. |
'<span class="LC_error">'.&mt('Modifying this will make problems').' '. |
&mt('have different numbers and answers').'</font>', |
&mt('have different numbers and answers').'</span>', |
'receiptalg' |
'receiptalg' |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
&mt('This controls how receipt numbers are generated.'), |
&mt('This controls how receipt numbers are generated.'), |
Line 2161 sub crsenv {
|
Line 2192 sub crsenv {
|
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
|
'print_header_format' |
|
=> '<b>Print header format; substitutions: %n student name %c course id %a assignment', |
'anonymous_quiz' |
'anonymous_quiz' |
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
Line 2172 sub crsenv {
|
Line 2205 sub crsenv {
|
'disable_receipt_display' |
'disable_receipt_display' |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'task_messages' |
|
=> '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>', |
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
'disableexampointprint' |
'disableexampointprint' |
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'externalsyllabus' |
|
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
'tthoptions' |
'tthoptions' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
); |
); |
my @Display_Order = ('url','description','courseid','cloners','grading', |
my @Display_Order = ('url','description','courseid','cloners','grading', |
|
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
'question.email','comment.email','policy.email', |
'question.email','comment.email','policy.email', |
'student_classlist_view', |
'student_classlist_view', |
Line 2196 sub crsenv {
|
Line 2234 sub crsenv {
|
'problem_stream_switch', |
'problem_stream_switch', |
'suppress_tries', |
'suppress_tries', |
'default_paper_size', |
'default_paper_size', |
|
'print_header_format', |
'disable_receipt_display', |
'disable_receipt_display', |
'spreadsheet_default_classcalc', |
'spreadsheet_default_classcalc', |
'spreadsheet_default_studentcalc', |
'spreadsheet_default_studentcalc', |
Line 2205 sub crsenv {
|
Line 2244 sub crsenv {
|
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'tthoptions', |
'tthoptions', |
'disablesigfigs', |
'disablesigfigs', |
'disableexampointprint' |
'disableexampointprint', |
|
'task_messages' |
); |
); |
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 2215 sub crsenv {
|
Line 2255 sub crsenv {
|
} |
} |
} |
} |
} |
} |
|
|
foreach my $parameter (@Display_Order) { |
foreach my $parameter (@Display_Order) { |
my $description = $descriptions{$parameter}; |
my $description = $descriptions{$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']". |
'.checked=true;"'; |
'.checked=true;"'; |
$output .= '<tr><td>'.$description.'</td>'; |
$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 2238 sub crsenv {
|
Line 2280 sub crsenv {
|
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
'</td>'; |
'</td>'; |
$output .= "</tr>\n"; |
$output .= &Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'.checked=true;"'; |
'.checked=true;"'; |
$output.='<tr><td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
$output.=&Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
'<input type="text" size=40 name="newp_name" '. |
'<input type="text" size=40 name="newp_name" '. |
$onchange.' /></td><td>'. |
$onchange.' /></td><td>'. |
'<input type="text" size=40 name="newp_value" '. |
'<input type="text" size=40 name="newp_value" '. |
$onchange.' /></td><td>'. |
$onchange.' /></td><td>'. |
'<input type="checkbox" name="newp_setparmval" /></td></tr>'; |
'<input type="checkbox" name="newp_setparmval" /></td>'. |
|
&Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'par' => 'Parameter', |
'par' => 'Parameter', |
Line 2260 sub crsenv {
|
Line 2304 sub crsenv {
|
my $Parameter=&mt('Parameter'); |
my $Parameter=&mt('Parameter'); |
my $Value=&mt('Value'); |
my $Value=&mt('Value'); |
my $Set=&mt('Set'); |
my $Set=&mt('Set'); |
my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js= |
my $html=&Apache::lonxml::xmlbegin(); |
'<script type="text/javascript" language="Javascript">'. |
$r->print(<<ENDenv); |
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
$html |
'</script>'; |
<head> |
|
<script type="text/javascript" language="Javascript" > |
my $start_page = |
$browse_js |
&Apache::loncommon::start_page('Set Course Environment', |
</script> |
$browse_js); |
<title>LON-CAPA Course Environment</title> |
my $end_page = |
</head> |
&Apache::loncommon::end_page(); |
$bodytag |
my $end_table=&Apache::loncommon::end_data_table(); |
|
$r->print(<<ENDENV); |
|
$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 |
<p> |
$start_table |
<table border=2> |
$start_header_row |
<tr><th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th></tr> |
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th> |
|
$end_header_row |
$output |
$output |
</table> |
$end_table |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
</form> |
</form> |
</body> |
$end_page |
</html> |
ENDENV |
ENDenv |
|
} |
} |
################################################## |
################################################## |
# Overview mode |
# Overview mode |
Line 2295 sub tablestart {
|
Line 2341 sub tablestart {
|
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return '<table border="2"><tr><th>'.&mt('Parameter').'</th><th>'. |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
} |
} |
} |
} |
Line 2303 sub tablestart {
|
Line 2349 sub tablestart {
|
sub tableend { |
sub tableend { |
if ($tableopen) { |
if ($tableopen) { |
$tableopen=0; |
$tableopen=0; |
return '</table>'; |
return &Apache::loncommon::end_data_table(); |
} else { |
} else { |
return''; |
return''; |
} |
} |
Line 2362 sub storedata {
|
Line 2408 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2377 sub storedata {
|
Line 2424 sub storedata {
|
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</font></h2>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
push (@deldata,$thiskey); |
push (@deldata,$thiskey,$thiskey.'.type'); |
} |
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
Line 2394 sub storedata {
|
Line 2442 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2414 sub storedata {
|
Line 2463 sub storedata {
|
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
|
my %loghash=map { $_ => '' } @deldata; |
|
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</font></h2>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
|
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
Line 2501 sub listdata {
|
Line 2553 sub listdata {
|
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
} |
} |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($realm ne $oldrealm) { |
if ($realm ne $oldrealm) { |
Line 2533 sub listdata {
|
Line 2585 sub listdata {
|
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$r->print(&tableend(). |
"\n<font color='blue'>".&mt('Part').": $part</font>"); |
"\n<span class=\"LC_parm_part\">".&mt('Part').": $part</span>"); |
$oldpart=$part; |
$oldpart=$part; |
} |
} |
# |
# |
# Preset defaults? |
|
# |
|
my ($hour,$min,$sec,$val)=('','','',''); |
|
unless ($$resourcedata{$thiskey}) { |
|
my ($parmname)=($thiskey=~/\.(\w+)$/); |
|
($hour,$min,$sec,$val)=&preset_defaults($parmname); |
|
} |
|
|
|
# |
|
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart(). |
':</b></td><td><input type="checkbox" name="del_'. |
&Apache::loncommon::start_data_table_row(). |
|
'<td><b>'.&standard_parameter_names($name). |
|
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
Line 2559 sub listdata {
|
Line 2604 sub listdata {
|
&Apache::lonhtmlcommon::date_setter('parmform', |
&Apache::lonhtmlcommon::date_setter('parmform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'','',$hour,$min,$sec). |
'',1,'',''). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
|
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'string_yesno') { |
} elsif ($thistype eq 'string_yesno') { |
my $showval; |
my $showval; |
if (defined($$resourcedata{$thiskey})) { |
if (defined($$resourcedata{$thiskey})) { |
$showval=$$resourcedata{$thiskey}; |
$showval=$$resourcedata{$thiskey}; |
} else { |
|
$showval=$val; |
|
} |
} |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
'" value="yes"'); |
'" value="yes"'); |
Line 2585 sub listdata {
|
Line 2629 sub listdata {
|
my $showval; |
my $showval; |
if (defined($$resourcedata{$thiskey})) { |
if (defined($$resourcedata{$thiskey})) { |
$showval=$$resourcedata{$thiskey}; |
$showval=$$resourcedata{$thiskey}; |
} else { |
|
$showval=$val; |
|
} |
} |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$showval.'">'); |
$showval.'">'); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
$r->print('</td></tr>'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
sub newoverview { |
sub newoverview { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Set Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 2667 ENDOVER
|
Line 2705 ENDOVER
|
|
|
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
$r->print('<table border="1"><tr><td>'); |
$r->print('<table id="LC_parm_overview_scope"> |
|
<tr><td class="LC_parm_overview_level_menu">'); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
$r->print('<td>'); |
$r->print('<td class="LC_parm_overview_map_menu">'); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
|
|
$r->print('<table border="1"><tr><td>'); |
$r->print('<table id="LC_parm_overview_controls"> |
|
<tr><td class="LC_parm_overview_parm_selectors">'); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print('</td><td><table border="0" cellspacing="0" cellpadding="0">'. |
$r->print('</td><td class="LC_parm_overview_restrictions"> |
'<tr><td>'.&mt('Parts').'</td><td></td><td>'.&mt('Section(s)'). |
<table class="LC_parm_overview_restrictions">'. |
'</td><td></td><td>'.&mt('Group(s)').'</td></tr><tr><td>'); |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
|
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td> </td><td>'); |
$r->print('</td><td>'); |
§ionmenu($r,\@selected_sections); |
§ionmenu($r,\@selected_sections); |
$r->print('</td><td> </td><td>'); |
$r->print('</td><td>'); |
&groupmenu($r,\@selected_groups); |
&groupmenu($r,\@selected_groups); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
Line 2719 ENDOVER
|
Line 2760 ENDOVER
|
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
'</form></body></html>'); |
'</form>'.&Apache::loncommon::end_page()); |
} |
} |
|
|
sub secgroup_lister { |
sub secgroup_lister { |
Line 2758 sub secgroup_lister {
|
Line 2799 sub secgroup_lister {
|
} |
} |
|
|
sub overview { |
sub overview { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Modify Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 2791 ENDOVER
|
Line 2828 ENDOVER
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'. |
|
&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub clean_parameters { |
|
my ($r) = @_; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
|
$r->print(<<ENDOVER); |
|
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=cleanparameters" name="parmform"> |
|
ENDOVER |
|
# Store modified |
|
|
|
&storedata($r,$crs,$dom); |
|
|
|
# Read modified data |
|
|
|
my $resourcedata=&readdata($crs,$dom); |
|
|
|
# List data |
|
|
|
$r->print('<h3>'. |
|
&mt('These parameters refer to resources that do not exist.'). |
|
'</h3>'. |
|
'<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.'<br />'. |
|
'<br />'); |
|
$r->print(&Apache::loncommon::start_data_table(). |
|
'<tr>'. |
|
'<th>'.&mt('Delete').'</th>'. |
|
'<th>'.&mt('Parameter').'</th>'. |
|
'</tr>'); |
|
foreach my $thiskey (sort(keys(%{$resourcedata}))) { |
|
next if (!exists($resourcedata->{$thiskey.'.type'}) |
|
&& $thiskey=~/\.type$/); |
|
my %data = &parse_key($thiskey); |
|
if (exists($data{'realm_exists'}) |
|
&& !$data{'realm_exists'}) { |
|
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<tr>'. |
|
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
|
|
|
$r->print('<td>'); |
|
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
|
&standard_parameter_names($data{'parameter_name'}), |
|
$resourcedata->{$thiskey})); |
|
$r->print('<br />'); |
|
if ($data{'scope_type'} eq 'all') { |
|
$r->print(&mt('All users')); |
|
} elsif ($data{'scope_type'} eq 'user') { |
|
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
|
} elsif ($data{'scope_type'} eq 'section') { |
|
$r->print(&mt('Section: [_1]',$data{'scope'})); |
|
} elsif ($data{'scope_type'} eq 'group') { |
|
$r->print(&mt('Group: [_1]',$data{'scope'})); |
|
} |
|
$r->print('<br />'); |
|
if ($data{'realm_type'} eq 'all') { |
|
$r->print(&mt('All Resources')); |
|
} elsif ($data{'realm_type'} eq 'folder') { |
|
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
|
} elsif ($data{'realm_type'} eq 'symb') { |
|
my ($map,$resid,$url) = |
|
&Apache::lonnet::decode_symb($data{'realm'}); |
|
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
|
$url,$resid,$map)); |
|
} |
|
$r->print(&mt('Part: [_1]',$data{'parameter_part'})); |
|
$r->print('</td></tr>'); |
|
|
|
} |
|
} |
|
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
|
'<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'. |
|
'</p></form>'. |
|
&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub parse_key { |
|
my ($key) = @_; |
|
my %data; |
|
my ($middle,$part,$name)= |
|
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
$data{'scope_type'} = 'all'; |
|
if ($middle=~/^\[(.*)\]/) { |
|
$data{'scope'} = $1; |
|
if ($data{'scope'}=~/^useropt\:(\w+)\:(\w+)/) { |
|
$data{'scope_type'} = 'user'; |
|
$data{'scope'} = [$1,$2]; |
|
} else { |
|
#FIXME check for group scope |
|
$data{'scope_type'} = 'section'; |
|
} |
|
$middle=~s/^\[(.*)\]//; |
|
} |
|
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
|
$data{'realm_type'}='all'; |
|
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
|
$data{'realm'} = $1; |
|
$data{'realm_type'} = 'folder'; |
|
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
|
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
|
&Apache::lonnet::logthis($1." siad ". $data{'realm_exists'} ); |
|
} elsif ($middle) { |
|
$data{'realm'} = $middle; |
|
$data{'realm_type'} = 'symb'; |
|
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
|
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($data{'realm'}); |
|
$data{'realm_exists'} = &Apache::lonnet::symbverify($data{'realm'},$url); |
|
} |
|
|
|
$data{'parameter_part'} = $part; |
|
$data{'parameter_name'} = $name; |
|
|
|
return %data; |
} |
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
=pod |
=pod |
|
|
=item check_cloners |
=item check_cloners |
Line 2940 Output html header for page
|
Line 3096 Output html header for page
|
################################################## |
################################################## |
################################################## |
################################################## |
sub header { |
sub header { |
my $html=&Apache::lonxml::xmlbegin(); |
return &Apache::loncommon::start_page('Parameter Manager'); |
my $bodytag=&Apache::loncommon::bodytag('Parameter Manager'); |
|
my $title = &mt('LON-CAPA Parameter Manager'); |
|
return(<<ENDHEAD); |
|
$html |
|
<head> |
|
<title>$title</title> |
|
</head> |
|
$bodytag |
|
ENDHEAD |
|
} |
} |
################################################## |
################################################## |
################################################## |
################################################## |
Line 2966 ENDMAINFORMHEAD
|
Line 3113 ENDMAINFORMHEAD
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
|
|
my @menu = |
my @menu = |
( |
( { divider=>'Settings for Your Course', |
{ text => 'Set Course Environment Parameters', |
}, |
|
{ text => 'Set Course Environment', |
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
|
help => 'Course_Environment', |
}, |
}, |
{ text => 'Set Portfolio Metadata', |
{ text => 'Set Portfolio Metadata', |
action => 'setrestrictmeta', |
action => 'setrestrictmeta', |
Line 2979 ENDMAINFORMHEAD
|
Line 3128 ENDMAINFORMHEAD
|
url => '/adm/slotrequest?command=showslots', |
url => '/adm/slotrequest?command=showslots', |
permission => $vgr, |
permission => $vgr, |
}, |
}, |
{ divider => 1, |
{ text => 'Set Parameter Setting Default Actions', |
|
action => 'setdefaults', |
|
permission => $parm_permission, |
|
}, |
|
{ divider => 'New and Existing Parameter Settings for Your Resources', |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
|
help => 'Parameter_Helper', |
}, |
}, |
{ text => 'Modify Resource Parameters - Overview Mode', |
{ text => 'Set/Modify Resource Parameters - Overview Mode', |
action => 'setoverview', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Set Resource Parameters - Overview Mode', |
|
action => 'newoverview', |
action => 'newoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
|
help => 'Parameter_Overview', |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
action => 'settable', |
action => 'settable', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Cascading_Parameters', |
help => 'Table_Mode', |
}, |
}, |
{ text => 'Set Parameter Setting Default Actions', |
{ divider => 'Existing Parameter Settings for Your Resources', |
action => 'setdefaults', |
}, |
|
{ text => 'Modify Resource Parameters - Overview Mode', |
|
action => 'setoverview', |
|
permission => $parm_permission, |
|
help => 'Parameter_Overview', |
|
}, |
|
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
|
action => 'parameterchangelog', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
if ($menu_item->{'divider'}) { |
if ($menu_item->{'divider'}) { |
$menu_html .= '<hr />'; |
$menu_html .= '<h3>'.&mt($menu_item->{'divider'}).'</h3>'; |
next; |
next; |
} |
} |
next if (! $menu_item->{'permission'}); |
next if (! $menu_item->{'permission'}); |
$menu_html.='<p>'; |
$menu_html.='<p>'; |
$menu_html.='<font size="+1">'; |
$menu_html.='<span class="LC_parm_menu_item">'; |
if (exists($menu_item->{'url'})) { |
if (exists($menu_item->{'url'})) { |
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
} else { |
} else { |
$menu_html.= |
$menu_html.= |
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
} |
} |
$menu_html.= &mt($menu_item->{'text'}).'</a></font>'; |
$menu_html.= &mt($menu_item->{'text'}).'</a></span>'; |
if (exists($menu_item->{'help'})) { |
if (exists($menu_item->{'help'})) { |
$menu_html.= |
$menu_html.= |
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
Line 3030 ENDMAINFORMHEAD
|
Line 3188 ENDMAINFORMHEAD
|
} |
} |
### Set portfolio metadata |
### Set portfolio metadata |
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text) = @_; |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my $output; |
my $output; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
unless (defined($options)) { |
if (!defined($options)) { |
$options = 'active,stuadd'; |
$options = 'active,stuadd'; |
$values = ''; |
$values = ''; |
} |
} |
$output.='<strong>'.$field_text.':</strong>'; |
if (!($options =~ /deleted/)) { |
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
$output.='<strong>'.$field_text.':</strong>'; |
|
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
|
|
my @options= ( ['active', 'Show to student'], |
my @options= ( ['active', 'Show to student'], |
['onlyone','Student may select only one choice'], |
['onlyone','Student may select only one choice'], |
['stuadd', 'Student may type choices']); |
['stuadd', 'Student may type choices']); |
foreach my $opt (@options) { |
if ($added_flag) { |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
push @options,['deleted', 'Delete Metadata Field']; |
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
} |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
foreach my $opt (@options) { |
&mt($opt->[1]).'</label> <br />'; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
|
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
|
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label> <br />'; |
|
} |
} |
} |
return ($output); |
return ($output); |
} |
} |
|
sub addmetafield { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if (exists($env{'form.undelete'})) { |
|
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undelete'); |
|
foreach my $meta_field(@meta_fields) { |
|
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
|
$options =~ s/deleted//; |
|
$options =~ s/,,/,/; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
|
|
|
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
|
} |
|
$r->print('<form action="" method="post">'); |
|
$r->print('<input type="hidden" name="action" value="setrestrictmeta" />'); |
|
$r->print('<input type="submit" value="Continue" />'); |
|
} elsif (exists($env{'form.fieldname'})) { |
|
my $meta_field = $env{'form.fieldname'}; |
|
my $display_field = $env{'form.fieldname'}; |
|
$meta_field =~ s/\W/_/g; |
|
$meta_field =~ tr/A-Z/a-z/; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.values'=>"", |
|
'metadata.'.$meta_field.'.added'=>"$display_field", |
|
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
|
$r->print('Added new Metadata Field '.$env{'form.fieldname'}." with result ".$put_result); |
|
} else { |
|
my $fields = &get_deleted_meta_fieldnames(); |
|
if ($fields) { |
|
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
|
$r->print('<form method="post" action="">'); |
|
foreach my $key(keys(%$fields)) { |
|
$r->print('<input type="checkbox" name="undelete" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
|
} |
|
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
|
$r->print('</form>'); |
|
} |
|
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
|
$r->print('<input type="text" name="fieldname" /><br />'); |
|
$r->print('<input type="submit" value="Add Metadata Field" />'); |
|
$r->print('</form>'); |
|
} |
|
} |
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
$r->print(&Apache::lonxml::xmlbegin()); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print('<head> |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
<title>LON-CAPA Restrict Metadata</title> |
|
</head>'); |
|
$r->print(&Apache::loncommon::bodytag('Restrict Metadata')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Restrict Metadata')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
Line 3087 sub setrestrictmeta {
|
Line 3291 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
$options.='active,'; |
$options.='active,'; |
} |
} |
|
if ($env{'form.'.$meta_field.'_deleted'}) { |
|
$options.='deleted,'; |
|
} |
|
|
my $name = $save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options, |
{'metadata.'.$meta_field.'.options'=>$options, |
Line 3096 sub setrestrictmeta {
|
Line 3304 sub setrestrictmeta {
|
} |
} |
} |
} |
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
|
{'freshen_cache' => 1}); |
|
# Get the default metadata fields |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
|
# Now get possible added metadata fields |
|
my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
&Apache::lonnet::logthis ($field); |
|
if ($field ne 'courserestricted') { |
if ($field ne 'courserestricted') { |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
} |
} |
|
my $added_flag = 1; |
|
foreach my $field (sort(keys(%$added_metadata_fields))) { |
|
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag); |
|
} |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<p> |
<p> |
$output |
$output |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
|
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field"> |
</form> |
</form> |
ENDenv |
ENDenv |
$r->print('</body> |
$r->print(&Apache::loncommon::end_page()); |
</html>'); |
|
return 'ok'; |
return 'ok'; |
} |
} |
################################################## |
################################################## |
|
sub get_added_meta_fieldnames { |
|
my %fields; |
|
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
|
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
|
my $field_name = $1; |
|
my ($display_field_name) = $env{$key}; |
|
$fields{$field_name} = $display_field_name; |
|
} |
|
} |
|
return \%fields; |
|
} |
|
sub get_deleted_meta_fieldnames { |
|
my %fields; |
|
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
|
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
|
my $field_name = $1; |
|
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
|
my ($display_field_name) = $env{$key}; |
|
$fields{$field_name} = $display_field_name; |
|
} |
|
} |
|
} |
|
return \%fields; |
|
} |
sub defaultsetter { |
sub defaultsetter { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $start_page = |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDDEFHEAD); |
$r->print(<<ENDDEFHEAD); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
ENDDEFHEAD |
ENDDEFHEAD |
|
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
my %keyp=(); |
my %keyp=(); |
Line 3213 ENDDEFHEAD
|
Line 3453 ENDDEFHEAD
|
} |
} |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
$r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'. |
$r->print("\n".&Apache::loncommon::start_data_table(). |
&mt('Action').'</th><th>'.&mt('Value').'</th></tr>'); |
&Apache::loncommon::start_data_table_header_row(). |
|
"<th>".&mt('Rule for parameter').'</th><th>'. |
|
&mt('Action').'</th><th>'.&mt('Value').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row()); |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
unless ($tempkey) { next; } |
unless ($tempkey) { next; } |
$r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
$r->print("\n".&Apache::loncommon::start_data_table_row(). |
|
"<td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
my $action=&rulescache($tempkey.'_action'); |
my $action=&rulescache($tempkey.'_action'); |
$r->print('<select name="'.$tempkey.'_action">'); |
$r->print('<select name="'.$tempkey.'_action">'); |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
Line 3266 ENDYESNO
|
Line 3510 ENDYESNO
|
} else { |
} else { |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
} |
} |
$r->print('</td></tr>'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print("</table>\n<input type='submit' name='storerules' value='". |
$r->print(&Apache::loncommon::end_data_table(). |
&mt('Store Rules')."' /></form>\n</body>\n</html>"); |
"\n<input type='submit' name='storerules' value='". |
|
&mt('Store Rules')."' /></form>\n". |
|
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
|
sub components { |
|
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
|
|
|
if ($typeflag) { |
|
$key=~s/\.type$//; |
|
} |
|
|
|
my ($middle,$part,$name)= |
|
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
my $issection; |
|
|
|
my $section=&mt('All Students'); |
|
if ($middle=~/^\[(.*)\]/) { |
|
$issection=$1; |
|
$section=&mt('Group/Section').': '.$issection; |
|
$middle=~s/^\[(.*)\]//; |
|
} |
|
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
|
if ($uname) { |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
|
$issection=''; |
|
} |
|
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
|
my $realmdescription=&mt('all resources'); |
|
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
|
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
|
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
|
} elsif ($middle) { |
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
|
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
|
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
|
} |
|
my $what=$part.'.'.$name; |
|
return ($realm,$section,$name,$part, |
|
$what,$middle,$uname,$udom,$issection,$realmdescription); |
|
} |
|
|
|
my %standard_parms; |
|
sub load_parameter_names { |
|
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
|
while (my $configline=<$config>) { |
|
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
|
chomp($configline); |
|
my ($short,$plain)=split(/:/,$configline); |
|
my (undef,$name,$type)=split(/\&/,$short,3); |
|
if ($type eq 'display') { |
|
$standard_parms{$name} = $plain; |
|
} |
|
} |
|
close($config); |
|
$standard_parms{'int_pos'} = 'Positive Integer'; |
|
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
|
%standard_parms=&Apache::lonlocal::texthash(%standard_parms); |
|
} |
|
|
|
sub standard_parameter_names { |
|
my ($name)=@_; |
|
if (!%standard_parms) { |
|
&load_parameter_names(); |
|
} |
|
if ($standard_parms{$name}) { |
|
return $standard_parms{$name}; |
|
} else { |
|
return $name; |
|
} |
|
} |
|
|
|
# |
|
# Parameter Change Log |
|
# |
|
|
|
|
|
sub parm_change_log { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
|
|
|
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
|
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
|
|
|
$r->print('<form action="/adm/parmset?action=parameterchangelog" |
|
method="post" name="parameterlog">'); |
|
|
|
my %saveable_parameters = ('show' => 'scalar',); |
|
&Apache::loncommon::store_course_settings('parameter_log', |
|
\%saveable_parameters); |
|
&Apache::loncommon::restore_course_settings('parameter_log', |
|
\%saveable_parameters); |
|
if (!$env{'form.show'}) { $env{'form.show'}=10; } |
|
|
|
my $countselect = |
|
&Apache::lonmeta::selectbox('show',$env{'form.show'},undef, |
|
(&mt('all'),10,20,50,100,1000,10000)); |
|
|
|
$r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'. |
|
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
|
' '.&mt('Include parameter types').'</label>'. |
|
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
|
|
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
|
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row()); |
|
my $shown=0; |
|
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
|
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
|
my $count = 0; |
|
my $time = |
|
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
|
my $plainname = |
|
&Apache::loncommon::plainname($parmlog{$id}{'exe_uname'}, |
|
$parmlog{$id}{'exe_udom'}); |
|
my $about_me_link = |
|
&Apache::loncommon::aboutmewrapper($plainname, |
|
$parmlog{$id}{'exe_uname'}, |
|
$parmlog{$id}{'exe_udom'}); |
|
my $send_msg_link=''; |
|
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
|
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
|
$send_msg_link ='<br />'. |
|
&Apache::loncommon::messagewrapper(&mt('Send message'), |
|
$parmlog{$id}{'exe_uname'}, |
|
$parmlog{$id}{'exe_udom'}); |
|
} |
|
my $row_start=&Apache::loncommon::start_data_table_row(); |
|
$r->print($row_start); |
|
my $makenewrow=0; |
|
my %istype=(); |
|
my $output; |
|
foreach my $changed (reverse(sort(@changes))) { |
|
my $value=$parmlog{$id}{'logentry'}{$changed}; |
|
my $typeflag = ($changed =~/\.type$/ && |
|
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
|
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
|
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
|
if ($typeflag) { |
|
$istype{$parmname}=$value; |
|
if (!$env{'form.includetypes'}) { next; } |
|
} |
|
$count++; |
|
if ($makenewrow) { |
|
$output .= $row_start; |
|
} else { |
|
$makenewrow=1; |
|
} |
|
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
|
&standard_parameter_names($parmname).'</td><td>'. |
|
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
|
my $stillactive=0; |
|
if ($parmlog{$id}{'delflag'}) { |
|
$output .= &mt('Deleted'); |
|
} else { |
|
if ($typeflag) { |
|
$output .= &mt('Type: [_1]',&standard_parameter_names($value)); |
|
} else { |
|
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
|
$uname,$udom,$issection,$issection,$courseopt); |
|
if (&isdateparm($istype{$parmname})) { |
|
$output .= &Apache::lonlocal::locallocaltime($value); |
|
} else { |
|
$output .= $value; |
|
} |
|
if ($value ne $all[$level]) { |
|
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
|
} else { |
|
$stillactive=1; |
|
} |
|
} |
|
} |
|
$output .= '</td><td>'; |
|
if ($stillactive) { |
|
my $title=&mt('Changed [_1]',&standard_parameter_names($parmname)); |
|
my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription, |
|
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
|
if (($uname) && ($udom)) { |
|
$output .= |
|
&Apache::loncommon::messagewrapper('Notify User', |
|
$uname,$udom,$title, |
|
$description); |
|
} else { |
|
$output .= |
|
&Apache::lonrss::course_blog_link($id,$title, |
|
$description); |
|
} |
|
} |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
|
$r->print('<td rowspan="'.$count.'">'.$time.'</td> |
|
<td rowspan="'.$count.'">'.$about_me_link. |
|
'<br /><tt>'.$parmlog{$id}{'exe_uname'}. |
|
':'.$parmlog{$id}{'exe_udom'}.'</tt>'. |
|
$send_msg_link.'</td>'.$output); |
|
|
|
$shown++; |
|
if (!($env{'form.show'} eq &mt('all') |
|
|| $shown<=$env{'form.show'})) { last; } |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 3308 sub handler {
|
Line 3761 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
text=>"Parameter Manager", |
text=>"Parameter Manager", |
faq=>10, |
faq=>10, |
bug=>'Instructor Interface'}); |
bug=>'Instructor Interface', |
|
help => 'Parameter_Manager'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my $parm_permission = |
my $parm_permission = |
Line 3333 sub handler {
|
Line 3787 sub handler {
|
# the table mode |
# the table mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
|
text=>"Problem Parameters"}); |
&assessparms($r); |
&assessparms($r); |
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
'Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
Line 3348 sub handler {
|
Line 3803 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
&overview($r); |
&overview($r); |
|
} elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
Line 3365 sub handler {
|
Line 3824 sub handler {
|
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |
&assessparms($r); |
&assessparms($r); |
} |
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log"}); |
|
&parm_change_log($r); |
|
} elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
|
text=>"Clean Parameters"}); |
|
&clean_parameters($r); |
|
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |