Skip to content

Commit

Permalink
MDL-16676 All references to the text.html and emoticons.html files ne…
Browse files Browse the repository at this point in the history
…ed to be updated to point to text2.html and emoticons2.html
  • Loading branch information
tjhunt committed Sep 25, 2008
1 parent a94cf79 commit 16851b2
Show file tree
Hide file tree
Showing 25 changed files with 60 additions and 34 deletions.
2 changes: 1 addition & 1 deletion admin/user/user_message_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function definition() {

$mform->addElement('textarea', 'messagebody', get_string('messagebody'), array('rows'=>15, 'cols'=>60));
$mform->addRule('messagebody', '', 'required', null, 'client');
$mform->setHelpButton('messagebody', array('writing', 'reading', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('messagebody', array('writing', 'reading', 'questions', 'richtext2'), false, 'editorhelpbutton');
$mform->addElement('format', 'format', get_string('format'));

$this->add_action_buttons();
Expand Down
2 changes: 1 addition & 1 deletion blog/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function definition() {
$mform->addElement('htmleditor', 'summary', get_string('entrybody', 'blog'), array('rows'=>25));
$mform->setType('summary', PARAM_RAW);
$mform->addRule('summary', get_string('emptybody', 'blog'), 'required', null, 'client');
$mform->setHelpButton('summary', array('writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('summary', array('writing', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format', 'format', get_string('format'));

Expand Down
2 changes: 1 addition & 1 deletion course/editcategory_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function definition() {
$themes += get_list_of_themes();
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
}
$mform->setHelpButton('description', array('writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('description', array('writing', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('hidden', 'id', null);
$mform->addElement('hidden', 'categoryadd', 0);
Expand Down
17 changes: 16 additions & 1 deletion lib/form/editorhelp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$topics = array();
$titles = array();
for ($i=1; ; $i++){
$button = optional_param("button$i", '', PARAM_ALPHAEXT);
$button = optional_param("button$i", '', PARAM_ALPHANUMEXT);
if ($button){
switch ($button){
case 'reading' :
Expand All @@ -16,12 +16,27 @@
$topics[$i] = helplink('questions', get_string('helpquestions'));
break;
case 'emoticons' :
debugging("You are referring to the old help file 'emoticons'. " .
"This was renamed to 'emoticons2' becuase of MDL-13233. " .
"Please update your code.", DEBUG_DEVELOPER);
// Fall through.
case 'emoticons2' :
$topics[$i] = helplink('emoticons2', get_string('helpemoticons'));
break;
case 'richtext' :
debugging("You are referring to the old help file 'richtext'. " .
"This was renamed to 'richtext2' becuase of MDL-13233. " .
"Please update your code.", DEBUG_DEVELOPER);
// Fall through.
case 'richtext2' :
$topics[$i] = helplink('richtext2', get_string('helprichtext'));
break;
case 'text' :
debugging("You are referring to the old help file 'text'. " .
"This was renamed to 'text2' becuase of MDL-13233. " .
"Please update your code.", DEBUG_DEVELOPER);
// Fall through.
case 'text2' :
$topics[$i] = helplink('text2', get_string('helptext'));
break;
default :
Expand Down
4 changes: 2 additions & 2 deletions lib/form/htmleditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ function setHelpButton($helpbuttonargs, $function='helpbutton'){
if ('editorhelpbutton' == $function){
$key = array_search('richtext2', $helpbuttonargs);
if ($key !== FALSE){
array_splice($helpbuttonargs, $key, 1, array('text', 'emoticons'));
array_splice($helpbuttonargs, $key, 1, array('text2', 'emoticons2'));
}
} elseif ('helpbutton' == $function && $helpbuttonargs[0] == 'richtext2' && ((!isset($helpbuttonargs[2])) || $helpbuttonargs[2] == 'moodle')){
//replace single 'richtext' help button with text and emoticon button when htmleditor off.
return $this->setHelpButton(array('text', 'emoticons'), 'editorhelpbutton');
return $this->setHelpButton(array('text2', 'emoticons2'), 'editorhelpbutton');
}
}
return parent::setHelpButton($helpbuttonargs, $function);
Expand Down
29 changes: 20 additions & 9 deletions lib/form/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,34 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
global $SESSION;
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
if (!is_array($helpbuttonargs)) {
$helpbuttonargs = array($helpbuttonargs);
} else {
$helpbuttonargs = $helpbuttonargs;
}
print_object($helpbuttonargs); // DONOTCOMMIT
debugging("'$function'", DEBUG_DEVELOPER); // DONOTCOMMIT
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
} elseif ('editorhelpbutton' == $function){
if (in_array('emoticons', $helpbuttonargs)){
debugging("'tadpole'", DEBUG_DEVELOPER); // DONOTCOMMIT
$defaultargs = array('', '', 'moodle', true, false, '', true);
$helpbuttonargs = $helpbuttonargs + $defaultargs ;
if (in_array($helpbuttonargs[0], array('emoticons2', 'text2', 'richtext2'))) {
debugging("'frog'", DEBUG_DEVELOPER); // DONOTCOMMIT
$SESSION->inserttextform = $this->_formid;
$SESSION->inserttextfield = $this->getAttribute('name');
}
} else if ('editorhelpbutton' == $function) {
debugging("'eft'", DEBUG_DEVELOPER); // DONOTCOMMIT
$specialhelp = array_intersect($helpbuttonargs, array('emoticons2', 'text2', 'richtext2'));
if (!empty($specialhelp)) {
debugging("'newt'", DEBUG_DEVELOPER); // DONOTCOMMIT
$SESSION->inserttextform = $this->_formid;
$SESSION->inserttextfield = $this->getAttribute('name');
}
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
$this->_helpbutton = call_user_func_array($function, $helpbuttonargs);
}
/**
* get html for help button
Expand Down
2 changes: 1 addition & 1 deletion mod/assignment/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function definition() {

$mform->addElement('htmleditor', 'description', get_string('description', 'assignment'));
$mform->setType('description', PARAM_RAW);
$mform->setHelpButton('description', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('description', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('description', get_string('required'), 'required', null, 'client');

$mform->addElement('modgrade', 'grade', get_string('grade'));
Expand Down
2 changes: 1 addition & 1 deletion mod/assignment/type/online/assignment.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function definition() {
// visible elements
$mform->addElement('htmleditor', 'text', get_string('submission', 'assignment'), array('cols'=>60, 'rows'=>30));
$mform->setType('text', PARAM_RAW); // to be cleaned before display
$mform->setHelpButton('text', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('text', array('reading', 'writing', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('text', get_string('required'), 'required', null, 'client');

$mform->addElement('format', 'format', get_string('format'));
Expand Down
2 changes: 1 addition & 1 deletion mod/chat/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function definition() {

$mform->addElement('htmleditor', 'intro', get_string('chatintro', 'chat'));
$mform->setType('intro', PARAM_RAW);
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('intro', get_string('required'), 'required', null, 'client');

$mform->addElement('date_time_selector', 'chattime', get_string('chattime', 'chat'));
Expand Down
2 changes: 1 addition & 1 deletion mod/choice/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function definition() {
$mform->addElement('htmleditor', 'text', get_string('choicetext', 'choice'));
$mform->setType('text', PARAM_RAW);
$mform->addRule('text', null, 'required', null, 'client');
$mform->setHelpButton('text', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('text', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format', 'format', get_string('format'));

Expand Down
2 changes: 1 addition & 1 deletion mod/data/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function definition() {
$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', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));

Expand Down
2 changes: 1 addition & 1 deletion mod/forum/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function definition() {
$mform->addElement('htmleditor', 'intro', get_string('forumintro', 'forum'));
$mform->setType('intro', PARAM_RAW);
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format', 'format', get_string('format'));

Expand Down
2 changes: 1 addition & 1 deletion mod/forum/post_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function definition() {
$mform->addElement('htmleditor', 'message', get_string('message', 'forum'), array('cols'=>50, 'rows'=>30, 'filearea'=>'forumpost'));
$mform->setType('message', PARAM_RAW);
$mform->addRule('message', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('message', array('reading', 'writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('message', array('reading', 'writing', 'questions', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format', 'format', get_string('format'));

Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/comment_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function definition() {
$mform->addElement('htmleditor', 'entrycomment',get_string('comment', 'glossary'));
$mform->addRule('entrycomment', get_string('required'), 'required', null, 'client');
$mform->setType('entrycomment', PARAM_RAW); // processed by trusttext or cleaned before the display
$mform->setHelpButton('entrycomment', array('writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('entrycomment', array('writing', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format', 'format', get_string('format'));
$mform->setHelpButton('format', array('textformat', get_string('helpformatting')));
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function definition() {
$mform->addElement('htmleditor', 'definition', get_string('definition', 'glossary'), array('rows'=>20));
$mform->setType('definition', PARAM_RAW);
$mform->addRule('definition', null, 'required', null, 'client');
$mform->setHelpButton('definition', array('writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('definition', array('writing', 'richtext2'), false, 'editorhelpbutton');

$mform->addElement('format');

Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function definition() {
$mform->addElement('htmleditor', 'intro', get_string('description'));
$mform->setType('intro', PARAM_RAW);
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'text'), false, 'editorhelpbutton');
$mform->setHelpButton('intro', array('writing', 'questions', 'text2'), false, 'editorhelpbutton');

$mform->addElement('text', 'entbypage', get_string('entbypage', 'glossary'));
$mform->setDefault('entbypage', 10);
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function definition() {
$mform->addElement('hidden', 'summarysource', HOTPOT_TEXTSOURCE_SPECIFIC);
$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
$mform->setAdvanced('summary');
}
$mform->setType('summarysource', PARAM_INT);
Expand Down
2 changes: 1 addition & 1 deletion mod/label/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function definition() {
$mform->addElement('htmleditor', 'content', get_string('labeltext', 'label'), array('size'=>'64'));
$mform->setType('content', PARAM_RAW);
$mform->addRule('content', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('content', array('questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('content', array('questions', 'richtext2'), false, 'editorhelpbutton');

$features = array('groups'=>false, 'groupings'=>false, 'groupmembersonly'=>true,
'outcomes'=>false, 'gradecat'=>false, 'idnumber'=>false);
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function definition() {

$mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
$mform->setType('intro', PARAM_RAW);
$mform->setHelpButton('intro', array('richtext', get_string('helprichtext')));
$mform->setHelpButton('intro', array('richtext2', get_string('helprichtext')));

//-------------------------------------------------------------------------------
$mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/type/html/resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function setup_elements(&$mform) {

$mform->addElement('htmleditor', 'alltext', get_string('fulltext', 'resource'), array('cols'=>85, 'rows'=>30));
$mform->setType('alltext', PARAM_RAW);
$mform->setHelpButton('alltext', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('alltext', array('reading', 'writing', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('alltext', get_string('required'), 'required', null, 'client');

$mform->addElement('header', 'displaysettings', get_string('display', 'resource'));
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/type/text/resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function setup_elements(&$mform) {

$mform->addElement('textarea', 'alltext', get_string('fulltext', 'resource'), array('cols'=>85, 'rows'=>30));
$mform->setType('alltext', PARAM_RAW);
$mform->setHelpButton('alltext', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('alltext', array('reading', 'writing', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('alltext', get_string('required'), 'required', null, 'client');

$mform->addElement('format', 'reference', get_string('format'), null, false);
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function definition() {
$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->addRule('summary', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');

// Scorm types
$options = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
Expand Down
2 changes: 1 addition & 1 deletion mod/wiki/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function definition() {

$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
$mform->addRule('summary', get_string('required'), 'required', null, 'client');

if (!$wikihasentries){
Expand Down
2 changes: 1 addition & 1 deletion question/type/edit_question_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function definition() {
$mform->addElement('htmleditor', 'questiontext', get_string('questiontext', 'quiz'),
array('rows' => 15, 'course' => $this->coursefilesid));
$mform->setType('questiontext', PARAM_RAW);
$mform->setHelpButton('questiontext', array(array('questiontext', get_string('questiontext', 'quiz'), 'quiz'), 'richtext'), false, 'editorhelpbutton');
$mform->setHelpButton('questiontext', array(array('questiontext', get_string('questiontext', 'quiz'), 'quiz'), 'richtext2'), false, 'editorhelpbutton');
$mform->addElement('format', 'questiontextformat', get_string('format'));

make_upload_directory($this->coursefilesid); // Just in case
Expand Down
2 changes: 1 addition & 1 deletion user/filters/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function setupForm(&$mform) {
$objs[] =& $mform->createElement('select', $this->_name.'_op', null, $this->getOperators());
$objs[] =& $mform->createElement('text', $this->_name, null);
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$grp->setHelpButton(array('text',$this->_label,'filters'));
$grp->setHelpButton(array('text2',$this->_label,'filters'));
$mform->disabledIf($this->_name, $this->_name.'_op', 'eq', 5);
if ($this->_advanced) {
$mform->setAdvanced($this->_name.'_grp');
Expand Down

0 comments on commit 16851b2

Please sign in to comment.