Index: lib/TWiki.pm =================================================================== --- lib/TWiki.pm (revision 4662) +++ lib/TWiki.pm (working copy) @@ -544,6 +544,8 @@ # see perldoc -f length my $len = do { use bytes; length( $text ); }; $this->writePageHeader( undef, $pageType, $contentType, $len ); + my $htmlHeader=join("\n",values %{$this->{htmlHeaders}}); + $text =~ s/([<]\/head[>])/$htmlHeader$1/i if $htmlHeader; print $text; } @@ -976,6 +978,7 @@ $this->{remoteUser} = $remoteUser; @{$this->{publicWebList}} = (); + %$this->{htmlHeaders} = {}; $this->{context} = {}; @@ -2162,8 +2165,23 @@ $_[0] =~ s;]*\bhref\s*=\s*['"](?!$TWiki::cfg{AntiSpam}{Clean}));isa( 'TWiki')) if DEBUG; + + $header=$this->handleCommonTags($header,$this->{webName},$this->{topicName}); + + $this->{htmlHeaders}{$tag}=$header; +} + +=pod + ---++ StaticMethod initialize( $pathInfo, $remoteUser, $topic, $url, $query ) -> ($topicName, $webName, $scriptUrlPath, $userName, $dataDir) Return value: ( $topicName, $webName, $TWiki::cfg{ScriptUrlPath}, $userName, $TWiki::cfg{DataDir} ) Index: lib/TWiki/Plugins/EditTablePlugin.pm =================================================================== --- lib/TWiki/Plugins/EditTablePlugin.pm (revision 4662) +++ lib/TWiki/Plugins/EditTablePlugin.pm (working copy) @@ -77,7 +77,8 @@ my $string = " \n"; - $_[0] =~ s/([<]\/head[>])/$string$1/i; +# $_[0] =~ s/([<]\/head[>])/$string$1/i; + TWiki::Func::addToHTMLHead('EDITTABLEPLUGIN_STYLE',$string); } return unless $_[0] =~ /%EDIT(TABLE|CELL){(.*)}%/os; Index: lib/TWiki/Plugins/EditTablePlugin/Core.pm =================================================================== --- lib/TWiki/Plugins/EditTablePlugin/Core.pm (revision 4662) +++ lib/TWiki/Plugins/EditTablePlugin/Core.pm (working copy) @@ -267,10 +267,17 @@ my $text = ''; if( $doEdit ) { my $dir = $TWiki::Plugins::EditTablePlugin::mishooHome; - $text .= "$preSp\n"; - $text .= "$preSp\n"; - $text .= "$preSp\n"; +# $text .= "$preSp\n"; +# $text .= "$preSp\n"; +# $text .= "$preSp\n"; + my $scriptext= "$preSp\n"; + $scriptext .= "$preSp\n"; + $scriptext .= "$preSp\n"; + TWiki::Func::addToHTMLHead("calendar",$scriptext); + TWiki::Func::addToHTMLHead("calendar",$scriptext); + } $text .= "$preSp\n" if $doEdit; $text .= "$preSp\n"; Index: lib/TWiki/Func.pm =================================================================== --- lib/TWiki/Func.pm (revision 4662) +++ lib/TWiki/Func.pm (working copy) @@ -17,7 +17,7 @@ # # As per the GPL, removal of this notice is prohibited. -=begin twiki +=pod ---++ package TWiki::Func @@ -1018,9 +1018,32 @@ } =pod - ---++ Functions: Rendering +=cut +=pod +---+++ addToHTMLHead($tag,$header) +Adds =$header= to the HTML header (the tags) +This is useful for plugins that want to include some javascript library or a custom css. + * =$tag= - Unique ID to prevent duplicated. It's suggested that Plugins use a suffix to prevent name clashed (ie: EDITTABLEPLUGIN_JSCALENDAR) + * =$header= - the text to be added to the section + +All tags pressent in =$header= will be expanded before being inserted into the == section. + +*Since:* TWiki::Plugins::VERSION 1.026 + +example: + +TWiki::Func::addToHTMLHead('PATTERN_STYLE','') + +=cut= + +sub addToHTMLHead { + my ($tag,$header) =@_; + $TWiki::Plugins::SESSION->addToHTMLHead($tag,$header); +} + +=pod= ---+++ registerTagHandler( $tag, \&fn ) Should only be called from initPlugin. Index: lib/TWiki/UI/View.pm =================================================================== --- lib/TWiki/UI/View.pm (revision 4662) +++ lib/TWiki/UI/View.pm (working copy) @@ -23,8 +23,7 @@ # # As per the GPL, removal of this notice is prohibited. -=begin twiki - +=pod ---+ package TWiki::UI::View UI delegate for view function