|
Lines 1-10
Link Here
|
| 1 |
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults themelang */ |
1 |
/* global KOHA CodeMirror to_highlight search_jumped humanMsg dataTablesDefaults themelang */ |
| 2 |
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX |
2 |
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX |
| 3 |
|
3 |
|
| 4 |
KOHA.Preferences = { |
4 |
KOHA.Preferences = { |
| 5 |
Save: function ( form ) { |
5 |
Save: function ( form ) { |
| 6 |
if ( ! $(form).valid() ) { |
6 |
if ( ! $(form).valid() ) { |
| 7 |
humanMsg.displayAlert( MSG_INVALID ); |
7 |
humanMsg.displayAlert( __("Error: presence of invalid data prevent saving. Please make the corrections and try again.") ); |
| 8 |
return; |
8 |
return; |
| 9 |
} |
9 |
} |
| 10 |
|
10 |
|
|
Lines 22-31
KOHA.Preferences = {
Link Here
|
| 22 |
data += '&' + $(this).attr('name') + '='; |
22 |
data += '&' + $(this).attr('name') + '='; |
| 23 |
}); |
23 |
}); |
| 24 |
if ( !data ) { |
24 |
if ( !data ) { |
| 25 |
humanMsg.displayAlert( MSG_NOTHING_TO_SAVE ); |
25 |
humanMsg.displayAlert( __("Nothing to save") ); |
| 26 |
return; |
26 |
return; |
| 27 |
} |
27 |
} |
| 28 |
KOHA.AJAX.MarkRunning( $( form ).find( '.save-all' ), MSG_SAVING ); |
28 |
KOHA.AJAX.MarkRunning($(form).find('.save-all'), __("Saving...") ); |
| 29 |
KOHA.AJAX.Submit( { |
29 |
KOHA.AJAX.Submit( { |
| 30 |
data: data, |
30 |
data: data, |
| 31 |
url: '/cgi-bin/koha/svc/config/systempreferences/', |
31 |
url: '/cgi-bin/koha/svc/config/systempreferences/', |
|
Lines 38-44
KOHA.Preferences = {
Link Here
|
| 38 |
modified_prefs.each(function(){ |
38 |
modified_prefs.each(function(){ |
| 39 |
var modified_pref = $(this).attr("id"); |
39 |
var modified_pref = $(this).attr("id"); |
| 40 |
modified_pref = modified_pref.replace("pref_",""); |
40 |
modified_pref = modified_pref.replace("pref_",""); |
| 41 |
msg += "<strong>"+ MSG_SAVED_PREFERENCE.format(modified_pref) + "</strong>\n"; |
41 |
msg += "<strong>" + __("Saved preference %s").format(modified_pref) + "</strong>\n"; |
| 42 |
}); |
42 |
}); |
| 43 |
humanMsg.displayAlert(msg); |
43 |
humanMsg.displayAlert(msg); |
| 44 |
|
44 |
|
|
Lines 54-66
function mark_modified() {
Link Here
|
| 54 |
$( this ).addClass( 'modified' ); |
54 |
$( this ).addClass( 'modified' ); |
| 55 |
var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' ); |
55 |
var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' ); |
| 56 |
if ( !name_cell.find( '.modified-warning' ).length ) |
56 |
if ( !name_cell.find( '.modified-warning' ).length ) |
| 57 |
name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' ); |
57 |
name_cell.append('<em class="modified-warning">(' + __("modified") + ')</em>'); |
| 58 |
KOHA.Preferences.Modified = true; |
58 |
KOHA.Preferences.Modified = true; |
| 59 |
} |
59 |
} |
| 60 |
|
60 |
|
| 61 |
window.onbeforeunload = function () { |
61 |
window.onbeforeunload = function () { |
| 62 |
if ( KOHA.Preferences.Modified ) { |
62 |
if ( KOHA.Preferences.Modified ) { |
| 63 |
return MSG_MADE_CHANGES; |
63 |
return __("You have made changes to system preferences."); |
| 64 |
} |
64 |
} |
| 65 |
}; |
65 |
}; |
| 66 |
|
66 |
|
|
Lines 146-162
$( document ).ready( function () {
Link Here
|
| 146 |
$("#pref_" + target ).hide(); |
146 |
$("#pref_" + target ).hide(); |
| 147 |
}); |
147 |
}); |
| 148 |
|
148 |
|
| 149 |
$("h3").attr("class","expanded").attr("title",MSG_CLICK_TO_EXPAND); |
149 |
$("h3").attr("class", "expanded").attr("title", __("Click to collapse this section")); |
| 150 |
var collapsible = $(".collapsed,.expanded"); |
150 |
var collapsible = $(".collapsed,.expanded"); |
| 151 |
|
151 |
|
| 152 |
$(collapsible).on("click",function(){ |
152 |
$(collapsible).on("click",function(){ |
| 153 |
var h3Id = $(this).attr("id"); |
153 |
var h3Id = $(this).attr("id"); |
| 154 |
var panel = $("#collapse_" + h3Id); |
154 |
var panel = $("#collapse_" + h3Id); |
| 155 |
if(panel.is(":visible")){ |
155 |
if(panel.is(":visible")){ |
| 156 |
$(this).addClass("collapsed").removeClass("expanded").attr("title",MSG_CLICK_TO_EXPAND); |
156 |
$(this).addClass("collapsed").removeClass("expanded").attr("title", __("Click to expand this section") ); |
| 157 |
panel.hide(); |
157 |
panel.hide(); |
| 158 |
} else { |
158 |
} else { |
| 159 |
$(this).addClass("expanded").removeClass("collapsed").attr("title",MSG_CLICK_TO_COLLAPSE); |
159 |
$(this).addClass("expanded").removeClass("collapsed").attr("title", __("Click to collapse this section") ); |
| 160 |
panel.show(); |
160 |
panel.show(); |
| 161 |
} |
161 |
} |
| 162 |
}); |
162 |
}); |
|
Lines 168-174
$( document ).ready( function () {
Link Here
|
| 168 |
href = href.replace("#",""); |
168 |
href = href.replace("#",""); |
| 169 |
var panel = $("#collapse_" + href ); |
169 |
var panel = $("#collapse_" + href ); |
| 170 |
if( panel.is(":hidden") ){ |
170 |
if( panel.is(":hidden") ){ |
| 171 |
$("#" + href ).addClass("expanded").removeClass("collapsed").attr("title",MSG_CLICK_TO_COLLAPSE); |
171 |
$("#" + href).addClass("expanded").removeClass("collapsed").attr("title", __("Click to collapse this section") ); |
| 172 |
panel.show(); |
172 |
panel.show(); |
| 173 |
} |
173 |
} |
| 174 |
}); |
174 |
}); |
|
Lines 187-193
$( document ).ready( function () {
Link Here
|
| 187 |
$("#pref_UpdateItemLocationOnCheckin").change(function(){ |
187 |
$("#pref_UpdateItemLocationOnCheckin").change(function(){ |
| 188 |
var the_text = $(this).val(); |
188 |
var the_text = $(this).val(); |
| 189 |
var alert_text = ''; |
189 |
var alert_text = ''; |
| 190 |
if ( the_text.indexOf('_ALL_:') != -1 ) alert_text = MSG_ALL_VALUE_WARN + '\n'; |
190 |
if (the_text.indexOf('_ALL_:') != -1) alert_text = __("Note: _ALL_ value will override all other values") + '\n'; |
| 191 |
var split_text =the_text.split("\n"); |
191 |
var split_text =the_text.split("\n"); |
| 192 |
var alert_issues = ''; |
192 |
var alert_issues = ''; |
| 193 |
var issue_count = 0; |
193 |
var issue_count = 0; |
|
Lines 198-204
$( document ).ready( function () {
Link Here
|
| 198 |
issue_count++; |
198 |
issue_count++; |
| 199 |
} |
199 |
} |
| 200 |
} |
200 |
} |
| 201 |
if (issue_count) alert_text += "\n"+ MSG_UPD_LOC_FORMAT_WARN +"\n"+alert_issues; |
201 |
if (issue_count) alert_text += "\n" + __("The following values are not formatted correctly:") + "\n" + alert_issues; |
| 202 |
if ( alert_text.length ) alert(alert_text); |
202 |
if ( alert_text.length ) alert(alert_text); |
| 203 |
}); |
203 |
}); |
| 204 |
|
204 |
|
| 205 |
- |
|
|