Bugzilla – Attachment 68464 Details for
Bug 16759
Make OPAC holdings table configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16759: Make OPAC holdings table configurable
Bug-16759-Make-OPAC-holdings-table-configurable.patch (text/plain), 11.96 KB, created by
Nick Clemens (kidclamp)
on 2017-10-24 13:07:54 UTC
(
hide
)
Description:
Bug 16759: Make OPAC holdings table configurable
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-24 13:07:54 UTC
Size:
11.96 KB
patch
obsolete
>From 20de991fd83c749cd4460ced67edcded6a1edc3b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 28 Jul 2017 16:28:08 -0300 >Subject: [PATCH] Bug 16759: Make OPAC holdings table configurable > >This patch makes the holdings table in the OPAC biblio detail page >configurable using the Columns configuration tools. > >This patch: >- Moves the holdingst table from plain DataTable to KohaTable >- Creates a sample yml colvis configuration for this table > containing all the currently available columns > >To test: >- Visit some record's detail page in the OPAC >- Apply this patch >- Reload >=> SUCCESS: The page shows the same information >- On the staff interface, go to: > Home > Administration > Columns settings >=> SUCCESS: There's a new OPAC section containing the configuration for > holdingst. >- Choose to hide some fields (both currently displayed and currently hidden). >- Reload the OPAC detail page >=> SUCCESS: > - Required fields are hidden > - It doesn't explode because of trying to hide stuff that is not there to start with >- Sign off :-D > >Sponsored-by: DOVER > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Followed test plan, patch worked as described. Also passed QA test tool > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/columns_settings.yml | 34 +++++++++ > .../prog/en/modules/admin/columns_settings.tt | 6 ++ > .../bootstrap/en/includes/columns_settings.inc | 37 ++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 86 +++++++++++----------- > 4 files changed, 118 insertions(+), 45 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 5198c0d..ab23de9 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -255,6 +255,40 @@ modules: > cannot_be_toggled: 1 > cannot_be_modified: 1 > >+ opac: >+ biblio-detail: >+ holdingst: >+ - >+ columnname: item_itemtype >+ - >+ columnname: item_current_location >+ - >+ columnname: item_home_location >+ - >+ columnname: item_ccode >+ - >+ columnname: item_callnumber >+ - >+ columnname: item_enumchron >+ - >+ columnname: item_url >+ - >+ columnname: item_copy >+ - >+ columnname: item_status >+ - >+ columnname: item_notes >+ - >+ columnname: item_datedue >+ - >+ columnname: item_barcode >+ - >+ columnname: item_holds >+ - >+ columnname: item_priority >+ - >+ columnname: item_coursereserves >+ > reports: > lostitems: > lostitems-table: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >index 4bdaf07..884cc77 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >@@ -156,6 +156,12 @@ > [% PROCESS pagelist module=modules.members modulename="members" %] > </div> > >+ <h3><a href="#opac">OPAC</a></h3> >+ <div id="opac"> >+ <h4>OPAC tables</h4> >+ [% PROCESS pagelist module=modules.opac modulename="opac" %] >+ </div> >+ > <h3><a href="#reports">Reports</a></h3> > <div id="reports"> > <h4>Reports tables</h4> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >new file mode 100644 >index 0000000..b065a35 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >@@ -0,0 +1,37 @@ >+[% USE ColumnsSettings %] >+ >+<script type="text/javascript"> >+function KohaTable(selector, dt_parameters, columns_settings) { >+ var id = 0; >+ var hidden_ids = []; >+ var included_ids = []; >+ $(columns_settings).each( function() { >+ var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' ); >+ var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id; >+ if ( used_id == -1 ) return; >+ >+ if ( this['is_hidden'] == "1" ) { >+ hidden_ids.push( used_id ); >+ } >+ if ( this['cannot_be_toggled'] == "0" ) { >+ included_ids.push( used_id ); >+ } >+ id++; >+ }); >+ dt_parameters[ "buttons" ] = [ >+ { >+ extend: 'colvis', >+ columns: included_ids, >+ text: _("Column visibility"), >+ } >+ ]; >+ var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters)); >+ >+ $(hidden_ids).each(function(index, value) { >+ table.fnSetColumnVis( value, false ); >+ }); >+ >+ return table; >+} >+ >+</script> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 8d0fae1..528d7d2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -2,6 +2,7 @@ > [% USE Koha %] > [% USE KohaDates %] > [% USE Branches %] >+[% USE ColumnsSettings %] > [% USE AuthorisedValues %] > [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] > [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] >@@ -1179,28 +1180,34 @@ > <table class="holdingst table table-bordered table-striped"> > <thead> > <tr> >- [% IF ( item_level_itypes ) %]<th id="item_itemtype" class="itype">Item type</th>[% END %] >- [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] >- <th id="item_current_location" class="item_location">Current location</th> >- [% END %] >- [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] >- <th id="item_home_location" class="item_location">Home library</th> >- [% END %] >- [% IF ( itemdata_ccode ) %]<th id="item_ccode" class="collection">Collection</th>[% END %] >- <th id="item_callnumber" class="call_no">Call number</th> >- [% IF ( itemdata_enumchron ) %]<th id="item_enumchron" class="vol_info">Vol info</th>[% END %] >- [% IF ( itemdata_uri ) %]<th id="item_url" class="url">URL</th>[% END %] >- [% IF ( itemdata_copynumber ) %]<th id="item_copy" class="copynumber">Copy number</th>[% END %] >- <th id="item_status" class="status">Status</th> >- [% IF ( itemdata_itemnotes ) %]<th id="item_notes" class="notes">Notes</th>[% END %] >- <th id="item_datedue" class="date_due">Date due</th> >- [% IF ( OPACShowBarcode ) %]<th id="item_barcode" class="barcode">Barcode</th>[% END %] >- [% IF holds_count.defined %] >- <th id="item_holds">Item holds</th> >- [% ELSIF show_priority %] >- <th id="item_priority">Item hold queue priority</th> >- [% END %] >- [% IF ( ShowCourseReservesHeader ) %]<th id="item_coursereserves">Course reserves</th>[% END %] >+ [% IF ( item_level_itypes ) %] >+ <th id="item_itemtype" data-colname="item_itemtype" class="itype">Item type</th>[% END %] >+ [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] >+ <th id="item_current_location" data-colname="item_current_location" class="item_location">Current location</th>[% END %] >+ [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] >+ <th id="item_home_location" data-colname="item_home_location" class="item_location">Home library</th>[% END %] >+ [% IF ( itemdata_ccode ) %] >+ <th id="item_ccode" data-colname="item_ccode" class="collection">Collection</th>[% END %] >+ <th id="item_callnumber" data-colname="item_callnumber" class="call_no">Call number</th> >+ [% IF ( itemdata_enumchron ) %] >+ <th id="item_enumchron" data-colname="item_enumchron" class="vol_info">Vol info</th>[% END %] >+ [% IF ( itemdata_uri ) %] >+ <th id="item_url" data-colname="item_url" class="url">URL</th>[% END %] >+ [% IF ( itemdata_copynumber ) %] >+ <th id="item_copy" data-colname="item_copy" class="copynumber">Copy number</th>[% END %] >+ <th id="item_status" data-colname="item_status" class="status">Status</th> >+ [% IF ( itemdata_itemnotes ) %] >+ <th id="item_notes" data-colname="item_notes" class="notes">Notes</th>[% END %] >+ <th id="item_datedue" data-colname="item_datedue" class="date_due">Date due</th> >+ [% IF ( OPACShowBarcode ) %] >+ <th id="item_barcode" data-colname="item_barcode" class="barcode">Barcode</th>[% END %] >+ [% IF holds_count.defined %] >+ <th id="item_holds" data-colname="item_holds">Item holds</th> >+ [% ELSIF show_priority %] >+ <th id="item_priority" data-colname="item_priority">Item hold queue priority</th> >+ [% END %] >+ [% IF ( ShowCourseReservesHeader ) %] >+ <th id="item_coursereserves" data-colname="item_coursereserves">Course reserves</th>[% END %] > </tr> > </thead> > <tbody> >@@ -1361,6 +1368,7 @@ > > [% BLOCK jsinclude %] > [% INCLUDE 'datatables.inc' %] >+[% INCLUDE 'columns_settings.inc' %] > [% IF ( SocialNetworks ) %] > <script type="text/javascript" src="https://apis.google.com/js/plusone.js"> > //<![CDATA[ >@@ -1427,6 +1435,17 @@ > return element.html(); > } > }); >+ >+ var columns_settings = [% ColumnsSettings.GetColumns( 'opac', 'biblio-detail', 'holdingst', 'json' ) %]; >+ KohaTable(".holdingst", { >+ dom: 'B<"clearfix">t', >+ "columnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ { "sType": "title-string", "aTargets" : [ "title-string" ] } >+ ], >+ "bKohaColumnsUseNames": true >+ }, columns_settings); >+ > [% IF ( TagsInputEnabled && loggedinusername ) %] > $(".tag_add").click(function(){ > var thisid = $(this).attr("id"); >@@ -1469,29 +1488,6 @@ > [% ELSE %] > var default_order_index = 0; > [% END %] >- $(".holdingst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumns": [ >- [% IF ( item_level_itypes ) %]null,[% END %] >- [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %]null,[% END %] >- [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %]null,[% END %] >- [% IF ( itemdata_ccode ) %]null,[% END %] >- null, >- [% IF ( itemdata_enumchron ) %]null,[% END %] >- [% IF ( itemdata_uri ) %]null,[% END %] >- [% IF ( itemdata_copynumber ) %]null,[% END %] >- null, >- [% IF ( itemdata_itemnotes ) %]null,[% END %] >- { "sType": "title-string" }, >- [% IF ( OPACShowBarcode ) %]null,[% END %] >- [% IF holds_count.defined %] >- null, >- [% ELSIF show_priority %] >- null, >- [% END %] >- [% IF ( ShowCourseReservesHeader ) %]null,[% END %] >- ], >- "aaSorting": [[ default_order_index, 'asc' ]] >- })); > > [% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]"; > q_array = query_desc.split(" "); >-- >2.1.4
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 16759
:
65401
|
65512
|
65513
|
65563
|
65564
|
68342
|
68343
|
68344
|
68345
|
68346
| 68464 |
68465
|
68507
|
68528