Owen Leonard
e180c568af
This patch alters the header and footer include files so that JavaScript can be included in either one or the other. As a proof of concept, the staff client home page is updated to include JS in the footer instead of the header. The processing of JavaScript included on individual pages can now be similar to how it is done in the OPAC. A block is created with the page's JavaScript which is then processed in js_includes.inc in the correct order, after other required js assets. On pages which have been modified to allow JavaScript to be moved to the footer you must add a variable to the template: [% SET footerjs = 1 %]. Eventually all staff client templates should be modified so that setting a flag is not required. "[% MACRO jsinclude BLOCK %]" is used instead of "[% BLOCK %]" and "[% PROCESS %]" because MACRO allows the template directives to be processed correctly when included by intranet-bottom.inc. To test, apply the patch and view the staff client home page. - Confirm that you get a confirmation when deleting a news item from the home page. - Enable the CircAutocompl system preference and test that patron autocomplete works from the "Check out" tab from the staff home page and from other pages where the "Check out" tab is present. - Test that JavaScript is working correctly on other pages like Circulation, Preferences, etc. Signed-off-by: Claire Gravely <claire_gravely@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
110 lines
4.7 KiB
HTML
110 lines
4.7 KiB
HTML
[% USE AudioAlerts %]
|
|
[%# Prevent XFS attacks -%]
|
|
[% UNLESS popup %]
|
|
<script type="text/javascript">
|
|
if (self === top) {
|
|
var antiClickjack = document.getElementById("antiClickjack");
|
|
antiClickjack.parentNode.removeChild(antiClickjack);
|
|
} else {
|
|
top.location = self.location;
|
|
}
|
|
</script>
|
|
[% END %]
|
|
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-migrate-1.3.0.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
|
|
<!-- koha core js -->
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
|
|
|
|
[% INCLUDE 'validator-strings.inc' %]
|
|
[% PROCESS 'html_helpers.inc' %]
|
|
[% IF ( IntranetUserJS ) %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
[% IntranetUserJS %]
|
|
//]]>
|
|
</script>
|
|
[% END %]
|
|
|
|
[% IF ( virtualshelves || intranetbookbag ) %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var MSG_BASKET_EMPTY = _("Your cart is currently empty");
|
|
var MSG_RECORD_IN_BASKET = _("This item is already in your cart");
|
|
var MSG_RECORD_ADDED = _("This item has been added to your cart");
|
|
var MSG_NRECORDS_ADDED = _("%s item(s) added to your cart");
|
|
var MSG_NRECORDS_IN_BASKET = _("%s already in your cart");
|
|
var MSG_NO_RECORD_SELECTED = _("No item was selected");
|
|
var MSG_NO_RECORD_ADDED = _("No item was added to your cart (already in your cart)!");
|
|
var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?");
|
|
var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
|
|
var MSG_IN_YOUR_CART = _("Items in your cart: %s");
|
|
var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
|
|
var MSG_ITEM_NOT_IN_CART = _("Add to cart");
|
|
var MSG_ITEM_IN_CART = _("In your cart");
|
|
var MSG_RECORD_REMOVED = _("The item has been removed from your cart");
|
|
//]]>
|
|
</script>
|
|
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/basket.js"></script>
|
|
[% END %]
|
|
|
|
[% IF LocalCoverImages %]
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/localcovers.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var NO_LOCAL_JACKET = _("No cover image available");
|
|
//]]>
|
|
</script>
|
|
[% END %]
|
|
|
|
[% IF Koha.Preference('AudioAlerts') || AudioAlertsPage %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var AUDIO_ALERT_PATH = '[% interface %]/[% theme %]/sound/';
|
|
var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) %]' );
|
|
//]]>
|
|
|
|
$( document ).ready(function() {
|
|
if ( AUDIO_ALERTS ) {
|
|
for ( var k in AUDIO_ALERTS ) {
|
|
var alert = AUDIO_ALERTS[k];
|
|
if ( $( alert.selector ).length ) {
|
|
playSound( alert.sound );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
|
|
[% IF ( CircAutocompl ) %]
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$( "#findborrower" ).autocomplete({
|
|
source: "/cgi-bin/koha/circ/ysearch.pl",
|
|
minLength: 3,
|
|
select: function( event, ui ) {
|
|
$( "#findborrower" ).val( ui.item.cardnumber );
|
|
$("#patronsearch").submit();
|
|
return false;
|
|
}
|
|
})
|
|
.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
|
|
return $( "<li></li>" )
|
|
.data( "ui-autocomplete-item", item )
|
|
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
|
|
.appendTo( ul );
|
|
};
|
|
});
|
|
</script>
|
|
[% END %]
|
|
[% END %]
|