From: Antoine Cellerier Date: Sat, 18 Mar 2006 00:51:57 +0000 (+0000) Subject: Http interface: make it possible to delete playlist nodes. Don't delete read only... X-Git-Tag: 0.9.0-test0~11878 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=49f3fdaea0574076a5d3d5d334ffd8c6cf36e975;p=vlc Http interface: make it possible to delete playlist nodes. Don't delete read only playlist items. --- diff --git a/share/http/js/functions.js b/share/http/js/functions.js index 5bab8699dc..eeac8f966e 100644 --- a/share/http/js/functions.js +++ b/share/http/js/functions.js @@ -520,6 +520,19 @@ function parse_playlist() nda.appendChild( ndai ); pos.appendChild( nda ); pos.appendChild( document.createTextNode( ' ' + elt.getAttribute( 'name' ) ) ); + + if( elt.getAttribute( 'ro' ) == 'rw' ) + { + pos.appendChild( document.createTextNode( ' ' ) ); + var del = document.createElement( "a" ); + del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); + var delimg = document.createElement( "img" ); + delimg.setAttribute( 'src', 'images/delete_small.png' ); + delimg.setAttribute( 'alt', '(delete)' ); + del.appendChild( delimg ); + pos.appendChild( del ); + } + var nd = document.createElement( "div" ); nd.setAttribute( 'class', 'pl_node' ); nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) ); @@ -545,15 +558,18 @@ function parse_playlist() pl.setAttribute( 'title', elt.getAttribute( 'uri' )); pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); pos.appendChild( pl ); - pos.appendChild( document.createTextNode( ' ' ) ); - - var del = document.createElement( "a" ); - del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); - var delimg = document.createElement( "img" ); - delimg.setAttribute( 'src', 'images/delete_small.png' ); - delimg.setAttribute( 'alt', '(delete)' ); - del.appendChild( delimg ); - pos.appendChild( del ); + + if( elt.getAttribute( 'ro' ) == 'rw' ) + { + pos.appendChild( document.createTextNode( ' ' ) ); + var del = document.createElement( "a" ); + del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); + var delimg = document.createElement( "img" ); + delimg.setAttribute( 'src', 'images/delete_small.png' ); + delimg.setAttribute( 'alt', '(delete)' ); + del.appendChild( delimg ); + pos.appendChild( del ); + } } if( elt.firstChild ) { diff --git a/share/http/requests/playlist.xml b/share/http/requests/playlist.xml index 05f1c577ae..f8b3cddcc4 100644 --- a/share/http/requests/playlist.xml +++ b/share/http/requests/playlist.xml @@ -35,9 +35,9 @@ - " current="current" uri="" name="" /> + " current="current" uri="" name="" ro="" /> - " name="" > + " name="" ro="" >