if no settings for the pligin -> msg sent to the user

This commit is contained in:
quenenni 2013-04-04 17:57:37 +02:00
parent 75578aa676
commit de660e89d2
4 changed files with 9 additions and 4 deletions

View file

@ -16,6 +16,8 @@ exports.eejsBlock_styles = function (hook_name, args, cb) {
}; };
exports.clientVars = function(hook, context, callback) { exports.clientVars = function(hook, context, callback) {
var pluginSettings = settings.ep_email_notifications;
var panelDisplayLocation = (pluginSettings && pluginSettings.panelDisplayLocation)?pluginSettings.panelDisplayLocation:"undefiend";
// return the setting to the clientVars, sending the value // return the setting to the clientVars, sending the value
return callback({ "panelDisplayLocation": settings.ep_email_notifications.panelDisplayLocation }); return callback({ "panelDisplayLocation": panelDisplayLocation });
}; };

View file

@ -3,7 +3,7 @@
, "ep_email_notifications.titleGritterUnsubscr": "Email unsubscription" , "ep_email_notifications.titleGritterUnsubscr": "Email unsubscription"
, "ep_email_notifications.headerGritterSubscr": "(Receive an email when someone modifies this pad)" , "ep_email_notifications.headerGritterSubscr": "(Receive an email when someone modifies this pad)"
, "ep_email_notifications.msgOptionsNotChecked": "You need to check at least one of the two options from 'Send a mail when someone..'" , "ep_email_notifications.msgOptionsNotChecked": "You need to check at least one of the two options from 'Send a mail when someone..'"
, "ep_email_notifications.msgParamsMissing": "Some settings for the 'email_Notifications' plugin are missing.<br />Please contact your administrator." , "ep_email_notifications.msgParamsMissing": "Settings for the 'email_Notifications' plugin are missing.<br />Please contact your administrator."
, "ep_email_notifications.msgEmailMalformed": "The email address is malformed" , "ep_email_notifications.msgEmailMalformed": "The email address is malformed"
, "ep_email_notifications.msgAlreadySubscr": "You are already registered for emails for this pad" , "ep_email_notifications.msgAlreadySubscr": "You are already registered for emails for this pad"
, "ep_email_notifications.msgUnsubscrNotExisting": "This email address is not registered for this pad" , "ep_email_notifications.msgUnsubscrNotExisting": "This email address is not registered for this pad"

View file

@ -13,8 +13,8 @@ exports.postAceInit = function(hook, context){
title: window._('ep_email_notifications.titleGritterError'), title: window._('ep_email_notifications.titleGritterError'),
// (string | mandatory) the text inside the notification // (string | mandatory) the text inside the notification
text: window._('ep_email_notifications.msgParamsMissing'), text: window._('ep_email_notifications.msgParamsMissing'),
// (int | optional) the time you want it to be alive for before fading out // (bool | optional) if you want it to fade out on its own or just sit there
time: 10000, sticky: true
}); });
// Hide the notification menu in mysettings // Hide the notification menu in mysettings

View file

@ -8,6 +8,7 @@ settings = require('../../src/node/utils/Settings');
// Settings -- EDIT THESE IN settings.json not here.. // Settings -- EDIT THESE IN settings.json not here..
var pluginSettings = settings.ep_email_notifications; var pluginSettings = settings.ep_email_notifications;
var areParamsOk = (pluginSettings)?true:false;
var checkFrequency = (pluginSettings && pluginSettings.checkFrequency)?pluginSettings.checkFrequency:60000; // 10 seconds var checkFrequency = (pluginSettings && pluginSettings.checkFrequency)?pluginSettings.checkFrequency:60000; // 10 seconds
var staleTime = (pluginSettings && pluginSettings.staleTime)?pluginSettings.staleTime:300000; // 5 minutes var staleTime = (pluginSettings && pluginSettings.staleTime)?pluginSettings.staleTime:300000; // 5 minutes
var fromName = (pluginSettings && pluginSettings.fromName)?pluginSettings.fromName:"Etherpad"; var fromName = (pluginSettings && pluginSettings.fromName)?pluginSettings.fromName:"Etherpad";
@ -22,6 +23,8 @@ var timers = {};
var server = email.server.connect(emailServer); var server = email.server.connect(emailServer);
exports.padUpdate = function (hook_name, _pad) { exports.padUpdate = function (hook_name, _pad) {
if (areParamsOk == false) return false;
var pad = _pad.pad; var pad = _pad.pad;
var padId = pad.id; var padId = pad.id;
exports.sendUpdates(padId); exports.sendUpdates(padId);