Bugzilla – Attachment 161802 Details for
Bug 35972
Add a 'Research tables' feature, that builds upon Course reserves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35972: Add thesis tables feature
Bug-35972-Add-thesis-tables-feature.patch (text/plain), 16.92 KB, created by
Martin Renvoize (ashimema)
on 2024-02-07 13:46:09 UTC
(
hide
)
Description:
Bug 35972: Add thesis tables feature
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-02-07 13:46:09 UTC
Size:
16.92 KB
patch
obsolete
>From d7da81123c30b170e9634cef9f171561986146d5 Mon Sep 17 00:00:00 2001 >From: Kris Sinnaeve <kris.sinnaeve@etf.edu> >Date: Tue, 14 Sep 2021 11:39:40 +0100 >Subject: [PATCH] Bug 35972: Add thesis tables feature > >This patch adds a new 'Thesis tables' feature to Koha based on the >existing 'Course reserves' system. >--- > C4/CourseReserves.pm | 18 ++- > .../bootstrap/en/includes/masthead.inc | 3 + > .../en/modules/opac-thesis-table-details.tt | 127 ++++++++++++++++++ > .../en/modules/opac-thesis-tables.tt | 86 ++++++++++++ > opac/opac-thesis-table-details.pl | 54 ++++++++ > opac/opac-thesis-tables.pl | 44 ++++++ > 6 files changed, 331 insertions(+), 1 deletion(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt > create mode 100755 opac/opac-thesis-table-details.pl > create mode 100755 opac/opac-thesis-tables.pl > >diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm >index fac8b849e21..b9f33ba0c62 100644 >--- a/C4/CourseReserves.pm >+++ b/C4/CourseReserves.pm >@@ -1004,7 +1004,7 @@ sub CountCourseReservesForItem { > > =head2 SearchCourses > >- my $courses = SearchCourses( term => $search_term, enabled => 'yes' ); >+ my $courses = SearchCourses( term => $search_term, enabled => 'yes', thesis_table => 'no' ); > > =cut > >@@ -1014,6 +1014,7 @@ sub SearchCourses { > my $term = $params{'term'}; > > my $enabled = $params{'enabled'} || '%'; >+ my $thesis_table = $params{'thesis_table'} || 'no'; > > my @params; > my $query = " >@@ -1042,6 +1043,21 @@ sub SearchCourses { > ) > AND > c.enabled LIKE ? >+ "; >+ >+ if ( $thesis_table eq 'no' ) { >+ $query .= " >+ AND >+ c.department != 'TT' >+ "; >+ } else { >+ $query .= " >+ AND >+ c.department = 'TT' >+ "; >+ } >+ >+ $query .= " > GROUP BY c.course_id, c.department, c.course_number, c.section, c.course_name, c.term, c.staff_note, c.public_note, c.students_count, c.enabled, c.timestamp > "; > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 670c15fc508..fecd7d2fe59 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -320,6 +320,9 @@ > <li class="nav-item"> > <a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a> > </li> >+ <li class="nav-item"> >+ <a href="/cgi-bin/koha/opac-thesis-tables.pl">Research tables</a> >+ </li> > [% END %] > [% IF Koha.Preference( 'OpacBrowser' ) == 1 %] > <li class="nav-item"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt >new file mode 100644 >index 00000000000..c8b84d1caca >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt >@@ -0,0 +1,127 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE AuthorisedValues %] >+[% USE ItemTypes %] >+[% USE Branches %] >+[% USE TablesSettings %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Reserves for [% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %] >+ [% Asset.css("css/datatables.css") | $raw %] >+[% END %] >+ >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-course-details' %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <nav aria-label="breadcrumb"> >+ <ul class="breadcrumb"> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-main.pl">Home</a> >+ </li> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-thesis-tables.pl">Research tables</a> >+ </li> >+ <li class="breadcrumb-item" aria-current="page"> >+ Reserves for <em>[% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</em> >+ </li> >+ </ul> >+ </nav> >+ >+ <div class="container-fluid"> >+ <div class="row"> >+ <div class="col"> >+ <div id="thesis_tables" class="maincontent"> >+ >+ <h2>Reserves for <em>[% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</em></h2> >+ <div class="rows"> >+ <ol> >+ [% IF ( course.instructors ) %] >+ <li><span class="label">Researcher:</span> >+ <ul> >+ [% FOREACH i IN course.instructors %] >+ <li><div class="instructor">[% i.firstname | html %] [% i.surname | html %]</div></li> >+ [% END %] >+ </ul> >+ </li> >+ [% END %] >+ [% IF ( course.public_note ) %]<li><span class="label">Notes:</span> [% course.public_note | $raw %]</li>[% END %] >+ </ol> >+ </div> >+ >+ [% IF ( course_reserves ) %] >+ <table id="thesis-table-items-table" class="table table-bordered table-striped table-condensed"> >+ <thead> >+ <tr> >+ <th class="anti-the">Title</th> >+ <th>Author</th> >+ <th>Item type</th> >+ <th>Location</th> >+ <th>Collection</th> >+ <th>Call number</th> >+ <th>Copy number</th> >+ <th>Status</th> >+ <th class="title-string">Date due</th> >+ <th>Notes</th> >+ <th>Link</th> >+ </tr> >+ </thead> >+ >+ <tbody> >+ [% FOREACH cr IN course_reserves %] >+ <tr> >+ <td><a href="opac-detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title-head.inc' biblio=cr.biblio %]</a></td> >+ <td>[% cr.biblio.author | html %]</td> >+ <td>[% ItemTypes.GetDescription( cr.item.itype ) | html %]</td> >+ <td>[% Branches.GetName( cr.item.holdingbranch ) | html %] <br/> <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => cr.item.location, opac => 1 ) | html %]</em></td> >+ <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode, opac => 1 ) | html %]</td> >+ <td>[% cr.item.itemcallnumber | html %]</td> >+ <td>[% cr.item.copynumber | html %]</td> >+ <td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td> >+ <td><span title="[% cr.issue.date_due | html %]">[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</span></td> >+ <td>[% IF ( cr.public_note ) %] >+ [% cr.public_note | $raw %] >+ [% ELSIF ( cr.item.itemnotes ) %] >+ [% cr.item.itemnotes | $raw %] >+ [% END %] >+ </td> >+ <td>[% IF (cr.item.uri) %] >+ <a href="[% cr.item.uri | url %]">Item URI</a> >+ [% ELSIF (cr.biblioitem.url) %] >+ <a href="[% cr.biblioitem.url | url %]">Record URL</a> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <br style="clear:both;" /> >+ <div class="alert alert-info"> >+ <p>No reserves have been selected for this research table.</p> >+ </div> >+ [% END %] >+ </div> <!-- / #course_reserves --> >+ </div> <!-- / .col --> >+ </div> <!-- / .row --> >+ </div> <!-- / .container-fluid --> >+</div> <!-- / .main --> >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %] >+ [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'columns_settings.inc' %] >+ <script> >+ $(document).ready(function() { >+ columns_settings = [% TablesSettings.GetColumns( 'opac', 'biblio-detail', 'thesis-table-items-table', 'json' ) | $raw %]; >+ KohaTable("#thesis-table-items-table", { >+ "dom": '<"top"f>rt<"clear">', >+ "sorting": [[ 1, "asc" ]], >+ "autoWidth": false, >+ }, columns_settings ); >+ }); >+ </script> >+[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt >new file mode 100644 >index 00000000000..a20e67612b8 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt >@@ -0,0 +1,86 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE AuthorisedValues %] >+[% USE TablesSettings %] >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Research tables</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %] >+ [% Asset.css("css/datatables.css") | $raw %] >+[% END %] >+ >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-thesis-tables' %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <nav aria-label="breadcrumb"> >+ <ul class="breadcrumb"> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-main.pl">Home</a> >+ </li> >+ <li class="breadcrumb-item" aria-current="page"> >+ <a href="#">Research tables</a> >+ </li> >+ </ul> >+ </nav> >+ >+ <div class="container-fluid"> >+ <div class="row"> >+ <div class="col order-first order-md-first order-lg-2"> >+ <div id="courses" class="maincontent"> >+ <h1>Research tables</h1> >+ >+ <table id="thesis_tables_table" class="table table-bordered table-striped table-condensed"> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th>Table #</th> >+ <th>Researcher</th> >+ <th>Topic</th> >+ </tr> >+ </thead> >+ >+ <tbody> >+ [% FOREACH c IN courses %] >+ <tr> >+ <td><a href="opac-thesis-table-details.pl?table_id=[% c.course_id | uri %]">[% c.course_name | html %][%- IF c.section -%] - [% c.section | html %][%- END -%]</a></td> >+ <td>[% c.course_number | html %]</td> >+ <td> >+ [% FOREACH i IN c.instructors %] >+ <div class="instructor"><span class="inst_surname">[% i.surname | html %]</span>[% IF i.firstname %]<span class="instr_separator">, </span><span class="instr_firstname">[% i.firstname | html %]</span>[% END %]</div> >+ [% END %] >+ </td> >+ <td>[% c.public_note | $raw %]</td> >+ [% END %] >+ </tbody> >+ </table> >+ </div> <!-- / #courses --> >+ </div> <!-- / .col --> >+ </div> <!-- / .row --> >+ </div> <!-- / .container-fluid --> >+</div> <!-- / .main --> >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %] >+ [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'columns_settings.inc' %] >+ <script> >+ $(document).ready(function() { >+ columns_settings = [% TablesSettings.GetColumns( 'opac', 'biblio-detail', 'thesis_tables_table', 'json' ) | $raw %] >+ KohaTable("#thesis_tables_table", { >+ "dom": '<"top"f>rt<"clear">', >+ "sorting": [[ 1, "asc" ]], >+ "autoWidth": false, >+ "asColumnDefs": [ >+ { "aTargets": [ 1 ], "sType": "nsb-nse" }, >+ ], >+ "language": { >+ "search": "_INPUT_", >+ "searchPlaceholder": "Search courses" >+ } >+ }, columns_settings ); >+ }); >+ </script> >+[% END %] >diff --git a/opac/opac-thesis-table-details.pl b/opac/opac-thesis-table-details.pl >new file mode 100755 >index 00000000000..fd82176d1c7 >--- /dev/null >+++ b/opac/opac-thesis-table-details.pl >@@ -0,0 +1,54 @@ >+#!/usr/bin/perl >+ >+# >+# Copyright 2012 Bywater Solutions >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+use C4::Koha; >+ >+use C4::CourseReserves qw(GetCourse GetCourseReserves); >+ >+my $cgi = CGI->new; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { template_name => "opac-thesis-table-details.tt", >+ query => $cgi, >+ type => "opac", >+ authnotrequired => 1, >+ debug => 1, >+ } >+); >+ >+my $table_id = $cgi->param('table_id'); >+ >+die("No table_id given") unless ($table_id); >+ >+my $course = GetCourse($table_id); >+my $course_reserves = GetCourseReserves( course_id => $table_id, include_items => 1, include_count => 1 ); >+ >+$template->param( >+ course => $course, >+ course_reserves => $course_reserves, >+); >+ >+output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/opac/opac-thesis-tables.pl b/opac/opac-thesis-tables.pl >new file mode 100755 >index 00000000000..32321cd4c12 >--- /dev/null >+++ b/opac/opac-thesis-tables.pl >@@ -0,0 +1,44 @@ >+#!/usr/bin/perl >+ >+# >+# Copyright 2012 Bywater Solutions >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+ >+use C4::CourseReserves qw(SearchCourses); >+ >+my $cgi = CGI->new; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { template_name => "opac-thesis-tables.tt", >+ query => $cgi, >+ type => "opac", >+ authnotrequired => 1, >+ debug => 1, >+ } >+); >+ >+my $courses = SearchCourses( enabled => 'yes', thesis_table => 'yes' ); >+ >+$template->param( courses => $courses ); >+output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.43.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 35972
:
161714
| 161802 |
161803