From 0a941490ec05cad6686995137d6657137447298d Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 8 Sep 2009 05:36:45 +0000 Subject: [PATCH] MDL-19792 Changed param id to entryid so that the navigation is built consistently with index.php. Also fixed the form which was broken --- blog/edit.php | 5 ++--- blog/edit_form.php | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/blog/edit.php b/blog/edit.php index 51ad4feaa2..e76e6f9f27 100755 --- a/blog/edit.php +++ b/blog/edit.php @@ -24,7 +24,7 @@ * @copyright 2009 Nicolas Connault * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once('../config.php'); +require_once(dirname(dirname(__FILE__)).'/config.php'); include_once('lib.php'); include_once('locallib.php'); include_once($CFG->dirroot.'/tag/lib.php'); @@ -141,7 +141,7 @@ if (!empty($existing)) { } $textfieldoptions = array('trusttext'=>true, 'subdirs'=>true); -$blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext', 'assignmentdata', 'textfieldoptions')); +$blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext', 'assignmentdata', 'textfieldoptions', 'id')); $existing = file_prepare_standard_editor($existing, 'summary', $textfieldoptions, $PAGE->get_context()); @@ -219,7 +219,6 @@ switch ($action) { print_error('unknowaction'); } -// Add filter params for return url $entry->modid = $modid; $entry->courseid = $courseid; diff --git a/blog/edit_form.php b/blog/edit_form.php index 00b82f6650..34df8ec8fc 100644 --- a/blog/edit_form.php +++ b/blog/edit_form.php @@ -26,6 +26,7 @@ class blog_edit_form extends moodleform { $mform =& $this->_form; $existing = $this->_customdata['existing']; + $entryid = $this->_customdata['id']; $summaryoptions = $this->_customdata['textfieldoptions']; if (!empty($this->_customdata['assignmentdata'])) { @@ -145,9 +146,9 @@ class blog_edit_form extends moodleform { $mform->addElement('hidden', 'courseid'); $mform->setType('courseid', PARAM_INT); - $mform->addElement('hidden', 'id'); - $mform->setType('id', PARAM_INT); - $mform->setDefault('id', 0); + $mform->addElement('hidden', 'entryid'); + $mform->setType('entryid', PARAM_INT); + $mform->setDefault('entryid', $entryid); $mform->addElement('hidden', 'modid'); $mform->setType('modid', PARAM_INT); @@ -185,9 +186,9 @@ class blog_edit_form extends moodleform { if ($blogassignment = $DB->get_record_sql('SELECT a.timedue, a.preventlate, a.emailteachers, a.var2, asub.grade FROM {assignment} a, {assignment_submissions} as asub WHERE a.id = asub.assignment AND userid = '.$USER->id.' AND a.assignmenttype = \'blog\' - AND asub.data1 = \''.$data['id'].'\'')) { + AND asub.data1 = \''.$data['entryid'].'\'')) { - $original = $DB->get_record('post', array('id' => $data['id'])); + $original = $DB->get_record('post', array('id' => $data['entryid'])); //don't allow updates of the summary, subject, or attachment $changed = ($original->summary != $data['summary'] || $original->subject != $data['subject'] || -- 2.39.5