~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/media/tutorial.js

  • Committer: William Grant
  • Date: 2009-12-10 00:22:35 UTC
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: grantw@unimelb.edu.au-20091210002235-m1606ugstnqiyxpm
Hook up a new ExerciseRESTView.test into the JS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
    var exercisebox = exercisediv.getElementsByTagName("textarea")[0];
64
64
    var code = exercisebox.value;
65
65
 
66
 
    var args = {'code': code};
67
 
 
68
66
    /* Send the form as multipart/form-data, since we are sending a whole lump
69
67
     * of Python code, it should be treated like a file upload. */
70
68
    /* AJAX callback function */
92
90
                close_previous(exerciseid);
93
91
        }
94
92
    if (worksheet)
95
 
        attempts_path = (
 
93
    {
 
94
        var args = {'code': code};
 
95
        var attempts_path = (
96
96
            "api/subjects/" + subject + "/" + year + "/" +
97
97
            semester + "/+worksheets/" + worksheet + "/" + filename +
98
98
            '/+attempts/' + username);
 
99
        ajax_call(callback, attempts_path, "", args, "PUT", "application/json");
 
100
    }
99
101
    else
100
 
       attempts_path = "api/+exercises/+attempts" + filename
101
 
 
102
 
    ajax_call(callback, attempts_path, "", args, "PUT", "application/json");
 
102
    {
 
103
        var args = {'ivle.op': 'test', 'code': code};
 
104
        var attempts_path = "api/+exercises/" + filename
 
105
        ajax_call(callback, attempts_path, "", args, "POST");
 
106
    }
103
107
}
104
108
 
105
109
/** User clicks "Save" button. Do an Ajax call to store it.