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

« back to all changes in this revision

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

Updated the exercises to be loaded from the database, not a local file.

This updated fixes some things broken in my previous commit, and now
it should leave the worksheets in a viewable (not working) state.

I have also updated ivle-addexercise and the database schema to reflect
the schema of an exercise.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            /* Close the "view previous" area (force reload) */
91
91
            close_previous(exerciseid);
92
92
        }
93
 
    attempts_path = "api/subjects/" + subject + "/+worksheets/" + worksheet 
94
 
        + "/" + filename + '/+attempts/' + username;
 
93
    attempts_path = "api/subjects/" + subject + "/" + year + "/" + semester + 
 
94
        "/+worksheets/" + worksheet + "/" + filename + '/+attempts/' + username;
95
95
    ajax_call(callback, attempts_path, "", args, "PUT", "application/json");
96
96
}
97
97
 
119
119
            set_saved_status(exerciseid, filename, "Saved");
120
120
        }
121
121
        
122
 
    call_path = 'api/subjects/' + subject + '/+worksheets/' + worksheet + 
123
 
                                                                '/' + filename;
 
122
    call_path = 'api/subjects/' + subject + "/" + year + "/" + semester + 
 
123
                                '/+worksheets/' + worksheet + '/' + filename;
124
124
    ajax_call(callback, call_path, "", args, "POST");
125
125
}
126
126
 
144
144
    var resettextbox = document.getElementById("input_resettext_" + exerciseid);
145
145
    var text_urlencoded = resettextbox.value;
146
146
    /* Need to un-urlencode the value */
147
 
    exercisebox.value = decodeURIComponent(text_urlencoded);
 
147
    exercisebox.value = text_urlencoded;//decodeURIComponent(text_urlencoded);
148
148
    /* We changed the text, so make Save button available, and autosave after
149
149
     * 10 seconds. */
150
150
    set_saved_status(exerciseid, filename, "Save");
549
549
            else
550
550
                noattempts.setAttribute("style", "display: auto");
551
551
        }
552
 
    attempts_path = "api/subjects/" + subject + "/+worksheets/" + worksheet 
553
 
        + "/" + filename + '/+attempts/' + username;
 
552
    attempts_path = "api/subjects/" + subject + "/" + year + "/" + semester + 
 
553
        "/+worksheets/" + worksheet + "/" + filename + '/+attempts/' + username;
554
554
    ajax_call(callback, attempts_path, "", {}, "GET");
555
555
}
556
556
 
625
625
            textarea.setAttribute("style", "display: auto");
626
626
        }
627
627
        
628
 
    call_path = "api/subjects/" + subject + '/+worksheets/' + worksheet + '/' 
629
 
                        + filename + '/+attempts/' + username + '/' + date;
 
628
    call_path = "api/subjects/" + subject + "/" + year + "/" + semester + 
 
629
            '/+worksheets/' + worksheet + '/' + filename + '/+attempts/' 
 
630
            + username + '/' + date;
630
631
    ajax_call(callback, call_path, "", {}, "GET");
631
632
}