WebContent/js/edit/benchmark.js
/**
 * Attaches actions to the 'update' and 'delete' buttons
 */
Attaches actions to the 'update' and 'delete' buttons
Attaches actions to the ' update ' and ' delete ' buttons
function attachButtonActions() {
	$("#delete").click(function() {
		$('#dialog-confirm-delete-txt')
		.text('are you sure you want to recycle this benchmark?');
		$('#dialog-confirm-delete').dialog({
			modal: true,
			width: 380,
			height: 165,
			buttons: {
				'OK': function() {
					log('user confirmed benchmark deletion.');
					$('#dialog-confirm-delete').dialog('close');
					$.post(
						starexecRoot + "services/recycle/benchmark",
						{selectedIds: [getParameterByName("id")]},
						function(returnCode) {
							s = parseReturnCode(returnCode);
							if (s) {
								window.location = starexecRoot + 'secure/explore/spaces.jsp';
							}
						},
						"json"
					);
				},
				"cancel": function() {
					log('user canceled job deletion');
					$(this).dialog("close");
				}
			}
		});
	});
	$("#update").click(function() {
		var isFormValid = $("#editBenchmarkForm").valid();
		if (isFormValid == true) {
			var name = $("#name").val();
			var description = $("#description").val();
			var isDownloadable = $("#downloadable").is(':checked');
			var type = $("#benchType").val();
			var data = {
				name: name,
				description: description,
				downloadable: isDownloadable,
				type: type
			};
			$.post(
				starexecRoot + "services/edit/benchmark/" + getParameterByName(
				"id"),
				data,
				function(returnCode) {
					s = parseReturnCode(returnCode);
					if (s) {
						window.location = starexecRoot + 'secure/details/benchmark.jsp?id=' + getParameterByName(
							"id");
					}
				},
				"json"
			);
		}
	});
}
function attachButtonActions ( ) { $ ( "#delete" ) . click ( function ( ) { $ ( '#dialog-confirm-delete-txt' ) . text ( 'are you sure you want to recycle this benchmark?' ) ; $ ( '#dialog-confirm-delete' ) . dialog ( { modal : true , width : 380 , height : 165 , buttons : { 'OK' : function ( ) { log ( 'user confirmed benchmark deletion.' ) ; $ ( '#dialog-confirm-delete' ) . dialog ( 'close' ) ; $ . post ( starexecRoot + "services/recycle/benchmark" , { selectedIds : [ getParameterByName ( "id" ) ] } , function ( returnCode ) { s = parseReturnCode ( returnCode ) ; if ( s ) { window . location = starexecRoot + 'secure/explore/spaces.jsp' ; } } , "json" ) ; } , "cancel" : function ( ) { log ( 'user canceled job deletion' ) ; $ ( this ) . dialog ( "close" ) ; } } } ) ; } ) ; $ ( "#update" ) . click ( function ( ) { var isFormValid = $ ( "#editBenchmarkForm" ) . valid ( ) ; if ( isFormValid == true ) { var name = $ ( "#name" ) . val ( ) ; var description = $ ( "#description" ) . val ( ) ; var isDownloadable = $ ( "#downloadable" ) . is ( ':checked' ) ; var type = $ ( "#benchType" ) . val ( ) ; var data = { name : name , description : description , downloadable : isDownloadable , type : type } ; $ . post ( starexecRoot + "services/edit/benchmark/" + getParameterByName ( "id" ) , data , function ( returnCode ) { s = parseReturnCode ( returnCode ) ; if ( s ) { window . location = starexecRoot + 'secure/details/benchmark.jsp?id=' + getParameterByName ( "id" ) ; } } , "json" ) ; } } ) ; }
Attaches actions to the 'update' and 'delete' buttons
Attaches actions to the ' update ' and ' delete ' buttons
// Prompts user to confirm deletion and, if they confirm,
 // deletes the solver via AJAX, then redirects to explore/spaces.jsp
 // If the 'update' button is pressed then trigger validation and, if that passes,
 // update the benchmark details via AJAX and redirect to /details/benchmark.jsp 
