Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-39422 mod_forms: prevent long coruse module names

To prevent ugly DB errors.
  • Loading branch information...
commit 10abf35eace3f7b96dc8f06c7bac75b5af855c8d 1 parent 6b8f82e
Dan Poltawski danpoltawski authored
1  mod/assign/mod_form.php
@@ -57,6 +57,7 @@ function definition() {
57 57 $mform->setType('name', PARAM_CLEANHTML);
58 58 }
59 59 $mform->addRule('name', null, 'required', null, 'client');
  60 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
60 61
61 62 $this->add_intro_editor(true, get_string('description', 'assign'));
62 63
1  mod/assignment/mod_form.php
@@ -45,6 +45,7 @@ function definition() {
45 45 $mform->setType('name', PARAM_CLEANHTML);
46 46 }
47 47 $mform->addRule('name', null, 'required', null, 'client');
  48 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
48 49
49 50 $this->add_intro_editor(true, get_string('description', 'assignment'));
50 51
1  mod/book/mod_form.php
@@ -45,6 +45,7 @@ function definition() {
45 45 $mform->setType('name', PARAM_CLEANHTML);
46 46 }
47 47 $mform->addRule('name', null, 'required', null, 'client');
  48 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
48 49 $this->add_intro_editor($config->requiremodintro, get_string('moduleintro'));
49 50
50 51 $alloptions = book_get_numbering_types();
1  mod/chat/mod_form.php
@@ -22,6 +22,7 @@ function definition() {
22 22 $mform->setType('name', PARAM_CLEANHTML);
23 23 }
24 24 $mform->addRule('name', null, 'required', null, 'client');
  25 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
25 26
26 27 $this->add_intro_editor(true, get_string('chatintro', 'chat'));
27 28
1  mod/choice/mod_form.php
@@ -22,6 +22,7 @@ function definition() {
22 22 $mform->setType('name', PARAM_CLEANHTML);
23 23 }
24 24 $mform->addRule('name', null, 'required', null, 'client');
  25 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
25 26
26 27 $this->add_intro_editor(true, get_string('chatintro', 'chat'));
27 28
1  mod/data/mod_form.php
@@ -22,6 +22,7 @@ function definition() {
22 22 $mform->setType('name', PARAM_CLEANHTML);
23 23 }
24 24 $mform->addRule('name', null, 'required', null, 'client');
  25 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
25 26
26 27 $this->add_intro_editor(true, get_string('intro', 'data'));
27 28
1  mod/feedback/mod_form.php
@@ -44,6 +44,7 @@ public function definition() {
44 44 $mform->addElement('text', 'name', get_string('name', 'feedback'), array('size'=>'64'));
45 45 $mform->setType('name', PARAM_TEXT);
46 46 $mform->addRule('name', null, 'required', null, 'client');
  47 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
47 48
48 49 $this->add_intro_editor(true, get_string('description', 'feedback'));
49 50
1  mod/folder/mod_form.php
@@ -44,6 +44,7 @@ function definition() {
44 44 $mform->setType('name', PARAM_CLEANHTML);
45 45 }
46 46 $mform->addRule('name', null, 'required', null, 'client');
  47 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
47 48 $this->add_intro_editor($config->requiremodintro);
48 49
49 50 //-------------------------------------------------------
1  mod/glossary/mod_form.php
@@ -22,6 +22,7 @@ function definition() {
22 22 $mform->setType('name', PARAM_CLEANHTML);
23 23 }
24 24 $mform->addRule('name', null, 'required', null, 'client');
  25 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
25 26
26 27 $this->add_intro_editor(true);
27 28
1  mod/imscp/mod_form.php
@@ -45,6 +45,7 @@ function definition() {
45 45 $mform->setType('name', PARAM_CLEANHTML);
46 46 }
47 47 $mform->addRule('name', null, 'required', null, 'client');
  48 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
48 49 $this->add_intro_editor($config->requiremodintro);
49 50
50 51 //-------------------------------------------------------
1  mod/lesson/mod_form.php
@@ -89,6 +89,7 @@ function definition() {
89 89 $mform->setType('name', PARAM_CLEANHTML);
90 90 }
91 91 $mform->addRule('name', null, 'required', null, 'client');
  92 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
92 93
93 94 // Create a text box that can be enabled/disabled for lesson time limit
94 95 $timedgrp = array();
1  mod/lti/mod_form.php
@@ -67,6 +67,7 @@ public function definition() {
67 67 $mform->addElement('text', 'name', get_string('basicltiname', 'lti'), array('size'=>'64'));
68 68 $mform->setType('name', PARAM_TEXT);
69 69 $mform->addRule('name', null, 'required', null, 'client');
  70 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
70 71 // Adding the optional "intro" and "introformat" pair of fields
71 72 $this->add_intro_editor(false, get_string('basicltiintro', 'lti'));
72 73 $mform->setAdvanced('introeditor');
1  mod/page/mod_form.php
@@ -47,6 +47,7 @@ function definition() {
47 47 $mform->setType('name', PARAM_CLEANHTML);
48 48 }
49 49 $mform->addRule('name', null, 'required', null, 'client');
  50 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
50 51 $this->add_intro_editor($config->requiremodintro);
51 52
52 53 //-------------------------------------------------------
1  mod/quiz/mod_form.php
@@ -69,6 +69,7 @@ protected function definition() {
69 69 $mform->setType('name', PARAM_CLEANHTML);
70 70 }
71 71 $mform->addRule('name', null, 'required', null, 'client');
  72 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
72 73
73 74 // Introduction.
74 75 $this->add_intro_editor(false, get_string('introduction', 'quiz'));
1  mod/resource/mod_form.php
@@ -55,6 +55,7 @@ function definition() {
55 55 $mform->setType('name', PARAM_CLEANHTML);
56 56 }
57 57 $mform->addRule('name', null, 'required', null, 'client');
  58 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
58 59 $this->add_intro_editor($config->requiremodintro);
59 60
60 61 //-------------------------------------------------------
1  mod/scorm/mod_form.php
@@ -43,6 +43,7 @@ function definition() {
43 43 $mform->setType('name', PARAM_CLEANHTML);
44 44 }
45 45 $mform->addRule('name', null, 'required', null, 'client');
  46 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
46 47
47 48 // Summary
48 49 $this->add_intro_editor(true);
1  mod/url/mod_form.php
@@ -45,6 +45,7 @@ function definition() {
45 45 $mform->setType('name', PARAM_CLEANHTML);
46 46 }
47 47 $mform->addRule('name', null, 'required', null, 'client');
  48 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
48 49 $this->add_intro_editor($config->requiremodintro);
49 50
50 51 //-------------------------------------------------------
1  mod/wiki/mod_form.php
@@ -53,6 +53,7 @@ protected function definition() {
53 53 $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64'));
54 54 $mform->setType('name', PARAM_TEXT);
55 55 $mform->addRule('name', $required, 'required', null, 'client');
  56 + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
56 57 // Adding the optional "intro" and "introformat" pair of fields
57 58 $this->add_intro_editor(true, get_string('wikiintro', 'wiki'));
58 59

0 comments on commit 10abf35

Please sign in to comment.
Something went wrong with that request. Please try again.