--- loncom/interface/londocs.pm 2013/01/04 00:17:48 1.484.2.20 +++ loncom/interface/londocs.pm 2012/12/04 00:39:48 1.520 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.20 2013/01/04 00:17:48 raeburn Exp $ +# $Id: londocs.pm,v 1.520 2012/12/04 00:39:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -651,7 +651,7 @@ sub print_paste_buffer { $is_external = 1; } - my ($canpaste,$nopaste,$othercrs,$areachange); + my ($canpaste,$nopaste,$othercrs,$areachange,$is_uploaded_map); if ($folder =~ /^supplemental/) { $canpaste = &supp_pasteable($env{'docs.markedcopy_url'}); unless ($canpaste) { @@ -1543,7 +1543,7 @@ sub apply_fixups { if ($folder !~ /^supplemental/) { $report = 1; } - (my $outtext,$errtext) = + my ($outtext,$errtext) = &LONCAPA::map::storemap("/uploaded/$cdom/$cnum/$storefn",1,$report); if ($errtext) { return &mt('Paste failed: an error occurred saving the folder or page.'); @@ -2443,7 +2443,7 @@ $form_common.' $forceedit, undef,$symb, &escape($env{'form.folderpath'}), - $renametitle,'','',1); + $renametitle); if ($jscall) { $editlink = ''.&mt('Edit').' '."\n"; @@ -2627,7 +2627,7 @@ sub checkonthis { $r->print(''.&mt('connection down').''); } elsif ($result eq 'not_found') { unless ($url=~/\$/) { - $r->print(''.&mt('not found').''); + $r->print(''.&mt('not found').''); } else { $r->print(''.&mt('unable to verify variable URL').''); } @@ -2673,7 +2673,7 @@ sub list_symbs { $r->print(&Apache::loncommon::start_data_table_row(). '
'.&mt('Done').'
'); - $r->print(&endContentScreen()); } @@ -2794,7 +2792,7 @@ sub checkversions { if ($env{'form.timerange'} eq 'all') { # show all documents $header=&mt('All Documents in '.$crstype); - $allsel=' selected="selected"'; + $allsel=1; foreach my $key (keys(%hash)) { if ($key=~/^ids\_(\/res\/.+)$/) { my $src=$1; @@ -2815,19 +2813,19 @@ sub checkversions { .&mt('seconds'); if ($env{'form.timerange'}==-1) { $seltext='since start of course'; - $startsel=' selected="selected"'; + $startsel='selected'; $env{'form.timerange'}=time; } $starttime=time-$env{'form.timerange'}; if ($env{'form.timerange'}==2592000) { $seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; - $monthsel=' selected="selected"'; + $monthsel='selected'; } elsif ($env{'form.timerange'}==604800) { $seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; - $weeksel=' selected="selected"'; + $weeksel='selected'; } elsif ($env{'form.timerange'}==86400) { $seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; - $daysel=' selected="selected"'; + $daysel='selected'; } $header=&mt('Content changed').' '.$seltext; } else { @@ -2865,11 +2863,11 @@ sub checkversions { @@ -2885,93 +2883,111 @@ $lt{'sc'}: +'.&mt('Resources').' | '. - "$lt{'mr'} | ". - "$lt{'ve'} | ". - "$lt{'vu'} | ". - ''.&mt('History').' | '. - &Apache::loncommon::end_data_table_header_row() - ); + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Resources').' | '. + "$lt{'mr'} | ". + "$lt{'ve'} | ". + "$lt{'vu'} | ". + ''.&mt('History').' | '. + ''); foreach my $key (sort(keys(%changes))) { #excludes not versionable problems from resource version history: - next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); - my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); - my $currentversion=&Apache::lonnet::getversion($key); - if ($currentversion<0) { - $currentversion=''.&mt('Could not be determined.').''; - } - my $linkurl=&Apache::lonnet::clutter($key); + if ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/) { + my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); + my $currentversion=&Apache::lonnet::getversion($key); + if ($currentversion<0) { + $currentversion=''.&mt('Could not be determined.').''; + } + my $linkurl=&Apache::lonnet::clutter($key); $r->print( + &Apache::loncommon::end_data_table_header_row(). &Apache::loncommon::start_data_table_row(). - ''.&Apache::lonnet::gettitle($linkurl).' '. + ' | '.&Apache::lonnet::gettitle($linkurl).' '. ''.$linkurl.' | '.
- ''.$currentversion.' ('. + ' | '.$currentversion.' ('. &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).') | '.
- '' - ); - # Used in course - my $usedversion=$hash{'version_'.$linkurl}; - if (($usedversion) && ($usedversion ne 'mostrecent')) { - if ($usedversion != $currentversion) { + ' | '); +# Used in course + my $usedversion=$hash{'version_'.$linkurl}; + if (($usedversion) && ($usedversion ne 'mostrecent')) { + if($usedversion != $currentversion){ $r->print(''.$usedversion.''); - } else { + }else{ $r->print($usedversion); } + } else { + $r->print($currentversion); + } + $r->print(' | '); +# Set version + $r->print(&Apache::loncommon::select_form($setversions{$linkurl}, + 'set_version_'.$linkurl, + {'select_form_order' => + ['',1..$currentversion,'mostrecent'], + '' => '', + 'mostrecent' => &mt('most recent'), + map {$_,$_} (1..$currentversion)})); + my $lastold=1; + for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { + my $url=$root.'.'.$prevvers.'.'.$extension; + if (&Apache::lonnet::metadata($url,'lastrevisiondate')< + $starttime) { + $lastold=$prevvers; + } + } + # + # Code to figure out how many version entries should go in + # each of the four columns + my $entries_per_col = 0; + my $num_entries = ($currentversion-$lastold); + if ($num_entries % $num_ver_col == 0) { + $entries_per_col = $num_entries/$num_ver_col; } else { - $r->print($currentversion); + $entries_per_col = $num_entries/$num_ver_col + 1; } - $r->print(' | '); - # Set version - $r->print(&Apache::loncommon::select_form( - $setversions{$linkurl}, - 'set_version_'.$linkurl, - {'select_form_order' => ['',1..$currentversion,'mostrecent'], - '' => '', - 'mostrecent' => &mt('most recent'), - map {$_,$_} (1..$currentversion)})); - my $lastold=1; - for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { - my $url=$root.'.'.$prevvers.'.'.$extension; - if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { - $lastold=$prevvers; - } - } - $r->print(' | '); - # List all available versions - $r->print(''); - for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { - my $url=$root.'.'.$prevvers.'.'.$extension; - $r->print( - '' - .'' - .&mt('Version [_1]',$prevvers).'' - .' ('.&Apache::lonlocal::locallocaltime( - &Apache::lonnet::metadata($url,'lastrevisiondate')) - .')'); - if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { - $r->print( - ' &'). - '" target="diffs">'.&mt('Diffs').''); + my $entries_count = 0; + $r->print(' | ');
+ my $cols_output = 1;
+ for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
+ my $url=$root.'.'.$prevvers.'.'.$extension;
+ $r->print(''.&mt('Version').' '.$prevvers.' ('.
+ &Apache::lonlocal::locallocaltime(
+ &Apache::lonnet::metadata($url,
+ 'lastrevisiondate')
+ ).
+ ')');
+ if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
+ $r->print(' '.&mt('Diffs').'');
+ }
+ $r->print(' '); + if (++$entries_count % $entries_per_col == 0) { + $r->print(' | ');
+ if ($cols_output != $num_ver_col) {
+ $r->print(''); + $cols_output++; + } + } + } + while($cols_output++ < $num_ver_col) { + $r->print(' | ');
}
- $r->print(' '); - } - $r->print(' | '.&Apache::loncommon::end_data_table_row());
+ }
}
- $r->print(
- &Apache::loncommon::end_data_table().
- ''.
- ''
- );
+ $r->print(''.&Apache::loncommon::end_data_table_row().
+ &Apache::loncommon::end_data_table().
+ '');
&untiehash();
- $r->print(&endContentScreen());
}
sub mark_hash_old {
@@ -3068,6 +3084,7 @@ sub startContentScreen {
if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
$output .= '
---|