version 1.430, 2009/02/13 20:20:30
|
version 1.439, 2009/03/30 15:57:26
|
Line 973 sub print_row {
|
Line 973 sub print_row {
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
$r->print('<td style="background-color:'.$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; |
$parm=&mt($parm); |
|
} |
} |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
if ($automatic) { |
if ($automatic) { |
Line 1077 sub print_td {
|
Line 1076 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 style="background-color:'.(($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 1183 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/\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 1317 ENDSCRIPT
|
Line 1330 ENDSCRIPT
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked="checked"'); |
$r->print(' checked="checked"'); |
} |
} |
my $displaykey; |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
if ($$allparms{$tempkey}=~/\S/) { |
: $tempkey) |
$displaykey = $$allparms{$tempkey}; |
.'</label></td>'); |
} else { |
|
$displaykey = $tempkey; |
|
} |
|
$displaykey =~ s/(\[|\])/~$1/g; |
|
$r->print(' />'.&mt($displaykey).'</label></td>'); |
|
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 1797 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 1976 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 2083 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 2176 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 2241 sub crsenv {
|
Line 2309 sub crsenv {
|
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 2251 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 2426 sub crsenv {
|
Line 2512 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 2473 sub crsenv {
|
Line 2566 sub crsenv {
|
.'('.&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 2553 sub crsenv {
|
Line 2646 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 />' |
Line 2572 sub crsenv {
|
Line 2665 sub crsenv {
|
&mt('Display Categories').'</a>', |
&mt('Display Categories').'</a>', |
'datelocale' |
'datelocale' |
=> '<b>'.&mt('Locale used for course calendar').'</b>', |
=> '<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) { |
# The following code is kept to have access to the old version of display order |
push(@Display_Order,'hidefromcat'); |
|
} |
# my @Display_Order = ('url','description','courseid','cloners'); |
if ($can_categorize) { |
# (my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
push(@Display_Order,'categories'); |
# if ($can_toggle_cat) { |
} |
# push(@Display_Order,'hidefromcat'); |
push (@Display_Order,('grading', |
# } |
'externalsyllabus', |
# if ($can_categorize) { |
'default_xml_style','pageseparators', |
# push(@Display_Order,'categories'); |
'question.email','question.email.text','comment.email', |
# } |
'comment.email.text','policy.email','policy.email.text', |
# push (@Display_Order,('grading', |
'student_classlist_view', |
# 'externalsyllabus', |
'student_classlist_opt_in', |
# 'default_xml_style','pageseparators', |
'student_classlist_portfiles', |
# 'question.email','question.email.text','comment.email', |
'plc.roles.denied','plc.users.denied', |
# 'comment.email.text','policy.email','policy.email.text', |
'pch.roles.denied','pch.users.denied', |
# 'student_classlist_view', |
'allow_limited_html_in_feedback', |
# 'student_classlist_opt_in', |
'allow_discussion_post_editing', |
# 'student_classlist_portfiles', |
'languages', |
# 'plc.roles.denied','plc.users.denied', |
'timezone', |
# 'pch.roles.denied','pch.users.denied', |
'datelocale', |
# 'allow_limited_html_in_feedback', |
'nothideprivileged', |
# 'allow_discussion_post_editing', |
'rndseed', |
# 'languages', |
'receiptalg', |
# 'timezone', |
'problem_stream_switch', |
# 'datelocale', |
'suppress_tries', |
# 'rolenames', |
'suppress_embed_prompt', |
# 'nothideprivileged', |
'default_paper_size', |
# 'rndseed', |
'print_header_format', |
# 'receiptalg', |
'disable_receipt_display', |
# 'problem_stream_switch', |
'spreadsheet_default_classcalc', |
# 'suppress_tries', |
'spreadsheet_default_studentcalc', |
# 'suppress_embed_prompt', |
'spreadsheet_default_assesscalc', |
# 'default_paper_size', |
'hideemptyrows', |
# 'print_header_format', |
'default_enrollment_start_date', |
# 'disable_receipt_display', |
'default_enrollment_end_date', |
# 'spreadsheet_default_classcalc', |
'tthoptions', |
# 'spreadsheet_default_studentcalc', |
'texengine', |
# 'spreadsheet_default_assesscalc', |
'disablesigfigs', |
# 'hideemptyrows', |
'disableexampointprint', |
# 'default_enrollment_start_date', |
'task_messages','task_grading')); |
# 'default_enrollment_end_date', |
foreach my $parameter (sort(keys(%values))) { |
# 'tthoptions', |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
# 'texengine', |
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
# 'disablesigfigs', |
|| ($parameter eq 'type')) { |
# 'disableexampointprint', |
if (! $descriptions{$parameter}) { |
# 'task_messages','task_grading')); |
$descriptions{$parameter}=$parameter; |
# foreach my $parameter (sort(keys(%values))) { |
push(@Display_Order,$parameter); |
# unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
} |
# ($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
} |
# || ($parameter eq 'type') || |
} |
# ($parameter =~ m/^(cc|in|ta|ep|ad|st)\.plaintext$/)) { |
|
# if (! $descriptions{$parameter}) { |
foreach my $parameter (@Display_Order) { |
# $descriptions{$parameter}=$parameter; |
my $description = $descriptions{$parameter}; |
# push(@Display_Order,$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>'; |
|
|
|
|
# ---------------------------------------------------------------- |
|
# Begin: New Version with Parameter Categories |
|
|
|
sub parameter_row { |
|
# Create parameter line for course environment screen |
|
my ($parameter, $description) = @_; |
|
my $output = ''; |
|
|
|
# Column 1/3: Descritive text of current parameter |
|
$output = &Apache::loncommon::start_data_table_row() |
|
.'<td>'.$description.'</td>'; |
|
|
|
# Column 2/3: Input field (Sometimes special field(s), depending on parameter) |
|
# ------------------------------- |
|
# onchange is javascript to automatically check the 'Set' button. |
|
my $onchange = 'onFocus="javascript:window.document.forms' |
|
."['envform'].elements['".$parameter."_setparmval']" |
|
.'.checked=true;"'; |
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 2659 sub crsenv {
|
Line 2774 sub crsenv {
|
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::loncommon::select_datelocale($parameter.'_value', |
&Apache::loncommon::select_datelocale($parameter.'_value', |
$currdatelocale, |
$currdatelocale, |
$onchange,$includeempty).'</td>'; |
$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 2675 sub crsenv {
|
Line 2810 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') { |
|
$output .= '<td>' |
|
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
|
.'</td>'; |
|
} |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
|
|
return $output; |
|
} |
|
|
|
|
|
|
|
|
|
# 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', |
|
); |
|
|
|
# Link Parameter Categories with Parameters |
|
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'); |
|
} |
|
if ($can_categorize) { |
|
push(@can_cats,'categories'); |
|
} |
|
$parm_cat_parms{'cat_can'} = [@can_cats]; |
|
|
|
# Add custom parameters to parameter categories hash |
|
my @custom_cats; |
|
foreach my $parameter (sort(keys(%values))) { |
|
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
|
($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]; |
|
|
|
|
|
# Old output structure: |
|
|
|
#$start_table |
|
#$start_header_row |
|
#<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th> |
|
#$end_header_row |
|
#$output |
|
#$end_table |
|
|
|
|
|
# Display Parameter List Overview |
|
# Provide hyperlinks to detailed parameter settings |
|
$output_SB .= '<a name="parmlist" />' |
|
.'<h2>'.&mt('Course Parameter Overview').'</h2>' |
|
.'<div class="LC_ContentBox">' |
|
.'<ul>'; |
|
foreach my $catkey (keys(%parm_cat_names)) { |
|
$output_SB .= '<li>' |
|
.'<a href="#parmlist_'.$catkey.'">' |
|
.$parm_cat_names{$catkey} |
|
.'</a>' |
|
.'</li>'; |
|
} |
|
$output_SB .= '</ul>' |
|
.'</div>'; |
|
|
|
|
|
# Display Parameter Details |
|
my $buttons='<div align="right">' |
|
.'<input type="submit" name="crsenv" value="'.&mt('Save All').'" />' |
|
.'<br /><a href="#parmlist">'.&mt('Back to Parameter List').'</a>' |
|
.'</div>'; |
|
|
|
$output_SB .= '<h2>'.&mt('Course Parameters').'</h2>'; |
|
|
|
foreach my $catkey (keys(%parm_cat_names)) { |
|
$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); |
|
} |
|
$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 />'; |
|
} |
|
|
|
$output_SB .= '</div>'; |
|
|
|
# End: New Version with Parameter Categories |
|
# ---------------------------------------------------------------- |
|
|
|
|
|
# # Display Parameter table |
|
# foreach my $parameter (@Display_Order) { |
|
# my $description = $descriptions{$parameter}; |
|
# # onchange is javascript to automatically check the 'Set' button. |
|
# my $onchange = 'onFocus="javascript:window.document.forms'. |
|
# "['envform'].elements['".$parameter."_setparmval']". |
|
# '.checked=true;"'; |
|
# $output .= &Apache::loncommon::start_data_table_row(). |
|
# '<td>'.$description.'</td>'; |
|
# |
|
# |
|
# |
|
## ------------------------------- |
|
# if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::date_setter('envform', |
|
# $parameter.'_value', |
|
# $values{$parameter}, |
|
# $onchange). |
|
# '</td>'; |
|
# } elsif ($parameter eq 'timezone') { |
|
# my $includeempty = 1; |
|
# my $timezone = &Apache::lonlocal::gettimezone(); |
|
# $output .= '<td>'. |
|
# &Apache::loncommon::select_timezone($parameter.'_value', |
|
# $timezone, |
|
# $onchange,$includeempty).'</td>'; |
|
# } elsif ($parameter eq 'datelocale') { |
|
# my $includeempty = 1; |
|
# my $locale_obj = &Apache::lonlocal::getdatelocale(); |
|
# my $currdatelocale; |
|
# if (ref($locale_obj)) { |
|
# $currdatelocale = $locale_obj->id(); |
|
# } |
|
# $output .= '<td>'. |
|
# &Apache::loncommon::select_datelocale($parameter.'_value', |
|
# $currdatelocale, |
|
# $onchange,$includeempty).'</td>'; |
|
# } elsif ($parameter eq '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') { |
|
# my $catdisplay; |
|
# if ($values{'categories'} ne '') { |
|
# my @curritems = split(/\&/,$values{'categories'}); |
|
# foreach my $item (@curritems) { |
|
# my ($name,$parent,$pos) = split(/:/,$item); |
|
# $catdisplay .= &unescape($name).'&'; |
|
# } |
|
# $catdisplay =~ s/\&$//; |
|
# } |
|
# $output .= '<td>'. |
|
# '<input type="hidden" name="categories_value" value="'. |
|
# $values{'categories'}.'" />'. |
|
# '<input type="textbox" name="categories_display" value="'. |
|
# $catdisplay.'" readonly="readonly" size="40" /></td>'; |
|
# } else { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::textbox($parameter.'_value', |
|
# $values{$parameter}, |
|
# 40,$onchange).'</td>'; |
|
# } |
|
# ------------------------------- |
|
|
|
|
|
# unless ($parameter eq 'rolenames') { |
|
# $output .= '<td>'. |
|
# &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
|
# '</td>'; |
|
# } |
|
# $output .= &Apache::loncommon::end_data_table_row()."\n"; |
|
# } |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'.checked=true;"'; |
'.checked=true;"'; |
Line 2698 sub crsenv {
|
Line 3110 sub crsenv {
|
'<input type="checkbox" name="newp_setparmval" /></td>'. |
'<input type="checkbox" name="newp_setparmval" /></td>'. |
&Apache::loncommon::end_data_table_row()."\n"; |
&Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
|
'par' => 'Parameter', |
|
'val' => 'Value', |
|
'set' => 'Set?', |
|
'sav' => 'Save' |
|
); |
|
|
|
my $Parameter=&mt('Parameter'); |
my $Parameter=&mt('Parameter'); |
my $Value=&mt('Value'); |
my $Value=&mt('Value'); |
Line 2736 $start_page
|
Line 3142 $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 |
|
$output_SB |
|
<hr class="LC_edit_problem_divide" /> |
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
$start_table |
$start_table |
$start_header_row |
$start_header_row |
Line 4570 sub parm_change_log {
|
Line 4978 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); |