{'categories'},$crstype)."\n";
+ $settings->{'categories'},$crstype,$disabled)."\n";
}
}
if (ref($domconf{'autoenroll'}) eq 'HASH') {
$autocoowner = $domconf{'autoenroll'}{'co-owners'};
}
+ my ($currcanclone,@code_order,$cloner_instcode);
+ my %codedefaults;
+ &Apache::lonnet::auto_instcode_defaults($cdom,\%codedefaults,
+ \@code_order);
+ if ($settings->{'cloners'}) {
+ unless ($settings->{'cloners'} eq '*') {
+ my @currclone = split(/,/,$settings->{'cloners'});
+ foreach my $item (@currclone) {
+ unless ($item eq '*') {
+ if (($item !~ /\:/) && ($item =~ /=/)) {
+ $cloner_instcode = 1;
+ }
+ }
+ }
+ }
+ }
+ if (ref($domconf{'coursedefaults'}) eq 'HASH') {
+ my $canclone = $domconf{'coursedefaults'}{'canclone'};
+ if (ref($canclone) eq 'HASH') {
+ if (ref($canclone->{'instcode'}) eq 'ARRAY') {
+ if ($settings->{'internal.coursecode'}) {
+ my @posscodes;
+ if (@code_order > 0) {
+ $currcanclone = 'instcode';
+ foreach my $item (@{$canclone->{'instcode'}}) {
+ if (grep(/^\Q$item\E$/,@code_order)) {
+ push(@posscodes,$item);
+ }
+ }
+ my $codestr = join(' + ',@posscodes);
+ $clonedefaults = &mt('Default for official courses is to also allow cloning if [_1] match in cloner and cloned.',
+ '"'.$codestr.'"').'
';
+ }
+ }
+ }
+ } elsif ($canclone eq 'domain') {
+ $clonedefaults = &mt('Default is for any course requester in [_1] domain to be able to clone.',
+ ''.$cdom.'').'
';
+ $currcanclone = 'domain';
+ }
+ if ($clonedefaults) {
+ if ($settings->{'cloners'} ne '') {
+ $clonedefaults .= '
'.&mt('Default does [_1]not[_2] currently apply because values have been set in the course.','','');
+ } else {
+ $clonedefaults .= &mt('Default is disregarded if [_1]any[_2] values are set here in the course.','','');
+ }
+ $clonedefaults = '
'.$clonedefaults;
+ }
+ }
if (!defined($categoriesform)) {
$categoriesform = &mt('No categories defined in this domain.');
}
-
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $replace;
if ($crstype eq 'Community') {
@@ -1692,22 +2840,28 @@ sub print_courseinfo {
} else {
$replace = &mt('To replace the standard title for a course role, enter a title, otherwise leave blank');
}
+ my ($editmap,$editsyllabus);
+ unless ($noedit) {
+ $editmap = (' 'x2).
+ '".
+ &mt('Select Map').'
'.
+ &mt('Modification may make assessment data inaccessible!').
+ '';
+ $editsyllabus = &mt('[_1]Edit[_2]','',
+ '');
+ }
my %items = (
'url' => {
- text => ''.&mt($itemtext->{'url'}).''.(' 'x2).
- '".
- &mt('Select Map').'
'.
- &mt('Modification may make assessment data inaccessible!').
- '',
+ text => ''.&mt($itemtext->{'url'}).''.$editmap,
input => 'textbox',
- size => '40',
+ size => '55',
advanced => 1
},
'description' => {
text => ''.&mt($itemtext->{'description'}).'',
input => 'textbox',
- size => '25',
+ size => '55',
},
'owner' => {
text => ''.&mt($itemtext->{'owner'}).'',
@@ -1715,15 +2869,22 @@ sub print_courseinfo {
'co-owners' => {
text => ''.&mt($itemtext->{'co-owners'}).'',
},
+ 'clonedfrom' => {
+ text => ''.&mt($itemtext->{'clonedfrom'}).'',
+ },
'courseid' => {
text => ''.&mt($itemtext->{'courseid'}).'
'.'('.
&mt('internal, optional').')',
input => 'textbox',
size => '25',
},
+ 'uniquecode' => {
+ text => ''.&mt($itemtext->{'uniquecode'}).'',
+ },
'cloners' => {
text => ''.&mt($itemtext->{'cloners'}).'
'.
- &mt('Owner and Coordinators included automatically'),
+ &mt('Owner and Coordinators included automatically').
+ $clonedefaults,
input => 'textbox',
size => '40'
},
@@ -1734,11 +2895,10 @@ sub print_courseinfo {
size => '20',
advanced => 1
},
- 'externalsyllabus' => {
- text => ''.&mt($itemtext->{'externalsyllabus'}).'
('.
- &mt('not using syllabus template)'),
- input => 'textbox',
- size => '40',
+ 'syllabus' => {
+ text => ''.&mt($itemtext->{'syllabus'}).'
'.
+ &mt('(Syllabus type in use)').(' ' x2).
+ $editsyllabus,
},
'hidefromcat' => {
text => ''.&mt($itemtext->{'hidefromcat'}).'
'.
@@ -1754,27 +2914,37 @@ sub print_courseinfo {
'loncaparev' => {
text => ''.&mt($itemtext->{'loncaparev'}).'',
},
+ 'defaultcredits' => {
+ text => ''.&mt($itemtext->{'defaultcredits'}).'',
+ },
);
my $datatable;
my $count = 0;
foreach my $item (@{$ordered}) {
+ my $colspan;
if ($item eq 'hidefromcat') {
next if (!$can_toggle_cat);
} elsif ($item eq 'categories') {
next if (!$can_categorize);
+ } elsif ($item eq 'uniquecode') {
+ next if (!$env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'});
+ }
+ unless (($item eq 'cloners') || ($item eq 'rolenames')) {
+ $colspan = 2;
}
$count ++;
if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) {
- $datatable .= &item_table_row_start($items{$item}{text},$count,"advanced");
+ $datatable .= &item_table_row_start($items{$item}{text},$count,"advanced",$colspan);
} else {
- $datatable .= &item_table_row_start($items{$item}{text},$count);
+ $datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan);
}
if ($items{$item}{input} eq 'radio') {
- $datatable .= &yesno_radio($item,$settings);
+ $datatable .= &yesno_radio($item,$settings,undef,undef,undef,$noedit);
} elsif ($item eq 'cloners') {
my $includeempty = 1;
my $num = 0;
- $datatable .= &Apache::loncommon::start_data_table().
+ $datatable .= ''.
+ &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_row().
' | '.
- (' 'x2).''.&mt('Yes').''.
+ (' 'x2).' | '.
+ "'cloners_all'".');"'.$disabled.' />'.&mt('No').''.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
- ''.
+ ''.
&Apache::loncommon::start_data_table();
my @cloners;
if ($settings->{$item} eq '') {
- $datatable .= &new_cloners_dom_row($cdom,'0');
+ unless ($noedit) {
+ my $default;
+ if ($currcanclone eq 'domain') {
+ $default = '0';
+ }
+ $datatable .= &new_cloners_dom_row($cdom,'0',$default);
+ }
} elsif ($settings->{$item} ne '*') {
my @entries = split(/,/,$settings->{$item});
if (@entries > 0) {
@@ -1818,7 +2995,7 @@ sub print_courseinfo {
'
'.
''.
&Apache::loncommon::end_data_table_row();
$num ++;
@@ -1841,23 +3018,56 @@ sub print_courseinfo {
''.
$add_domtitle.' '.
&Apache::loncommon::select_dom_form('','cloners_newdom',
- $includeempty).
+ $includeempty,undef,undef,
+ undef,undef,$noedit).
''.
' | '.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
- ''.
+ ''.
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_row().
''.
&mt('Specific users').' ('.
&mt('user:domain,user:domain').') '.
&Apache::lonhtmlcommon::textbox($item,$cloners_str,
- $items{$item}{'size'}).
+ $items{$item}{'size'},$disabled).
' | '.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table();
+ if (@code_order > 0) {
+ my (%cat_items,@codetitles,%cat_titles,%cat_order);
+ my ($jscript,$totcodes,$numtitles,$lasttitle) =
+ &Apache::courseclassifier::instcode_selectors_data($cdom,'display',
+ \%cat_items,\@codetitles,
+ \%cat_titles,\%cat_order);
+ my $showncodes = 'off';
+ my $checkedoff = ' checked="checked"';
+ my $checkedon = '';
+ if ($cloner_instcode) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ $showncodes = 'on';
+ }
+ $datatable .= ''.
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_row().
+ ''.
+ &mt('Cloning by official course(s) based on course category').(' 'x2).
+ ''.
+ (' ').
+ ''.
+ &Apache::courseclassifier::build_instcode_selectors($numtitles,
+ $lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order,
+ $showncodes,'LC_cloners_instcodes','LC_cloners_instcode',$noedit).
+ ' | '.&Apache::loncommon::end_data_table_row().
+ &Apache::loncommon::end_data_table();
+ }
} elsif ($item eq 'rolenames') {
- $datatable .= &Apache::loncommon::start_data_table();
+ $datatable .= ''.
+ &Apache::loncommon::start_data_table();
my @roles;
if ($crstype eq 'Community') {
@roles = ('co');
@@ -1872,12 +3082,17 @@ sub print_courseinfo {
' | '.
&Apache::lonhtmlcommon::textbox('rolenames_'.$role,
$settings->{$role.'.plaintext'},
- $items{$item}{size}).' | '.
+ $items{$item}{size},$disabled).''.
&Apache::loncommon::end_data_table_row();
}
$datatable .= &Apache::loncommon::end_data_table().'';
} elsif ($item eq 'categories') {
- my $launcher = 'onFocus="this.blur();javascript:catsbrowser();";';
+ my $launcher;
+ if ($noedit) {
+ $launcher = $disabled;
+ } else {
+ $launcher = 'onfocus="this.blur();javascript:catsbrowser();"';
+ }
$datatable .= ''.
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item},
$items{$item}{size},$launcher);
@@ -1892,8 +3107,22 @@ sub print_courseinfo {
$owner = &mt('None specified');
}
$datatable .= $owner;
+ } elsif ($item eq 'clonedfrom') {
+ my $clonesrc = $env{'course.'.$env{'request.course.id'}.'.clonedfrom'};
+ my $clonedfrom = &mt('None');
+ if ($clonesrc =~ m{/$match_domain/$match_courseid}) {
+ my %clonesrcinfo = &Apache::lonnet::coursedescription($clonesrc);
+ if ($clonesrcinfo{'description'}) {
+ $clonedfrom = $clonesrcinfo{'description'}.' '.($clonesrc);
+ }
+ }
+ $datatable .= $clonedfrom;
+ } elsif ($item eq 'uniquecode') {
+ my $code = $env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'};
+ if ($code) {
+ $datatable .= $code;
+ }
} elsif ($item eq 'co-owners') {
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $coowners = $env{'course.'.$env{'request.course.id'}.'.internal.co-owners'};
my @currcoown;
if ($coowners) {
@@ -1903,15 +3132,45 @@ sub print_courseinfo {
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) {
$datatable .= &show_autocoowners(@currcoown);
} else {
- $datatable .= &coowner_invitations($cnum,$cdom,@currcoown);
+ $datatable .= &coowner_invitations($cnum,$cdom,\@currcoown,$noedit);
}
} else {
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) {
$datatable .= &show_autocoowners(@currcoown);
} else {
- $datatable .= &manage_coownership($cnum,$cdom,@currcoown);
+ $datatable .= &manage_coownership($cnum,$cdom,\@currcoown,$noedit);
}
}
+ } elsif ($item eq 'syllabus') {
+ my $external = $env{'course.'.$env{'request.course.id'}.'.externalsyllabus'};
+ my $uploaded = $env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'};
+ my $minimal = $env{'course.'.$env{'request.course.id'}.'.minimalsyllabus'};
+ if (($minimal =~/\w/) || ($uploaded =~/\w/)) {
+ if ($minimal =~/\w/) {
+ if ($external =~ m{\Q$minimal\E$}) {
+ undef($external);
+ }
+ } elsif ($uploaded =~/\w/) {
+ if ($external =~ m{\Q$uploaded\E$}) {
+ undef($external);
+ }
+ }
+ } elsif ($external!~/\w/) {
+ undef($external);
+ }
+ if ($external) {
+ $datatable .= &mt('External URL');
+ } elsif ($minimal) {
+ $datatable .= &mt('Minimal template');
+ } elsif ($uploaded) {
+ $datatable .= &mt('Uploaded file');
+ } else {
+ $datatable .= &mt('Standard template');
+ }
+ $datatable .= (' ' x 2).
+ &mt('[_1]View[_2]',
+ '',
+ '');
} elsif ($item eq 'loncaparev') {
my $loncaparev = $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'};
my $showreqd;
@@ -1923,7 +3182,7 @@ sub print_courseinfo {
}
$datatable .= $showreqd;
} else {
- $datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size});
+ $datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size},$disabled);
}
$datatable .= &item_table_row_end();
}
@@ -1932,19 +3191,24 @@ sub print_courseinfo {
}
sub new_cloners_dom_row {
- my ($newdom,$num) = @_;
- my $output;
+ my ($newdom,$num,$default) = @_;
+ my ($output,$checkedon,$checkedoff);
if ($newdom ne '') {
+ if ($num eq $default) {
+ $checkedon = 'checked="checked" ';
+ } else {
+ $checkedoff = 'checked="checked" ';
+ }
$output .= &Apache::loncommon::start_data_table_row().
''.
&mt('Any user in domain:').' '.$newdom.''.
(' 'x2).''.(' 'x2).
'
@@ -2081,6 +3346,7 @@ ENDSCRIPT
sub display_loncaparev_constraints {
my ($r,$navmap,$loncaparev,$crstype) = @_;
+ my ($reqdmajor,$reqdminor);
my $cid = $env{'request.course.id'};
my $cdom = $env{'course.'.$cid.'.domain'};
my $cnum = $env{'course.'.$cid.'.num'};
@@ -2090,25 +3356,45 @@ sub display_loncaparev_constraints {
'section/group' => 'section/group',
'user' => 'user',
);
- my (%checkparms,%checkresponsetypes,%checkcrstypes,%anonsurvey,%randomizetry);
- &Apache::loncommon::build_release_hashes(\%checkparms,\%checkresponsetypes,
- \%checkcrstypes,\%anonsurvey,\%randomizetry);
- if (defined($checkcrstypes{$crstype})) {
+ &Apache::lonrelrequtils::init_global_hashes();
+ if (defined($Apache::lonrelrequtils::checkcrstypes{$crstype})) {
+ ($reqdmajor,$reqdminor) = split(/\./,$Apache::lonrelrequtils::checkcrstypes{$crstype});
$output .= ''.&mt('Course type: [_1] requires [_2] or newer',$crstype,
- $checkcrstypes{$crstype}).'';
+ $Apache::lonrelrequtils::checkcrstypes{$crstype}).'';
}
my (%fromparam,%rowspan,%bymap,%byresource,@scopeorder,%toshow,%allmaps,
- %byresponsetype,%bysubmission);
+ %byresponsetype,%bysubmission,%fromblocks);
@scopeorder = ('all','section/group','user');
+ my $now = time;
my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom);
if (ref($resourcedata) eq 'HASH') {
foreach my $key (keys(%{$resourcedata})) {
- foreach my $item (keys(%checkparms)) {
+ foreach my $item (keys(%Apache::lonrelrequtils::checkparms)) {
if ($key =~ /(\Q$item\E)$/) {
- if (ref($checkparms{$item}) eq 'ARRAY') {
+ if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') {
my $value = $resourcedata->{$key};
+ if ($item eq 'examcode') {
+ if (&Apache::lonnet::validCODE($value)) {
+ $value = 'valid';
+ } else {
+ $value = '';
+ }
+ } elsif ($item eq 'printstartdate') {
+ if ($value =~ /^\d+$/) {
+ if ($value > $now) {
+ $value = 'future';
+ }
+ }
+ } elsif ($item eq 'printenddate') {
+ if ($value =~ /^\d+$/) {
+ if ($value < $now) {
+ $value = 'past';
+ }
+ }
+
+ }
my ($middle,$scope,$which,$level,$map,$resource);
- if (grep(/^\Q$value\E$/,@{$checkparms{$item}})) {
+ if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) {
my $stdtype = &Apache::lonparmset::standard_parameter_types($item);
my $stdname = &Apache::lonparmset::standard_parameter_names($item);
my $valname = &get_param_description($stdtype,$value);
@@ -2200,6 +3486,9 @@ sub display_loncaparev_constraints {
' | '.&mt('Extent').' | '.&mt('Setting').' | '.
&Apache::loncommon::end_data_table_header_row();
foreach my $rev (keys(%fromparam)) {
+ my ($major,$minor) = split(/\./,$rev);
+ ($reqdmajor,$reqdminor) =
+ &Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
$output .= &Apache::loncommon::start_data_table_row().
''.$rev.' | ';
my $newrow;
@@ -2230,6 +3519,75 @@ sub display_loncaparev_constraints {
}
}
+ my %comm_blocks = &Apache::lonnet::dump('comm_block',$cdom,$cnum);
+ my $now = time;
+ if (keys(%comm_blocks) > 0) {
+ foreach my $block (keys(%comm_blocks)) {
+ if ($block =~ /^firstaccess____(.+)$/) {
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:timer'};
+ if (ref($comm_blocks{$block}) eq 'HASH') {
+ push(@{$fromblocks{'timer'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
+ ' '.&mt('set by [_1]',
+ &Apache::loncommon::plainname(split(/:/,$comm_blocks{$block}{'setter'}))));
+ }
+ next;
+ } elsif ($block =~ /^(\d+)____(\d+)$/) {
+ my ($start,$end) = ($1,$2);
+ next if ($end < $now);
+ }
+ if (ref($comm_blocks{$block}) eq 'HASH') {
+ if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') {
+ if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') {
+ if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}}) > 0) {
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:docs'};
+ push(@{$fromblocks{'docs'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
+ ' '.
+ &mt('set by [_1]',
+ &Apache::loncommon::plainname(split(/:/,$comm_blocks{$block}{'setter'}))));
+ }
+ } elsif ($comm_blocks{$block}{'blocks'}{'printout'} eq 'on') {
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:printout'};
+ push(@{$fromblocks{'printout'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
+ ' '.
+ &mt('set by [_1]',
+ &Apache::loncommon::plainname(split(/:/,$comm_blocks{$block}{'setter'}))));
+
+ }
+ }
+ }
+ }
+ if (keys(%fromblocks)) {
+ my %lt = (
+ docs => 'Content blocking',
+ printout => 'Printout generation',
+ timer => 'Timed quiz trigger',
+ );
+ $output .= ''.&mt('Requirements from exam blocking').'
'.
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ ''.&mt('Release').' | '.&mt('Setting').' | '.
+ ''.&mt('Event(s)').' | '.
+ &Apache::loncommon::end_data_table_header_row();
+ foreach my $type ('docs','printout','timer') {
+ if (ref($fromblocks{$type}) eq 'HASH') {
+ foreach my $rev (keys(%{$fromblocks{$type}})) {
+ my ($major,$minor) = split(/\./,$rev);
+ ($reqdmajor,$reqdminor) =
+ &Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
+ $output .= &Apache::loncommon::start_data_table_row().
+ ''.$rev.' | '.$lt{$type}.' | ';
+ foreach my $event (sort(@{$fromblocks{$type}{$rev}})) {
+ $output .= $event.' ';
+ }
+ $output =~ s{\Q \E$}{};
+ $output .= ' | '.&Apache::loncommon::end_data_table_row();
+ }
+ }
+ }
+ $output .= &Apache::loncommon::end_data_table().'
';
+ }
+ }
+
if (defined($navmap)) {
my %anonsubms=&Apache::lonnet::dump('nohist_anonsurveys',$cdom,$cnum);
my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'};
@@ -2239,7 +3597,7 @@ sub display_loncaparev_constraints {
my $stdname=&Apache::lonparmset::standard_parameter_names('type');
my $valanon=&get_param_description($stdtype,'anonsurvey');
my $valrandtry=&get_param_description($stdtype,'randomizetry');
-
+ my %checkedrev;
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) {
my @parts = @{$res->parts()};
my $symb = $res->symb();
@@ -2256,6 +3614,13 @@ sub display_loncaparev_constraints {
push(@{$bysubmission{$symb}{$rev}},$what);
}
$allmaps{$enclosing_map} = 1;
+ unless ($checkedrev{'anonsurvey'}) {
+ my ($major,$minor) = split(/\./,$rev);
+ ($reqdmajor,$reqdminor) =
+ &Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,
+ $reqdmajor,$reqdminor);
+ $checkedrev{'anonsurvey'} = 1;
+ }
}
if (exists($randtrysubms{$symb."\0".$part})) {
my $rev = $rev_randtry;
@@ -2268,12 +3633,27 @@ sub display_loncaparev_constraints {
push(@{$bysubmission{$symb}{$rev}},$what);
}
$allmaps{$enclosing_map} = 1;
+ unless ($checkedrev{'randomizetry'}) {
+ my ($major,$minor) = split(/\./,$rev);
+ ($reqdmajor,$reqdminor) =
+ &Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,
+ $reqdmajor,$reqdminor);
+ $checkedrev{'randomizetry'} = 1;
+ }
}
}
my %responses = $res->responseTypes();
foreach my $key (keys(%responses)) {
- if (exists($checkresponsetypes{$key})) {
- push(@{$byresponsetype{$symb}{$checkresponsetypes{$key}}},$key);
+ if (exists($Apache::lonrelrequtils::checkresponsetypes{$key})) {
+ my $rev = $Apache::lonrelrequtils::checkresponsetypes{$key};
+ unless ($checkedrev{$key}) {
+ my ($major,$minor) = split(/\./,$rev);
+ ($reqdmajor,$reqdminor) =
+ &Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,
+ $reqdmajor,$reqdminor);
+ $checkedrev{$key} = 1;
+ }
+ push(@{$byresponsetype{$symb}{$rev}},$key);
$allmaps{$enclosing_map} = 1;
}
}
@@ -2291,9 +3671,9 @@ sub display_loncaparev_constraints {
}
foreach my $map (keys(%allmaps)) {
my $mapres = $navmap->getResourceByUrl($map);
- my $mapsymb = $mapres->symb();
- $toshow{$mapsymb} = 1;
if (ref($mapres)) {
+ my $mapsymb = $mapres->symb();
+ $toshow{$mapsymb} = 1;
my $pcslist = $mapres->map_hierarchy();
if ($pcslist ne '') {
foreach my $pc (split(/,/,$pcslist)) {
@@ -2334,6 +3714,10 @@ sub display_loncaparev_constraints {
'');
}
$r->print(&Apache::loncommon::end_page());
+ my ($currmajor,$currminor) = split(/\./,$loncaparev);
+ if (($currmajor != $reqdmajor) || ($currminor != $reqdminor)) {
+ return 1;
+ }
return;
}
@@ -2352,7 +3736,7 @@ sub show_contents_view {
''.&mt('Attribute/Setting').' | '.
&Apache::loncommon::end_data_table_header_row().
&Apache::loncommon::start_data_table_row().
- ' '.$icon.' '.&mt('Main Course Documents').' | ');
+ ' '.$icon.' '.&mt('Main Content').' | ');
&releases_by_map($r,$bymap,$topmap,$scopeorder,$lt);
$r->print(&Apache::loncommon::end_data_table_row());
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef);
@@ -2475,13 +3859,19 @@ sub show_contents_view {
}
$r->print(&Apache::loncommon::end_data_table());
}
+ return;
}
sub releases_by_map {
my ($r,$bymap,$url,$scopeorder,$lt) = @_;
return unless ((ref($bymap) eq 'HASH') && (ref($scopeorder) eq 'ARRAY'));
+ my $newrow = 0;
if (ref($bymap->{$url}) eq 'HASH') {
foreach my $rev (sort(keys(%{$bymap->{$url}}))) {
+ if ($newrow) {
+ $r->print(&Apache::loncommon::end_data_table_row().
+ &Apache::loncommon::continue_data_table_row());
+ }
$r->print(''.$rev.' | ');
if (ref($bymap->{$url}{$rev}) eq 'HASH') {
$r->print('');
@@ -2503,6 +3893,7 @@ sub releases_by_map {
$r->print(' ');
}
$r->print(' | ');
+ $newrow = 1;
}
} else {
$r->print(' | ');
@@ -2528,9 +3919,27 @@ sub get_param_description {
return $name;
}
+sub update_releasereq {
+ my $readmap = 1;
+ my $getrelreq = 1;
+ if (ref($modified_courses) eq 'ARRAY') {
+ foreach my $item (@{$modified_courses}) {
+ if (ref($item) eq 'ARRAY') {
+ my ($cdom,$cnum,$chome,$crstype) = @{$item};
+ &Apache::lonrelrequtils::modify_course_relreq(undef,undef,$cnum,$cdom,
+ $chome,$crstype,$cdom.'_'.$cnum,
+ $readmap,$getrelreq);
+ }
+ }
+ $modified_courses = [];
+ }
+ undef($registered_cleanup);
+ return;
+}
+
sub show_autocoowners {
my (@currcoown) = @_;
- my $output = ''.&mt('Co-ownership is set automatically when a Course Coordinator role is assigned to official course personnel (from institutional data).').'';
+ my $output = ''.&mt('Co-ownership is set automatically when a Course Coordinator role[_1] is assigned to official course personnel (from institutional data).','
').'';
if (@currcoown > 0) {
$output .= '
'.&mt('Current co-owners are:').' '.
join(', ',map { &Apache::loncommon::plainname(split(':',$_)); } (@currcoown));
@@ -2541,13 +3950,20 @@ sub show_autocoowners {
}
sub coowner_invitations {
- my ($cnum,$cdom,@currcoown) = @_;
- my ($output,@pendingcoown,@othercoords);
+ my ($cnum,$cdom,$currcoownref,$noedit) = @_;
+ my ($output,@pendingcoown,@othercoords,@currcoown);
my $pendingcoowners =
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'};
if ($pendingcoowners) {
@pendingcoown = split(',',$pendingcoowners);
}
+ if (ref($currcoownref) eq 'ARRAY') {
+ @currcoown = @{$currcoownref};
+ }
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
my $ccrole = 'cc';
my %ccroles = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,undef,[$ccrole]);
foreach my $key (sort(keys(%ccroles))) {
@@ -2565,7 +3981,7 @@ sub coowner_invitations {
''.&mt('Current co-owners').' | ';
foreach my $person (@currcoown) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= ''.(' 'x2).' ';
+ $output .= ''.(' 'x2).' ';
}
$output .= ' | '.
&Apache::loncommon::end_data_table_row();
@@ -2575,7 +3991,7 @@ sub coowner_invitations {
''.&mt('Invited as co-owners [_1](agreement pending)',' ').' | ';
foreach my $person (@pendingcoown) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= ''.(' 'x2).' ';
+ $output .= ''.(' 'x2).' ';
}
$output .= ' | '.
&Apache::loncommon::end_data_table_row();
@@ -2585,7 +4001,7 @@ sub coowner_invitations {
''.&mt('Invite other Coordinators [_1]to become co-owners',' ').' | ';
foreach my $person (@othercoords) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= ''.(' 'x2).' ';
+ $output .= ''.(' 'x2).' ';
}
$output .= ' | '.
&Apache::loncommon::end_data_table_row();
@@ -2598,13 +4014,20 @@ sub coowner_invitations {
}
sub manage_coownership {
- my ($cnum,$cdom,@currcoown) = @_;
- my (@pendingcoown);
+ my ($cnum,$cdom,$currcoownref,$noedit) = @_;
+ my (@pendingcoown,@currcoown);
my $pendingcoowners =
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'};
if ($pendingcoowners) {
@pendingcoown = split(',',$pendingcoowners);
}
+ if (ref($currcoownref) eq 'ARRAY') {
+ @currcoown = @{$currcoownref};
+ }
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
my ($is_coowner,$is_pending,$output);
my $uname = $env{'user.name'};
my $udom = $env{'user.domain'};
@@ -2634,10 +4057,10 @@ sub manage_coownership {
}
$output .= '';
if ($is_coowner) {
- $output .= &mt('You are currently a co-owner:').' ';
+ $output .= &mt('You are currently a co-owner:').' ';
} else {
- $output .= &mt('The course owner has invited you to become a co-owner:').' '.(' 'x2).
- '';
+ $output .= &mt('The course owner has invited you to become a co-owner:').' '.(' 'x2).
+ '';
}
$output .= '';
if (@currcoown) {
@@ -2651,7 +4074,7 @@ sub manage_coownership {
}
sub print_localization {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -2670,17 +4093,24 @@ sub print_localization {
input => 'selectbox',
},
);
- my $datatable;
+ my ($datatable,$disabled);
my $count = 0;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $item (@{$ordered}) {
$count ++;
- $datatable .= &item_table_row_start($items{$item}{text},$count);
+ my $colspan;
+ unless ($item eq 'languages') {
+ $colspan = 2;
+ }
+ $datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan);
if ($item eq 'timezone') {
my $includeempty = 1;
my $timezone = &Apache::lonlocal::gettimezone();
$datatable .=
&Apache::loncommon::select_timezone($item,$timezone,undef,
- $includeempty);
+ $includeempty,$disabled);
} elsif ($item eq 'datelocale') {
my $includeempty = 1;
my $locale_obj = &Apache::lonlocal::getdatelocale();
@@ -2690,15 +4120,18 @@ sub print_localization {
}
$datatable .=
&Apache::loncommon::select_datelocale($item,$currdatelocale,
- undef,$includeempty);
+ undef,$includeempty,$disabled);
} else {
if ($settings->{$item} eq '') {
- $datatable .=
- &Apache::loncommon::select_language('languages_0','',1);
+ unless ($noedit) {
+ $datatable .= ''.
+ &Apache::loncommon::select_language('languages_0','',1);
+ }
} else {
my $num = 0;
my @languages = split(/\s*[,;:]\s*/,$settings->{$item});
- $datatable .= &Apache::loncommon::start_data_table();
+ $datatable .= ' | '.
+ &Apache::loncommon::start_data_table();
if (@languages > 0) {
my %langchoices = &get_lang_choices();
foreach my $lang (@languages) {
@@ -2713,19 +4146,22 @@ sub print_localization {
' '.
' | '.
&Apache::loncommon::end_data_table_row();
$num ++;
}
}
- $datatable .= &Apache::loncommon::start_data_table_row().
+ unless ($noedit) {
+ $datatable .=
+ &Apache::loncommon::start_data_table_row().
''.
&mt('Additional language:'). ' '.
&Apache::loncommon::select_language('languages_'.$num,'',1).
''.
- ' | '.&Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table();
+ ''.&Apache::loncommon::end_data_table_row();
+ }
+ $datatable .= &Apache::loncommon::end_data_table().'
';
}
}
$datatable .= &item_table_row_end();
@@ -2746,7 +4182,7 @@ sub get_lang_choices {
}
sub print_feedback {
- my ($position,$cdom,$settings,$ordered,$itemtext,$rowtotal) = @_;
+ my ($position,$cdom,$settings,$ordered,$itemtext,$rowtotal,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -2781,21 +4217,25 @@ sub print_feedback {
del => 'Delete?',
sec => 'Sections:',
);
-
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $item (@{$ordered}) {
$count ++;
if ($position eq 'top') {
$datatable .= &item_table_row_start($items{$item}{text},$count);
} else {
- $datatable .= &item_table_row_start($items{$item}{text}."
(Custom text)",$count, "advanced");
+ $datatable .= &item_table_row_start($items{$item}{text}."
(Custom text)",$count, "advanced",2);
}
if ($position eq 'top') {
my $includeempty = 0;
- $datatable .= &user_table($cdom,$item,\@sections,
- $settings->{$item},\%lt);
+ $datatable .= ''.
+ &user_table($cdom,$item,\@sections,
+ $settings->{$item},\%lt,$noedit);
} else {
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',
- $settings->{$item.'.text'},$items{$item}{size});
+ $settings->{$item.'.text'},$items{$item}{size},$disabled);
}
$datatable .= &item_table_row_end();
}
@@ -2804,15 +4244,21 @@ sub print_feedback {
}
sub user_table {
- my ($cdom,$item,$sections,$currvalue,$lt) = @_;
+ my ($cdom,$item,$sections,$currvalue,$lt,$noedit) = @_;
my $output;
if ($currvalue eq '') {
- $output .= &select_recipient($item,'0',$cdom,$sections);
+ unless ($noedit) {
+ $output .= &select_recipient($item,'0',$cdom,$sections);
+ }
} else {
my $num = 0;
my @curr = split(/,/,$currvalue);
- $output .= '';
+ $output .= '';
my ($currusers);
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $val (@curr) {
next if ($val eq '');
my ($uname,$udom,$seclist) = ($val =~ /^($match_username):($match_domain)(\(?[^\)]*\)?)$/);
@@ -2824,7 +4270,7 @@ sub user_table {
$currusers .= ''.
''.
''.
''.(' 'x2).
@@ -2835,7 +4281,7 @@ sub user_table {
if (@{$sections}) {
$currusers.= (' 'x3).$lt->{'sec'}.' '.
&select_sections($item,$num,$sections,
- \@selsec);
+ \@selsec,$noedit);
}
}
$currusers .= ' | ';
@@ -2853,12 +4299,16 @@ sub user_table {
''.
'';
}
- $output .= ''.
+ unless ($noedit) {
+ $output .=
+ ' '.
''.
$lt->{'add'}.' '.
&select_recipient($item,$num,$cdom,$sections).
''.
- ' | ';
+ '';
+ }
+ $output .= ' ';
}
return $output;
}
@@ -2868,7 +4318,7 @@ sub select_recipient {
my $domform = &Apache::loncommon::select_dom_form($cdom,$item.'_udom_'.$num,$includeempty);
my $selectlink =
&Apache::loncommon::selectstudent_link('display',$item.'_uname_'.$num,
- $item.'_udom_'.$num,1);
+ $item.'_udom_'.$num,'only');
my $output =
''.&mt('Username').' '.
' | '.
@@ -2885,14 +4335,17 @@ sub select_recipient {
}
sub select_sections {
- my ($item,$num,$sections,$selected) = @_;
- my ($output,@currsecs,$allsec);
+ my ($item,$num,$sections,$selected,$noedit) = @_;
+ my ($output,@currsecs,$allsec,$disabled);
if (ref($selected) eq 'ARRAY') {
@currsecs = @{$selected};
}
if (!@currsecs) {
$allsec = ' selected="selected"';
}
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
if (ref($sections) eq 'ARRAY') {
if (@{$sections}) {
my $mult;
@@ -2902,7 +4355,7 @@ sub select_sections {
$mult .= ' size="4"';
}
}
- $output = '
|