Commit 49f3fdae authored by Antoine Cellerier's avatar Antoine Cellerier

Http interface: make it possible to delete playlist nodes. Don't delete read only playlist items.

parent d2768293
...@@ -520,6 +520,19 @@ function parse_playlist() ...@@ -520,6 +520,19 @@ function parse_playlist()
nda.appendChild( ndai ); nda.appendChild( ndai );
pos.appendChild( nda ); pos.appendChild( nda );
pos.appendChild( document.createTextNode( ' ' + elt.getAttribute( 'name' ) ) ); 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" ); var nd = document.createElement( "div" );
nd.setAttribute( 'class', 'pl_node' ); nd.setAttribute( 'class', 'pl_node' );
nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) ); nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) );
...@@ -545,15 +558,18 @@ function parse_playlist() ...@@ -545,15 +558,18 @@ function parse_playlist()
pl.setAttribute( 'title', elt.getAttribute( 'uri' )); pl.setAttribute( 'title', elt.getAttribute( 'uri' ));
pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
pos.appendChild( pl ); pos.appendChild( pl );
pos.appendChild( document.createTextNode( ' ' ) );
if( elt.getAttribute( 'ro' ) == 'rw' )
var del = document.createElement( "a" ); {
del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); pos.appendChild( document.createTextNode( ' ' ) );
var delimg = document.createElement( "img" ); var del = document.createElement( "a" );
delimg.setAttribute( 'src', 'images/delete_small.png' ); del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' );
delimg.setAttribute( 'alt', '(delete)' ); var delimg = document.createElement( "img" );
del.appendChild( delimg ); delimg.setAttribute( 'src', 'images/delete_small.png' );
pos.appendChild( del ); delimg.setAttribute( 'alt', '(delete)' );
del.appendChild( delimg );
pos.appendChild( del );
}
} }
if( elt.firstChild ) if( elt.firstChild )
{ {
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
<vlc id="end" /> <vlc id="end" />
<vlc id="if" param1="pl.type value 'Node' strcmp" /> <vlc id="if" param1="pl.type value 'Node' strcmp" />
<vlc id="rpn" param1="1 +" /> <vlc id="rpn" param1="1 +" />
<leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri value '&' '&amp;' str_replace" />" name="<vlc id="value" param1="pl.name value '&' '&amp;' str_replace" />" /> <leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri value '&' '&amp;' str_replace" />" name="<vlc id="value" param1="pl.name value '&' '&amp;' str_replace" />" ro="<vlc id="value" param1="pl.ro" />" />
<vlc id="else" /> <vlc id="else" />
<node id="<vlc id="value" param1="pl.index" />" name="<vlc id="value" param1="pl.name value '&' '&amp;' str_replace" />" > <node id="<vlc id="value" param1="pl.index" />" name="<vlc id="value" param1="pl.name value '&' '&amp;' str_replace" />" ro="<vlc id="value" param1="pl.ro" />" >
<vlc id="if" param1="first_item value 0 ="/> <vlc id="if" param1="first_item value 0 ="/>
<vlc id="rpn" param1="first_item 1 store" /> <vlc id="rpn" param1="first_item 1 store" />
<vlc id="end"/> <vlc id="end"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment