[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Wed Dec 18 13:56:42 EST 2013
raeburn Wed Dec 18 18:56:42 2013 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Fix documentation links on Course Utilities menu in Course Editor
- Supply appropriate help link on right side of breadcrumbs container
when using Course Utilities
- Only display table (and headers) for Check Resource Versions screen if
there are imported published resources with version changes in specified
time frame.
- Sort resources in Check Resource Versions screen in date order (items
most recently changed listed first).
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.570 loncom/interface/londocs.pm:1.571
--- loncom/interface/londocs.pm:1.570 Sun Nov 17 14:40:31 2013
+++ loncom/interface/londocs.pm Wed Dec 18 18:56:41 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.570 2013/11/17 14:40:31 raeburn Exp $
+# $Id: londocs.pm,v 1.571 2013/12/18 18:56:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4033,8 +4033,8 @@
sub checkversions {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+ $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions"));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions"));
$r->print(&startContentScreen('tools'));
my $header='';
@@ -4190,10 +4190,30 @@
<br clear="all" />
<hr />
<h4>$lt{'vers'}</h4>
-<input type="submit" name="setversions" value="$lt{'save'}" />
ENDHEADERS
#number of columns for version history
+ my %changedbytime;
+ foreach my $key (keys(%changes)) {
+ #excludes not versionable problems from resource version history:
+ next if ($key =~ /^\/res\/lib\/templates/);
+ my $chg;
+ if ($env{'form.timerange'} eq 'all') {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ $chg = &Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate');
+ } else {
+ $chg = $changes{$key};
+ next if ($chg < $starttime);
+ }
+ push(@{$changedbytime{$chg}},$key);
+ }
+ if (keys(%changedbytime) == 0) {
+ &untiehash();
+ $r->print(&mt('No content changes in imported content in specified time frame').
+ &endContentScreen());
+ return;
+ }
$r->print(
+ '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
'<th>'.&mt('Resources').'</th>'.
@@ -4203,26 +4223,25 @@
'<th>'.&mt('History').'</th>'.
&Apache::loncommon::end_data_table_header_row()
);
- 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='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
- }
- my $linkurl=&Apache::lonnet::clutter($key);
- $r->print(
- &Apache::loncommon::start_data_table_row().
- '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'.
- '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
- '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('.
- &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.
- '<td align="right">'
- );
- # Used in course
- my $usedversion=$hash{'version_'.$linkurl};
- if (($usedversion) && ($usedversion ne 'mostrecent')) {
+ foreach my $chg (sort {$b <=> $a } keys(%changedbytime)) {
+ foreach my $key (sort(@{$changedbytime{$chg}})) {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ my $currentversion=&Apache::lonnet::getversion($key);
+ if ($currentversion<0) {
+ $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
+ }
+ my $linkurl=&Apache::lonnet::clutter($key);
+ $r->print(
+ &Apache::loncommon::start_data_table_row().
+ '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'.
+ '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
+ '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('.
+ &Apache::lonlocal::locallocaltime($chg).')</span></td>'.
+ '<td align="right">'
+ );
+ # Used in course
+ my $usedversion=$hash{'version_'.$linkurl};
+ if (($usedversion) && ($usedversion ne 'mostrecent')) {
if ($usedversion != $currentversion) {
$r->print('<span class="LC_warning">'.$usedversion.'</span>');
} else {
@@ -4231,44 +4250,45 @@
} else {
$r->print($currentversion);
}
- $r->print('</td><td title="'.$lt{'vu'}.'">');
- # 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('</td>');
- # List all available versions
- $r->print('<td valign="top"><span class="LC_fontsize_medium">');
- for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
- my $url=$root.'.'.$prevvers.'.'.$extension;
- $r->print(
- '<span class="LC_nobreak">'
- .'<a href="'.&Apache::lonnet::clutter($url).'">'
- .&mt('Version [_1]',$prevvers).'</a>'
- .' ('.&Apache::lonlocal::locallocaltime(
- &Apache::lonnet::metadata($url,'lastrevisiondate'))
- .')');
- if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
+ $r->print('</td><td title="'.$lt{'vu'}.'">');
+ # 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('</td>');
+ # List all available versions
+ $r->print('<td valign="top"><span class="LC_fontsize_medium">');
+ for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
+ my $url=$root.'.'.$prevvers.'.'.$extension;
$r->print(
- ' <a href="/adm/diff?filename='.
- &Apache::lonnet::clutter($root.'.'.$extension).
- &HTML::Entities::encode('&versionone='.$prevvers,'"<>&').
- '" target="diffs">'.&mt('Diffs').'</a>');
+ '<span class="LC_nobreak">'
+ .'<a href="'.&Apache::lonnet::clutter($url).'">'
+ .&mt('Version [_1]',$prevvers).'</a>'
+ .' ('.&Apache::lonlocal::locallocaltime(
+ &Apache::lonnet::metadata($url,'lastrevisiondate'))
+ .')');
+ if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
+ $r->print(
+ ' <a href="/adm/diff?filename='.
+ &Apache::lonnet::clutter($root.'.'.$extension).
+ &HTML::Entities::encode('&versionone='.$prevvers,'"<>&').
+ '" target="diffs">'.&mt('Diffs').'</a>');
+ }
+ $r->print('</span><br />');
}
- $r->print('</span><br />');
+ $r->print('</span></td>'.&Apache::loncommon::end_data_table_row());
}
- $r->print('</span></td>'.&Apache::loncommon::end_data_table_row());
}
$r->print(
&Apache::loncommon::end_data_table().
@@ -4278,6 +4298,7 @@
&untiehash();
$r->print(&endContentScreen());
+ return;
}
sub mark_hash_old {
@@ -4332,13 +4353,13 @@
sub init_breadcrumbs {
- my ($form,$text)=@_;
+ my ($form,$text,$help)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1",
text=>&Apache::loncommon::course_type().' Editor',
faq=>273,
bug=>'Instructor Interface',
- help => 'Docs_Adding_Course_Doc'});
+ help => $help});
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
text=>$text,
faq=>273,
@@ -4422,9 +4443,8 @@
'Adding_Folders','Docs_Overview', 'Load_Map',
'Supplemental','Score_Upload_Form','Adding_Pages',
'Importing_LON-CAPA_Resource','Importing_IMS_Course',
- 'Uploading_From_Harddrive',
- 'Check_Resource_Versions','Verify_Content',
- 'Course_Roster','Web_Page','Dropbox') {
+ 'Uploading_From_Harddrive','Course_Roster','Web_Page',
+ 'Dropbox') {
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
@@ -4454,7 +4474,7 @@
&choose_dump_server($r);
return OK;
} elsif ($allowed && $env{'form.verify'}) {
- &init_breadcrumbs('verify','Verify Content');
+ &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
&verifycontent($r);
} elsif ($allowed && $env{'form.listsymbs'}) {
&init_breadcrumbs('listsymbs','List Content IDs');
@@ -4467,7 +4487,7 @@
}
&docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath);
} elsif ($allowed && $env{'form.versions'}) {
- &init_breadcrumbs('versions','Check/Set Resource Versions');
+ &init_breadcrumbs('versions','Check/Set Resource Versions','Docs_Check_Resource_Versions');
&checkversions($r);
} elsif ($allowed && $env{'form.dumpcourse'}) {
&init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space');
@@ -4679,6 +4699,14 @@
if ($showdoc) {
$r->print(&Apache::loncommon::start_page("$crstype documents",undef,
{'force_register' => $showdoc,}));
+ } elsif ($toolsflag) {
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ href=>"/adm/coursedocs",text=>"$crstype Contents"});
+ $r->print(&Apache::loncommon::start_page("$crstype Contents", $script)
+ .&Apache::loncommon::help_open_menu('','',273,'RAT')
+ .&Apache::lonhtmlcommon::breadcrumbs(
+ 'Editing Course Contents')
+ );
} elsif ($r->uri eq '/adm/supplemental') {
my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
$r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
@@ -5535,14 +5563,14 @@
{ linktext => $lt{'vc'},
url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')",
permission => 'F',
- help => 'Verify_Content',
+ help => 'Docs_Verify_Content',
icon => 'verify.png',
linktitle => 'Verify contents can be retrieved/rendered',
},
{ linktext => $lt{'cv'},
url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')",
permission => 'F',
- help => 'Check_Resource_Versions',
+ help => 'Docs_Check_Resource_Versions',
icon => 'resversion.png',
linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions",
},
@@ -5567,7 +5595,7 @@
{ linktext => $lt{'dcd'},
url => $dumpurl,
permission => $candump,
- #help => '',
+ help => 'Docs_Dump_Course_Docs',
icon => 'dump.png',
linktitle => $lt{'dcd'},
},
More information about the LON-CAPA-cvs
mailing list