[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm londependencies.pm londocs.pm lonhtmlcommon.pm /xml londefdef.pm
raeburn
raeburn at source.lon-capa.org
Fri Jul 6 18:46:12 EDT 2012
raeburn Fri Jul 6 22:46:12 2012 EDT
Modified files:
/loncom/interface loncommon.pm londependencies.pm londocs.pm
lonhtmlcommon.pm
/loncom/xml londefdef.pm
Log:
- Managing dependencies and uploading archive files to a course.
- Support decompression of archive files(e.g., zip files) uploaded to
Supplemental Content.
- Support upload of multiple (linked) web pages to a course, where only
one (containing links to others) is included in a folder (i.e., sequence
file) -- access allowed to others in course context based on httpref.
- When listing unused files in a directory in /docs/ or /supplemental/
exclude files included in httprefs.
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1084 loncom/interface/loncommon.pm:1.1085
--- loncom/interface/loncommon.pm:1.1084 Thu Jul 5 21:33:39 2012
+++ loncom/interface/loncommon.pm Fri Jul 6 22:46:06 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1084 2012/07/05 21:33:39 raeburn Exp $
+# $Id: loncommon.pm,v 1.1085 2012/07/06 22:46:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -9316,7 +9316,7 @@
sub ask_for_embedded_content {
my ($actionurl,$state,$allfiles,$codebase,$args)=@_;
my (%subdependencies,%dependencies,%mapping,%existing,%newfiles,%pathchanges,
- %currsubfile,%unused);
+ %currsubfile,%unused,$rem);
my $counter = 0;
my $numnew = 0;
my $numremref = 0;
@@ -9329,6 +9329,10 @@
my $heading = &mt('Upload embedded files');
my $buttontext = &mt('Upload');
+ my $navmap;
+ if ($env{'request.course.id'}) {
+ $navmap = Apache::lonnavmaps::navmap->new();
+ }
if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) {
my $current_path='/';
if ($env{'form.currentpath'}) {
@@ -9374,6 +9378,7 @@
$url = $args->{'docs_url'};
$title = $args->{'docs_title'};
$toplevel = "/$url";
+ ($rem) = ($toplevel =~ m{^(.+/)[^/]+$});
($path) =
($toplevel =~ m{^(\Q/uploaded/$cdom/$cnum/\E(?:docs|supplemental)/(?:default|\d+)/\d+)/});
$fileloc = &Apache::lonnet::filelocation('',$toplevel);
@@ -9474,6 +9479,12 @@
if (ref($currsubfile{$path}) eq 'HASH') {
foreach my $file (keys(%{$currsubfile{$path}})) {
unless ($subdependencies{$path}{$file}) {
+ next if (($rem ne '') &&
+ (($env{"httpref.$rem"."$path/$file"} ne '') ||
+ (ref($navmap) &&
+ (($navmap->getResourceByUrl($rem."$path/$file") ne '') ||
+ (($file =~ /^(.*\.s?html?)\.bak$/i) &&
+ ($navmap->getResourceByUrl($rem."$path/$1")))))));
$unused{$path.'/'.$file} = 1;
}
}
@@ -9532,6 +9543,14 @@
unless (($file eq $filename) ||
($file eq $filename.'.bak') ||
($dependencies{$file})) {
+ if ($actionurl eq '/adm/dependencies') {
+ next if (($rem ne '') &&
+ (($env{"httpref.$rem".$file} ne '') ||
+ (ref($navmap) &&
+ (($navmap->getResourceByUrl($rem.$file) ne '') ||
+ (($file =~ /^(.*\.s?html?)\.bak$/i) &&
+ ($navmap->getResourceByUrl($rem.$1)))))));
+ }
$unused{$file} = 1;
}
}
@@ -11044,7 +11063,10 @@
document.getElementById('arc_depon_'+count).style.display='block';
form.elements[depitem].options.length = 0;
form.elements[depitem].options[0] = new Option('Select','',true,true);
- for (var i=1; i<count; i++) {
+ for (var i=1; i<=numitems; i++) {
+ if (i == count) {
+ continue;
+ }
var startelement = $startcount + (i-1) * 7;
for (var j=1; j<6; j++) {
if ((j != 2) && (j!= 4)) {
Index: loncom/interface/londependencies.pm
diff -u loncom/interface/londependencies.pm:1.1 loncom/interface/londependencies.pm:1.2
--- loncom/interface/londependencies.pm:1.1 Mon Apr 16 19:59:12 2012
+++ loncom/interface/londependencies.pm Fri Jul 6 22:46:06 2012
@@ -2,7 +2,7 @@
# Handler to manage dependencies for HTML files uploaded directly
# to a course.
#
-# $Id: londependencies.pm,v 1.1 2012/04/16 19:59:12 raeburn Exp $
+# $Id: londependencies.pm,v 1.2 2012/07/06 22:46:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,15 +94,22 @@
$r->send_http_header;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action','symb','title']);
+ ['action','symb','title','url']);
my $action = $env{'form.action'};
my $symb = $env{'form.symb'};
my $docs_title = $env{'form.title'};
- my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase);
- my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);
+ my $docs_url = $env{'form.url'};
+ my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url);
+ if ($symb) {
+ (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
+ } elsif (($docs_url) && ($env{'httpref.'.$docs_url} ne '')) {
+ $url = $docs_url;
+ $url =~ s{^/}{};
+ }
my $title = &mt('Manage Dependencies');
my $state = '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
- '<input type="hidden" name="title" value="'.$docs_title.'" />'."\n";
+ '<input type="hidden" name="title" value="'.$docs_title.'" />'."\n".
+ '<input type="hidden" name="url" value="'.$docs_url.'" />'."\n";
my $dir_root = '/userfiles';
my ($destination) =
($url =~ m{^\Quploaded/$cdom/$cnum/\E((?:docs|supplemental)/(?:default|\d+)/\d+)/});
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.489 loncom/interface/londocs.pm:1.490
--- loncom/interface/londocs.pm:1.489 Thu Jul 5 21:33:39 2012
+++ loncom/interface/londocs.pm Fri Jul 6 22:46:06 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.489 2012/07/05 21:33:39 raeburn Exp $
+# $Id: londocs.pm,v 1.490 2012/07/06 22:46:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3464,7 +3464,7 @@
my ($dir,$file,$warning,$error,$output);
my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)=
&decompression_info();
- if ($env{'form.archiveurl'} !~ m{^/uploaded/\Q$docudom/$docuname/docs/\E(?:default|supplemental|\d+).*/([^/]+)$}) {
+ if ($env{'form.archiveurl'} !~ m{^/uploaded/\Q$docudom/$docuname/\E(?:docs|supplemental)/(?:default|\d+).*/([^/]+)$}) {
$error = &mt('Archive file "[_1]" not in the expected location.',$env{'form.archiveurl'});
} else {
my $file = $1;
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.318 loncom/interface/lonhtmlcommon.pm:1.319
--- loncom/interface/lonhtmlcommon.pm:1.318 Mon Jun 4 16:59:00 2012
+++ loncom/interface/lonhtmlcommon.pm Fri Jul 6 22:46:06 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.318 2012/06/04 16:59:00 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.319 2012/07/06 22:46:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -209,9 +209,10 @@
=cut
sub dependencycheck_js {
- my ($symb,$title) = @_;
+ my ($symb,$title,$url) = @_;
my $link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"').
- '&title='.&HTML::Entities::encode($title,'<>&"');
+ '&title='.&HTML::Entities::encode($title,'<>&"').
+ '&url='.&HTML::Entities::encode($url,'<>&"');
return <<ENDJS;
<script type="text/javascript">
// <![CDATA[
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.439 loncom/xml/londefdef.pm:1.440
--- loncom/xml/londefdef.pm:1.439 Mon Apr 16 19:46:14 2012
+++ loncom/xml/londefdef.pm Fri Jul 6 22:46:12 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.439 2012/04/16 19:46:14 raeburn Exp $
+# $Id: londefdef.pm,v 1.440 2012/07/06 22:46:12 raeburn Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -635,10 +635,10 @@
if ($url =~ /\.html?$/i) {
my ($symb,$itemtitle,$displayfile) =
&Apache::lonxml::get_courseupload_hierarchy($url);
- if ($symb ne '') {
+ if (($symb ne '') || ($env{'httpref.'.$url} ne '')) {
$result .= (' ' x 3).
&Apache::lonhtmlcommon::dependencies_button()."\n".
- &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle)."\n";
+ &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,$url)."\n";
}
}
my $viewtext = &mt('Course View');
More information about the LON-CAPA-cvs
mailing list