';
+ $midpoint = int($numfiles/2);
+ if ($numfiles%2) {
+ $midpoint ++;
+ }
+ }
+ my $count = 0;
+ my $currentcategory='';
foreach my $file (@files) {
next if ($file->[1] !~ /\S/);
+ if ($file->[2] ne $currentcategory) {
+ $currentcategory=$file->[2];
+ if ((!$seconddiv) && ($count >= $midpoint)) {
+ $result .= '
'."\n".''."\n";
+ $seconddiv = 1;
+ }
+ $result.='
'.$currentcategory.'
';
+ $count++;
+ }
$result .=
'
';
+ $file->[1].'';
+ if ($file->[3]) {
+ $result.=&Apache::loncommon::help_open_topic($file->[3]);
+ }
+ my $filename=$file->[0];
+ $filename=~s/^\/home\/httpd\/html//;
+ $result.='
'.&mt('Example').''."\n";
+ $count ++;
+ }
+ if ($numfiles > 0) {
+ $result .= '
'."\n".''."\n";
}
return $result;
}
@@ -1137,7 +1134,7 @@ $errormsg
sub update_construct_style {
if ($env{'request.state'} eq "construct"
- && $env{'form.problemmode'} eq &mt('View')
+ && $env{'form.problemmode'} eq 'view'
&& defined($env{'form.submitted'})
&& !defined($env{'form.resetdata'})
&& !defined($env{'form.newrandomization'})) {
@@ -1146,8 +1143,8 @@ sub update_construct_style {
&Apache::lonnet::delenv('construct\\.style');
} elsif ($env{'form.style_file'}
&& $env{'construct.style'} ne $env{'form.style_file'}) {
- &Apache::lonnet::appenv('construct.style' =>
- $env{'form.style_file'});
+ &Apache::lonnet::appenv({'construct.style' =>
+ $env{'form.style_file'}});
}
}
}
@@ -1160,13 +1157,6 @@ sub handler {
$Apache::lonxml::debug=$env{'user.debug'};
$env{'request.uri'}=$request->uri;
&setuppermissions();
- # some times multiple problemmodes are submitted, need to select
- # the last one
- if ( defined($env{'form.problemmode'}) && ref($env{'form.problemmode'}) ) {
- my $mode=$env{'form.problemmode'}->[-1];
- undef $env{'form.problemmode'};
- $env{'form.problemmode'}=$mode;
- }
my $file=&Apache::lonnet::filelocation("",$request->uri);
@@ -1195,12 +1185,11 @@ sub handler {
['problemmode']);
if (!(defined $env{'form.problemmode'})) {
#first visit to problem in construction space
- $env{'form.problemmode'}='View';
+ $env{'form.problemmode'}= 'view';
&renderpage($request,$file);
- } elsif ($env{'form.problemmode'} eq &mt('EditXML') ||
- $env{'form.problemmode'} eq 'EditXML') {
+ } elsif ($env{'form.problemmode'} eq 'editxml') {
&editxmlmode($request,$file);
- } elsif ($env{'form.problemmode'} eq &mt('Calculate answers')) {
+ } elsif ($env{'form.problemmode'} eq 'calcanswers') {
&analyze($request,$file);
} else {
&update_construct_style();