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

raeburn raeburn at source.lon-capa.org
Sun Aug 3 10:20:43 EDT 2014


raeburn		Sun Aug  3 14:20:43 2014 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
    /loncom/xml	scripttag.pm 
  Log:
  - Support style of packaging .js dependency used in Camtasia Studio 8.4.2
    *_player.html files.
  - Dependency on spritesheet.min.css no longer included as <link> tag in
    Camtasia's top-levl *.html file, so explicitly include in %allow.
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.292 loncom/publisher/lonpublisher.pm:1.293
--- loncom/publisher/lonpublisher.pm:1.292	Sun Aug  3 13:52:59 2014
+++ loncom/publisher/lonpublisher.pm	Sun Aug  3 14:20:38 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.292 2014/08/03 13:52:59 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.293 2014/08/03 14:20:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -825,6 +825,14 @@
 #
                                                     my $spritesheet = $1.'express_show/spritesheet.png';
                                                     $allow{&absoluteurl($spritesheet,$target)}=1;
+
+#
+# Camtasia 8.4: skins/express_show/spritesheet.min.css needed, and included in zip archive.
+# Not referenced directly in <main>.html or <main>_player.html files,
+# so add this file to %allow (where <main> is name user gave to file/archive).
+#
+                                                    my $spritecss = $1.'express_show/spritesheet.min.css';
+                                                    $allow{&absoluteurl($spritecss,$target)}=1;
                                                 }
                                             } elsif ($srctype eq 'PosterImageSrc') {
                                                 if ($url =~ m{^(.+)_First_Frame\.png$}) {
@@ -843,6 +851,15 @@
                                 }
                             }
                         }
+                        if ($script =~ m{\.addMediaSrc\((["'])((?!\1).+)\1\);}) {
+                            my $src = $2;
+                            if ($src) {
+                                my $url = &urlfixup($src);
+                                unless ($url=~m{^(?:http|https|ftp)://}) {
+                                    $allow{&absoluteurl($url,$target)}=1;
+                                }
+                            }
+                        }
                         if ($script =~ /\(document,\s*(['"])script\1,\s*\[([^\]]+)\]\);/s) {
                             my $scriptslist = $2;
                             my @srcs = split(/\s*,\s*/,$scriptslist);
@@ -857,6 +874,15 @@
                                 }
                             }
                         }
+                        if ($script =~ m{loadScript\(\s*(['"])((?:(?!\1).)+\.js)\1,\s*function}is) {
+                            my $src = $2;
+                            if ($src) {
+                                my $url = &urlfixup($src);
+                                unless ($url=~m{^(?:http|https|ftp)://}) {
+                                    $allow{&absoluteurl($url,$target)}=1;
+                                }
+                            }
+                        }
                         $outstring .= $script;
                     }
                 }
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.170 loncom/xml/scripttag.pm:1.171
--- loncom/xml/scripttag.pm:1.170	Sun Jul 27 11:39:29 2014
+++ loncom/xml/scripttag.pm	Sun Aug  3 14:20:43 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.170 2014/07/27 11:39:29 raeburn Exp $
+# $Id: scripttag.pm,v 1.171 2014/08/03 14:20:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -142,7 +142,7 @@
               }
           } elsif (($type eq 'text/javascript') && ($bodytext ne '')) {
               if ($url =~ m{^\Q/uploaded/$cdom/$cnum/docs/\E}) {
-                  if ($bodytext =~ m{\.addMediaSrc\((["'])(?:(?!\1).)+\1\)}) {
+                  if ($bodytext =~ m{\.addMediaSrc\((["'])((?!\1).)+\1\);}) {
                       my $quote = $1;
                       if ($bodytext =~ m{\Q.addMediaSrc($quote\E([^$quote]+)\Q$quote)\E}) {
                           my $fname = $1;
@@ -225,6 +225,16 @@
                           }
                       }
                   }
+                  if ($bodytext =~ m{loadScript\(\s*(['"])((?:(?!\1).)+\.js)\1,\s*function}is) {
+                      my $fname = $2;
+                      if ($fname) {
+                          my $cleanhref =
+                              &Apache::londefdef::clean_docs_httpref($fname,$url,$cdom,$cnum);
+                          if ($cleanhref) {
+                              &Apache::lonxml::extlink($cleanhref);
+                          }
+                      }
+                  }
               }
           }
       }




More information about the LON-CAPA-cvs mailing list