1 $(document).ready(function() {
2 $("table.preferences").tablesorter({
4 headers: { 1: { sorter:false}}
8 // We can assume 'KOHA' exists, as we depend on KOHA.AJAX
11 Save: function ( form ) {
12 data = $( form ).find( '.modified' ).serialize();
14 humanMsg.displayAlert( 'Nothing to save' );
17 KOHA.AJAX.MarkRunning( $( form ).find( '.save-all' ), _( 'Saving...' ) );
20 url: '/cgi-bin/koha/svc/config/systempreferences/',
21 success: function ( data ) { KOHA.Preferences.Success( form ) },
22 complete: function () { KOHA.AJAX.MarkDone( $( form ).find( '.save-all' ) ) }
25 Success: function ( form ) {
26 humanMsg.displayAlert( 'Saved' );
29 .find( '.modified-warning' ).remove().end()
30 .find( '.modified' ).removeClass('modified');
31 KOHA.Preferences.Modified = false;
35 $( document ).ready( function () {
36 function mark_modified() {
37 $( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
38 $( this ).addClass( 'modified' );
39 var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
40 if ( !name_cell.find( '.modified-warning' ).length )
41 name_cell.append( '<em class="modified-warning">(modified)</em>' );
42 KOHA.Preferences.Modified = true;
46 .find( 'input.preference, textarea.preference' ).keyup( function () {
47 if ( this.defaultValue === undefined || this.value != this.defaultValue ) mark_modified.call( this );
49 .find( 'select.preference' ).change( mark_modified );
50 $('.preference-checkbox').change( function () {
51 $('.preference-checkbox').addClass('modified');
52 mark_modified.call(this);
55 window.onbeforeunload = function () {
56 if ( KOHA.Preferences.Modified ) {
57 return _( "You have made changes to system preferences." );
61 $( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } );
63 $( '.prefs-tab .save-all' ).attr( 'disabled', true ).click( function () {
64 KOHA.Preferences.Save( this.form );
68 $( '.prefs-tab .expand-textarea' ).show().click( function () {
69 $( this ).hide().nextAll( 'textarea, input[type=submit]' )
70 .animate( { height: 'show', queue: false } )
71 .animate( { opacity: 1 } );
74 } ).nextAll( 'textarea, input[type=submit]' ).hide().css( { opacity: 0 } );
76 $("h3").attr("class","expanded").attr("title",_("Click to expand this section"));
77 var collapsible = $(".collapsed,.expanded");
79 $(collapsible).toggle(
81 $(this).addClass("collapsed").removeClass("expanded").attr("title",_("Click to expand this section"));
82 $(this).next("table").hide();
85 $(this).addClass("expanded").removeClass("collapsed").attr("title",_("Click to collapse this section"));
86 $(this).next("table").show();
91 var words = to_highlight.split( ' ' );
92 $( '.prefs-tab table' ).find( 'td, th' ).not( '.name-cell' ).each( function ( i, td ) {
93 $.each( words, function ( i, word ) { $( td ).highlight( word ) } );
94 } ).find( 'option' ).removeHighlight();
97 if ( search_jumped ) {
98 document.location.hash = "jumped";