Bugzilla – Attachment 38327 Details for
Bug 14042
The authority type admin page manage its own pagination
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14042: Get rid of the home made pagination in the auth type admin
Bug-14042-Get-rid-of-the-home-made-pagination-in-t.patch (text/plain), 4.65 KB, created by
Jonathan Druart
on 2015-04-22 12:01:06 UTC
(
hide
)
Description:
Bug 14042: Get rid of the home made pagination in the auth type admin
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-04-22 12:01:06 UTC
Size:
4.65 KB
patch
obsolete
>From 87e311b6484ce5a8482f88139f7352dc10329bc7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 22 Apr 2015 13:56:28 +0200 >Subject: [PATCH] Bug 14042: Get rid of the home made pagination in the auth > type admin > >This patch removes the home made pagination and introduces datatables on >this page. > >Test plan: >Go to the authority type admin page and confirm there is a beautiful >table. >--- > admin/authtypes.pl | 32 ++++++---------------- > .../prog/en/modules/admin/authtypes.tt | 24 ++++++++++++---- > 2 files changed, 27 insertions(+), 29 deletions(-) > >diff --git a/admin/authtypes.pl b/admin/authtypes.pl >index 3a3efed..23e9d29 100755 >--- a/admin/authtypes.pl >+++ b/admin/authtypes.pl >@@ -26,18 +26,20 @@ use C4::Auth; > use C4::Output; > > sub StringSearch { >- my $sth = C4::Context->dbh->prepare("SELECT * FROM auth_types WHERE (authtypecode like ?) ORDER BY authtypecode"); >- $sth->execute((shift || '') . "%"); >- return $sth->fetchall_arrayref({}); >+ my $string = shift || ''; >+ my $dbh = C4::Context->dbh; >+ return $dbh->selectall_arrayref(q| >+ SELECT authtypecode, authtypetext, auth_tag_to_report, summary >+ FROM auth_types >+ WHERE (authtypecode like ?) ORDER BY authtypecode >+ |, { Slice => {} }, $string . "%" ); > } > > my $input = new CGI; > my $script_name = "/cgi-bin/koha/admin/authtypes.pl"; > my $searchfield = $input->param('authtypecode'); # FIXME: Auth Type search not really implemented > my $authtypecode = $input->param('authtypecode'); >-my $offset = $input->param('offset') || 0; > my $op = $input->param('op') || ''; >-my $pagesize = 20; > my ($template, $borrowernumber, $cookie) > = get_template_and_user({template_name => "admin/authtypes.tt", > query => $input, >@@ -108,24 +110,6 @@ if ($op eq 'add_form') { > ################## DEFAULT ################################## > } else { # DEFAULT > my $results = StringSearch($searchfield); >- my $count = scalar @$results; >- my @loop_data; >- for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ >- push @loop_data, { >- authtypecode => $results->[$i]{'authtypecode'}, >- authtypetext => $results->[$i]{'authtypetext'}, >- auth_tag_to_report => $results->[$i]{'auth_tag_to_report'}, >- summary => $results->[$i]{'summary'}, >- }; >- } >- $template->param(loop => \@loop_data); >- if ($offset>0) { >- my $prevpage = $offset-$pagesize; >- $template->param(previous => "$script_name?offset=".$prevpage); >- } >- if ($offset+$pagesize<$count) { >- my $nextpage = $offset+$pagesize; >- $template->param(next => "$script_name?offset=".$nextpage); >- } >+ $template->param( loop => $results ); > } #---- END $OP eq DEFAULT > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >index 4815d69..40238a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >@@ -7,6 +7,20 @@ > [% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] >+<script type="text/javascript"> >+//<![CDATA[ >+ $(document).ready(function() { >+ $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ }); >+//]]> >+</script> > </head> > > <body id="admin_authtypes" class="admin"> >@@ -96,7 +110,8 @@ > > <h1>Authority types</h1> > <p>Define authority types, then authority MARC structure in the same way you define itemtypes and biblio MARC tag structure. Authority values are managed through plugins</p> >-<table> >+<table id="authtypes"> >+ <thead> > <tr> > <th>Code</th> > <th>Description</th> >@@ -106,7 +121,8 @@ > <th>Edit</th> > <th>Delete</th> > </tr> >- >+ </thead> >+ <tbody> > [% FOREACH loo IN loop %] > <tr> > <td>[% loo.authtypecode %]</td> >@@ -118,11 +134,9 @@ > <td><a href="[% loo.script_name %]?op=delete_confirm&authtypecode=[% loo.authtypecode |html %]">Delete</a></td> > </tr> > [% END %] >+ <tbody> > </table> > >- [% IF ( previous ) %]<p><a href="[% previous %]"><< Previous</a></p>[% END %] >- [% IF ( next ) %]<p><a href="[% next %]">Next >></a></p>[% END %] >- > [% END %] > </div> > </div> >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14042
:
38327
|
38338
|
38376