From 3268cf992153dc80c558d68ca4f75540595ac556 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 22 Apr 2009 06:48:15 +0000 Subject: [PATCH] MDL-18910 full support for module intro editor with embedded images --- lang/en_utf8/forum.php | 1 - lang/en_utf8/glossary.php | 1 - lang/en_utf8/scorm.php | 1 - lib/file/file_browser.php | 9 +++++++++ mod/data/lib.php | 3 --- mod/data/mod_form.php | 2 +- mod/feedback/mod_form.php | 20 ++++++++++---------- mod/forum/lib.php | 3 --- mod/glossary/lib.php | 3 --- mod/glossary/mod_form.php | 2 +- mod/hotpot/mod_form.php | 2 +- mod/quiz/mod_form.php | 2 +- mod/scorm/lib.php | 1 - mod/scorm/mod_form.php | 14 +++++++------- 14 files changed, 30 insertions(+), 34 deletions(-) diff --git a/lang/en_utf8/forum.php b/lang/en_utf8/forum.php index d148018a1d..f5284e75ee 100644 --- a/lang/en_utf8/forum.php +++ b/lang/en_utf8/forum.php @@ -24,7 +24,6 @@ $string['allsubscribe'] = 'Subscribe to all forums'; $string['allunsubscribe'] = 'Unsubscribe from all forums'; $string['alreadyfirstpost'] = 'This is already the first post in the discussion'; $string['anyfile'] = 'Any file'; -$string['areaintro'] = 'Forum introduction'; $string['attachment'] = 'Attachment'; $string['attachments'] = 'Attachments'; $string['attachmentnopost'] = 'You cannot export attachments without a post id'; diff --git a/lang/en_utf8/glossary.php b/lang/en_utf8/glossary.php index d3c9da79d6..167f33afb2 100644 --- a/lang/en_utf8/glossary.php +++ b/lang/en_utf8/glossary.php @@ -15,7 +15,6 @@ $string['allowprintview'] = 'Allow print view'; $string['allowratings'] = 'Allow entries to be rated?'; $string['answer'] = 'Answer'; $string['approve'] = 'Approve'; -$string['areaintro'] = 'Glossary introduction'; $string['areyousuredelete'] = 'Are you sure you want to delete this entry?'; $string['areyousuredeletecomment'] = 'Are you sure you want to delete this comment?'; $string['areyousureexport'] = 'Are you sure you want to export this entry to'; diff --git a/lang/en_utf8/scorm.php b/lang/en_utf8/scorm.php index 2501e675f6..81977d8996 100644 --- a/lang/en_utf8/scorm.php +++ b/lang/en_utf8/scorm.php @@ -9,7 +9,6 @@ $string['apidebugmask'] = 'API debug capture mask (simple regex on <username& $string['allowtypeexternal'] = 'Enable external package type'; $string['allowtypeimsrepository'] = 'Enable IMS package type'; $string['allowtypelocalsync'] = 'Enable downloaded package type'; -$string['areaintro'] = 'Introduction files'; $string['areacontent'] = 'Content files'; $string['areapackage'] = 'Package file'; $string['asset'] = 'Asset'; diff --git a/lib/file/file_browser.php b/lib/file/file_browser.php index c697b83fc7..31c8b8454f 100644 --- a/lib/file/file_browser.php +++ b/lib/file/file_browser.php @@ -474,8 +474,17 @@ class file_browser { if (function_exists($fileinfofunction)) { $areas = $fileinfofunction($course, $cm, $context); } else { + $areas = array(); + } + if (!isset($areas[$modname.'_intro']) + and plugin_supports('mod', $modname, FEATURE_MOD_INTRO, true) + and has_capability('moodle/course:managefiles', $context)) { + $areas[$modname.'_intro'] = get_string('moduleintro'); + } + if (empty($areas)) { return null; } + if (is_null($filearea) or is_null($itemid)) { return new file_info_module($this, $course, $cm, $context, $areas); diff --git a/mod/data/lib.php b/mod/data/lib.php index b7a10ed577..d8300f0a83 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -2466,9 +2466,6 @@ function data_get_exportdata($dataid, $fields, $selectedfields) { */ function data_get_file_areas($course, $cm, $context) { $areas = array(); - if (has_capability('moodle/course:managefiles', $context)) { - $areas['data_intro'] = get_string('areaintro', 'data'); - } return $areas; } diff --git a/mod/data/mod_form.php b/mod/data/mod_form.php index 9777a96f49..244339522a 100644 --- a/mod/data/mod_form.php +++ b/mod/data/mod_form.php @@ -69,7 +69,7 @@ class mod_data_mod_form extends moodleform_mod { function data_preprocessing(&$default_values){ if (empty($default_values['scale'])){ $default_values['assessed'] = 0; - } + } } } diff --git a/mod/feedback/mod_form.php b/mod/feedback/mod_form.php index da13615328..ad0eca27ad 100644 --- a/mod/feedback/mod_form.php +++ b/mod/feedback/mod_form.php @@ -19,7 +19,7 @@ class mod_feedback_mod_form extends moodleform_mod { //------------------------------------------------------------------------------- $mform->addElement('header', 'general', get_string('general', 'form')); - + $mform->addElement('text', 'name', get_string('name', 'feedback'), array('size'=>'64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', null, 'required', null, 'client'); @@ -28,40 +28,40 @@ class mod_feedback_mod_form extends moodleform_mod { //------------------------------------------------------------------------------- $mform->addElement('header', 'timinghdr', get_string('timing', 'form')); - + $enableopengroup = array(); $enableopengroup[] =& $mform->createElement('checkbox', 'openenable', get_string('feedbackopen', 'feedback')); $enableopengroup[] =& $mform->createElement('date_time_selector', 'timeopen', ''); $mform->addGroup($enableopengroup, 'enableopengroup', get_string('feedbackopen', 'feedback'), ' ', false); $mform->setHelpButton('enableopengroup', array('timeopen', get_string('feedbackopens', 'feedback'), 'feedback')); $mform->disabledIf('enableopengroup', 'openenable', 'notchecked'); - + $enableclosegroup = array(); $enableclosegroup[] =& $mform->createElement('checkbox', 'closeenable', get_string('feedbackclose', 'feedback')); $enableclosegroup[] =& $mform->createElement('date_time_selector', 'timeclose', ''); $mform->addGroup($enableclosegroup, 'enableclosegroup', get_string('feedbackclose', 'feedback'), ' ', false); $mform->setHelpButton('enableclosegroup', array('timeclose', get_string('feedbackcloses', 'feedback'), 'feedback')); $mform->disabledIf('enableclosegroup', 'closeenable', 'notchecked'); - + //------------------------------------------------------------------------------- $mform->addElement('header', 'feedbackhdr', get_string('feedback_options', 'feedback')); - + $options=array(); $options[1] = get_string('anonymous', 'feedback'); $options[2] = get_string('non_anonymous', 'feedback'); $mform->addElement('select', 'anonymous', get_string('anonymous_edit', 'feedback'), $options); - + $mform->addElement('selectyesno', 'publish_stats', get_string('show_analysepage_after_submit', 'feedback')); $mform->addElement('selectyesno', 'email_notification', get_string('email_notification', 'feedback')); $mform->setHelpButton('email_notification', array('emailnotification', get_string('email_notification', 'feedback'), 'feedback')); - + // check if there is existing responses to this feedback if (is_numeric($this->_instance) AND $this->_instance and $feedback = $DB->get_record("feedback", array("id"=>$this->_instance))) { $completedFeedbackCount = feedback_get_completeds_group_count($feedback); } else { $completedFeedbackCount = false; } - + if($completedFeedbackCount) { $multiple_submit_value = $feedback->multiple_submit ? get_string('yes') : get_string('no'); $mform->addElement('text', 'multiple_submit_static', get_string('multiple_submit', 'feedback'), array('size'=>'4','disabled'=>'disabled', 'value'=>$multiple_submit_value)); @@ -73,10 +73,10 @@ class mod_feedback_mod_form extends moodleform_mod { } $mform->addElement('selectyesno', 'autonumbering', get_string('autonumbering', 'feedback')); $mform->setHelpButton('autonumbering', array('autonumbering', get_string('autonumbering', 'feedback'), 'feedback')); - + //------------------------------------------------------------------------------- $mform->addElement('header', 'aftersubmithdr', get_string('after_submit', 'feedback')); - + $mform->addElement('text', 'site_after_submit', get_string('site_after_submit', 'feedback'), array('size'=>'64','maxlength'=>'255')); $mform->setType('site_after_submit', PARAM_TEXT); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index c241ea0e72..101f1d6c72 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4048,9 +4048,6 @@ function forum_print_attachments($post, $cm, $type) { */ function forum_get_file_areas($course, $cm, $context) { $areas = array(); - if (has_capability('moodle/course:managefiles', $context)) { - $areas['forum_intro'] = get_string('areaintro', 'forum'); - } return $areas; } diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 0d0798a01a..10a7c8047d 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -1068,9 +1068,6 @@ function glossary_print_attachments($entry, $cm, $type=NULL, $align="left") { */ function glossary_get_file_areas($course, $cm, $context) { $areas = array(); - if (has_capability('moodle/course:managefiles', $context)) { - $areas['glossary_intro'] = get_string('areaintro', 'glossary'); - } return $areas; } diff --git a/mod/glossary/mod_form.php b/mod/glossary/mod_form.php index bed2930123..da243a6eb1 100644 --- a/mod/glossary/mod_form.php +++ b/mod/glossary/mod_form.php @@ -173,7 +173,7 @@ class mod_glossary_mod_form extends moodleform_mod { function data_preprocessing(&$default_values){ if (empty($default_values['scale'])){ $default_values['assessed'] = 0; - } + } if (empty($default_values['assessed'])){ $default_values['userating'] = 0; diff --git a/mod/hotpot/mod_form.php b/mod/hotpot/mod_form.php index 79a3fc440f..de15a8061c 100644 --- a/mod/hotpot/mod_form.php +++ b/mod/hotpot/mod_form.php @@ -3,7 +3,7 @@ require_once ($CFG->dirroot.'/course/moodleform_mod.php'); require_once ($CFG->dirroot.'/mod/hotpot/lib.php'); $HOTPOT_TEXTSOURCE = array( - HOTPOT_TEXTSOURCE_QUIZ => get_string('textsourcequiz', 'hotpot'), + HOTPOT_TEXTSOURCE_QUIZ => get_string('textsourcequiz', 'hotpot'), HOTPOT_TEXTSOURCE_FILENAME => get_string('textsourcefilename', 'hotpot'), HOTPOT_TEXTSOURCE_FILEPATH => get_string('textsourcefilepath', 'hotpot'), HOTPOT_TEXTSOURCE_SPECIFIC => get_string('textsourcespecific', 'hotpot') diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 5f81141e51..7d623f8b59 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -28,7 +28,7 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php'); /** * Settings form for the quiz module. - * + * * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 0d308a588b..a9ca61027e 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -690,7 +690,6 @@ function scorm_get_extra_capabilities() { function scorm_get_file_areas($course, $cm, $context) { $areas = array(); if (has_capability('moodle/course:managefiles', $context)) { - $areas['scorm_intro'] = get_string('areaintro', 'scorm'); $areas['scorm_content'] = get_string('areacontent', 'scorm'); $areas['scorm_package'] = get_string('areapackage', 'scorm'); } diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index cf50882433..323147180f 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -84,7 +84,7 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), scorm_get_grade_method_array()); $mform->setHelpButton('grademethod', array('grademethod', get_string('grademethod', 'scorm'),'scorm')); $mform->setDefault('grademethod', $cfg_scorm->grademethod); - + // Maximum Grade for ($i=0; $i<=100; $i++) { $grades[$i] = "$i"; @@ -100,17 +100,17 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array()); $mform->setHelpButton('maxattempt', array('maxattempt',get_string('maximumattempts', 'scorm'), 'scorm')); $mform->setDefault('maxattempt', $cfg_scorm->maxattempts); - + // Display attempt status $mform->addElement('selectyesno', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm')); $mform->setHelpButton('displayattemptstatus', array('displayattemptstatus',get_string('displayattemptstatus', 'scorm'), 'scorm')); $mform->setDefault('displayattemptstatus', $cfg_scorm->displayattemptstatus); - + // Display course structure $mform->addElement('selectyesno', 'displaycoursestructure', get_string('displaycoursestructure', 'scorm')); $mform->setHelpButton('displaycoursestructure', array('displaycoursestructure',get_string('displaycoursestructure', 'scorm'), 'scorm')); $mform->setDefault('displaycoursestructure', $cfg_scorm->displaycoursestructure); - + // Force completed $mform->addElement('selectyesno', 'forcecompleted', get_string('forcecompleted', 'scorm')); $mform->setHelpButton('forcecompleted', array('forcecompleted',get_string('forcecompleted', 'scorm'), 'scorm')); @@ -122,13 +122,13 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setHelpButton('forcenewattempt', array('forcenewattempt',get_string('forcenewattempt', 'scorm'), 'scorm')); $mform->setDefault('forcenewattempt', $cfg_scorm->forcenewattempt); $mform->setAdvanced('forcenewattempt'); - + // Last attempt lock - lock the enter button after the last available attempt has been made $mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm')); $mform->setHelpButton('lastattemptlock', array('lastattemptlock',get_string('lastattemptlock', 'scorm'), 'scorm')); $mform->setDefault('lastattemptlock', $cfg_scorm->lastattemptlock); $mform->setAdvanced('lastattemptlock'); - + // What Grade $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array()); $mform->disabledIf('whatgrade', 'maxattempt','eq',1); @@ -155,7 +155,7 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setDefault('enddisabled', 1); $mform->disabledIf('dateendgrp', 'enddisabled', 'checked'); */ - + // Stage Size $mform->addElement('static', '', '' ,'
'); $mform->addElement('static', 'stagesize', get_string('stagesize','scorm')); -- 2.39.5