Search - Paginate results (#713)

This commit is contained in:
JT Smith 2008-10-21 20:28:49 +00:00
parent c35ef01b49
commit 20460192a6
4 changed files with 39 additions and 8 deletions

View file

@ -7,7 +7,8 @@
- Made Classname from control a subclass of ReadOnly.
- Added query keys to WebGUI::Crud.
- EMS Saved Address (#8864)
- Inclusion of UsersOnline macro into the core (#766)
- rfe: Inclusion of UsersOnline macro into the core (#766)
- rfe: Search - Paginate results (#713)
- WebGUI::Crud can now automatically resolve differences between its
definition and the table schema.
- Fixed a limit bug in the asset discovery service.

View file

@ -32,14 +32,23 @@ my $session = start(); # this line required
repairManageWorkflows($session);
addPreTextToThingyFields($session);
updateAddressBook($session);
changeDefaultPaginationInSearch($session);
addUsersOnlineMacro($session);
finish($session); # this line required
#----------------------------------------------------------------------------
sub changeDefaultPaginationInSearch {
my $session = shift;
print "\tAllow content managers to change the default pagination in the search asset... " unless $quiet;
$session->db->write("ALTER TABLE `search` ADD COLUMN `paginateAfter` INTEGER NOT NULL DEFAULT 25");
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addUsersOnlineMacro {
my $session = shift;
print "\tMaking the UsersOnline macro available." unless $quiet;
print "\tMaking the UsersOnline macro available... " unless $quiet;
$session->config->addToHash("macros","UsersOnline","UsersOnline");
print "DONE!\n" unless $quiet;
}
@ -47,7 +56,7 @@ sub addUsersOnlineMacro {
#----------------------------------------------------------------------------
sub updateAddressBook {
my $session = shift;
print "\tAdding organization and email to address book." unless $quiet;
print "\tAdding organization and email to address book... " unless $quiet;
my $db = $session->db;
$db->write("alter table address add column organization char(255)");
$db->write("alter table address add column email char(255)");

View file

@ -104,7 +104,15 @@ sub definition {
fieldType => "yesNo",
defaultValue => 0,
},
);
paginateAfter => {
hoverHelp => $i18n->get("paginate after help"),
label => $i18n->get("paginate after"),
tab => "display",
fieldType => "integer",
defaultValue => 25,
},
);
push(@{$definition}, {
assetName=>$i18n->get('assetName'),
icon=>'search.gif',
@ -152,9 +160,9 @@ sub view {
my %var;
$var{'form_header' } = WebGUI::Form::formHeader($session, {
action=>$self->getUrl("doit=1")
});
#.WebGUI::Form::hidden($self->session,{name=>"doit", value=>"1"});
action=>$self->getUrl
})
.WebGUI::Form::hidden($self->session,{name=>"doit", value=>"1"});
$var{'form_footer' } = WebGUI::Form::formFooter($session);
$var{'form_submit' } = WebGUI::Form::submit($session, {
value=>$i18n->get("search")
@ -187,7 +195,8 @@ sub view {
#Set up the paginator
my $p = $search->getPaginatorResultSet (
$self->getUrl('doit=1;keywords='.$session->url->escape($keywords))
$self->getUrl('doit=1;keywords='.$session->url->escape($keywords)),
$self->get("paginateAfter"),
);
my @results = ();

View file

@ -3,6 +3,18 @@ use strict;
our $I18N = { ##hashref of hashes
'paginate after' => {
message => q|Paginate After|,
lastUpdated => 0,
context => q|an asset property|
},
'paginate after help' => {
message => q|The number of items to be displayed before breaking further items into additional pages.|,
lastUpdated => 0,
context => q|an asset property help|
},
'useContainers' => {
message => q|Use container URLs in results?|,
lastUpdated => 0,