mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 18:36:42 +02:00
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:
parent
757f30a20c
commit
30a9aff589
10 changed files with 111 additions and 28 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue