* added "random" sorting method, and "Random 100" to
tab bar. * add "name" and "id" attribute to the text input box in the header, it wasn't working because it was missing. * removed the search header from the search results page. * fixed navigation buttons (next, prev)... they were missing the search string, pressing "next" or "prev" on a search aborted the search.
This commit is contained in:
29
kwotes.pl
29
kwotes.pl
@ -103,8 +103,14 @@ if ($action eq "add") {
|
||||
} elsif ($action eq "list") {
|
||||
|
||||
# what are we sorting on
|
||||
my $sort = ($FORM{"o"} eq "date") ?
|
||||
"submit_dt" : ( ($FORM{"o"} eq "rating") ? "rating" : undef);
|
||||
my $sort = undef;
|
||||
if ($FORM{"o"} eq "date") {
|
||||
$sort = "submit_dt";
|
||||
} elsif ($FORM{"o"} eq "rating") {
|
||||
$sort = "rating";
|
||||
} elsif ($FORM{"o"} eq "random") {
|
||||
$sort = "RAND()";
|
||||
}
|
||||
|
||||
# get start index
|
||||
my $start_index = (defined($FORM{"s"})) ? $FORM{"s"} : 0;
|
||||
@ -126,17 +132,18 @@ if ($action eq "add") {
|
||||
my @rows = list_kwotes($dbh, $sort, $sort_order, $max_returned, $start_index, $search_string);
|
||||
|
||||
# setup these vars
|
||||
$vars{TITLE} = "Kwotes";
|
||||
$vars{ORDER} = $FORM{"o"};
|
||||
$vars{NEXT_INDEX} = $start_index+$max_returned;
|
||||
$vars{MAX_RETURN} = $max_returned;
|
||||
$vars{LAST_INDEX} = $start_index-$max_returned;
|
||||
$vars{MAX_RECORDS} = $max_records;
|
||||
$vars{TITLE} = "Kwotes";
|
||||
$vars{ORDER} = $FORM{"o"};
|
||||
$vars{NEXT_INDEX} = $start_index+$max_returned;
|
||||
$vars{MAX_RETURN} = $max_returned;
|
||||
$vars{LAST_INDEX} = $start_index-$max_returned;
|
||||
$vars{MAX_RECORDS} = $max_records;
|
||||
$vars{SEARCH_STRING} = $search_string;
|
||||
|
||||
# add the search header if it was a search
|
||||
if (defined($search_string)) {
|
||||
$main_content .= wrap_template("html/content-search.html", %vars);
|
||||
}
|
||||
#if (defined($search_string)) {
|
||||
# $main_content .= wrap_template("html/content-search.html", %vars);
|
||||
#}
|
||||
|
||||
# get the navigation template
|
||||
my $navigation_template = undef;
|
||||
|
Reference in New Issue
Block a user