• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5590: BrowserBoosterPlugin: does not work with EditTablePlugin

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension BrowserBoosterPlugin Normal Closed TWiki:Main.OliverKrueger n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

... because it is too restrictive about the urls in css and js it can import.

Here's the patch:

--- lib/TWiki/Plugins/BrowserBoosterPlugin.pm   (revision 16732)
+++ lib/TWiki/Plugins/BrowserBoosterPlugin.pm   (working copy)
@@ -27,7 +27,7 @@
 $NO_PREFS_IN_TOPIC = 1;
 $pluginName = 'BrowserBoosterPlugin';

-sub DEBUG { 0; } # toggle me
+use constant DEBUG => 0; # toggle me

 sub initPlugin {
     my( $topic, $web, $user, $installWeb ) = @_;
@@ -78,7 +78,7 @@
     $text    =~ m/src=["'](.*?)["']/i;
     my $file = $1;
     my $src  = $1;
-    $file    =~ s/($TWiki::cfg{DefaultUrlHost})?$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/ge;
+    $file    =~ s/.*$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/g;

     # read file
     my $fileContent = readFile( $file );
@@ -87,7 +87,7 @@
     return $text unless $fileContent; # just to make sure

     $fileContent =~ s/<(\/?script)/&lt;$1/go;
-    return "\n" . '<!-- ' . $src . ' -->' ."\n" . '<script type="text/javascript">'."\n" . $fileContent . "\n</script>\n";
+    return "\n<!-- BrowserBoosterPlugin: $src -->\n" . '<script type="text/javascript">'."\n" . $fileContent . "\n</script>\n";

 }

@@ -114,21 +114,9 @@
 sub importStylesheet {
     my ( $url, $prefix, $suffix ) = @_;
     my $retval = "";
-    my $file   = "";
-    my $dir    = $TWiki::cfg{PubDir};
+    my $file   = $url;
+    $file =~ s/.*$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/g;

-    if ( $url =~ m/^http/ ) {
-      # url with host
-      $file             = $url;
-      my $twiki_pub_url = $TWiki::cfg{DefaultUrlHost} . $TWiki::cfg{PubUrlPath};
-      $file             =~ s/$twiki_pub_url/$dir/ge;
-    } else {
-      # url without host
-      $file             = $url;
-      my $twiki_pub_url = $TWiki::cfg{PubUrlPath};
-      $file             =~ s/$twiki_pub_url/$dir/ge;
-    }
-
     if ( $file ) {
       my $fileContent = readFile( $file );

@@ -141,7 +129,7 @@
       # SMELL: We should maintain a list of visited urls to prevent loops
     }

-    return $prefix . $retval . $suffix;
+    return $prefix . "/* BrowserBoosterPlugin: $url */\n" . $retval . $suffix;
 }

Oliver, could you please check?

-- TWiki:Main/MichaelDaum - 30 Apr 2008

Looks good. Thanks Michael.

-- TWiki:Main.OliverKrueger - 04 Jul 2008

ItemTemplate
Summary BrowserBoosterPlugin: does not work with EditTablePlugin
ReportedBy TWiki:Main.MichaelDaum
Codebase

SVN Range TWiki-5.0.0, Tue, 15 Apr 2008, build 16676
AppliesTo Extension
Component BrowserBoosterPlugin
Priority Normal
CurrentState Closed
WaitingFor TWiki:Main.OliverKrueger
Checkins TWikirev:16983
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-07-04 - OliverKrueger
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback