package/ui/phpvirtualbox/js/dialogs.js
/**
 * Run the VM Log Viewer dialog
 * @param {String} vm - uuid or name of virtual machine to obtain logs for
 */
Run the VM Log Viewer dialog
@param {String} vm - uuid or name of virtual machine to obtain logs for
Run the VM Log Viewer dialog @param { String } vm - uuid or name of virtual machine to obtain logs for
function vboxShowLogsDialogInit(vm) {
	$('#vboxPane').append($('<div />').attr({'id':'vboxVMLogsDialog'}));
	var l = new vboxLoader();
	l.add('machineGetLogFilesList',function(r){
		$('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
	},{'vm':vm.id});
	l.addFileToDOM('panes/vmlogs.html',$('#vboxVMLogsDialog'));
	l.onLoad = function(){
		var buttons = {};
		buttons[trans('Refresh','UIVMLogViewer')] = function() {
			l = new vboxLoader();
			l.add('machineGetLogFilesList',function(r){
				$('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
			},{'vm':vm.id});
			l.onLoad = function(){
				vboxShowLogsInit(vm);
			};
			l.run();
		};
		buttons[trans('Close','UIVMLogViewer')] = function(){$(this).trigger('close').empty().remove();};
		$('#vboxVMLogsDialog').dialog({'closeOnEscape':true,'width':800,'height':500,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/vm_show_logs_16px.png" class="vboxDialogTitleIcon" /> '+ trans('%1 - VirtualBox Log Viewer','UIVMLogViewer').replace('%1',vm.name)}).on("dialogbeforeclose",function(){
	    	$(this).parent().find('span:contains("'+trans('Close','UIVMLogViewer')+'")').trigger('click');
	    });
		vboxShowLogsInit(vm);
	};
	l.run();
}
function vboxShowLogsDialogInit ( vm ) { $ ( '#vboxPane' ) . append ( $ ( '<div />' ) . attr ( { 'id' : 'vboxVMLogsDialog' } ) ) ; var l = new vboxLoader ( ) ; l . add ( 'machineGetLogFilesList' , function ( r ) { $ ( '#vboxVMLogsDialog' ) . data ( { 'logs' : r . responseData . logs , 'logpath' : r . responseData . path } ) ; } , { 'vm' : vm . id } ) ; l . addFileToDOM ( 'panes/vmlogs.html' , $ ( '#vboxVMLogsDialog' ) ) ; l . onLoad = function ( ) { var buttons = { } ; buttons [ trans ( 'Refresh' , 'UIVMLogViewer' ) ] = function ( ) { l = new vboxLoader ( ) ; l . add ( 'machineGetLogFilesList' , function ( r ) { $ ( '#vboxVMLogsDialog' ) . data ( { 'logs' : r . responseData . logs , 'logpath' : r . responseData . path } ) ; } , { 'vm' : vm . id } ) ; l . onLoad = function ( ) { vboxShowLogsInit ( vm ) ; } ; l . run ( ) ; } ; buttons [ trans ( 'Close' , 'UIVMLogViewer' ) ] = function ( ) { $ ( this ) . trigger ( 'close' ) . empty ( ) . remove ( ) ; } ; $ ( '#vboxVMLogsDialog' ) . dialog ( { 'closeOnEscape' : true , 'width' : 800 , 'height' : 500 , 'buttons' : buttons , 'modal' : true , 'autoOpen' : true , 'dialogClass' : 'vboxDialogContent' , 'title' : '<img src="images/vbox/vm_show_logs_16px.png" class="vboxDialogTitleIcon" /> ' + trans ( '%1 - VirtualBox Log Viewer' , 'UIVMLogViewer' ) . replace ( '%1' , vm . name ) } ) . on ( "dialogbeforeclose" , function ( ) { $ ( this ) . parent ( ) . find ( 'span:contains("' + trans ( 'Close' , 'UIVMLogViewer' ) + '")' ) . trigger ( 'click' ) ; } ) ; vboxShowLogsInit ( vm ) ; } ; l . run ( ) ; }
Run the VM Log Viewer dialog
 @param {String} vm - uuid or name of virtual machine to obtain logs for
Run the VM Log Viewer dialog @param { String } vm - uuid or name of virtual machine to obtain logs for