<commit_before>=============
ckanext-reminder
=============

This extension has two main functions.

1. The extension provides simple email notifications for datasets which have a set data-expiry date. The extension relies on a
daily cronjob during which datasets are checked if the reminder-data is set to current date. The email sending process is not
retried in any way and the emails will not be sent if the cronjob fails to run for some reason.

2. The extension provides a subscription form snippet which can be added to dataset templates. Users can submit their
email address and receive notifications of these specific datasets when they are updated. The user can unsubscribe
from any datasets by clicking the link located at the bottom of the email.

------------
Requirements
------------

This extension is developed and tested with CKAN version 2.5.2 but versions starting from 2.2 should work fine.
This extension also needs Bootstrap 3+ for styling to work properly. Bootstrap 2 should mainly be fine, but styles might be a
bit off at least with the subscription_form template.


------------
Installation
------------

To install ckanext-reminder:

1. Activate your CKAN virtual environment, for example::

     . /usr/lib/ckan/default/bin/activate

2. Install the ckanext-reminder Python package into your virtual environment::

     pip install ckanext-reminder

3. Add ``reminder`` to the ``ckan.plugins`` setting in your CKAN
   config file (by default the config file is located at
   ``/etc/ckan/default/production.ini``).

4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::

     sudo service apache2 reload

5. Add the following field to your dataset. E.g. with ckanext-scheming::

    {
        "field_name": "reminder",
        "label": "Next reminder date",
        "preset": "date",
        "display_snippet": null
    }

6. Initialize database tables used by the subscribe to email notifications functionality::

    paster --plugin=ckanext-reminder reminder init --config=YOUR_CONFIGURATION.ini

7. Call the appropriate paster commands in e.g. a cronjob to send the reminders/notifications::

    # For admin reminders of dataset expiration
    paster --plugin=ckanext-reminder reminder send --config=YOUR_CONFIGURATION.ini

    # For update notifications to subscribed users
    paster --plugin=ckanext-reminder reminder notify --config=YOUR_CONFIGURATION.ini

---------------
Config Settings
---------------

The extension supports one recipient for reminder emails. Required configs are::

    # The email links will be prefixed with this site url
    ckanext.reminder.site_url = https://<YOUR_SITE_URL>

    # This configuration can be overwritten in the admin configuration UI
    ckanext.reminder.email = <YOUR_EMAIL_ADDRESS>


------------------------
Development Installation
------------------------

To install ckanext-reminder for development, activate your CKAN virtualenv and
do::

    git clone https://github.com/6aika/ckanext-reminder.git
    cd ckanext-reminder
    python setup.py develop
    pip install -r dev-requirements.txt


---------------
Updating translations
---------------

To extract all translatable strings run this command in the plugin root directory::

    python setup.py extract_messages

After this the updated ckanext-reminder.pot with the source language can be pushed to Transifex with the transifex client::

    tx push --source

Translate new strings in Transifex and pull them by running::

    # --force can be added if old translations can be overwritten by the ones fetched from transifex (this is usually the case)
    tx pull<commit_msg>Update README.rst to instruct configuring the reminder field<commit_after>=============
ckanext-reminder
=============

This extension has two main functions.

1. The extension provides simple email notifications for datasets which have a set data-expiry date. The extension relies on a
daily cronjob during which datasets are checked if the reminder-data is set to current date. The email sending process is not
retried in any way and the emails will not be sent if the cronjob fails to run for some reason.

2. The extension provides a subscription form snippet which can be added to dataset templates. Users can submit their
email address and receive notifications of these specific datasets when they are updated. The user can unsubscribe
from any datasets by clicking the link located at the bottom of the email.

------------
Requirements
------------

This extension is developed and tested with CKAN version 2.5.2 but versions starting from 2.2 should work fine.
This extension also needs Bootstrap 3+ for styling to work properly. Bootstrap 2 should mainly be fine, but styles might be a
bit off at least with the subscription_form template.


------------
Installation
------------

To install ckanext-reminder:

1. Activate your CKAN virtual environment, for example::

     . /usr/lib/ckan/default/bin/activate

2. Install the ckanext-reminder Python package into your virtual environment::

     pip install ckanext-reminder

3. Add ``reminder`` to the ``ckan.plugins`` setting in your CKAN
   config file (by default the config file is located at
   ``/etc/ckan/default/production.ini``).

4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::

     sudo service apache2 reload

5. Configure a field in the CKAN config file, which specified the field that should be used
   for the date of the reminder
   
   Add field ``ckanext.reminder.field`` in the CKAN config file. For example:
   ``ckanext.reminder.field = reminder_field``
   where reminder_field is the name
   of the field containing a date when the user should be reminded. The date should
   be in format year-month-day, for example "2018-05-31". The reminder is only sent
   if current date is the same as the date in the field specified at ckanext.reminder.field

6. Initialize database tables used by the subscribe to email notifications functionality::

    paster --plugin=ckanext-reminder reminder init --config=YOUR_CONFIGURATION.ini

7. Call the appropriate paster commands in e.g. a cronjob to send the reminders/notifications::

    # For admin reminders of dataset expiration
    paster --plugin=ckanext-reminder reminder send --config=YOUR_CONFIGURATION.ini

    # For update notifications to subscribed users
    paster --plugin=ckanext-reminder reminder notify --config=YOUR_CONFIGURATION.ini

---------------
Config Settings
---------------

The extension supports one recipient for reminder emails. Required configs are::

    # The email links will be prefixed with this site url
    ckanext.reminder.site_url = https://<YOUR_SITE_URL>

    # This configuration can be overwritten in the admin configuration UI
    ckanext.reminder.email = <YOUR_EMAIL_ADDRESS>


------------------------
Development Installation
------------------------

To install ckanext-reminder for development, activate your CKAN virtualenv and
do::

    git clone https://github.com/6aika/ckanext-reminder.git
    cd ckanext-reminder
    python setup.py develop
    pip install -r dev-requirements.txt


---------------
Updating translations
---------------

To extract all translatable strings run this command in the plugin root directory::

    python setup.py extract_messages

After this the updated ckanext-reminder.pot with the source language can be pushed to Transifex with the transifex client::

    tx push --source

Translate new strings in Transifex and pull them by running::

    # --force can be added if old translations can be overwritten by the ones fetched from transifex (this is usually the case)
    tx pull

{'fraction_non_alphanumeric': 0.09535611792329768, 'fraction_numerical': 0.00573962953300287, 'mean_word_length': 3.2149532710280373, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2669830', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1954, 'n_words': 947}