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>
104 lines
4.2 KiB
Text
104 lines
4.2 KiB
Text
[% USE Asset %]
|
|
[% USE KohaDates %]
|
|
[% USE AuthorisedValues %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Files for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="pat_files" class="pat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Files for [% INCLUDE 'patron-title.inc' %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'members-toolbar.inc' %]
|
|
|
|
<h1>Files</h1>
|
|
|
|
[% IF errors %]
|
|
<div class="dialog alert">
|
|
[% IF errors.empty_upload %]The file you are attempting to upload has no contents.[% END %]
|
|
[% IF errors.no_file %]You did not select a file to upload.[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( files ) %]
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
<th>Uploaded</th>
|
|
[% IF CAN_user_borrowers_edit_borrowers %]<th> </th>[% END %]
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH f IN files %]
|
|
<tr>
|
|
<td><a href="?borrowernumber=[% borrowernumber %]&op=download&file_id=[% f.file_id %]">[% f.file_name %]</a></td>
|
|
<td>[% f.file_type %]</td>
|
|
<td>[% f.file_description %]</td>
|
|
<td>[% f.date_uploaded | $KohaDates %]</td>
|
|
[% IF CAN_user_borrowers_edit_borrowers %]<td><a class="btn btn-default btn-xs confirmdelete" href="?borrowernumber=[% borrowernumber %]&op=delete&file_id=[% f.file_id %]"><i class="fa fa-trash"></i> Delete</a></td>[% END %]
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
<p>This patron has no files attached.</p>
|
|
</div>
|
|
[% END %]
|
|
|
|
<form method="post" action="/cgi-bin/koha/members/files.pl" enctype="multipart/form-data">
|
|
<fieldset class="rows">
|
|
<legend>Upload New File</legend>
|
|
<ol>
|
|
<li><input type="hidden" name="op" value="upload" />
|
|
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
|
|
|
|
<label for="description">Description:</label>
|
|
<input name="description" id="description" type="text" /></li>
|
|
|
|
<li><label for="uploadfile">File:</label><input name="uploadfile" type="file" id="uploadfile" /></li>
|
|
|
|
</ol>
|
|
<fieldset class="action"><input name="upload" type="submit" id="upload" value="Upload File" /></fieldset>
|
|
</fieldset>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-b">
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/members-menu.js") %]
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$(".confirmdelete").on("click", function(){
|
|
$(this).parents('tr').addClass("warn");
|
|
if(confirm(_("Are you sure you want to delete this file?"))){
|
|
return true;
|
|
} else {
|
|
$(this).parents('tr').removeClass("warn");
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|