[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonparmset.pm
raeburn
raeburn@source.lon-capa.org
Wed, 20 May 2009 18:03:04 -0000
This is a MIME encoded message
--raeburn1242842584
Content-Type: text/plain
raeburn Wed May 20 18:03:04 2009 EDT
Modified files: (Branch: version_2_9_X)
/loncom/interface lonparmset.pm
Log:
- Backport 1.415, 1.416, 1.418, 1.419, 1.420, 1.421, 1.422,
1.423, 1.424, 1.425, 1.427, 1.429, 1.430, 1.431,
1.432, 1.433, 1.434, 1.435, 1.436, 1.437, 1.438,
1.440, 1.444, 1.450.
--raeburn1242842584
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090520180304.txt"
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.413 loncom/interface/lonparmset.pm:1.413.4.1
--- loncom/interface/lonparmset.pm:1.413 Thu Oct 23 14:26:17 2008
+++ loncom/interface/lonparmset.pm Wed May 20 18:03:04 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.413 2008/10/23 14:26:17 bisitz Exp $
+# $Id: lonparmset.pm,v 1.413.4.1 2009/05/20 18:03:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,8 +46,276 @@
=over 4
+=item parmval()
+
+Figure out a cascading parameter.
+
+Inputs: $what - a parameter spec (incluse part info and name I.E. 0.weight)
+ $id - a bighash Id number
+ $def - the resource's default value 'stupid emacs
+
+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
+ 13- Map or Folder level in course
+ 12- resource default
+ 11- map default
+ 10- resource level in course
+ 9 - General for section
+ 8 - Map or Folder level for section
+ 7 - resource level in section
+ 6 - General for group
+ 5 - Map or Folder level for group
+ 4 - resource level in group
+ 3 - General for specific student
+ 2 - Map or Folder level for specific student
+ 1 - resource level for specific student
+
+=item parmval_by_symb()
+
+=item reset_caches()
+
+=item cacheparmhash()
+
+=item parmhash()
+
+=item symbcache()
+
+=item preset_defaults()
+
+=item date_sanity_info()
+
+=item storeparm()
+
+Store a parameter by symb
+
+ Takes
+ - symb
+ - name of parameter
+ - level
+ - new value
+ - new type
+ - username
+ - userdomain
+
+=item log_parmset()
+
+=item storeparm_by_symb_inner()
+
+=item valout()
+
+Format a value for output.
+
+Inputs: $value, $type, $editable
+
+Returns: $value, formatted for output. If $type indicates it is a date,
+localtime($value) is returned.
+$editable will return an icon to click on
+
+=item plink()
+
+Produces a link anchor.
+
+Inputs: $type,$dis,$value,$marker,$return,$call
+
+Returns: scalar with html code for a link which will envoke the
+javascript function 'pjump'.
+
+=item page_js()
+
+=item startpage()
+
+=item print_row()
+
+=item print_td()
+
+=item print_usergroups()
+
+=item parm_control_group()
+
+=item extractResourceInformation() :
+
+Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
+
+Input: See list below:
+
+=item * B<ids> : An array that will contain all of the ids in the course.
+
+=item * B<typep> : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
+
+=item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
+
+
+=item * B<allparms> : hash, name of parameter->display value (what is the display value?)
+
+=item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]"
+
+=item * B<allkeys> : hash, full key to part->display value (what's display value?)
+
+=item * B<allmaps> : hash, ???
+
+=item * B<fcat> : ???
+
+=item * B<defp> : hash, ???
+
+=item * B<mapp> : ??
+
+=item * B<symbp> : hash, id->full sym?
+
+
+
+=item isdateparm()
+
+=item parmmenu()
+
+=item partmenu()
+
+=item usermenu()
+
+=item displaymenu()
+
+=item mapmenu()
+
+=item levelmenu()
+
+=item sectionmenu()
+
+=item keysplit()
+
+=item keysinorder()
+
+=item keysinorder_bytype()
+
+=item keysindisplayorder()
+
+=item standardkeyorder()
+
+=item assessparms() :
+
+Show assessment data and parameters. This is a large routine that should
+be simplified and shortened... someday.
+
+Inputs: $r
+
+Returns: nothing
+
+Variables used (guessed by Jeremy):
+
+=item * B<pscat>: 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<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
+
+=item * B<@catmarker> contains list of all possible parameters including part #s
+
+=item * B<$fullkeyp> contains the full part/id # for the extraction of proper parameters
+
+=item * B<$tempkeyp> contains part 0 only (no ids - ie, subparts)
+ When storing information, store as part 0
+ When requesting information, request from full part
+
+=item tablestart()
+
+=item tableend()
+
+=item extractuser()
+
+=item parse_listdata_key()
+
+=item listdata()
+
+=item date_interval_selector()
+
+=item get_date_interval_from_form()
+
+=item default_selector()
+
+=item string_selector()
+
+=item dateshift()
+
+=item newoverview()
+
+=item secgroup_lister()
+
+=item overview()
+
+=item clean_parameters()
+
+=item date_shift_one()
+
+=item date_shift_two()
+
+=item parse_key()
+
+=item check_cloners() :
+
+Checks if new users included in list of allowed cloners
+are valid users. Replaces supplied list with
+cleaned list containing only users with valid usernames
+and domains.
+
+Inputs: $clonelist, $oldcloner
+where $clonelist is ref to array of requested cloners,
+and $oldcloner is ref to array of currently allowed
+cloners.
+
+Returns: string - comma separated list of requested
+cloners (username:domain) who do not exist in system.
+
+=item change_clone() :
+
+Modifies the list of courses a user can clone (stored
+in the user's environment.db file), called when a
+change is made to the list of users allowed to clone
+a course.
+
+Inputs: $action,$cloner
+where $action is add or drop, and $cloner is identity of
+user for whom cloning ability is to be changed in course.
+
+
+=item check_cloners()
+
+=item change_clone()
+
+=item header()
+
+Output html header for page
+
+=item print_main_menu()
+
+=item output_row()
+
+Set portfolio metadata
+
+=item order_meta_fields()
+
+=item addmetafield()
+
+=item setrestrictmeta()
+
+=item get_added_meta_fieldnames()
+
+=item get_deleted_meta_fieldnames()
+
+=item defaultsetter()
+
+=item components()
+
+=item load_parameter_names()
+
+=item parm_change_log()
+
+=item handler() :
+
+Main handler. Calls &assessparms subroutine.
+
+
+=back
+
=cut
+
###################################################################
###################################################################
@@ -67,40 +335,6 @@
use Apache::lonrss;
use LONCAPA qw(:DEFAULT :match);
-
-##################################################
-##################################################
-
-=pod
-
-=item parmval
-
-Figure out a cascading parameter.
-
-Inputs: $what - a parameter spec (incluse part info and name I.E. 0.weight)
- $id - a bighash Id number
- $def - the resource's default value 'stupid emacs
-
-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
-13- Map or Folder level in course
-12- resource default
-11- map default
-10- resource level in course
-9 - General for section
-8 - Map or Folder level for section
-7 - resource level in section
-6 - General for group
-5 - Map or Folder level for group
-4 - resource level in group
-3 - General for specific student
-2 - Map or Folder level for specific student
-1 - resource level for specific student
-
-=cut
-
-##################################################
sub parmval {
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,
@@ -302,6 +536,7 @@
}
}
+
sub preset_defaults {
my $type=shift;
if (&rulescache($type.'_action') eq 'default') {
@@ -316,7 +551,6 @@
}
}
-##################################################
sub date_sanity_info {
my $checkdate=shift;
@@ -371,17 +605,6 @@
&storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup);
}
-#
-# Store a parameter by symb
-#
-# Takes
-# - symb
-# - name of parameter
-# - level
-# - new value
-# - new type
-# - username
-# - userdomain
my %recstack;
sub storeparm_by_symb {
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_;
@@ -536,25 +759,6 @@
return '';
}
-##################################################
-##################################################
-
-=pod
-
-=item valout
-
-Format a value for output.
-
-Inputs: $value, $type, $editable
-
-Returns: $value, formatted for output. If $type indicates it is a date,
-localtime($value) is returned.
-$editable will return an icon to click on
-
-=cut
-
-##################################################
-##################################################
sub valout {
my ($value,$type,$editable)=@_;
my $result = '';
@@ -611,24 +815,6 @@
return $result;
}
-##################################################
-##################################################
-
-=pod
-
-=item plink
-
-Produces a link anchor.
-
-Inputs: $type,$dis,$value,$marker,$return,$call
-
-Returns: scalar with html code for a link which will envoke the
-javascript function 'pjump'.
-
-=cut
-
-##################################################
-##################################################
sub plink {
my ($type,$dis,$value,$marker,$return,$call)=@_;
my $winvalue=$value;
@@ -643,6 +829,7 @@
my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
unless (defined($winvalue)) { $winvalue=$val; }
my $valout = &valout($value,$type,1);
+ my $unencmarker = $marker;
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call,
\$hour, \$min, \$sec) {
$$item = &HTML::Entities::encode($$item,'"<>&');
@@ -650,7 +837,7 @@
}
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."','"
- .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
+ .$unencmarker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
$valout.'</a></td></tr></table>';
}
@@ -721,10 +908,10 @@
$start_page
$breadcrumbs
<form method="post" action="/adm/parmset?action=settable" name="parmform">
-<input type="hidden" value='' name="pres_value" />
-<input type="hidden" value='' name="pres_type" />
-<input type="hidden" value='' name="pres_marker" />
-<input type="hidden" value='1' name="prevvisit" />
+<input type="hidden" value="" name="pres_value" />
+<input type="hidden" value="" name="pres_type" />
+<input type="hidden" value="" name="pres_marker" />
+<input type="hidden" value="1" name="prevvisit" />
ENDHEAD
}
@@ -756,7 +943,7 @@
my $parm=$$display{$which};
if ($parmlev eq 'full') {
- $r->print('<td bgcolor='.$defbgtwo.' align="center">'
+ $r->print('<td style="background-color:'.$defbgtwo.';" align="center">'
.$$part{$which}.'</td>');
} else {
$parm=~s|\[.*\]\s||g;
@@ -765,7 +952,7 @@
if ($automatic) {
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>';
}
- $r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>');
+ $r->print('<td>'.$parm.'</td>');
my $thismarker=$which;
$thismarker=~s/^parameter\_//;
@@ -842,31 +1029,37 @@
}
} # end of $parmlev if/else
- $r->print('<td bgcolor="#CCCCFF" align="center">'.$effective_parm.'</td>');
+ $r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>');
if ($parmlev eq 'full') {
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
'.'.$$name{$which},$$symbp{$rid});
my $sessionvaltype=$typeoutpar[$result];
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
- $r->print('<td bgcolor="#999999" align="center"><font color="#FFFFFF">'.
+ $r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'.
&valout($sessionval,$sessionvaltype).' '.
'</font></td>');
}
- $r->print('</tr>');
- $r->print("\n");
}
sub print_td {
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
- $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).
- ' align="center">');
- if ($which<11 || $which > 12) {
- $r->print(&plink($$typeoutpar[$which],
- $$display{$value},$$outpar[$which],
- $mprefix."$which",'parmform.pres','psub'));
+ $r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg).
+ ';" align="center">');
+ my $nolink = 0;
+ if ($which == 11 || $which == 12) {
+ $nolink = 1;
+ } elsif ($mprefix =~ /availablestudent\&$/) {
+ if ($which > 3) {
+ $nolink = 1;
+ }
+ }
+ if ($nolink) {
+ $r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
} else {
- $r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
+ $r->print(&plink($$typeoutpar[$which],
+ $$display{$value},$$outpar[$which],
+ $mprefix."$which",'parmform.pres','psub'));
}
$r->print('</td>'."\n");
}
@@ -886,11 +1079,11 @@
my $grp_parm;
if (($coursereply) && ($cgroup ne $resultgroup)) {
if ($result > 3) {
- $bgcolor = '"#AAFFAA"';
+ $bgcolor = '#AAFFAA';
$grp_parm = &valout($coursereply,$resulttype);
}
$grp_parm = &valout($coursereply,$resulttype);
- $output = '<td bgcolor='.$bgcolor.' align="center">';
+ $output = '<td style="background-color:'.$bgcolor.';" align="center">';
if ($resultgroup && $resultlevel) {
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm;
} else {
@@ -898,7 +1091,7 @@
}
$output .= '</td>';
} else {
- $output .= '<td bgcolor='.$bgcolor.'> </td>';
+ $output .= '<td style="background-color:'.$bgcolor.';"> </td>';
}
return ($coursereply,$output,$grp_parm,$resultgroup);
}
@@ -927,40 +1120,6 @@
return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype);
}
-=pod
-
-=item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
-
-Input: See list below:
-
-=over 4
-
-=item B<ids>: An array that will contain all of the ids in the course.
-
-=item B<typep>: hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
-
-=item B<keyp>: hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
-
-=item B<allparms>: hash, name of parameter->display value (what is the display value?)
-
-=item B<allparts>: hash, part identification->text representation of part, where the text representation is "[Part $part]"
-
-=item B<allkeys>: hash, full key to part->display value (what's display value?)
-
-=item B<allmaps>: hash, ???
-
-=item B<fcat>: ???
-
-=item B<defp>: hash, ???
-
-=item B<mapp>: ??
-
-=item B<symbp>: hash, id->full sym?
-
-=back
-
-=cut
-
sub extractResourceInformation {
my $ids = shift;
my $typep = shift;
@@ -999,9 +1158,15 @@
#
my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
- my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
- my $parmdis = $display;
- $parmdis =~ s/\s*\[Part.*$//g;
+ my ($display,$parmdis);
+ $display = &standard_parameter_names($name);
+ if ($display eq '') {
+ $display= &Apache::lonnet::metadata($srcf,$key.'.display');
+ $parmdis = $display;
+ $parmdis =~ s/\s*\[Part.*$//g;
+ } else {
+ $parmdis = $display;
+ }
$$allparms{$name}=$parmdis;
if (ref($defkeytype)) {
$$defkeytype{$name}=
@@ -1127,17 +1292,17 @@
</script>
ENDSCRIPT
$r->print();
- $r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>");
+ $r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>');
my $cnt=0;
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
- $r->print("\n<td><label><input type='checkbox' name='pscat' ");
+ $r->print("\n".'<td><label><input type="checkbox" name="pscat" ');
$r->print('value="'.$tempkey.'"');
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
- $r->print(' checked');
+ $r->print(' checked="checked"');
}
- $r->print('>'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey})
- : &mt($tempkey))
- .'</label></td>');
+ $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
+ : $tempkey).
+ '</label></td>');
$cnt++;
if ($cnt==3) {
$r->print("</tr>\n<tr>");
@@ -1145,7 +1310,7 @@
}
}
$r->print('</tr>'
- .'<tr id=\"LC_parm_overview_parm_menu_selectors\">'
+ .'<tr id="LC_parm_overview_parm_menu_selectors">'
.'<td valign="top">'
.'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>'
.'<span class="LC_nobreak">'
@@ -1188,7 +1353,7 @@
sub partmenu {
my ($r,$allparts,$psprt)=@_;
- $r->print('<select multiple name="psprt" size="8">');
+ $r->print('<select multiple="multiple" name="psprt" size="8">');
$r->print('<option value="all"');
$r->print(' selected="selected"') unless (@{$psprt});
$r->print('>'.&mt('All Parts').'</option>');
@@ -1352,7 +1517,7 @@
my %sectionhash = &Apache::loncommon::get_sections();
return if (!%sectionhash);
- $r->print('<select name="Section" multiple="true" size="8" >');
+ $r->print('<select name="Section" multiple="multiple" size="8" >');
foreach my $s ('all',sort keys %sectionhash) {
$r->print(' <option value="'.$s.'"');
foreach (@{$selectedsections}) {
@@ -1371,7 +1536,7 @@
my %grouphash = &Apache::longroup::coursegroups();
return if (!%grouphash);
- $r->print('<select name="Group" multiple="true" size="8" >');
+ $r->print('<select name="Group" multiple="multiple" size="8" >');
foreach my $group (sort(keys(%grouphash))) {
$r->print(' <option value="'.$group.'"');
foreach (@{$selectedgroups}) {
@@ -1421,12 +1586,12 @@
my ($r,$sortorder)=@_;
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"');
if ($sortorder eq 'realmstudent') {
- $r->print(' checked="on"');
+ $r->print(' checked="checked"');
}
$r->print(' />'.&mt('Sort by realm first, then student (group/section)'));
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"');
if ($sortorder eq 'studentrealm') {
- $r->print(' checked="on"');
+ $r->print(' checked="checked"');
}
$r->print(' />'.&mt('Sort by student (group/section) first, then realm').
'</label>');
@@ -1455,36 +1620,6 @@
'parameter_0_discusshide' => 20);
}
-##################################################
-##################################################
-
-=pod
-
-=item assessparms
-
-Show assessment data and parameters. This is a large routine that should
-be simplified and shortened... someday.
-
-Inputs: $r
-
-Returns: nothing
-
-Variables used (guessed by Jeremy):
-
-=over 4
-
-=item B<pscat>: 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<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
-
-=item B<allmaps>:
-
-=back
-
-=cut
-
-##################################################
-##################################################
sub assessparms {
my $r=shift;
@@ -1639,6 +1774,39 @@
my @values=split(/\&\&\&/,$env{'form.pres_value'});
my @types=split(/\&\&\&/,$env{'form.pres_type'});
for (my $i=0;$i<=$#markers;$i++) {
+ if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my (@ok_slots,@fail_slots,@del_slots);
+ my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
+ my ($level,@all) =
+ &parmval_by_symb('0.availablestudent',$pssymb,'',$uname,$udom,
+ $csec,$cgroup,$courseopt);
+ foreach my $slot_name (split(/:/,$values[$i])) {
+ next if ($slot_name eq '');
+ if (&update_slots($slot_name,$cdom,$cnum,$pssymb,$uname,$udom) eq 'ok') {
+ push(@ok_slots,$slot_name);
+
+ } else {
+ push(@fail_slots,$slot_name);
+ }
+ }
+ if (@ok_slots) {
+ $values[$i] = join(':',@ok_slots);
+ } else {
+ $values[$i] = '';
+ }
+ if ($all[$level] ne '') {
+ my @existing = split(/:/,$all[$level]);
+ foreach my $slot_name (@existing) {
+ if (!grep(/^\Q$slot_name\E$/,split(/:/,$values[$i]))) {
+ if (&delete_slots($slot_name,$cdom,$cnum,$uname,$udom,$pssymb) eq 'ok') {
+ push(@del_slots,$slot_name);
+ }
+ }
+ }
+ }
+ }
$message.=&storeparm(split(/\&/,$markers[$i]),
$values[$i],
$types[$i],
@@ -1665,12 +1833,13 @@
if (!$pssymb) {
$r->print('<table border="1"><tr><td>');
&levelmenu($r,\%alllevs,$parmlev);
+ $r->print('</td>');
if ($parmlev ne 'general') {
$r->print('<td>');
&mapmenu($r,\%allmaps,$pschp,\%maptitles);
$r->print('</td>');
}
- $r->print('</td></tr></table>');
+ $r->print('</tr></table>');
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
} else {
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
@@ -1707,9 +1876,9 @@
$coursespan += 3;
}
- $r->print('<p><table border=2>');
- $r->print('<tr><td colspan=5></td>');
- $r->print('<th colspan='.($coursespan).'>'.&mt('Any User').'</th>');
+ $r->print('<p><table border="2">');
+ $r->print('<tr><td colspan="5"></td>');
+ $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
if ($uname) {
if (@usersgroups > 1) {
$userspan ++;
@@ -1735,18 +1904,18 @@
'fr' => 'for Resource'
);
$r->print(<<ENDTABLETWO);
-<th rowspan=3>$lt{'pie'}</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>
-<th colspan=1>$lt{'ic'}</th>
+<th rowspan="3">$lt{'pie'}</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>
+<th colspan="1">$lt{'ic'}</th>
ENDTABLETWO
if ($csec) {
- $r->print("<th colspan=3>".
+ $r->print('<th colspan="3">'.
&mt("in Section")." $csec</th>");
}
if ($cgroup) {
- $r->print("<th colspan=3>".
+ $r->print('<th colspan="3">'.
&mt("in Group")." $cgroup</th>");
}
$r->print(<<ENDTABLEHEADFOUR);
@@ -1787,20 +1956,20 @@
||
($pssymb && $pssymb eq $symbp{$rid})) {
# ------------------------------------------------------ Entry for one resource
- if ($defbgone eq '"#E0E099"') {
- $defbgone='"#E0E0DD"';
+ if ($defbgone eq '#E0E099') {
+ $defbgone='#E0E0DD';
} else {
- $defbgone='"#E0E099"';
+ $defbgone='#E0E099';
}
- if ($defbgtwo eq '"#FFFF99"') {
- $defbgtwo='"#FFFFDD"';
+ if ($defbgtwo eq '#FFFF99') {
+ $defbgtwo='#FFFFDD';
} else {
- $defbgtwo='"#FFFF99"';
+ $defbgtwo='#FFFF99';
}
- if ($defbgthree eq '"#FFBB99"') {
- $defbgthree='"#FFBBDD"';
+ if ($defbgthree eq '#FFBB99') {
+ $defbgthree='#FFBBDD';
} else {
- $defbgthree='"#FFBB99"';
+ $defbgthree='#FFBB99';
}
my $thistitle='';
@@ -1817,21 +1986,30 @@
if (grep $_ eq $tempkeyp, @catmarker) {
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
- $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
unless ($display{$_}) { $display{$_}=''; }
+ my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
+ if ($allparms{$name{$_}} ne '') {
+ my $identifier;
+ if ($parmdis =~ /(\s*\[Part.*)$/) {
+ $identifier = $1;
+ }
+ $display{$_} = $allparms{$name{$_}}.$identifier;
+ } else {
+ $display{$_} = $parmdis;
+ }
$display{$_}.=' ('.$name{$_}.')';
$default{$_}=&Apache::lonnet::metadata($uri,$_);
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
}
}
- my $totalparms=scalar keys %name;
+ my $totalparms=scalar(keys(%name));
if ($totalparms>0) {
my $firstrow=1;
my $title=&Apache::lonnet::gettitle($symbp{$rid});
- $r->print('<tr><td bgcolor='.$defbgone.
- ' rowspan='.$totalparms.
- '><tt><font size=-1>'.
+ $r->print('<tr><td style="background-color:'.$defbgone.';"'.
+ ' rowspan="'.$totalparms.
+ '"><tt><font size="-1">'.
join(' / ',split(/\//,$uri)).
'</font></tt><p><b>'.
"<a href=\"javascript:openWindow('".
@@ -1844,13 +2022,13 @@
$r->print(' ('.$thistitle.')');
}
$r->print('</a></b></td>');
- $r->print('<td bgcolor='.$defbgtwo.
- ' rowspan='.$totalparms.'>'.$typep{$rid}.
+ $r->print('<td style="background-color:'.$defbgtwo.';"'.
+ ' rowspan="'.$totalparms.'">'.$typep{$rid}.
'</td>');
- $r->print('<td bgcolor='.$defbgone.
- ' rowspan='.$totalparms.
- '>'.$maptitles{$mapp{$rid}}.'</td>');
+ $r->print('<td style="background-color:'.$defbgone.';"'.
+ ' rowspan="'.$totalparms.
+ '">'.$maptitles{$mapp{$rid}}.'</td>');
foreach (&keysinorder_bytype(\%name,\%keyorder)) {
unless ($firstrow) {
@@ -1862,6 +2040,7 @@
\%type,\%display,$defbgone,$defbgtwo,
$defbgthree,$parmlev,$uname,$udom,$csec,
$cgroup,\@usersgroups);
+ $print('</tr>'."\n");
}
}
}
@@ -1871,9 +2050,9 @@
} # end of full
#--------------------------------------------------- Entry for parm level map
if ($parmlev eq 'map') {
- my $defbgone = '"E0E099"';
- my $defbgtwo = '"FFFF99"';
- my $defbgthree = '"FFBB99"';
+ my $defbgone = 'E0E099';
+ my $defbgtwo = 'FFFF99';
+ my $defbgthree = 'FFBB99';
my %maplist;
@@ -1924,7 +2103,16 @@
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ if ($allparms{$name{$tempkeyp}} ne '') {
+ my $identifier;
+ if ($parmdis =~ /(\s*\[Part.*)$/) {
+ $identifier = $1;
+ }
+ $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
+ } else {
+ $display{$tempkeyp} = $parmdis;
+ }
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
@@ -1961,27 +2149,30 @@
,'<font color="red"><i>'.$coursename.'</i></font>'
)
."<br /></h4>\n"
- );
+ );
#---------------------------------------------------------------- print table
- $r->print('<p><table border="2">');
- $r->print('<tr><th>'.&mt('Parameter Name').'</th>');
- $r->print('<th>'.&mt('Default Value').'</th>');
- $r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
+ $r->print('<p>'..&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ '<tr><th>'.&mt('Parameter Name').'</th>'.
+ '<th>'.&mt('Default Value').'</th>'.
+ '<th>'.&mt('Parameter in Effect').'</th>'.
+ &Apache::loncommon::end_data_table_header_row());
foreach (&keysinorder(\%name,\%keyorder)) {
- $r->print('<tr>');
+ $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);
+ $r->print(&Apache::loncommon::end_data_table_row());
}
- $r->print("</table></div>");
+ $r->print(&Apache::loncommon::end_data_table().'</p></div>');
} # end each map
} # end of $parmlev eq map
#--------------------------------- Entry for parm level general (Course level)
if ($parmlev eq 'general') {
- my $defbgone = '"E0E099"';
- my $defbgtwo = '"FFFF99"';
- my $defbgthree = '"FFBB99"';
+ my $defbgone = 'E0E099';
+ my $defbgtwo = 'FFFF99';
+ my $defbgthree = 'FFBB99';
#-------------------------------------------- for each map, gather information
my $mapid="0.0";
@@ -2012,7 +2203,16 @@
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ if ($allparms{$name{$tempkeyp}} ne '') {
+ my $identifier;
+ if ($parmdis =~ /(\s*\[Part.*)$/) {
+ $identifier = $1;
+ }
+ $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
+ } else {
+ $display{$tempkeyp} = $parmdis;
+ }
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
@@ -2025,7 +2225,8 @@
#---------------------------------------------------- print header information
my $setdef=&mt("Set Defaults for All Resources in Course");
$r->print(<<ENDMAPONE);
-<center><h4>$setdef
+<center>
+<h4>$setdef
<font color="red"><i>$coursename</i></font><br />
ENDMAPONE
if ($uname) {
@@ -2039,18 +2240,21 @@
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")};
$r->print("</h4>\n");
#---------------------------------------------------------------- print table
- $r->print('<p><table border="2">');
- $r->print('<tr><th>'.&mt('Parameter Name').'</th>');
- $r->print('<th>'.&mt('Default Value').'</th>');
- $r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
+ $r->print('<p>'.&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ '<th>'.&mt('Parameter Name').'</th>'.
+ '<th>'.&mt('Default Value').'</th>'.
+ '<th>'.&mt('Parameter in Effect').'</th>'.
+ &Apache::loncommon::end_data_table_header_row());
foreach (&keysinorder(\%name,\%keyorder)) {
- $r->print('<tr>');
+ $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);
+ $r->print(&Apache::loncommon::end_data_table_row());
}
- $r->print("</table></center>");
+ $r->print(&Apache::loncommon::end_data_table().'</p></center>');
} # end of $parmlev eq general
}
$r->print('</form>'.&Apache::loncommon::end_page());
@@ -2058,633 +2262,6 @@
##################################################
-##################################################
-
-=pod
-
-=item crsenv
-
-Show and set course data and parameters. This is a large routine that should
-be simplified and shortened... someday.
-
-Inputs: $r
-
-Returns: nothing
-
-=cut
-
-##################################################
-##################################################
-sub crsenv {
- my $r=shift;
- my $setoutput='';
-
- my $breadcrumbs =
- &Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment');
- my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
-
- my (%crsinfo,$chome);
-
- #
- # Go through list of changes
- foreach (keys %env) {
- next if ($_!~/^form\.(.+)\_setparmval$/);
- my $name = $1;
- my $value = $env{'form.'.$name.'_value'};
- if ($name eq 'newp') {
- $name = $env{'form.newp_name'};
- }
- if ($name eq 'url') {
- $value=~s/^\/res\///;
- my $bkuptime=time;
- my @tmp = &Apache::lonnet::get
- ('environment',['url'],$dom,$crs);
- $setoutput.=&mt('Backing up previous URL').': '.
- &Apache::lonnet::put
- ('environment',
- {'top level map backup '.$bkuptime => $tmp[1] },
- $dom,$crs).
- '<br />';
- }
- #
- # Deal with modified default spreadsheets
- if ($name =~ /^spreadsheet_default_(classcalc|
- studentcalc|
- assesscalc)$/x) {
- my $sheettype = $1;
- if ($sheettype eq 'classcalc') {
- # no need to do anything since viewing the sheet will
- # cause it to be updated.
- } elsif ($sheettype eq 'studentcalc') {
- # expire all the student spreadsheets
- &Apache::lonnet::expirespread('','','studentcalc');
- } else {
- # expire all the assessment spreadsheets
- # this includes non-default spreadsheets, but better to
- # be safe than sorry.
- &Apache::lonnet::expirespread('','','assesscalc');
- # expire all the student spreadsheets
- &Apache::lonnet::expirespread('','','studentcalc');
- }
- }
- #
- # Deal with the enrollment dates
- if ($name =~ /^default_enrollment_(start|end)_date$/) {
- $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
- }
- #
- # Deal with the emails
- if ($name =~ /\.email$/) {
- foreach my $specifier (split(',',$value)) {
- my ($user,$sections_or_groups)=
- ($specifier=~/^([^\(]+)\(([^\)]+)\)/);
- if (!$sections_or_groups) {
- $user = $specifier;
- }
- my ($name,$domain) = split(':',$user);
- if (!defined($user) || !defined($domain)) {
- $setoutput.= '<br /> <span class="LC_error">'.
- &mt("Invalid email address specified, address must be of the form username:domain what was specified was ([_1])",$user).
- '</span>';
- undef($value);
- } elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') {
- $setoutput.= '<br /> <span class="LC_error">'.
- &mt("Invalid email address specified, user [_1] is unknown.",$name).
- '</span>';
- undef($value);
- }
- }
- }
- # Get existing cloners
- my @oldcloner = ();
- if ($name eq 'cloners') {
- my %clonenames=&Apache::lonnet::dump('environment',$dom,$crs,'cloners');
- if ($clonenames{'cloners'} =~ /,/) {
- @oldcloner = split/,/,$clonenames{'cloners'};
- } else {
- $oldcloner[0] = $clonenames{'cloners'};
- }
- }
- #
- # Let the user know we made the changes
- if ($name && defined($value)) {
- my %failed_cloners;
- if ($name eq 'cloners') {
- $value =~ s/\s//g;
- $value =~ s/^,//;
- $value =~ s/,$//;
- # check requested clones are valid users.
- %failed_cloners = &check_cloners(\$value,\@oldcloner);
- }
- my $put_result = &Apache::lonnet::put('environment',
- {$name=>$value},$dom,$crs);
- if ($put_result eq 'ok') {
- $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>';
- if ($name =~ /^default_enrollment_(start|end)_date$/) {
- $setoutput .= &Apache::lonlocal::locallocaltime($value);
- } elsif ($name eq 'categories') {
- $setoutput .= $env{'form.categories_display'};
- } else {
- $setoutput .= $value;
- }
- $setoutput .= '</b>.<br />';
- if ($name eq 'cloners') {
- &change_clone($value,\@oldcloner);
- }
- # Update environment and nohist_courseids.db
- if (($name eq 'description') || ($name eq 'cloners') ||
- ($name eq 'hidefromcat') || ($name eq 'categories')) {
- if ($chome eq '') {
- %crsinfo =
- &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
- $crs,undef,undef,'.');
- $chome = &Apache::lonnet::homeserver($crs,$dom);
- }
- }
- if ($name eq 'description' && defined($value)) {
- &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value});
- if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
- $crsinfo{$env{'request.course.id'}}{'description'} = $value;
- my $putresult =
- &Apache::lonnet::courseidput($dom,\%crsinfo,
- $chome,'notime');
- }
- }
- if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) {
- if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
- &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value});
- $crsinfo{$env{'request.course.id'}}{$name} = $value;
- my $putresult =
- &Apache::lonnet::courseidput($dom,\%crsinfo,
- $chome,'notime');
- }
- }
- } else {
- $setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to').
- ' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />';
- }
- if (($name eq 'cloners') && (keys(%failed_cloners) > 0)) {
- $setoutput.= &mt('Unable to include').': ';
- my @fails;
- my $num = 0;
- if (defined($failed_cloners{'format'})) {
- $fails[$num] .= '<b>'.$failed_cloners{'format'}.
- '</b>, '.&mt('reason').' - '.
- &mt('Invalid format');
- $num ++;
- }
- if (defined($failed_cloners{'domain'})) {
- $fails[$num] .= '<b>'.$failed_cloners{'domain'}.
- '</b>, '.&mt('reason').' - '.
- &mt('Domain does not exist');
- $num ++;
- }
- if (defined($failed_cloners{'newuser'})) {
- $fails[$num] .= '<b>'.$failed_cloners{'newuser'}. '</b>, '.&mt('reason').' - '.
- &mt('LON-CAPA user(s) do(es) not exist.').
- '.<br />'.&mt('Please ').
- ' <a href="/adm/createuser">'.
- &mt('add the user(s)').'</a>, '.
- &mt('and then return to the ').
- '<a href="/adm/parmset?action=crsenv">'.
- &mt('Course Parameters page').'</a> '.
- &mt('to add the new user(s) to the list of possible cloners');
- }
- $setoutput .= join('; ',@fails).'.<br />';
- }
- }
- }
-
- 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
-
- &Apache::lonnet::coursedescription($env{'request.course.id'},
- {'freshen_cache' => 1});
-
-# -------------------------------------------------------- Get parameters again
-
- my %values=&Apache::lonnet::dump('environment',$dom,$crs);
- my $SelectStyleFile=&mt('Select Style File');
- my $SelectSpreadsheetFile=&mt('Select Spreadsheet File');
- my $output='';
- my $can_categorize;
- if (! exists($values{'con_lost'})) {
- my %descriptions=
- ('url' => '<b>'.&mt('Top Level Map').'</b><br />'.
- '<a href="javascript:openbrowser'.
- "('envform','url','sequence')\">".
- &mt('Select Map').'</a><br /><span class="LC_warning"> '.
- &mt('Modification may make assessment data inaccessible!').
- '</span>',
- 'description' => '<b>'.&mt('Course Description').'</b>',
- 'courseid' => '<b>'.&mt('Course ID or number').
- '</b><br />'.
- '('.&mt('internal, optional').')',
- 'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br />'
- .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")<br />'
- .&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'<br />'
- .&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"<tt>*:domain</tt>"').'<br />'
- .&mt('Use [_1] to allow unrestricted cloning in all domains.','"<tt>*</tt>"'),
- 'grading' => '<b>'.&mt('Grading').'</b><br />'.
- &mt('[_1], [_2], or [_3]','"<tt>standard</tt>"','"<tt>external</tt>"','"<tt>spreadsheet</tt>"').&Apache::loncommon::help_open_topic('GradingOptions'),
- 'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />'
- .&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'<br />'
- .'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"<tt>any</tt>"','"<tt>section</tt>"').')',
- 'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b><br />'.
- '<a href="javascript:openbrowser'.
- "('envform','default_xml_style'".
- ",'sty')\">$SelectStyleFile</a><br />",
- 'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').'</b><br />'
- .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
- 'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').'</b>',
- 'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'
- .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
- 'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').'</b>',
- 'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b><br />'
- .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
- 'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').'</b>',
- 'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'
- .'('.&mt('[_1] for default hiding','"<tt>yes</tt>"').')',
- 'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'
- .'('.&mt('[_1] for visible separation.','"<tt>yes</tt>"').' '
- .&mt('Changes will not show until next login.').')',
- 'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'
- .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')',
- 'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'
- .'('.&mt('[_1] for link to each a listing of each student\'s files.','"<tt>yes</tt>"').')',
- 'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'
- .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')',
- 'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').'</b><br />'
- .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
- .'("<tt>'.&mt('role,role,...').'</tt>") '
- .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
- 'plc.users.denied' =>
- '<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'.
- '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
-
- 'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />'
- .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"')
- .'("<tt>'.&mt('role,role,...').'</tt>") '
- .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
- 'pch.users.denied' =>
- '<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'.
- '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
- 'spreadsheet_default_classcalc'
- => '<b>'.&mt('Default Course Spreadsheet').'</b> '.
- '<a href="javascript:openbrowser'.
- "('envform','spreadsheet_default_classcalc'".
- ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
- 'spreadsheet_default_studentcalc'
- => '<b>'.&mt('Default Student Spreadsheet').'</b><br />'.
- '<a href="javascript:openbrowser'.
- "('envform','spreadsheet_default_calc'".
- ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
- 'spreadsheet_default_assesscalc'
- => '<b>'.&mt('Default Assessment Spreadsheet').'</b> '.
- '<a href="javascript:openbrowser'.
- "('envform','spreadsheet_default_assesscalc'".
- ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
- 'allow_limited_html_in_feedback'
- => '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'.
- '('.&mt('Set value to [_1] to allow.','"<tt>yes</tt>"').')',
- 'allow_discussion_post_editing'
- => '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />'
- .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
- .'('.&mt('Set value to [_1] to allow all roles.','"<tt>yes</tt>"').')'
- .'("<tt>'.&mt('role:section,role:section,...').'</tt>")<br />'
- .'('.&mt('Example: "<tt>st:001,st:002,in,cc</tt>" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')',
- 'rndseed'
- => '<b>'.&mt('Randomization algorithm used').'</b><br />'
- .'<span class="LC_error">'
- .&mt('Modifying this will make problems have different numbers and answers!')
- .'</span>',
- 'receiptalg'
- => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.
- &mt('This controls how receipt numbers are generated.'),
- 'suppress_tries'
- => '<b>'.&mt('Suppress number of tries in printing').'</b><br />'.
- ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
- 'problem_stream_switch'
- => '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.
- ' ('.&mt('[_1] if allowed, anything else if not','"<tt>yes</tt>"').')',
- 'default_paper_size'
- => '<b>'.&mt('Default paper type').'</b><br />'.
- ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'.
- ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'.
- ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',
- 'print_header_format'
- => ' <b>'.&mt('Print header format').'</b><br />'
- .&mt('Substitutions:<br />[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the <tt>%</tt> limit the field size.','"<tt>%n</tt>"','"<tt>%c</tt>"','"<tt>%a</tt>"'),
- 'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>',
- 'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>',
- 'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b><br />'
- .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")',
- 'languages' => '<b>'.&mt('Languages used').'</b>',
- 'disable_receipt_display'
- => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.
- ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
- 'task_messages'
- => '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_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>"').')',
- 'disablesigfigs'
- => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.
- ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
- 'disableexampointprint'
- => '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'.
- ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
- 'externalsyllabus'
- => '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>',
- 'tthoptions'
- => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>',
-
- 'texengine'
- => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'
- .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')',
- 'timezone'
- => '<b>'.&mt('Timezone in which the course takes place').'</b>',
-
- 'suppress_embed_prompt'
- => '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'.
- ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
- 'hidefromcat'
- => '<b>'.&mt('Exclude from course catalog').'</b><br />'.
- ' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')',
- 'categories'
- => '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'.
- &mt('Display Categories').'</a>',
- 'datelocale'
- => '<b>'.&mt('Locale used for course calendar').'</b>',
- );
- my @Display_Order = ('url','description','courseid','cloners');
- (my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom);
- if ($can_toggle_cat) {
- push(@Display_Order,'hidefromcat');
- }
- if ($can_categorize) {
- push(@Display_Order,'categories');
- }
- push (@Display_Order,('grading',
- 'externalsyllabus',
- 'default_xml_style','pageseparators',
- 'question.email','question.email.text','comment.email',
- 'comment.email.text','policy.email','policy.email.text',
- 'student_classlist_view',
- 'student_classlist_opt_in',
- 'student_classlist_portfiles',
- 'plc.roles.denied','plc.users.denied',
- 'pch.roles.denied','pch.users.denied',
- 'allow_limited_html_in_feedback',
- 'allow_discussion_post_editing',
- 'languages',
- 'timezone',
- 'datelocale',
- 'nothideprivileged',
- 'rndseed',
- 'receiptalg',
- 'problem_stream_switch',
- 'suppress_tries',
- 'suppress_embed_prompt',
- 'default_paper_size',
- 'print_header_format',
- 'disable_receipt_display',
- 'spreadsheet_default_classcalc',
- 'spreadsheet_default_studentcalc',
- 'spreadsheet_default_assesscalc',
- 'hideemptyrows',
- 'default_enrollment_start_date',
- 'default_enrollment_end_date',
- 'tthoptions',
- 'texengine',
- 'disablesigfigs',
- 'disableexampointprint',
- 'task_messages','task_grading'));
- foreach my $parameter (sort(keys(%values))) {
- unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) ||
- ($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/)
- || ($parameter eq 'type')) {
- if (! $descriptions{$parameter}) {
- $descriptions{$parameter}=$parameter;
- push(@Display_Order,$parameter);
- }
- }
- }
-
- foreach my $parameter (@Display_Order) {
- my $description = $descriptions{$parameter};
- # onchange is javascript to automatically check the 'Set' button.
- my $onchange = 'onFocus="javascript:window.document.forms'.
- "['envform'].elements['".$parameter."_setparmval']".
- '.checked=true;"';
- $output .= &Apache::loncommon::start_data_table_row().
- '<td>'.$description.'</td>';
- if ($parameter =~ /^default_enrollment_(start|end)_date$/) {
- $output .= '<td>'.
- &Apache::lonhtmlcommon::date_setter('envform',
- $parameter.'_value',
- $values{$parameter},
- $onchange).
- '</td>';
- } elsif ($parameter eq 'timezone') {
- my $includeempty = 1;
- my $timezone = &Apache::lonlocal::gettimezone();
- $output .= '<td>'.
- &Apache::loncommon::select_timezone($parameter.'_value',
- $timezone,
- $onchange,$includeempty).'</td>';
- } elsif ($parameter eq 'datelocale') {
- my $includeempty = 1;
- my $locale_obj = &Apache::lonlocal::getdatelocale();
- my $currdatelocale;
- if (ref($locale_obj)) {
- $currdatelocale = $locale_obj->id();
- }
- $output .= '<td>'.
- &Apache::loncommon::select_datelocale($parameter.'_value',
- $currdatelocale,
- $onchange,$includeempty).'</td>';
- } elsif ($parameter eq 'categories') {
- my $catdisplay;
- if ($values{'categories'} ne '') {
- my @curritems = split(/\&/,$values{'categories'});
- foreach my $item (@curritems) {
- my ($name,$parent,$pos) = split(/:/,$item);
- $catdisplay .= &unescape($name).'&';
- }
- $catdisplay =~ s/\&$//;
- }
- $output .= '<td>'.
- '<input type="hidden" name="categories_value" value="'.
- $values{'categories'}.'" />'.
- '<input type="textbox" name="categories_display" value="'.
- $catdisplay.'" readonly="readonly" size="40" /></td>';
- } else {
- $output .= '<td>'.
- &Apache::lonhtmlcommon::textbox($parameter.'_value',
- $values{$parameter},
- 40,$onchange).'</td>';
- }
- $output .= '<td>'.
- &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
- '</td>';
- $output .= &Apache::loncommon::end_data_table_row()."\n";
- }
- my $onchange = 'onFocus="javascript:window.document.forms'.
- '[\'envform\'].elements[\'newp_setparmval\']'.
- '.checked=true;"';
- $output.=&Apache::loncommon::start_data_table_row().
- '<td><i>'.&mt('Create New Environment Variable').'</i><br />'.
- '<input type="text" size=40 name="newp_name" '.
- $onchange.' /></td><td>'.
- '<input type="text" size=40 name="newp_value" '.
- $onchange.' /></td><td>'.
- '<input type="checkbox" name="newp_setparmval" /></td>'.
- &Apache::loncommon::end_data_table_row()."\n";
- }
- my %lt=&Apache::lonlocal::texthash(
- 'par' => 'Parameter',
- 'val' => 'Value',
- 'set' => 'Set?',
- 'sav' => 'Save'
- );
-
- my $Parameter=&mt('Parameter');
- my $Value=&mt('Value');
- my $Set=&mt('Set');
- my ($jscript,$categorize_js);
- my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');
- if ($can_categorize) {
- $categorize_js = <<ENDSCRIPT;
-function catsbrowser() {
- var catswin = null;
- var url = '/adm/parmset?action=categorizecourse';
- if (!catswin || catswin.closed) {
- catswin=window.open(url,'categorieswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
- } else {
- catswin.focus();
- }
-}
-ENDSCRIPT
- }
- $jscript = '<script type="text/javascript" language="Javascript">'."\n".
- $browse_js."\n".$categorize_js."\n".'</script>';
- my $start_page =
- &Apache::loncommon::start_page('Set Course Environment',
- $jscript);
- my $end_page =
- &Apache::loncommon::end_page();
- my $end_table=&Apache::loncommon::end_data_table();
- $r->print(<<ENDENV);
-$start_page
-$breadcrumbs
-<form method="post" action="/adm/parmset?action=crsenv" name="envform">
-$setoutput
-<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div>
-$start_table
-$start_header_row
-<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th>
-$end_header_row
-$output
-$end_table
-<input type="submit" name="crsenv" value="$lt{'sav'}" />
-</form>
-$end_page
-ENDENV
-}
-
-sub can_modify_catsettings {
- my ($dom) = @_;
- my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
- my ($can_toggle_cat,$can_categorize);
- if (ref($domconf{'coursecategories'}) eq 'HASH') {
- if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
- $can_toggle_cat = 1;
- }
- if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {
- $can_categorize = 1;
- }
- }
- return ($can_toggle_cat,$can_categorize);
-}
-
-sub assign_course_categories {
- my ($r) = @_;
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $hascats = 0;
- my $cathash;
- my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
- if (ref($domconf{'coursecategories'}) eq 'HASH') {
- $cathash = $domconf{'coursecategories'}{'cats'};
- if (ref($cathash) eq 'HASH') {
- $hascats = 1;
- }
- }
- my $catwin_js;
- if ($hascats) {
- my $alert = &mt('Use \"Save\" in the main window to save course categories');
- $catwin_js = <<ENDSCRIPT;
-<script type="text/javascript">
-
-function updateCategories() {
- var newcategories = '';
- var unescapedcats = '';
- if (document.chgcats.usecategory.length) {
- for (var i=0; i<document.chgcats.usecategory.length; i++) {
- if (document.chgcats.usecategory[i].checked == true) {
- newcategories = newcategories + document.chgcats.usecategory[i].value + '&';
- unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & ';
- }
- }
- if (newcategories.length > 0) {
- newcategories = newcategories.slice(0,-1);
- }
- if (unescapedcats.length > 0) {
- unescapedcats = unescapedcats.slice(0,-3);
- }
- } else {
- if (document.chgcats.usecategory.checked == true) {
- newcategories = document.chgcats.usecategory.value;
- unescapedcats = document.chgcats.catname.value;
- }
- }
- opener.document.envform.categories_value.value = newcategories;
- opener.document.envform.categories_display.value = unescapedcats;
- opener.document.envform.categories_setparmval.checked = true;
- alert("$alert");
- self.close();
- return;
-}
-
-</script>
-ENDSCRIPT
- } else {
- my $onload;
- }
- my $start_page =
- &Apache::loncommon::start_page('Course Categories',$catwin_js,
- {'only_body' => 1,});
- my $end_page = &Apache::loncommon::end_page();
- my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>';
- if ($hascats) {
- my %currsettings =
- &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);
- $categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'.
- '<form name="chgcats" action="/adm/parmset" method="post">'."\n"
- .&Apache::loncommon::assign_categories_table($cathash,
- $currsettings{'categories'})."\n"
- .'<br /><input type="button" name="changes" value="'
- .&mt('Copy to main window').'" '
- .'onclick="javascript:updateCategories()" /></form><br />';
- } else {
- $categoriesform .= &mt('No categories defined for this domain');
- }
- $r->print($start_page.$categoriesform.$end_page);
- return;
-}
-
-##################################################
# Overview mode
##################################################
my $tableopen;
@@ -2957,7 +2534,7 @@
}
if ($part ne $oldpart) {
$r->print(&tableend().
- "\n<span class=\"LC_parm_part\">".&mt('Part').": $part</span>");
+ "\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>");
$oldpart=$part;
}
#
@@ -2992,7 +2569,7 @@
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'.
- $thistype.'">');
+ $thistype.'" />');
$r->print('</td>'.&Apache::loncommon::end_data_table_row());
}
}
@@ -3300,7 +2877,7 @@
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder);
$r->print(&tableend().'<p>'.
- ($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'.
+ ($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'.
&Apache::loncommon::end_page());
}
@@ -3329,7 +2906,7 @@
$r->print('<h3>'.
&mt('These parameters refer to resources that do not exist.').
'</h3>'.
- '<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.'<br />'.
+ '<input type="submit" value="'.&mt('Delete Selected').'" />'.'<br />'.
'<br />');
$r->print(&Apache::loncommon::start_data_table().
'<tr>'.
@@ -3382,7 +2959,7 @@
}
}
$r->print(&Apache::loncommon::end_data_table().'<p>'.
- '<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.
+ '<input type="submit" value="'.&mt('Delete Selected').'" />'.
'</p></form>'.
&Apache::loncommon::end_page());
}
@@ -3471,42 +3048,6 @@
return %data;
}
-##################################################
-##################################################
-
-=pod
-
-=item check_cloners
-
-Checks if new users included in list of allowed cloners
-are valid users. Replaces supplied list with
-cleaned list containing only users with valid usernames
-and domains.
-
-Inputs: $clonelist, $oldcloner
-where $clonelist is ref to array of requested cloners,
-and $oldcloner is ref to array of currently allowed
-cloners.
-
-Returns: string - comma separated list of requested
-cloners (username:domain) who do not exist in system.
-
-=item change_clone
-
-Modifies the list of courses a user can clone (stored
-in the user's environment.db file), called when a
-change is made to the list of users allowed to clone
-a course.
-
-Inputs: $action,$cloner
-where $action is add or drop, and $cloner is identity of
-user for whom cloning ability is to be changed in course.
-
-=cut
-
-##################################################
-##################################################
-
sub extract_cloners {
my ($clonelist,$allowclone) = @_;
if ($clonelist =~ /,/) {
@@ -3622,24 +3163,10 @@
}
-##################################################
-##################################################
-
-=pod
-
-=item * header
-
-Output html header for page
-
-=cut
-
-##################################################
-##################################################
sub header {
return &Apache::loncommon::start_page('Parameter Manager');
}
-##################################################
-##################################################
+
sub print_main_menu {
my ($r,$parm_permission)=@_;
#
@@ -3656,8 +3183,8 @@
my @menu =
( { divider=>'Settings for Your Course',
},
- { text => 'Set Course Environment',
- action => 'crsenv',
+ { text => 'Edit course configuration',
+ url => '/adm/courseprefs?origin=params',
permission => $parm_permission,
help => 'Course_Environment',
},
@@ -3744,7 +3271,7 @@
}
if (!($options =~ /deleted/)) {
my @options= ( ['active', 'Show to student'],
- ['stuadd', 'Provide text area for students to type catalog information'],
+ ['stuadd', 'Provide text area for students to type metadata'],
['choices','Provide choices for students to select from']);
# ['onlyone','Student may select only one choice']);
if ($added_flag) {
@@ -3769,20 +3296,20 @@
my $single_checked;
if ($options =~ m/onlyone/) {
$multiple_checked = "";
- $single_checked = " CHECKED ";
+ $single_checked = ' checked="checked"';
} else {
- $multiple_checked = " CHECKED ";
+ $multiple_checked = ' checked="checked"';
$single_checked = "";
}
$output .= &Apache::loncommon::continue_data_table_row();
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata">
- <input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/>
- Student may select multiple choices from list</span></td>';
+ <input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked.' />'.
+ &mt('Student may select multiple choices from list').'</span></td>';
$output .= &Apache::loncommon::end_data_table_row();
$output .= &Apache::loncommon::continue_data_table_row();
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata">
- <input type="radio" name="'.$field_name.'_onlyone" value="single" '.$single_checked.'/>
- Student may select only one choice from list</span></td>';
+ <input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' />'.
+ &mt('Student may select only one choice from list').'</span></td>';
$output .= &Apache::loncommon::end_data_table_row();
}
return ($output);
@@ -4173,12 +3700,12 @@
} elsif ($defkeytype{$tempkey} eq 'string_yesno') {
my $yeschecked='';
my $nochecked='';
- if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked='checked="checked"'; }
- if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; }
+ if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked=' checked="checked"'; }
+ if (&rulescache($tempkey.'_value') eq 'no') { $nochecked=' checked="checked"'; }
$r->print(<<ENDYESNO);
-<label><input type="radio" name="$tempkey\_value" value="yes" $yeschecked /> $lt{'yes'}</label><br />
-<label><input type="radio" name="$tempkey\_value" value="no" $nochecked /> $lt{'no'}</label>
+<label><input type="radio" name="$tempkey\_value" value="yes"$yeschecked /> $lt{'yes'}</label><br />
+<label><input type="radio" name="$tempkey\_value" value="no"$nochecked /> $lt{'no'}</label>
ENDYESNO
} else {
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />');
@@ -4186,8 +3713,8 @@
$r->print('</td>'.&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table().
- "\n<input type='submit' name='storerules' value='".
- &mt('Save Rules')."' /></form>\n".
+ "\n".'<input type="submit" name="storerules" value='".
+ &mt('Save')."' /></form>'."\n".
&Apache::loncommon::end_page());
return;
}
@@ -4422,26 +3949,100 @@
$r->print(&Apache::loncommon::end_page());
}
+sub update_slots {
+ my ($slot_name,$cdom,$cnum,$symb,$uname,$udom) = @_;
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+ if (!keys(%slot)) {
+ return 'error: slot does not exist';
+ }
+ my $max=$slot{'maxspace'};
+ if (!defined($max)) { $max=99999; }
+
+ my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
+ "^$slot_name\0");
+ my ($tmp)=%consumed;
+ if ($tmp=~/^error: 2 / ) {
+ return 'error: unable to determine current slot status';
+ }
+ my $last=0;
+ foreach my $key (keys(%consumed)) {
+ my $num=(split('\0',$key))[1];
+ if ($num > $last) { $last=$num; }
+ if ($consumed{$key}->{'name'} eq $uname.':'.$udom) {
+ return 'ok';
+ }
+ }
+
+ if (scalar(keys(%consumed)) >= $max) {
+ return 'error: no space left in slot';
+ }
+ my $wanted=$last+1;
+
+ my %reservation=('name' => $uname.':'.$udom,
+ 'timestamp' => time,
+ 'symb' => $symb);
+
+ my $success=&Apache::lonnet::newput('slot_reservations',
+ {"$slot_name\0$wanted" =>
+ \%reservation},
+ $cdom, $cnum);
+ if ($success eq 'ok') {
+ my %storehash = (
+ symb => $symb,
+ slot => $slot_name,
+ action => 'reserve',
+ context => 'parameter',
+ );
+ &Apache::lonnet::instructor_log('slotreservationslog',\%storehash,
+ '',$uname,$udom,$cnum,$cdom);
+
+ &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash,
+ '',$uname,$udom,$uname,$udom);
+ }
+ return $success;
+}
+
+sub delete_slots {
+ my ($slot_name,$cdom,$cnum,$uname,$udom,$symb) = @_;
+ my $delresult;
+ my %consumed = &Apache::lonnet::dump('slot_reservations',$cdom,
+ $cnum, "^$slot_name\0");
+ if (&Apache::lonnet::error(%consumed)) {
+ return 'error: unable to determine current slot status';
+ }
+ my ($tmp)=%consumed;
+ if ($tmp=~/^error: 2 /) {
+ return 'error: unable to determine current slot status';
+ }
+ foreach my $key (keys(%consumed)) {
+ if ($consumed{$key}->{'name'} eq $uname.':'.$udom) {
+ my $num=(split('\0',$key))[1];
+ my $entry = $slot_name.'\0'.$num;
+ $delresult = &Apache::lonnet::del('slot_reservations',[$entry],
+ $cdom,$cnum);
+ if ($delresult eq 'ok') {
+ my %storehash = (
+ symb => $symb,
+ slot => $slot_name,
+ action => 'release',
+ context => 'parameter',
+ );
+ &Apache::lonnet::instructor_log('slotreservationslog',\%storehash,
+ 1,$uname,$udom,$cnum,$cdom);
+ &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash,
+ 1,$uname,$udom,$uname,$udom);
+ }
+ }
+ }
+ return $delresult;
+}
+
sub check_for_course_info {
my $navmap = Apache::lonnavmaps::navmap->new();
return 1 if ($navmap);
return 0;
}
-##################################################
-##################################################
-
-=pod
-
-=item * handler
-
-Main handler. Calls &assessparms and &crsenv subroutines.
-
-=cut
-
-##################################################
-##################################################
-
sub handler {
my $r=shift;
@@ -4496,10 +4097,6 @@
$r->print(&header());
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager'));
&print_main_menu($r,$parm_permission);
- } elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv',
- text=>"Course Environment"});
- &crsenv($r);
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) {
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
@@ -4567,11 +4164,3 @@
1;
__END__
-=pod
-
-=back
-
-=cut
-
-
-
--raeburn1242842584--