version 1.570, 2013/11/17 14:40:31
|
version 1.571, 2013/12/18 18:56:41
|
Line 4033 sub devalidateversioncache {
|
Line 4033 sub devalidateversioncache {
|
sub checkversions { |
sub checkversions { |
my ($r) = @_; |
my ($r) = @_; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
$r->print(&Apache::loncommon::start_page("Check $crstype Document Versions")); |
$r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions")); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions")); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions")); |
$r->print(&startContentScreen('tools')); |
$r->print(&startContentScreen('tools')); |
|
|
my $header=''; |
my $header=''; |
Line 4190 $lt{'sc'}: <input type="submit" name="se
|
Line 4190 $lt{'sc'}: <input type="submit" name="se
|
<br clear="all" /> |
<br clear="all" /> |
<hr /> |
<hr /> |
<h4>$lt{'vers'}</h4> |
<h4>$lt{'vers'}</h4> |
<input type="submit" name="setversions" value="$lt{'save'}" /> |
|
ENDHEADERS |
ENDHEADERS |
#number of columns for version history |
#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( |
$r->print( |
|
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'. |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Resources').'</th>'. |
'<th>'.&mt('Resources').'</th>'. |
Line 4203 ENDHEADERS
|
Line 4223 ENDHEADERS
|
'<th>'.&mt('History').'</th>'. |
'<th>'.&mt('History').'</th>'. |
&Apache::loncommon::end_data_table_header_row() |
&Apache::loncommon::end_data_table_header_row() |
); |
); |
foreach my $key (sort(keys(%changes))) { |
foreach my $chg (sort {$b <=> $a } keys(%changedbytime)) { |
#excludes not versionable problems from resource version history: |
foreach my $key (sort(@{$changedbytime{$chg}})) { |
next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my $currentversion=&Apache::lonnet::getversion($key); |
my $currentversion=&Apache::lonnet::getversion($key); |
if ($currentversion<0) { |
if ($currentversion<0) { |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
} |
} |
my $linkurl=&Apache::lonnet::clutter($key); |
my $linkurl=&Apache::lonnet::clutter($key); |
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'. |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('. |
&Apache::lonlocal::locallocaltime($chg).')</span></td>'. |
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
'<td align="right">' |
'<td align="right">' |
); |
); |
# Used in course |
# Used in course |
my $usedversion=$hash{'version_'.$linkurl}; |
my $usedversion=$hash{'version_'.$linkurl}; |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
|
if ($usedversion != $currentversion) { |
if ($usedversion != $currentversion) { |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
} else { |
} else { |
Line 4231 ENDHEADERS
|
Line 4250 ENDHEADERS
|
} else { |
} else { |
$r->print($currentversion); |
$r->print($currentversion); |
} |
} |
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
# Set version |
# Set version |
$r->print(&Apache::loncommon::select_form( |
$r->print(&Apache::loncommon::select_form( |
$setversions{$linkurl}, |
$setversions{$linkurl}, |
'set_version_'.$linkurl, |
'set_version_'.$linkurl, |
{'select_form_order' => ['',1..$currentversion,'mostrecent'], |
{'select_form_order' => ['',1..$currentversion,'mostrecent'], |
'' => '', |
'' => '', |
'mostrecent' => &mt('most recent'), |
'mostrecent' => &mt('most recent'), |
map {$_,$_} (1..$currentversion)})); |
map {$_,$_} (1..$currentversion)})); |
my $lastold=1; |
my $lastold=1; |
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
my $url=$root.'.'.$prevvers.'.'.$extension; |
my $url=$root.'.'.$prevvers.'.'.$extension; |
if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { |
if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { |
$lastold=$prevvers; |
$lastold=$prevvers; |
|
} |
} |
} |
} |
$r->print('</td>'); |
$r->print('</td>'); |
# List all available versions |
# List all available versions |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
my $url=$root.'.'.$prevvers.'.'.$extension; |
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( |
$r->print( |
' <a href="/adm/diff?filename='. |
'<span class="LC_nobreak">' |
&Apache::lonnet::clutter($root.'.'.$extension). |
.'<a href="'.&Apache::lonnet::clutter($url).'">' |
&HTML::Entities::encode('&versionone='.$prevvers,'"<>&'). |
.&mt('Version [_1]',$prevvers).'</a>' |
'" target="diffs">'.&mt('Diffs').'</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( |
$r->print( |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
Line 4278 ENDHEADERS
|
Line 4298 ENDHEADERS
|
|
|
&untiehash(); |
&untiehash(); |
$r->print(&endContentScreen()); |
$r->print(&endContentScreen()); |
|
return; |
} |
} |
|
|
sub mark_hash_old { |
sub mark_hash_old { |
Line 4332 $help{'Caching'}.'</p></form>'."\n\n");
|
Line 4353 $help{'Caching'}.'</p></form>'."\n\n");
|
|
|
|
|
sub init_breadcrumbs { |
sub init_breadcrumbs { |
my ($form,$text)=@_; |
my ($form,$text,$help)=@_; |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1", |
text=>&Apache::loncommon::course_type().' Editor', |
text=>&Apache::loncommon::course_type().' Editor', |
faq=>273, |
faq=>273, |
bug=>'Instructor Interface', |
bug=>'Instructor Interface', |
help => 'Docs_Adding_Course_Doc'}); |
help => $help}); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1', |
text=>$text, |
text=>$text, |
faq=>273, |
faq=>273, |
Line 4422 sub handler {
|
Line 4443 sub handler {
|
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Supplemental','Score_Upload_Form','Adding_Pages', |
'Supplemental','Score_Upload_Form','Adding_Pages', |
'Importing_LON-CAPA_Resource','Importing_IMS_Course', |
'Importing_LON-CAPA_Resource','Importing_IMS_Course', |
'Uploading_From_Harddrive', |
'Uploading_From_Harddrive','Course_Roster','Web_Page', |
'Check_Resource_Versions','Verify_Content', |
'Dropbox') { |
'Course_Roster','Web_Page','Dropbox') { |
|
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
} |
} |
# Composite help files |
# Composite help files |
Line 4454 sub handler {
|
Line 4474 sub handler {
|
&choose_dump_server($r); |
&choose_dump_server($r); |
return OK; |
return OK; |
} elsif ($allowed && $env{'form.verify'}) { |
} elsif ($allowed && $env{'form.verify'}) { |
&init_breadcrumbs('verify','Verify Content'); |
&init_breadcrumbs('verify','Verify Content','Docs_Verify_Content'); |
&verifycontent($r); |
&verifycontent($r); |
} elsif ($allowed && $env{'form.listsymbs'}) { |
} elsif ($allowed && $env{'form.listsymbs'}) { |
&init_breadcrumbs('listsymbs','List Content IDs'); |
&init_breadcrumbs('listsymbs','List Content IDs'); |
Line 4467 sub handler {
|
Line 4487 sub handler {
|
} |
} |
&docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath); |
&docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath); |
} elsif ($allowed && $env{'form.versions'}) { |
} 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); |
&checkversions($r); |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
&init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space'); |
&init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space'); |
Line 4679 sub handler {
|
Line 4699 sub handler {
|
if ($showdoc) { |
if ($showdoc) { |
$r->print(&Apache::loncommon::start_page("$crstype documents",undef, |
$r->print(&Apache::loncommon::start_page("$crstype documents",undef, |
{'force_register' => $showdoc,})); |
{'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') { |
} elsif ($r->uri eq '/adm/supplemental') { |
my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype); |
my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype); |
$r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef, |
$r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef, |
Line 5535 sub generate_admin_menu {
|
Line 5563 sub generate_admin_menu {
|
{ linktext => $lt{'vc'}, |
{ linktext => $lt{'vc'}, |
url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')", |
url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')", |
permission => 'F', |
permission => 'F', |
help => 'Verify_Content', |
help => 'Docs_Verify_Content', |
icon => 'verify.png', |
icon => 'verify.png', |
linktitle => 'Verify contents can be retrieved/rendered', |
linktitle => 'Verify contents can be retrieved/rendered', |
}, |
}, |
{ linktext => $lt{'cv'}, |
{ linktext => $lt{'cv'}, |
url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')", |
url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')", |
permission => 'F', |
permission => 'F', |
help => 'Check_Resource_Versions', |
help => 'Docs_Check_Resource_Versions', |
icon => 'resversion.png', |
icon => 'resversion.png', |
linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions", |
linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions", |
}, |
}, |
Line 5567 sub generate_admin_menu {
|
Line 5595 sub generate_admin_menu {
|
{ linktext => $lt{'dcd'}, |
{ linktext => $lt{'dcd'}, |
url => $dumpurl, |
url => $dumpurl, |
permission => $candump, |
permission => $candump, |
#help => '', |
help => 'Docs_Dump_Course_Docs', |
icon => 'dump.png', |
icon => 'dump.png', |
linktitle => $lt{'dcd'}, |
linktitle => $lt{'dcd'}, |
}, |
}, |