From 526b77611744cfd6739501b96d96c07914f44185 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sun, 22 Jan 2006 01:38:28 +0000 Subject: [PATCH] begining of a VLM interface and some code organisations changes. The vlm interface should be done pretty soon (i'll try to finish it tomorrow) vlm.html : vlm web interface. What works: sending broadcast and vod creation commands js/vlm.js : add code to handle sending vlm commands. requests/vlm_cmd.xml : used to send a vlm command and get the resulting error message requests/vlm.xml : export the full vlm media/schedules "tree". I still need to parse that in js/vlm.js in order to display it in dialogs/vlm . dialogs/* : dialogs' code which is used as building blocks for the main pages. (in order to avoid code duplication) mosaic.html, js/mosaic.js, dialogs/mosaic : start of a mosaic help page. nothing works and it's almost empty but i didn't feel like sorting through the commited files. --- share/http/dialogs/.hosts | 0 share/http/dialogs/browse | 43 +++ share/http/dialogs/footer | 35 ++ share/http/dialogs/input | 205 +++++++++++ share/http/dialogs/main | 98 ++++++ share/http/dialogs/mosaic | 47 +++ share/http/dialogs/playlist | 63 ++++ share/http/dialogs/sout | 289 ++++++++++++++++ share/http/dialogs/vlm | 117 +++++++ share/http/index.html | 564 +------------------------------ share/http/{ => js}/functions.js | 30 +- share/http/js/mosaic.js | 85 +++++ share/http/js/vlm.js | 148 ++++++++ share/http/mosaic.html | 58 ++++ share/http/requests/browse.xml | 2 +- share/http/requests/playlist.xml | 2 +- share/http/requests/status.xml | 2 +- share/http/requests/vlm.xml | 79 +++++ share/http/requests/vlm_cmd.xml | 33 ++ share/http/style.css | 42 ++- share/http/vlm.html | 50 +++ 21 files changed, 1410 insertions(+), 582 deletions(-) create mode 100644 share/http/dialogs/.hosts create mode 100644 share/http/dialogs/browse create mode 100644 share/http/dialogs/footer create mode 100644 share/http/dialogs/input create mode 100644 share/http/dialogs/main create mode 100644 share/http/dialogs/mosaic create mode 100644 share/http/dialogs/playlist create mode 100644 share/http/dialogs/sout create mode 100644 share/http/dialogs/vlm rename share/http/{ => js}/functions.js (96%) create mode 100644 share/http/js/mosaic.js create mode 100644 share/http/js/vlm.js create mode 100644 share/http/mosaic.html create mode 100644 share/http/requests/vlm.xml create mode 100644 share/http/requests/vlm_cmd.xml create mode 100644 share/http/vlm.html diff --git a/share/http/dialogs/.hosts b/share/http/dialogs/.hosts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/share/http/dialogs/browse b/share/http/dialogs/browse new file mode 100644 index 0000000000..f67ab86137 --- /dev/null +++ b/share/http/dialogs/browse @@ -0,0 +1,43 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: + + + diff --git a/share/http/dialogs/footer b/share/http/dialogs/footer new file mode 100644 index 0000000000..a3e450f3ad --- /dev/null +++ b/share/http/dialogs/footer @@ -0,0 +1,35 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: + + + diff --git a/share/http/dialogs/input b/share/http/dialogs/input new file mode 100644 index 0000000000..51e28daf6b --- /dev/null +++ b/share/http/dialogs/input @@ -0,0 +1,205 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: browse + + + diff --git a/share/http/dialogs/main b/share/http/dialogs/main new file mode 100644 index 0000000000..427d696502 --- /dev/null +++ b/share/http/dialogs/main @@ -0,0 +1,98 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: input, +sout and playlist . + + +
+
+ VLC media player + +
+
+ +   + + + +   + + +   + + +   + +   + + +
+
+ (?) + - + Time : (?)/(?) + - + Volume : (?) +
+ (?) +
+
diff --git a/share/http/dialogs/mosaic b/share/http/dialogs/mosaic new file mode 100644 index 0000000000..9debb928f0 --- /dev/null +++ b/share/http/dialogs/mosaic @@ -0,0 +1,47 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: input and +sout. + + +
+
+ VLC media player - Mosaic wizard + +
+
+ + +
+ + +
+ +
+
diff --git a/share/http/dialogs/playlist b/share/http/dialogs/playlist new file mode 100644 index 0000000000..486a1afdf5 --- /dev/null +++ b/share/http/dialogs/playlist @@ -0,0 +1,63 @@ + +vim:syntax=html + +This dialog needs the following dialogs to be fully functional: + + +
+
+ Playlist +
+
+ + +   + +   + + + +
+
+ (?) +
+
diff --git a/share/http/dialogs/sout b/share/http/dialogs/sout new file mode 100644 index 0000000000..7f921667c1 --- /dev/null +++ b/share/http/dialogs/sout @@ -0,0 +1,289 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: +Note that the sout chain is used and sent to VLC by the input dialog + + + diff --git a/share/http/dialogs/vlm b/share/http/dialogs/vlm new file mode 100644 index 0000000000..f219aeb0ee --- /dev/null +++ b/share/http/dialogs/vlm @@ -0,0 +1,117 @@ + +vim:syntax=html + + +This dialog needs the following dialogs to be fully functional: input, +sout and vlmelements . + + +
+
+ VLC media player - VLM interface + +
+
+ + + +
+ + + +
+
+
+ New broadcast element +
+ + + + + + +
+ + + +
+ + + +
+
+ + +
+
+ +
+
+ Broadcast Elements +
+
+
+ +
+
+ Video on Demand Elements +
+
+
+ +
+
+ Schedule Elements +
+
+
diff --git a/share/http/index.html b/share/http/index.html index 31e27ec4d4..0dd58562f2 100644 --- a/share/http/index.html +++ b/share/http/index.html @@ -3,7 +3,7 @@ @@ -40,560 +40,12 @@ - - -
-
- VLC media player - -
-
- -   - - - -   - - -   - - -   - -   - - -
-
- (?) - - - Time : (?)/(?) - - - Volume : (?) -
- (?) -
-
- - - - - -
-
- Playlist -
-
- - -   - -   - - - -
-
- (?) -
-
- - + + + + + + diff --git a/share/http/functions.js b/share/http/js/functions.js similarity index 96% rename from share/http/functions.js rename to share/http/js/functions.js index afab5b28c1..ce4d932829 100644 --- a/share/http/functions.js +++ b/share/http/js/functions.js @@ -1,7 +1,7 @@ /***************************************************************************** * functions.js: VLC media player web interface ***************************************************************************** - * Copyright (C) 2005 the VideoLAN team + * Copyright (C) 2005-2006 the VideoLAN team * $Id$ * * Authors: Antoine Cellerier @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ /* global variables */ @@ -167,15 +167,15 @@ function check_and_replace_int( id, val ) document.getElementById( id ).value = val; } -function addslashes( str ){ return str.replace(/\'/, '\\\''); } +function addslashes( str ){ return str.replace(/\'/g, '\\\''); } function disable( id ){ document.getElementById( id ).disabled = true; } function enable( id ){ document.getElementById( id ).disabled = false; } -function button_over( element ){ element.style.border = "1px solid black"; } +function button_over( element ){ element.style.border = "1px solid #000"; } -function button_out( element ){ element.style.border = "1px none black"; } +function button_out( element ){ element.style.border = "1px solid #fff"; } /* toggle show help under the buttons */ function toggle_btn_text() @@ -344,17 +344,17 @@ function parse_playlist() { if( pos.hasChildNodes() ) pos.appendChild( document.createElement( "br" ) ); - pos.appendChild( document.createElement( 'a' ) ); - nda = pos.lastChild; + nda = document.createElement( 'a' ); + pos.appendChild( nda ); nda.setAttribute( 'href', 'javascript:toggle_show_node(\''+elt.getAttribute( 'id' )+'\');' ); - nda.appendChild( document.createElement( 'img' ) ); - ndai = nda.lastChild; + ndai = document.createElement( 'img' ); + nda.appendChild( ndai ); ndai.setAttribute( 'src', 'images/minus.png' ); ndai.setAttribute( 'alt', '[-]' ); ndai.setAttribute( 'id', 'pl_img_'+elt.getAttribute( 'id' ) ); pos.appendChild( document.createTextNode( ' ' + elt.getAttribute( 'name' ) ) ); - pos.appendChild( document.createElement( "div" ) ); - nd = pos.lastChild; + nd = document.createElement( "div" ); + pos.appendChild( nd ); nd.setAttribute( 'class', 'pl_node' ); nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) ); } @@ -362,8 +362,8 @@ function parse_playlist() { if( pos.hasChildNodes() ) pos.appendChild( document.createElement( "br" ) ); - pos.appendChild( document.createElement( "a" ) ); - pl = pos.lastChild; + pl = document.createElement( "a" ); + pos.appendChild( pl ); pl.setAttribute( 'class', 'pl_leaf' ); pl.setAttribute( 'href', 'javascript:pl_play('+elt.getAttribute( 'id' )+');' ); pl.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) ); @@ -376,8 +376,8 @@ function parse_playlist() pl.setAttribute( 'title', elt.getAttribute( 'uri' )); pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); pos.appendChild( document.createTextNode( ' ' ) ); - pos.appendChild( document.createElement( "a" ) ); - del = pos.lastChild; + del = document.createElement( "a" ); + pos.appendChild( del ); del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); del.appendChild( document.createElement( "img" ) ); del = del.lastChild; diff --git a/share/http/js/mosaic.js b/share/http/js/mosaic.js new file mode 100644 index 0000000000..c073dc9dd6 --- /dev/null +++ b/share/http/js/mosaic.js @@ -0,0 +1,85 @@ +/***************************************************************************** + * mosaic.js: VLC media player web interface - Mosaic specific functions + ***************************************************************************** + * Copyright (C) 2005-2006 the VideoLAN team + * $Id$ + * + * Authors: Antoine Cellerier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/********************************************************************** + * + *********************************************************************/ + +function mosaic_size_change() +{ + check_and_replace_int( "mosaic_rows", "1" ); + mr = value( "mosaic_rows" ); + check_and_replace_int( "mosaic_cols", "1" ); + mc = value( "mosaic_cols" ); + + mlayout = document.getElementById( "mosaic_layout" ); + while( mlayout.hasChildNodes() ) + mlayout.removeChild( mlayout.firstChild ); + + if( mc && mr ) + { + for( y = 0; y < mr; y++ ) + { + mrow = document.createElement( 'div' ); + mrow.setAttribute( 'class', 'mosaic_row' ); + for( x = 0; x < mc; x++ ) + { + melt = document.createElement( 'input' ); + melt.setAttribute( 'type', 'button' ); + melt.setAttribute( 'id', 'mosaic_'+x+'_'+y ); + melt.setAttribute( 'class', 'mosaic_element' ); + melt.setAttribute( 'onclick', 'mosaic_elt_choose(\'mosaic_'+x+'_'+y+'\');' ); + melt.setAttribute( 'value', '(click)' ); + mrow.appendChild( melt ); + } + mlayout.appendChild( mrow ); + } + } +} + +function mosaic_add_input() +{ + mlist = document.getElementById( "mosaic_list" ); + minput = document.createElement( 'a' ); + minput.setAttribute( 'href', 'javascript:mosaic_elt_select(\'mosaic_'+value('mosaic_input_name')+'\');'); + minput.setAttribute( 'id', 'mosaic_'+value('mosaic_input_name') ); + minput.setAttribute( 'value', value('mosaic_input') ); + minput.setAttribute( 'title', value('mosaic_input') ); + minputtxt = document.createTextNode( value('mosaic_input_name') ); + minput.appendChild( minputtxt ); + mlist.appendChild( minput ); + mlist.appendChild( document.createElement( 'br' ) ); +} + +function mosaic_elt_select( id ) +{ + hide( 'mosaic_list' ); + document.getElementById( document.getElementById( 'mosaic_list' ).value ).value = + document.getElementById( id ).getAttribute( 'value' ); +} + +function mosaic_elt_choose( id ) +{ + document.getElementById( 'mosaic_list' ).value = id; + show( 'mosaic_list' ); +} diff --git a/share/http/js/vlm.js b/share/http/js/vlm.js new file mode 100644 index 0000000000..90d503f978 --- /dev/null +++ b/share/http/js/vlm.js @@ -0,0 +1,148 @@ +/***************************************************************************** + * vlm.js: VLC media player web interface + ***************************************************************************** + * Copyright (C) 2005-2006 the VideoLAN team + * $Id$ + * + * Authors: Antoine Cellerier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/* replace quotes and spaces by underscores */ +function addunderscores( str ){ return str.replace(/\'|\"| /g, '_'); } + +/********************************************************************** + * Input dialog functions + *********************************************************************/ + +function vlm_input_edit( dest ) +{ + document.getElementById( 'input_dest' ).value = dest; + show( 'input' ); +} + +function vlm_input_change() +{ + hide( 'input' ); + document.getElementById( value( 'input_dest' ) ).value = value( 'input_mrl' ); +} + +function vlm_output_edit( dest ) +{ + document.getElementById( 'sout_dest' ).value = dest; + show( 'sout' ); +} + +function vlm_output_change() +{ + hide( 'sout' ); + document.getElementById( value( 'sout_dest' ) ).value = value( 'sout_mrl' ).substr(6); /* substr <-> remove :sout= */ +} + +function hide_vlm_add() +{ + document.getElementById( 'vlm_add_broadcast' ).style.display = 'none'; + document.getElementById( 'vlm_add_vod' ).style.display = 'none'; + document.getElementById( 'vlm_add_schedule' ).style.display = 'none'; +} + +function update_vlm_add_broadcast() +{ + cmd = document.getElementById( 'vlm_command' ); + + if( value( 'vlm_broadcast_name' ) ) + { + cmd.value = "new " + addunderscores( value( 'vlm_broadcast_name' ) ) + + " broadcast"; + + if( checked( 'vlm_broadcast_enabled' ) ) + { + cmd.value += " enabled"; + } + + if( checked( 'vlm_broadcast_loop' ) ) + { + cmd.value += " loop"; + } + + if( value( 'vlm_broadcast_input' ) ) + { + cmd.value += " input " + value( 'vlm_broadcast_input' ); + } + + if( value( 'vlm_broadcast_output' ) ) + { + cmd.value += " output " + value( 'vlm_broadcast_output' ); + } + } +} + +function update_vlm_add_vod() +{ + cmd = document.getElementById( 'vlm_command' ); + + if( value( 'vlm_vod_name' ) ) + { + cmd.value = "new " + addunderscores( value( 'vlm_vod_name' ) ) + + " vod"; + + if( checked( 'vlm_vod_enabled' ) ) + { + cmd.value += " enabled"; + } + + if( value( 'vlm_vod_input' ) ) + { + cmd.value += " input " + value( 'vlm_vod_input' ); + } + + if( value( 'vlm_vod_output' ) ) + { + cmd.value += " output " + value( 'vlm_vod_output' ); + } + } +} + +function update_vlm_add_schedule() +{ +} + +function parse_vlm_cmd() +{ + if( req.readyState == 4 ) + { + if( req.status == 200 ) + { + vlm_answer = req.responseXML.documentElement; + error_tag = vlm_answer.getElementsByTagName( 'error' )[0]; + if( error_tag.hasChildNodes() ) + { + vlm_error = error_tag.firstChild.data; + alert( vlm_error ); + } + } + } +} + +function vlm_cmd( cmd ) +{ + loadXMLDoc( 'requests/vlm_cmd.xml?command='+cmd, parse_vlm_cmd ); +} + +function vlm_send( ) +{ + vlm_cmd( value( 'vlm_command' ) ); +} diff --git a/share/http/mosaic.html b/share/http/mosaic.html new file mode 100644 index 0000000000..1ecd809a19 --- /dev/null +++ b/share/http/mosaic.html @@ -0,0 +1,58 @@ + + + + + + + + + VLC media player - Web Interface - Mosaic Wizard + + + + + + + + + +

TODO : code

+ + + + + + + + + + + + + + + + + + diff --git a/share/http/requests/browse.xml b/share/http/requests/browse.xml index b4b7a8553c..ad4d8b7402 100644 --- a/share/http/requests/browse.xml +++ b/share/http/requests/browse.xml @@ -3,7 +3,7 @@ + + + + + + " enabled="" loop=""> + + + + + + + + + + + + + + + + + + + + " enabled=""> + + + + + + + + + + + + + + + + + + + " enabled="" date="" period="" repeat=""> + + + + + + + + + + diff --git a/share/http/requests/vlm_cmd.xml b/share/http/requests/vlm_cmd.xml new file mode 100644 index 0000000000..080ff91581 --- /dev/null +++ b/share/http/requests/vlm_cmd.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/share/http/style.css b/share/http/style.css index 92d45b8c23..3ea4d1a52d 100644 --- a/share/http/style.css +++ b/share/http/style.css @@ -1,7 +1,7 @@ /***************************************************************************** * style.css: VLC media player web interface ***************************************************************************** - * Copyright (C) 2005 the VideoLAN team + * Copyright (C) 2005-2006 the VideoLAN team * $Id$ * * Authors: Antoine Cellerier @@ -34,7 +34,7 @@ div { text-align: left; } -div#main, div#playlist, div#input, div#sout, div#footer { +div.dialog { width: 600px; background: #fff; border: solid #000 1px; @@ -63,11 +63,11 @@ input { background-color: #fff; } -div#sout_helper, div#input_helper { +div.helper { margin: 10px; border: solid #ccc 2px; } -div#sout_helper hr, div#input_helper hr { +div.helper hr { border: solid #ccc 1px; } @@ -91,7 +91,7 @@ div.controls { padding: 3px 5px; } div.controls button { - border: 1px none #000; + border: 1px solid #fff; padding: 0px; background-color: #fff; } @@ -117,20 +117,46 @@ img { border: 0px none black; } -div#browse { +div.popup { background-color: #fff; - width: 70%; overflow: hidden; border: solid #888 1px; margin: 10px auto; /* Center on page - Firefox */ position: absolute; - left: 15%; z-index: 1; font-size: 0.8em; } +div#browse { + width: 70%; + left: 15%; +} div#browse div.title { background-color: #008; } div#browser { padding: 20px; } + +div#mosaic_list { + width: 50%; + left: 25%; +} + +div#mosaic_layout { + border: 1px solid #000; + background-color: #ddf; + display: block; + margin: 1em; + padding: 0.3em 0.6em; +} +div.mosaic_row { + padding: 0.6em 0em; +} + +.mosaic_element { + display: inline; + border: 1px solid #000; + margin: 0em 0.3em; + padding: 0.3em 0.3em; + background-color: #dfd; +} diff --git a/share/http/vlm.html b/share/http/vlm.html new file mode 100644 index 0000000000..c885583e24 --- /dev/null +++ b/share/http/vlm.html @@ -0,0 +1,50 @@ + + + + + + + + + VLC media player - Web Interface - VLM + + + + + + + + + + + + + + + + + + + + -- 2.39.2