lib/TWiki/Contrib/BehaviourContrib.pm
changeset 0 414e01d06fd5
child 1 e2915a7cbdfa
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/TWiki/Contrib/BehaviourContrib.pm	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +package TWiki::Contrib::BehaviourContrib;
     1.5 +use vars qw( $VERSION );
     1.6 +$VERSION = '$Rev: 15675 (22 Jan 2008) $';
     1.7 +$RELEASE = '1.3.1';
     1.8 +
     1.9 +=begin twiki
    1.10 +
    1.11 +---+++ TWiki::Contrib::BehaviourContrib::addHEAD()
    1.12 +
    1.13 +This function will automatically add the headers for the contrib to
    1.14 +the page being rendered. It is intended for use from Plugins and
    1.15 +other extensions. For example:
    1.16 +
    1.17 +<verbatim>
    1.18 +sub commonTagsHandler {
    1.19 +  ....
    1.20 +  require TWiki::Contrib::BehaviourContrib;
    1.21 +  TWiki::Contrib::BehaviourContrib::addHEAD();
    1.22 +  ....
    1.23 +</verbatim>
    1.24 +
    1.25 +=cut
    1.26 +
    1.27 +sub addHEAD {
    1.28 +    my $base = '%PUBURLPATH%/%TWIKIWEB%/BehaviourContrib';
    1.29 +    my $USE_SRC =
    1.30 +      TWiki::Func::getPreferencesValue('BEHAVIOURCONTRIB_DEBUG') ?
    1.31 +          '_src' : '';
    1.32 +    my $head = <<HERE;
    1.33 +<script type='text/javascript' src='$base/behaviour$USE_SRC.js'></script>
    1.34 +HERE
    1.35 +    TWiki::Func::addToHEAD( 'BEHAVIOURCONTRIB', $head );
    1.36 +}
    1.37 +
    1.38 +1;