$textfieldoptions = array('trusttext'=>true, 'subdirs'=>true);
$blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext', 'textfieldoptions', 'id'));
+$draftitemid = file_get_submitted_draft_itemid('attachments');
+file_prepare_draft_area($draftitemid, $PAGE->context, 'blog_attachment', empty($id)?null:$id);
-$existing = file_prepare_standard_editor($existing, 'summary', $textfieldoptions, $PAGE->get_context());
+$draftid_editor = file_get_submitted_draft_itemid('summary');
+$currenttext = file_prepare_draft_area($draftid_editor, $PAGE->context, 'blog_post', empty($id) ? null : $id, array('subdirs'=>true), @$existing->summary);
if ($blogeditform->is_cancelled()){
redirect($returnurl);
$entry->modid = $modid;
$entry->courseid = $courseid;
-
+$entry->attachments = $draftitemid;
+$entry->summary = array('text' => @$existing->summary, 'format' => empty($existing->summaryformat) ? FORMAT_HTML : $existing->summaryformat, 'itemid' => $draftid_editor);
+$entry->summaryformat = (empty($existing->summaryformat)) ? FORMAT_HTML : $existing->summaryformat;
$PAGE->requires->data_for_js('blog_edit_existing', $entry);
// done here in order to allow deleting of entries with wrong user id above
$mform->addElement('text', 'subject', get_string('entrytitle', 'blog'), 'size="60"');
$textfieldoptions = array('trusttext'=>true, 'subdirs'=>true);
- $mform->addElement('editor', 'summary_editor', get_string('entrybody', 'blog'), null, $summaryoptions);
+ $mform->addElement('editor', 'summary', get_string('entrybody', 'blog'), null, $summaryoptions);
$mform->setType('subject', PARAM_TEXT);
$mform->addRule('subject', get_string('emptytitle', 'blog'), 'required', null, 'client');
- $mform->setType('summary_editor', PARAM_RAW);
- $mform->addRule('summary_editor', get_string('emptybody', 'blog'), 'required', null, 'client');
- $mform->setHelpButton('summary_editor', array('writing', 'richtext2'), false, 'editorhelpbutton');
+ $mform->setType('summary', PARAM_RAW);
+ $mform->addRule('summary', get_string('emptybody', 'blog'), 'required', null, 'client');
+ $mform->setHelpButton('summary', array('writing', 'richtext2'), false, 'editorhelpbutton');
- $mform->addElement('format', 'format', get_string('format'));
+ $mform->addElement('format', 'summaryformat', get_string('format'));
- $mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
+ $mform->addElement('filemanager', 'attachments', get_string('attachment', 'forum'));
//disable publishstate options that are not allowed
$publishstates = array();