NAME
CGI::Application::Plugin::MetadataDB
SYNOPSIS
use CGI::Application::Plugin::MetadataDB;
use CGI::Application::Plugin::Feedback;
use CGI::Application::Plugin::Session;
$ENV{HTML_TEMPLATE_ROOT} = '';
sub mdw_search : Runmode {
my $self = shift;
}
sub mdw_search_results : Runmode {
my $self = shift;
}
See Medatata::DB::WUI code for example usage.
DESCRIPTION
Methods to aid building search to use Metadata::DB You will need to import the following plugins in your cgi app CGI::Application::Plugin::Session; CGI::Application::Plugin::Feedback;
Metadata::DB::Search makes use of a database.
CUSTOMIZING
the main things you want to customize are
how each record displays
my $default = q{
<div>
<i><TMPL_VAR LIST_INDEX></i>
id <TMPL_VAR ID>
<TMPL_VAR META_AS_UL_HTML>
</div>
};
$o->mdw_result_code($default);
the main template
the connection to the database
METHODS
These methods are meant to aid you in creating runmodes that interact with Metadata::DB
mds_object()
mdw_per_page_limit()
mdw_process_search()
mdw_record_params()
argument is id number, returns html template params in hashref
mdw_records_loop()
argument is a list of ids, (not array ref)
returns a loop suitable for html template, uses mdw_record_params()
mdw_result_code()
perl setget method, returns result code for one object you can override this
mdw_results_loop_detailed()
mdw_search_args_submitted()
mdw_search_results_tmpl_code()
mdw_search_tmpl()
This is a setget method, opt arg is a HTML::Template object returns HTML::Template object by default we look for ENV HTML_TEMPLATE_ROOT / mdw_search.html you can provide your own template by passing to the method before run
mdw_search_results_tmpl()
this is like mdw_search_results_tmpl() by default looks for mdw_search_results.html you can pass it another template to use
mdw_search_results_tmpl_name()
setget method, default is mdw_search_results.html
mdw_search_tmpl_name()
setget method, default is mdw_search.html
IF YOU WANT TO CHANGE THE TEMPLATES USED
Presently we require that the search template, generated by Metadata::DB::Search::InterfaceHTML be present on disk, if you have various of these you may want to define which to use before you run() your cgiapp
$wui->mdw_search_tmpl_name('mdw_search.people.html');
And maybe change the output also for each record..
$wui->mdw_search_results_tmpl_name('mdw_search_results.people.html');
$wui->run;
Of course you can also provide template objects via mdw_search_results_tmpl() etc.