ed7543287b
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>
179 lines
6.3 KiB
Text
179 lines
6.3 KiB
Text
[% USE Asset %]
|
|
[% USE AuthorisedValues %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Serials › Manage new fields for subscriptions
|
|
[% IF op == "list" %] › List of fields
|
|
[% ELSIF op == "add_form" %]
|
|
[% IF field %] › Modify field
|
|
[% ELSE %] › Add field
|
|
[% END %]
|
|
[% END %]
|
|
</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") %]
|
|
</head>
|
|
|
|
<body id="ser_add_fields" class="ser">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'serials-search.inc' %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Manage new fields for subscriptions
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% IF op == 'list' %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default btn-sm" id="newfields" href="/cgi-bin/koha/serials/add_fields.pl?op=add_form"><i class="fa fa-plus"></i> New fields</a>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF messages %]
|
|
[% FOR message IN messages %]
|
|
[% IF message.code == 'insert' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">Field created.</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be created. Perhaps the name already exists?</div>
|
|
[% END %]
|
|
[% ELSIF message.code == 'update' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">Field updated.</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be updated. Perhaps the name already exists?</div>
|
|
[% END %]
|
|
[% ELSIF message.code == 'delete' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">Field deleted.</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be deleted. Check the log for errors.</div>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
<h3>Additional fields for subscriptions</h3>
|
|
[% IF fields %]
|
|
<table id="fieldst">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Authorised value category</th>
|
|
<th>Marc field</th>
|
|
<th>Searchable</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOR field IN fields %]
|
|
<tr>
|
|
<td>[% field.name %]</td>
|
|
<td>[% field.authorised_value_category %]</td>
|
|
<td>[% field.marcfield %]</td>
|
|
<td>
|
|
[% IF field.searchable %]Yes[% ELSE %]No[% END %]
|
|
</td>
|
|
<td class="actions">
|
|
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/add_fields.pl?op=add_form&field_id=[% field.id %]"><i class="fa fa-pencil"></i> Edit</a>
|
|
<a class="confirmdelete btn btn-default btn-xs" href="/cgi-bin/koha/serials/add_fields.pl?op=delete&field_id=[% field.id %]"><i class="fa fa-trash"></i> Delete</a>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
There is no field defined.
|
|
[% END %]
|
|
[% ELSIF op == 'add_form' %]
|
|
[% IF field %]
|
|
<h3>Modify field</h3>
|
|
[% ELSE %]
|
|
<h3>Add field</h3>
|
|
[% END %]
|
|
<form action="/cgi-bin/koha/serials/add_fields.pl" name="add_form" id="add_field" method="post">
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li>
|
|
<label for="name" class="required">Name: </label>
|
|
<input type="text" name="name" id="name" value="[% field.name | html %]" class="required" required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="av">Authorised value category: </label>
|
|
<select name="authorised_value_category">
|
|
<option value="">None</option>
|
|
[% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => field.authorised_value_category ) %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="marcfield">Marc field: </label>
|
|
<input type="text" name="marcfield" id="marcfield" value="[% field.marcfield| html %]" />
|
|
</li>
|
|
<li>
|
|
<label for="searchable">Searchable: </label>
|
|
[% IF field.searchable %]
|
|
<input type="checkbox" name="searchable" id="searchable" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" name="searchable" id="searchable" />
|
|
[% END %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
[% IF field %]
|
|
<input type="hidden" name="field_id" value="[% field.id %]" />
|
|
[% END %]
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="submit" value="Save" />
|
|
<a href="/cgi-bin/koha/serials/add_fields.pl" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-b">
|
|
[% INCLUDE 'serials-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE "datatables.inc" %]
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
|
|
$("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
'bAutoWidth': false,
|
|
'sDom': 't<"bottom pager"ilpf>',
|
|
'sPaginationType': 'four_button',
|
|
'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
|
|
'iDisplayLength': 20,
|
|
'aaSorting': [[ 0, "asc" ]],
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
|
]
|
|
}));
|
|
|
|
$(".confirmdelete").click(function(){
|
|
return confirm(_("Are you sure you want to delete this field?"));
|
|
});
|
|
|
|
$("#add_field").on('submit', function(){
|
|
if ( $("#marcfield").val().length > 0
|
|
&& $("select[name='authorised_value_category']" ).val().length > 0 ) {
|
|
alert("You cannot select an authorised value category and a marcfield");
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|