JQuery

 view release on metacpan or  search on metacpan

lib/JQuery/ClickMenu.pm  view on Meta::CPAN

}
EOD

    $css4 =~ s!ID!$my->{param}{id}!g ; 
    $css6 =~ s!ID!$my->{param}{id}!g ; 
    if (!$my->{param}{headerMenu}) { 
	$css6 = '' ; 
    }  
    # css4 needs to be at the end, otherwise the border does not show.
    return [$css1,$css2,$css3,$css5,$css6,$css4] ; 

} 

#$("#ID").clickMenu({onClick:function(){
#    $.post("PROGRAM_TO_RUN", { date: new Date().getTime(), data: $(this).text(), path: $(this).next().text() RM } );
#}});
#$.post("PROGRAM_TO_RUN", { date: new Date().getTime(), data: $(this).text(), path: $(this).find("span").attr("value") RM } );
#$('#ID').clickMenu({arrowSrc:'arrow_right.png'})
sub get_jquery_code { 
    my $my = shift ; 
    my $id = $my->id ; 
    my $remoteProgram = $my->{param}{remoteProgram} ; 
    my $function =<<'EOD';
        $('#ID').clickMenu({
                arrowSrc:'PLUGINS_DIR/clickmenu/arrow_right.gif', 

                onClick:function(){
		var a = $(this).find('>a');
		if ( a.length )
		{
			//close the menu
			//alert($(this).text() + ' was clicked ' + a.attr('href') );
			$('#ID').trigger('closemenu');
                        $.post("PROGRAM_TO_RUN", { date: new Date().getTime(), data: $(this).text(), path: a.attr('href') , rm: 'MyClickMenu' } );
		}
		return false; //stop default action
	}});
EOD
    $function =~ s/#ID/#$id/g ; 
    $function =~ s/PROGRAM_TO_RUN/$remoteProgram/ ; 
    $function =~ s/PLUGINS_DIR/$my->{fileDir}/g ; 
    my $rm = ", rm: '$my->{param}{rm}'" ;
    $rm = '' unless $my->{param}{rm} =~ /\S/ ; 
    $function =~ s/RM/$rm/ ;
    $function = '' unless $remoteProgram =~ /\S/ ; 
    return $function ; 
}
1;
=head1 NAME

JQuery::ClickMenu - A clickable menu

=head1 VERSION

Version 1.00

=cut

=head1 SYNOPSIS

JQuery::ClickMenu is a desktop style menu. 

    use JQuery;
    use JQuery::ClickMenu ; 
 my $list =<<EOD;
 File(f)
  Menu1
  sep(s)
  Menu2
 Options(f)
  Menu1
  sep(s)
  Menu2
  SubMenu(f)
   Submenu1
   Submenu2
 EOD

 my $clickmenu = JQuery::ClickMenu->new(list => $list, 
				  id => 'myclickmenu',
				  headerMenu => 1,
				  separator => '/',
				  addToJQuery => $jquery,
				  rm => 'MyClickMenu',
				  remoteProgram => '/cgi-bin/jquery_clickmenu_results.pl') ; 
 my $html = $clickmenu->HTML ;
 my $html = $tree->HTML ;
    
=head1 DESCRIPTION

ClickMenu displays a menu in desktop format

The simplest way to present the data is in the format shown
above. Each indentation represents another level. The letters in brackets stand for

=over 

=item f

A folder or node

=item s

A separator line between items

=item list

The list in the format show above

=item id

The css id of the element

=item separator

When an item is pressed, the it and all ancestors are concatenated and
sent to the calling program.  The item called 'data' contains just the
data as shown at the leaf or node. 'path' gives the whole path, each
element being separated by the separator.

In other words, you might get data=myfile, and path=dir/dir1/dir2/myfile

=item addToJQuery

The JQuery container

=item rm
This is the runmode to be used when running an external program

=item remoteProgram
This is the name of the remote program to be used when an item is pressed.

=item headerMenu 

Sets the menu flush at the top with the following css:

        position: fixed;
	top: 0;
	border: 0;
	width: 100%;

=back

=head1 FUNCTIONS

=over

=item new

Instantiate the object



( run in 1.161 second using v1.01-cache-2.11-cpan-d8267643d1d )