* 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; $i<count($this->blocks); $i++) {
$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 .= "</script>";
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) {