--- loncom/interface/loncommon.pm 2012/04/06 01:23:11 1.1066 +++ loncom/interface/loncommon.pm 2012/04/08 22:34:57 1.1067 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1066 2012/04/06 01:23:11 raeburn Exp $ +# $Id: loncommon.pm,v 1.1067 2012/04/08 22:34:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -9931,20 +9931,26 @@ sub decompress_form { my ($mimetype,$archiveurl,$action,$noextract,$hiddenelements,$dirlist) = @_; my %lt = &Apache::lonlocal::texthash ( this => 'This file is an archive file.', + camt => 'This file is a Camtasia archive file.', itsc => 'Its contents are as follows:', youm => 'You may wish to extract its contents.', - camt => 'Extraction of contents is recommended for Camtasia zip files.', extr => 'Extract contents', + auto => 'LON-CAPA can process the files automatically, or you can decide how each should be handled.', + proa => 'Process automatically?', yes => 'Yes', no => 'No', + fold => 'Title for folder containing movie', + movi => 'Title for page containing embedded movie', ); - my $output = '
'.$lt{'this'}; my $fileloc = &Apache::lonnet::filelocation(undef,$archiveurl); - my (%toplevel,@paths); + my ($is_camtasia,$topdir,%toplevel,@paths); my $info = &list_archive_contents($fileloc,\@paths); if (@paths) { foreach my $path (@paths) { $path =~ s{^/}{}; + if ($path =~ m{^([^/]+)/$}) { + $topdir = $1; + } if ($path =~ m{^([^/]+)/}) { $toplevel{$1} = $path; } else { @@ -9952,12 +9958,53 @@ sub decompress_form { } } } - if ($info eq '') { - $output .= ' '.$lt{'youm'}.'
'."\n"; + if ($mimetype =~ m{^application/(x\-)?(compressed|zip)}) { + my @camtasia = ("$topdir/","$topdir/index.html", + "$topdir/media/", + "$topdir/media/$topdir.mp4", + "$topdir/media/FirstFrame.png", + "$topdir/media/player.swf", + "$topdir/media/swfobject.js", + "$topdir/media/expressInstall.swf"); + my @diffs = &compare_arrays(\@paths,\@camtasia); + if (@diffs == 0) { + $is_camtasia = 1; + } + } + my $output; + if ($is_camtasia) { + $output = <<"ENDCAM"; + +$lt{'camt'}
+ENDCAM } else { - $output .= ' '.$lt{'itsc'}.''."\n". - ''.$info.'
'.$lt{'this'}; + if ($info eq '') { + $output .= ' '.$lt{'youm'}.'
'."\n"; + } else { + $output .= ' '.$lt{'itsc'}.''."\n". + ''.$info.'