From: skodak Date: Sat, 26 Jul 2008 15:15:25 +0000 (+0000) Subject: MDL-11844 new option for conditional stripping of tags from activity names X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8eb1d25ffe7038ab89e078f1322b12bfcd48651e;p=moodle.git MDL-11844 new option for conditional stripping of tags from activity names --- diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 82100e3b5b..874aacafe2 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -78,6 +78,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page // add tinymce configuration options here $ADMIN->add('htmleditor', $temp); + // "htmlsettings" settingpage + $temp = new admin_settingpage('htmlsettings', get_string('htmlsettings', 'admin')); + $temp->add(new admin_setting_configcheckbox('formatstringstriptags', get_string('stripalltitletags', 'admin'), get_string('configstripalltitletags', 'admin'), 1)); + $ADMIN->add('appearance', $temp); + // "documentation" settingpage $temp = new admin_settingpage('documentation', get_string('moodledocs')); $temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL)); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index fbc802f3e4..4d794c81cd 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -234,6 +234,7 @@ $string['configstatsmaxruntime'] = 'Stats processing can be quite intensive, so $string['configstatsmaxruntime2'] = 'Stats processing can be quite intensive, specify maximum time allowed for gathering of one day of statistics. Maximum number of days processed in one cron execution is 3.'; $string['configstatsruntimestart'] = 'What time should the cronjob that does the stats processing start? Please specify different times if there are multiple Moodles on one physical server.'; $string['configstatsuserthreshold'] = 'If you enter a non-zero, non numeric value here, for ranking courses, courses with less than this number of enrolled users (all roles) will be ignored'; +$string['configstripalltitletags'] = 'By default all HTML tags are removed from all titles of activities, posts, blogs, etc. Uncheck this if you want to allow html tags in activity names.'; $string['configsupportemail'] = 'This email address will be published to users of this site as the one to email when they need general help (for example, when new users create their own accounts). If this email is left blank then no such helpful email address is supplied.'; $string['configsupportname'] = 'This is the name of a person or other entity offering general help via the support email or web address.'; $string['configsupportpage'] = 'This web address will be published to users of this site as the one to go to when they need general help (for example, when new users create their own accounts). If this address is left blank then no link will be supplied.'; @@ -405,6 +406,7 @@ $string['hidefromnone'] = 'Hide from nobody'; $string['hidefromstudents'] = 'Hide from students'; $string['htmleditor'] = 'HTML editor'; $string['htmleditorsettings'] = 'HTML editor settings'; +$string['htmlsettings'] = 'HTML settings'; $string['http'] = 'HTTP'; $string['httpsecurity'] = 'HTTP security'; $string['iconvrecommended'] = 'Installing the optional ICONV library is highly recommended in order to improve site performance, particularly if your site is supporting non-Latin languages.'; @@ -677,6 +679,7 @@ $string['stickyblockscourseview'] = 'Course page'; $string['stickyblocksduplicatenotice'] = 'If any block you add here is already present in a particular page, it will result in a duplicate.
Only the pinned block will be non-editable, the duplicate will still be editable.'; $string['stickyblocksmymoodle'] = 'My Moodle'; $string['stickyblockspagetype'] = 'Page type to configure'; +$string['stripalltitletags'] = 'Remove HTML tags from all titles'; $string['supportemail'] = 'Support email'; $string['supportname'] = 'Support name'; $string['supportpage'] = 'Support page'; diff --git a/mod/assignment/mod_form.php b/mod/assignment/mod_form.php index 8b42ca0022..7ea56acee0 100644 --- a/mod/assignment/mod_form.php +++ b/mod/assignment/mod_form.php @@ -32,7 +32,11 @@ class mod_assignment_mod_form extends moodleform_mod { // $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment')); $mform->addElement('text', 'name', get_string('assignmentname', 'assignment'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'description', get_string('description', 'assignment')); diff --git a/mod/chat/mod_form.php b/mod/chat/mod_form.php index ad5139ff7f..9be14b6432 100644 --- a/mod/chat/mod_form.php +++ b/mod/chat/mod_form.php @@ -11,7 +11,11 @@ class mod_chat_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('chatname', 'chat'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'intro', get_string('chatintro', 'chat')); diff --git a/mod/choice/mod_form.php b/mod/choice/mod_form.php index 70caf0d370..573ac339ff 100644 --- a/mod/choice/mod_form.php +++ b/mod/choice/mod_form.php @@ -4,7 +4,7 @@ require_once ($CFG->dirroot.'/course/moodleform_mod.php'); class mod_choice_mod_form extends moodleform_mod { function definition() { - global $CHOICE_SHOWRESULTS, $CHOICE_PUBLISH, $CHOICE_DISPLAY, $DB; + global $CFG, $CHOICE_SHOWRESULTS, $CHOICE_PUBLISH, $CHOICE_DISPLAY, $DB; $mform =& $this->_form; @@ -12,7 +12,11 @@ class mod_choice_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('choicename', 'choice'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'text', get_string('choicetext', 'choice')); diff --git a/mod/data/mod_form.php b/mod/data/mod_form.php index a7e912bef7..d383eba0b5 100644 --- a/mod/data/mod_form.php +++ b/mod/data/mod_form.php @@ -12,7 +12,11 @@ class mod_data_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'intro', get_string('intro', 'data')); diff --git a/mod/forum/mod_form.php b/mod/forum/mod_form.php index 1bb172e369..5a0493a4f1 100644 --- a/mod/forum/mod_form.php +++ b/mod/forum/mod_form.php @@ -12,7 +12,11 @@ class mod_forum_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('forumname', 'forum'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); diff --git a/mod/glossary/mod_form.php b/mod/glossary/mod_form.php index b50c290e28..2f90d15b98 100644 --- a/mod/glossary/mod_form.php +++ b/mod/glossary/mod_form.php @@ -12,7 +12,11 @@ class mod_glossary_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'intro', get_string('description')); diff --git a/mod/hotpot/mod_form.php b/mod/hotpot/mod_form.php index 871634cf7b..9af7eb3699 100644 --- a/mod/hotpot/mod_form.php +++ b/mod/hotpot/mod_form.php @@ -58,7 +58,11 @@ class mod_hotpot_mod_form extends moodleform_mod { $mform->addElement('text', 'name', get_string('name'), array('size' => '40')); } $mform->setType('namesource', PARAM_INT); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } // Location $sitecontext = get_context_instance(CONTEXT_SYSTEM); diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php index 806d2360d2..632719b408 100644 --- a/mod/lesson/mod_form.php +++ b/mod/lesson/mod_form.php @@ -14,7 +14,7 @@ require_once('locallib.php'); class mod_lesson_mod_form extends moodleform_mod { function definition() { - global $LESSON_NEXTPAGE_ACTION, $COURSE, $DB; + global $CFG, $LESSON_NEXTPAGE_ACTION, $COURSE, $DB; $mform =& $this->_form; @@ -22,7 +22,11 @@ class mod_lesson_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); // Create a text box that can be enabled/disabled for lesson time limit diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 7b59e85db9..1c7cf142a0 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -15,7 +15,11 @@ class mod_quiz_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz")); diff --git a/mod/resource/mod_form.php b/mod/resource/mod_form.php index 88de7d5aa8..633ce29359 100644 --- a/mod/resource/mod_form.php +++ b/mod/resource/mod_form.php @@ -31,7 +31,11 @@ class mod_resource_mod_form extends moodleform_mod { // $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'48')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'summary', get_string('summary')); diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index dc6e6da4ce..a8153a5f39 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -14,7 +14,11 @@ class mod_scorm_mod_form extends moodleform_mod { // Name $mform->addElement('text', 'name', get_string('name')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); // Summary diff --git a/mod/survey/mod_form.php b/mod/survey/mod_form.php index 86733df0b8..b655044a4c 100644 --- a/mod/survey/mod_form.php +++ b/mod/survey/mod_form.php @@ -14,7 +14,11 @@ class mod_survey_mod_form extends moodleform_mod { $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); - $mform->setType('name', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEAN); + } $mform->addRule('name', null, 'required', null, 'client'); if (!$options = $DB->get_records_menu("survey", array("template"=>0), "name", "id, name")) { diff --git a/version.php b/version.php index 0d1778c0b4..c5d94e9f82 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2008072500; // YYYYMMDD = date of the last version bump + $version = 2008072600; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20080726)'; // Human-friendly version name