WebGUI 2.4.0 release
This commit is contained in:
parent
2a61818564
commit
6286f9bfaf
74 changed files with 2332 additions and 548 deletions
|
|
@ -14,11 +14,24 @@ use CGI;
|
|||
use Exporter;
|
||||
use FileHandle;
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&randint &getNextId &saveAttachment &round &urlize "e);
|
||||
our @EXPORT = qw(&paginate &appendToUrl &randint &getNextId &saveAttachment &round &urlize "e);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub appendToUrl {
|
||||
my ($url);
|
||||
$url = $_[0];
|
||||
if ($url =~ /\?/) {
|
||||
$url .= '&'.$_[1];
|
||||
} else {
|
||||
$url .= '?'.$_[1];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getNextId {
|
||||
|
|
@ -28,6 +41,36 @@ sub getNextId {
|
|||
return $id;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub paginate {
|
||||
my ($pn, $i, $dataRows, $prevNextBar, $itemsPerPage, @row, $url);
|
||||
$itemsPerPage = $_[0];
|
||||
$url = $_[1];
|
||||
@row = @{$_[2]};
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$dataRows .= $row[$i];
|
||||
}
|
||||
$prevNextBar = '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$prevNextBar .= '<a href="'.appendToUrl($url,('pn='.($pn-1))).'">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$prevNextBar .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$prevNextBar .= ' · ';
|
||||
if (($pn+1) < (($#row+1)/$itemsPerPage)) {
|
||||
$prevNextBar .= '<a href="'.appendToUrl($url,('pn='.($pn+1))).'">'.WebGUI::International::get(92).'»</a>';
|
||||
} else {
|
||||
$prevNextBar .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$prevNextBar .= '</div>';
|
||||
return ($dataRows, $prevNextBar);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# This is here simply to make typing shorter, cuz I'm lazy.
|
||||
sub quote {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue