Skip to content

Commit

Permalink
Item13735: adjust to new api in DBCachePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Sep 21, 2015
1 parent 393cfd6 commit 7abee86
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
33 changes: 18 additions & 15 deletions data/System/JQGridPlugin.txt
@@ -1,5 +1,6 @@
%META:TOPICINFO{author="micha" comment="save topic" date="1436976367" format="1.1" version="2"}%
%META:TOPICINFO{author="ProjectContributor" comment="topic" date="1436976367" format="1.1" version="1"}%
---+ %TOPIC%
%$SHORTDESCRIPTION%

%STARTSECTION{"summary"}%
jqGrid is an Ajax-enabled !JavaScript control that provides solutions for
Expand Down Expand Up @@ -160,17 +161,12 @@ Custom grid connectors must process the following parameters:

%$INSTALL_INSTRUCTIONS%

---++ Plugin Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Author(s): | Michael Daum |
| Copyright: | 2009-2015 Michael Daum http://michaeldaumconsulting.com |
| License: | GPL |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order --> |
---++ Dependencies
%$DEPENDENCIES%

---++ Change History

%TABLE{columnwidths="7em" tablewidth="100%"}%
| 17 Jul 2015: | (2.41) default to =dbcache= connector now as it is the only one really working; fixed example in docu; fixed grid resizer |
| 02 Dec 2014: | (2.40) moving from jquery.tmpl to jsrender |
| 28 Aug 2014: | (2.31) fully specify REST security |
Expand Down Expand Up @@ -204,7 +200,14 @@ Custom grid connectors must process the following parameters:
added field-specific options (title, resizable, align, width, search); \
ongoing work on colmodel |
| 26 Mar 2010: | initial release, externalized from Foswiki:Extensions/JQueryPlugin |
| Dependencies: | %$DEPENDENCIES% |
| Home: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="2009-2015 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Version" title="Version" value="%$VERSION%"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
%META:FIELD{name="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Repository" value="https://github.com/foswiki/JQGridPlugin"}%
%META:FIELD{name="Home" value="http://foswiki.org/Extensions/JQGridPlugin"}%
%META:FIELD{name="Support" value="http://foswiki.org/Support/JQGridPlugin"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/JQGridPlugin"}%
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/JQGridPlugin.pm
Expand Up @@ -16,8 +16,8 @@ package Foswiki::Plugins::JQGridPlugin;
use strict;
use warnings;

our $VERSION = '2.41';
our $RELEASE = '2.41';
our $VERSION = '2.50';
our $RELEASE = '21 Sep 2015';
our $SHORTDESCRIPTION = 'jQuery grid widget for Foswiki';
our $NO_PREFS_IN_TOPIC = 1;
our $doInit = 0;
Expand Down
14 changes: 6 additions & 8 deletions lib/Foswiki/Plugins/JQGridPlugin/DBCacheConnector.pm
Expand Up @@ -139,15 +139,14 @@ sub search {
my $db = Foswiki::Plugins::DBCachePlugin::getDB($params{web});
throw Error::Simple("can't load dbcache") unless defined $db;


my @result = ();
my @selectedColumns = split(/\s*,\s*/, $params{columns});

my $sort = $this->column2Property($params{sort});
my ($topicNames, $hits, $msg) = $db->dbQuery($params{query}, undef, $sort, $params{reverse});
return '' unless $topicNames;
my $hits = $db->dbQuery($params{query}, undef, $sort, $params{reverse});
return '' unless $hits;

my $count = scalar(@$topicNames);
my $count = $hits->count;
my $totalPages = POSIX::ceil($count / $params{rows});

my $page = $params{page};
Expand All @@ -159,11 +158,10 @@ sub search {

my $limit = $start + $params{rows};

my $index = 0;
foreach my $topic (@$topicNames) {
my $index = $hits->skip($start);
while (my $topicObj = $hits->next) {
$index++;
next if $index <= $start;
my $topicObj = $hits->{$topic};
my $topic = $topicObj->fastget("topic");
my $form = $topicObj->fastget("form");
my $fieldDef;
$form = $topicObj->fastget($form) if $form;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/JQGridPlugin/DEPENDENCIES
@@ -1,3 +1,3 @@
Foswiki::Plugins::JQueryPlugin,>6.00,perl,Required
Foswiki::Plugins::DBCachePlugin,>3.61,perl,Required
Foswiki::Plugins::DBCachePlugin,>9.00,perl,Required
Foswiki::Plugins::SolrPlugin,>1.00,perl,Optional

0 comments on commit 7abee86

Please sign in to comment.