version 1.446, 2009/05/12 10:54:11
|
version 1.456, 2009/06/08 18:04:45
|
Line 214 Variables used (guessed by Jeremy):
|
Line 214 Variables used (guessed by Jeremy):
|
When storing information, store as part 0 |
When storing information, store as part 0 |
When requesting information, request from full part |
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 tablestart() |
|
|
=item tableend() |
=item tableend() |
Line 322 Set portfolio metadata
|
Line 309 Set portfolio metadata
|
|
|
=item handler() : |
=item handler() : |
|
|
Main handler. Calls &assessparms and &crsenv subroutines. |
Main handler. Calls &assessparms subroutine. |
|
|
|
|
=back |
=back |
Line 867 sub page_js {
|
Line 854 sub page_js {
|
|
|
return(<<ENDJS); |
return(<<ENDJS); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function pclose() { |
function pclose() { |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
"height=350,width=350,scrollbars=no,menubar=no"); |
"height=350,width=350,scrollbars=no,menubar=no"); |
Line 906 sub page_js {
|
Line 893 sub page_js {
|
var newWin = window.open(url, wdwName, options); |
var newWin = window.open(url, wdwName, options); |
newWin.focus(); |
newWin.focus(); |
} |
} |
|
// ]]> |
</script> |
</script> |
$selscript |
$selscript |
ENDJS |
ENDJS |
Line 1261 sub parmmenu {
|
Line 1249 sub parmmenu {
|
my $tempkey; |
my $tempkey; |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function checkall(value, checkName) { |
function checkall(value, checkName) { |
|
|
|
var li = "_li"; |
|
var displayOverview = ""; |
|
|
|
if (value == false) { |
|
displayOverview = "none" |
|
} |
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
document.forms.parmform.elements[i].checked=value; |
document.forms.parmform.elements[i].checked=value; |
|
document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview; |
} |
} |
} |
} |
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
|
checkboxChecked(thisvalue); |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
Line 1297 sub parmmenu {
|
Line 1296 sub parmmenu {
|
checkthis('contentclose','pscat'); |
checkthis('contentclose','pscat'); |
} |
} |
|
|
|
|
function checkvisi() { |
function checkvisi() { |
checkthis('hiddenresource','pscat'); |
checkthis('hiddenresource','pscat'); |
checkthis('encrypturl','pscat'); |
checkthis('encrypturl','pscat'); |
Line 1319 sub parmmenu {
|
Line 1317 sub parmmenu {
|
checkthis('maxtries','pscat'); |
checkthis('maxtries','pscat'); |
} |
} |
|
|
|
function hideParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = "none"; |
|
} |
|
|
|
function showParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = ""; |
|
} |
|
|
|
function checkboxChecked(id) { |
|
var li = "_li"; |
|
var id_li = id.concat(li); |
|
|
|
if (document.getElementById(id_li).style.display == "none") { |
|
document.getElementById(id_li).style.display = ""; |
|
} |
|
else { |
|
document.getElementById(id_li).style.display = "none"; |
|
} |
|
} |
|
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>'); |
|
|
#part to print selected parms overview |
|
$r->print(&mt('Selected Parameters:').'<br />'); |
|
|
|
#print out all possible parms and hide them by default |
|
$r->print('<ul>'); |
|
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
|
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
|
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
|
$r->print(' style="display:none"'); |
|
} |
|
$r->print('>' |
|
.($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey) |
|
.'</li>' |
|
); |
|
} |
|
$r->print('</ul>' |
|
.'<p><a href="javascript:showParms()">' |
|
.&mt('Show detailed Parameter Selection') |
|
.'</a></p>' |
|
); |
|
|
|
&shortCuts($r,$allparms,$pscat,$keyorder); |
|
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
} |
|
|
|
sub parmboxes { |
|
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
my $tempkey; |
|
|
|
#part to print the parm-list |
|
$r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">' |
|
.'<legend>'.&mt('Parameter').'</legend>' |
|
."\n" |
|
.'<table>' |
|
); |
my $cnt=0; |
my $cnt=0; |
|
|
|
$r->print('<tr>'); |
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.'" '); |
|
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
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"'); |
} |
} |
Line 1335 ENDSCRIPT
|
Line 1391 ENDSCRIPT
|
: $tempkey) |
: $tempkey) |
.'</label></td>'); |
.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==4) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
$cnt=0; |
$cnt=0; |
} |
} |
} |
} |
$r->print('</tr>' |
$r->print('</tr>' |
.'<tr id="LC_parm_overview_parm_menu_selectors">' |
.'</table>' |
|
.'<hr />' |
|
.'<a href="javascript:hideParms()">' |
|
.&mt('Hide') |
|
.'</a>' |
|
); |
|
|
|
#&shortCuts($r,$allparms,$pscat,$keyorder); |
|
$r->print('</fieldset>'); |
|
} |
|
sub shortCuts { |
|
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
|
|
#part to print out the shortcuts for parmselection |
|
$r->print('<table><tr id="LC_parm_overview_parm_menu_selectors">' |
.'<td valign="top">' |
.'<td valign="top">' |
.'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>' |
.'<fieldset><legend>'.&mt('Parameter Selection').'</legend>' |
.'<span class="LC_nobreak">' |
.'<span class="LC_nobreak">' |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
.'</span>' |
.'</span>' |
Line 1358 ENDSCRIPT
|
Line 1428 ENDSCRIPT
|
.'</fieldset>' |
.'</fieldset>' |
.'</td>' |
.'</td>' |
.'<td colspan="2" valign="top">' |
.'<td colspan="2" valign="top">' |
.'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>' |
.'<fieldset><legend>'.&mt('Add Selection for...').'</legend>' |
.'<span class="LC_nobreak">' |
.'<span class="LC_nobreak">' |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
.'</span>' |
.'</span>' |
Line 1378 ENDSCRIPT
|
Line 1448 ENDSCRIPT
|
.'</span>' |
.'</span>' |
.'</fieldset>' |
.'</fieldset>' |
.'</td>' |
.'</td>' |
.'</tr></table>' |
.'</tr></table>'); |
); |
|
} |
} |
|
|
sub partmenu { |
sub partmenu { |
Line 1438 sub usermenu {
|
Line 1507 sub usermenu {
|
$sections .= ' '.&mt('or').' '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function group_or_section(caller) { |
function group_or_section(caller) { |
if (caller == "cgroup") { |
if (caller == "cgroup") { |
if (document.parmform.cgroup.selectedIndex != 0) { |
if (document.parmform.cgroup.selectedIndex != 0) { |
Line 1449 function group_or_section(caller) {
|
Line 1519 function group_or_section(caller) {
|
} |
} |
} |
} |
} |
} |
|
// ]]> |
</script> |
</script> |
|; |
|; |
} else { |
} else { |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function group_or_section(caller) { |
function group_or_section(caller) { |
return; |
return; |
} |
} |
|
// ]]> |
</script> |
</script> |
|; |
|; |
} |
} |
Line 1488 function group_or_section(caller) {
|
Line 1561 function group_or_section(caller) {
|
if (%sectionhash || %grouphash) { |
if (%sectionhash || %grouphash) { |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); |
$r->print($sections.$groups); |
$r->print($sections.$groups); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
} |
} |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); |
Line 1499 function group_or_section(caller) {
|
Line 1573 function group_or_section(caller) {
|
|
|
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
$r->print('<div class="LC_ContentBoxSpecial">'); |
$r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); |
$r->print('<h2 class="LC_hcell">Step 2</h2>'); |
|
$r->print('<div class="LC_BoxPadding">' ); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
|
&parmmenu($r,$allparms,$pscat,$keyorder); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
&parmboxes($r,$allparms,$pscat,$keyorder); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
&partmenu($r,$allparts,$psprt); |
&partmenu($r,$allparts,$psprt); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
Line 1862 sub assessparms {
|
Line 1936 sub assessparms {
|
} |
} |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
|
$r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); |
$r->print('<div class="LC_ContentBoxSpecial">'); |
|
$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
|
$r->print('<div class="LC_BoxPadding">' ); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
|
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
|
|
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
} |
} |
|
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
|
|
|
&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 1886 sub assessparms {
|
Line 1958 sub assessparms {
|
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
} |
} |
$r->print('<div class="LC_ContentBoxSpecial">'); |
$r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection'))); |
$r->print('<h2 class="LC_hcell">Step 3</h2>'); |
|
$r->print('<div class="LC_BoxPadding">' ); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
|
|
|
$r->print('<p>'.$message.'</p>'); |
$r->print('<p>'.$message.'</p>'); |
|
|
Line 2308 ENDMAPONE
|
Line 2378 ENDMAPONE
|
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
|
|
sub crsenv { |
|
my $r=shift; |
|
my $setoutput=''; |
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
|
text=>"Course Environment"}); |
|
my $breadcrumbs = |
|
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my (%crsinfo,$chome); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
|
|
# |
|
# Go through list of changes |
|
foreach (keys %env) { |
|
next if ($_!~/^form\.(.+)\_setparmval$/); |
|
my $name = $1; |
|
my $value = $env{'form.'.$name.'_value'}; |
|
if ($name eq 'newp') { |
|
$name = $env{'form.newp_name'}; |
|
} |
|
if ($name =~ /^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') { |
|
$value=~s/^\/res\///; |
|
my $bkuptime=time; |
|
my @tmp = &Apache::lonnet::get |
|
('environment',['url'],$dom,$crs); |
|
$setoutput.=&mt('Backing up previous URL').': '. |
|
&Apache::lonnet::put |
|
('environment', |
|
{'top level map backup '.$bkuptime => $tmp[1] }, |
|
$dom,$crs). |
|
'<br />'; |
|
} |
|
# |
|
# Deal with modified default spreadsheets |
|
if ($name =~ /^spreadsheet_default_(classcalc| |
|
studentcalc| |
|
assesscalc)$/x) { |
|
my $sheettype = $1; |
|
if ($sheettype eq 'classcalc') { |
|
# no need to do anything since viewing the sheet will |
|
# cause it to be updated. |
|
} elsif ($sheettype eq 'studentcalc') { |
|
# expire all the student spreadsheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} else { |
|
# expire all the assessment spreadsheets |
|
# this includes non-default spreadsheets, but better to |
|
# be safe than sorry. |
|
&Apache::lonnet::expirespread('','','assesscalc'); |
|
# expire all the student spreadsheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} |
|
} |
|
# |
|
# Deal with the enrollment dates |
|
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
|
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
|
} |
|
# |
|
# Deal with the emails |
|
if ($name =~ /\.email$/) { |
|
foreach my $specifier (split(',',$value)) { |
|
my ($user,$sections_or_groups)= |
|
($specifier=~/^([^\(]+)\(([^\)]+)\)/); |
|
if (!$sections_or_groups) { |
|
$user = $specifier; |
|
} |
|
my ($name,$domain) = split(':',$user); |
|
if (!defined($user) || !defined($domain)) { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid e-mail address specified, address must be of the form username:domain what was specified was ([_1])",$user). |
|
'</span>'; |
|
undef($value); |
|
} elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid e-mail address specified, user [_1] is unknown.",$name). |
|
'</span>'; |
|
undef($value); |
|
} |
|
} |
|
} |
|
# Get existing cloners |
|
my @oldcloner = (); |
|
if ($name eq 'cloners') { |
|
my %clonenames=&Apache::lonnet::dump('environment',$dom,$crs,'cloners'); |
|
if ($clonenames{'cloners'} =~ /,/) { |
|
@oldcloner = split/,/,$clonenames{'cloners'}; |
|
} else { |
|
$oldcloner[0] = $clonenames{'cloners'}; |
|
} |
|
} |
|
# |
|
# Let the user know we made the changes |
|
if ($name && defined($value)) { |
|
my %failed_cloners; |
|
if ($name eq 'cloners') { |
|
$value =~ s/\s//g; |
|
$value =~ s/^,//; |
|
$value =~ s/,$//; |
|
# check requested clones are valid users. |
|
%failed_cloners = &check_cloners(\$value,\@oldcloner); |
|
} |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
if ($put_result eq 'ok') { |
|
$setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'; |
|
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
|
$setoutput .= &Apache::lonlocal::locallocaltime($value); |
|
} elsif ($name eq 'categories') { |
|
$setoutput .= $env{'form.categories_display'}; |
|
} else { |
|
$setoutput .= $value; |
|
} |
|
$setoutput .= '</b>.<br />'; |
|
if ($name eq 'cloners') { |
|
&change_clone($value,\@oldcloner); |
|
} |
|
# Update environment and nohist_courseids.db |
|
if (($name eq 'description') || ($name eq 'cloners') || |
|
($name eq 'hidefromcat') || ($name eq 'categories')) { |
|
if ($chome eq '') { |
|
%crsinfo = |
|
&Apache::lonnet::courseiddump($dom,'.',1,'.','.', |
|
$crs,undef,undef,'.'); |
|
$chome = &Apache::lonnet::homeserver($crs,$dom); |
|
} |
|
} |
|
if ($name eq 'description' && defined($value)) { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value}); |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
$crsinfo{$env{'request.course.id'}}{'description'} = $value; |
|
my $putresult = |
|
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
|
} |
|
if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) { |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value}); |
|
$crsinfo{$env{'request.course.id'}}{$name} = $value; |
|
my $putresult = |
|
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
|
} |
|
} else { |
|
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
|
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
|
} |
|
if (($name eq 'cloners') && (keys(%failed_cloners) > 0)) { |
|
$setoutput.= &mt('Unable to include').': '; |
|
my @fails; |
|
my $num = 0; |
|
if (defined($failed_cloners{'format'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'format'}. |
|
'</b>, '.&mt('reason').' - '. |
|
&mt('Invalid format'); |
|
$num ++; |
|
} |
|
if (defined($failed_cloners{'domain'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'domain'}. |
|
'</b>, '.&mt('reason').' - '. |
|
&mt('Domain does not exist'); |
|
$num ++; |
|
} |
|
if (defined($failed_cloners{'newuser'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'newuser'}. '</b>, '.&mt('reason').' - '. |
|
&mt('LON-CAPA user(s) do(es) not exist.'). |
|
'.<br />'.&mt('Please '). |
|
' <a href="/adm/createuser">'. |
|
&mt('add the user(s)').'</a>, '. |
|
&mt('and then return to the '). |
|
'<a href="/adm/parmset?action=crsenv">'. |
|
&mt('Course Parameters page').'</a> '. |
|
&mt('to add the new user(s) to the list of possible cloners'); |
|
} |
|
$setoutput .= join('; ',@fails).'.<br />'; |
|
} |
|
} |
|
} |
|
|
|
# ------------------------- Re-init course environment entries for this session |
|
|
|
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
|
{'freshen_cache' => 1}); |
|
|
|
# -------------------------------------------------------- Get parameters again |
|
|
|
my %values=&Apache::lonnet::dump('environment',$dom,$crs); |
|
my $SelectStyleFile=&mt('Select Style File'); |
|
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
|
my $output=''; |
|
my $output_SB = ''; # will be replaced by "$output" when all changes are done |
|
my $can_categorize; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'par' => 'Parameter', |
|
'val' => 'Value', |
|
'set' => 'Set?', |
|
'sav' => 'Save', |
|
); |
|
if (! exists($values{'con_lost'})) { |
|
my %descriptions= |
|
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
|
'<a href="javascript:openbrowser'. |
|
"('envform','url','sequence')\">". |
|
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
|
&mt('Modification may make assessment data inaccessible!'). |
|
'</span>', |
|
'description' => '<b>'.&mt('Course Title').'</b>', |
|
'courseid' => '<b>'.&mt('Course ID or number'). |
|
'</b><br />'. |
|
'('.&mt('internal, optional').')', |
|
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")<br />' |
|
.&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'<br />' |
|
.&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"<tt>*:domain</tt>"').'<br />' |
|
.&mt('Use [_1] to allow unrestricted cloning in all domains.','"<tt>*</tt>"'), |
|
'grading' => '<b>'.&mt('Grading').'</b><br />'. |
|
&mt('[_1], [_2], or [_3]','"<tt>standard</tt>"','"<tt>external</tt>"','"<tt>spreadsheet</tt>"').&Apache::loncommon::help_open_topic('GradingOptions'), |
|
'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />' |
|
.&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'<br />' |
|
.'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"<tt>any</tt>"','"<tt>section</tt>"').')', |
|
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b><br />'. |
|
'<a href="javascript:openbrowser'. |
|
"('envform','default_xml_style'". |
|
",'sty')\">$SelectStyleFile</a><br />", |
|
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
|
'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').'</b>', |
|
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
|
'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').'</b>', |
|
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
|
'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').'</b>', |
|
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />' |
|
.'('.&mt('[_1] for default hiding','"<tt>yes</tt>"').')', |
|
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />' |
|
.'('.&mt('[_1] for visible separation.','"<tt>yes</tt>"').' ' |
|
.&mt('Changes will not show until next login.').')', |
|
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />' |
|
.'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')', |
|
'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />' |
|
.'('.&mt("[_1] for link to each a listing of each student's files.",'"<tt>yes</tt>"').')', |
|
'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />' |
|
.'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')', |
|
'plc.roles.denied'=> '<b>'.&mt('Disallow chat room use for Roles').'</b><br />' |
|
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
|
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
|
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
|
'plc.users.denied' => |
|
'<b>'.&mt('Disallow chat room use for Users').'</b><br />'. |
|
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
|
|
|
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />' |
|
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"') |
|
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
|
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
|
'pch.users.denied' => |
|
'<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'. |
|
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
|
'spreadsheet_default_classcalc' |
|
=> '<b>'.&mt('Default Course Spreadsheet').'</b> '. |
|
'<a href="javascript:openbrowser'. |
|
"('envform','spreadsheet_default_classcalc'". |
|
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
|
'spreadsheet_default_studentcalc' |
|
=> '<b>'.&mt('Default Student Spreadsheet').'</b><br />'. |
|
'<a href="javascript:openbrowser'. |
|
"('envform','spreadsheet_default_calc'". |
|
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
|
'spreadsheet_default_assesscalc' |
|
=> '<b>'.&mt('Default Assessment Spreadsheet').'</b> '. |
|
'<a href="javascript:openbrowser'. |
|
"('envform','spreadsheet_default_assesscalc'". |
|
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
|
'allow_limited_html_in_feedback' |
|
=> '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'. |
|
'('.&mt('Set value to [_1] to allow.','"<tt>yes</tt>"').')', |
|
'allow_discussion_post_editing' |
|
=> '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />' |
|
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
|
.'('.&mt('Set value to [_1] to allow all roles.','"<tt>yes</tt>"').')' |
|
.'("<tt>'.&mt('role:section,role:section,...').'</tt>")<br />' |
|
.'('.&mt('Example: "<tt>st:001,st:002,in,cc</tt>" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')', |
|
'rndseed' |
|
=> '<b>'.&mt('Randomization algorithm used').'</b><br />' |
|
.'<span class="LC_error">' |
|
.&mt('Modifying this will make problems have different numbers and answers!') |
|
.'</span>', |
|
'receiptalg' |
|
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
|
&mt('This controls how receipt numbers are generated.'), |
|
'suppress_tries' |
|
=> '<b>'.&mt('Suppress number of tries in printing').'</b><br />'. |
|
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
|
'problem_stream_switch' |
|
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'. |
|
' ('.&mt('[_1] if allowed, anything else if not','"<tt>yes</tt>"').')', |
|
'default_paper_size' |
|
=> '<b>'.&mt('Default paper type').'</b><br />'. |
|
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
|
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
|
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
|
'print_header_format' |
|
=> ' <b>'.&mt('Print header format').'</b><br />' |
|
.&mt('Substitutions:<br />[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the <tt>%</tt> limit the field size.','"<tt>%n</tt>"','"<tt>%c</tt>"','"<tt>%a</tt>"'), |
|
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
|
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
|
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")', |
|
'languages' => '<b>'.&mt('Languages used').'</b>', |
|
'disable_receipt_display' |
|
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
|
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'task_messages' |
|
=> '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','"<tt>only_student</tt>"','"<tt>student_and_user_notes_screen</tt>"').')', |
|
'disablesigfigs' |
|
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
|
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'disableexampointprint' |
|
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
|
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'externalsyllabus' |
|
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
|
'tthoptions' |
|
=> '<b>'.&mt('Default set of options to pass to tth/m when converting TeX').'</b>', |
|
|
|
'texengine' |
|
=> '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />' |
|
.'('.&mt("[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student's preference",'"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')', |
|
'timezone' |
|
=> '<b>'.&mt('Timezone in which the course takes place').'</b>', |
|
|
|
'suppress_embed_prompt' |
|
=> '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'. |
|
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
|
'hidefromcat' |
|
=> '<b>'.&mt('Exclude from course catalog').'</b><br />'. |
|
' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')', |
|
'categories' |
|
=> '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
|
&mt('Display Categories').'</a>', |
|
'datelocale' |
|
=> '<b>'.&mt('Locale used for course calendar').'</b>', |
|
'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.').')', |
|
); |
|
|
|
|
|
# ---------------------------------------------------------------- |
|
# Begin: New Version with Parameter Categories |
|
|
|
sub parameter_row { |
|
# Create parameter row for course environment screen |
|
|
|
my ($parameter, $description) = @_; |
|
|
|
# Start Parameter Row |
|
my $output = &Apache::loncommon::start_data_table_row(); |
|
|
|
# Column 1/3: Descriptive text of current parameter |
|
$output .= '<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$/) { |
|
$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 { # Display default textbox in all other cases |
|
$output .= '<td>' |
|
.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
|
$values{$parameter}, |
|
40, |
|
$onchange) |
|
.'</td>'; |
|
} |
|
|
|
# Column 3/3: Check Box (in most cases) |
|
unless ($parameter eq 'rolenames') { |
|
$output .= '<td>' |
|
.&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval') |
|
.'</td>'; |
|
} |
|
|
|
# End Parameter Row |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
|
|
return $output; |
|
} # End sub parameter_row |
|
|
|
|
|
# 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'); |
|
} |
|
if ($can_categorize) { |
|
push(@can_cats,'categories'); |
|
} |
|
$parm_cat_parms{'cat_can'} = [@can_cats]; |
|
|
|
# Add custom parameters to custom parameter category |
|
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]; |
|
|
|
|
|
# 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 $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
|
if ($can_categorize) { |
|
$categorize_js = <<ENDSCRIPT; |
|
function catsbrowser() { |
|
var catswin = null; |
|
var url = '/adm/parmset?action=categorizecourse'; |
|
if (!catswin || catswin.closed) { |
|
catswin=window.open(url,'categorieswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
|
} else { |
|
catswin.focus(); |
|
} |
|
} |
|
ENDSCRIPT |
|
} |
|
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
|
$browse_js."\n".$categorize_js."\n".'</script>'; |
|
my $start_page = |
|
&Apache::loncommon::start_page('Set Course Environment', |
|
$jscript); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
$r->print(<<ENDENV); |
|
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
|
$setoutput |
|
$output_SB |
|
</form> |
|
$end_page |
|
ENDENV |
|
} |
|
|
|
sub can_modify_catsettings { |
|
my ($dom) = @_; |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
|
my ($can_toggle_cat,$can_categorize); |
|
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
|
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
|
$can_toggle_cat = 1; |
|
} |
|
if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { |
|
$can_categorize = 1; |
|
} |
|
} |
|
return ($can_toggle_cat,$can_categorize); |
|
} |
|
|
|
sub assign_course_categories { |
|
my ($r) = @_; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $hascats = 0; |
|
my $cathash; |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); |
|
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconf{'coursecategories'}{'cats'}; |
|
if (ref($cathash) eq 'HASH') { |
|
$hascats = 1; |
|
} |
|
} |
|
my $catwin_js; |
|
if ($hascats) { |
|
my $alert = &mt('Use \"Save\" in the main window to save course categories'); |
|
$catwin_js = <<ENDSCRIPT; |
|
<script type="text/javascript"> |
|
|
|
function updateCategories() { |
|
var newcategories = ''; |
|
var unescapedcats = ''; |
|
if (document.chgcats.usecategory.length) { |
|
for (var i=0; i<document.chgcats.usecategory.length; i++) { |
|
if (document.chgcats.usecategory[i].checked == true) { |
|
newcategories = newcategories + document.chgcats.usecategory[i].value + '&'; |
|
unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & '; |
|
} |
|
} |
|
if (newcategories.length > 0) { |
|
newcategories = newcategories.slice(0,-1); |
|
} |
|
if (unescapedcats.length > 0) { |
|
unescapedcats = unescapedcats.slice(0,-3); |
|
} |
|
} else { |
|
if (document.chgcats.usecategory.checked == true) { |
|
newcategories = document.chgcats.usecategory.value; |
|
unescapedcats = document.chgcats.catname.value; |
|
} |
|
} |
|
opener.document.envform.categories_value.value = newcategories; |
|
opener.document.envform.categories_display.value = unescapedcats; |
|
opener.document.envform.categories_setparmval.checked = true; |
|
alert("$alert"); |
|
self.close(); |
|
return; |
|
} |
|
|
|
</script> |
|
ENDSCRIPT |
|
} else { |
|
my $onload; |
|
} |
|
my $start_page = |
|
&Apache::loncommon::start_page('Course Categories',$catwin_js, |
|
{'only_body' => 1,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>'; |
|
if ($hascats) { |
|
my %currsettings = |
|
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); |
|
$categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'. |
|
'<form name="chgcats" action="/adm/parmset" method="post">'."\n" |
|
.&Apache::loncommon::assign_categories_table($cathash, |
|
$currsettings{'categories'})."\n" |
|
.'<br /><input type="button" name="changes" value="' |
|
.&mt('Copy to main window').'" ' |
|
.'onclick="javascript:updateCategories()" /></form><br />'; |
|
} else { |
|
$categoriesform .= &mt('No categories defined for this domain'); |
|
} |
|
$r->print($start_page.$categoriesform.$end_page); |
|
return; |
|
} |
|
|
|
################################################## |
################################################## |
# Overview mode |
# Overview mode |
################################################## |
################################################## |
Line 3605 ENDOVER
|
Line 2875 ENDOVER
|
|
|
#$r->print('<table id="LC_parm_overview_scope"> |
#$r->print('<table id="LC_parm_overview_scope"> |
# <tr><td class="LC_parm_overview_level_menu">'); |
# <tr><td class="LC_parm_overview_level_menu">'); |
$r->print('<div class="LC_ContentBoxSpecial">'); |
$r->print('<div class="LC_Box">'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
$r->print('<div class="LC_BoxPadding">' ); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
#$r->print('</td>'); |
#$r->print('</td>'); |
} |
} |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
#$r->print('</td></tr></table>'); |
#$r->print('</td></tr></table>'); |
|
|
#$r->print('<table id="LC_parm_overview_controls"> |
#$r->print('<table id="LC_parm_overview_controls"> |
# <tr><td class="LC_parm_overview_parm_selectors">'); |
# <tr><td class="LC_parm_overview_parm_selectors">'); |
$r->print('<div class="LC_ContentBoxSpecial">'); |
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_BoxPadding">' ); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
&parmboxes($r,\%allparms,\@pscat,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
$r->print('<table>'. |
$r->print('<table>'. |
Line 3638 ENDOVER
|
Line 2912 ENDOVER
|
&groupmenu($r,\@selected_groups); |
&groupmenu($r,\@selected_groups); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
#$r->print('</td></tr></table>'); |
#$r->print('</td></tr></table>'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
|
|
$r->print('<div class="LC_ContentBoxSpecial">'); |
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_BoxPadding">' ); |
$r->print('<div>'); |
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder); |
Line 4064 ENDMAINFORMHEAD
|
Line 3339 ENDMAINFORMHEAD
|
my @menu = |
my @menu = |
( { categorytitle=>'Settings for this Course', |
( { categorytitle=>'Settings for this Course', |
items => [ |
items => [ |
{ linktext => 'Course Environment', |
{ linktext => 'Course Configuration', |
url => '/adm/parmset?action=crsenv', |
url => '/adm/courseprefs?origin=params', |
permission => $parm_permission, |
permission => $parm_permission, |
linktitle =>'Edit environment settings for this course.' , |
linktitle =>'Edit course configuration.' , |
icon => 'preferences-desktop-remote-desktop.png' , |
icon => 'preferences-desktop-remote-desktop.png' , |
#help => 'Course_Environment', |
#help => 'Course_Environment', |
}, |
}, |
Line 4159 sub output_row {
|
Line 3434 sub output_row {
|
push @options,['deleted', 'Delete Metadata Field']; |
push @options,['deleted', 'Delete Metadata Field']; |
} |
} |
$output = &Apache::loncommon::start_data_table_row(); |
$output = &Apache::loncommon::start_data_table_row(); |
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>'; |
$output .= '<td><strong>'.$field_text.':</strong></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
foreach my $opt (@options) { |
foreach my $opt (@options) { |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label> |
$output .= '<td>'.(' ' x 5).'<label> |
<input type="checkbox" name="'. |
<input type="checkbox" name="'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
&mt($opt->[1]).'</label></span> </td>'; |
&mt($opt->[1]).'</label></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"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
$output .= '<td>'.(' ' x 10).'<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
my $multiple_checked; |
my $multiple_checked; |
my $single_checked; |
my $single_checked; |
Line 4183 sub output_row {
|
Line 3458 sub output_row {
|
$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).' |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' /> |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' /> |
'.&mt('Student may select multiple choices from list').'</span></td>'; |
'.&mt('Student may select multiple choices from list').'</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).' |
<input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' /> |
<input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' /> |
'.&mt('Student may select only one choice from list').'</span></td>'; |
'.&mt('Student may select only one choice from list').'</td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
return ($output); |
return ($output); |
Line 4992 sub handler {
|
Line 4267 sub handler {
|
&assessparms($r); |
&assessparms($r); |
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'crsenv') { |
|
&crsenv($r); |
|
} elsif ($env{'form.action'} eq 'setoverview') { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&overview($r); |
&overview($r); |
} elsif ($env{'form.action'} eq 'addmetadata') { |
} elsif ($env{'form.action'} eq 'addmetadata') { |