Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Class::DBI::Plugin::FilterOnClick 1.0

    Download button

    No screenshots available
    Downloads: 341  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Aaron Johnson | More programs
    Perl Artistic License / FREE
    November 29th, 2006, 23:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Class::DBI::Plugin::FilterOnClick description

    Class::DBI::Plugin::FilterOnClick is a Perl module to generate browsable and searchable HTML Tables.

    Class::DBI::Plugin::FilterOnClick is a Perl module to generate browsable and searchable HTML Tables using FilterOnClick in conjunction with Class::DBI.

    SYNOPSIS

    # Inside of your sub-class of Class::DBI add these lines:
    use Class::DBI::Plugin::FilterOnClick;
    use Class::DBI::Pager;
    use Class::DBI::AbstractSearch;
    use Class::DBI::Plugin::AbstractCount;
    use Class::DBI::Plugin::RetrieveAll;

    .....

    # Inside your script you will be able to use this modules
    # methods on your table class or object as needed.

    use ClassDBIBaseClass;
    use URI::Escape;
    use CGI;

    my $cgi = CGI->new();

    my %params;

    map { $params{$_} =
    uri_unescape($cgi->param("$_"))
    } $cgi->param();

    my $filteronclick = Baseball::Master->filteronclick(
    -config_file => '/srv/www/cgi-bin/baseball.ini',
    # -rows => $cgi->param('rows') || 15 ,
    -on_page => $cgi->param('page') || 1,
    -params => %params );

    $filteronclick->field_to_column(
    lastname => 'Last Name' . $html->order_by_link('lastname'),
    firstname => 'First Name' . $html->order_by_link('firstname'),
    bats => 'Bats',
    throws => 'Throws',
    ht_ft => 'Height Ft',
    ht_in => 'In',
    wt => 'Weight',
    birthyear => 'Birthyear',
    birthstate => 'Birthstate',
    _FilterOnClickCustom1_ => 'Other Data',
    _FilterOnClickCustom2_ => 'More Data'
    );

    FilterOnClickCustom

    $filteronclick->data_table->addRow(
    'Last Name',
    'First Name',
    'Bats' ,
    'Throws' ,
    'Height (ft)',
    '(inches)',
    'Weight',
    'Birth Year' );

    $filteronclick->params( $cgi->Vars; );
    $filteronclick->exclude_from_url([ 'page' ]);

    # indicate which columns to exclude, inverse of display above
    # can be set in config file as well
    $filteronclick->exclude_columns();

    # indicate the base class to work with, this is optional,
    # if you should create you object via a call to
    # Class::DBI::Plugin::FilterOnClick vs. a Class::DBI sub class
    # this assures the correct sub class is used for data collection
    $filteronclick->cdbi_class( 'Baseball::Master' );

    # indicate the style of navigation to provide
    $filteronclick->navigation_style( 'both' );

    print qq~Filter by First Letter of Last Name~;

    print $filteronclick->string_filter_navigation(
    -column => 'lastname',
    -position => 'begins',
    );

    print qq~~;

    $filteronclick->only('firstname');


    print $filteronclick->build_table(

    _FilterOnClickCustom1_ => sub {
    my $pid = shift; # pid = Primary ID of the record in the base table
    my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
    if (@status_objects) {
    my $years;
    foreach my $st (@status_objects) {
    $years .= $st->year() . " ";
    }
    return $years;
    }
    return 'NA';
    },

    _FilterOnClickCustom2_ => sub {
    my $pid = shift; # pid = Primary ID of the record in the base table
    my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
    if (@status_objects) {
    my $teams;
    foreach my $st (@status_objects) {
    $teams .= $st->team() . " ";
    }
    return $teams;
    }
    return 'NA';
    },
    );

    my $nav = $filteronclick->html_table_navigation();

    print qq!$navn!;

    $filteronclick->add_bottom_span($nav);

    print $filteronclick->data_table;

    UPGRADE WARNING

    As of the .8 release there have been changes to the methods and how they work. It is likely that scripts built with older versions WILL break. Please read below to find specific changes that may negatively impact scripts built using the the releases prior to .8. The 1.0 release contains some minor modifications that could in some chases break your scripts, test carefully before upgrading in a production environment.

    The intention of this module is to simplify the creation of browsable and searchable HTML tables without having to write the HTML, either in your script or in templates.
    It is intended for use inside of other frameworks such as Embperl, Apache::ASP or even CGI. It does not aspire to be its own framework. If you are looking for a frameworks which allow using Class::DBI I suggest you look into the Maypole or the Catalyst module.

    See FilterOnClick below for more on the purpose of this module.

    Tables are created using HTML::Table. The use of HTML::Table was selected because it allows for several advanced sorting techniques that can provide for easy manipulation of the data outside of the SQL statement. This is very useful in scenarios where you want to provide/test a sort routine and not write SQL for it. The more I use this utility the less likely it seems that one would need to leverage this, but it is an option if you want to explore it.

    Feedback on this module, its interface, usage, documentation etc. is welcome.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    HTML Tables | Class::DBI plugin | Perl module | Class::DBI::Plugin:: | generate | HTML

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM