1 /*****************************************************************************
2 * vlm.js: VLC media player web interface
3 *****************************************************************************
4 * Copyright (C) 2005-2006 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /* replace quotes and spaces by underscores */
25 function addunderscores( str ){ return str.replace(/\'|\"| /g, '_'); }
27 /**********************************************************************
28 * Input dialog functions
29 *********************************************************************/
31 function toggle_show_vlm_helper()
33 var vlmh = document.getElementById( "vlm_helper" );
34 var vlmhctrl = document.getElementById( "vlm_helper_controls" );
35 var btn = document.getElementById( "btn_vlm_helper_toggle" );
36 if( vlmh.style.display == 'block' || vlmh.style.display == '')
38 vlmh.style.display = 'none';
39 vlmhctrl.style.display = 'none';
40 btn.removeChild( btn.firstChild );
41 btn.appendChild( document.createTextNode( 'Show VLM helper' ) );
45 vlmh.style.display = 'block';
46 vlmhctrl.style.display = 'inline';
47 btn.removeChild( btn.firstChild );
48 btn.appendChild( document.createTextNode( 'Hide VLM helper' ) );
52 function vlm_input_edit( dest )
54 document.getElementById( 'input_dest' ).value = dest;
58 function vlm_input_change()
60 document.getElementById( value( 'input_dest' ) ).value = value( 'input_mrl' ).replace( /\ :/g, " option " );
62 document.getElementById( value( 'input_dest' ) ).focus();
65 function vlm_output_edit( dest )
67 document.getElementById( 'sout_dest' ).value = dest;
71 function vlm_output_change()
73 document.getElementById( value( 'sout_dest' ) ).value = value( 'sout_mrl' ).substr(6).replace( /\ :/g, " option " ); /* substr <-> remove :sout= */
75 document.getElementById( value( 'sout_dest' ) ).focus();
78 function hide_vlm_add()
80 document.getElementById( 'vlm_add_broadcast' ).style.display = 'none';
81 document.getElementById( 'vlm_add_vod' ).style.display = 'none';
82 document.getElementById( 'vlm_add_schedule' ).style.display = 'none';
83 document.getElementById( 'vlm_add_other' ).style.display = 'none';
86 function toggle_schedule_date()
88 if( checked( 'vlm_schedule_now' ) )
90 disable( 'vlm_schedule_year' );
91 disable( 'vlm_schedule_month' );
92 disable( 'vlm_schedule_day' );
93 disable( 'vlm_schedule_hour' );
94 disable( 'vlm_schedule_minute' );
95 disable( 'vlm_schedule_second' );
99 enable( 'vlm_schedule_year' );
100 enable( 'vlm_schedule_month' );
101 enable( 'vlm_schedule_day' );
102 enable( 'vlm_schedule_hour' );
103 enable( 'vlm_schedule_minute' );
104 enable( 'vlm_schedule_second' );
108 function toggle_schedule_repeat()
110 if( checked( 'vlm_schedule_repeat' ) )
112 enable( 'vlm_schedule_period_year' );
113 enable( 'vlm_schedule_period_month' );
114 enable( 'vlm_schedule_period_day' );
115 enable( 'vlm_schedule_period_hour' );
116 enable( 'vlm_schedule_period_minute' );
117 enable( 'vlm_schedule_period_second' );
118 enable( 'vlm_schedule_repeat_times' );
122 disable( 'vlm_schedule_period_year' );
123 disable( 'vlm_schedule_period_month' );
124 disable( 'vlm_schedule_period_day' );
125 disable( 'vlm_schedule_period_hour' );
126 disable( 'vlm_schedule_period_minute' );
127 disable( 'vlm_schedule_period_second' );
128 disable( 'vlm_schedule_repeat_times' );
132 function vlm_schedule_type_change( name )
134 var act = document.getElementById( 'vlm_elt_' + name + '_action' ).value;
135 var itemname = document.getElementById( 'vlm_elt_' + name + '_name' );
136 var opt = document.getElementById( 'vlm_elt_' + name + '_opt' );
137 if( act == "play" || act == "pause" || act == "stop" )
139 itemname.style.display = "";
140 opt.style.display = "none";
142 else if( act == "seek" )
144 itemname.style.display = "";
145 opt.style.display = "";
149 itemname.style.display = "none";
150 opt.style.display = "";
154 function update_vlm_add_broadcast()
156 var cmd = document.getElementById( 'vlm_command' );
158 if( value( 'vlm_broadcast_name' ) )
160 cmd.value = "new " + addunderscores( value( 'vlm_broadcast_name' ) )
163 if( checked( 'vlm_broadcast_enabled' ) )
165 cmd.value += " enabled";
168 if( checked( 'vlm_broadcast_loop' ) )
170 cmd.value += " loop";
173 if( value( 'vlm_broadcast_input' ) )
175 cmd.value += " input " + value( 'vlm_broadcast_input' );
178 if( value( 'vlm_broadcast_output' ) )
180 cmd.value += " output " + value( 'vlm_broadcast_output' );
189 function update_vlm_add_vod()
191 var cmd = document.getElementById( 'vlm_command' );
193 if( value( 'vlm_vod_name' ) )
195 cmd.value = "new " + addunderscores( value( 'vlm_vod_name' ) )
198 if( checked( 'vlm_vod_enabled' ) )
200 cmd.value += " enabled";
203 if( value( 'vlm_vod_input' ) )
205 cmd.value += " input " + value( 'vlm_vod_input' );
208 if( value( 'vlm_vod_output' ) )
210 cmd.value += " output " + value( 'vlm_vod_output' );
219 function update_vlm_add_schedule()
221 var cmd = document.getElementById( 'vlm_command' );
223 check_and_replace_int( 'vlm_schedule_year', '0000' );
224 check_and_replace_int( 'vlm_schedule_month', '00' );
225 check_and_replace_int( 'vlm_schedule_day', '00' );
226 check_and_replace_int( 'vlm_schedule_hour', '00' );
227 check_and_replace_int( 'vlm_schedule_minute', '00' );
228 check_and_replace_int( 'vlm_schedule_second', '00' );
229 check_and_replace_int( 'vlm_schedule_period_year', '0000' );
230 check_and_replace_int( 'vlm_schedule_period_month', '00' );
231 check_and_replace_int( 'vlm_schedule_period_day', '00' );
232 check_and_replace_int( 'vlm_schedule_period_hour', '00' );
233 check_and_replace_int( 'vlm_schedule_period_minute', '00' );
234 check_and_replace_int( 'vlm_schedule_period_second', '00' );
236 if( value( 'vlm_schedule_name' ) )
238 cmd.value = "new " + addunderscores( value( 'vlm_schedule_name' ) ) + " schedule";
240 if( checked( 'vlm_schedule_enabled' ) )
242 cmd.value += " enabled";
245 if( checked( 'vlm_schedule_now' ) )
247 cmd.value += " date now";
251 cmd.value += " date " + value( 'vlm_schedule_year' ) + "/" + value( 'vlm_schedule_month' ) + "/" + value( 'vlm_schedule_day' ) + '-' + value( 'vlm_schedule_hour' ) + ':' + value( 'vlm_schedule_minute' ) + ':' + value( 'vlm_schedule_second' );
254 if( checked( 'vlm_schedule_repeat' ) )
256 cmd.value += " period " + value( 'vlm_schedule_period_year' ) + "/" + value( 'vlm_schedule_period_month' ) + "/" + value( 'vlm_schedule_period_day' ) + '-' + value( 'vlm_schedule_period_hour' ) + ':' + value( 'vlm_schedule_period_minute' ) + ':' + value( 'vlm_schedule_period_second' );
258 if( value( 'vlm_schedule_repeat_times' ) != 0 )
260 cmd.value += " repeat " + (value( 'vlm_schedule_repeat_times' ) - 1 );
271 function update_vlm_add_other()
273 var cmd = document.getElementById( 'vlm_command' );
277 function clear_vlm_add()
279 document.getElementById( 'vlm_command' ).value = "";
280 document.getElementById( 'vlm_broadcast_name' ).value = "";
281 document.getElementById( 'vlm_vod_name' ).value = "";
284 function create_button( caption, action )
286 /* var link = document.createElement( "input" );
287 link.setAttribute( 'type', 'button' );*/
288 /* link.setAttribute( 'onclick', action ); */
289 /* Above doesn't work on ie. You need to use something like
290 * link.onclick = function() { alert( 'pouet' ); };
291 * instead ... conclusion: IE is crap */
292 /* link.setAttribute( 'value', caption );*/
294 var d = document.createElement( 'div' );
295 d.innerHTML = "<input type='button' onclick='"+action+"' value='"+caption+"' />"; /* other IE work around ... still crap. Use double quotes only in action */
296 var link = d.firstChild;
299 function create_option( caption, value )
301 var opt = document.createElement( 'option' );
302 opt.setAttribute( 'value', value );
303 opt.appendChild( document.createTextNode( caption ) );
307 function parse_vlm_cmd()
309 if( req.readyState == 4 )
311 if( req.status == 200 )
313 var vlm_answer = req.responseXML.documentElement;
314 var error_tag = vlm_answer.getElementsByTagName( 'error' )[0];
315 var vlme = document.getElementById( 'vlm_error' );
316 clear_children( vlme );
317 if( error_tag.hasChildNodes() )
319 vlme.appendChild( document.createTextNode( 'Error: ' + error_tag.firstChild.data ) );
320 vlme.style.color = "#f00";
324 vlme.appendChild( document.createTextNode( 'Command succesful (' + value( 'vlm_command' ) + ') ' ) );
325 vlme.style.color = "#0f0";
328 vlme.appendChild( create_button( 'clear', 'clear_children( document.getElementById( "vlm_error" ) );' ) );
335 function parse_vlm_elements()
337 if( req.readyState == 4 )
339 if( req.status == 200 )
341 var vlmb = document.getElementById( 'vlm_broadcast_list' );
342 var vlmv = document.getElementById( 'vlm_vod_list' );
343 var vlms = document.getElementById( 'vlm_schedule_list' );
345 clear_children( vlmb );
346 clear_children( vlmv );
347 clear_children( vlms );
349 answer = req.responseXML.documentElement;
351 var elt = answer.firstChild;
355 if( elt.nodeName == "broadcast" || elt.nodeName == "vod" )
357 var nb = document.createElement( 'div' );
358 setclass( nb, 'list_element' );
359 if( elt.nodeName == "broadcast" )
361 vlmb.appendChild( nb );
365 vlmv.appendChild( nb );
367 var nbname = document.createElement( 'b' );
368 nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
369 nb.appendChild( nbname );
371 if( elt.getAttribute( 'enabled' ) == 'yes' )
373 nb.appendChild( document.createTextNode( " enabled " ) );
374 nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
378 nb.appendChild( document.createTextNode( " disabled " ) );
379 nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
382 if( elt.nodeName == "broadcast" )
384 if( elt.getAttribute( 'loop' ) == 'yes' )
386 nb.appendChild( document.createTextNode( " loop " ) );
388 nb.appendChild( create_button( 'Un-loop', 'vlm_unloop("'+elt.getAttribute( 'name' ) + '");' ) );
392 nb.appendChild( document.createTextNode( " play once " ) );
393 nb.appendChild( create_button( 'Loop', 'vlm_loop("'+elt.getAttribute( 'name' ) + '");' ) );
397 if( elt.getAttribute( 'enabled' ) == 'yes' )
399 nb.appendChild( document.createTextNode( " " ) );
400 nb.appendChild( create_button( 'Play', 'vlm_play("'+elt.getAttribute('name')+'");' ) );
403 nb.appendChild( document.createTextNode( " " ) );
404 nb.appendChild( create_button( 'Pause', 'vlm_pause("'+elt.getAttribute('name')+'");' ) );
406 nb.appendChild( document.createTextNode( " " ) );
407 nb.appendChild( create_button( 'Stop', 'vlm_stop("'+elt.getAttribute('name')+'");' ) );
410 nb.appendChild( document.createTextNode( " " ) );
411 nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
413 var list = document.createElement( "ul" );
415 /* begin input list */
416 var item = document.createElement( "li" );
417 list.appendChild( item );
418 item.appendChild( document.createTextNode( "Inputs: " ) );
419 var text = document.createElement( "input" );
420 text.setAttribute( 'type', 'text' );
421 text.setAttribute( 'size', '40' );
422 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_input' );
423 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' );
424 item.appendChild( text );
425 item.appendChild( document.createTextNode( ' ' ) );
426 item.appendChild( create_button( 'Edit', 'vlm_input_edit("vlm_elt_'+elt.getAttribute('name')+'_input");') );
427 item.appendChild( document.createTextNode( ' ' ) );
428 item.appendChild( create_button( 'Add input', 'vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' ) );
430 var inputs = elt.getElementsByTagName( 'input' );
431 if( inputs.length > 0 )
433 var ilist = document.createElement( "ol" );
434 ilist.setAttribute( 'start', '1' );
435 item.appendChild( ilist );
436 for( i = 0; i < inputs.length; i++ )
438 var item = document.createElement( "li" );
439 item.appendChild( document.createTextNode( inputs[i].firstChild.data + " " ) );
440 item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) );
441 ilist.appendChild( item );
444 /* end of input list */
447 var item = document.createElement( "li" );
448 outputelt = elt.getElementsByTagName( 'output' )[0];
449 if( outputelt.hasChildNodes() )
451 output = outputelt.firstChild.data;
457 item.appendChild( document.createTextNode( 'Output: ' ) );
458 var text = document.createElement( "input" );
459 text.setAttribute( 'type', 'text' );
460 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_output' );
461 text.setAttribute( 'value', output );
462 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_output("'+elt.getAttribute( 'name' )+ '",document.getElementById("vlm_elt_'+elt.getAttribute( 'name' )+'_output").value);' );
463 item.appendChild( text );
465 item.appendChild( document.createTextNode( ' ' ) );
467 item.appendChild( create_button( 'Edit', 'vlm_output_edit("vlm_elt_'+elt.getAttribute('name')+'_output");' ) );
468 item.appendChild( document.createTextNode( ' ' ) );
469 item.appendChild( create_button( 'Change output', 'vlm_output("'+elt.getAttribute( 'name' )+ '",document.getElementById("vlm_elt_'+elt.getAttribute( 'name' )+'_output").value);' ) );
470 list.appendChild( item );
473 /* begin options list */
474 var item = document.createElement( "li" );
475 list.appendChild( item );
476 item.appendChild( document.createTextNode( "Options: " ) );
478 var text = document.createElement( "input" );
479 text.setAttribute( 'type', 'text' );
480 text.setAttribute( 'size', '40' );
481 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_option' );
482 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' );
483 item.appendChild( text );
484 item.appendChild( document.createTextNode( ' ' ) );
485 item.appendChild( create_button( 'Add option', 'vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' ) );
487 var options = elt.getElementsByTagName( 'option' );
488 if( options.length > 0 )
490 var olist = document.createElement( "ul" );
491 item.appendChild( olist );
492 for( i = 0; i < options.length; i++ )
494 var item = document.createElement( "li" );
495 item.appendChild( document.createTextNode( options[i].firstChild.data ) );
496 olist.appendChild( item );
502 var instances = elt.getElementsByTagName( 'instance' );
503 if( instances.length > 0 )
505 var item = document.createElement("li");
506 var ilist = document.createElement("ul");
507 list.appendChild( item );
508 item.appendChild(document.createTextNode("Instances:"));
509 item.appendChild( ilist );
510 for( i = 0; i < instances.length; i++ )
512 var iname = instances[i].getAttribute( 'name' );
513 var istate = instances[i].getAttribute( 'state' );
514 var iposition = Number( instances[i].getAttribute( 'position' ) * 100);
515 var itime = Math.floor( instances[i].getAttribute( 'time' ) / 1000000);
516 var ilength = Math.floor( instances[i].getAttribute( 'length' ) / 1000000);
517 var irate = instances[i].getAttribute( 'rate' );
518 var ititle = instances[i].getAttribute( 'title' );
519 var ichapter = instances[i].getAttribute( 'chapter' );
520 var iseekable = instances[i].getAttribute( 'seekable' );
521 var iplaylistindex = instances[i].getAttribute( 'playlistindex' );
523 var item = document.createElement( "li" );
524 item.appendChild( document.createTextNode( iname + ": " + istate + " (" + iplaylistindex + ") " + (iposition.toFixed(2)) + "%" + " " + format_time( itime ) + "/" + format_time( ilength ) ) );
525 ilist.appendChild( item );
528 /* end of instances list */
530 nb.appendChild( list );
533 else if( elt.nodeName == "schedule" )
535 var nb = document.createElement( 'div' );
536 setclass( nb, 'list_element' );
537 vlms.appendChild( nb );
539 var nbname = document.createElement( 'b' );
540 nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
541 nb.appendChild( nbname );
543 if( elt.getAttribute( 'enabled' ) == 'yes' )
545 nb.appendChild( document.createTextNode( " enabled " ) );
546 nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
550 nb.appendChild( document.createTextNode( " disabled " ) );
551 nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
554 nb.appendChild( document.createTextNode( " " ) );
555 nb.appendChild( create_button( "Delete", 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
557 var list = document.createElement( 'ul' );
559 var item = document.createElement( 'li' );
560 item.appendChild( document.createTextNode( "Date: " + elt.getAttribute( 'date' ) ) );
561 list.appendChild( item );
563 var item = document.createElement( 'li' );
564 item.appendChild( document.createTextNode( "Period (in seconds): " + elt.getAttribute( 'period' ) ) );
565 list.appendChild( item );
567 var item = document.createElement( 'li' );
568 if( elt.getAttribute( 'repeat' ) == -1 )
570 item.appendChild( document.createTextNode( "Number of repeats left: for ever" ) );
574 item.appendChild( document.createTextNode( "Number of repeats left: " + elt.getAttribute( 'repeat' ) ) );
576 list.appendChild( item );
578 var commands = elt.getElementsByTagName( 'command' );
579 for( i = 0; i < commands.length; i++ )
581 var item = document.createElement( "li" );
582 item.appendChild( document.createTextNode( "Command: " + commands[i].firstChild.data + " " ) );
583 list.appendChild( item );
586 var item = document.createElement( 'li' );
587 var sel = document.createElement( 'select' );
588 sel.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_action' );
589 sel.setAttribute( 'onchange', 'vlm_schedule_type_change("'+elt.getAttribute('name')+'");');
590 sel.appendChild( create_option( 'play', 'play' ) );
591 sel.appendChild( create_option( 'pause', 'pause' ) );
592 sel.appendChild( create_option( 'stop', 'stop' ) );
593 sel.appendChild( create_option( 'seek', 'seek' ) );
594 sel.appendChild( create_option( '(other)', '' ) );
595 item.appendChild( sel );
597 item.appendChild( document.createTextNode( " " ) );
598 var text = document.createElement( 'input' );
599 text.setAttribute( 'type', 'text' );
600 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_name' );
601 text.setAttribute( 'size', '10' );
602 text.setAttribute( 'value', '(name)' );
603 text.setAttribute( 'onfocus', 'if( this.value == "(name)" ) this.value = "";' );
604 text.setAttribute( 'onblur', 'if( this.value == "" ) this.value = "(name)";' );
605 item.appendChild( text );
607 item.appendChild( document.createTextNode( " " ) );
608 text = document.createElement( 'input' );
609 text.setAttribute( 'type', 'text' );
610 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_opt' );
611 text.setAttribute( 'size', '30' );
612 text.setAttribute( 'value', '(options)' );
613 text.setAttribute( 'onfocus', 'if( this.value == "(options)" ) this.value = "";' );
614 text.setAttribute( 'onblur', 'if( this.value == "" ) this.value = "(options)";' );
615 item.appendChild( text );
616 item.appendChild( document.createTextNode( " " ) );
617 item.appendChild( create_button( "Append command", 'vlm_schedule_append("' + elt.getAttribute( 'name' ) + '");') );
619 list.appendChild( item );
621 nb.appendChild( list );
622 vlm_schedule_type_change( elt.getAttribute('name') );
625 elt = elt.nextSibling;
631 function vlm_cmd( cmd )
633 loadXMLDoc( 'requests/vlm_cmd.xml?command='+cmd.replace(/\#/g, '%23'), parse_vlm_cmd );
636 function vlm_get_elements( )
638 loadXMLDoc( 'requests/vlm.xml', parse_vlm_elements );
641 /* helper functions */
643 function vlm_disable( name )
645 document.getElementById( 'vlm_command' ).value = "setup "+name+" disabled";
646 vlm_cmd( value( 'vlm_command' ) );
649 function vlm_enable( name )
651 document.getElementById( 'vlm_command' ).value = "setup "+name+" enabled";
652 vlm_cmd( value( 'vlm_command' ) );
655 function vlm_loop( name )
657 document.getElementById( 'vlm_command' ).value = "setup "+name+" loop";
658 vlm_cmd( value( 'vlm_command' ) );
661 function vlm_unloop( name )
663 document.getElementById( 'vlm_command' ).value = "setup "+name+" unloop";
664 vlm_cmd( value( 'vlm_command' ) );
667 function vlm_play( name )
669 document.getElementById( 'vlm_command' ).value = "control "+name+" play";
670 vlm_cmd( value( 'vlm_command' ) );
673 function vlm_pause( name )
675 document.getElementById( 'vlm_command' ).value = "control "+name+" pause";
676 vlm_cmd( value( 'vlm_command' ) );
679 function vlm_stop( name )
681 document.getElementById( 'vlm_command' ).value = "control "+name+" stop";
682 vlm_cmd( value( 'vlm_command' ) );
685 function vlm_delete( name )
687 document.getElementById( 'vlm_command' ).value = "del "+name;
688 vlm_cmd( value( 'vlm_command' ) );
691 function vlm_delete_input( name, num )
693 document.getElementById( 'vlm_command' ).value = "setup "+name+" inputdeln "+num;
694 vlm_cmd( value( 'vlm_command' ) );
697 function vlm_add_input( name, input )
699 document.getElementById( 'vlm_command' ).value = "setup "+name+" input "+input;
700 vlm_cmd( value( 'vlm_command' ) );
703 function vlm_output( name, output )
705 document.getElementById( 'vlm_command' ).value = "setup "+name+" output "+output;
706 vlm_cmd( value( 'vlm_command' ) );
709 function vlm_option( name, option )
711 document.getElementById( 'vlm_command' ).value = "setup "+name+" option "+option;
712 vlm_cmd( value( 'vlm_command' ) );
715 function vlm_batch( batch )
718 var commands = batch.split( '\n' );
719 for( i = 0; i < commands.length; i++ )
721 document.getElementById( 'vlm_command' ).value = commands[i];
722 vlm_cmd( value( 'vlm_command' ) );
726 function vlm_schedule_append( name )
728 var act = document.getElementById( 'vlm_elt_' + name + '_action' ).value;
729 document.getElementById( 'vlm_command' ).value = "setup " + name + " append ";
731 var itemname = document.getElementById( 'vlm_elt_' + name + '_name' ).value;
732 if( itemname == "(name)" ) itemname = "";
734 var opt = document.getElementById( 'vlm_elt_' + name + '_opt' ).value;
735 if( opt == "(options)" ) opt = "";
739 document.getElementById( 'vlm_command' ).value += opt;
743 document.getElementById( 'vlm_command' ).value += 'control ' + itemname + " " + act + " " + opt;
745 vlm_cmd( value( 'vlm_command' ) );
749 vlm_cmd( value( 'vlm_command' ) );