From 2b1067d39b2e6ecda98dbbe22664298193cae1d6 Mon Sep 17 00:00:00 2001 From: Nick Clemens <nick@bywatersolutions.com> Date: Fri, 17 Sep 2021 16:18:09 +0000 Subject: [PATCH] Bug 29049: (follow-up) Reduce number of line returns in page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While moving the dropdown to a block, I noticed the page size was very large when there are many holds This patch chomps a large amoutn of whitespace, from the block and elsewhere and drecreased the paeg from about 400k lines to 25k lines for a record with ~200 holds To test: 1 - Apply previous patch 2 - Load holds tab for a biblio 3 - Save the page as html from your browser, note the size of the file 4 - Apply patch this 5 - Reload and repeat 6 - Note the size is much smaller Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> --- .../prog/en/includes/holds_table.inc | 161 ++++++++---------- 1 file changed, 71 insertions(+), 90 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index c0799f245d..8dd1fcf60f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -21,33 +21,31 @@ <th> </th> <th> </th> </tr> - - [% SET first_priority = 0 %] - [% SET last_priority = holds.last.priority %] + [%- SET first_priority = 0 -%] + [%- SET last_priority = holds.last.priority -%] [% BLOCK priority_dropdown %] - [% SET loop_priority = 1 %] - [% WHILE loop_priority <= last_priority %] - [% IF this_priority == loop_priority %] + [%- SET loop_priority = 1 -%] + [%- WHILE loop_priority <= last_priority -%] + [%- IF this_priority == loop_priority -%] <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option> - [% ELSE %] + [%- ELSE -%] <option value="[% loop_priority | html %]">[% loop_priority | html %]</option> - [% END %] - [% loop_priority = loop_priority + 1 %] - [% END %] + [%- END -%] + [%- loop_priority = loop_priority + 1- %] + [%- END -%] [% END %] - [% FOREACH hold IN holds %] - [% IF !hold.found && first_priority == 0 %] - [% first_priority = hold.priority %] - [% found_holds = loop.index() %] - [% END %] - [% IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' %] - [% this_priority = hold.priority %] - [% ELSE %] - [% this_priority = loop.count() - found_holds %] - [% END %] + [%- IF !hold.found && first_priority == 0 -%] + [%- first_priority = hold.priority -%] + [%- found_holds = loop.index() -%] + [%- END -%] + [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%] + [%- this_priority = hold.priority -%] + [%- ELSE -%] + [%- this_priority = loop.count() - found_holds -%] + [%- END -%] <tr> <td> <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> @@ -60,7 +58,6 @@ [% ELSE %] <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option> [% END %] - <option value="del">del</option> </select> [% ELSE %] @@ -80,38 +77,31 @@ </select> [% END %] </td> - - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - [% UNLESS hold.found %] - [% SET prev_priority = loop.prev.priority %] - [% SET next_priority = loop.next.priority %] - + [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%] + [%- UNLESS hold.found -%] + [%- SET prev_priority = loop.prev.priority -%] + [%- SET next_priority = loop.next.priority -%] <td style="white-space:nowrap;"> <a title="Move hold up" href="request.pl?action=move&where=up&first_priority=[% first_priority | html %]&last_priority=[% last_priority | html %]&prev_priority=[% prev_priority | html %]&next_priority=[% next_priority | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> <img src="[% interface | html %]/[% theme | html %]/img/go-up.png" alt="Go up" /> </a> - <a title="Move hold to top" href="request.pl?action=move&where=top&first_priority=[% first_priority | html %]&last_priority=[% last_priority | html %]&prev_priority=[% prev_priority | html %]&next_priority=[% next_priority | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> <img src="[% interface | html %]/[% theme | html %]/img/go-top.png" alt="Go top" /> </a> - <a title="Move hold to bottom" href="request.pl?action=move&where=bottom&first_priority=[% first_priority | html %]&last_priority=[% last_priority | html %]&prev_priority=[% prev_priority | html %]&next_priority=[% next_priority | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Go bottom" /> </a> - <a title="Move hold down" href="request.pl?action=move&where=down&first_priority=[% first_priority | html %]&last_priority=[% last_priority | html %]&prev_priority=[% prev_priority | html %]&next_priority=[% next_priority | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Go down" /> </a> </td> - [% ELSE %] + [%- ELSE -%] <td></td> - [% END %] - [% END %] - + [%- END -%] + [%- END -%] <td> [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %] </td> - <td>[% hold.notes | html | html_line_break %]</td> <td> [% IF Koha.Preference('AllowHoldDateInFuture') %] @@ -121,110 +111,101 @@ [% END %] </td> <td><input type="text" class="datepicker futuredate" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" /></td> - <td> - [% IF ( hold.found ) %] - [% IF ( hold.atdestination ) %] + [%- IF ( hold.found ) -%] + [%- IF ( hold.atdestination ) -%] Item waiting at <strong> [% hold.wbrname | html %]</strong>[% IF hold.desk_name %], [% hold.desk_name | html %],[% END %] <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> since [% hold.waiting_date | $KohaDates %] - [% ELSIF (hold.intransit) %] + [%- ELSIF (hold.intransit) -%] Item being transferred to <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> - [% ELSIF (hold.inprocessing) %] + [%- ELSIF (hold.inprocessing) -%] Item being processed at <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> - [% END %] - [% ELSE %] - [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %] + [%- END -%] + [%- ELSE -%] + [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%] [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" /> - [% ELSE %] + [%- ELSE -%] <select class="pickup_location_dropdown" data-selected="[% hold.branchcode | html %]" data-hold_id="[% hold.reserve_id | html %]" name="pickup"> <option selected="selected" value="[% hold.branchcode | html %]">[% Branches.GetName(hold.branchcode) | html %]</option> <option value="" disabled="disabled" class="loading">Loading...</option> </select> <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/> - [% END %] - [% END %] + [%- END -%] + [%- END -%] </td> - <td> - [% IF ( hold.found ) %] + [%- IF ( hold.found ) -%] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]"> - [% IF ( hold.barcodenumber ) %] - [% hold.barcodenumber | html %] + [%- IF ( hold.barcodenumber ) -%] + [%- hold.barcodenumber | html -%] <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" /> - [% ELSE %] + [%- ELSE -%] No barcode - [% END %] + [%- END -%] </a> - [% ELSE %] - [% IF ( hold.item_level_hold ) %] + [%- ELSE -%] + [%- IF ( hold.item_level_hold ) -%] <em> Only item <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]"> - [% IF ( hold.barcodenumber ) %] - [% hold.barcodenumber | html %] + [%- IF ( hold.barcodenumber ) -%] + [%- hold.barcodenumber | html -%] <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" /> - [% ELSE %] + [%- ELSE -%] No barcode - [% END %] + [%- END -%] </a> </em> - [% ELSE %] - [% IF hold.itemtype %] + [%- ELSE -%] + [%- IF hold.itemtype -%] <em>Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</em> - [% ELSE %] + [%- ELSE -%] <em>Next available</em> - [% END %] + [%- END -%] <input type="hidden" name="itemnumber" value="" /> - [% END %] - [% END %] - [% IF hold.non_priority %] + [%- END -%] + [%- END -%] + [%- IF hold.non_priority -%] <br><i>Non priority hold</i> - [% END %] + [%- END -%] </td> - - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - [% UNLESS hold.found %] + [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%] + [%- UNLESS hold.found -%] <td> <a title="Toggle lowest priority" href="request.pl?action=setLowestPriority&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> - [% IF ( hold.lowestPriority ) %] + [%- IF ( hold.lowestPriority ) -%] <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Unset lowest priority" /> - [% ELSE %] + [%- ELSE -%] <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Set to lowest priority" /> - [% END %] + [%- END -%] </a> </td> - [% ELSE %] + [%- ELSE -%] <td></td> - [% END %] - [% END %] - + [%- END -%] + [%- END -%] <td> <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> <img src="[% interface | html %]/[% theme | html %]/img/x.png" alt="Cancel" /> </a> </td> - <td> - [% IF Koha.Preference('SuspendHoldsIntranet') %] - [% UNLESS ( hold.found ) %] + [%- IF Koha.Preference('SuspendHoldsIntranet') -%] + [%- UNLESS ( hold.found ) -%] <input type="button" value="[% IF ( hold.suspend ) %]Unsuspend[% ELSE %]Suspend[% END %]" onclick="window.location.href='request.pl?action=toggleSuspend&reserve_id=[% hold.reserve_id | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&date=[% hold.date | html %]&suspend_until=' + $('#suspend_until_[% hold.reserve_id | html %]').val()" /> - - [% IF Koha.Preference('AutoResumeSuspendedHolds') %] + [%- IF Koha.Preference('AutoResumeSuspendedHolds') -%] <label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label> <input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | $KohaDates %]" class="datepicker suspend_until_datepicker" /> <a href='#' onclick="document.getElementById('suspend_until_[% hold.reserve_id | html %]').value='';">Clear date</a> - [% ELSE %] + [%- ELSE -%] <input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/> - [% END %] - [% END %] - [% END # IF SuspendHoldsIntranet %] - - [% IF ( hold.found ) %] + [%- END -%] + [%- END -%] + [%- END # IF SuspendHoldsIntranet -%] + [%- IF ( hold.found ) -%] <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&where=down&first_priority=[% first_priority | uri %]&last_priority=[% last_priority | uri %]&prev_priority=0&next_priority=1&borrowernumber=[% hold.borrowernumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]&reserve_id=[% hold.reserve_id | uri %]&date=[% hold.date | uri %]'"> - [% END %] + [%- END -%] </td> - </tr> - [% END %] </table> -- 2.20.1