]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18910 full support for module intro editor with embedded images
authorskodak <skodak>
Wed, 22 Apr 2009 04:31:54 +0000 (04:31 +0000)
committerskodak <skodak>
Wed, 22 Apr 2009 04:31:54 +0000 (04:31 +0000)
mod/data/lib.php
mod/data/mod_form.php
mod/data/rsslib.php
mod/data/view.php

index f05b690552cd93da5e120ed05de0bbfd3930b8e7..b7a10ed577980ff4cfe74b21340553199a46ef26 100755 (executable)
@@ -2482,22 +2482,7 @@ function data_pluginfile($course, $cminfo, $context, $filearea, $args) {
         return false;
     }
 
-    if ($filearea === 'data_intro') {
-        // all users may access it
-        $relativepath = '/'.implode('/', $args);
-        $fullpath = $context->id.'data_intro0'.$relativepath;
-
-        $fs = get_file_storage();
-        if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
-            return false;
-        }
-
-        $lifetime = isset($CFG->filelifetime) ? $CFG->filelifetime : 86400;
-
-        // finally send the file
-        send_stored_file($file, $lifetime, 0);
-
-    } else if ($filearea === 'data_content') {
+    if ($filearea === 'data_content') {
         $contentid = (int)array_shift($args);
 
         if (!$content = $DB->get_record('data_content', array('id'=>$contentid))) {
index e1c910cddf7033304f9565f2473a794358ef2574..9777a96f49cd21352cdaf992ca16fef2099febcc 100644 (file)
@@ -19,10 +19,7 @@ class mod_data_mod_form extends moodleform_mod {
         }
         $mform->addRule('name', null, 'required', null, 'client');
 
-        $mform->addElement('htmleditor', 'intro', get_string('intro', 'data'));
-        $mform->setType('intro', PARAM_RAW);
-        $mform->addRule('intro', null, 'required', null, 'client');
-        $mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
+        $this->add_intro_editor(true, get_string('intro', 'data'));
 
         $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));
 
index 7f7354079040e2f7a8add6cc337e9070f900226b..ef0390779af1c08e2a43a068cf25106bf55f179f 100644 (file)
@@ -86,7 +86,7 @@
                         // First all rss feeds common headers.
                         $header = rss_standard_header($course->shortname.': '.format_string($data->name,true),
                                                       $CFG->wwwroot."/mod/data/view.php?d=".$data->id,
-                                                      format_string($data->intro,true));
+                                                      format_string($data->intro,true)); //TODO: fix format
 
                         if (!empty($header)) {
                             $articles = rss_add_items($items);
index 9a6792730ad5b7f1c9f0922b2ca43552d31f8002..ed15395bc9baece01509d3a0d36ff090d20948d7 100755 (executable)
     if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
         $options = new object();
         $options->noclean = true;
-        print_box(format_text($data->intro, $data->introformat, $options), 'generalbox', 'intro');
+        print_box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
     }
 
 /// Delete any requested records