use EPrints;
use strict;

my $session = new EPrints::Session;
exit unless( defined $session );


my $url = $session->get_repository()->get_conf("base_url")."/view/keywords/";

my $tag_cloud = EPrints::Plugin::TagCloud->new( 
		session => $session, 
		min_percent => 75, 
		max_percent => 250, 
		link_url_begin => $url, 
		link_url_end => ".html",
		fieldname => 'keywords',
	);

my $tag_cloud_container = $session->make_element( 'div', class => 'ed_tag_cloud' );
$tag_cloud_container->appendChild( $tag_cloud->render() );

my $frag = $session->param( 'frag' );


if( defined $frag && $frag == 1 )
{
	binmode( STDOUT, ":utf8" );
        print STDOUT $tag_cloud_container->toString;
}
else
{
        my $title = $session->make_text( "Tag Cloud" );
        my $page = $session->make_doc_fragment;
        $page->appendChild( $tag_cloud_container );
        $session->build_page( $title, $page, "tag_cloud" );
        $session->send_page;
}

$session->terminate;

