-<script src="[% interface %]/lib/codemirror/codemirror-compressed.js"></script>
-<script src="[% interface %]/lib/filesaver.js"></script>
-<script src="[% interface %]/lib/koha/cateditor/marc-mode.js"></script>
-<script src="[% interface %]/lib/require.js"></script>
+[% Asset.js("lib/codemirror/codemirror-compressed.js") %]
+[% Asset.js("lib/filesaver.js") %]
+[% Asset.js("lib/koha/cateditor/marc-mode.js") %]
+[% Asset.js("lib/require.js") %]
<script>
+ var authInfo = {
+ [%- FOREACH authtag = authtags -%]
+ [% authtag.tagfield %]: {
+ subfield: '[% authtag.tagsubfield %]',
+ authtypecode: '[% authtag.authtypecode %]',
+ },
+ [%- END -%]
+ };
require.config( {
baseUrl: '[% interface %]/lib/koha/cateditor/',
config: {
return $result[0];
},
postCreate: function() {
- this.setText( defaultvalue );
+ var value = defaultvalue;
+ var widget = this;
+
+ $.each( authvals, function() {
+ if ( this.value == widget.text ) {
+ value = this.value;
+ }
+ } );
+
+ this.setText( value );
$( '<select></select>' ).appendTo( this.node );
var $node = $( this.node ).find( 'select' );
$.each( authvals, function( undef, authval ) {
- $node.append( '<option value="' + authval.value + '"' + (authval.value == defaultvalue ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' );
+ $node.append( '<option value="' + authval.value + '"' + (authval.value == value ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' );
} );
$node.val( this.text );
}
function showResultsBox(data) {
- $('#search-top-pages, #search-bottom-pages').find('.pagination').empty();
+ $('#search-top-pages, #search-bottom-pages').find('nav').empty();
$('#searchresults thead tr').empty();
$('#searchresults tbody').empty();
$('#search-serversinfo').empty().append('<li>' + _("Loading...") + '</li>');
var max_page = Math.ceil( data.total_fetched / data.page_size ) - 1;
if ( cur_page != 0 ) {
- pages.push( '<li><a class="search-nav" href="#" data-offset="' + (data.offset - data.page_size) + '">« ' + _("Previous") + '</a></li>' );
+ pages.push( '<li><a class="search-nav" href="#" data-offset="' + (data.offset - data.page_size) + '"><span aria-hidden="true">«</span> ' + _("Previous") + '</a></li>' );
}
for ( var page = Math.max( 0, cur_page - 9 ); page <= Math.min( max_page, cur_page + 9 ); page++ ) {
}
if ( cur_page < max_page ) {
- pages.push( ' <li><a class="search-nav" href="#" data-offset="' + (data.offset + data.page_size) + '">' + _("Next") + ' »</a></li>' );
+ pages.push( ' <li><a class="search-nav" href="#" data-offset="' + (data.offset + data.page_size) + '">' + _("Next") + ' <span aria-hidden="true">»</span></a></li>' );
}
- $( '#search-top-pages, #search-bottom-pages' ).find( '.pagination' ).html( pages.length > 1 ? ( '<ul>' + pages.join( '' ) + '</ul>' ) : '' );
+ $( '#search-top-pages, #search-bottom-pages' ).find( 'nav' ).html( pages.length > 1 ? ( '<ul class="pagination pagination-sm">' + pages.join( '' ) + '</ul>' ) : '' );
var $overlay = $('#search-overlay');
$overlay.find('span').text(_("Loading"));
$(this).height( $(window).height() * .8 - $(this).prevAll('.modal-header').height() );
} );
}, 100);
-
- $("#advanced-search-ui, #search-results-ui, #macro-ui").css( {
- marginLeft: function() {
- return -($(this).width() / 2);
- }
- } );
}
- $( '#macro-ui' ).on( 'shown', function() {
+ $( '#macro-ui' ).on( 'shown.bs.modal', function() {
if ( macroEditor ) return;
macroEditor = CodeMirror(
// Click bindings
$( '#save-record, #save-dropdown a' ).click( function() {
- $( '#save-record' ).find('i').attr( 'class', 'icon-loading' ).siblings( 'span' ).text( _("Saving...") );
+ $( '#save-record' ).find('i').attr( 'class', 'fa fa-spinner' ).siblings( 'span' ).text( _("Saving...") );
function finishCb(result) {
if ( result.error == 'syntax' ) {
}
} );
- $( '#save-record' ).find('i').attr( 'class', 'icon-hdd' );
+ $( '#save-record' ).find('i').attr( 'class', 'fa fa-hdd-o' );
if ( result.error ) {
// Reset backend info
if ( !result.errors.length ) {
$('#macro-ui').modal('hide');
+ editor.focus(); //Return cursor to editor after macro run
return false;
}
return false;
} );
+ window.onbeforeunload = function() {
+ if(editor.modified )
+ { return 1; }
+ else
+ { return undef; }
+ };
+
// Start editor
Preferences.Load( [% USER_INFO.borrowernumber || 0 %] );
displayPreferences(editor);