[LON-CAPA-cvs] cvs: loncom /interface londocs.pm portfolio.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 11 Jun 2007 17:13:34 -0000


albertel		Mon Jun 11 13:13:34 2007 EDT

  Modified files:              
    /loncom/interface	portfolio.pm londocs.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - BUG#5290 - also support <a href releative references on upload
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.179 loncom/interface/portfolio.pm:1.180
--- loncom/interface/portfolio.pm:1.179	Tue May  1 21:33:50 2007
+++ loncom/interface/portfolio.pm	Mon Jun 11 13:13:30 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.179 2007/05/02 01:33:50 albertel Exp $
+# $Id: portfolio.pm,v 1.180 2007/06/11 17:13:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1830,7 +1830,9 @@
     <input type="hidden" name="mode"        value="$env{'form.mode'}" />
 STATE
 	    $r->print("<p>Completed upload of the file. This file contained references to other files. You can upload these now: </p>");
-	    $r->print(&Apache::londocs::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase,{'error_on_invalid_names' => 1}));
+	    $r->print(&Apache::londocs::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase,
+				      {'error_on_invalid_names'   => 1,
+				       'ignore_remote_references' => 1,}));
 	    $r->print('<p>Or '.&done('Return to directory listing',$url).'</p>');
 	} else {
 	    $r->print(&done(undef,$url));
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.273 loncom/interface/londocs.pm:1.274
--- loncom/interface/londocs.pm:1.273	Mon May 21 20:38:25 2007
+++ loncom/interface/londocs.pm	Mon Jun 11 13:13:30 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.273 2007/05/22 00:38:25 albertel Exp $
+# $Id: londocs.pm,v 1.274 2007/06/11 17:13:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1586,11 +1586,16 @@
     foreach my $embed_file (keys(%{$allfiles})) {
 	$upload_output .= &Apache::loncommon::start_data_table_row().
 	    '<td>'.$embed_file.'</td><td>';
-	if ($args->{'error_on_invalid_names'}
+	if ($args->{'ignore_remote_references'}
+	    && $embed_file =~ m{^\w+://}) {
+	    $upload_output.='<span class="LC_warning">'.&mt("URL points to other server.").'</span>';
+	} elsif ($args->{'error_on_invalid_names'}
 	    && $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) {
 	    
 	    $upload_output.='<span class="LC_warning">'.&mt("Invalid characters").'</span>';
+	    
 	} else {
+
 	    $upload_output .='
            <input name="embedded_item_'.$num.'" type="file" value="bob" />
            <input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />';
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.885 loncom/lonnet/perl/lonnet.pm:1.886
--- loncom/lonnet/perl/lonnet.pm:1.885	Thu Jun  7 18:09:59 2007
+++ loncom/lonnet/perl/lonnet.pm	Mon Jun 11 13:13:34 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.885 2007/06/07 22:09:59 albertel Exp $
+# $Id: lonnet.pm,v 1.886 2007/06/11 17:13:34 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1739,13 +1739,16 @@
     while (my $t=$p->get_token()) {
 	if ($t->[0] eq 'S') {
 	    my ($tagname, $attr) = ($t->[1],$t->[2]);
-	    push (@state, $tagname);
+	    push(@state, $tagname);
             if (lc($tagname) eq 'allow') {
                 &add_filetype($allfiles,$attr->{'src'},'src');
             }
 	    if (lc($tagname) eq 'img') {
 		&add_filetype($allfiles,$attr->{'src'},'src');
 	    }
+	    if (lc($tagname) eq 'a') {
+		&add_filetype($allfiles,$attr->{'href'},'href');
+	    }
             if (lc($tagname) eq 'script') {
                 if ($attr->{'archive'} =~ /\.jar$/i) {
                     &add_filetype($allfiles,$attr->{'archive'},'archive');