View | Details | Raw Unified | Return to bug 9331
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/ajax.js (-8 / +8 lines)
Lines 7-13 KOHA.AJAX = { Link Here
7
            cache: false,
7
            cache: false,
8
            dataType: 'json',
8
            dataType: 'json',
9
            type: 'POST',
9
            type: 'POST',
10
            error: function ( xhr, stat, error ) { KOHA.AJAX.BaseError( error_callback, xhr, stat, error ) }
10
            error: function ( xhr, stat, error ) { KOHA.AJAX.BaseError( error_callback, xhr, stat, error ); }
11
        } );
11
        } );
12
        $.ajax( options );
12
        $.ajax( options );
13
    },
13
    },
Lines 15-44 KOHA.AJAX = { Link Here
15
        KOHA.xhr = xhr;
15
        KOHA.xhr = xhr;
16
        if ( !xhr.getResponseHeader( 'content-type' ).match( 'application/json' ) ) {
16
        if ( !xhr.getResponseHeader( 'content-type' ).match( 'application/json' ) ) {
17
            // Something really failed
17
            // Something really failed
18
            humanMsg.displayAlert( _( 'Internal Server Error, please reload the page' ) );
18
            humanMsg.displayAlert( MSG_INTERNAL_SERVER_ERROR );
19
            return;
19
            return;
20
        }
20
        }
21
21
22
        var error = eval( '(' + xhr.responseText + ')' );
22
        var error = eval( '(' + xhr.responseText + ')' );
23
23
24
        if ( error.type == 'auth' ) {
24
        if ( error.type == 'auth' ) {
25
            humanMsg.displayMsg( _( 'You need to log in again, your session has timed out' ) );
25
            humanMsg.displayMsg( MSG_SESSION_TIMED_OUT );
26
        }
26
        }
27
27
28
        if ( callback ) {
28
        if ( callback ) {
29
            callback( error );
29
            callback( error );
30
        } else {
30
        } else {
31
            humanMsg.displayAlert( _( 'Error; your data might not have been saved' ) );
31
            humanMsg.displayAlert( MSG_DATA_NOT_SAVED );
32
        }
32
        }
33
    },
33
    },
34
    MarkRunning: function ( selector, text ) {
34
    MarkRunning: function ( selector, text ) {
35
        text = text || _( 'Loading...' );
35
        text = text || MSG_LOADING;
36
        $( selector )
36
        $( selector )
37
            .attr( 'disabled', 'disabled' )
37
            .attr( 'disabled', 'disabled' )
38
            .each( function () {
38
            .each( function () {
39
                var $image = $( '<img src="/intranet-tmpl/prog/img/spinner-small.gif" alt="" class="spinner" />' );
39
                var $image = $( '<img src="/intranet-tmpl/prog/img/spinner-small.gif" alt="" class="spinner" />' );
40
                var selector_type = this.localName;
40
                var selector_type = this.localName;
41
                if (selector_type == undefined) selector_type = this.nodeName; // IE only
41
                if (selector_type === undefined) selector_type = this.nodeName; // IE only
42
                switch ( selector_type.toLowerCase() ) {
42
                switch ( selector_type.toLowerCase() ) {
43
                    case 'input':
43
                    case 'input':
44
                        $( this ).data( 'original-text', this.value );
44
                        $( this ).data( 'original-text', this.value );
Lines 65-71 KOHA.AJAX = { Link Here
65
            .removeAttr( 'disabled' )
65
            .removeAttr( 'disabled' )
66
            .each( function () {
66
            .each( function () {
67
                var selector_type = this.localName;
67
                var selector_type = this.localName;
68
                if (selector_type == undefined) selector_type = this.nodeName; // IE only
68
                if (selector_type === undefined) selector_type = this.nodeName; // IE only
69
                switch ( selector_type.toLowerCase() ) {
69
                switch ( selector_type.toLowerCase() ) {
70
                    case 'input':
70
                    case 'input':
71
                        this.value = $( this ).data( 'original-text' );
71
                        this.value = $( this ).data( 'original-text' );
Lines 85-88 KOHA.AJAX = { Link Here
85
            } )
85
            } )
86
            .removeData( 'original-text' );
86
            .removeData( 'original-text' );
87
    }
87
    }
88
}
88
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-4 / +8 lines)
Lines 3-11 Link Here
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
4
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/preferences.css" />
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/preferences.css" />
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/humanmsg.css" />
7
<script src="[% themelang %]/lib/jquery/plugins/humanmsg.js" type="text/javascript"></script>
8
<script src="[% themelang %]/js/ajax.js" type="text/javascript"></script>
9
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
10
<script type="text/javascript">
7
<script type="text/javascript">
11
//<![CDATA[
8
//<![CDATA[
Lines 21-28 Link Here
21
    var MSG_MADE_CHANGES = _("You have made changes to system preferences.");
18
    var MSG_MADE_CHANGES = _("You have made changes to system preferences.");
22
    var MSG_CLICK_TO_EXPAND = _("Click to expand this section");
19
    var MSG_CLICK_TO_EXPAND = _("Click to expand this section");
23
    var MSG_CLICK_TO_COLLAPSE = _("Click to collapse this section");
20
    var MSG_CLICK_TO_COLLAPSE = _("Click to collapse this section");
21
    var MSG_INTERNAL_SERVER_ERROR = _( "Internal Server Error, please reload the page" );
22
    var MSG_SESSION_TIMED_OUT = _( 'You need to log in again, your session has timed out' );
23
    var MSG_DATA_NOT_SAVED = _( 'Error; your data might not have been saved' );
24
    var MSG_LOADING = _( 'Loading...' );
25
24
//]]>
26
//]]>
25
</script>
27
</script>
28
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/humanmsg.css" />
29
<script src="[% themelang %]/lib/jquery/plugins/humanmsg.js" type="text/javascript"></script>
30
<script src="[% themelang %]/js/ajax.js" type="text/javascript"></script>
26
<script src="[% themelang %]/js/pages/preferences.js" type="text/javascript"></script>
31
<script src="[% themelang %]/js/pages/preferences.js" type="text/javascript"></script>
27
<script src="[% themelang %]/lib/jquery/plugins/jquery.highlight-3.js" type="text/javascript"></script>
32
<script src="[% themelang %]/lib/jquery/plugins/jquery.highlight-3.js" type="text/javascript"></script>
28
</head>
33
</head>
29
- 

Return to bug 9331