Commit 55703351 authored by Antoine Cellerier's avatar Antoine Cellerier

make sure that local variables are local variables.

parent 2a4ba1cc
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* global variables */ /* global variables */
old_time = 0; var old_time = 0;
/********************************************************************** /**********************************************************************
* Misc utils * Misc utils
...@@ -56,9 +56,9 @@ function loadXMLDoc( url, callback ) ...@@ -56,9 +56,9 @@ function loadXMLDoc( url, callback )
/* fomat time in second as hh:mm:ss */ /* fomat time in second as hh:mm:ss */
function format_time( s ) function format_time( s )
{ {
hours = Math.floor(s/3600); var hours = Math.floor(s/3600);
minutes = Math.floor((s/60)%60); var minutes = Math.floor((s/60)%60);
seconds = s%60; var seconds = s%60;
if( hours < 10 ) hours = "0"+hours; if( hours < 10 ) hours = "0"+hours;
if( minutes < 10 ) minutes = "0"+minutes; if( minutes < 10 ) minutes = "0"+minutes;
if( seconds < 10 ) seconds = "0"+seconds; if( seconds < 10 ) seconds = "0"+seconds;
...@@ -68,7 +68,7 @@ function format_time( s ) ...@@ -68,7 +68,7 @@ function format_time( s )
/* delete all a tag's children and add a text child node */ /* delete all a tag's children and add a text child node */
function set_text( id, val ) function set_text( id, val )
{ {
elt = document.getElementById( id ); var elt = document.getElementById( id );
while( elt.hasChildNodes() ) while( elt.hasChildNodes() )
elt.removeChild( elt.firstChild ); elt.removeChild( elt.firstChild );
elt.appendChild( document.createTextNode( val ) ); elt.appendChild( document.createTextNode( val ) );
...@@ -77,10 +77,10 @@ function set_text( id, val ) ...@@ -77,10 +77,10 @@ function set_text( id, val )
/* set item's 'element' attribute to value */ /* set item's 'element' attribute to value */
function set_css( item, element, value ) function set_css( item, element, value )
{ {
for( j = 0; j<document.styleSheets.length; j++ ) for( var j = 0; j < document.styleSheets.length; j++ )
{ {
cssRules = document.styleSheets[j].cssRules; cssRules = document.styleSheets[j].cssRules;
for( i = 0; i<cssRules.length; i++) for( var i = 0; i < cssRules.length; i++)
{ {
if( cssRules[i].selectorText == item ) if( cssRules[i].selectorText == item )
{ {
...@@ -94,10 +94,10 @@ function set_css( item, element, value ) ...@@ -94,10 +94,10 @@ function set_css( item, element, value )
/* get item's 'element' attribute */ /* get item's 'element' attribute */
function get_css( item, element ) function get_css( item, element )
{ {
for( j = 0; j<document.styleSheets.length; j++ ) for( var j = 0; j < document.styleSheets.length; j++ )
{ {
cssRules = document.styleSheets[j].cssRules; cssRules = document.styleSheets[j].cssRules;
for( i = 0; i<cssRules.length; i++) for( var i = 0; i < cssRules.length; i++)
{ {
if( cssRules[i].selectorText == item ) if( cssRules[i].selectorText == item )
{ {
...@@ -109,7 +109,7 @@ function get_css( item, element ) ...@@ -109,7 +109,7 @@ function get_css( item, element )
function toggle_show( id ) function toggle_show( id )
{ {
element = document.getElementById( id ); var element = document.getElementById( id );
if( element.style.display == 'block' || element.style.display == '' ) if( element.style.display == 'block' || element.style.display == '' )
{ {
element.style.display = 'none'; element.style.display = 'none';
...@@ -121,8 +121,8 @@ function toggle_show( id ) ...@@ -121,8 +121,8 @@ function toggle_show( id )
} }
function toggle_show_node( id ) function toggle_show_node( id )
{ {
element = document.getElementById( 'pl_'+id ); var element = document.getElementById( 'pl_'+id );
img = document.getElementById( 'pl_img_'+id ); var img = document.getElementById( 'pl_img_'+id );
if( element.style.display == 'block' || element.style.display == '' ) if( element.style.display == 'block' || element.style.display == '' )
{ {
element.style.display = 'none'; element.style.display = 'none';
...@@ -147,8 +147,8 @@ function value( id ){ return document.getElementById( id ).value; } ...@@ -147,8 +147,8 @@ function value( id ){ return document.getElementById( id ).value; }
function radio_value( name ) function radio_value( name )
{ {
radio = document.getElementsByName( name ); var radio = document.getElementsByName( name );
for( i = 0; i<radio.length; i++ ) for( var i = 0; i < radio.length; i++ )
{ {
if( radio[i].checked ) if( radio[i].checked )
{ {
...@@ -196,19 +196,19 @@ function toggle_btn_text() ...@@ -196,19 +196,19 @@ function toggle_btn_text()
/* input actions */ /* input actions */
function in_play() function in_play()
{ {
input_iesuxx = value('input_mrl'); var input = value('input_mrl');
if( value('sout_mrl') != '' ) if( value('sout_mrl') != '' )
input_iesuxx += ' '+value('sout_mrl'); input += ' '+value('sout_mrl');
url = 'requests/status.xml?command=in_play&input='+escape(input_iesuxx); var url = 'requests/status.xml?command=in_play&input='+escape( input );
loadXMLDoc( url, parse_status ); loadXMLDoc( url, parse_status );
setTimeout( 'update_playlist()', 1000 ); setTimeout( 'update_playlist()', 1000 );
} }
function in_enqueue() function in_enqueue()
{ {
input_iesuxx = value('input_mrl'); var input = value('input_mrl');
if( value('sout_mrl') != '' ) if( value('sout_mrl') != '' )
input_iesuxx += ' '+value('sout_mrl'); input += ' '+value('sout_mrl');
url = 'requests/status.xml?command=in_enqueue&input='+escape(input_iesuxx); var url = 'requests/status.xml?command=in_enqueue&input='+escape( input );
loadXMLDoc( url, parse_status ); loadXMLDoc( url, parse_status );
setTimeout( 'update_playlist()', 1000 ); setTimeout( 'update_playlist()', 1000 );
} }
...@@ -300,17 +300,17 @@ function parse_status() ...@@ -300,17 +300,17 @@ function parse_status()
{ {
if( req.status == 200 ) if( req.status == 200 )
{ {
status_iesuxx = req.responseXML.documentElement; var status = req.responseXML.documentElement;
new_time = status_iesuxx.getElementsByTagName( 'time' )[0].firstChild.data; var new_time = status.getElementsByTagName( 'time' )[0].firstChild.data;
if( old_time > new_time ) if( old_time > new_time )
setTimeout('update_playlist()',50); setTimeout('update_playlist()',50);
old_time = new_time; old_time = new_time;
set_text( 'time', format_time( new_time ) ); set_text( 'time', format_time( new_time ) );
set_text( 'length', format_time( status_iesuxx.getElementsByTagName( 'length' )[0].firstChild.data ) ); set_text( 'length', format_time( status.getElementsByTagName( 'length' )[0].firstChild.data ) );
if( status_iesuxx.getElementsByTagName( 'volume' ).length != 0 ) if( status.getElementsByTagName( 'volume' ).length != 0 )
set_text( 'volume', Math.floor(status_iesuxx.getElementsByTagName( 'volume' )[0].firstChild.data/5.12)+'%' ); set_text( 'volume', Math.floor(status.getElementsByTagName( 'volume' )[0].firstChild.data/5.12)+'%' );
set_text( 'state', status_iesuxx.getElementsByTagName( 'state' )[0].firstChild.data ); set_text( 'state', status.getElementsByTagName( 'state' )[0].firstChild.data );
if( status_iesuxx.getElementsByTagName( 'state' )[0].firstChild.data == "playing" ) if( status.getElementsByTagName( 'state' )[0].firstChild.data == "playing" )
{ {
document.getElementById( 'btn_pause_img' ).setAttribute( 'src', 'images/pause.png' ); document.getElementById( 'btn_pause_img' ).setAttribute( 'src', 'images/pause.png' );
} }
...@@ -333,27 +333,27 @@ function parse_playlist() ...@@ -333,27 +333,27 @@ function parse_playlist()
{ {
if( req.status == 200 ) if( req.status == 200 )
{ {
answer = req.responseXML.documentElement; var answer = req.responseXML.documentElement;
playtree_iesuxx = document.getElementById( 'playtree' ); var playtree = document.getElementById( 'playtree' );
pos = document.createElement( "div" ); var pos = document.createElement( "div" );
pos_top = pos; var pos_top = pos;
elt = answer.firstChild; var elt = answer.firstChild;
while( elt ) while( elt )
{ {
if( elt.nodeName == "node" ) if( elt.nodeName == "node" )
{ {
if( pos.hasChildNodes() ) if( pos.hasChildNodes() )
pos.appendChild( document.createElement( "br" ) ); pos.appendChild( document.createElement( "br" ) );
nda = document.createElement( 'a' ); var nda = document.createElement( 'a' );
pos.appendChild( nda ); pos.appendChild( nda );
nda.setAttribute( 'href', 'javascript:toggle_show_node(\''+elt.getAttribute( 'id' )+'\');' ); nda.setAttribute( 'href', 'javascript:toggle_show_node(\''+elt.getAttribute( 'id' )+'\');' );
ndai = document.createElement( 'img' ); var ndai = document.createElement( 'img' );
nda.appendChild( ndai ); nda.appendChild( ndai );
ndai.setAttribute( 'src', 'images/minus.png' ); ndai.setAttribute( 'src', 'images/minus.png' );
ndai.setAttribute( 'alt', '[-]' ); ndai.setAttribute( 'alt', '[-]' );
ndai.setAttribute( 'id', 'pl_img_'+elt.getAttribute( 'id' ) ); ndai.setAttribute( 'id', 'pl_img_'+elt.getAttribute( 'id' ) );
pos.appendChild( document.createTextNode( ' ' + elt.getAttribute( 'name' ) ) ); pos.appendChild( document.createTextNode( ' ' + elt.getAttribute( 'name' ) ) );
nd = document.createElement( "div" ); var nd = document.createElement( "div" );
pos.appendChild( nd ); pos.appendChild( nd );
nd.setAttribute( 'class', 'pl_node' ); nd.setAttribute( 'class', 'pl_node' );
nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) ); nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) );
...@@ -362,7 +362,7 @@ function parse_playlist() ...@@ -362,7 +362,7 @@ function parse_playlist()
{ {
if( pos.hasChildNodes() ) if( pos.hasChildNodes() )
pos.appendChild( document.createElement( "br" ) ); pos.appendChild( document.createElement( "br" ) );
pl = document.createElement( "a" ); var pl = document.createElement( "a" );
pos.appendChild( pl ); pos.appendChild( pl );
pl.setAttribute( 'class', 'pl_leaf' ); pl.setAttribute( 'class', 'pl_leaf' );
pl.setAttribute( 'href', 'javascript:pl_play('+elt.getAttribute( 'id' )+');' ); pl.setAttribute( 'href', 'javascript:pl_play('+elt.getAttribute( 'id' )+');' );
...@@ -376,7 +376,7 @@ function parse_playlist() ...@@ -376,7 +376,7 @@ 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( document.createTextNode( ' ' ) ); pos.appendChild( document.createTextNode( ' ' ) );
del = document.createElement( "a" ); var del = document.createElement( "a" );
pos.appendChild( del ); pos.appendChild( del );
del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' ); del.setAttribute( 'href', 'javascript:pl_delete('+elt.getAttribute( 'id' )+')' );
del.appendChild( document.createElement( "img" ) ); del.appendChild( document.createElement( "img" ) );
...@@ -400,9 +400,9 @@ function parse_playlist() ...@@ -400,9 +400,9 @@ function parse_playlist()
pos = pos.parentNode; pos = pos.parentNode;
} }
} }
while( playtree_iesuxx.hasChildNodes() ) while( playtree.hasChildNodes() )
playtree_iesuxx.removeChild( playtree_iesuxx.firstChild ); playtree.removeChild( playtree.firstChild );
playtree_iesuxx.appendChild( pos_top ); playtree.appendChild( pos_top );
} }
else else
{ {
...@@ -418,10 +418,10 @@ function parse_browse_dir( ) ...@@ -418,10 +418,10 @@ function parse_browse_dir( )
{ {
if( req.status == 200 ) if( req.status == 200 )
{ {
answer = req.responseXML.documentElement; var answer = req.responseXML.documentElement;
browser_iesuxx = document.getElementById( 'browser' ); var browser = document.getElementById( 'browser' );
pos = document.createElement( "div" ); var pos = document.createElement( "div" );
elt = answer.firstChild; var elt = answer.firstChild;
while( elt ) while( elt )
{ {
if( elt.nodeName == "element" ) if( elt.nodeName == "element" )
...@@ -449,9 +449,9 @@ function parse_browse_dir( ) ...@@ -449,9 +449,9 @@ function parse_browse_dir( )
} }
elt = elt.nextSibling; elt = elt.nextSibling;
} }
while( browser_iesuxx.hasChildNodes() ) while( browser.hasChildNodes() )
browser_iesuxx.removeChild( browser_iesuxx.firstChild ); browser.removeChild( browser.firstChild );
browser_iesuxx.appendChild( pos ); browser.appendChild( pos );
} }
else else
{ {
...@@ -474,7 +474,7 @@ function hide_input( ) ...@@ -474,7 +474,7 @@ function hide_input( )
/* FIXME ... subs support */ /* FIXME ... subs support */
function update_input_file() function update_input_file()
{ {
mrl = document.getElementById( 'input_mrl' ); var mrl = document.getElementById( 'input_mrl' );
mrl.value = value( 'input_file_filename' ); mrl.value = value( 'input_file_filename' );
} }
...@@ -482,19 +482,19 @@ function update_input_file() ...@@ -482,19 +482,19 @@ function update_input_file()
/* update the input MRL using data from the input disc helper */ /* update the input MRL using data from the input disc helper */
function update_input_disc() function update_input_disc()
{ {
mrl = document.getElementById( 'input_mrl' ); var mrl = document.getElementById( 'input_mrl' );
type = radio_value( "input_disc_type" ); var type = radio_value( "input_disc_type" );
device = value( "input_disc_dev" ); var device = value( "input_disc_dev" );
check_and_replace_int( 'input_disc_title', 0 ); check_and_replace_int( 'input_disc_title', 0 );
check_and_replace_int( 'input_disc_chapter', 0 ); check_and_replace_int( 'input_disc_chapter', 0 );
check_and_replace_int( 'input_disc_subtrack', '' ); check_and_replace_int( 'input_disc_subtrack', '' );
check_and_replace_int( 'input_disc_audiotrack', 0 ); check_and_replace_int( 'input_disc_audiotrack', 0 );
title = value( 'input_disc_title' ); var title = value( 'input_disc_title' );
chapter = value( 'input_disc_chapter' ); var chapter = value( 'input_disc_chapter' );
subs = value( 'input_disc_subtrack' ); var subs = value( 'input_disc_subtrack' );
audio = value( 'input_disc_audiotrack' ); var audio = value( 'input_disc_audiotrack' );
mrl.value = ""; mrl.value = "";
...@@ -537,8 +537,8 @@ function update_input_disc() ...@@ -537,8 +537,8 @@ function update_input_disc()
/* update the input MRL using data from the input network helper */ /* update the input MRL using data from the input network helper */
function update_input_net() function update_input_net()
{ {
mrl = document.getElementById( 'input_mrl' ); var mrl = document.getElementById( 'input_mrl' );
type = radio_value( "input_net_type" ); var type = radio_value( "input_net_type" );
check_and_replace_int( 'input_net_udp_port', 1234 ); check_and_replace_int( 'input_net_udp_port', 1234 );
check_and_replace_int( 'input_net_udpmcast_port', 1234 ); check_and_replace_int( 'input_net_udpmcast_port', 1234 );
...@@ -561,7 +561,7 @@ function update_input_net() ...@@ -561,7 +561,7 @@ function update_input_net()
} }
else if( type == "http" ) else if( type == "http" )
{ {
url = value( 'input_net_http_url' ); var url = value( 'input_net_http_url' );
if( url.substring(0,7) != "http://" if( url.substring(0,7) != "http://"
&& url.substring(0,8) != "https://" && url.substring(0,8) != "https://"
&& url.substring(0,6) != "ftp://" && url.substring(0,6) != "ftp://"
...@@ -572,7 +572,7 @@ function update_input_net() ...@@ -572,7 +572,7 @@ function update_input_net()
} }
else if( type == "rtsp" ) else if( type == "rtsp" )
{ {
url = value( 'input_net_rtsp_url' ); var url = value( 'input_net_rtsp_url' );
if( url.substring(0,7) != "rtsp://" ) if( url.substring(0,7) != "rtsp://" )
mrl.value += "rtsp://"; mrl.value += "rtsp://";
mrl.value += url; mrl.value += url;
...@@ -588,8 +588,8 @@ function update_input_net() ...@@ -588,8 +588,8 @@ function update_input_net()
/* toggle show the full sout interface */ /* toggle show the full sout interface */
function toggle_show_sout_helper() function toggle_show_sout_helper()
{ {
element = document.getElementById( "sout_helper" ); var element = document.getElementById( "sout_helper" );
if( element.style.display == 'block' ) if( element.style.display == 'block' )
{ {
element.style.display = 'none'; element.style.display = 'none';
document.getElementById( "sout_helper_toggle" ).value = 'Full sout interface'; document.getElementById( "sout_helper_toggle" ).value = 'Full sout interface';
...@@ -604,7 +604,7 @@ function toggle_show_sout_helper() ...@@ -604,7 +604,7 @@ function toggle_show_sout_helper()
/* update the sout MRL using data from the sout_helper */ /* update the sout MRL using data from the sout_helper */
function update_sout() function update_sout()
{ {
mrl = document.getElementById( 'sout_mrl' ); var mrl = document.getElementById( 'sout_mrl' );
mrl.value = ""; mrl.value = "";
check_and_replace_int( 'sout_http_port', 8080 ); check_and_replace_int( 'sout_http_port', 8080 );
...@@ -624,13 +624,13 @@ function update_sout() ...@@ -624,13 +624,13 @@ function update_sout()
enable( 'sout_sub' ); enable( 'sout_sub' );
} }
transcode = checked( 'sout_vcodec_s' ) || checked( 'sout_acodec_s' ) var transcode = checked( 'sout_vcodec_s' ) || checked( 'sout_acodec_s' )
|| checked( 'sout_sub' ) || checked( 'sout_soverlay' ); || checked( 'sout_sub' ) || checked( 'sout_soverlay' );
if( transcode ) if( transcode )
{ {
mrl.value += ":sout=#transcode{"; mrl.value += ":sout=#transcode{";
alot = false; /* alot == at least one transcode */ var alot = false; /* alot == at least one transcode */
if( checked( 'sout_vcodec_s' ) ) if( checked( 'sout_vcodec_s' ) )
{ {
mrl.value += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' ); mrl.value += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' );
...@@ -659,9 +659,9 @@ function update_sout() ...@@ -659,9 +659,9 @@ function update_sout()
mrl.value += "}"; mrl.value += "}";
} }
output = checked( 'sout_display' ) + checked( 'sout_file' ) var output = checked( 'sout_display' ) + checked( 'sout_file' )
+ checked( 'sout_http' ) + checked( 'sout_mmsh' ) + checked( 'sout_http' ) + checked( 'sout_mmsh' )
+ checked( 'sout_rtp' ) + checked( 'sout_udp' ); + checked( 'sout_rtp' ) + checked( 'sout_udp' );
if( output ) if( output )
{ {
...@@ -669,9 +669,9 @@ function update_sout() ...@@ -669,9 +669,9 @@ function update_sout()
mrl.value += ":"; mrl.value += ":";
else else
mrl.value += ":sout=#"; mrl.value += ":sout=#";
aloo = false; /* aloo == at least one output */ var aloo = false; /* aloo == at least one output */
mux = radio_value( 'sout_mux' ); var mux = radio_value( 'sout_mux' );
ttl = parseInt( value( 'sout_ttl' ) ); var ttl = parseInt( value( 'sout_ttl' ) );
if( output > 1 ) mrl.value += "duplicate{"; if( output > 1 ) mrl.value += "duplicate{";
if( checked( 'sout_display' ) ) if( checked( 'sout_display' ) )
{ {
...@@ -799,12 +799,12 @@ function loop_refresh_status() ...@@ -799,12 +799,12 @@ function loop_refresh_status()
} }
function loop_refresh_playlist() function loop_refresh_playlist()
{ {
/* setTimeout( 'loop_refresh_playlist()', 10000 ); */ /* setTimeout( 'loop_refresh_playlist()', 10000 ); */
update_playlist(); update_playlist();
} }
function loop_refresh() function loop_refresh()
{ {
setTimeout('loop_refresh_status()',0); setTimeout( 'loop_refresh_status()', 1 );
setTimeout('loop_refresh_playlist()',0); setTimeout( 'loop_refresh_playlist()', 1 );
} }
...@@ -110,9 +110,9 @@ function toggle_schedule_repeat() ...@@ -110,9 +110,9 @@ function toggle_schedule_repeat()
function vlm_schedule_type_change( name ) function vlm_schedule_type_change( name )
{ {
act = document.getElementById( 'vlm_elt_' + name + '_action' ).value; var act = document.getElementById( 'vlm_elt_' + name + '_action' ).value;
itemname = document.getElementById( 'vlm_elt_' + name + '_name' ); var itemname = document.getElementById( 'vlm_elt_' + name + '_name' );
opt = document.getElementById( 'vlm_elt_' + name + '_opt' ); var opt = document.getElementById( 'vlm_elt_' + name + '_opt' );
if( act == "play" || act == "pause" || act == "stop" ) if( act == "play" || act == "pause" || act == "stop" )
{ {
itemname.style.display = ""; itemname.style.display = "";
...@@ -132,7 +132,7 @@ function vlm_schedule_type_change( name ) ...@@ -132,7 +132,7 @@ function vlm_schedule_type_change( name )
function update_vlm_add_broadcast() function update_vlm_add_broadcast()
{ {
cmd = document.getElementById( 'vlm_command' ); var cmd = document.getElementById( 'vlm_command' );
if( value( 'vlm_broadcast_name' ) ) if( value( 'vlm_broadcast_name' ) )
{ {
...@@ -167,7 +167,7 @@ function update_vlm_add_broadcast() ...@@ -167,7 +167,7 @@ function update_vlm_add_broadcast()
function update_vlm_add_vod() function update_vlm_add_vod()
{ {
cmd = document.getElementById( 'vlm_command' ); var cmd = document.getElementById( 'vlm_command' );
if( value( 'vlm_vod_name' ) ) if( value( 'vlm_vod_name' ) )
{ {
...@@ -197,7 +197,7 @@ function update_vlm_add_vod() ...@@ -197,7 +197,7 @@ function update_vlm_add_vod()
function update_vlm_add_schedule() function update_vlm_add_schedule()
{ {
cmd = document.getElementById( 'vlm_command' ); var cmd = document.getElementById( 'vlm_command' );
check_and_replace_int( 'vlm_schedule_year', '0000' ); check_and_replace_int( 'vlm_schedule_year', '0000' );
check_and_replace_int( 'vlm_schedule_month', '00' ); check_and_replace_int( 'vlm_schedule_month', '00' );
...@@ -249,7 +249,7 @@ function update_vlm_add_schedule() ...@@ -249,7 +249,7 @@ function update_vlm_add_schedule()
function update_vlm_add_other() function update_vlm_add_other()
{ {
cmd = document.getElementById( 'vlm_command' ); var cmd = document.getElementById( 'vlm_command' );
cmd.value = ""; cmd.value = "";
} }
...@@ -269,7 +269,7 @@ function clear_children( elt ) ...@@ -269,7 +269,7 @@ function clear_children( elt )
function create_button( caption, action ) function create_button( caption, action )
{ {
link = document.createElement( "input" ); var link = document.createElement( "input" );
link.setAttribute( 'type', 'button' ); link.setAttribute( 'type', 'button' );
link.setAttribute( 'onclick', action ); link.setAttribute( 'onclick', action );
link.setAttribute( 'value', caption ); link.setAttribute( 'value', caption );
...@@ -277,7 +277,7 @@ function create_button( caption, action ) ...@@ -277,7 +277,7 @@ function create_button( caption, action )
} }
function create_option( caption, value ) function create_option( caption, value )
{ {
opt = document.createElement( 'option' ); var opt = document.createElement( 'option' );
opt.setAttribute( 'value', value ); opt.setAttribute( 'value', value );
opt.appendChild( document.createTextNode( caption ) ); opt.appendChild( document.createTextNode( caption ) );
return opt; return opt;
...@@ -289,9 +289,9 @@ function parse_vlm_cmd() ...@@ -289,9 +289,9 @@ function parse_vlm_cmd()
{ {
if( req.status == 200 ) if( req.status == 200 )
{ {
vlm_answer = req.responseXML.documentElement; var vlm_answer = req.responseXML.documentElement;
error_tag = vlm_answer.getElementsByTagName( 'error' )[0]; var error_tag = vlm_answer.getElementsByTagName( 'error' )[0];
vlme = document.getElementById( 'vlm_error' ); var vlme = document.getElementById( 'vlm_error' );
clear_children( vlme ); clear_children( vlme );
if( error_tag.hasChildNodes() ) if( error_tag.hasChildNodes() )
{ {
...@@ -317,9 +317,9 @@ function parse_vlm_elements() ...@@ -317,9 +317,9 @@ function parse_vlm_elements()
{ {
if( req.status == 200 ) if( req.status == 200 )
{ {
vlmb = document.getElementById( 'vlm_broadcast_list' ); var vlmb = document.getElementById( 'vlm_broadcast_list' );
vlmv = document.getElementById( 'vlm_vod_list' ); var vlmv = document.getElementById( 'vlm_vod_list' );
vlms = document.getElementById( 'vlm_schedule_list' ); var vlms = document.getElementById( 'vlm_schedule_list' );
clear_children( vlmb ); clear_children( vlmb );
clear_children( vlmv ); clear_children( vlmv );
...@@ -327,13 +327,13 @@ function parse_vlm_elements() ...@@ -327,13 +327,13 @@ function parse_vlm_elements()
answer = req.responseXML.documentElement; answer = req.responseXML.documentElement;
elt = answer.firstChild; var elt = answer.firstChild;
while( elt ) while( elt )
{ {
if( elt.nodeName == "broadcast" || elt.nodeName == "vod" ) if( elt.nodeName == "broadcast" || elt.nodeName == "vod" )
{ {
nb = document.createElement( 'div' ); var nb = document.createElement( 'div' );
nb.setAttribute( 'class', 'list_element' ); nb.setAttribute( 'class', 'list_element' );
if( elt.nodeName == "broadcast" ) if( elt.nodeName == "broadcast" )
{ {
...@@ -343,11 +343,11 @@ function parse_vlm_elements() ...@@ -343,11 +343,11 @@ function parse_vlm_elements()
{ {
vlmv.appendChild( nb ); vlmv.appendChild( nb );
} }
nbname = document.createElement( 'b' ); var nbname = document.createElement( 'b' );
nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
nb.appendChild( nbname ); nb.appendChild( nbname );
link = document.createElement( 'input' ); var link = document.createElement( 'input' );
link.setAttribute( 'type', 'button' ); link.setAttribute( 'type', 'button' );
if( elt.getAttribute( 'enabled' ) == 'yes' ) if( elt.getAttribute( 'enabled' ) == 'yes' )
{ {
...@@ -399,20 +399,20 @@ function parse_vlm_elements() ...@@ -399,20 +399,20 @@ function parse_vlm_elements()
nb.appendChild( document.createTextNode( " " ) ); nb.appendChild( document.createTextNode( " " ) );
nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) ); nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
list = document.createElement( "ul" ); var list = document.createElement( "ul" );
/* begin input list */ /* begin input list */
inputs = elt.getElementsByTagName( 'input' ); var inputs = elt.getElementsByTagName( 'input' );
for( i = 0; i < inputs.length; i++ ) for( i = 0; i < inputs.length; i++ )
{ {
item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( "Input: " + inputs[i].firstChild.data + " " ) ); item.appendChild( document.createTextNode( "Input: " + inputs[i].firstChild.data + " " ) );
item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) ); item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) );
list.appendChild( item ); list.appendChild( item );
} }
/* Add input */ /* Add input */
item = document.createElement( "li" ); var item = document.createElement( "li" );
text = document.createElement( "input" ); var text = document.createElement( "input" );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'size', '40' ); text.setAttribute( 'size', '40' );
text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_input' ); text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_input' );
...@@ -426,7 +426,7 @@ function parse_vlm_elements() ...@@ -426,7 +426,7 @@ function parse_vlm_elements()
/* end of input list */ /* end of input list */
/* output */ /* output */
item = document.createElement( "li" ); var item = document.createElement( "li" );
outputelt = elt.getElementsByTagName( 'output' )[0]; outputelt = elt.getElementsByTagName( 'output' )[0];
if( outputelt.hasChildNodes() ) if( outputelt.hasChildNodes() )
{ {
...@@ -437,7 +437,7 @@ function parse_vlm_elements() ...@@ -437,7 +437,7 @@ function parse_vlm_elements()
output = ""; output = "";
} }
item.appendChild( document.createTextNode( 'Output: ' ) ); item.appendChild( document.createTextNode( 'Output: ' ) );
text = document.createElement( "input" ); var text = document.createElement( "input" );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_output' ); text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_output' );
text.setAttribute( 'value', output ); text.setAttribute( 'value', output );
...@@ -452,18 +452,18 @@ function parse_vlm_elements() ...@@ -452,18 +452,18 @@ function parse_vlm_elements()
/* end of output */ /* end of output */
/* begin options list */ /* begin options list */
options = elt.getElementsByTagName( 'option' ); var options = elt.getElementsByTagName( 'option' );
for( i = 0; i < options.length; i++ ) for( i = 0; i < options.length; i++ )
{ {
item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( "Option: " + options[i].firstChild.data ) ); item.appendChild( document.createTextNode( "Option: " + options[i].firstChild.data ) );
list.appendChild( item ); list.appendChild( item );
} }
/* Add option */ /* Add option */
item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( ' ' ) ); item.appendChild( document.createTextNode( ' ' ) );
text = document.createElement( "input" ); var text = document.createElement( "input" );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'size', '40' ); text.setAttribute( 'size', '40' );
text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_option' ); text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_option' );
...@@ -479,15 +479,15 @@ function parse_vlm_elements() ...@@ -479,15 +479,15 @@ function parse_vlm_elements()
} }
else if( elt.nodeName == "schedule" ) else if( elt.nodeName == "schedule" )
{ {
nb = document.createElement( 'div' ); var nb = document.createElement( 'div' );
nb.setAttribute( 'class', 'list_element' ); nb.setAttribute( 'class', 'list_element' );
vlms.appendChild( nb ); vlms.appendChild( nb );
nbname = document.createElement( 'b' ); var nbname = document.createElement( 'b' );
nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
nb.appendChild( nbname ); nb.appendChild( nbname );
link = document.createElement( 'input' ); var link = document.createElement( 'input' );
link.setAttribute( 'type', 'button' ); link.setAttribute( 'type', 'button' );
if( elt.getAttribute( 'enabled' ) == 'yes' ) if( elt.getAttribute( 'enabled' ) == 'yes' )
{ {
...@@ -506,17 +506,17 @@ function parse_vlm_elements() ...@@ -506,17 +506,17 @@ function parse_vlm_elements()
nb.appendChild( document.createTextNode( " " ) ); nb.appendChild( document.createTextNode( " " ) );
nb.appendChild( create_button( "Delete", 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) ); nb.appendChild( create_button( "Delete", 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
list = document.createElement( 'ul' ); var list = document.createElement( 'ul' );
item = document.createElement( 'li' ); var item = document.createElement( 'li' );
item.appendChild( document.createTextNode( "Date: " + elt.getAttribute( 'date' ) ) ); item.appendChild( document.createTextNode( "Date: " + elt.getAttribute( 'date' ) ) );
list.appendChild( item ); list.appendChild( item );
item = document.createElement( 'li' ); var item = document.createElement( 'li' );
item.appendChild( document.createTextNode( "Period (in seconds): " + elt.getAttribute( 'period' ) ) ); item.appendChild( document.createTextNode( "Period (in seconds): " + elt.getAttribute( 'period' ) ) );
list.appendChild( item ); list.appendChild( item );
item = document.createElement( 'li' ); var item = document.createElement( 'li' );
if( elt.getAttribute( 'repeat' ) == -1 ) if( elt.getAttribute( 'repeat' ) == -1 )
{ {
item.appendChild( document.createTextNode( "Number of repeats left: for ever" ) ); item.appendChild( document.createTextNode( "Number of repeats left: for ever" ) );
...@@ -527,16 +527,16 @@ function parse_vlm_elements() ...@@ -527,16 +527,16 @@ function parse_vlm_elements()
} }
list.appendChild( item ); list.appendChild( item );
commands = elt.getElementsByTagName( 'command' ); var commands = elt.getElementsByTagName( 'command' );
for( i = 0; i < commands.length; i++ ) for( i = 0; i < commands.length; i++ )
{ {
item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( "Command: " + commands[i].firstChild.data + " " ) ); item.appendChild( document.createTextNode( "Command: " + commands[i].firstChild.data + " " ) );
list.appendChild( item ); list.appendChild( item );
} }
item = document.createElement( 'li' ); var item = document.createElement( 'li' );
sel = document.createElement( 'select' ); var sel = document.createElement( 'select' );
sel.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_action' ); sel.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_action' );
sel.setAttribute( 'onchange', 'vlm_schedule_type_change("'+elt.getAttribute('name')+'");'); sel.setAttribute( 'onchange', 'vlm_schedule_type_change("'+elt.getAttribute('name')+'");');
sel.appendChild( create_option( 'play', 'play' ) ); sel.appendChild( create_option( 'play', 'play' ) );
...@@ -547,7 +547,7 @@ function parse_vlm_elements() ...@@ -547,7 +547,7 @@ function parse_vlm_elements()
item.appendChild( sel ); item.appendChild( sel );
item.appendChild( document.createTextNode( " " ) ); item.appendChild( document.createTextNode( " " ) );
text = document.createElement( 'input' ); var text = document.createElement( 'input' );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_name' ); text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_name' );
text.setAttribute( 'size', '10' ); text.setAttribute( 'size', '10' );
...@@ -677,11 +677,13 @@ function vlm_batch( batch ) ...@@ -677,11 +677,13 @@ function vlm_batch( batch )
function vlm_schedule_append( name ) function vlm_schedule_append( name )
{ {
act = document.getElementById( 'vlm_elt_' + name + '_action' ).value; var act = document.getElementById( 'vlm_elt_' + name + '_action' ).value;
document.getElementById( 'vlm_command' ).value = "setup " + name + " append "; document.getElementById( 'vlm_command' ).value = "setup " + name + " append ";
itemname = document.getElementById( 'vlm_elt_' + name + '_name' ).value;
var itemname = document.getElementById( 'vlm_elt_' + name + '_name' ).value;
if( itemname == "(name)" ) itemname = ""; if( itemname == "(name)" ) itemname = "";
opt = document.getElementById( 'vlm_elt_' + name + '_opt' ).value;
var opt = document.getElementById( 'vlm_elt_' + name + '_opt' ).value;
if( opt == "(options)" ) opt = ""; if( opt == "(options)" ) opt = "";
if( act == '' ) if( act == '' )
......
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