Maintained by Hendrik Würz, Guido Roessling
Students can receive mails for new material and a changelog will be generated for updated documents provided in the course.
25 sites
11 fans
Current versions available: 2

This plugins allows students to receive a notification as soon as new material becomes uploaded. Optionally the new file can be included in the mail directly. For updated material a changelog will be displayed which includes the changed page for PDF documents.

Copyright (c) The Development Manager Ltd, Hendrik Wuerz

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>;.


## Installation

1. Install the dependency local_changeloglib with the required command line tools (See readme.md in the changeloglib repository.)
cd path/to/moodle/home
git clone https://github.com/hwuerz/moodle-local_uploadnotification.git local/uploadnotification

## Tests

This plugin provides tests for the main features. To run them please follow the next steps:

2. Install the plugin.
3. Run the tests
cd /path/to/moodle/home
vendor/bin/phpunit --group local_uploadnotification

## Features

### Mail delivery for new material

The plugin can inform your students as soon as new material is published in one of their courses. The delivered mail can optionally include the new file. These functions must be enabled by three parties: The moodle admin, the teacher and the student. The options for courses and for students are only visible if the admin has enabled the feature.

1. Go to Site administration -> Plugins -> Local plugins -> Upload notification
2. Set Allow notification mail delivery to yes. This will enable the mail delivery for course admins and students. If you set it to no, the delivery is completely disabled: No one can see the settings and no mails will be send in any case.
3. Set Maximum filesize of mail attachments (in KB) to 100000. This will allow attachments up to 10MB. If this value is zero, no attachments will be send.

Now the feature is visible for teachers and students. As a general rule: A mail will only be send if someone (teacher or student) has requested the delivery and no one has forbidden it.

As a teacher follow these steps

1. Go to your course -> Open the course menu (where you can access the settings, turn editing on, ...) -> Click on the link Uploadnotification
2. You have three options for Enable notification mail delivery for material uploads
• No preferences The default option. No mails will be send except the user requests them.
• Disable No mails will be send for actions in this course. The student settings are ignored.
• Enable Mails will be send except a user has disabled the delivery for himself.
3. Set the check mark for Allow email attachments (this is the default). This will allow students to receive mails with attachments. As a teacher you can not force this to avoid unwanted traffic.

As a student follow these steps

1. Click on your username and select Preferences
2. At Miscellaneous you find a link Uploadnotification
3. All students have two settings:
• Enable notification mail delivery for material uploads with the same options as teachers. No preference will only send mails if the course settings have enabled them. Enable sends always mails except a teacher has disabled the feature for a course. Disable will never allow the mail delivery to this student.
• Maximum filesize of mail attachments (in KB) Insert a value greater zero to receive attachments up to this size. You can not request sizes which are greater than the limit of the moodle admin. The attachment will only be send if the teacher has not removed the check mark in his his course.

### Changelog generation

The plugin can build a changelog for uploaded resources. It will include the timestamp of the update and the filename of the predecessor. At the moment only file resources are supported (no folders, pages, or others). For PDF documents, the plugin can detect the page number on which changes were performed.

Teachers can update material on two ways:

1. Delete the old resource and upload the new document independently
2. Edit the current resource and select a new file.

A file and its predecessor must be uploaded in the same course and section.

To enable the changelog, the moodle admin has to allow this feature. If he has deactivated it, teachers will not see the options in the course settings.

1. Go to Site administration -> Plugins -> Local plugins -> Upload notification
2. Set Allow automatic changelog generation in courses on true. This will activate the feature for teachers.
3. Set Allowed size of analysed files for the diff detection (in MB) to 100. This will allow the plugin to search for differences on documents with maximum 100MB filesize. If you set this value to zero, a changelog can be generated, but the pages where changes are performed will not longer be identified.
4. Set Enable the changelog in new courses by default and Enable the diff detection in new courses by default to true. This will activate the changelog and diff detection in all courses which have no custom settings.

As a teacher follow these steps to customize the behaviour in your course:

1. Go to your course -> Open the course menu (where you can access the settings, turn editing on, ...) -> Click on the link Uploadnotification
2. Set Display a changelog for updates to true. This will print an information with the filename of the predecessor and the time of the change next to the new document.
3. Set Detect differences in updates to true. This will search for changed pages in the new document and add their numbers to the changelog. This feature only works for PDF documents which are smaller than the admin-limit.
4. Create a new PDF document in your course.
5. Edit the new document and upload an update with a few changes.
6. On the course page, the changelog will be displayed.
7. Delete the updated resource and upload a version which was changed again a little bit. This upload must be in the same section as before.
8. After a page reload (limitation of moodle because the upload was performed via ajax) the changelog is displayed again.

### Contributors

Guido Roessling: Maintainer

### Awards

• Thu, May 10, 2018, 6:39 PM
Hi Prerna,

I'm glad to hear that it works now.

Unfortunately, push notifications on mobile devices are currently not in the scope of this plugin and in the near future, I will not have time to implement this functionality. But if you or someone else has programming experience, I encourage any to contribute. Just create a pull request on Github and I will merge the code.

Regards, Hendrik
• Thu, Jan 17, 2019, 3:25 PM
Hi Hendrik,

I have installed this plugin. is this plugin support for moodle version 3.5.2? Thanks

Regards,
• Sun, Jan 20, 2019, 7:56 PM
thank you for the question. Yes, the plugin should work on Moodle 3.4-3.6 (we have it in use in our Moodle 3.6* nightly and used it before in 3.5.*). I have updated the details accordingly...
Guido
• Mon, Jan 21, 2019, 9:53 AM
Hi Guido,
Thank you for the answer. I have a question again, Time for digest delivery. Can I disable it? Because notifications (email notification) become not real time. Thank you for your answer again...
Regards,
• Tue, Jan 22, 2019, 2:59 AM

unfortunately the digest delivery can not be completely disabled. Some points that could still help you:

* The digest delivery will only be used if students explicitly enable it in their settings. The default option is a just-in-time delivery.

* There is (a hard coded) delay of five minutes between the upload of a file and the first possible mail delivery time. This delay should ensure that teachers can edit their material before everybody gets a mail. If you want to change this behavior, you have to edit the source code. I think you would just have to change this line: https://github.com/hwuerz/moodle-local_uploadnotification/blob/master/classes/util.php#L96 But this hint is untested, so you should try it out first in a test environment.

* Mails are only send when the moodle cron is executed. You can run it more often to decrease the time until mail delivery.

Regards, Hendrik
• Tue, Jan 22, 2019, 9:36 AM
Hi Hendrik,

If I add some activity in my course at 06:00 a.m, set digest delivery at 07:00 a.m and the moodle cron will executed at 07:01 a.m. What the time mail notifications can be sent? or what time will the student receive a notification email?

• Tue, Jan 22, 2019, 11:19 PM

the answer to your question depends on the settings of the students.

Scenario 1: The student has not set any preferences for the digest delivery or has disabled it
06:00 am: File created
06:05 am: First possible delivery time
07:00 am: No actions
07:01 am: Mail delivery

Scenario 2: The student explicitly requested a digest delivery
06:00 am: File created --> Scheduled for 07:00 because of the digest request
06:05 am: No actions
07:00 am: No actions
07:01 am: No action because the planning time plus five minutes (= 07:05 am) is still in the future.
07:05 am (or any time later): Mail delivery as soon as the cron is executed

I recommend you start the cron job every minute. In this case, the delay between uploading and sending the mail is quite low. (See also https://docs.moodle.org/28/en/index.php?title=Cron&oldid=118466#Cron_in_Moodle_2.7.2B )

Regards, Hendrik
• Wed, Jan 23, 2019, 6:29 AM
If changeloglib is not previously installed, installing this plugin causes error 500, which was not fun to trace and fix.
• Wed, Jan 23, 2019, 12:04 PM
Hi Travis,

Have you deleted the uploadnotification plugin? install the poppler & check diff in your system (linux's server) with the terminal or putty, and then install the changloglib (changloglib required poppler & diff), Finally install the uploadnotification.

• Wed, Jan 23, 2019, 12:22 PM
Hi Hendrik,

Thank you for the answer. I had run the cron job every 2 minutes, before I installed this plugin. where can I check if the notification email is not sent? I have checked in the mail server, there is no email about that notificiation. Thanks.
• Thu, Jan 24, 2019, 2:40 AM

You said that you checked the mail server. Was this the source server of Moodle, or the receiving server of a student? The SMTP server of Moodle has to be set correctly, because the plugin uses the standard mail function of Moodle. You can have a look at YOUR-MOODLE-SERVER/admin/settings.php?section=outgoingmailconfig if you haven't done so or try this useful plugin to send a test mail https://moodle.org/plugins/local_mailtest

In addition, the plugin only sends mails to registered _students_. As an admin, you may not get any notification. Did you check the inbox of a student of the course?

Did you activate the notifications in the course? It can be done at Course Page -> Settings Icon -> "Upload Notification" -> "Enable notification delivery for material uploads" -> "Enable"

If these points have not yielded any results, you can look directly in the database. The plugin creates a table called local_uploadnotification in which all planned and not already delivered mails are stored. When you upload a file, a new record will be created. When the mail is sent, the record becomes deleted. You can check whether the records exist in your system. Unfortunately, there is no dashboard for this data. So you have to look directly into the database via the command line or use an external tool like phpmyadmin.

Best regards, Hendrik
• Thu, Jan 24, 2019, 12:27 PM
Hi Hendrik,

The problem is over. I have changed the SMTP Session limit (before : 1, after : 10/ session), that's what makes email not sent.
If create some activity -> create record in the database (automatically), after 5 minutes the data is lost.
If the database is empty (no record in the table), the email should be sent. If not sent the problem is SMTP Session limit. I think that's the problem.