]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19744 Fixed blog attachments
authornicolasconnault <nicolasconnault>
Fri, 11 Sep 2009 05:52:22 +0000 (05:52 +0000)
committernicolasconnault <nicolasconnault>
Fri, 11 Sep 2009 05:52:22 +0000 (05:52 +0000)
blog/edit.php
blog/edit_form.php

index 5fac155a49d6349e925551c6f3e6f74d6ea38a9f..a00a967cb27a04f10eebe659488c01ef04c6cd82 100755 (executable)
@@ -139,8 +139,11 @@ if (!empty($existing)) {
 
 $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);
@@ -218,7 +221,9 @@ switch ($action) {
 
 $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
index cbe982bf8f7661b8c3f2060a508f52e27c255f02..279366e590c8cae96cc281585f121c0a761ff516 100644 (file)
@@ -36,18 +36,18 @@ class blog_edit_form extends moodleform {
 
         $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();