From 2a0d5695b30ebbfc13683387dff00d8959e18d47 Mon Sep 17 00:00:00 2001 From: vyshane Date: Mon, 29 Jan 2007 07:54:48 +0000 Subject: [PATCH] Made non-AJAX deletion of resources only apply to IE browsers. --- lib/ajax/ajaxcourse.js | 6 ++++++ lib/ajax/ajaxlib.php | 7 ++++++- lib/ajax/section_classes.js | 31 ++++++++++++++++--------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lib/ajax/ajaxcourse.js b/lib/ajax/ajaxcourse.js index 0ac21766728..e5c1ccacf1b 100644 --- a/lib/ajax/ajaxcourse.js +++ b/lib/ajax/ajaxcourse.js @@ -244,6 +244,12 @@ function php_portal_class() { //flag for week fomat this.isWeek = false; + //client browser + this.clientIsIE = null; + + //session key + this.sesskey = null; + //strings this.strings = []; diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index e9854e0acae..6d7024641c0 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -115,6 +115,12 @@ class jsportal { $output .= ""; diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index bccbd7e7462..f13a0e2f303 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -766,22 +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; + + if (!main.portal.clientIsIE) { + 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.parentObj.remove_resource(this); + main.connect('DELETE', 'class=resource&id='+this.id); + } else { + // 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.sesskey+ + "&sr=" + this.parentObj.sectionId; } - 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; }