Revision 58 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/StatisticsController.groovy

View differences:

StatisticsController.groovy
440 440
		render(text: cont,contentType:"text/csv",encoding:"UTF-8")
441 441
		
442 442
	}
443
	
444
	def deleteGraph = {
445
	
446
		if(params['id']) {
447
			
448
			def graphToDelete = EneGraph.get(params['id'])
449
			if(graphToDelete) {
450
				
451
				graphToDelete.delete()
452
				flash['confirms'] = "<p>Graph deleted successfully.</p>"
453
				redirect(action:'graphs')
454
				return true
455
				
456
			} else {
457
				flash['errors'] = "<p>No graph was deleted. Graph ID invalid!</p>"
458
				redirect(action:'graphs')
459
				return false
460
			}
461
			
462
		} else {
463
		
464
			flash['errors'] = "<p>No graph was deleted. Graph ID not specified!</p>"
465
			redirect(action:'graphs')
466
			return false
467
		
468
		}	
469
		
470
	}
443 471
	
444 472
}

Also available in: Unified diff