Permalink
Browse files

MDL-22594

Putting back wiki editors and disabling file attachement
  • Loading branch information...
1 parent 09e6fed commit 44c0751bbff12aed5b791d8b9037286c880ab696 Jordi Piguillem committed Jul 19, 2010
Showing with 24 additions and 24 deletions.
  1. +7 −5 mod/wiki/create_form.php
  2. +14 −14 mod/wiki/edit_form.php
  3. +1 −3 mod/wiki/locallib.php
  4. +1 −1 mod/wiki/pagelib.php
  5. +1 −1 mod/wiki/version.php
@@ -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'));
@@ -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);
}
@@ -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'));
@@ -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');
}
/**
@@ -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;
}
@@ -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.