version 1.406, 2008/08/28 03:04:41
|
version 1.441, 2009/03/31 17:04:15
|
Line 44 This module sets coursewide and assessme
|
Line 44 This module sets coursewide and assessme
|
|
|
=head1 INTERNAL SUBROUTINES |
=head1 INTERNAL SUBROUTINES |
|
|
=over 4 |
=over |
|
|
=cut |
|
|
|
################################################################### |
|
################################################################### |
|
|
|
package Apache::lonparmset; |
|
|
|
use strict; |
|
use Apache::lonnet; |
|
use Apache::Constants qw(:common :http REDIRECT); |
|
use Apache::lonhtmlcommon(); |
|
use Apache::loncommon; |
|
use GDBM_File; |
|
use Apache::lonhomework; |
|
use Apache::lonxml; |
|
use Apache::lonlocal; |
|
use Apache::lonnavmaps; |
|
use Apache::longroup; |
|
use Apache::lonrss; |
|
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
|
################################################## |
|
################################################## |
|
|
|
=pod |
=pod |
|
|
=item parmval |
=item parmval() |
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
|
|
Line 98 Returns: A list, the first item is the
|
Line 73 Returns: A list, the first item is the
|
2 - Map or Folder level for specific student |
2 - Map or Folder level for specific student |
1 - resource 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 crsenv() |
|
|
|
Show and set course data and parameters. This is a large routine that should |
|
be simplified and shortened... someday. |
|
|
|
Inputs: $r |
|
|
|
Returns: nothing |
|
|
|
=item can_modify_catsettings() |
|
|
|
=item assign_course_categories() |
|
|
|
=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 and &crsenv subroutines. |
|
|
|
|
|
=back |
|
|
=cut |
=cut |
|
|
################################################## |
################################################################### |
|
################################################################### |
|
|
|
package Apache::lonparmset; |
|
|
|
use strict; |
|
use Apache::lonnet; |
|
use Apache::Constants qw(:common :http REDIRECT); |
|
use Apache::lonhtmlcommon(); |
|
use Apache::loncommon; |
|
use GDBM_File; |
|
use Apache::lonhomework; |
|
use Apache::lonxml; |
|
use Apache::lonlocal; |
|
use Apache::lonnavmaps; |
|
use Apache::longroup; |
|
use Apache::lonrss; |
|
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
sub parmval { |
sub parmval { |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
Line 302 sub reset_caches {
|
Line 550 sub reset_caches {
|
} |
} |
} |
} |
|
|
|
|
|
|
sub preset_defaults { |
sub preset_defaults { |
my $type=shift; |
my $type=shift; |
if (&rulescache($type.'_action') eq 'default') { |
if (&rulescache($type.'_action') eq 'default') { |
Line 316 sub preset_defaults {
|
Line 566 sub preset_defaults {
|
} |
} |
} |
} |
|
|
################################################## |
|
|
|
|
|
sub date_sanity_info { |
sub date_sanity_info { |
my $checkdate=shift; |
my $checkdate=shift; |
Line 325 sub date_sanity_info {
|
Line 576 sub date_sanity_info {
|
my $crsprefix='course.'.$env{'request.course.id'}.'.'; |
my $crsprefix='course.'.$env{'request.course.id'}.'.'; |
if ($env{$crsprefix.'default_enrollment_end_date'}) { |
if ($env{$crsprefix.'default_enrollment_end_date'}) { |
if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { |
if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { |
$result.='<br />'.&mt('After course enrollment end!'); |
$result.='<div class="LC_warning">' |
|
.&mt('After course enrollment end!') |
|
.'</div>'; |
} |
} |
} |
} |
if ($env{$crsprefix.'default_enrollment_start_date'}) { |
if ($env{$crsprefix.'default_enrollment_start_date'}) { |
if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { |
if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { |
$result.='<br />'.&mt('Before course enrollment start!'); |
$result.='<div class="LC_warning">' |
|
.&mt('Before course enrollment start!') |
|
.'</div>'; |
} |
} |
} |
} |
|
# Preparation for additional warnings about dates in the past/future. |
|
# An improved, more context sensitive version is recommended, |
|
# e.g. warn for due and answer dates which are defined before the corresponding open date, etc. |
|
# if ($checkdate<time) { |
|
# $result.='<div class="LC_info">' |
|
# .'('.&mt('in the past').')' |
|
# .'</div>'; |
|
# } |
|
# if ($checkdate>time) { |
|
# $result.='<div class="LC_info">' |
|
# .'('.&mt('in the future').')' |
|
# .'</div>'; |
|
# } |
return $result; |
return $result; |
} |
} |
################################################## |
################################################## |
Line 354 sub storeparm {
|
Line 622 sub storeparm {
|
&storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup); |
&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; |
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
Line 519 sub storeparm_by_symb_inner {
|
Line 776 sub storeparm_by_symb_inner {
|
return ''; |
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 { |
sub valout { |
my ($value,$type,$editable)=@_; |
my ($value,$type,$editable)=@_; |
my $result = ''; |
my $result = ''; |
Line 551 sub valout {
|
Line 790 sub valout {
|
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
|
my @timer; |
$year=$year-70; |
$year=$year-70; |
$mday--; |
$mday--; |
if ($year) { |
if ($year) { |
$result.=$year.' yrs '; |
# $result.=&mt('[quant,_1,yr]',$year).' '; |
|
push(@timer,&mt('[quant,_1,yr]',$year)); |
} |
} |
if ($mon) { |
if ($mon) { |
$result.=$mon.' mths '; |
# $result.=&mt('[quant,_1,mth]',$mon).' '; |
|
push(@timer,&mt('[quant,_1,mth]',$mon)); |
} |
} |
if ($mday) { |
if ($mday) { |
$result.=$mday.' days '; |
# $result.=&mt('[quant,_1,day]',$mday).' '; |
|
push(@timer,&mt('[quant,_1,day]',$mday)); |
} |
} |
if ($hour) { |
if ($hour) { |
$result.=$hour.' hrs '; |
# $result.=&mt('[quant,_1,hr]',$hour).' '; |
|
push(@timer,&mt('[quant,_1,hr]',$hour)); |
} |
} |
if ($min) { |
if ($min) { |
$result.=$min.' mins '; |
# $result.=&mt('[quant,_1,min]',$min).' '; |
|
push(@timer,&mt('[quant,_1,min]',$min)); |
} |
} |
if ($sec) { |
if ($sec) { |
$result.=$sec.' secs '; |
# $result.=&mt('[quant,_1,sec]',$sec).' '; |
|
push(@timer,&mt('[quant,_1,sec]',$sec)); |
|
} |
|
# $result=~s/\s+$//; |
|
if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable |
|
push(@timer,&mt('[quant,_1,sec]',0)); |
} |
} |
$result=~s/\s+$//; |
$result.=join(", ",@timer); |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = &Apache::lonlocal::locallocaltime($value). |
$result = &Apache::lonlocal::locallocaltime($value). |
&date_sanity_info($value); |
&date_sanity_info($value); |
Line 583 sub valout {
|
Line 833 sub valout {
|
return $result; |
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 { |
sub plink { |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my $winvalue=$value; |
my $winvalue=$value; |
Line 615 sub plink {
|
Line 848 sub plink {
|
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
my $valout = &valout($value,$type,1); |
my $valout = &valout($value,$type,1); |
|
my $unencmarker = $marker; |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
\$hour, \$min, \$sec) { |
\$hour, \$min, \$sec) { |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item =~ s/\'/\\\'/g; |
$$item =~ s/\'/\\\'/g; |
} |
} |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
$valout.'</a></td></tr></table>'; |
$valout.'</a></td></tr></table>'; |
Line 683 sub startpage {
|
Line 917 sub startpage {
|
my %loaditems = ('onunload' => "pclose()", |
my %loaditems = ('onunload' => "pclose()", |
'onload' => "group_or_section('cgroup')",); |
'onload' => "group_or_section('cgroup')",); |
|
|
|
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
|
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
|
text=>"Problem Parameters"}); |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Table Mode", |
|
help => 'Course_Setting_Parameters'}); |
|
} |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&page_js(), |
&page_js(), |
Line 693 sub startpage {
|
Line 936 sub startpage {
|
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value='' name="pres_value" /> |
<input type="hidden" value="" name="pres_value" /> |
<input type="hidden" value='' name="pres_type" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value='' name="pres_marker" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value='1' name="prevvisit" /> |
<input type="hidden" value="1" name="prevvisit" /> |
ENDHEAD |
ENDHEAD |
} |
} |
|
|
Line 728 sub print_row {
|
Line 971 sub print_row {
|
my $parm=$$display{$which}; |
my $parm=$$display{$which}; |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
$r->print('<td bgcolor='.$defbgtwo.' align="center">' |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
.$$part{$which}.'</td>'); |
.$$part{$which}.'</td>'); |
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
if ($automatic) { |
if ($automatic) { |
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>'; |
$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; |
my $thismarker=$which; |
$thismarker=~s/^parameter\_//; |
$thismarker=~s/^parameter\_//; |
Line 814 sub print_row {
|
Line 1057 sub print_row {
|
} |
} |
|
|
} # end of $parmlev if/else |
} # 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') { |
if ($parmlev eq 'full') { |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
'.'.$$name{$which},$$symbp{$rid}); |
'.'.$$name{$which},$$symbp{$rid}); |
my $sessionvaltype=$typeoutpar[$result]; |
my $sessionvaltype=$typeoutpar[$result]; |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
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).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
} |
} |
Line 831 sub print_row {
|
Line 1074 sub print_row {
|
|
|
sub print_td { |
sub print_td { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
$r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg). |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
' align="center">'); |
';" align="center">'); |
if ($which<11 || $which > 12) { |
my $nolink = 0; |
$r->print(&plink($$typeoutpar[$which], |
if ($which == 11 || $which == 12) { |
$$display{$value},$$outpar[$which], |
$nolink = 1; |
$mprefix."$which",'parmform.pres','psub')); |
} elsif ($mprefix =~ /availablestudent\&$/) { |
|
if ($which > 3) { |
|
$nolink = 1; |
|
} |
|
} |
|
if ($nolink) { |
|
$r->print(&valout($$outpar[$which],$$typeoutpar[$which])); |
} else { |
} 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"); |
$r->print('</td>'."\n"); |
} |
} |
Line 858 sub print_usergroups {
|
Line 1109 sub print_usergroups {
|
my $grp_parm; |
my $grp_parm; |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '"#AAFFAA"'; |
$bgcolor = '#AAFFAA'; |
$grp_parm = &valout($coursereply,$resulttype); |
$grp_parm = &valout($coursereply,$resulttype); |
} |
} |
$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) { |
if ($resultgroup && $resultlevel) { |
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm; |
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm; |
} else { |
} else { |
Line 870 sub print_usergroups {
|
Line 1121 sub print_usergroups {
|
} |
} |
$output .= '</td>'; |
$output .= '</td>'; |
} else { |
} else { |
$output .= '<td bgcolor='.$bgcolor.'> </td>'; |
$output .= '<td style="background-color:'.$bgcolor.';"> </td>'; |
} |
} |
return ($coursereply,$output,$grp_parm,$resultgroup); |
return ($coursereply,$output,$grp_parm,$resultgroup); |
} |
} |
Line 899 sub parm_control_group {
|
Line 1150 sub parm_control_group {
|
return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
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 { |
sub extractResourceInformation { |
my $ids = shift; |
my $ids = shift; |
Line 971 sub extractResourceInformation {
|
Line 1190 sub extractResourceInformation {
|
# |
# |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
my ($display,$parmdis); |
my $parmdis = $display; |
$display = &standard_parameter_names($name); |
$parmdis =~ s/\[Part.*$//g; |
if ($display eq '') { |
|
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
|
$parmdis = $display; |
|
$parmdis =~ s/\s*\[Part.*$//g; |
|
} else { |
|
$parmdis = $display; |
|
} |
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
if (ref($defkeytype)) { |
if (ref($defkeytype)) { |
$$defkeytype{$name}= |
$$defkeytype{$name}= |
Line 985 sub extractResourceInformation {
|
Line 1210 sub extractResourceInformation {
|
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
$$allparts{$part} = "Part: $part"; |
$$allparts{$part} = &mt('Part: [_1]',$part); |
# |
# |
# Remember all keys going with this resource |
# Remember all keys going with this resource |
# |
# |
Line 1025 sub extractResourceInformation {
|
Line 1250 sub extractResourceInformation {
|
} |
} |
|
|
|
|
################################################## |
|
################################################## |
|
|
|
sub isdateparm { |
sub isdateparm { |
my $type=shift; |
my $type=shift; |
Line 1099 sub parmmenu {
|
Line 1322 sub parmmenu {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
$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; |
my $cnt=0; |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
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.'"'); |
$r->print('value="'.$tempkey.'"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print('>'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
: $tempkey) |
: $tempkey) |
.'</label></td>'); |
.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
$cnt=0; |
$cnt=0; |
} |
} |
} |
} |
$r->print(' |
$r->print('</tr>' |
</tr><tr id=\"LC_parm_overview_parm_menu_selectors\"><td> |
.'<tr id="LC_parm_overview_parm_menu_selectors">' |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
.'<td valign="top">' |
<a href="javascript:checkstandard()">Select Common Only</a> |
.'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>' |
</td><td> |
.'<span class="LC_nobreak">' |
<a href="javascript:checkdates()">Add Problem Dates</a> |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
<a href="javascript:checkcontdates()">Add Content Dates</a><br /> |
.'</span>' |
<a href="javascript:checkdisset()">Add Discussion Settings</a> |
.'<br />' |
<a href="javascript:checkvisi()">Add Visibilities</a><br /> |
.'<span class="LC_nobreak">' |
<a href="javascript:checkparts()">Add Part Parameters</a> |
.'• <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>' |
</td><td> |
.'</span>' |
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
.'<br />' |
</td> |
.'<span class="LC_nobreak">' |
'); |
.'• <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>' |
$r->print('</tr></table>'); |
.'</span>' |
|
.'</fieldset>' |
|
.'</td>' |
|
.'<td colspan="2" valign="top">' |
|
.'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>' |
|
.'<span class="LC_nobreak">' |
|
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
|
.'</span>' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>' |
|
.'</span>' |
|
# .'<br />' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>' |
|
.'</span>' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>' |
|
.'</span>' |
|
# .'<br />' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>' |
|
.'</span>' |
|
.'</fieldset>' |
|
.'</td>' |
|
.'</tr></table>' |
|
); |
} |
} |
|
|
sub partmenu { |
sub partmenu { |
my ($r,$allparts,$psprt)=@_; |
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('<option value="all"'); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
Line 1160 sub usermenu {
|
Line 1408 sub usermenu {
|
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my %lt=&Apache::lonlocal::texthash( |
|
'se' => "Section", |
|
'gr' => "Group", |
|
'fu' => "For User", |
|
'oi' => "or ID", |
|
'ad' => "at Domain" |
|
); |
|
my $sections=''; |
my $sections=''; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
|
|
my $groups; |
my $groups; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash = &Apache::longroup::coursegroups(); |
|
|
|
my $g_s_header=''; |
|
my $g_s_footer=''; |
|
|
if (%sectionhash) { |
if (%sectionhash) { |
$sections=$lt{'se'}.': <select name="csec"'; |
$sections=&mt('Section:').' <select name="csec"'; |
if (%grouphash && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
Line 1186 sub usermenu {
|
Line 1431 sub usermenu {
|
} |
} |
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
|
|
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
$sections .= ' or '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
function group_or_section(caller) { |
function group_or_section(caller) { |
Line 1214 function group_or_section(caller) {
|
Line 1460 function group_or_section(caller) {
|
} |
} |
|
|
if (%grouphash) { |
if (%grouphash) { |
$groups=$lt{'gr'}.': <select name="cgroup"'; |
$groups=&mt('Group:').' <select name="cgroup"'; |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
Line 1236 function group_or_section(caller) {
|
Line 1482 function group_or_section(caller) {
|
} |
} |
$groups.='</select>'; |
$groups.='</select>'; |
} |
} |
$r->print(<<ENDMENU); |
|
<b> |
if (%sectionhash || %grouphash) { |
$sections |
$g_s_header='<fieldset><legend>'.&mt('Group/Section').'</legend><div>'; |
$groups |
$g_s_footer='</div></fieldset>'; |
<br /> |
} |
$lt{'fu'} |
|
<input type="text" value="$uname" size="12" name="uname" /> |
$r->print('<b>' |
$lt{'oi'} |
.$g_s_header |
<input type="text" value="$id" size="12" name="id" /> |
.$sections |
$lt{'ad'} |
.$groups |
$chooseopt |
.$g_s_footer |
</b> |
.'<fieldset><legend>'.&mt('User').'</legend><div>' |
ENDMENU |
.&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]' |
|
,'<input type="text" value="'.$uname.'" size="12" name="uname" />' |
|
,'<input type="text" value="'.$id.'" size="12" name="id" /> ' |
|
,$chooseopt) |
|
.'</div></fieldset>' |
|
.'</b>' |
|
); |
} |
} |
|
|
sub displaymenu { |
sub displaymenu { |
Line 1256 sub displaymenu {
|
Line 1508 sub displaymenu {
|
$r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
$r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
&mt('Select Parts to View').'</th></tr><tr><td>'); |
&mt('Select Parts to View').'</th></tr><tr><td>'); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print('</td><td>'); |
$r->print('</td><td valign="top" align="center">'); |
&partmenu($r,$allparts,$psprt); |
&partmenu($r,$allparts,$psprt); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
} |
} |
Line 1295 sub sectionmenu {
|
Line 1547 sub sectionmenu {
|
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
return if (!%sectionhash); |
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) { |
foreach my $s ('all',sort keys %sectionhash) { |
$r->print(' <option value="'.$s.'"'); |
$r->print(' <option value="'.$s.'"'); |
foreach (@{$selectedsections}) { |
foreach (@{$selectedsections}) { |
Line 1314 sub groupmenu {
|
Line 1566 sub groupmenu {
|
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash = &Apache::longroup::coursegroups(); |
return if (!%grouphash); |
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))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$r->print(' <option value="'.$group.'"'); |
foreach (@{$selectedgroups}) { |
foreach (@{$selectedgroups}) { |
Line 1364 sub sortmenu {
|
Line 1616 sub sortmenu {
|
my ($r,$sortorder)=@_; |
my ($r,$sortorder)=@_; |
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"'); |
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"'); |
if ($sortorder eq '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(' />'.&mt('Sort by realm first, then student (group/section)')); |
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"'); |
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"'); |
if ($sortorder eq 'studentrealm') { |
if ($sortorder eq 'studentrealm') { |
$r->print(' checked="on"'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
'</label>'); |
'</label>'); |
Line 1398 sub standardkeyorder {
|
Line 1650 sub standardkeyorder {
|
'parameter_0_discusshide' => 20); |
'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 { |
sub assessparms { |
|
|
my $r=shift; |
my $r=shift; |
Line 1582 sub assessparms {
|
Line 1805 sub assessparms {
|
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
for (my $i=0;$i<=$#markers;$i++) { |
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]), |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$values[$i], |
$values[$i], |
$types[$i], |
$types[$i], |
Line 1608 sub assessparms {
|
Line 1864 sub assessparms {
|
if (!$pssymb) { |
if (!$pssymb) { |
$r->print('<table border="1"><tr><td>'); |
$r->print('<table border="1"><tr><td>'); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
|
$r->print('</td>'); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
$r->print('<td>'); |
$r->print('<td>'); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('</td></tr></table>'); |
$r->print('</tr></table>'); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
Line 1650 sub assessparms {
|
Line 1907 sub assessparms {
|
$coursespan += 3; |
$coursespan += 3; |
} |
} |
|
|
$r->print('<p><table border=2>'); |
$r->print('<p><table border="2">'); |
$r->print('<tr><td colspan=5></td>'); |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<th colspan='.($coursespan).'>'.&mt('Any User').'</th>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
if ($uname) { |
if ($uname) { |
if (@usersgroups > 1) { |
if (@usersgroups > 1) { |
$userspan ++; |
$userspan ++; |
Line 1678 sub assessparms {
|
Line 1935 sub assessparms {
|
'fr' => 'for Resource' |
'fr' => 'for Resource' |
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan=3>$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
<th colspan=1>$lt{'ic'}</th> |
<th colspan="1">$lt{'ic'}</th> |
|
|
ENDTABLETWO |
ENDTABLETWO |
if ($csec) { |
if ($csec) { |
$r->print("<th colspan=3>". |
$r->print('<th colspan="3">'. |
&mt("in Section")." $csec</th>"); |
&mt("in Section")." $csec</th>"); |
} |
} |
if ($cgroup) { |
if ($cgroup) { |
$r->print("<th colspan=3>". |
$r->print('<th colspan="3">'. |
&mt("in Group")." $cgroup</th>"); |
&mt("in Group")." $cgroup</th>"); |
} |
} |
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
Line 1730 ENDTABLEHEADFOUR
|
Line 1987 ENDTABLEHEADFOUR
|
|| |
|| |
($pssymb && $pssymb eq $symbp{$rid})) { |
($pssymb && $pssymb eq $symbp{$rid})) { |
# ------------------------------------------------------ Entry for one resource |
# ------------------------------------------------------ Entry for one resource |
if ($defbgone eq '"#E0E099"') { |
if ($defbgone eq '#E0E099') { |
$defbgone='"#E0E0DD"'; |
$defbgone='#E0E0DD'; |
} else { |
} else { |
$defbgone='"#E0E099"'; |
$defbgone='#E0E099'; |
} |
} |
if ($defbgtwo eq '"#FFFF99"') { |
if ($defbgtwo eq '#FFFF99') { |
$defbgtwo='"#FFFFDD"'; |
$defbgtwo='#FFFFDD'; |
} else { |
} else { |
$defbgtwo='"#FFFF99"'; |
$defbgtwo='#FFFF99'; |
} |
} |
if ($defbgthree eq '"#FFBB99"') { |
if ($defbgthree eq '#FFBB99') { |
$defbgthree='"#FFBBDD"'; |
$defbgthree='#FFBBDD'; |
} else { |
} else { |
$defbgthree='"#FFBB99"'; |
$defbgthree='#FFBB99'; |
} |
} |
|
|
my $thistitle=''; |
my $thistitle=''; |
Line 1760 ENDTABLEHEADFOUR
|
Line 2017 ENDTABLEHEADFOUR
|
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
$display{$_}=&Apache::lonnet::metadata($uri,$_.'.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; |
|
} |
unless ($display{$_}) { $display{$_}=''; } |
unless ($display{$_}) { $display{$_}=''; } |
$display{$_}.=' ('.$name{$_}.')'; |
$display{$_}.=' ('.$name{$_}.')'; |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
Line 1772 ENDTABLEHEADFOUR
|
Line 2038 ENDTABLEHEADFOUR
|
if ($totalparms>0) { |
if ($totalparms>0) { |
my $firstrow=1; |
my $firstrow=1; |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
$r->print('<tr><td bgcolor='.$defbgone. |
$r->print('<tr><td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'><tt><font size=-1>'. |
'><tt><font size="-1">'. |
join(' / ',split(/\//,$uri)). |
join(' / ',split(/\//,$uri)). |
'</font></tt><p><b>'. |
'</font></tt><p><b>'. |
"<a href=\"javascript:openWindow('". |
"<a href=\"javascript:openWindow('". |
Line 1787 ENDTABLEHEADFOUR
|
Line 2053 ENDTABLEHEADFOUR
|
$r->print(' ('.$thistitle.')'); |
$r->print(' ('.$thistitle.')'); |
} |
} |
$r->print('</a></b></td>'); |
$r->print('</a></b></td>'); |
$r->print('<td bgcolor='.$defbgtwo. |
$r->print('<td style="background-color:'.$defbgtwo.';"'. |
' rowspan='.$totalparms.'>'.$typep{$rid}. |
' rowspan='.$totalparms.'>'.$typep{$rid}. |
'</td>'); |
'</td>'); |
|
|
$r->print('<td bgcolor='.$defbgone. |
$r->print('<td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
|
|
Line 1814 ENDTABLEHEADFOUR
|
Line 2080 ENDTABLEHEADFOUR
|
} # end of full |
} # end of full |
#--------------------------------------------------- Entry for parm level map |
#--------------------------------------------------- Entry for parm level map |
if ($parmlev eq 'map') { |
if ($parmlev eq 'map') { |
my $defbgone = '"E0E099"'; |
my $defbgone = '#E0E099'; |
my $defbgtwo = '"FFFF99"'; |
my $defbgtwo = '#FFFF99'; |
my $defbgthree = '"FFBB99"'; |
my $defbgthree = '#FFBB99'; |
|
|
my %maplist; |
my %maplist; |
|
|
Line 1867 ENDTABLEHEADFOUR
|
Line 2133 ENDTABLEHEADFOUR
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$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}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
Line 1904 ENDTABLEHEADFOUR
|
Line 2179 ENDTABLEHEADFOUR
|
,'<font color="red"><i>'.$coursename.'</i></font>' |
,'<font color="red"><i>'.$coursename.'</i></font>' |
) |
) |
."<br /></h4>\n" |
."<br /></h4>\n" |
); |
); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p>'.&Apache::loncommon::start_data_table() |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
.&Apache::loncommon::start_data_table_header_row() |
$r->print('<th>'.&mt('Default Value').'</th>'); |
.'<th>'.&mt('Parameter Name').'</th>' |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
.'<th>'.&mt('Default Value').'</th>' |
|
.'<th>'.&mt('Parameter in Effect').'</th>' |
|
.&Apache::loncommon::end_data_table_header_row() |
|
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
$r->print("</table></div>"); |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
|
.'</div>' |
|
); |
} # end each map |
} # end each map |
} # end of $parmlev eq map |
} # end of $parmlev eq map |
#--------------------------------- Entry for parm level general (Course level) |
#--------------------------------- Entry for parm level general (Course level) |
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
my $defbgone = '"E0E099"'; |
my $defbgone = '#E0E099'; |
my $defbgtwo = '"FFFF99"'; |
my $defbgtwo = '#FFFF99'; |
my $defbgthree = '"FFBB99"'; |
my $defbgthree = '#FFBB99'; |
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid="0.0"; |
my $mapid="0.0"; |
Line 1955 ENDTABLEHEADFOUR
|
Line 2235 ENDTABLEHEADFOUR
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$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}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
Line 1968 ENDTABLEHEADFOUR
|
Line 2257 ENDTABLEHEADFOUR
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
my $setdef=&mt("Set Defaults for All Resources in Course"); |
my $setdef=&mt("Set Defaults for All Resources in Course"); |
$r->print(<<ENDMAPONE); |
$r->print(<<ENDMAPONE); |
<center><h4>$setdef |
<center> |
|
<h4>$setdef |
<font color="red"><i>$coursename</i></font><br /> |
<font color="red"><i>$coursename</i></font><br /> |
ENDMAPONE |
ENDMAPONE |
if ($uname) { |
if ($uname) { |
Line 1982 ENDMAPONE
|
Line 2272 ENDMAPONE
|
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p>'.&Apache::loncommon::start_data_table() |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
.&Apache::loncommon::start_data_table_header_row() |
$r->print('<th>'.&mt('Default Value').'</th>'); |
.'<th>'.&mt('Parameter Name').'</th>' |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
.'<th>'.&mt('Default Value').'</th>' |
|
.'<th>'.&mt('Parameter in Effect').'</th>' |
|
.&Apache::loncommon::end_data_table_header_row() |
|
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
$r->print("</table></center>"); |
$r->print(&Apache::loncommon::end_data_table() |
|
.'</p>' |
|
.'</center>' |
|
); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
################################################## |
|
################################################## |
|
|
|
=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 { |
sub crsenv { |
my $r=shift; |
my $r=shift; |
my $setoutput=''; |
my $setoutput=''; |
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
|
text=>"Course Environment"}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
my (%crsinfo,$chome); |
my (%crsinfo,$chome); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
|
# |
# |
# Go through list of changes |
# Go through list of changes |
Line 2038 sub crsenv {
|
Line 2320 sub crsenv {
|
if ($name eq 'newp') { |
if ($name eq 'newp') { |
$name = $env{'form.newp_name'}; |
$name = $env{'form.newp_name'}; |
} |
} |
|
if ($name =~ /^rolenames_([^_]+)$/) { |
|
$name = $1.'.plaintext'; |
|
my $standardtitle = |
|
&Apache::lonnet::plaintext($1,$crstype,$env{'request.course.id'},1); |
|
my %adv_roles = |
|
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); |
|
if ($value ne '') { |
|
foreach my $role (keys(%adv_roles)) { |
|
if ($role =~ m{^cr/$match_domain/$match_name/\Q$value\E$}) { |
|
$setoutput.= '<span class="LC_error">'. |
|
&mt('Requested replacement title for [_1] role is already used as the name of a custom role ([_2]).',$standardtitle,$value). |
|
'</span><br />'; |
|
undef($value); |
|
} |
|
} |
|
} |
|
} |
if ($name eq 'url') { |
if ($name eq 'url') { |
$value=~s/^\/res\///; |
$value=~s/^\/res\///; |
my $bkuptime=time; |
my $bkuptime=time; |
Line 2088 sub crsenv {
|
Line 2387 sub crsenv {
|
my ($name,$domain) = split(':',$user); |
my ($name,$domain) = split(':',$user); |
if (!defined($user) || !defined($domain)) { |
if (!defined($user) || !defined($domain)) { |
$setoutput.= '<br /> <span class="LC_error">'. |
$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). |
&mt("Invalid e-mail address specified, address must be of the form username:domain what was specified was ([_1])",$user). |
'</span>'; |
'</span>'; |
undef($value); |
undef($value); |
} elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { |
} elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { |
$setoutput.= '<br /> <span class="LC_error">'. |
$setoutput.= '<br /> <span class="LC_error">'. |
&mt("Invalid email address specified, user [_1] is unknown.",$name). |
&mt("Invalid e-mail address specified, user [_1] is unknown.",$name). |
'</span>'; |
'</span>'; |
undef($value); |
undef($value); |
} |
} |
Line 2199 sub crsenv {
|
Line 2498 sub crsenv {
|
} |
} |
} |
} |
|
|
my $start_table =&Apache::loncommon::start_data_table(); |
|
my $start_header_row=&Apache::loncommon::start_data_table_header_row(); |
|
my $end_header_row =&Apache::loncommon::end_data_table_header_row(); |
|
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
|
|
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
Line 2213 sub crsenv {
|
Line 2509 sub crsenv {
|
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $output=''; |
my $output=''; |
|
my $output_SB = ''; # will be replaced by "$output" when all changes are done |
my $can_categorize; |
my $can_categorize; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'par' => 'Parameter', |
|
'val' => 'Value', |
|
'set' => 'Set?', |
|
'sav' => 'Save', |
|
); |
if (! exists($values{'con_lost'})) { |
if (! exists($values{'con_lost'})) { |
my %descriptions= |
my %descriptions= |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
Line 2222 sub crsenv {
|
Line 2525 sub crsenv {
|
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Modification may make assessment data inaccessible!'). |
&mt('Modification may make assessment data inaccessible!'). |
'</span>', |
'</span>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'description' => '<b>'.&mt('Course Title').'</b>', |
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
'('.&mt('internal, optional').')', |
'('.&mt('internal, optional').')', |
Line 2257 sub crsenv {
|
Line 2560 sub crsenv {
|
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />' |
'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>"').')', |
.'('.&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 />' |
'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>"').')', |
.'('.&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 />' |
'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>"').')', |
.'('.&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 />' |
'plc.roles.denied'=> '<b>'.&mt('Disallow chat room use for Roles').'</b><br />' |
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
'plc.users.denied' => |
'plc.users.denied' => |
'<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'. |
'<b>'.&mt('Disallow chat room use for Users').'</b><br />'. |
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
|
|
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />' |
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />' |
Line 2340 sub crsenv {
|
Line 2643 sub crsenv {
|
'externalsyllabus' |
'externalsyllabus' |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
'tthoptions' |
'tthoptions' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>', |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting TeX').'</b>', |
|
|
'texengine' |
'texengine' |
=> '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />' |
=> '<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>"').')', |
.'('.&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' |
'timezone' |
=> '<b>'.&mt('Timezone in which the course takes place').'</b>', |
=> '<b>'.&mt('Timezone in which the course takes place').'</b>', |
|
|
Line 2357 sub crsenv {
|
Line 2660 sub crsenv {
|
'categories' |
'categories' |
=> '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
=> '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
&mt('Display Categories').'</a>', |
&mt('Display Categories').'</a>', |
|
'datelocale' |
|
=> '<b>'.&mt('Locale used for course calendar').'</b>', |
|
'rolenames' |
|
=> '<b>'.&mt('Replacement titles for standard course roles').'</b><br />'. |
|
'('.&mt('To replace the standard title for a course role, enter the title you wish to use, otherwise leave blank.').')', |
); |
); |
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'); |
# Begin: New Version with Parameter Categories |
} |
|
if ($can_categorize) { |
sub parameter_row { |
push(@Display_Order,'categories'); |
# Create parameter row for course environment screen |
} |
|
push (@Display_Order,('grading', |
my ($parameter, $description) = @_; |
'externalsyllabus', |
|
'default_xml_style','pageseparators', |
# Start Parameter Row |
'question.email','question.email.text','comment.email', |
my $output = &Apache::loncommon::start_data_table_row(); |
'comment.email.text','policy.email','policy.email.text', |
|
'student_classlist_view', |
# Column 1/3: Descriptive text of current parameter |
'student_classlist_opt_in', |
$output .= '<td>'.$description.'</td>'; |
'student_classlist_portfiles', |
|
'plc.roles.denied','plc.users.denied', |
# Column 2/3: Input field (Sometimes special field(s), depending on parameter) |
'pch.roles.denied','pch.users.denied', |
|
'allow_limited_html_in_feedback', |
# onchange is javascript to automatically check the 'Set' button. |
'allow_discussion_post_editing', |
my $onchange = 'onFocus="javascript:window.document.forms' |
'languages', |
."['envform'].elements['".$parameter."_setparmval']" |
'timezone', |
.'.checked=true;"'; |
'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$/) { |
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::date_setter('envform', |
&Apache::lonhtmlcommon::date_setter('envform', |
Line 2433 sub crsenv {
|
Line 2702 sub crsenv {
|
&Apache::loncommon::select_timezone($parameter.'_value', |
&Apache::loncommon::select_timezone($parameter.'_value', |
$timezone, |
$timezone, |
$onchange,$includeempty).'</td>'; |
$onchange,$includeempty).'</td>'; |
|
} elsif ($parameter eq 'datelocale') { |
|
my $includeempty = 1; |
|
my $locale_obj = &Apache::lonlocal::getdatelocale(); |
|
my $currdatelocale; |
|
if (ref($locale_obj)) { |
|
$currdatelocale = $locale_obj->id(); |
|
} |
|
$output .= '<td>'. |
|
&Apache::loncommon::select_datelocale($parameter.'_value', |
|
$currdatelocale, |
|
$onchange,$includeempty).'</td>'; |
|
} elsif ($parameter eq 'rolenames') { |
|
$output.= '<td><table>'; |
|
foreach my $role ('cc','in','ta','ep','ad','st') { |
|
my $onchange = 'onFocus="javascript:window.document.forms'. |
|
"['envform'].elements['". |
|
$parameter.'_'.$role."_setparmval']". |
|
'.checked=true;"'; |
|
$output.= '<tr><td>'.&Apache::lonnet::plaintext($role,$crstype,undef,1). |
|
'</td><td>'. |
|
&Apache::lonhtmlcommon::textbox($parameter.'_'.$role.'_value', |
|
$values{$role.'.plaintext'}, |
|
15,$onchange). |
|
'</td></tr>'; |
|
} |
|
$output .= '</table></td><td><table>'; |
|
foreach my $role ('cc','in','ta','ep','ad','st') { |
|
$output .= '<tr><td>'.&Apache::lonhtmlcommon::checkbox($parameter.'_'.$role.'_setparmval'). |
|
'</td></tr>'; |
|
} |
|
$output .= '</table></td>'; |
} elsif ($parameter eq 'categories') { |
} elsif ($parameter eq 'categories') { |
my $catdisplay; |
my $catdisplay; |
if ($values{'categories'} ne '') { |
if ($values{'categories'} ne '') { |
Line 2448 sub crsenv {
|
Line 2748 sub crsenv {
|
$values{'categories'}.'" />'. |
$values{'categories'}.'" />'. |
'<input type="textbox" name="categories_display" value="'. |
'<input type="textbox" name="categories_display" value="'. |
$catdisplay.'" readonly="readonly" size="40" /></td>'; |
$catdisplay.'" readonly="readonly" size="40" /></td>'; |
} else { |
} else { # Display default textbox in all other cases |
$output .= '<td>'. |
$output .= '<td>' |
&Apache::lonhtmlcommon::textbox($parameter.'_value', |
.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
$values{$parameter}, |
$values{$parameter}, |
40,$onchange).'</td>'; |
40, |
} |
$onchange) |
$output .= '<td>'. |
.'</td>'; |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
} |
'</td>'; |
|
$output .= &Apache::loncommon::end_data_table_row()."\n"; |
# Column 3/3: Check Box (in most cases) |
} |
unless ($parameter eq 'rolenames') { |
my $onchange = 'onFocus="javascript:window.document.forms'. |
$output .= '<td>' |
'[\'envform\'].elements[\'newp_setparmval\']'. |
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
'.checked=true;"'; |
.'</td>'; |
$output.=&Apache::loncommon::start_data_table_row(). |
} |
'<td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
|
'<input type="text" size=40 name="newp_name" '. |
# End Parameter Row |
$onchange.' /></td><td>'. |
$output .= &Apache::loncommon::end_data_table_row(); |
'<input type="text" size=40 name="newp_value" '. |
|
$onchange.' /></td><td>'. |
return $output; |
'<input type="checkbox" name="newp_setparmval" /></td>'. |
} # End sub parameter_row |
&Apache::loncommon::end_data_table_row()."\n"; |
|
|
|
|
# Parameter Category Names |
|
my %parm_cat_names = &Apache::lonlocal::texthash ( |
|
'cat_0' => 'Parameter Category Zero', |
|
'cat_1' => 'Parameter Category One', |
|
'cat_2' => 'Parameter Category Two', |
|
'cat_3' => 'Parameter Category Three', |
|
'cat_4' => 'Parameter Category Four', |
|
'cat_5' => 'Parameter Category Five', |
|
'cat_6' => 'Parameter Category Six', |
|
'cat_7' => 'Parameter Category Seven', |
|
'cat_can' => 'Parameter Category Can', |
|
'cat_custom' => 'Parameter Category Custom', |
|
); |
|
|
|
# Display Order of Parameter Categories |
|
my @Display_Order = ( |
|
'cat_0', |
|
'cat_1', |
|
'cat_2', |
|
'cat_3', |
|
'cat_4', |
|
'cat_5', |
|
'cat_6', |
|
'cat_7', |
|
'cat_can', |
|
'cat_custom', |
|
); |
|
|
|
# Link Parameter Categories with Parameters |
|
# Order of parameters is display order |
|
my %parm_cat_parms = ( |
|
'cat_0' => [ |
|
'url', |
|
'description', |
|
'courseid', |
|
'cloners' |
|
], |
|
'cat_1' => [ |
|
'grading', |
|
'externalsyllabus', |
|
'default_xml_style', |
|
'pageseparators' |
|
], |
|
'cat_2' => [ |
|
'question.email', |
|
'question.email.text', |
|
'comment.email', |
|
'comment.email.text', |
|
'policy.email', |
|
'policy.email.text', |
|
], |
|
'cat_3' => [ |
|
'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', |
|
], |
|
'cat_4' => [ |
|
'languages', |
|
'timezone', |
|
'datelocale', |
|
'rolenames', |
|
'nothideprivileged', |
|
'rndseed', |
|
'receiptalg', |
|
'problem_stream_switch', |
|
'suppress_tries', |
|
'suppress_embed_prompt', |
|
'default_paper_size', |
|
'print_header_format', |
|
'disable_receipt_display', |
|
], |
|
'cat_5' => [ |
|
'spreadsheet_default_classcalc', |
|
'spreadsheet_default_studentcalc', |
|
'spreadsheet_default_assesscalc', |
|
'hideemptyrows', |
|
], |
|
'cat_6' => [ |
|
'default_enrollment_start_date', |
|
'default_enrollment_end_date', |
|
], |
|
'cat_7' => [ |
|
'tthoptions', |
|
'texengine', |
|
'disablesigfigs', |
|
'disableexampointprint', |
|
'task_messages', |
|
'task_grading', |
|
], |
|
); |
|
|
|
# Add special parameters depending on special context to parameter categories hash |
|
my @can_cats; |
|
(my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
|
if ($can_toggle_cat) { |
|
push(@can_cats,'hidefromcat'); |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
if ($can_categorize) { |
'par' => 'Parameter', |
push(@can_cats,'categories'); |
'val' => 'Value', |
} |
'set' => 'Set?', |
$parm_cat_parms{'cat_can'} = [@can_cats]; |
'sav' => 'Save' |
|
); |
# Add custom parameters to custom parameter category |
|
my @custom_cats; |
my $Parameter=&mt('Parameter'); |
foreach my $parameter (sort(keys(%values))) { |
my $Value=&mt('Value'); |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
my $Set=&mt('Set'); |
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
|
|| ($parameter eq 'type') || |
|
($parameter =~ m/^(cc|in|ta|ep|ad|st)\.plaintext$/)) { |
|
if (! $descriptions{$parameter}) { |
|
$descriptions{$parameter}=$parameter; |
|
push(@custom_cats,$parameter); |
|
} |
|
} |
|
} |
|
$parm_cat_parms{'cat_custom'} = [@custom_cats]; |
|
|
|
|
|
# Display Course Parameter Overview |
|
# Provide hyperlinks to detailed parameter settings |
|
$output_SB .= '<a name="parmlist" />' |
|
.'<div class="LC_ContentBoxSpecial">' |
|
.'<h2 class="LC_hcell">'.&mt('Course Parameter Overview').'</h2>' |
|
.'<ul>'; |
|
foreach my $catkey (@Display_Order) { |
|
if (!@{$parm_cat_parms{$catkey}}) { next; } # Only display non-empty categories |
|
$output_SB .= '<li>' |
|
.'<a href="#parmlist_'.$catkey.'">' |
|
.$parm_cat_names{$catkey} |
|
.'</a>' |
|
.'</li>'; |
|
} |
|
$output_SB .= '</ul>' |
|
.'</div>'; |
|
|
|
|
|
my $buttons='<div align="right">' |
|
.'<input type="submit" name="crsenv" value="'.&mt('Save All').'" />' |
|
.'<br /><a href="#parmlist">'.&mt('Back to Course Parameter Overview').'</a>' |
|
.'</div>'; |
|
|
|
# Display all Parameters grouped by categories |
|
$output_SB .= '<h2>'.&mt('Course Parameters').'</h2>'; |
|
|
|
foreach my $catkey (@Display_Order) { |
|
if (!@{$parm_cat_parms{$catkey}}) { next; } # Only display non-empty categories |
|
$output_SB .= &Apache::loncommon::start_data_table(); |
|
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
|
.'<td colspan="3">' |
|
.'<a name="parmlist_'.$catkey.'" />' |
|
.'<h3>'.$parm_cat_names{$catkey}.'</h3>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_empty_row |
|
.&Apache::loncommon::start_data_table_header_row() |
|
.'<th>'.$lt{'par'}.'</th><th>'.$lt{'val'}.'</th><th>'.$lt{'set'}.'</th>' |
|
.&Apache::loncommon::end_data_table_header_row(); |
|
|
|
foreach my $parameter (@{$parm_cat_parms{$catkey}}) { |
|
my $description = $descriptions{$parameter}; |
|
$output_SB .= ¶meter_row($parameter, $description); |
|
} |
|
# Add special row to custom category |
|
# Offer possibilty to create a new environment variable |
|
if ($catkey eq 'cat_custom') { |
|
my $onchange = 'onFocus="javascript:window.document.forms' |
|
.'[\'envform\'].elements[\'newp_setparmval\']' |
|
.'.checked=true;"'; |
|
$output_SB .= &Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<i>'.&mt('Create New Environment Variable').'</i><br />' |
|
.'<input type="text" size="40" name="newp_name" '.$onchange.' />' |
|
.'</td><td>' |
|
.'<input type="text" size="40" name="newp_value" '.$onchange.' />' |
|
.'</td><td>' |
|
.'<input type="checkbox" name="newp_setparmval" /></td>' |
|
.&Apache::loncommon::end_data_table_row(); |
|
} |
|
# Add buttons row at end of each category |
|
$output_SB .= &Apache::loncommon::start_data_table_empty_row() |
|
.'<td colspan="3">' |
|
.$buttons |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_empty_row; |
|
|
|
$output_SB .= &Apache::loncommon::end_data_table() |
|
. '<br />'; |
|
} |
|
|
|
# End: New Version with Parameter Categories |
|
# ---------------------------------------------------------------- |
|
|
|
|
|
} |
|
|
my ($jscript,$categorize_js); |
my ($jscript,$categorize_js); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
if ($can_categorize) { |
if ($can_categorize) { |
Line 2503 ENDSCRIPT
|
Line 2993 ENDSCRIPT
|
$jscript); |
$jscript); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
my $end_table=&Apache::loncommon::end_data_table(); |
|
$r->print(<<ENDENV); |
$r->print(<<ENDENV); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
$output_SB |
$start_table |
|
$start_header_row |
|
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th> |
|
$end_header_row |
|
$output |
|
$end_table |
|
<input type="submit" name="crsenv" value="$lt{'sav'}" /> |
|
</form> |
</form> |
$end_page |
$end_page |
ENDENV |
ENDENV |
Line 2563 function updateCategories() {
|
Line 3045 function updateCategories() {
|
for (var i=0; i<document.chgcats.usecategory.length; i++) { |
for (var i=0; i<document.chgcats.usecategory.length; i++) { |
if (document.chgcats.usecategory[i].checked == true) { |
if (document.chgcats.usecategory[i].checked == true) { |
newcategories = newcategories + document.chgcats.usecategory[i].value + '&'; |
newcategories = newcategories + document.chgcats.usecategory[i].value + '&'; |
alert("i is "+i+" and catname is "+document.chgcats.catname[i].value); |
|
unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & '; |
unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & '; |
} |
} |
} |
} |
Line 2571 function updateCategories() {
|
Line 3052 function updateCategories() {
|
newcategories = newcategories.slice(0,-1); |
newcategories = newcategories.slice(0,-1); |
} |
} |
if (unescapedcats.length > 0) { |
if (unescapedcats.length > 0) { |
usescapedcats = unescapedcats.slice(0,-3); |
unescapedcats = unescapedcats.slice(0,-3); |
} |
} |
} else { |
} else { |
if (document.chgcats.usecategory.checked == true) { |
if (document.chgcats.usecategory.checked == true) { |
Line 2887 sub listdata {
|
Line 3368 sub listdata {
|
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$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; |
$oldpart=$part; |
} |
} |
# |
# |
Line 2908 sub listdata {
|
Line 3389 sub listdata {
|
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'',''). |
'',1,'',''). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
(($$resourcedata{$thiskey}!=0)?'<a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
&mt('Shift all dates based on this date').'</a>':''). |
&mt('Shift all dates based on this date').'</a></span>':''). |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'date_interval') { |
} elsif ($thistype eq 'date_interval') { |
Line 2922 sub listdata {
|
Line 3403 sub listdata {
|
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'" />'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
Line 3045 sub newoverview {
|
Line 3526 sub newoverview {
|
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3205 sub overview {
|
Line 3688 sub overview {
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3230 ENDOVER
|
Line 3715 ENDOVER
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3239 sub clean_parameters {
|
Line 3724 sub clean_parameters {
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
|
text=>"Clean Parameters"}); |
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3259 ENDOVER
|
Line 3746 ENDOVER
|
$r->print('<h3>'. |
$r->print('<h3>'. |
&mt('These parameters refer to resources that do not exist.'). |
&mt('These parameters refer to resources that do not exist.'). |
'</h3>'. |
'</h3>'. |
'<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.'<br />'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'.'<br />'. |
'<br />'); |
'<br />'); |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table(). |
'<tr>'. |
'<tr>'. |
Line 3312 ENDOVER
|
Line 3799 ENDOVER
|
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
$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>'. |
'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
Line 3322 sub date_shift_one {
|
Line 3809 sub date_shift_one {
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
&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 $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3347 sub date_shift_two {
|
Line 3836 sub date_shift_two {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
&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 $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3401 sub parse_key {
|
Line 3892 sub parse_key {
|
return %data; |
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 { |
sub extract_cloners { |
my ($clonelist,$allowclone) = @_; |
my ($clonelist,$allowclone) = @_; |
Line 3552 sub change_clone {
|
Line 4009 sub change_clone {
|
} |
} |
|
|
|
|
################################################## |
|
################################################## |
|
|
|
=pod |
|
|
|
=item * header |
|
|
|
Output html header for page |
|
|
|
=cut |
|
|
|
################################################## |
|
################################################## |
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Parameter Manager'); |
return &Apache::loncommon::start_page('Parameter Manager'); |
} |
} |
################################################## |
|
################################################## |
|
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$parm_permission)=@_; |
my ($r,$parm_permission)=@_; |
# |
# |
|
$r->print(&header()); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
$r->print(<<ENDMAINFORMHEAD); |
$r->print(<<ENDMAINFORMHEAD); |
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/parmset" name="studentform"> |
action="/adm/parmset" name="studentform"> |
Line 3583 ENDMAINFORMHEAD
|
Line 4031 ENDMAINFORMHEAD
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
|
|
|
my @menu = |
my @menu = |
( { divider=>'Settings for Your Course', |
( { categorytitle=>'Settings for this Course', |
}, |
items => [ |
{ text => 'Set Course Environment', |
{ linktext => 'Course Environment', |
action => 'crsenv', |
url => '/adm/parmset?action=crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Course_Environment', |
linktitle =>'Edit environment settings for this course.' , |
}, |
icon => 'preferences-desktop-remote-desktop.png' , |
{ text => 'Set Portfolio Metadata', |
#help => 'Course_Environment', |
action => 'setrestrictmeta', |
}, |
permission => $parm_permission, |
{ linktext => 'Portfolio Metadata', |
}, |
url => '/adm/parmset?action=setrestrictmeta', |
{ text => 'Manage Course Slots', |
permission => $parm_permission, |
url => '/adm/slotrequest?command=showslots', |
linktitle => 'Restrict metadata for this course.' , |
permission => $vgr, |
icon =>'contact-new.png' , |
}, |
}, |
{ text => 'Reset Student Access Times', |
{ linktext => 'Manage Course Slots', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/slotrequest?command=showslots', |
permission => $mgr, |
permission => $vgr, |
}, |
linktitle =>'Manage slots for this course.' , |
|
icon => 'format-justify-fill.png' , |
{ text => 'Set Parameter Setting Default Actions', |
}, |
action => 'setdefaults', |
{ linktext => 'Reset Student Access Times', |
permission => $parm_permission, |
url => '/adm/helper/resettimes.helper', |
}, |
permission => $mgr, |
{ divider => 'New and Existing Parameter Settings for Your Resources', |
linktitle =>'Reset access times for folders/maps, resources or the course.' , |
}, |
icon => 'start-here.png' , |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
}, |
url => '/adm/helper/parameter.helper', |
|
permission => $parm_permission, |
{ linktext => 'Set Parameter Setting Default Actions', |
help => 'Parameter_Helper', |
url => '/adm/parmset?action=setdefaults', |
}, |
permission => $parm_permission, |
{ text => 'Set/Modify Resource Parameters - Overview Mode', |
linktitle =>'Set default actions for parameters.' , |
action => 'newoverview', |
icon => 'folder-new.png' , |
permission => $parm_permission, |
}]}, |
help => 'Parameter_Overview', |
{ categorytitle => 'New and Existing Parameter Settings for Resources', |
}, |
items => [ |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
action => 'settable', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Table_Mode', |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
}, |
icon => 'dialog-information.png' , |
{ divider => 'Existing Parameter Settings for Your Resources', |
#help => 'Parameter_Helper', |
}, |
}, |
{ text => 'Modify Resource Parameters - Overview Mode', |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
action => 'setoverview', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Parameter_Overview', |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
}, |
icon => 'edit-find.png' , |
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
#help => 'Parameter_Overview', |
action => 'parameterchangelog', |
}, |
permission => $parm_permission, |
{ linktext => 'Edit Resource Parameters - Table Mode', |
}, |
url => '/adm/parmset?action=settable', |
|
permission => $parm_permission, |
|
linktitle =>'Set/Modify resource parameters in table mode.' , |
|
icon => 'edit-copy.png' , |
|
#help => 'Table_Mode', |
|
}]}, |
|
{ categorytitle => 'Existing Parameter Settings for Resources', |
|
items => [ |
|
{ linktext => 'Modify Resource Parameters - Overview Mode', |
|
url => '/adm/parmset?action=setoverview', |
|
permission => $parm_permission, |
|
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
|
icon => 'preferences-desktop-wallpaper.png' , |
|
#help => 'Parameter_Overview', |
|
}, |
|
{ linktext => 'Change Log', |
|
url => '/adm/parmset?action=parameterchangelog', |
|
permission => $parm_permission, |
|
linktitle =>'View parameter and course blog posting/user notification change log.' , |
|
icon => 'emblem-system.png' , |
|
}]} |
); |
); |
my $menu_html = ''; |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
foreach my $menu_item (@menu) { |
|
if ($menu_item->{'divider'}) { |
|
$menu_html .= '<h3>'.&mt($menu_item->{'divider'}).'</h3>'; |
|
next; |
|
} |
|
next if (! $menu_item->{'permission'}); |
|
$menu_html.='<p>'; |
|
$menu_html.='<span class="LC_parm_menu_item">'; |
|
if (exists($menu_item->{'url'})) { |
|
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
|
} else { |
|
$menu_html.= |
|
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
|
} |
|
$menu_html.= &mt($menu_item->{'text'}).'</a></span>'; |
|
if (exists($menu_item->{'help'})) { |
|
$menu_html.= |
|
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
|
} |
|
$menu_html.='</p>'.$/; |
|
} |
|
$r->print($menu_html); |
|
return; |
return; |
} |
} |
### Set portfolio metadata |
|
|
|
|
|
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my $output; |
my $output; |
Line 3674 sub output_row {
|
Line 4123 sub output_row {
|
} |
} |
if (!($options =~ /deleted/)) { |
if (!($options =~ /deleted/)) { |
my @options= ( ['active', 'Show to student'], |
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']); |
['choices','Provide choices for students to select from']); |
# ['onlyone','Student may select only one choice']); |
# ['onlyone','Student may select only one choice']); |
if ($added_flag) { |
if ($added_flag) { |
Line 3698 sub output_row {
|
Line 4147 sub output_row {
|
my $multiple_checked; |
my $multiple_checked; |
my $single_checked; |
my $single_checked; |
if ($options =~ m/onlyone/) { |
if ($options =~ m/onlyone/) { |
$multiple_checked = ""; |
$multiple_checked = ''; |
$single_checked = " CHECKED "; |
$single_checked = ' checked="checked"'; |
} else { |
} else { |
$multiple_checked = " CHECKED "; |
$multiple_checked = ' checked="checked"'; |
$single_checked = ""; |
$single_checked = ''; |
} |
} |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/> |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' /> |
Student may select multiple choices from list</span></td>'; |
'.&mt('Student may select multiple choices from list').'</span></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
<input type="radio" name="'.$field_name.'_onlyone" value="single" '.$single_checked.'/> |
<input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' /> |
Student may select only one choice from list</span></td>'; |
'.&mt('Student may select only one choice from list').'</span></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
return ($output); |
return ($output); |
} |
} |
|
|
|
|
|
|
sub order_meta_fields { |
sub order_meta_fields { |
my ($r)=@_; |
my ($r)=@_; |
my $idx = 1; |
my $idx = 1; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/parmset?action=setrestrictmeta", |
({href=>"/adm/parmset?action=setrestrictmeta", |
text=>"Restrict Metadata"}, |
text=>"Restrict Metadata"}, |
Line 3799 sub order_meta_fields {
|
Line 4253 sub order_meta_fields {
|
$r->print('</table>'); |
$r->print('</table>'); |
return 'ok'; |
return 'ok'; |
} |
} |
|
|
|
|
sub continue { |
sub continue { |
my $output; |
my $output; |
$output .= '<form action="" method="post">'; |
$output .= '<form action="" method="post">'; |
Line 3806 sub continue {
|
Line 4262 sub continue {
|
$output .= '<input type="submit" value="Continue" />'; |
$output .= '<input type="submit" value="Continue" />'; |
return ($output); |
return ($output); |
} |
} |
|
|
|
|
sub addmetafield { |
sub addmetafield { |
my ($r)=@_; |
my ($r)=@_; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 3852 sub addmetafield {
|
Line 4312 sub addmetafield {
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
|
|
|
|
|
|
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
|
text=>"Restrict Metadata"}); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 3935 ENDenv
|
Line 4400 ENDenv
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return 'ok'; |
return 'ok'; |
} |
} |
################################################## |
|
|
|
|
|
sub get_added_meta_fieldnames { |
sub get_added_meta_fieldnames { |
my ($cid) = @_; |
my ($cid) = @_; |
my %fields; |
my %fields; |
Line 3948 sub get_added_meta_fieldnames {
|
Line 4415 sub get_added_meta_fieldnames {
|
} |
} |
return \%fields; |
return \%fields; |
} |
} |
|
|
|
|
|
|
sub get_deleted_meta_fieldnames { |
sub get_deleted_meta_fieldnames { |
my ($cid) = @_; |
my ($cid) = @_; |
my %fields; |
my %fields; |
Line 3965 sub get_deleted_meta_fieldnames {
|
Line 4435 sub get_deleted_meta_fieldnames {
|
sub defaultsetter { |
sub defaultsetter { |
my ($r) = @_; |
my ($r) = @_; |
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
|
text=>"Set Defaults"}); |
my $start_page = |
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'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
Line 4116 ENDYESNO
|
Line 4588 ENDYESNO
|
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print(&Apache::loncommon::end_data_table(). |
$r->print(&Apache::loncommon::end_data_table(). |
"\n<input type='submit' name='storerules' value='". |
"\n".'<input type="submit" name="storerules" value="'. |
&mt('Save Rules')."' /></form>\n". |
&mt('Save').'" /></form>'."\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 4161 sub components {
|
Line 4633 sub components {
|
} |
} |
|
|
my %standard_parms; |
my %standard_parms; |
|
|
|
|
sub load_parameter_names { |
sub load_parameter_names { |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
Line 4190 sub standard_parameter_names {
|
Line 4664 sub standard_parameter_names {
|
} |
} |
} |
} |
|
|
# |
|
# Parameter Change Log |
|
# |
|
|
|
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r)=@_; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log"}); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
|
|
Line 4352 sub parm_change_log {
|
Line 4825 sub parm_change_log {
|
$r->print(&Apache::loncommon::end_page()); |
$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 { |
sub check_for_course_info { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
return 1 if ($navmap); |
return 1 if ($navmap); |
return 0; |
return 0; |
} |
} |
|
|
################################################## |
|
################################################## |
|
|
|
=pod |
|
|
|
=item * handler |
|
|
|
Main handler. Calls &assessparms and &crsenv subroutines. |
|
|
|
=cut |
|
|
|
################################################## |
|
################################################## |
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
&reset_caches(); |
&reset_caches(); |
|
|
if ($r->header_only) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK; |
|
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['action','state', |
['action','state', |
'pres_marker', |
'pres_marker', |
Line 4405 sub handler {
|
Line 4952 sub handler {
|
my $exists = &check_for_course_info(); |
my $exists = &check_for_course_info(); |
|
|
if ($env{'request.course.id'} && $parm_permission && $exists) { |
if ($env{'request.course.id'} && $parm_permission && $exists) { |
|
|
# Start Page |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
|
|
|
|
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
Line 4418 sub handler {
|
Line 4959 sub handler {
|
# the table mode |
# the table mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
|
text=>"Problem Parameters"}); |
|
&assessparms($r); |
&assessparms($r); |
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
$r->print(&header()); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'crsenv') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
|
text=>"Course Environment"}); |
|
&crsenv($r); |
&crsenv($r); |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
|
&overview($r); |
&overview($r); |
} elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&addmetafield($r); |
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&order_meta_fields($r); |
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
|
text=>"Restrict Metadata"}); |
|
&setrestrictmeta($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'newoverview') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
|
&newoverview($r); |
&newoverview($r); |
} elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
|
text=>"Set Defaults"}); |
|
&defaultsetter($r); |
&defaultsetter($r); |
} elsif ($env{'form.action'} eq 'settable' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'settable') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Table Mode", |
|
help => 'Course_Setting_Parameters'}); |
|
&assessparms($r); |
&assessparms($r); |
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log"}); |
|
&parm_change_log($r); |
&parm_change_log($r); |
} elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
|
text=>"Clean Parameters"}); |
|
&clean_parameters($r); |
&clean_parameters($r); |
} elsif ($env{'form.action'} eq 'dateshift1' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'dateshift1') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_one($r); |
&date_shift_one($r); |
} elsif ($env{'form.action'} eq 'dateshift2' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'dateshift2') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_two($r); |
&date_shift_two($r); |
} elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'categorizecourse') { |
&assign_course_categories($r); |
&assign_course_categories($r); |
} |
} |
} else { |
} else { |
Line 4497 sub handler {
|
Line 5008 sub handler {
|
1; |
1; |
__END__ |
__END__ |
|
|
=pod |
|
|
|
=back |
|
|
|
=cut |
|
|
|
|
|
|
|