]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11844 new option for conditional stripping of tags from activity names
authorskodak <skodak>
Sat, 26 Jul 2008 15:15:25 +0000 (15:15 +0000)
committerskodak <skodak>
Sat, 26 Jul 2008 15:15:25 +0000 (15:15 +0000)
15 files changed:
admin/settings/appearance.php
lang/en_utf8/admin.php
mod/assignment/mod_form.php
mod/chat/mod_form.php
mod/choice/mod_form.php
mod/data/mod_form.php
mod/forum/mod_form.php
mod/glossary/mod_form.php
mod/hotpot/mod_form.php
mod/lesson/mod_form.php
mod/quiz/mod_form.php
mod/resource/mod_form.php
mod/scorm/mod_form.php
mod/survey/mod_form.php
version.php

index 82100e3b5b5364849fe75001230f08eccf40431c..874aacafe20d18e00c04ef117e74d48023d1ff16 100644 (file)
@@ -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));
index fbc802f3e47e068548bf858543a0103f71ea38aa..4d794c81cd14fc703996077a957bd7ea58ee2fa2 100644 (file)
@@ -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 <b>start</b>? 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.<br />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';
index 8b42ca0022283fb223f55ba76082ef5b0ae3f005..7ea56acee067adde1d5604acdf9dcbf78660c334 100644 (file)
@@ -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'));
index ad5139ff7f17c812a9e53bc1ea6e78bf7fc9f60d..9be14b64322e22c6f1968744fd3e2653ef50ee88 100644 (file)
@@ -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'));
index 70caf0d370aae055ad725d2ae6cb1ae2fe9585fb..573ac339ff78b76fa9a21e1cec3cc3ef81ec2da1 100644 (file)
@@ -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'));
index a7e912bef76fceeacee835a4e7e4e6bf5ae652ec..d383eba0b532c634939e4b2e53de21670677a153 100644 (file)
@@ -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'));
index 1bb172e369efe8e8ccfb1567b8cbdc184d0b9f19..5a0493a4f135f17e01caa46bead2682a614c9d93 100644 (file)
@@ -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');
 
index b50c290e283e74531615aa61cd96ffae1f9e226e..2f90d15b9889991b0a80112a45f11d0904ba3b3e 100644 (file)
@@ -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'));
index 871634cf7b17dffa948da0c909bd7ba83e802e38..9af7eb369992e3119d0ec86a454bdc780deefa54 100644 (file)
@@ -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);
index 806d2360d285c2d2bb2b122a88199ba9d4a089d2..632719b408b93e9511268dd8b02e9e4c8b4ade88 100644 (file)
@@ -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
index 7b59e85db9c39e45ae20e6ef1b5d241cc0dd2e3d..1c7cf142a00dd45cf1819a726117b38a7cbcad5f 100644 (file)
@@ -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"));
index 88de7d5aa8f36400c7db976d0084fbc7774814d6..633ce29359c851ace9220bd0e97e4da19a1e49b6 100644 (file)
@@ -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'));
index dc6e6da4cef6689124d4bcb4bd4aa13f34392b34..a8153a5f39644348e95c120ee1cb561647268540 100644 (file)
@@ -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
index 86733df0b8ee85f75c7649fefe4e644426fc0bc1..b655044a4ccd655a98868bf34da4e07d8415382c 100644 (file)
@@ -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")) {
index 0d1778c0b4055464ccac7559e659016faa62b54f..c5d94e9f828372803556b4a7f8b4e2296231b1ac 100644 (file)
@@ -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