[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Thu Dec 19 09:51:22 EST 2013
raeburn Thu Dec 19 14:51:22 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface londocs.pm
Log:
- For 2.11
- Backport 1.571, 1.572.
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.43 loncom/interface/londocs.pm:1.484.2.44
--- loncom/interface/londocs.pm:1.484.2.43 Wed Nov 20 04:48:18 2013
+++ loncom/interface/londocs.pm Thu Dec 19 14:51:21 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.43 2013/11/20 04:48:18 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.44 2013/12/19 14:51:21 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,
@@ -4421,9 +4442,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','Simple_Problem') {
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
@@ -4431,8 +4451,6 @@
'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
$help{'Simple Page'} = &Apache::loncommon::help_open_topic(
'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
- $help{'Simple Problem'} = &Apache::loncommon::help_open_topic(
- 'Option_Response_Simple');
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
$help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic(
@@ -4453,7 +4471,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');
@@ -4466,7 +4484,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');
@@ -4678,6 +4696,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,
@@ -4972,7 +4998,7 @@
$pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makesmpproblem();">$lt{'sipr'}</a>
- $help{'Simple Problem'}
+ $help{'Simple_Problem'}
</form>
NSPROBFORM
@@ -5534,14 +5560,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",
},
@@ -5566,7 +5592,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