$ADMIN->add('appearance', $temp);
-/* TODO: reimplement editor settings and preferences, editors are now full plugins ;-)
- // "htmleditor" settingpage
- $ADMIN->add('appearance', new admin_category('htmleditor', get_string('htmleditor', 'admin')));
-
- $temp = new admin_settingpage('htmleditorsettings', get_string('htmleditorsettings', 'admin'));
-
- $htmleditors = get_available_editors();
-
- $temp->add(new admin_setting_configselect('defaulthtmleditor', get_string('defaulthtmleditor', 'admin'), null, 'tinymce', $htmleditors));
- $temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
- $temp->add(new admin_setting_emoticons());
- $ADMIN->add('htmleditor', $temp);
-
-
- TODO: before deleting these settings migrate or drop config values!
- $temp = new admin_settingpage('htmlarea', get_string('htmlarea', 'admin'));
- $temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
- $temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
- $temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
- $temp->add(new admin_setting_special_editorfontlist());
- $temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
- $temp->add(new admin_setting_special_editorhidebuttons());
- $ADMIN->add('htmleditor', $temp);
-
- $temp = new admin_settingpage('tinymce', 'TinyMCE');
- // 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));
+ $temp->add(new admin_setting_emoticons());
$ADMIN->add('appearance', $temp);
// "documentation" settingpage
}
}
-/**
- * Special font selector for use in admin section
- *
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class admin_setting_special_editorfontlist extends admin_setting {
-
-/**
- * Construct method, calls parent::__construct with specific args
- */
- public function __construct() {
- global $CFG;
- $name = 'editorfontlist';
- $visiblename = get_string('editorfontlist', 'admin');
- $description = get_string('configeditorfontlist', 'admin');
- $defaults = array('k0' => 'Trebuchet',
- 'v0' => 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif',
- 'k1' => 'Arial',
- 'v1' => 'arial,helvetica,sans-serif',
- 'k2' => 'Courier New',
- 'v2' => 'courier new,courier,monospace',
- 'k3' => 'Georgia',
- 'v3' => 'georgia,times new roman,times,serif',
- 'k4' => 'Tahoma',
- 'v4' => 'tahoma,arial,helvetica,sans-serif',
- 'k5' => 'Times New Roman',
- 'v5' => 'times new roman,times,serif',
- 'k6' => 'Verdana',
- 'v6' => 'verdana,arial,helvetica,sans-serif',
- 'k7' => 'Impact',
- 'v7' => 'impact',
- 'k8' => 'Wingdings',
- 'v8' => 'wingdings');
- parent::__construct($name, $visiblename, $description, $defaults);
- }
-
- /**
- * Return the current setting
- *
- * @return array Array of the current setting(s)
- */
- public function get_setting() {
- global $CFG;
- $result = $this->config_read($this->name);
- if (is_null($result)) {
- return NULL;
- }
- $i = 0;
- $currentsetting = array();
- $items = explode(';', $result);
- foreach ($items as $item) {
- $item = explode(':', $item);
- $currentsetting['k'.$i] = $item[0];
- $currentsetting['v'.$i] = $item[1];
- $i++;
- }
- return $currentsetting;
- }
-
- /**
- * Save the new setting(s)
- *
- * @todo Add vartype handling to ensure $data is an array
- * @param array $data Array containing the new settings
- * @return bool
- */
- public function write_setting($data) {
-
- // there miiight be an easier way to do this :)
- // if this is changed, make sure the $defaults array above is modified so that this
- // function processes it correctly
-
- $keys = array();
- $values = array();
-
- foreach ($data as $key => $value) {
- if (substr($key,0,1) == 'k') {
- $keys[substr($key,1)] = $value;
- } elseif (substr($key,0,1) == 'v') {
- $values[substr($key,1)] = $value;
- }
- }
-
- $result = array();
- for ($i = 0; $i < count($keys); $i++) {
- if (($keys[$i] !== '') && ($values[$i] !== '')) {
- $result[] = clean_param($keys[$i],PARAM_NOTAGS).':'.clean_param($values[$i], PARAM_NOTAGS);
- }
- }
-
- return ($this->config_write($this->name, implode(';', $result)) ? '' : get_string('errorsetting', 'admin'));
- }
-
- /**
- * Returns XHTML for the options
- *
- * @todo Add vartype handling to ensure that $data is an array
- * @param array $data An array of values to set
- * @param string $query
- * @return string XHTML
- */
- public function output_html($data, $query='') {
- $fullname = $this->get_full_name();
- $return = '<div class="form-group">';
- for ($i = 0; $i < count($data) / 2; $i++) {
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[k'.$i.']" value="'.$data['k'.$i].'" />';
- $return .= ' ';
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[v'.$i.']" value="'.$data['v'.$i].'" /><br />';
- }
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[k'.$i.']" value="" />';
- $return .= ' ';
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[v'.$i.']" value="" /><br />';
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[k'.($i + 1).']" value="" />';
- $return .= ' ';
- $return .= '<input type="text" class="form-text" name="'.$fullname.'[v'.($i + 1).']" value="" />';
- $return .= '</div>';
-
- return format_admin_setting($this, $this->visiblename, $return, $this->description, false, '', NULL, $query);
- }
-
-}
/**
* Special settings for emoticons
*
}
}
-/**
- * Used to set editor options/settings
- *
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-class admin_setting_special_editorhidebuttons extends admin_setting {
-/** @var array Array of possible options */
- public $items;
-
- /**
- * Calls parent::__construct with specific options
- */
- public function __construct() {
- parent::__construct('editorhidebuttons', get_string('editorhidebuttons', 'admin'),
- get_string('confeditorhidebuttons', 'admin'), array());
- // weird array... buttonname => buttonimage (assume proper path appended). if you leave buttomimage blank, text will be printed instead
- $this->items = array('fontname' => '',
- 'fontsize' => '',
- 'formatblock' => '',
- 'bold' => 'ed_format_bold.gif',
- 'italic' => 'ed_format_italic.gif',
- 'underline' => 'ed_format_underline.gif',
- 'strikethrough' => 'ed_format_strike.gif',
- 'subscript' => 'ed_format_sub.gif',
- 'superscript' => 'ed_format_sup.gif',
- 'copy' => 'ed_copy.gif',
- 'cut' => 'ed_cut.gif',
- 'paste' => 'ed_paste.gif',
- 'clean' => 'ed_wordclean.gif',
- 'undo' => 'ed_undo.gif',
- 'redo' => 'ed_redo.gif',
- 'justifyleft' => 'ed_align_left.gif',
- 'justifycenter' => 'ed_align_center.gif',
- 'justifyright' => 'ed_align_right.gif',
- 'justifyfull' => 'ed_align_justify.gif',
- 'lefttoright' => 'ed_left_to_right.gif',
- 'righttoleft' => 'ed_right_to_left.gif',
- 'insertorderedlist' => 'ed_list_num.gif',
- 'insertunorderedlist' => 'ed_list_bullet.gif',
- 'outdent' => 'ed_indent_less.gif',
- 'indent' => 'ed_indent_more.gif',
- 'forecolor' => 'ed_color_fg.gif',
- 'hilitecolor' => 'ed_color_bg.gif',
- 'inserthorizontalrule' => 'ed_hr.gif',
- 'createanchor' => 'ed_anchor.gif',
- 'createlink' => 'ed_link.gif',
- 'unlink' => 'ed_unlink.gif',
- 'insertimage' => 'ed_image.gif',
- 'inserttable' => 'insert_table.gif',
- 'insertsmile' => 'em.icon.smile.gif',
- 'insertchar' => 'icon_ins_char.gif',
- 'spellcheck' => 'spell-check.gif',
- 'htmlmode' => 'ed_html.gif',
- 'popupeditor' => 'fullscreen_maximize.gif',
- 'search_replace' => 'ed_replace.gif');
- }
-
- /**
- * Get an array of current settings
- *
- * @return array Array of current settings
- */
- public function get_setting() {
- $result = $this->config_read($this->name);
- if (is_null($result)) {
- return NULL;
- }
- if ($result === '') {
- return array();
- }
- return explode(' ', $result);
- }
-
- /**
- * Save the selected settings
- *
- * @param array $data Array of settings to save
- * @return mixed empty string, error string, or bool true=>success, false=>error
- */
- public function write_setting($data) {
- if (!is_array($data)) {
- return ''; // ignore it
- }
- unset($data['xxxxx']);
- $result = array();
-
- foreach ($data as $key => $value) {
- if (!isset($this->items[$key])) {
- return get_string('errorsetting', 'admin');
- }
- if ($value == '1') {
- $result[] = $key;
- }
- }
- return ($this->config_write($this->name, implode(' ', $result)) ? '' : get_string('errorsetting', 'admin'));
- }
-
- /**
- * Return XHTML for the field and wrapping div(s)
- *
- * @param array $data
- * @param string $query
- * @return string XHTML for output
- */
- public function output_html($data, $query='') {
-
- global $CFG;
-
- // checkboxes with input name="$this->name[$key]" value="1"
- // we do 15 fields per column
-
- $return = '<div class="form-group">';
- $return .= '<table><tr><td valign="top" align="right">';
- $return .= '<input type="hidden" name="'.$this->get_full_name().'[xxxxx]" value="1" />'; // something must be submitted even if nothing selected
-
- $count = 0;
-
- foreach($this->items as $key => $value) {
- if ($count % 15 == 0 and $count != 0) {
- $return .= '</td><td valign="top" align="right">';
- }
-
- $return .= '<label for="'.$this->get_id().$key.'">';
- $return .= ($value == '' ? get_string($key,'editor') : '<img width="18" height="18" src="'.$CFG->wwwroot.'/lib/editor/htmlarea/images/'.$value.'" alt="'.get_string($key,'editor').'" title="'.get_string($key,'editor').'" />').' ';
- $return .= '<input type="checkbox" class="form-checkbox" value="1" id="'.$this->get_id().$key.'" name="'.$this->get_full_name().'['.$key.']"'.(in_array($key,$data) ? ' checked="checked"' : '').' /> ';
- $return .= '</label>';
- $count++;
- if ($count % 15 != 0) {
- $return .= '<br /><br />';
- }
- }
-
- $return .= '</td></tr>';
- $return .= '</table>';
- $return .= '</div>';
-
- return format_admin_setting($this, $this->visiblename, $return, $this->description, false, '', NULL, $query);
- }
-}
/**
* Special setting for limiting of the list of available languages.
$choices['0'] = get_string('textformat');
$choices['1'] = get_string('htmlformat');
$mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
- $mform->setDefault('mailformat', 1);
+ $mform->setDefault('mailformat', 1);
if (!empty($CFG->allowusermailcharset)) {
$choices = array();
$choices['0'] = get_string('site').' (UTF-8)';
}
$choices = array_merge($choices, $charsets);
- $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices);
+ $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices);
}
$choices = array();
$mform->addElement('select', 'trackforums', get_string('trackforums'), $choices);
$mform->setDefault('trackforums', 0);
}
-/* TODO: reimplement editor preferences
+
if (!empty($CFG->htmleditor)) {
$choices = array();
$choices['0'] = get_string('texteditor');
$mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
$mform->setDefault('htmleditor', 1);
}
-*/
+
if (empty($CFG->enableajax)) {
$mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
} else {
$choices[$key] = $theme->name;
}
}
- $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
+ $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
}
$mform->addElement('editor', 'description_editor', get_string('userdescription'), null, $editoroptions);
}
/// Moodle optional fields
- $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
+ $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
$mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
$mform->setType('url', PARAM_URL);