Koha/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt
Julian Maurice ed7543287b Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
Having to write [% KOHA_VERSION %] for each url is bad because:
- It's easily forgettable when adding new <script> or <link>
- It prevents grep'ing for the full filename
- It violates the DRY principle
- If at some point we want to change the "force js and css reload"
  mechanism, it will be tedious

This patch:
- adds a Template::Toolkit plugin that generates <script> and
  <link> tags for JS and CSS files, and inserts automatically the Koha
  version in the filename
- use the new plugin to remove all occurences of [% KOHA_VERSION %]
- remove the code that was adding KOHA_VERSION as a template variable

Test plan:
1. Apply patch
2. Go to several different pages in Koha (opac and intranet) while
   checking your browser's dev tools (there should be no 404 for JS and
   CSS files, and the Koha version should appear in filenames) and the
   server logs (there should be no "File not found")
3. `git grep KOHA_VERSION` should return nothing
4. prove t/db_dependent/Koha/Template/Plugin/Asset.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-13 11:49:44 -03:00

129 lines
5.8 KiB
Text

[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections &rsaquo; Collection [% colTitle %] &rsquo; Add or remove items</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="rcoll_addItems" class="tools rcoll">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<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; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/addItems.pl?colId=[% colId %]">Collection <i>[% colTitle %]</i></a> &rsaquo; Add or remove items</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( ! colId ) %]
<div class="dialog message">
<p>Invalid collection id</p>
<p><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Return to rotating collections home</a></p>
</div>
[% ELSE %]
[% INCLUDE 'rotating-collections-toolbar.inc' %]
<h1>Collection <i>[% colTitle %]</i></h1>
[% IF ( previousActionAdd ) %]
[% IF ( addSuccess ) %]
<div class="dialog message">Item with barcode '[% barcode %]' added successfully</div>
[% ELSE %]
<div class="dialog alert">
<p>Failed to add item with barcode <i>[% barcode %]</i>:
<p>
[% IF failureMessage == "NO_ITEM" %]
No item with matching barcode found
[% ELSIF failureMessage == "IN_COLLECTION_OTHER" %]
Item is already in a different rotating collection
[% ELSIF failureMessage == "IN_COLLECTION" %]
Item is already in this collection
[% ELSE %]
[% failureMessage %]
[% END %]
</p>
</div>
[% END %]
[% END %]
[% IF ( previousActionRemove ) %]
[% IF ( removeSuccess ) %]
<div class="dialog message">Item with barcode <i>[% barcode %]</i> removed successfully</div>
[% ELSE %]
<div class="dialog alert">
Failed to remove item with barcode <i>[% barcode %]</i>:
<p>
[% IF failureMessage == "NO_ITEM" %]
No item with matching barcode found
[% ELSIF failureMessage == "NOT_IN_COLLECTION" %]
Item is not in this collection
[% ELSE %]
[% failureMessage %]
[% END %]
</p>
</div>
[% END %]
[% END %]
<div>
<form action="addItems.pl" method="post">
<fieldset class="brief">
<legend>Add or remove items</legend>
<ol>
<li>
<label for="barcode">Barcode: </label>
<input type="text" id="barcode" name="barcode" />
[% IF ( removeChecked ) %]
<label class="inline"><input type="checkbox" name="removeItem" checked="checked" /> Remove item from collection</label>
[% ELSE %]
<label class="inline"><input type="checkbox" name="removeItem" /> Remove item from collection</label>
[% END %]
</li>
</ol>
<p>
<input type="hidden" id="colId" name="colId" value="[% colId %]" />
<input type="hidden" name="action" value="addItem" />
<input type="submit" value="Submit" />
</p>
</fieldset>
</form>
</div>
<div>
<h2>Items in <i>[% colTitle %]</i></h2>
[% IF ( collectionItemsLoop ) %]
<table>
<tr>
<th>Title</th>
<th>Call number</th>
<th>Barcode</th>
<th>&nbsp;</th>
</tr>
[% FOREACH collectionItemsLoo IN collectionItemsLoop %]
<tr>
<td>[% INCLUDE 'biblio-default-view.inc' biblionumber = collectionItemsLoo.biblionumber %][% collectionItemsLoo.title |html %]</a></td>
<td>[% collectionItemsLoo.itemcallnumber %]</td>
<td>[% collectionItemsLoo.barcode %]</td>
<td><a href="/cgi-bin/koha/rotating_collections/addItems.pl?colId=[% colId %]&amp;barcode=[% collectionItemsLoo.barcode %]&amp;removeItem=1&amp;action=addItem">Remove</a></td>
</tr>
[% END %]
</table>
[% ELSE %]
<div class="dialog message">There are no items in this collection.</div>
[% END %]
</div>
[% END %]
</div> <!-- /.yui-b -->
</div> <!-- /#yui-main -->
<div class="yui-b">
[% INCLUDE 'tools-menu.inc' %]
</div>
</div> <!-- /#bd -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") %]
[% Asset.js("js/rotating-collections.js") %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]