[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /publisher lonpublisher.pm /xml scripttag.pm

raeburn raeburn at source.lon-capa.org
Sun Jul 27 07:39:37 EDT 2014


raeburn		Sun Jul 27 11:39:37 2014 EDT

  Modified files:              
    /loncom/xml	scripttag.pm 
    /loncom/publisher	lonpublisher.pm 
    /loncom/interface	loncommon.pm 
  Log:
  - Bug 6671
   - Support changes in packaging of mp4 files between Camtasia 8.1
     and Camtasia 8.4.
  
  
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.169 loncom/xml/scripttag.pm:1.170
--- loncom/xml/scripttag.pm:1.169	Tue Oct  1 00:52:58 2013
+++ loncom/xml/scripttag.pm	Sun Jul 27 11:39:29 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.169 2013/10/01 00:52:58 raeburn Exp $
+# $Id: scripttag.pm,v 1.170 2014/07/27 11:39:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -142,6 +142,17 @@
               }
           } elsif (($type eq 'text/javascript') && ($bodytext ne '')) {
               if ($url =~ m{^\Q/uploaded/$cdom/$cnum/docs/\E}) {
+                  if ($bodytext =~ m{\.addMediaSrc\((["'])(?:(?!\1).)+\1\)}) {
+                      my $quote = $1;
+                      if ($bodytext =~ m{\Q.addMediaSrc($quote\E([^$quote]+)\Q$quote)\E}) {
+                          my $fname = $1;
+                          my $cleanhref =
+                              &Apache::londefdef::clean_docs_httpref($fname,$url,$cdom,$cnum);
+                          if ($cleanhref) {
+                              &Apache::lonxml::extlink($cleanhref);
+                          }
+                      }
+                  }
                   if ($bodytext =~ m{\.set\w+(Src|Swf)\(["']}i) {
                       my @srcs = split(/\.set/,$bodytext);
                       if (scalar(@srcs) > 1) {
@@ -168,6 +179,16 @@
                                                   &Apache::lonxml::extlink($spritesheet);
                                               }
                                           }
+#
+# Camtasia 8.4: express_show/spritesheet.min.css needed, and included in zip archive.
+# Not referenced directly in <main>.html or <main>_player.html files,
+# so call lonxml::extlink() here to include httpref for the uploaded file.
+# (where <main> is name user gave to file/archive).
+#
+                                          my $spritesheet_css = $1.'express_show/spritesheet.min.css';
+                                          if (&Apache::lonnet::repcopy_userfile($spritesheet_css) eq 'ok') {
+                                              &Apache::lonxml::extlink($spritesheet_css);
+                                          }
                                       } elsif ($srctype eq 'PosterImageSrc') {
                                           if ($fname =~ m{^(.+)_First_Frame\.png$}) {
                                               my $prefix = $1;
@@ -189,6 +210,21 @@
                           }
                       }
                   }
+                  if ($bodytext =~ /\(document,\s*(['"])script\1,\s*\[([^\]]+)\]\);/s) {
+                      my $scriptslist = $2;
+                      my @srcs = split(/\s*,\s*/,$scriptslist);
+                      foreach my $src (@srcs) {
+                          if ($src =~ /(["'])(?:(?!\1).)+\.js\1/) {
+                              my $quote = $1;
+                              my ($fname) = ($src =~ m/\Q$quote\E([^$quote]+)\Q$quote\E/);
+                              my $cleanhref =
+                                  &Apache::londefdef::clean_docs_httpref($fname,$url,$cdom,$cnum);
+                              if ($cleanhref) {
+                                  &Apache::lonxml::extlink($cleanhref);
+                              }
+                          }
+                      }
+                  }
               }
           }
       }
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.290 loncom/publisher/lonpublisher.pm:1.291
--- loncom/publisher/lonpublisher.pm:1.290	Sun Jul 27 11:14:36 2014
+++ loncom/publisher/lonpublisher.pm	Sun Jul 27 11:39:33 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.290 2014/07/27 11:14:36 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.291 2014/07/27 11:39:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -841,6 +841,20 @@
                                 }
                             }
                         }
+                        if ($script =~ /\(document,\s*(['"])script\1,\s*\[([^\]]+)\]\);/s) {
+                            my $scriptslist = $2;
+                            my @srcs = split(/\s*,\s*/,$scriptslist);
+                            foreach my $src (@srcs) {
+                                if ($src =~ /(["'])(?:(?!\1).)+\.js\1/) {
+                                    my $quote = $1;
+                                    my ($url) = ($src =~ m/\Q$quote\E([^$quote]+)\Q$quote\E/);
+                                    $url = &urlfixup($url);
+                                    unless ($url=~m{^(?:http|https|ftp)://}) {
+                                        $allow{&absoluteurl($url,$target)}=1;
+                                    }
+                                }
+                            }
+                        }
                         $outstring .= $script;
                     }
                 }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1196 loncom/interface/loncommon.pm:1.1197
--- loncom/interface/loncommon.pm:1.1196	Sun Jun 22 19:11:58 2014
+++ loncom/interface/loncommon.pm	Sun Jul 27 11:39:36 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1196 2014/06/22 19:11:58 raeburn Exp $
+# $Id: loncommon.pm,v 1.1197 2014/07/27 11:39:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -11073,7 +11073,7 @@
                         "$topdir/media/player.swf",
                         "$topdir/media/swfobject.js",
                         "$topdir/media/expressInstall.swf");
-        my @camtasia8 = ("$topdir/","$topdir/$topdir.html",
+        my @camtasia8_1 = ("$topdir/","$topdir/$topdir.html",
                          "$topdir/$topdir.mp4",
                          "$topdir/$topdir\_config.xml",
                          "$topdir/$topdir\_controller.swf",
@@ -11095,13 +11095,36 @@
                          "$topdir/skins/express_show/",
                          "$topdir/skins/express_show/player-min.css",
                          "$topdir/skins/express_show/spritesheet.png");
+        my @camtasia8_4 = ("$topdir/","$topdir/$topdir.html",
+                         "$topdir/$topdir.mp4",
+                         "$topdir/$topdir\_config.xml",
+                         "$topdir/$topdir\_controller.swf",
+                         "$topdir/$topdir\_embed.css",
+                         "$topdir/$topdir\_First_Frame.png",
+                         "$topdir/$topdir\_player.html",
+                         "$topdir/$topdir\_Thumbnails.png",
+                         "$topdir/playerProductInstall.swf",
+                         "$topdir/scripts/",
+                         "$topdir/scripts/config_xml.js",
+                         "$topdir/scripts/techsmith-smart-player.min.js",
+                         "$topdir/skins/",
+                         "$topdir/skins/configuration_express.xml",
+                         "$topdir/skins/express_show/",
+                         "$topdir/skins/express_show/spritesheet.min.css",
+                         "$topdir/skins/express_show/spritesheet.png",
+                         "$topdir/skins/express_show/techsmith-smart-player.min.css");
         my @diffs = &compare_arrays(\@paths,\@camtasia6);
         if (@diffs == 0) {
             $is_camtasia = 6;
         } else {
-            @diffs = &compare_arrays(\@paths,\@camtasia8);
+            @diffs = &compare_arrays(\@paths,\@camtasia8_1);
             if (@diffs == 0) {
                 $is_camtasia = 8;
+            } else {
+                @diffs = &compare_arrays(\@paths,\@camtasia8_4);
+                if (@diffs == 0) {
+                    $is_camtasia = 8;
+                }
             }
         }
     }




More information about the LON-CAPA-cvs mailing list