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 sanitize_input( str )
156 return str.replace( /\"/g, '\\\"' ).replace( /^/, '"' ).replace( /$/, '"' ).replace( /\ option\ /g, '" option "' );
159 function update_vlm_add_broadcast()
161 var cmd = document.getElementById( 'vlm_command' );
163 if( value( 'vlm_broadcast_name' ) )
165 cmd.value = "new " + addunderscores( value( 'vlm_broadcast_name' ) )
168 if( checked( 'vlm_broadcast_enabled' ) )
170 cmd.value += " enabled";
173 if( checked( 'vlm_broadcast_loop' ) )
175 cmd.value += " loop";
178 if( value( 'vlm_broadcast_input' ) )
180 cmd.value += " input " + sanitize_input( value( 'vlm_broadcast_input' ) );
183 if( value( 'vlm_broadcast_output' ) )
185 cmd.value += " output " + value( 'vlm_broadcast_output' );
194 function update_vlm_add_vod()
196 var cmd = document.getElementById( 'vlm_command' );
198 if( value( 'vlm_vod_name' ) )
200 cmd.value = "new " + addunderscores( value( 'vlm_vod_name' ) )
203 if( checked( 'vlm_vod_enabled' ) )
205 cmd.value += " enabled";
208 if( value( 'vlm_vod_input' ) )
210 cmd.value += " input " + sanitize_input( value( 'vlm_vod_input' ) );
213 if( value( 'vlm_vod_output' ) )
215 cmd.value += " output " + value( 'vlm_vod_output' );
224 function update_vlm_add_schedule()
226 var cmd = document.getElementById( 'vlm_command' );
228 check_and_replace_int( 'vlm_schedule_year', '0000' );
229 check_and_replace_int( 'vlm_schedule_month', '00' );
230 check_and_replace_int( 'vlm_schedule_day', '00' );
231 check_and_replace_int( 'vlm_schedule_hour', '00' );
232 check_and_replace_int( 'vlm_schedule_minute', '00' );
233 check_and_replace_int( 'vlm_schedule_second', '00' );
234 check_and_replace_int( 'vlm_schedule_period_year', '0000' );
235 check_and_replace_int( 'vlm_schedule_period_month', '00' );
236 check_and_replace_int( 'vlm_schedule_period_day', '00' );
237 check_and_replace_int( 'vlm_schedule_period_hour', '00' );
238 check_and_replace_int( 'vlm_schedule_period_minute', '00' );
239 check_and_replace_int( 'vlm_schedule_period_second', '00' );
241 if( value( 'vlm_schedule_name' ) )
243 cmd.value = "new " + addunderscores( value( 'vlm_schedule_name' ) ) + " schedule";
245 if( checked( 'vlm_schedule_enabled' ) )
247 cmd.value += " enabled";
250 if( checked( 'vlm_schedule_now' ) )
252 cmd.value += " date now";
256 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' );
259 if( checked( 'vlm_schedule_repeat' ) )
261 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' );
263 if( value( 'vlm_schedule_repeat_times' ) != 0 )
265 cmd.value += " repeat " + (value( 'vlm_schedule_repeat_times' ) - 1 );
276 function update_vlm_add_other()
278 var cmd = document.getElementById( 'vlm_command' );
282 function clear_vlm_add()
284 document.getElementById( 'vlm_command' ).value = "";
285 document.getElementById( 'vlm_broadcast_name' ).value = "";
286 document.getElementById( 'vlm_vod_name' ).value = "";
289 function create_button( caption, action )
291 /* var link = document.createElement( "input" );
292 link.setAttribute( 'type', 'button' );*/
293 /* link.setAttribute( 'onclick', action ); */
294 /* Above doesn't work on ie. You need to use something like
295 * link.onclick = function() { alert( 'pouet' ); };
296 * instead ... conclusion: IE is crap */
297 /* link.setAttribute( 'value', caption );*/
299 var d = document.createElement( 'div' );
300 d.innerHTML = "<input type='button' onclick='"+action+"' value='"+caption+"' />"; /* other IE work around ... still crap. Use double quotes only in action */
301 var link = d.firstChild;
304 function create_option( caption, value )
306 var opt = document.createElement( 'option' );
307 opt.setAttribute( 'value', value );
308 opt.appendChild( document.createTextNode( caption ) );
312 function parse_vlm_cmd()
314 if( req.readyState == 4 )
316 if( req.status == 200 )
318 var vlm_answer = req.responseXML.documentElement;
319 var error_tag = vlm_answer.getElementsByTagName( 'error' )[0];
320 var vlme = document.getElementById( 'vlm_error' );
321 clear_children( vlme );
322 if( error_tag.hasChildNodes() )
324 vlme.appendChild( document.createTextNode( 'Error: ' + error_tag.firstChild.data ) );
325 vlme.style.color = "#f00";
329 vlme.appendChild( document.createTextNode( 'Command succesful (' + value( 'vlm_command' ) + ') ' ) );
330 vlme.style.color = "#0f0";
333 vlme.appendChild( create_button( 'clear', 'clear_children( document.getElementById( "vlm_error" ) );' ) );
340 function parse_vlm_elements()
342 if( req.readyState == 4 )
344 if( req.status == 200 )
346 var vlmb = document.getElementById( 'vlm_broadcast_list' );
347 var vlmv = document.getElementById( 'vlm_vod_list' );
348 var vlms = document.getElementById( 'vlm_schedule_list' );
350 clear_children( vlmb );
351 clear_children( vlmv );
352 clear_children( vlms );
354 answer = req.responseXML.documentElement;
356 var elt = answer.firstChild;
360 if( elt.nodeName == "broadcast" || elt.nodeName == "vod" )
362 var nb = document.createElement( 'div' );
363 setclass( nb, 'list_element' );
364 if( elt.nodeName == "broadcast" )
366 vlmb.appendChild( nb );
370 vlmv.appendChild( nb );
372 var nbname = document.createElement( 'b' );
373 nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
374 nb.appendChild( nbname );
376 if( elt.getAttribute( 'enabled' ) == 'yes' )
378 nb.appendChild( document.createTextNode( " enabled " ) );
379 nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
383 nb.appendChild( document.createTextNode( " disabled " ) );
384 nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
387 if( elt.nodeName == "broadcast" )
389 if( elt.getAttribute( 'loop' ) == 'yes' )
391 nb.appendChild( document.createTextNode( " loop " ) );
393 nb.appendChild( create_button( 'Un-loop', 'vlm_unloop("'+elt.getAttribute( 'name' ) + '");' ) );
397 nb.appendChild( document.createTextNode( " play once " ) );
398 nb.appendChild( create_button( 'Loop', 'vlm_loop("'+elt.getAttribute( 'name' ) + '");' ) );
402 if( elt.getAttribute( 'enabled' ) == 'yes' )
404 nb.appendChild( document.createTextNode( " " ) );
405 nb.appendChild( create_button( 'Play', 'vlm_play("'+elt.getAttribute('name')+'");' ) );
408 nb.appendChild( document.createTextNode( " " ) );
409 nb.appendChild( create_button( 'Pause', 'vlm_pause("'+elt.getAttribute('name')+'");' ) );
411 nb.appendChild( document.createTextNode( " " ) );
412 nb.appendChild( create_button( 'Stop', 'vlm_stop("'+elt.getAttribute('name')+'");' ) );
415 nb.appendChild( document.createTextNode( " " ) );
416 nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
418 var list = document.createElement( "ul" );
420 /* begin input list */
421 var item = document.createElement( "li" );
422 list.appendChild( item );
423 item.appendChild( document.createTextNode( "Inputs: " ) );
424 var text = document.createElement( "input" );
425 text.setAttribute( 'type', 'text' );
426 text.setAttribute( 'size', '40' );
427 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_input' );
428 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' );
429 item.appendChild( text );
430 item.appendChild( document.createTextNode( ' ' ) );
431 item.appendChild( create_button( 'Edit', 'vlm_input_edit("vlm_elt_'+elt.getAttribute('name')+'_input");') );
432 item.appendChild( document.createTextNode( ' ' ) );
433 item.appendChild( create_button( 'Add input', 'vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' ) );
435 var inputs = elt.getElementsByTagName( 'input' );
436 if( inputs.length > 0 )
438 var ilist = document.createElement( "ol" );
439 ilist.setAttribute( 'start', '1' );
440 item.appendChild( ilist );
441 for( i = 0; i < inputs.length; i++ )
443 var item = document.createElement( "li" );
444 item.appendChild( document.createTextNode( inputs[i].firstChild.data + " " ) );
445 item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) );
446 ilist.appendChild( item );
449 /* end of input list */
452 var item = document.createElement( "li" );
453 outputelt = elt.getElementsByTagName( 'output' )[0];
454 if( outputelt.hasChildNodes() )
456 output = outputelt.firstChild.data;
462 item.appendChild( document.createTextNode( 'Output: ' ) );
463 var text = document.createElement( "input" );
464 text.setAttribute( 'type', 'text' );
465 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_output' );
466 text.setAttribute( 'value', output );
467 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_output("'+elt.getAttribute( 'name' )+ '",document.getElementById("vlm_elt_'+elt.getAttribute( 'name' )+'_output").value);' );
468 item.appendChild( text );
470 item.appendChild( document.createTextNode( ' ' ) );
472 item.appendChild( create_button( 'Edit', 'vlm_output_edit("vlm_elt_'+elt.getAttribute('name')+'_output");' ) );
473 item.appendChild( document.createTextNode( ' ' ) );
474 item.appendChild( create_button( 'Change output', 'vlm_output("'+elt.getAttribute( 'name' )+ '",document.getElementById("vlm_elt_'+elt.getAttribute( 'name' )+'_output").value);' ) );
475 list.appendChild( item );
478 /* begin options list */
479 var item = document.createElement( "li" );
480 list.appendChild( item );
481 item.appendChild( document.createTextNode( "Options: " ) );
483 var text = document.createElement( "input" );
484 text.setAttribute( 'type', 'text' );
485 text.setAttribute( 'size', '40' );
486 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_option' );
487 text.setAttribute( 'onkeypress', 'if( event.keyCode == 13 ) vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' );
488 item.appendChild( text );
489 item.appendChild( document.createTextNode( ' ' ) );
490 item.appendChild( create_button( 'Add option', 'vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' ) );
492 var options = elt.getElementsByTagName( 'option' );
493 if( options.length > 0 )
495 var olist = document.createElement( "ul" );
496 item.appendChild( olist );
497 for( i = 0; i < options.length; i++ )
499 var item = document.createElement( "li" );
500 item.appendChild( document.createTextNode( options[i].firstChild.data ) );
501 olist.appendChild( item );
507 var instances = elt.getElementsByTagName( 'instance' );
508 if( instances.length > 0 )
510 var item = document.createElement("li");
511 var ilist = document.createElement("ul");
512 list.appendChild( item );
513 item.appendChild(document.createTextNode("Instances:"));
514 item.appendChild( ilist );
515 for( i = 0; i < instances.length; i++ )
517 var iname = instances[i].getAttribute( 'name' );
518 var istate = instances[i].getAttribute( 'state' );
519 var iposition = Number( instances[i].getAttribute( 'position' ) * 100);
520 var itime = Math.floor( instances[i].getAttribute( 'time' ) / 1000000);
521 var ilength = Math.floor( instances[i].getAttribute( 'length' ) / 1000000);
522 var irate = instances[i].getAttribute( 'rate' );
523 var ititle = instances[i].getAttribute( 'title' );
524 var ichapter = instances[i].getAttribute( 'chapter' );
525 var iseekable = instances[i].getAttribute( 'seekable' );
526 var iplaylistindex = instances[i].getAttribute( 'playlistindex' );
528 var item = document.createElement( "li" );
529 item.appendChild( document.createTextNode( iname + ": " + istate + " (" + iplaylistindex + ") " + (iposition.toFixed(2)) + "%" + " " + format_time( itime ) + "/" + format_time( ilength ) ) );
530 ilist.appendChild( item );
533 /* end of instances list */
535 nb.appendChild( list );
538 else if( elt.nodeName == "schedule" )
540 var nb = document.createElement( 'div' );
541 setclass( nb, 'list_element' );
542 vlms.appendChild( nb );
544 var nbname = document.createElement( 'b' );
545 nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
546 nb.appendChild( nbname );
548 if( elt.getAttribute( 'enabled' ) == 'yes' )
550 nb.appendChild( document.createTextNode( " enabled " ) );
551 nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
555 nb.appendChild( document.createTextNode( " disabled " ) );
556 nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
559 nb.appendChild( document.createTextNode( " " ) );
560 nb.appendChild( create_button( "Delete", 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
562 var list = document.createElement( 'ul' );
564 var item = document.createElement( 'li' );
565 item.appendChild( document.createTextNode( "Date: " + elt.getAttribute( 'date' ) ) );
566 list.appendChild( item );
568 var item = document.createElement( 'li' );
569 item.appendChild( document.createTextNode( "Period (in seconds): " + elt.getAttribute( 'period' ) ) );
570 list.appendChild( item );
572 var item = document.createElement( 'li' );
573 if( elt.getAttribute( 'repeat' ) == -1 )
575 item.appendChild( document.createTextNode( "Number of repeats left: for ever" ) );
579 item.appendChild( document.createTextNode( "Number of repeats left: " + elt.getAttribute( 'repeat' ) ) );
581 list.appendChild( item );
583 var commands = elt.getElementsByTagName( 'command' );
584 for( i = 0; i < commands.length; i++ )
586 var item = document.createElement( "li" );
587 item.appendChild( document.createTextNode( "Command: " + commands[i].firstChild.data + " " ) );
588 list.appendChild( item );
591 var item = document.createElement( 'li' );
592 var sel = document.createElement( 'select' );
593 sel.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_action' );
594 sel.setAttribute( 'onchange', 'vlm_schedule_type_change("'+elt.getAttribute('name')+'");');
595 sel.appendChild( create_option( 'play', 'play' ) );
596 sel.appendChild( create_option( 'pause', 'pause' ) );
597 sel.appendChild( create_option( 'stop', 'stop' ) );
598 sel.appendChild( create_option( 'seek', 'seek' ) );
599 sel.appendChild( create_option( '(other)', '' ) );
600 item.appendChild( sel );
602 item.appendChild( document.createTextNode( " " ) );
603 var text = document.createElement( 'input' );
604 text.setAttribute( 'type', 'text' );
605 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_name' );
606 text.setAttribute( 'size', '10' );
607 text.setAttribute( 'value', '(name)' );
608 text.setAttribute( 'onfocus', 'if( this.value == "(name)" ) this.value = "";' );
609 text.setAttribute( 'onblur', 'if( this.value == "" ) this.value = "(name)";' );
610 item.appendChild( text );
612 item.appendChild( document.createTextNode( " " ) );
613 text = document.createElement( 'input' );
614 text.setAttribute( 'type', 'text' );
615 text.setAttribute( 'id', 'vlm_elt_'+elt.getAttribute('name')+'_opt' );
616 text.setAttribute( 'size', '30' );
617 text.setAttribute( 'value', '(options)' );
618 text.setAttribute( 'onfocus', 'if( this.value == "(options)" ) this.value = "";' );
619 text.setAttribute( 'onblur', 'if( this.value == "" ) this.value = "(options)";' );
620 item.appendChild( text );
621 item.appendChild( document.createTextNode( " " ) );
622 item.appendChild( create_button( "Append command", 'vlm_schedule_append("' + elt.getAttribute( 'name' ) + '");') );
624 list.appendChild( item );
626 nb.appendChild( list );
627 vlm_schedule_type_change( elt.getAttribute('name') );
630 elt = elt.nextSibling;
636 function vlm_cmd( cmd )
638 loadXMLDoc( 'requests/vlm_cmd.xml?command='+encodeURIComponent(cmd), parse_vlm_cmd );
641 function vlm_get_elements( )
643 loadXMLDoc( 'requests/vlm.xml', parse_vlm_elements );
646 /* helper functions */
648 function vlm_disable( name )
650 document.getElementById( 'vlm_command' ).value = "setup "+name+" disabled";
651 vlm_cmd( value( 'vlm_command' ) );
654 function vlm_enable( name )
656 document.getElementById( 'vlm_command' ).value = "setup "+name+" enabled";
657 vlm_cmd( value( 'vlm_command' ) );
660 function vlm_loop( name )
662 document.getElementById( 'vlm_command' ).value = "setup "+name+" loop";
663 vlm_cmd( value( 'vlm_command' ) );
666 function vlm_unloop( name )
668 document.getElementById( 'vlm_command' ).value = "setup "+name+" unloop";
669 vlm_cmd( value( 'vlm_command' ) );
672 function vlm_play( name )
674 document.getElementById( 'vlm_command' ).value = "control "+name+" play";
675 vlm_cmd( value( 'vlm_command' ) );
678 function vlm_pause( name )
680 document.getElementById( 'vlm_command' ).value = "control "+name+" pause";
681 vlm_cmd( value( 'vlm_command' ) );
684 function vlm_stop( name )
686 document.getElementById( 'vlm_command' ).value = "control "+name+" stop";
687 vlm_cmd( value( 'vlm_command' ) );
690 function vlm_delete( name )
692 document.getElementById( 'vlm_command' ).value = "del "+name;
693 vlm_cmd( value( 'vlm_command' ) );
696 function vlm_delete_input( name, num )
698 document.getElementById( 'vlm_command' ).value = "setup "+name+" inputdeln "+num;
699 vlm_cmd( value( 'vlm_command' ) );
702 function vlm_add_input( name, input )
704 document.getElementById( 'vlm_command' ).value = "setup "+name+" input "+sanitize_input( input );
705 vlm_cmd( value( 'vlm_command' ) );
708 function vlm_output( name, output )
710 document.getElementById( 'vlm_command' ).value = "setup "+name+" output "+output;
711 vlm_cmd( value( 'vlm_command' ) );
714 function vlm_option( name, option )
716 document.getElementById( 'vlm_command' ).value = "setup "+name+" option "+option;
717 vlm_cmd( value( 'vlm_command' ) );
720 function vlm_batch( batch )
723 var commands = batch.split( '\n' );
724 for( i = 0; i < commands.length; i++ )
726 document.getElementById( 'vlm_command' ).value = commands[i];
727 vlm_cmd( value( 'vlm_command' ) );
731 function vlm_schedule_append( name )
733 var act = document.getElementById( 'vlm_elt_' + name + '_action' ).value;
734 document.getElementById( 'vlm_command' ).value = "setup " + name + " append ";
736 var itemname = document.getElementById( 'vlm_elt_' + name + '_name' ).value;
737 if( itemname == "(name)" ) itemname = "";
739 var opt = document.getElementById( 'vlm_elt_' + name + '_opt' ).value;
740 if( opt == "(options)" ) opt = "";
744 document.getElementById( 'vlm_command' ).value += opt;
748 document.getElementById( 'vlm_command' ).value += 'control ' + itemname + " " + act + " " + opt;
750 vlm_cmd( value( 'vlm_command' ) );
754 vlm_cmd( value( 'vlm_command' ) );