Skip to content

Commit

Permalink
MDL-39405 wiki: Reformat forms for better usability
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Apr 30, 2013
1 parent d36cc73 commit 7ce746f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion mod/wiki/create_form.php
Expand Up @@ -35,7 +35,7 @@ protected function definition() {
$defaultformat = $this->_customdata['defaultformat'];
$forceformat = $this->_customdata['forceformat'];

$mform->addElement('header', 'general', get_string('createpage', 'wiki'));
$mform->addElement('header', 'general', get_string('newpagehdr', 'wiki'));

$textoptions = array();
if (!empty($this->_customdata['disable_pagetitle'])) {
Expand Down
1 change: 1 addition & 0 deletions mod/wiki/lang/en/wiki.php
Expand Up @@ -131,6 +131,7 @@
$string['navigationto'] = 'This page goes to';
$string['navigationto_help'] = 'Links to other pages';
$string['newpage'] = 'New';
$string['newpagehdr'] = 'New page';
$string['newpagetitle'] = 'New page title';
$string['noattachments'] = '<strong>No files attached</strong>';
$string['nocontent'] = 'There is no content for this page';
Expand Down
34 changes: 15 additions & 19 deletions mod/wiki/mod_form.php
Expand Up @@ -46,42 +46,38 @@ protected function definition() {
$required = get_string('required');

//-------------------------------------------------------------------------------
// Adding the "general" fieldset, where all the common settings are showed
// Adding the "general" fieldset, where all the common settings are shown.
$mform->addElement('header', 'general', get_string('general', 'form'));

// Adding the standard "name" field
// Adding the standard "name" field.
$mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', $required, 'required', null, 'client');
// Adding the optional "intro" and "introformat" pair of fields
// Adding the optional "intro" and "introformat" pair of fields.
$this->add_intro_editor(true, get_string('wikiintro', 'wiki'));

//-------------------------------------------------------------------------------
// Adding the rest of wiki settings, spreeading all them into this fieldset
// or adding more fieldsets ('header' elements) if needed for better logic

$mform->addElement('header', 'wikifieldset', get_string('wikisettings', 'wiki'));
$wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki'));
// Don't allow changes to the wiki type once it is set.
$wikitype_attr = array();
if (!empty($this->_instance)) {
$wikitype_attr['disabled'] = 'disabled';
}
$mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr);
$mform->addHelpButton('wikimode', 'wikimode', 'wiki');

$attr = array('size' => '20');
if (!empty($this->_instance)) {
$attr['disabled'] = 'disabled';
}

$mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr);
$mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki');
$mform->setType('firstpagetitle', PARAM_TEXT);
if (empty($this->_instance)) {
$mform->addRule('firstpagetitle', $required, 'required', null, 'client');
}

$wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki'));
// don't allow to change wiki type once is set
$wikitype_attr = array();
if (!empty($this->_instance)) {
$wikitype_attr['disabled'] = 'disabled';
}
$mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr);
$mform->addHelpButton('wikimode', 'wikimode', 'wiki');
// Format.
$mform->addElement('header', 'wikifieldset', get_string('format'));

$formats = wiki_get_formats();
$editoroptions = array();
Expand All @@ -95,10 +91,10 @@ protected function definition() {
$mform->addHelpButton('forceformat', 'forceformat', 'wiki');

//-------------------------------------------------------------------------------
// add standard elements, common to all modules
// Add standard elements, common to all modules.
$this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// add standard buttons, common to all modules
// Add standard buttons, common to all modules.
$this->add_action_buttons();

}
Expand Down

0 comments on commit 7ce746f

Please sign in to comment.