}
file.close();
+ JSAN.use('util.file'); var file = new util.file('no_sound');
+ if (file._file.exists()) {
+ try {
+ var x = file.get_content();
+ if (x) {
+ obj.no_sound = x;
+ obj.stash('no_sound');
+ }
+ } catch(E) {
+ alert(E);
+ }
+ }
+ file.close();
+
JSAN.use('util.functional');
JSAN.use('util.fm_utils');
'play_url' : function(url) {
+ var obj = this;
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var obj = this;
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
var url2 = obj.xp_url_init( data.server + url );
dump('url = ' + url2 + '\n');
- obj.SOUND.play( url2 );
+ if (typeof data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') obj.SOUND.play( url2 );
} catch(E) {
- obj.SOUND.beep();
+ try { if (data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') obj.SOUND.beep(); } catch(F) {
+ dump('beep(): ' + F + '\n');
+ }
dump('play_url(): ' + E + '\n');
}
+
},
'good' : function(e){
g.error.sdump('D_TRACE','my_init() for font_settings.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
+ document.getElementById('sound').checked = typeof g.data.no_sound == 'undefined' || g.data.no_sound == 'false' || g.data.no_sound == false ? false : true;
} catch(E) {
try { g.error.standard_unexpected_error_alert('admin/font_settings.xul',E); } catch(F) { alert(E); }
}
}
+ function toggle_sound() {
+ try {
+ var bool = document.getElementById('sound').checked;
+ g.data.no_sound = bool; g.data.stash('no_sound');
+ alert('Sound is now ' + (bool ? ' disabled.' : ' enabled.') );
+ } catch(E) {
+ try { g.error.standard_unexpected_error_alert('setting sound in admin/font_settings.xul',E); } catch(F) { alert(E); }
+ }
+ }
+
+ function save_sound() {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('no_sound');
+ file.write_content( 'truncate', String( document.getElementById('sound').checked ) );
+ file.close();
+ alert('Sound preference saved to file system.');
+ } catch(E) {
+ try { g.error.standard_unexpected_error_alert('saving in admin/font_settings.xul',E); } catch(F) { alert(E); }
+ }
+ }
+
]]>
</script>
+ <groupbox orient="vertical">
+ <caption label="Adjust Sound"/>
+ <hbox>
+ <checkbox id="sound" label="Disable sound?" oncommand="toggle_sound();"/>
+ <button label='Save to Disk' oncommand="save_sound();"/>
+ </hbox>
+ </groupbox>
+
<groupbox>
<caption label="Adjust Global Font"/>
<hbox>
<tr valign="top">
<td>
<div style='padding: 8px;'>
- <a href='javascript:_l("font_settings.xul");'>Global Font Settings</a>
+ <a href='javascript:_l("font_settings.xul");'>Global Font and Sound Settings</a>
</div>
<div style='padding: 8px;'>
<a href='javascript:_l("printer_settings.html");'>Printer Settings Editor</a>