MDL-14722 Added new maxattachments setting at admin and forum level to

set the maximum number of attachments for forum posts.   Default: 1.

Works, but still needs a bit of polishing to deal with re-editing posts (to stop people going above maxattachments)

Also fixed documentation for attachments.
This commit is contained in:
moodler 2008-09-08 05:46:42 +00:00
parent 757f30a20c
commit 30a9aff589
10 changed files with 111 additions and 28 deletions

View file

@ -52,9 +52,11 @@ class mod_forum_post_form extends moodleform {
$mform->setHelpButton('subscribemessage', array('subscription', get_string('subscription', 'forum'), 'forum'));
}
if ($forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) { // 1 = No attachments at all
$mform->addElement('filepicker', 'attachment', get_string('attachment', 'forum'));
$mform->setHelpButton('attachment', array('attachment', get_string('attachment', 'forum'), 'forum'));
if (!empty($forum->maxattachments) && $forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) { // 1 = No attachments at all
for ($i=0; $i<$forum->maxattachments; $i++) {
$mform->addElement('filepicker', 'attachment'.$i, get_string('attachment', 'forum'));
$mform->setHelpButton('attachment'.$i, array('attachment2', get_string('attachment', 'forum'), 'forum'));
}
}
if (empty($post->id) && has_capability('moodle/course:manageactivities', $coursecontext)) { // hack alert