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

« back to all changes in this revision

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

  • Committer: Nick Chadwick
  • Date: 2009-03-17 01:42:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1162.
  • Revision ID: chadnickbok@gmail.com-20090317014219-e0dvzakaxw58b71p
Fixed a problem with exercise editor, which wasn't editing or adding
variables properly.

Fixed the final issues from the merge-proposal, which make deleting
exercises use appropriate functions, which now raise exceptions
if they fail.

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
}
181
181
 
182
182
/* Modify and add Variables */
183
 
function edit_var(varid)
 
183
function edit_var(varid, suiteid)
184
184
{
185
185
    var var_name = $('#var_type_' + varid).val();
186
186
    var var_val = $('#var_val' + varid).val();
204
204
        }
205
205
    }
206
206
 
207
 
    var args = {'ivle.op': 'edit_var'};
 
207
    var args = {'ivle.op': 'edit_var', 'var_name': var_name,
 
208
                'var_val': var_val, 'var_type': var_type, 'argno': argno,
 
209
                'varid': varid, 'suiteid': suiteid};
208
210
    
209
211
    update_path = "api/+exercises/" + exercise;
210
212
    ajax_call(callback, update_path, "", args, 'POST')
213
215
 
214
216
function add_var(suiteid)
215
217
{
216
 
    var var_name = $('#new_var_type_' + suiteid).val();
217
 
    var var_val = $('#new_var_val' + suiteid).val();
218
 
    var var_type = $('#new_var_name_' + suiteid).val();
 
218
    var var_name = $('#new_var_name_' + suiteid).val();
 
219
    var var_val = $('#new_var_val_' + suiteid).val();
 
220
    var var_type = $('#new_var_type_' + suiteid).val();
219
221
    var argno = $('#new_var_argno_' + suiteid).val();
220
222
    
221
223
    var callback = function(xhr)