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>
237 lines
13 KiB
Text
237 lines
13 KiB
Text
[% USE Asset %]
|
|
[% USE AuthorisedValues %]
|
|
[% USE ItemTypes %]
|
|
[% USE Branches %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Course reserves › Course details for [% course.course_name %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
|
|
[% Asset.css("css/datatables.css") %]
|
|
</head>
|
|
|
|
<body id="courses_course_details" class="course">
|
|
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> › Course details for <i>[% course.course_name %]</i></div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-8 col-md-offset-2">
|
|
|
|
[% IF CAN_user_coursereserves_add_reserves OR CAN_user_coursereserves_manage_courses OR CAN_user_coursereserves_manage_courses %]
|
|
<div id="toolbar">
|
|
[% IF CAN_user_coursereserves_add_reserves %]
|
|
<a class="btn btn-default btn-sm" id="add_items" href="/cgi-bin/koha/course_reserves/add_items.pl?course_id=[% course.course_id %]"><i class="fa fa-plus"></i> Add reserves</a>
|
|
[% END %]
|
|
[% IF ( CAN_user_coursereserves_manage_courses ) %]
|
|
<a class="btn btn-default btn-sm" id="edit_course" href="/cgi-bin/koha/course_reserves/course.pl?course_id=[% course.course_id %]"><i class="fa fa-pencil"></i> Edit course</a>
|
|
[% END %]
|
|
[% IF ( CAN_user_coursereserves_manage_courses ) %]
|
|
<a class="btn btn-default btn-sm" id="delete_course" href="/cgi-bin/koha/course_reserves/mod_course.pl?course_id=[% course.course_id %]&action=del"><i class="fa fa-trash"></i> Delete course</a>
|
|
[% END %]
|
|
</div><!-- /toolbar -->
|
|
[% END %]
|
|
|
|
<div class="rows">
|
|
<ol>
|
|
<li><span class="label">Course name</span> [% course.course_name %]</li>
|
|
<li><span class="label">Term</span> [% AuthorisedValues.GetByCode( 'TERM', course.term ) %]</li>
|
|
<li><span class="label">Department</span> [% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) %]</li>
|
|
<li><span class="label">Course number</span> [% course.course_number %]</li>
|
|
<li><span class="label">Section</span> [% course.section %]</li>
|
|
<li><span class="label">Instructors</span> [% FOREACH i IN course.instructors %]<div class="instructor"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber %]">[% i.firstname %] [% i.surname %]</a></div>[% END %]</li>
|
|
<li><span class="label">Staff note</span> [% course.staff_note %]</li>
|
|
<li><span class="label">Public note</span> [% course.public_note %]</li>
|
|
<li><span class="label">Student count</span> [% course.students_count %]</li>
|
|
<li><span class="label">Status</span> [% IF course.enabled == 'yes' %]Active[% ELSE %]Inactive[% END %]</li>
|
|
</ol>
|
|
</div>
|
|
|
|
[% IF course_reserves %]
|
|
<table id="course_reserves_table">
|
|
<caption>Reserves</caption>
|
|
<thead>
|
|
<tr>
|
|
<th class="antithe">Title</th>
|
|
<th>Author</th>
|
|
<th>Barcode</th>
|
|
<th>Call number</th>
|
|
[% IF item_level_itypes %]<th>Item type</th>[% END %]
|
|
<th>Collection</th>
|
|
<th>Location</th>
|
|
<th>Library</th>
|
|
<th>Staff note</th>
|
|
<th>Public note</th>
|
|
<th>Link</th>
|
|
<th class="NoSort">Other course reserves</th>
|
|
[% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
|
|
<th class="NoSort">Actions</th>
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH cr IN course_reserves %]
|
|
<tr>
|
|
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber %]">[% cr.biblio.title %]</a></td>
|
|
<td>[% cr.biblio.author %]</td>
|
|
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber %]&biblionumber=[% cr.biblio.biblionumber %]&bi=[% cr.biblioitem.biblioitemnumber %]">[% cr.item.barcode %]</a></td>
|
|
<td>[% cr.item.itemcallnumber %]</td>
|
|
[% IF item_level_itypes %]
|
|
<td>
|
|
[% IF cr.course_item.itype %]
|
|
[% IF cr.course_item.enabled == 'yes' %]
|
|
[% ItemTypes.GetDescription( cr.item.itype ) %]
|
|
[% ELSE %]
|
|
[% ItemTypes.GetDescription( cr.course_item.itype ) %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
<i>Unchanged</i>
|
|
[% IF cr.item.itype %]
|
|
([% ItemTypes.GetDescription( cr.item.itype ) %])
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
[% END %]
|
|
<td>
|
|
[% IF cr.course_item.ccode %]
|
|
[% IF cr.course_item.enabled == 'yes' %]
|
|
[% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %]
|
|
[% ELSE %]
|
|
[% AuthorisedValues.GetByCode( 'CCODE', cr.course_item.ccode ) %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
<i>Unchanged</i>
|
|
[% IF cr.item.ccode %]
|
|
([% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %])
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF cr.course_item.location %]
|
|
[% IF cr.course_item.enabled == 'yes' %]
|
|
[% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %]
|
|
[% ELSE %]
|
|
[% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
<i>Unchanged</i>
|
|
[% IF cr.item.location %]
|
|
([% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %])
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF cr.course_item.holdingbranch %]
|
|
[% IF cr.course_item.enabled == 'yes' %]
|
|
[% Branches.GetName( cr.item.holdingbranch ) %]
|
|
[% ELSE %]
|
|
[% Branches.GetName( cr.course_item.holdingbranch ) %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
<i>Unchanged</i>
|
|
[% IF cr.item.holdingbranch %]
|
|
([% Branches.GetName( cr.item.holdingbranch ) %])
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
<td>[% IF (cr.staff_note) %]
|
|
[% cr.staff_note %]
|
|
[% ELSIF (cr.item.itemnotes_nonpublic) %]
|
|
[% cr.item.itemnotes_nonpublic %]
|
|
[% END %]
|
|
</td>
|
|
<td>[% IF (cr.public_note) %]
|
|
[% cr.public_note %]
|
|
[% ELSIF (cr.item.itemnotes) %]
|
|
[% cr.item.itemnotes %]
|
|
[% END %]
|
|
</td>
|
|
|
|
<td>
|
|
[% IF (cr.item.uri) %]
|
|
<a href="[% cr.item.uri %]">Item URI</a>
|
|
[% ELSIF (cr.biblioitem.url) %]
|
|
<a href="[% cr.biblioitem.url %]">Record URL</a>
|
|
[% END %]
|
|
</td>
|
|
|
|
<td>
|
|
[% FOREACH c IN cr.courses %]
|
|
[% UNLESS cr.course_id == c.course_id %]
|
|
<p>
|
|
<a href="course-details.pl?course_id=[% c.course_id %]">
|
|
[% c.course_name %]
|
|
[% IF c.section %] [% c.section %] [% END %]
|
|
[% IF c.term %] [% AuthorisedValues.GetByCode( 'TERM', c.term ) %] [% END %]
|
|
</a>
|
|
</p>
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
|
|
[% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
|
|
<td class="actions">
|
|
[% IF CAN_user_coursereserves_add_reserves %]
|
|
<a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id %]&itemnumber=[% cr.item.itemnumber %]&action=lookup&return=[% course.course_id %]"><i class="fa fa-pencil"></i> Edit</a>
|
|
[% END %]
|
|
|
|
[% IF CAN_user_coursereserves_delete_reserves %]
|
|
[% IF cr.item.onloan %]
|
|
<a class="btn btn-default btn-xs disabled checkedout delete_item" href="#" data-toggle="tooltip" data-placement="left" title="This item is checked out">
|
|
[% ELSE %]
|
|
<a class="btn btn-default btn-xs delete_item" href="course-details.pl?course_id=[% course.course_id %]&action=del_reserve&cr_id=[% cr.cr_id %]">
|
|
[% END %]
|
|
<i class="fa fa-trash"></i> Remove</a>
|
|
[% END %]
|
|
</td>
|
|
[% END %]
|
|
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sPaginationType": "four_button",
|
|
"aoColumnDefs": [
|
|
{ 'bSortable': false, 'aTargets': [ 'NoSort' ] },
|
|
{ 'sType': "anti-the", 'aTargets' : [ 'antithe'] }
|
|
]
|
|
}));
|
|
|
|
$(".delete_item").click(function(){
|
|
return confirmDelete(_("Are you sure you want to remove this item from the course?"));
|
|
});
|
|
|
|
$("#delete_course").click(function(){
|
|
[% SET count = course_reserves.size || 0 %]
|
|
[% IF count == 1 %]
|
|
return confirmDelete(_("Are you sure you want to delete this course? There is %s attached item.").format([% count %]) );
|
|
[% ELSIF count > 1 %]
|
|
return confirmDelete(_("Are you sure you want to delete this course? There are %s attached items.").format([% count %]) );
|
|
[% ELSE %]
|
|
return confirmDelete(_("Are you sure you want to delete this course?"));
|
|
[% END %]
|
|
});
|
|
$(".disabled").tooltip().on("click", function(e){
|
|
e.preventDefault();
|
|
if( $(this).hasClass("checkedout") ){
|
|
alert(_("This item cannot be removed. It is checked out"));
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|