From 58cac329b7249104cf2bffeb2cbf08c98350b2ca Mon Sep 17 00:00:00 2001 From: vyshane Date: Mon, 29 Jan 2007 02:21:12 +0000 Subject: [PATCH] Temporarily disabling ajax for module/resource deletions. Related to MDL-8287. --- lib/ajax/ajaxlib.php | 3 ++- lib/ajax/section_classes.js | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index 915c5f2656c..e9854e0acae 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -100,7 +100,7 @@ class jsportal { * Prints the JavaScript code needed to set up AJAX for the course. */ function print_javascript($courseid, $return=false) { - global $CFG; + global $CFG, $USER; $blocksoutput = $output = ''; for ($i=0; $iblocks); $i++) { @@ -128,6 +128,7 @@ class jsportal { $output .= " main.portal.strings['deletecheck']='".get_string('deletecheck','','_var_')."';\n"; $output .= " main.portal.strings['resource']='".get_string('resource')."';\n"; $output .= " main.portal.strings['activity']='".get_string('activity')."';\n"; + $output .= " main.portal.strings['sesskey']='".$USER->sesskey."';\n"; $output .= " onloadobj.load();\n"; $output .= " main.process_blocks();\n"; $output .= ""; diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index 1edc5aecff1..bccbd7e7462 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -403,7 +403,7 @@ section_class.prototype.remove_resource = function(el) { this.write_sequence_list(); return true; -} +} section_class.prototype.insert_resource = function(el, targetel) { @@ -766,17 +766,23 @@ resource_class.prototype.toggle_groupmode = function() { resource_class.prototype.delete_button = function() { + /* if (this.debug) { YAHOO.log("Deleting "+this.getEl().id+" from parent "+this.parentObj.getEl().id); } if (!confirm(main.getString('deletecheck', main.getString(this.is)+" "+this.id))) { return false; } - //this.getEl().parentNode.removeChild(this.getEl()); this.parentObj.remove_resource(this); - main.connect('DELETE', 'class=resource&id='+this.id); -} + */ + + // Not currently doing deletion by ajax because of unsolved problem in + // resource_class.remove_resource() + self.location = main.portal.strings['wwwroot']+"/course/mod.php?delete=" + +this.id+"&sesskey="+main.portal.strings['sesskey']+ + "&sr=" + this.parentObj.sectionId; +} resource_class.prototype.update_index = function(index) {