Remove the "saved" alert on config.html closes #160

This commit is contained in:
Anders Betnér 2006-06-29 21:53:53 +00:00
parent c9cdd06240
commit e3842fe73e
2 changed files with 30 additions and 6 deletions

View File

@ -32,19 +32,24 @@ select {
padding-left: 1.5em;
margin-bottom: .5em;
}
#config_not_writable_warning {
.message_div {
background-color: yellow;
padding: 1em;
border: 1px solid #8CACBB;
}
.warning_color {
#messages {
background-color: yellow;
padding: 1em;
border: 1px solid #8CACBB;
width: 40em;
}
</style>
<h1>Configuration</span></h1><span id="toggle_basic_advanced"></span>
<div id="config_not_writable_warning" style="display: none;">Your config file is not writable, you can not change anything using this webpage</div>
<div id="config_not_writable_warning" class="message_div" style="display: none;">Your config file is not writable, you can not change anything using this webpage</div>
<form id="theform" method="get" action="#">
</form>
<div id="buttons"></div>
<br />
<div id="messages" class="message_div" style="display: none;"></div>
@include ftr.html@

View File

@ -10,6 +10,7 @@ Event.observe(window,'load',init);
// I could have put it below Config = ... but I want all window.load events
// at the start of the file
var DEBUG = window.location.toString().match(/debug.*/);
var g_messageTimeout;
if ('debug=validate' == DEBUG) {
DEBUG = 'validate';
}
@ -117,7 +118,7 @@ var ConfigInitialValues = {
frag.appendChild(document.createTextNode(el));
frag.appendChild(document.createElement('br'));
});
var outerDiv = Builder.node('div',{id: ConfigXML.getSectionId('missing_items'),className: 'warning_color'});
var outerDiv = Builder.node('div',{id: ConfigXML.getSectionId('missing_items')});
outerDiv.appendChild(Builder.node('div',{className: 'naviheader'},'Options missing from config.xml'));
var contentDiv = Builder.node('div',{className: 'navibox'});
contentDiv.appendChild(document.createTextNode('The options below are in your mt-daapd.conf and Firefly uses them,'));
@ -452,10 +453,18 @@ var BuildElement = {
};
function saved(req) {
if (g_messageTimeout) {
window.clearTimeout(g_messageTimeout);
}
if ('200' == Element.textContent(req.responseXML.getElementsByTagName('status')[0])) {
alert('Saved');
$('messages').innerHTML = 'Saved';
Effect.Appear('messages',{duration: 0.2});
g_messageTimeout = window.setTimeout(function(){
Effect.Fade('messages',{duration: 0.2});
},3000);
} else {
alert("Couldn't save and if this weren't a beta I'd tell you why");
$('messages').innerHTML = 'Error: ' + req.responseText;
Effect.Appear('messages',{duration: 0.2});
}
}
function saveForm() {
@ -578,6 +587,16 @@ var i=0;
//###TODO potential error a select without a default value
$(item.id).value = ConfigInitialValues.getValue(item.id) || item.default_value || '';
}
$('messages').innerHTML = 'Cancelled';
if (g_messageTimeout) {
window.clearTimeout(g_messageTimeout);
}
Effect.Appear('messages',{duration: 0.2});
g_messageTimeout = window.setTimeout(function(){
Effect.Fade('messages',{duration: 0.2});
},3000);
});
return;
}