--- loncom/interface/lonparmset.pm 2002/02/12 06:28:23 1.44
+++ loncom/interface/lonparmset.pm 2002/03/13 21:24:24 1.45
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.44 2002/02/12 06:28:23 albertel Exp $
+# $Id: lonparmset.pm,v 1.45 2002/03/13 21:24:24 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -366,7 +366,8 @@ sub assessparms {
$ENV{'request.course.id'});
if ($csec eq '-1') {
$message="".
- "User '$uname' at domain '$udom' not in this course";
+ "User '$uname' at domain '$udom' not ".
+ "in this course";
$uname='';
$csec=$ENV{'form.csec'};
} else {
@@ -464,14 +465,9 @@ sub assessparms {
if ($snum==6) { $storeunder=$seclevel; }
if ($snum==5) { $storeunder=$seclevelm; }
if ($snum==4) { $storeunder=$seclevelr; }
- $storeunder=&Apache::lonnet::escape($storeunder);
- my $storecontent=
- $storeunder.'='.
- &Apache::lonnet::escape($ENV{'form.pres_value'}).'&'.
- $storeunder.'.type='.
- &Apache::lonnet::escape($ENV{'form.pres_type'});
-
+ my %storecontent = ($storeunder => $ENV{'form.pres_value'},
+ $storeunder.'type' => $ENV{'form.pres_type'});
my $reply='';
if ($snum>3) {
# ---------------------------------------------------------------- Store Course
@@ -485,13 +481,11 @@ sub assessparms {
} else {
&Apache::lonnet::expirespread('','','assesscalc');
}
-
# Store parameter
- $reply=&Apache::lonnet::critical('put:'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'.
- $storecontent,
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
+ $reply=&Apache::lonnet::cput
+ ('resourcedata',\%storecontent,
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
} else {
# ------------------------------------------------------------------ Store User
#
@@ -506,11 +500,9 @@ sub assessparms {
} else {
&Apache::lonnet::expirespread($uname,$udom,'assesscalc');
}
-
# Store parameter
- $reply=
- &Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'.
- $storecontent,$uhome);
+ $reply=&Apache::lonnet::cput
+ ('resourcedata',\%storecontent,$udom,$uname);
}
if ($reply=~/^error\:(.*)/) {
@@ -519,28 +511,13 @@ sub assessparms {
# ---------------------------------------------------------------- Done storing
}
# -------------------------------------------------------------- Get coursedata
- my $reply=&Apache::lonnet::reply('dump:'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata',
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
- if ($reply!~/^error\:/) {
- foreach (split(/\&/,$reply)) {
- my ($name,$value)=split(/\=/,$_);
- $courseopt{&Apache::lonnet::unescape($name)}=
- &Apache::lonnet::unescape($value);
- }
- }
+ %courseopt = &Apache::lonnet::dump
+ ('resourcedata',
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
# --------------------------------------------------- Get userdata (if present)
if ($uname) {
- my $reply=
- &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);
- if ($reply!~/^error\:/) {
- foreach (split(/\&/,$reply)) {
- my ($name,$value)=split(/\=/,$_);
- $useropt{&Apache::lonnet::unescape($name)}=
- &Apache::lonnet::unescape($value);
- }
- }
+ %useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname);
}
# ------------------------------------------------------------------- Sort this
@@ -713,9 +690,12 @@ ENDTABLEHEADFOUR
untie(%parmhash);
}
+# Set course environment parameters
sub crsenv {
my $r=shift;
my $setoutput='';
+ my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+ my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
# -------------------------------------------------- Go through list of changes
foreach (keys %ENV) {
if ($_=~/^form\.(.+)\_setparmval$/) {
@@ -726,75 +706,66 @@ sub crsenv {
}
if ($name eq 'url') {
$value=~s/^\/res\///;
+ my @tmp = &Apache::lonnet::get
+ ('environment',['url'],$dom,$crs);
$setoutput.='Backing up previous URL: '.
- &Apache::lonnet::reply('put:'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.
- ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.
- ':environment:'.
- &Apache::lonnet::escape('top level map backup '.
- time).'='.
- &Apache::lonnet::reply('get:'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.
- ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.
- ':environment:url',
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'}),
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'}).
- '
';
-
+ &Apache::lonnet::put
+ ('environment',
+ {'top level map backup ' => $tmp[1] },
+ $dom,$crs).
+ '
';
}
if ($name) {
- $setoutput.='Setting '.$name.' to '.
- $value.': '.
- &Apache::lonnet::reply('put:'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.
- ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.
- ':environment:'.
- &Apache::lonnet::escape($name).'='.
- &Apache::lonnet::escape($value),
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'}).
- '
';
+ $setoutput.='Setting '.$name.' to '.
+ $value.': '.
+ &Apache::lonnet::put
+ ('environment',{$name=>$value},$dom,$crs).
+ '
';
}
}
}
# -------------------------------------------------------- Get parameters again
- my $rep=&Apache::lonnet::reply
- ('dump:'.$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.
- ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.
- ':environment',
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
+
+ my %values=&Apache::lonnet::dump('environment',$dom,$crs);
my $output='';
- if ($rep ne 'con_lost') {
- my %values;
+ if (! exists($values{'con_lost'})) {
my %descriptions=
- ('url' => 'Top Level Map
Modification may make assessment data inaccessible',
- 'description' => 'Course Description',
- 'courseid' => 'Course ID or number
(internal, optional)',
- 'question.email' => 'Feedback Addresses for Content Questions
(user:domain,user:domain,...)',
- 'comment.email' => 'Feedback Addresses for Comments
(user:domain,user:domain,...)',
- 'policy.email' => 'Feedback Addresses for Course Policy
(user:domain,user:domain,...)',
- 'hideemptyrows' => 'Hide Empty Rows in Spreadsheets
("yes" for default hiding)',
- 'pch.roles.denied'=> 'Disallow Resource Discussion for Students
"st": student, "ta": TA, "in": instructor;
role,role,...)'
- );
-
- foreach (split(/\&/,$rep)) {
- my ($name,$value)=split(/\=/,$_);
- $name=&Apache::lonnet::unescape($name);
- $values{$name}=&Apache::lonnet::unescape($value);
- unless ($descriptions{$name}) {
- $descriptions{$name}=$name;
+ ('url' => 'Top Level Map
'.
+ 'Modification may make assessment data '.
+ 'inaccessible',
+ 'description' => 'Course Description',
+ 'courseid' => 'Course ID or number
'.
+ '(internal, optional)',
+ 'question.email' => 'Feedback Addresses for Content '.
+ 'Questions
(user:domain,'.
+ 'user:domain,...)',
+ 'comment.email' => 'Feedback Addresses for Comments
'.
+ '(user:domain,user:domain,...)',
+ 'policy.email' => 'Feedback Addresses for Course Policy'.
+ '
(user:domain,user:domain,...)',
+ 'hideemptyrows' => 'Hide Empty Rows in Spreadsheets
'.
+ '("yes" for default hiding)',
+ 'pch.roles.denied'=> 'Disallow Resource Discussion for '.
+ 'Students
"st": '.
+ 'student, "ta": '.
+ 'TA, "in": '.
+ 'instructor;
role,role,...)'
+ );
+ foreach (keys(%values)) {
+ unless ($descriptions{$_}) {
+ $descriptions{$_}=$_;
}
}
foreach (sort keys %descriptions) {
$output.='