Skip to content

Commit

Permalink
MDL-22594
Browse files Browse the repository at this point in the history
Putting back wiki editors and disabling file attachement
  • Loading branch information
Jordi Piguillem committed Jul 19, 2010
1 parent 09e6fed commit 44c0751
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
12 changes: 7 additions & 5 deletions mod/wiki/create_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ protected function definition() {
$mform =& $this->_form;

$formats = $this->_customdata['formats'];
$defaultformat = $this->_customdata['defaultformat'];
$forceformat = $this->_customdata['forceformat'];

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

Expand All @@ -42,13 +44,13 @@ protected function definition() {
}
$mform->addElement('text', 'pagetitle', get_string('newpagetitle', 'wiki'), $textoptions);

// TODO: disable creole and nwiki format until moodle core text format lib added
$disabled_formats = array('creole', 'nwiki');
foreach ($formats as $format) {
if (in_array($format, $disabled_formats)) {
$attr = array('disabled'=>'disabled');
} else {
if ($format == $defaultformat) {
$attr = array('checked'=>'checked');
}else if (!empty($forceformat)){
$attr = array('disabled'=>'disabled');
} else {
$attr = array();
}
$mform->addElement('radio', 'pageformat', '', get_string('format'.$format, 'wiki'), $format, $attr);
}
Expand Down
28 changes: 14 additions & 14 deletions mod/wiki/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ protected function definition() {
$mform->addElement('hidden', 'contentformat');
$mform->setDefault('contentformat', $format);

if ($format != 'html') {
//uploads
$mform->addElement('header', 'attachments_tags', get_string('attachments', 'wiki'));
$mform->addElement('filemanager', 'attachments', get_string('attachments', 'wiki'), null, page_wiki_edit::$attachmentoptions);
$fileinfo = array(
'contextid'=>$contextid,
'component'=>'mod_wiki',
'filearea'=>$filearea,
'itemid'=>$fileitemid,
);

$mform->addElement('wikifiletable', 'deleteuploads', get_string('wikifiletable', 'wiki'), null, $fileinfo, $format);
$mform->addElement('submit', 'editoption', get_string('upload', 'wiki'), array('id' => 'tags'));
}
// if ($format != 'html') {
// //uploads
// $mform->addElement('header', 'attachments_tags', get_string('attachments', 'wiki'));
// $mform->addElement('filemanager', 'attachments', get_string('attachments', 'wiki'), null, page_wiki_edit::$attachmentoptions);
// $fileinfo = array(
// 'contextid'=>$contextid,
// 'component'=>'mod_wiki',
// 'filearea'=>$filearea,
// 'itemid'=>$fileitemid,
// );
//
// $mform->addElement('wikifiletable', 'deleteuploads', get_string('wikifiletable', 'wiki'), null, $fileinfo, $format);
// $mform->addElement('submit', 'editoption', get_string('upload', 'wiki'), array('id' => 'tags'));
// }

if (!empty($CFG->usetags)) {
$mform->addElement('header', 'tagshdr', get_string('tags', 'tag'));
Expand Down
4 changes: 1 addition & 3 deletions mod/wiki/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,7 @@ function wiki_increment_pageviews($page) {
* Text format supported by wiki module
*/
function wiki_get_formats() {
// TODO: disable creole and nwiki format until moodle core text format lib added
return array('html');
//return array('html', 'creole', 'nwiki');
return array('html', 'creole', 'nwiki');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion mod/wiki/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ function set_action($action) {
require_once(dirname(__FILE__) . '/create_form.php');
$url = new moodle_url('/mod/wiki/create.php', array('action' => 'create', 'wid' => $PAGE->activityrecord->id, 'gid' => $this->gid, 'uid' => $this->uid));
$formats = wiki_get_formats();
$options = array('formats' => $formats);
$options = array('formats' => $formats, 'defaultformat' => $PAGE->activityrecord->defaultformat,'forceformat' => $PAGE->activityrecord->forceformat);
if ($this->title != get_string('newpage', 'wiki')) {
$options['disable_pagetitle'] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion mod/wiki/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$module->version = 2010040109; // The current module version (Date: YYYYMMDDXX)
$module->version = 2010071900; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)

0 comments on commit 44c0751

Please sign in to comment.