WebContent/js/edit/solver.js
/**
 * Monitors the solver's "websites" and updates the server if the client adds/deletes any
 */
Monitors the solver's "websites" and updates the server if the client adds/deletes any
Monitors the solver ' s " websites " and updates the server if the client adds / deletes any
function attachWebsiteMonitor() {
	$("#websites").on("click", ".delWebsite", function() {
		var id = $(this).attr('id');
		var parent = $(this).parent().parent();
		$('#dialog-confirm-delete-txt')
		.text('Are you sure you want to delete this website?');
		$('#dialog-confirm-delete').dialog({
			modal: true,
			width: 380,
			height: 165,
			buttons: {
				'OK': function() {
					$('#dialog-confirm-delete').dialog('close');
					$.post(
						starexecRoot + "services/websites/delete/" + id,
						function(returnData) {
							s = parseReturnCode(returnData);
							if (s) {
								parent.remove();
							}
						},
						"json"
					).error(function() {
						showMessage('error',
							"Internal error updating websites",
							5000);
					});
				},
				"cancel": function() {
					$(this).dialog("close");
				}
			}
		});
	});
	$("#addWebsite").click(function() {
		var name = $("#website_name").val();
		var url = $("#website_url").val();
		if (name.trim().length == 0) {
			showMessage('error', 'please enter a website name', 6000);
			return;
		} else if (url.indexOf("http://") != 0) {
			showMessage('error', 'url must start with http://', 6000);
			return;
		} else if (url.trim().length <= 12) {
			showMessage('error', 'the given url is not long enough', 6000);
			return;
		}
		var data = {name: name, url: url};
		$.post(
			starexecRoot + "services/website/add/solver/" + getParameterByName(
			"id"),
			data,
			function(returnCode) {
				s = parseReturnCode(returnCode);
				if (s) {
					$("#website_name").val("");
					$("#website_url").val("");
					$('#websites li').remove();
					refreshSolverWebsites();
				}
			},
			"json"
		);
	});
}
function attachWebsiteMonitor ( ) { $ ( "#websites" ) . on ( "click" , ".delWebsite" , function ( ) { var id = $ ( this ) . attr ( 'id' ) ; var parent = $ ( this ) . parent ( ) . parent ( ) ; $ ( '#dialog-confirm-delete-txt' ) . text ( 'Are you sure you want to delete this website?' ) ; $ ( '#dialog-confirm-delete' ) . dialog ( { modal : true , width : 380 , height : 165 , buttons : { 'OK' : function ( ) { $ ( '#dialog-confirm-delete' ) . dialog ( 'close' ) ; $ . post ( starexecRoot + "services/websites/delete/" + id , function ( returnData ) { s = parseReturnCode ( returnData ) ; if ( s ) { parent . remove ( ) ; } } , "json" ) . error ( function ( ) { showMessage ( 'error' , "Internal error updating websites" , 5000 ) ; } ) ; } , "cancel" : function ( ) { $ ( this ) . dialog ( "close" ) ; } } } ) ; } ) ; $ ( "#addWebsite" ) . click ( function ( ) { var name = $ ( "#website_name" ) . val ( ) ; var url = $ ( "#website_url" ) . val ( ) ; if ( name . trim ( ) . length == 0 ) { showMessage ( 'error' , 'please enter a website name' , 6000 ) ; return ; } else if ( url . indexOf ( "http://" ) != 0 ) { showMessage ( 'error' , 'url must start with http://' , 6000 ) ; return ; } else if ( url . trim ( ) . length <= 12 ) { showMessage ( 'error' , 'the given url is not long enough' , 6000 ) ; return ; } var data = { name : name , url : url } ; $ . post ( starexecRoot + "services/website/add/solver/" + getParameterByName ( "id" ) , data , function ( returnCode ) { s = parseReturnCode ( returnCode ) ; if ( s ) { $ ( "#website_name" ) . val ( "" ) ; $ ( "#website_url" ) . val ( "" ) ; $ ( '#websites li' ) . remove ( ) ; refreshSolverWebsites ( ) ; } } , "json" ) ; } ) ; }
Monitors the solver's "websites" and updates the server if the client adds/deletes any
Monitors the solver ' s " websites " and updates the server if the client adds / deletes any
// Handles deleting an existing website
 // Handles adding a new website
