Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
Owen Leonard e68fe2a928 Bug 25968: Make logs sort by date descending as a default
This patch adds DataTables with columns configuration to the log viewer.
The table of log entries is now sorted by default by date descending.

To test, apply the patch and go to Administration -> Table settings.

 - Expand the "Tools" section and confirm that there is a section for
   "logviewer."
 - Go to Tools -> Log viewer.
 - Perform a search which will return multiple results.
 - Confirm that the results are sorted by date descending.
 - Test that the table controls work correctly: Paging, columns, export.
 - Return to the Table settings administration page and test that
   changes to those settings are correctly reflected in the log viewer
   table.

Signed-off-by: barbara <barbara.johnson@bedfordtx.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: Fix indentation in .yml to match other entries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-07-30 17:44:27 +02:00

342 lines
18 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
Koha &rsaquo; Tools &rsaquo;
[% IF ( do_it ) %]
Logs &rsaquo; Results
[% ELSE %]
Logs
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
fieldset.rows label.viewlog {
float: none;
font-weight: normal;
margin: 0;
min-width: 9em;
padding: .5em;
text-align: left;
white-space: nowrap;
width: auto;
}
.log_modules {
display: flex;
flex-wrap: wrap;
}
</style>
</head>
<body id="tools_viewlog" class="tools">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
[% BLOCK translate_log_module %]
[% SWITCH module %]
[% CASE 'AUTH' %]Authentication
[% CASE 'CATALOGUING' %]Catalog
[% CASE 'AUTHORITIES' %]Authorities
[% CASE 'MEMBERS' %]Patrons
[% CASE 'ACQUISITIONS' %]Acquisitions
[% CASE 'SERIAL' %]Serials
[% CASE 'HOLDS' %]Holds
[% CASE 'ILL' %]Interlibrary loans
[% CASE 'CIRCULATION' %]Circulation
[% CASE 'LETTER' %]Letter
[% CASE 'FINES' %]Fines
[% CASE 'SYSTEMPREFERENCE' %]System prefs
[% CASE 'CRONJOBS' %]Cron jobs
[% CASE 'REPORTS' %]Reports
[% CASE %][% module | html %]
[% END %]
[% END %]
[% BLOCK translate_log_action %]
[% SWITCH action %]
[% CASE 'ADD' %]Add
[% CASE 'DELETE' %]Delete
[% CASE 'MODIFY' %]Modify
[% CASE 'ISSUE' %]Checkout
[% CASE 'RETURN' %]Return
[% CASE 'CREATE' %]Create
[% CASE 'CANCEL' %]Cancel
[% CASE 'RESUME' %]Resume
[% CASE 'SUSPEND' %]Suspend
[% CASE 'RENEW' %]Renew
[% CASE 'RENEWAL' %]Renew
[% CASE 'CHANGE PASS' %]Change password
[% CASE 'ADDCIRCMESSAGE' %]Add circulation message
[% CASE 'DELCIRCMESSAGE' %]Delete circulation message
[% CASE 'STATUS_CHANGE' %]Change ILL request status
[% CASE 'Run' %]Run
[% CASE %][% action | html %]
[% END %]
[% END %]
[% BLOCK translate_log_interface %]
[% SWITCH log_interface %]
[% CASE 'INTRANET' %]Intranet
[% CASE 'OPAC' %]OPAC
[% CASE 'SIP' %]SIP
[% CASE 'COMMANDLINE' %]Command-line
[% CASE 'API' %]REST API
[% CASE %][% log_interface | html %]
[% END %]
[% END %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
[% IF ( do_it ) %]
<a href="/cgi-bin/koha/tools/viewlog.pl">Logs</a> &rsaquo; Results
[% ELSE %]
Logs
[% END %]
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<h1>Browse system logs</h1>
<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
[% IF ( do_it ) %]
<input type="hidden" name="do_it" value="[% do_it | html %]" />
[% END %]
<input type="hidden" name="src" value="[% src | html %]" />
<fieldset class="rows">
<ol>
<li>
<label for="user">Librarian:</label>
<input type="text" name="user" id="user" value="[% user | html %]" />
</li>
[% UNLESS src == "circ" %]
<li>
<label for="modules">Modules:</label>
<div class="log_modules">
[% IF modules.size == 0 %]
<label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value="" checked="checked"> All</label>
[% ELSE %]
<label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
[% END %]
[% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %]
[% IF modules.grep(modx).size %]
<label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]" checked="checked"> [% PROCESS translate_log_module module=modx %]</label>
[% ELSE %]
<label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]"> [% PROCESS translate_log_module module=modx %]</label>
[% END %]
[% END %]
</div>
</li>
[% ELSE %]
<input type="hidden" name="modules" value="MEMBERS" />
<input type="hidden" name="modules" value="CIRCULATION" />
[% END %]
<li>
<label for="actions">Actions:</label>
<div class="log_modules">
[% IF actions.length == 0 %]
<label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value="" checked="checked"> All</label>
[% ELSE %]
<label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value=""> All</label>
[% END %]
[% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'CHANGE PASS' 'Run' ] %]
[% IF actions.grep(actx).size %]
<label for="action[% actx | html %]" class="viewlog"><input type="checkbox" id="action[% actx | html %]" name="actions" value="[% actx | html %]" checked="checked"> [% PROCESS translate_log_action action=actx %]</label>
[% ELSE %]
<label for="action[% actx | html %]" class="viewlog"><input type="checkbox" id="action[% actx | html %]" name="actions" value="[% actx | html %]"> [% PROCESS translate_log_action action=actx %]</label>
[% END %]
[% END %]
</div>
</li>
<li>
[% IF src == 'circ' %]
<label for="object">Borrowernumber: </label>
<input type="text" id="object" name="object" value="[% object | html %]" readonly="readonly" title="This field cannot be modified from the circulation module." />
[% ELSE %]
<label for="object">Object: </label>
<input type="text" id="object" name="object" value="[% object | html %]" />
[% END %]
</li>
<li>
<label for="info">Info:</label>
<input type="text" id="info" name="info" value="[% info | html %]" />
</li>
<li>
<label for="interfaces">Interface:</label>
[% IF interfaces.size == 0 %]
<label for="interfaceALL" class="viewlog"><input type="checkbox" id="interfaceALL" name="interfaces" value="" checked="checked"> All</label>
[% ELSE %]
<label for="interfaceALL" class="viewlog"><input type="checkbox" id="interfaceALL" name="interfaces" value=""> All</label>
[% END %]
[% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' 'API' ] %]
[% IF interfaces.grep(interf).size %]
<label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value="[% interf | html %]" checked="checked"> [% PROCESS translate_log_interface log_interface=interf %]</label>
[% ELSE %]
<label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value="[% interf | html %]"> [% PROCESS translate_log_interface log_interface=interf %]</label>
[% END %]
[% END %]
</li>
<li>
<label for="from"> Display from: </label> <input type="text" size="10" id="from" name="from" value="[% datefrom | html %]" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Display to: </label> <input size="10" id="to" name="to" type="text" value="[% dateto | html %]" class="datepickerto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Output</legend>
<ol>
<li>
<label for="screen" >To screen in the browser:</label> <input id="screen" type="radio" checked="checked" name="output" value="screen" />
</li>
<li>
<label for="file">To a file:</label>
<input id="file" type="radio" name="output" value="file" />
<label class="inline" for="basename">Named:</label>
<input type="text" name="basename" id="basename" value="Export" />
<!--
<label for="MIME" class="inline">Into an application:</label>
[% CGIextChoice | html %]
[% CGIsepChoice | html %]
-->
<input type="hidden" name="report_name" value="[% report_name | html %]" />
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<input type="hidden" name="do_it" value="1" />
</fieldset>
</form>
[% IF ( do_it ) %]
[% IF ( total ) %]
<h3>Log entries</h3>
<table id="logst">
<thead>
<tr>
<th>Date</th>
<th>Librarian</th>
<th>Module</th>
<th>Action</th>
<th>Object</th>
<th>Info</th>
<th>Interface</th>
</tr>
</thead>
<tbody>
[% FOREACH loopro IN looprow %]
<tr>
<td data-order="[% loopro.timestamp | html %]">[% loopro.timestamp | $KohaDates with_hours=1 %]</td>
<td>
[% IF loopro.librarian %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.librarian.borrowernumber | uri %]" title="display detail for this librarian."> [% IF ( loopro.librarian.firstname ) || ( loopro.librarian.surname ) %][% loopro.librarian.firstname | html %] [% loopro.librarian.surname | html %] ([% loopro.librarian.borrowernumber | html %]) [% ELSE %][% loopro.librarian.borrowernumber | html %][% END %]</a>
[% ELSE %]
[% loopro.user | html %]
[% END %]
</td>
<td>[% PROCESS translate_log_module module=loopro.module %]</td>
<td>[% PROCESS translate_log_action action=loopro.action %]</td>
<td>
[% IF ( loopro.module == 'MEMBERS' ) || ( loopro.module == 'CIRCULATION' ) || ( loopro.module == 'FINES' ) %]
[% IF loopro.patron %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.object | uri %]" title="Display member details."> [% IF ( loopro.object ) %][% IF ( loopro.patron.firstname ) || ( loopro.patron.surname ) %][% loopro.patron.firstname | html %] [% loopro.patron.surname | html %] ([% loopro.object | html %]) [% ELSE %]Member [% loopro.object | html %][% END %][% END %] </a>
[% ELSE %]
[% loopro.object | html %]
[% END %]
[% ELSE %]
[% IF ( loopro.module == 'CATALOGUING' ) %]
[% IF ( loopro.info.substr(0, 4) == 'item' ) %]
<a href="/cgi-bin/koha/catalogue/moredetail.pl?item=[% loopro.object | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.object | uri %]">Item [% loopro.object | html %]</a> from
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.biblionumber | uri %]" title="Display detail for this biblio">Biblio [% loopro.biblionumber | html %]</a>
[% ELSIF ( loopro.info.substr(0, 6) == 'biblio' ) %]
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.object | uri %]" title="Display detail for this biblio">Biblio [% loopro.object | html %]</a>
[% ELSE %]
[% loopro.object | html %]
[% END %]
[% ELSE %]
[% IF ( loopro.module == 'SERIAL' ) %]
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% loopro.object | uri %]">Subscription [% loopro.object | html %] </a>
[% ELSE %]
[% IF ( loopro.module == 'AUTHORITIES' ) %]
<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% loopro.object | uri %]" title="Display detail for this authority">Authority [% loopro.object | html %]</a>
[% ELSE %]
[% loopro.object | html %]
[% END %]
[% END %]
[% END %]
[% END %]
</td>
<td>
[% IF ( loopro.module == 'CIRCULATION' ) %]
<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a>
[% ELSE %]
[% loopro.info | html %]
[% END %]
</td>
<td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<div class="dialog alert">
No log found
[% IF ( CATALOGUING ) %]
for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% object | url %]">Bibliographic record [% object | html %]</a>
[% END %]
[% IF ( MEMBERS ) %]
for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% object | url %]">[% INCLUDE 'patron-title.inc' %]</a>
[% END %]
.
</div>
[% END %]
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% IF ( circulation ) %]
[% INCLUDE 'circ-menu.inc' %]
[% ELSE %]
[% IF ( CATALOGUING ) %]
[% INCLUDE 'biblio-view-menu.inc' %]
[% ELSE %]
[% INCLUDE 'tools-menu.inc' %]
[% END %]
[% END %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% IF ( circulation ) %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
<script>
var columns_settings = [% TablesSettings.GetColumns('tools', 'logviewer', 'logst', 'json') | $raw %];
</script>
[% Asset.js("js/viewlog.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]