Show error messages when creating smart playlists. Closes #180

This commit is contained in:
Anders Betnér 2006-06-29 08:06:28 +00:00
parent 8ba331adae
commit a205cda835
4 changed files with 33 additions and 16 deletions

View File

@ -158,4 +158,10 @@ td {
#playlist_buttons {
float: right;
}
#pl_warning {
background-color: yellow;
padding: 1em;
border: 1px solid #8CACBB;
width: 40em;
}

View File

@ -11,7 +11,9 @@
@ispage config.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
@ispage config.html:<script type="text/javascript" src="lib-js/script.aculo.us/scriptaculous.js"></script>:@
@ispage config.html:<script type="text/javascript" src="util.js"></script>:@
@ispage config.html:<script type="text/javascript" src="config.js"></script>:@
@ispage config.html:<script type="text/javascript" src="config.js"></script>:@
@ispage smart.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
@ispage smart.html:<script type="text/javascript" src="lib-js/script.aculo.us/effects.js"></script>:@
@ispage smart.html:<script type="text/javascript" src="smart.js"></script>:@
@ispage playlist.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
@ispage playlist.html:<script type="text/javascript" src="lib-js/script.aculo.us/builder.js"></script>:@

View File

@ -4,25 +4,27 @@
<table cellspacing="0" >
<thead><tr><th>ID</th><th>Playlist Name</th><th>Type</th><th>Action</th></tr></thead>
<tbody id="playlists">
<tr><td></td></tr>
</tbody>
</table>
<a href="javascript:pl_new();">Add new playlist</a>
<div id="pl_data">
</div>
<div id="pl_editor" style="display: none;">
<div class="naviheader">
New playlist
</div>
<div class="navibox">
<form name="pl_form" action="">
<form id="pl_form" action="">
<div>
<input type="hidden" name="playlist_id"/>
<input type="hidden" name="playlist_id" id="playlist_id" />
<label for="playlist_name">Name</label>
<input id="playlist_name" class="playlistfield" type="text" name="playlist_name" />
<br />
<label for="playlist_spec">Playlist criteria</label>
<textarea id="playlist_spec" class="playlistfield" rows="5" name="playlist_spec"></textarea>
<textarea id="playlist_spec" class="playlistfield" rows="5" cols="50" name="playlist_spec"></textarea>
<br />
<div id="playlist_buttons">
<input type="button" onclick="javascript:pl_update();" name="submit_button" value="Submit"/>
@ -33,13 +35,10 @@ New playlist
</div>
</form>
</div>
<div id="pl_warning" class="message" style="display:none">
</div>
<br />
<div id="pl_warning" class="message" style="display:none;">
Error messages go here...
</div>
</div>
@include ftr.html@

View File

@ -1,6 +1,6 @@
var req;
var playlist_info={};
var g_messageTimeout;
function pl_editor_state(state) {
var pleditor = document.getElementById("pl_editor");
@ -17,6 +17,9 @@ function pl_editor_state(state) {
}
function pl_errormsg(msg) {
if (g_messageTimeout) {
window.clearTimeout(g_messageTimeout);
}
var msgdiv = document.getElementById("pl_warning");
if(!msgdiv)
@ -27,7 +30,12 @@ function pl_errormsg(msg) {
if(msg == "") {
msgdiv.style.display="none";
} else {
msgdiv.style.display="block";
Effect.Appear(msgdiv,{duration: 0.2});
if (('Success' == msg) || 'Cancelled' == msg) {
g_messageTimeout = window.setTimeout(function(){
Effect.Fade(msgdiv,{duration: 0.2});
},3000);
}
}
}
@ -63,17 +71,19 @@ function pl_displayresults(xmldoc,query) {
pl_errormsg(status_string);
} else {
pl_editor_state(false);
pl_errormsg("Success");
}
}
function pl_update() {
/* this is either update or create, depending... */
pl_errormsg('');
var id, name, spec;
id = document.forms['pl_form']['playlist_id'].value;
name = encodeURIComponent(document.forms['pl_form']['playlist_name'].value);
spec = encodeURIComponent(document.forms['pl_form']['playlist_spec'].value);
id = document.getElementById('playlist_id').value;
name = encodeURIComponent(document.getElementById('playlist_name').value);
spec = encodeURIComponent(document.getElementById('playlist_spec').value);
if(id == '0') {
/* new playlist... post it! */
@ -87,7 +97,7 @@ function pl_update() {
pl_displayresults(req.responseXML);
init();
pl_editor_state(false);
// pl_editor_state(false);
}
function pl_cancel() {