--- loncom/interface/lonparmset.pm 2016/10/25 18:54:48 1.522.2.19
+++ loncom/interface/lonparmset.pm 2013/04/08 23:21:15 1.531
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.522.2.19 2016/10/25 18:54:48 raeburn Exp $
+# $Id: lonparmset.pm,v 1.531 2013/04/08 23:21:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,6 +46,8 @@ This module sets coursewide and assessme
=over
+=pod
+
=item parmval()
Figure out a cascading parameter.
@@ -137,21 +139,15 @@ javascript function 'pjump'.
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.
-Input: See list below
-
-=over 4
+Input: See list below:
=item * B : Current username
=item * B : Domain of current user.
-=item * B : Course
-
-=back
-
-Outputs: See list below
+=item * b (out) : An array that will contain all of the ids in the course.
@@ -177,8 +173,6 @@ Outputs: See list below
=item * B
-=back
-
=item isdateparm()
=item parmmenu()
@@ -216,8 +210,6 @@ Returns: nothing
Variables used (guessed by Jeremy):
-=over
-
=item * B: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
=item * B: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
@@ -230,8 +222,6 @@ Variables used (guessed by Jeremy):
When storing information, store as part 0
When requesting information, request from full part
-=back
-
=item tablestart()
=item tableend()
@@ -298,6 +288,7 @@ Set portfolio metadata
Main handler. Calls &assessparms subroutine.
+
=back
=cut
@@ -323,6 +314,31 @@ use HTML::Entities;
use LONCAPA qw(:DEFAULT :match);
+sub startSettingsScreen {
+ my ($r,$mode,$crstype)=@_;
+
+ my $tabtext = &mt('Course Settings');
+ if ($crstype eq 'Community') {
+ $tabtext = &mt('Community Settings');
+ }
+ $r->print("\n".'');
+ $r->print("\n".' '.
+ $tabtext.
+ ' ');
+
+ $r->print("\n".''.
+ &mt('Content and Problem Settings').' ');
+ $r->print("\n".' '."\n");
+ $r->print('');
+}
+
+sub endSettingsScreen {
+ my ($r)=@_;
+ $r->print('
');
+}
+
+
+
sub parmval {
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,
@@ -760,7 +776,7 @@ sub valout {
$result =
' ';
+ .' title="'.&mt('Change').'" />';
} else {
$result=' ';
}
@@ -878,7 +894,9 @@ sub page_js {
var newWin = window.open(url, wdwName, options);
newWin.focus();
}
+
// ]]>
+
$selscript
ENDJS
@@ -906,7 +924,7 @@ COURSECONTENTSCRIPT
}
sub startpage {
- my ($r,$psymb) = @_;
+ my ($r,$psymb,$crstype) = @_;
my %loaditems = (
'onload' => "group_or_section('cgroup')",
@@ -933,13 +951,14 @@ sub startpage {
';
my $start_page =
- &Apache::loncommon::start_page('Set/Modify Course Parameters',$js,
- {'add_entries' => \%loaditems,});
+ &Apache::loncommon::start_page('Set/Modify Course Parameters',$js,
+ {'add_entries' => \%loaditems,});
my $breadcrumbs =
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'});
$r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(<
@@ -954,8 +973,7 @@ ENDHEAD
sub print_row {
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone,
- $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp,
- $readonly)=@_;
+ $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_;
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
@@ -1000,24 +1018,24 @@ sub print_row {
if ($parmlev eq 'general') {
if ($uname) {
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} elsif ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} else {
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
}
} elsif ($parmlev eq 'map') {
if ($uname) {
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} elsif ($csec) {
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
} else {
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
}
} else {
if ($uname) {
@@ -1039,30 +1057,30 @@ sub print_row {
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
if ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
}
if ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly));
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly));
- &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly));
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
}
if ($uname) {
if ($othergrp) {
$r->print($othergrp);
}
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
}
} # end of $parmlev if/else
@@ -1082,23 +1100,15 @@ sub print_row {
}
sub print_td {
- my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_;
+ my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
$r->print('');
my $nolink = 0;
- if ($readonly) {
+ if ($which == 11 || $which == 12) {
$nolink = 1;
- } else {
- if ($which == 11 || $which == 12) {
+ } elsif ($mprefix =~ /availablestudent\&$/) {
+ if ($which > 3) {
$nolink = 1;
- } elsif ($mprefix =~ /availablestudent\&$/) {
- if ($which > 3) {
- $nolink = 1;
- }
- } elsif ($mprefix =~ /examcode\&$/) {
- unless ($which == 2) {
- $nolink = 1;
- }
}
}
if ($nolink) {
@@ -1253,7 +1263,7 @@ sub extractResourceInformation {
$$mapp{$mapid}=$$mapp{$id};
$$allmaps{$mapid}=$$mapp{$id};
if ($mapid eq '1') {
- $$maptitles{$mapid}=&mt('Main Content');
+ $$maptitles{$mapid}=&mt('Main Course Documents');
} else {
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id});
}
@@ -1387,8 +1397,8 @@ sub lookUpTableParameter {
'contentopen' => 'time_settings',
'contentclose' => 'time_settings',
'discussend' => 'time_settings',
- 'printstartdate' => 'time_settings',
- 'printenddate' => 'time_settings',
+ 'printopendate' => 'time_settings',
+ 'printclosedate' => 'time_settings',
'weight' => 'grading',
'handgrade' => 'grading',
'maxtries' => 'tries',
@@ -1423,7 +1433,7 @@ sub lookUpTableParameter {
'lenient' => 'grading',
'retrypartial' => 'tries',
'discussvote' => 'misc',
- 'examcode' => 'high_level_randomization',
+
);
}
@@ -1500,23 +1510,26 @@ sub parmboxes {
#Print parameters
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
- next if(@{$categoryList{$key}} == 0);
- $r->print('\n");
}
$r->print("\n");
@@ -1684,13 +1697,13 @@ function group_or_section(caller) {
# This function shows on table Mode the available Parameters for the selected Resources
#
sub displaymenu {
- my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_;
+ my ($r,$allparms,$pscat,$psprt,$keyorder)=@_;
$r->print(&Apache::lonhtmlcommon::start_pick_box());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
&parmmenu($r,$allparms,$pscat,$keyorder);
- $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid));
+ $r->print(&Apache::loncommon::start_scrollbox());
&parmboxes($r,$allparms,$pscat,$keyorder);
$r->print(&Apache::loncommon::end_scrollbox());
@@ -1764,7 +1777,7 @@ sub mapmenu {
.''
);
- $r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll'));
+ $r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll'));
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));
# Display row: "All Maps or Folders"
@@ -1783,7 +1796,7 @@ sub mapmenu {
.&Apache::loncommon::end_data_table_row()
);
- # Display row: "Main Content"
+ # Display row: "Main Course Documents"
if (exists($$allmaps{1})) {
$r->print(
&Apache::loncommon::start_data_table_row()
@@ -1975,14 +1988,15 @@ sub standardkeyorder {
'parameter_0_discussend' => 19,
'parameter_0_discusshide' => 20,
'parameter_0_discussvote' => 21,
- 'parameter_0_printstartdate' => 22,
- 'parameter_0_printenddate' => 23);
+ 'parameter_0_printopendate' => 22,
+ 'parameter_0_printclosedate' => 23);
}
sub assessparms {
- my ($r,$parm_permission) = @_;
+ my $r=shift;
+
# -------------------------------------------------------- Variable declaration
@@ -2040,7 +2054,7 @@ sub assessparms {
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt');
- if (!@psprt) { $psprt[0]='0'; }
+ if (!@psprt) { $psprt[0]='all'; }
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; }
my $pssymb='';
@@ -2133,7 +2147,7 @@ sub assessparms {
$symbp{'0.0'} = '';
# ---------------------------------------------------------- Anything to store?
- if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) {
+ if ($env{'form.pres_marker'}) {
my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
my @values=split(/\&\&\&/,$env{'form.pres_value'});
my @types=split(/\&\&\&/,$env{'form.pres_type'});
@@ -2142,7 +2156,7 @@ sub assessparms {
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
my ($got_chostname,$chostname,$cmajor,$cminor);
my $totalstored = 0;
- my $now = time;
+
for (my $i=0;$i<=$#markers;$i++) {
my ($needsrelease,$needsnewer,$name);
@@ -2176,35 +2190,18 @@ sub assessparms {
}
}
}
- } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate)\&\d+$/) {
+ } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote)\&\d+$/) {
$name = $1;
- my $val = $values[$i];
- if ($name eq 'examcode') {
- if (&Apache::lonnet::validCODE($values[$i])) {
- $val = 'valid';
- }
- } elsif ($name eq 'printstartdate') {
- if ($val =~ /^\d+$/) {
- if ($val > $now) {
- $val = 'future';
- }
- }
- } elsif ($name eq 'printenddate') {
- if ($val =~ /^\d+$/) {
- if ($val < $now) {
- $val = 'past';
- }
- }
- }
$needsrelease =
- $Apache::lonnet::needsrelease{"parameter:$name:$val"};
+ $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"};
if ($needsrelease) {
unless ($got_chostname) {
($chostname,$cmajor,$cminor) = ¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = ¶meter_releasecheck($name,$val,
+ $needsnewer = ¶meter_releasecheck($name,$values[$i],
$needsrelease,
+ $chostname,
$cmajor,$cminor);
}
}
@@ -2233,7 +2230,8 @@ sub assessparms {
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
# ------------------------------------------------------------------ Start page
- &startpage($r,$pssymb);
+ my $crstype = &Apache::loncommon::course_type();
+ &startpage($r,$pssymb,$crstype);
foreach ('tolerance','date_default','date_start','date_end',
'date_interval','int','float','string') {
@@ -2285,7 +2283,7 @@ ENDPARMSELSCRIPT
# Step 2
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
- &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
+ &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);
# Step 3
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
@@ -2313,7 +2311,6 @@ ENDPARMSELSCRIPT
.''
.'');
} else {
- $r->print();
# parameter screen for a single resource.
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb);
my $title = &Apache::lonnet::gettitle($pssymb);
@@ -2323,12 +2320,6 @@ ENDPARMSELSCRIPT
' ');
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)')));
$r->print(&Apache::lonhtmlcommon::start_pick_box());
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')).
- ''.
- ' '.
- &mt('Show all parts').
- ' ');
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups);
$r->print(&Apache::lonhtmlcommon::row_closure(1));
$r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -2358,10 +2349,6 @@ ENDPARMSELSCRIPT
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat;
my $csuname=$env{'user.name'};
my $csudom=$env{'user.domain'};
- my $readonly = 1;
- if ($parm_permission->{'edit'}) {
- undef($readonly);
- }
if ($parmlev eq 'full') {
#
@@ -2447,9 +2434,8 @@ ENDTABLEHEADFOUR
my $defbgtwo='';
my $defbgthree = '';
- foreach (@ids) {
+ foreach my $rid (@ids) {
- my $rid=$_;
my ($inmapid)=($rid=~/\.(\d+)$/);
if ((!$pssymb &&
@@ -2547,7 +2533,7 @@ ENDTABLEHEADFOUR
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$defbgthree,$parmlev,$uname,$udom,$csec,
- $cgroup,\@usersgroups,$noeditgrp,$readonly);
+ $cgroup,\@usersgroups);
}
}
}
@@ -2670,8 +2656,7 @@ ENDTABLEHEADFOUR
$r->print(&Apache::loncommon::start_data_table_row());
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
- $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp,
- $readonly);
+ $parmlev,$uname,$udom,$csec,$cgroup);
}
$r->print(&Apache::loncommon::end_data_table().'
'
.''
@@ -2761,9 +2746,8 @@ ENDMAPONE
foreach (&keysinorder(\%name,\%keyorder)) {
$r->print(&Apache::loncommon::start_data_table_row());
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
- \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
- $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp,
- $readonly);
+ \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
+ $parmlev,$uname,$udom,$csec,$cgroup);
}
$r->print(&Apache::loncommon::end_data_table()
.''
@@ -2772,6 +2756,7 @@ ENDMAPONE
} # end of $parmlev eq general
}
$r->print('');
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
} # end sub assessparms
@@ -2781,19 +2766,12 @@ ENDMAPONE
my $tableopen;
sub tablestart {
- my ($readonly) = @_;
if ($tableopen) {
- return '';
+ return '';
} else {
- $tableopen=1;
- my $output = &Apache::loncommon::start_data_table().''.&mt('Parameter').' ';
- if ($readonly) {
- $output .= ''.&mt('Current value').' ';
- } else {
- $output .= ''.&mt('Delete').' '.&mt('Set to ...').' ';
- }
- $output .= ' ';
- return $output;
+ $tableopen=1;
+ return &Apache::loncommon::start_data_table().''.&mt('Parameter').' '.
+ &mt('Delete').' '.&mt('Set to ...').' ';
}
}
@@ -2826,11 +2804,7 @@ sub readdata {
}
}
}
- if (wantarray) {
- return ($resourcedata,$classlist);
- } else {
- return $resourcedata;
- }
+ return $resourcedata;
}
@@ -2846,7 +2820,6 @@ sub storedata {
my @deldata=();
undef @deldata;
my ($got_chostname,$chostname,$cmajor,$cminor);
- my $now = time;
foreach my $key (keys(%env)) {
if ($key =~ /^form\.([a-z]+)\_(.+)$/) {
my $cmd=$1;
@@ -2857,10 +2830,9 @@ sub storedata {
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
}
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {
- my ($data, $typeof, $text, $name, $valchk);
+ my ($data, $typeof, $text, $name);
if ($cmd eq 'set') {
$data=$env{$key};
- $valchk = $data;
$typeof=$env{'form.typeof_'.$thiskey};
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
@@ -2869,51 +2841,24 @@ sub storedata {
$name = 'lenient';
} elsif ($typeof eq 'string_discussvote') {
$name = 'discussvote';
- } elsif ($typeof eq 'string_examcode') {
- $name = 'examcode';
- if (&Apache::lonnet::validCODE($data)) {
- $valchk = 'valid';
- }
} elsif ($typeof eq 'string_yesno') {
if ($thiskey =~ /\.retrypartial$/) {
$name = 'retrypartial';
}
}
- } elsif ($cmd eq 'datepointer') {
- $data=&Apache::lonhtmlcommon::get_date_from_form($env{$key});
- $typeof=$env{'form.typeof_'.$thiskey};
- $text = &mt('Saved modified date for');
- if ($typeof eq 'date_start') {
- if ($thiskey =~ /\.printstartdate$/) {
- $name = 'printstartdate';
- if (($data) && ($data > $now)) {
- $valchk = 'future';
- }
- }
- } elsif ($typeof eq 'date_end') {
- if ($thiskey =~ /\.printenddate$/) {
- $name = 'printenddate';
- if (($data) && ($data < $now)) {
- $valchk = 'past';
+ if ($name ne '') {
+ my ($needsrelease,$needsnewer);
+ $needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"};
+ if ($needsrelease) {
+ unless ($got_chostname) {
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
+ $got_chostname = 1;
}
+ $needsnewer = ¶meter_releasecheck($name,$data,
+ $needsrelease,
+ $chostname,$cmajor,
+ $cminor);
}
- }
- } elsif ($cmd eq 'dateinterval') {
- $data=&get_date_interval_from_form($thiskey);
- $typeof=$env{'form.typeof_'.$thiskey};
- $text = &mt('Saved modified date for');
- }
- if ($name ne '') {
- my ($needsrelease,$needsnewer);
- $needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$valchk"};
- if ($needsrelease) {
- unless ($got_chostname) {
- ($chostname,$cmajor,$cminor)=¶meter_release_vars();
- $got_chostname = 1;
- }
- $needsnewer = ¶meter_releasecheck($name,$valchk,
- $needsrelease,
- $cmajor,$cminor);
if ($needsnewer) {
$r->print(' '.&oldversion_warning($name,$data,
$chostname,$cmajor,
@@ -2921,6 +2866,14 @@ sub storedata {
next;
}
}
+ } elsif ($cmd eq 'datepointer') {
+ $data=&Apache::lonhtmlcommon::get_date_from_form($env{$key});
+ $typeof=$env{'form.typeof_'.$thiskey};
+ $text = &mt('Saved modified date for');
+ } elsif ($cmd eq 'dateinterval') {
+ $data=&get_date_interval_from_form($thiskey);
+ $typeof=$env{'form.typeof_'.$thiskey};
+ $text = &mt('Saved modified date for');
}
if (defined($data) and $$olddata{$thiskey} ne $data) {
if ($tuname) {
@@ -2964,7 +2917,7 @@ sub storedata {
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') {
my %loghash=map { $_ => '' } @deldata;
&log_parmset(\%loghash,1);
- $r->print(''.&mt('Deleted [quant,_1,parameter]',$delentries/2).' ');
+ $r->print(''.&mt('Deleted [_1] parameter(s)',$delentries).' ');
} else {
$r->print(''.
&mt('Error deleting parameters').'
');
@@ -2974,7 +2927,7 @@ sub storedata {
if ($putentries) {
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
&log_parmset(\%newdata,0);
- $r->print(''.&mt('Saved [quant,_1,parameter]',$putentries/2).' ');
+ $r->print(''.&mt('Saved [_1] parameter(s)',$putentries/2).' ');
} else {
$r->print(''.
&mt('Error saving parameters').'
');
@@ -3009,7 +2962,7 @@ sub parse_listdata_key {
}
sub listdata {
- my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_;
+ my ($r,$resourcedata,$listdata,$sortorder)=@_;
# Start list output
my $oldsection='';
@@ -3119,48 +3072,36 @@ sub listdata {
# Ready to print
#
my $parmitem = &standard_parameter_names($name);
- $r->print(&tablestart($readonly).
+ $r->print(&tablestart().
&Apache::loncommon::start_data_table_row().
''.&mt($parmitem).
- ' ');
- unless ($readonly) {
- $r->print(' ');
- }
- $r->print('');
+ ' ');
$foundkeys++;
if (&isdateparm($thistype)) {
- my $jskey='key_'.$pointer;
- my $state;
- $pointer++;
- if ($readonly) {
- $state = 'disabled';
- }
- $r->print(
- &Apache::lonhtmlcommon::date_setter('parmform',
- $jskey,
- $$resourcedata{$thiskey},
- '',1,$state));
- unless ($readonly) {
- $r->print(
+ my $jskey='key_'.$pointer;
+ $pointer++;
+ $r->print(
+ &Apache::lonhtmlcommon::date_setter('parmform',
+ $jskey,
+ $$resourcedata{$thiskey},
+ '',1,'','').
' '.
(($$resourcedata{$thiskey}!=0)?''.
&mt('Shift all dates based on this date').' ':'').
&date_sanity_info($$resourcedata{$thiskey})
);
- }
} elsif ($thistype eq 'date_interval') {
- $r->print(&date_interval_selector($thiskey,
- $$resourcedata{$thiskey},$readonly));
+ $r->print(&date_interval_selector($thiskey,
+ $$resourcedata{$thiskey}));
} elsif ($thistype =~ m/^string/) {
- $r->print(&string_selector($thistype,$thiskey,
- $$resourcedata{$thiskey},$name,$readonly));
+ $r->print(&string_selector($thistype,$thiskey,
+ $$resourcedata{$thiskey},$name));
} else {
- $r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly));
+ $r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
- unless ($readonly) {
- $r->print(' ');
+ $r->print(' ');
$r->print(' '.&Apache::loncommon::end_data_table_row());
}
}
@@ -3169,7 +3110,7 @@ sub listdata {
sub date_interval_selector {
- my ($thiskey, $showval, $readonly) = @_;
+ my ($thiskey, $showval) = @_;
my $result;
foreach my $which (['days', 86400, 31],
['hours', 3600, 23],
@@ -3181,12 +3122,10 @@ sub date_interval_selector {
my %select = ((map {$_ => $_} (0..$max)),
'select_form_order' => [0..$max]);
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
- \%select,'',$readonly);
+ \%select);
$result .= ' '.&mt($name);
}
- unless ($readonly) {
- $result .= ' ';
- }
+ $result .= ' ';
return $result;
}
@@ -3208,12 +3147,8 @@ sub get_date_interval_from_form {
sub default_selector {
- my ($thiskey, $showval, $readonly) = @_;
- my $disabled;
- if ($readonly) {
- $disabled = ' disabled="disabled"';
- }
- return ' ';
+ my ($thiskey, $showval) = @_;
+ return ' ';
}
my %strings =
@@ -3230,7 +3165,7 @@ my %strings =
=> [[ 'problem', 'Standard Problem'],
[ 'survey', 'Survey'],
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'],
- [ 'exam', 'Exam'],
+ [ 'exam', 'Bubblesheet Exam'],
[ 'anonsurvey', 'Anonymous Survey'],
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'],
[ 'practice', 'Practice'],
@@ -3254,10 +3189,10 @@ sub standard_string_options {
}
sub string_selector {
- my ($thistype, $thiskey, $showval, $name, $readonly) = @_;
+ my ($thistype, $thiskey, $showval, $name) = @_;
if (!exists($strings{$thistype})) {
- return &default_selector($thiskey,$showval,$readonly);
+ return &default_selector($thiskey,$showval);
}
my %skiptype;
@@ -3276,19 +3211,17 @@ sub string_selector {
$got_chostname = 1;
}
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease,
- $cmajor,$cminor);
+ $chostname,$cmajor,
+ $cminor);
if ($needsnewer) {
$skiptype{$parmval} = 1;
}
}
}
}
-
- my ($result,$disabled);
+
- if ($readonly) {
- $disabled = ' disabled="disabled"';
- }
+ my $result;
my $numinrow = 3;
if ($thistype eq 'string_problemstatus') {
$numinrow = 2;
@@ -3314,7 +3247,7 @@ sub string_selector {
$result .= ''.
''.
' {'edit'}) {
- undef($readonly);
- }
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
@@ -3400,6 +3330,7 @@ sub newoverview {
{'add_entries' => \%loaditems,});
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(<
ENDOVER
@@ -3428,7 +3359,7 @@ ENDOVER
my $pschp=$env{'form.pschp'};
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt');
- if (!@psprt) { $psprt[0]='0'; }
+ if (!@psprt) { $psprt[0]='all'; }
my @selected_sections =
&Apache::loncommon::get_env_multiple('form.Section');
@@ -3520,13 +3451,12 @@ ENDOVER
# List data
- &listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly);
+ &listdata($r,$resourcedata,$listdata,$sortorder);
}
- $r->print(&tableend());
- unless ($readonly) {
- $r->print(((($env{'form.store'}) || ($env{'form.dis'}))?'
':''));
- }
- $r->print('');
+ $r->print(&tableend().
+ ((($env{'form.store'}) || ($env{'form.dis'}))?'
':'').
+ '');
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
}
@@ -3566,54 +3496,39 @@ sub secgroup_lister {
}
sub overview {
- my ($r,$parm_permission) = @_;
+ my ($r) = @_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $readonly = 1;
- if ($parm_permission->{'edit'}) {
- undef($readonly);
- }
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
my $start_page=&Apache::loncommon::start_page('Modify Parameters');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(''.&Apache::loncommon::end_page());
+ $r->print(&tableend().''.
+ ($foundkeys?' ':''.&mt('There are no parameters.').' ').'
'.
+ &Apache::loncommon::end_page());
}
sub clean_parameters {
@@ -3689,8 +3604,8 @@ ENDOVER
my ($map,$resid,$url) =
&Apache::lonnet::decode_symb($data{'realm'});
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]',
- $url.' ',
- $resid.' ',$map));
+ $url.' ',
+ $resid.' ',$map));
}
$r->print(' '.&mt('Part: [_1]',$data{'parameter_part'}));
$r->print(' ');
@@ -3700,6 +3615,7 @@ ENDOVER
$r->print(&Apache::loncommon::end_data_table().''.
' '.
'
');
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
}
@@ -3707,17 +3623,20 @@ sub date_shift_one {
my ($r) = @_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
text=>"Shifting Dates"});
my $start_page=&Apache::loncommon::start_page('Shift Dates');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
$r->print($start_page.$breadcrumbs);
- $r->print('');
+ &endSettingsScreen($r);
}
@@ -4147,6 +4033,8 @@ sub setrestrictmeta {
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+ &startSettingsScreen($r,'parmset',$crstype);
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
my $save_field = '';
if ($env{'form.restrictmeta'}) {
@@ -4217,6 +4105,7 @@ ENDButtons
$buttons
ENDenv
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
return 'ok';
}
@@ -4257,14 +4146,16 @@ sub defaultsetter {
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
text=>"Set Defaults"});
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
my $start_page =
- &Apache::loncommon::start_page('Parameter Setting Default Actions');
+ &Apache::loncommon::start_page('Parameter Setting Default Actions');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');
$r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print('');
- my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
my @ids=();
my %typep=();
my %keyp=();
@@ -4318,8 +4209,8 @@ sub defaultsetter {
foreach my $key (keys %allparms) {
$newrules{$key.'_triggers'}=$triggers{$key};
}
- &Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs);
- &Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs);
+ &Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum);
+ &Apache::lonnet::del('parmdefactions',\@delrules,$cdom,$cnum);
&resetrulescache();
}
my %lt=&Apache::lonlocal::texthash('days' => 'Days',
@@ -4407,6 +4298,7 @@ ENDYESNO
$r->print(&Apache::loncommon::end_data_table().
"\n".' '."\n");
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
return;
}
@@ -4494,7 +4386,10 @@ sub standard_parameter_types {
}
sub parm_change_log {
- my ($r,$parm_permission)=@_;
+ my ($r)=@_;
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
text=>"Parameter Change Log"});
my $js = ''."\n";
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js));
$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'});
+ &startSettingsScreen($r,'parmset',$crstype);
+ my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',$cdom,$cnum);
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); }
@@ -4523,19 +4417,12 @@ sub parm_change_log {
$r->print(&Apache::loncommon::display_filter('parmslog').' '."\n".
' '.
' ');
- my $readonly = 1;
- if ($parm_permission->{'edit'}) {
- undef($readonly);
- }
- my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'},
- $env{'course.'.$env{'request.course.id'}.'.domain'});
+
+ my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
''.&mt('Time').' '.&mt('User').' '.&mt('Extent').' '.&mt('Users').' '.
- &mt('Parameter').' '.&mt('Part').' '.&mt('New Value').' ');
- unless ($readonly) {
- $r->print(''.&mt('Announce').' ');
- }
- $r->print(&Apache::loncommon::end_data_table_header_row());
+ &mt('Parameter').''.&mt('Part').' '.&mt('New Value').' '.&mt('Announce').' '.
+ &Apache::loncommon::end_data_table_header_row());
my $shown=0;
my $folder='';
if ($env{'form.displayfilter'} eq 'currentfolder') {
@@ -4568,8 +4455,7 @@ sub parm_change_log {
$parmlog{$id}{'exe_uname'},
$parmlog{$id}{'exe_udom'});
my $send_msg_link='';
- if ((!$readonly) &&
- (($parmlog{$id}{'exe_uname'} ne $env{'user.name'})
+ if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'})
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) {
$send_msg_link =' '.
&Apache::loncommon::messagewrapper(&mt('Send message'),
@@ -4639,31 +4525,27 @@ sub parm_change_log {
}
}
}
- $output .= '';
-
- unless ($readonly) {
- $output .= '';
- if ($stillactive) {
- my $parmitem = &standard_parameter_names($parmname);
- $parmitem = &mt($parmitem);
- my $title=&mt('Changed [_1]',$parmitem);
- my $description=&mt('Changed [_1] for [_2] to [_3]',
- $parmitem,$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 .= ' ';
- }
- $output .= &Apache::loncommon::end_data_table_row();
+ $output .= '';
+
+ if ($stillactive) {
+ my $parmitem = &standard_parameter_names($parmname);
+ $parmitem = &mt($parmitem);
+ my $title=&mt('Changed [_1]',$parmitem);
+ my $description=&mt('Changed [_1] for [_2] to [_3]',
+ $parmitem,$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 .= ' '.&Apache::loncommon::end_data_table_row();
}
if ($env{'form.displayfilter'} eq 'containing') {
my $wholeentry=$about_me_link.':'.
@@ -4683,6 +4565,7 @@ sub parm_change_log {
|| $shown<=$env{'form.show'})) { last; }
}
$r->print(&Apache::loncommon::end_data_table());
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
}
@@ -4731,10 +4614,10 @@ sub update_slots {
context => 'parameter',
);
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash,
- '',$uname,$udom,$cnum,$cdom);
+ '',$uname,$udom,$cnum,$cdom);
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash,
- '',$uname,$udom,$uname,$udom);
+ '',$uname,$udom,$uname,$udom);
}
return $success;
}
@@ -4765,9 +4648,9 @@ sub delete_slots {
context => 'parameter',
);
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash,
- 1,$uname,$udom,$cnum,$cdom);
+ 1,$uname,$udom,$cnum,$cdom);
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash,
- 1,$uname,$udom,$uname,$udom);
+ 1,$uname,$udom,$uname,$udom);
}
}
}
@@ -4790,7 +4673,7 @@ sub parameter_release_vars {
}
sub parameter_releasecheck {
- my ($name,$value,$needsrelease,$cmajor,$cminor) = @_;
+ my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_;
my $needsnewer;
my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
if (($cmajor < $needsmajor) ||
@@ -4810,12 +4693,9 @@ sub oldversion_warning {
lenient => 'string_lenient',
retrypartial => 'string_yesno',
discussvote => 'string_discussvote',
- examcode => 'string_examcode',
);
if (exists($stringtypes{$name})) {
- if ($name eq 'examcode') {
- $desc = $value;
- } elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
+ if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {
next unless (ref($possibilities) eq 'ARRAY');
my ($parmval, $description) = @{ $possibilities };
@@ -4825,19 +4705,6 @@ sub oldversion_warning {
}
}
}
- } elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) {
- my $now = time;
- if ($value =~ /^\d+$/) {
- if ($name eq 'printstartdate') {
- if ($value > $now) {
- $desc = &Apache::lonlocal::locallocaltime($value);
- }
- } elsif ($name eq 'printenddate') {
- if ($value < $now) {
- $desc = &Apache::lonlocal::locallocaltime($value);
- }
- }
- }
}
my $standard_name = &standard_parameter_names($name);
return ''.
@@ -4849,46 +4716,6 @@ sub oldversion_warning {
'
';
}
-sub get_permission {
- my %permission;
- my $allowed = 0;
- return (\%permission,$allowed) unless ($env{'request.course.id'});
- if ((&Apache::lonnet::allowed('opa',$env{'request.course.id'})) ||
- (&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.
- $env{'request.course.sec'}))) {
- %permission= (
- 'edit' => 1,
- 'set' => 1,
- 'setoverview' => 1,
- 'addmetadata' => 1,
- 'ordermetadata' => 1,
- 'setrestrictmeta' => 1,
- 'newoverview' => 1,
- 'setdefaults' => 1,
- 'settable' => 1,
- 'parameterchangelog' => 1,
- 'cleanparameters' => 1,
- 'dateshift1' => 1,
- 'dateshift2' => 1,
- 'helper' => 1,
- );
- } elsif ((&Apache::lonnet::allowed('vpa',$env{'request.course.id'})) ||
- (&Apache::lonnet::allowed('vpa',$env{'request.course.id'}.'/'.
- $env{'request.course.sec'}))) {
- %permission = (
- 'set' => 1,
- 'settable' => 1,
- 'newoverview' => 1,
- 'setoverview' => 1,
- 'parameterchangelog' => 1,
- );
- }
- foreach my $perm (values(%permission)) {
- if ($perm) { $allowed=1; last; }
- }
- return (\%permission,$allowed);
-}
-
sub handler {
my $r=shift;
@@ -4916,41 +4743,41 @@ sub handler {
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'});
# ----------------------------------------------------- Needs to be in a course
- my ($parm_permission,$allowed) = &get_permission();
+ my $parm_permission =
+ (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.
+ $env{'request.course.sec'}));
my $exists = &check_for_course_info();
- if ($env{'request.course.id'} && $allowed && $exists) {
+ if ($env{'request.course.id'} && $parm_permission && $exists) {
#
# Main switch on form.action and form.state, as appropriate
#
# Check first if coming from someone else headed directly for
# the table mode
- if (($parm_permission->{'set'}) &&
- ((($env{'form.command'} eq 'set') && ($env{'form.url'})
- && (!$env{'form.dis'})) || ($env{'form.symb'}))) {
- &assessparms($r,$parm_permission);
+ if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
+ && (!$env{'form.dis'})) || ($env{'form.symb'})) {
+ &assessparms($r);
} elsif (! exists($env{'form.action'})) {
&print_main_menu($r,$parm_permission);
- } elsif (!$parm_permission->{$env{'form.action'}}) {
- &print_main_menu($r,$parm_permission);
} elsif ($env{'form.action'} eq 'setoverview') {
- &overview($r,$parm_permission);
- } elsif ($env{'form.action'} eq 'addmetadata') {
- &addmetafield($r);
- } elsif ($env{'form.action'} eq 'ordermetadata') {
- &order_meta_fields($r);
+ &overview($r);
+ } elsif ($env{'form.action'} eq 'addmetadata') {
+ &addmetafield($r);
+ } elsif ($env{'form.action'} eq 'ordermetadata') {
+ &order_meta_fields($r);
} elsif ($env{'form.action'} eq 'setrestrictmeta') {
- &setrestrictmeta($r);
+ &setrestrictmeta($r);
} elsif ($env{'form.action'} eq 'newoverview') {
- &newoverview($r,$parm_permission);
+ &newoverview($r);
} elsif ($env{'form.action'} eq 'setdefaults') {
- &defaultsetter($r);
- } elsif ($env{'form.action'} eq 'settable') {
- &assessparms($r,$parm_permission);
+ &defaultsetter($r);
+ } elsif ($env{'form.action'} eq 'settable') {
+ &assessparms($r);
} elsif ($env{'form.action'} eq 'parameterchangelog') {
- &parm_change_log($r,$parm_permission);
+ &parm_change_log($r);
} elsif ($env{'form.action'} eq 'cleanparameters') {
- &clean_parameters($r);
+ &clean_parameters($r);
} elsif ($env{'form.action'} eq 'dateshift1') {
&date_shift_one($r);
} elsif ($env{'form.action'} eq 'dateshift2') {