182
206
ajax_call(callback, update_path, "", args, 'POST');
209
function delete_var(varid, suiteid)
211
var callback = function(xhr)
216
testresponse = JSON.parse(xhr.responseText);
217
alert('Variable Deleted.');
218
window.location.reload();
223
alert('Error Deleting Variable');
227
var args = {'ivle.op': 'delete_var', 'suiteid': suiteid, 'varid': varid};
228
update_path = "api/+exercises/" + exercise;
229
ajax_call(callback, update_path, "", args, 'POST');
185
233
/* Add and edit test case parts */
187
235
function add_test_case(suiteid)
189
var passmsg = $("new_test_case_pass_" + suiteid).val();
190
var failmsg = $("new_test_case_fail_" + suiteid).val();
191
var case_default = $("new_test_case_default_" + suiteid).val();
237
var passmsg = $("#new_test_case_pass_" + suiteid).val();
238
var failmsg = $("#new_test_case_fail_" + suiteid).val();
239
var case_default = $("#new_test_case_default_" + suiteid).val();
193
241
var callback = function(xhr)
258
var args = {'ivle.op': 'add_testcase', 'passmsg': passmsg,
259
'failmsg': failmsg, 'default': case_default,
261
update_path = "api/+exercises/" + exercise;
262
ajax_call(callback, update_path, "", args, 'POST');
266
function edit_test_case(testid, suiteid)
268
var passmsg = $("#test_case_pass_" + testid + "_" + suiteid).val();
269
var failmsg = $("#test_case_fail_" + testid + "_" + suiteid).val();
270
var case_default = $("#test_case_default_" + testid + "_" + suiteid).val();
272
var callback = function(xhr)
277
testresponse = JSON.parse(xhr.responseText);
278
alert('Test Case Modified Sucessfully');
283
alert('Error Saving Test Case');
288
var args = {'ivle.op': 'edit_testcase', 'passmsg': passmsg,
289
'failmsg': failmsg, 'default': case_default,
290
'testid':testid, 'suiteid': suiteid};
291
update_path = "api/+exercises/" + exercise;
292
ajax_call(callback, update_path, "", args, 'POST');
295
function delete_testcase(testid, suiteid)
297
var callback = function(xhr)
302
testresponse = JSON.parse(xhr.responseText);
303
alert('Test Case Deleted.');
304
window.location.reload();
309
alert('Error Deleting Test Case');
314
var args = {'ivle.op': 'delete_testcase', 'testid': testid,
316
update_path = "api/+exercises/" + exercise;
317
ajax_call(callback, update_path, "", args, 'POST');
320
/* Functions to add, edit, and delete test case parts */
321
function edit_test_part(partid, testid, suiteid)
323
var part_type = $("#test_part_part_type_" + partid).val();
324
var test_type = $("#test_part_test_type_" + partid).val();
325
var data = $("#test_part_data_" + partid).val();
326
var filename = $("#test_part_file_" + partid).val();
328
var callback = function(xhr)
333
testresponse = JSON.parse(xhr.responseText);
334
alert("Test Part Modified");
338
alert("Error Adding Test Part");
343
var args = {'ivle.op': 'edit_testpart', 'part_type': part_type,
344
'test_type': test_type, 'data': data, 'filename': filename,
345
'partid': partid, 'testid': testid, 'suiteid': suiteid};
346
update_path = "api/+exercises/" + exercise;
347
ajax_call(callback, update_path, "", args, 'POST');
350
function add_test_part(testid, suiteid)
352
var part_type = $("#new_test_part_part_type_" + testid).val();
353
var test_type = $("#new_test_part_test_type_" + testid).val();
354
var data = $("#new_test_part_data_" + testid).val();
355
var filename = $("#new_test_part_file_" + testid).val();
357
var savebutton = $("#new_test_part_save_" + testid);
358
savebutton.attr('value', 'Saving...');
359
savebutton.attr('disabled', 'disabled');
361
var callback = function(xhr)
365
var test_parts = $("#test_case_parts_" + testid);
368
testresponse = JSON.parse(xhr.responseText);
369
savebutton.attr('value', 'Saving...');
370
savebutton.removeAttr('disabled');
372
alert("Test Part Added");
373
window.location.reload();
378
alert("Error Adding Test Part");
383
var args = {'ivle.op': 'add_testpart', 'part_type': part_type,
384
'test_type': test_type, 'data': data, 'filename': filename,
385
'testid': testid, 'suiteid': suiteid};
386
update_path = "api/+exercises/" + exercise;
387
ajax_call(callback, update_path, "", args, 'POST');
390
function delete_testpart(partid, testid, suiteid)
392
var callback = function(xhr)
396
testresponse = JSON.parse(xhr.responseText);
397
alert("Test Part Deleted.");
398
window.location.reload();
403
alert("Error Deleting Test Part");
408
var args = {'ivle.op': 'delete_testpart', 'partid': partid,
409
'testid': testid, 'suiteid': suiteid};
410
update_path = "api/+exercises/" + exercise;
411
ajax_call(callback, update_path, "", args, 'POST');