]> git.sesse.net Git - vlc/commitdiff
Http interface: make it possible to delete playlist nodes. Don't delete read only...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 18 Mar 2006 00:51:57 +0000 (00:51 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 18 Mar 2006 00:51:57 +0000 (00:51 +0000)
share/http/js/functions.js
share/http/requests/playlist.xml

index 5bab8699dc3e741a1dc1b2b4d67588c3c2183e11..eeac8f966e49e3813b5bed138d98d0a116818c38 100644 (file)
@@ -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 )
                 {
index 05f1c577aef84c593e761f8a85b834b7b5fab1ee..f8b3cddcc48d1ea30eea06c9f4cf5bb5caa7c0d0 100644 (file)
@@ -35,9 +35,9 @@
   <vlc id="end" />
   <vlc id="if" param1="pl.type value 'Node' strcmp" />
     <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" />
-    <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="rpn" param1="first_item 1 store" />
     <vlc id="end"/>