[Mt-daapd-cvs] mt-daapd/admin-root smart.html,NONE,1.1 smart.js,NONE,1.1 mt-daapd.css,1.3,1.4 hdr.ht
Status: Beta
Brought to you by:
andrew40
From: Ron P. <rp...@us...> - 2005-06-20 03:18:33
|
Update of /cvsroot/mt-daapd/mt-daapd/admin-root In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19306 Modified Files: mt-daapd.css hdr.html Added Files: smart.html smart.js Log Message: start working on smart playlist parser --- NEW FILE: smart.html --- @include hdr.html@ <div class="stx"> <table class="hovertable" width="400"> <thead><th>ID</th><th>Playlist Name</th><th>Type</th></thead> <tbody id="playlists"> </tbody> </table> <div id="pl_data"> </div> </div> @include ftr.html@ Index: hdr.html =================================================================== RCS file: /cvsroot/mt-daapd/mt-daapd/admin-root/hdr.html,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** hdr.html 16 Mar 2005 19:56:40 -0000 1.13 --- hdr.html 20 Jun 2005 03:18:16 -0000 1.14 *************** *** 7,14 **** <link rel="stylesheet" type="text/css" href="mt-daapd.css" /> @ispage status.html:<meta http-equiv="refresh" content="10" />:@ @ispage playlist.html:<script type="text/javascript" src="playlist.js" />:@ </head> ! <body @ispage playlist.html:onload="init()":@> @ispage playlist.html:<!--:@ <div> --- 7,15 ---- <link rel="stylesheet" type="text/css" href="mt-daapd.css" /> @ispage status.html:<meta http-equiv="refresh" content="10" />:@ + @ispage smart.html:<script type="text/javascript" src="smart.js" />:@ @ispage playlist.html:<script type="text/javascript" src="playlist.js" />:@ </head> ! <body @ispage playlist.html:onload="init()":@ @ispage smart.html:onload="init()":@> @ispage playlist.html:<!--:@ <div> *************** *** 25,29 **** <a href="status.html" class="@ispage status.html:selected:plain@">Status</a> <a href="playlist.html" class="@ispage playlist.html:selected:plain@">Playlist</a> ! <a href="feedback.html" class="@ispage feedback.html:selected:plain@">Feedback</a> <a href="thanks.html" class="@ispage thanks.html:selected:plain@">Thanks</a> </div> --- 26,32 ---- <a href="status.html" class="@ispage status.html:selected:plain@">Status</a> <a href="playlist.html" class="@ispage playlist.html:selected:plain@">Playlist</a> ! <a href="feedback.html" class="@ispage ! feedback.html:selected:plain@">Feedback</a> ! <a href="smart.html" class="@ispage smart.html:selected:plain@">Smart</a> <a href="thanks.html" class="@ispage thanks.html:selected:plain@">Thanks</a> </div> Index: mt-daapd.css =================================================================== RCS file: /cvsroot/mt-daapd/mt-daapd/admin-root/mt-daapd.css,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mt-daapd.css 21 Mar 2005 19:53:39 -0000 1.3 --- mt-daapd.css 20 Jun 2005 03:18:16 -0000 1.4 *************** *** 29,33 **** ! body { font: 0.7em Verdana, Helvetica, Arial, sans-serif; --- 29,36 ---- ! table.hovertable tr:hover { ! background-color: #8CACBB; ! } ! body { font: 0.7em Verdana, Helvetica, Arial, sans-serif; *************** *** 46,49 **** --- 49,53 ---- } + table { font-size: 100%; --- NEW FILE: smart.js --- var req; var playlist_info={}; function selectPlaylist(e) { var targ; if(!e) var e=window.event; if(e.target) targ=e.target; else if (e.srcElement) targ=e.srcElement; if(targ.nodeType == 3) targ = targ.parentNode; while(targ.previousSibling) targ=targ.previousSibling; pl_id = targ.firstChild.nodeValue; alert(playlist_info[pl_id]['name']); } function processPlaylists() { var xmldoc = req.responseXML; var playlists = xmldoc.getElementsByTagName("dmap.listingitem"); var pl_table = document.getElementById("playlists"); playlist_info = {}; while(pl_table.childNodes.length > 0) { pl_table.removeChild(pl_table.lastChild); } for(var x=0; x < playlists.length; x++) { var pl_id=playlists[x].getElementsByTagName("dmap.itemid")[0].firstChild.nodeValue; var pl_name=playlists[x].getElementsByTagName("dmap.itemname")[0].firstChild.nodeValue; var pl_type=playlists[x].getElementsByTagName("org.mt-daapd.playlist-type")[0].firstChild.nodeValue; playlist_info[String(pl_id)] = { 'name': pl_name, 'type': pl_type }; if(pl_type == 1) { var pl_spec=playlists[x].getElementsByTagName("org.mt-daapd.smart-playlist-spec")[0].firstChild.nodeValue; playlist_info[String(pl_id)]['spec'] = pl_spec; } switch(pl_type) { case "0": pl_type = "Static (Web Edited)"; break; case "1": pl_type = "Smart"; break; case "2": pl_type = "Static (File)"; break; case "3": pl_type = "Static (iTunes)"; break; } var row = document.createElement("tr"); row.onclick=selectPlaylist; if(row.captureEvents) row.captureEvents(Event.CLICK); var td1 = document.createElement("td"); var td2 = document.createElement("td"); var td3 = document.createElement("td"); td1.innerHTML=pl_id; td2.innerHTML=pl_name + "\n"; td3.innerHTML=pl_type + "\n"; row.appendChild(td1); row.appendChild(td2); row.appendChild(td3); pl_table.appendChild(row); } } function processReqChange() { if(req.readyState == 4) { if(req.status == 200) { processPlaylists(); } } } function init() { loadXMLDoc("/databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec","playlists"); } function loadXMLDoc(url) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(null); // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(); } } } |