forgot to commit i18n files + validation output page with template and external css

This commit is contained in:
quenenni 2013-04-03 05:16:18 +02:00
parent c84222d085
commit 18a3964a84
5 changed files with 113 additions and 59 deletions

View file

@ -1,4 +1,5 @@
var db = require('ep_etherpad-lite/node/db/DB').db,
fs = require("fs"),
async = require('../../src/node_modules/async'),
settings = require('../../src/node/utils/Settings');
@ -222,69 +223,32 @@ function sendContent(res, args, action, padId, padURL, resultDb) {
if (resultDb.foundInDb == true && resultDb.timeDiffGood == true) {
// Pending data were found un Db and updated -> good
resultMsg = "Success";
classResult = "good";
classResult = "validationGood";
if (action == 'subscribe') {
msgCause = "You will receive email when someone changes this pad.";
} else {
msgCause = "You won't receive anymore email when someone changes this pad.";
}
} else if (resultDb.foundInDb == true) {
// Pending data were found but older than a day -> fail
msgCause = "You have max 24h to click the link in your confirmation email.";
resultMsg = "Too late!";
resultMsg += '<div>\n';
resultMsg += msgCause;
resultMsg += '</div>\n';
classResult = "bad";
classResult = "validationBad";
msgCause = "You have max 24h to click the link in your confirmation email.";
} else {
// Pending data weren't found in Db -> fail
resultMsg = "Fail";
classResult = "validationBad";
msgCause = "We couldn't find any pending " + (action == 'subscribe'?'subscription':'unsubscription') + "<br />in our system with this Id.<br />Maybe you wait more than 24h before validating";
resultMsg = "Fail\n";
resultMsg += '<div>\n';
resultMsg += msgCause;
resultMsg += '</div>\n';
classResult = "bad";
}
args.content = fs.readFileSync(__dirname + "/templates/response.ejs", 'utf-8');
args.content = args.content
.replace(/\<%action%\>/, actionMsg)
.replace(/\<%classResult%\>/, classResult)
.replace(/\<%result%\>/, resultMsg)
.replace(/\<%explanation%\>/, msgCause)
.replace(/\<%padUrl%\>/g, padURL);
res.contentType("text/html; charset=utf-8");
args.content = '<html>\n';
args.content += '<head>\n';
args.content += '<meta charset="utf-8">\n';
args.content += '<title>Email Notifications Subscription</title>\n';
// args.content += '<link href="../../static/css/email_notifications.css" media="all" rel="stylesheet" type="text/css" />\n';
args.content += '<style>\n';
args.content += '.emailSubscription {\n';
args.content += ' width: 600px;\n';
args.content += ' margin: 0 auto;\n';
args.content += ' text-align: center;\n';
args.content += ' font-size: bigger;\n';
args.content += ' font-weight: bold;\n';
args.content += ' font-color: green;\n';
args.content += '}\n';
args.content += '.emailSubscription > div {\n';
args.content += ' border: solid 2px #333;\n';
args.content += ' padding: .3em;\n';
args.content += ' margin-bottom: .5em;\n';
args.content += '}\n';
args.content += '.good {\n';
args.content += ' background-color: green;\n';
args.content += '}\n';
args.content += '.bad {\n';
args.content += ' background-color: red;\n';
args.content += '}\n';
args.content += '</style>\n';
args.content += '</head>\n';
args.content += '<body style="text-align:center;">\n';
args.content += '<h1>Email notifications</h1>\n';
args.content += '<div class="emailSubscription">\n';
args.content += actionMsg + "\n";
args.content += '<div class="' + classResult + '">\n';
args.content += resultMsg;
if (action == 'subscribe' && classResult == 'good') {
args.content += "<div style='margin:0; padding:.2em; font-weight:normal;'>You will receive email when someone changes this pad.</div>"
} else if (action == 'unsubscribe' && classResult == 'good'){
args.content += "<div style='margin:0; padding:.2em; font-weight:normal;'>You won't receive anymore email when someone changes this pad.</div>";
}
args.content += '</div>\n';
args.content += 'Go to the pad: <a href="' + padURL + '">' + padURL + '</a>';
args.content += '</div>\n';
args.content += '</body>\n';
args.content += '</html>\n';
res.send(args.content); // Send it to the requester
res.send(args.content); // Send it to the requester*/
}

19
locales/en.json Normal file
View file

@ -0,0 +1,19 @@
{ "ep_email_notifications.titleGritterError": "Email subscription error"
, "ep_email_notifications.titleGritterSubscr": "Email subscription"
, "ep_email_notifications.titleGritterUnsubscr": "Email unsubscription"
, "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.msgParamsMissing": "Some 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.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.msgUnknownErr": "Unknown error"
, "ep_email_notifications.msgSubscrSuccess": "An email was sent to your address.<br />Click on the link in order to validate your subscription."
, "ep_email_notifications.msgUnsubscrSuccess": "An email was sent to your address.<br />Click on the link in order to validate your unsubscription"
, "ep_email_notifications.menuLabel": "Email Notifications"
, "ep_email_notifications.formOptionsTitle": "Send a mail when someone.."
, "ep_email_notifications.formOptionOnStart": "starts editing the pad"
, "ep_email_notifications.formOptionOnEnd": "finish editing the pad"
, "ep_email_notifications.formBtnSubscr": "subscribe"
, "ep_email_notifications.formBtnUnsubscr": "unsubscribe"
}

19
locales/fr.json Normal file
View file

@ -0,0 +1,19 @@
{ "ep_email_notifications.titleGritterError": "Notification par email - Erreur"
, "ep_email_notifications.titleGritterSubscr": "Notification par email"
, "ep_email_notifications.titleGritterUnsubscr": "Désinscription d'email"
, "ep_email_notifications.headerGritterSubscr": "(Être prévenu lorsque quelqu'un modifie ce pad)"
, "ep_email_notifications.msgOptionsNotChecked": "Il faut cocher au moins une des 2 options pour l'inscription de l'email..'"
, "ep_email_notifications.msgParamsMissing": "Les paramètres de configurations du plugin 'email_Notifications' sont manquantes.<br />Veuillez contacter votre administrateur."
, "ep_email_notifications.msgEmailMalformed": "L'adresse email n'est pas valide"
, "ep_email_notifications.msgAlreadySubscr": "Vous avez déjà enregistré cette adresse email pour ce pad"
, "ep_email_notifications.msgUnsubscrNotExisting": "Cette adresse email n'est pas enregistrée pour ce pad"
, "ep_email_notifications.msgUnknownErr": "Etteur inconnue"
, "ep_email_notifications.msgSubscrSuccess": "Un email a été envoyé à votre adresse.<br />Cliquez sur le lien afin de valider votre inscription."
, "ep_email_notifications.msgUnsubscrSuccess": "Un email a été envoyé à votre adresse.<br />Cliquez sur le lien afin de valider votre désinscription."
, "ep_email_notifications.menuLabel": "Notification par email"
, "ep_email_notifications.formOptionsTitle": "Envoyer un email quand qqu'un.."
, "ep_email_notifications.formOptionOnStart": "commence l'édition du pad"
, "ep_email_notifications.formOptionOnEnd": "a fini d'éditer le pad"
, "ep_email_notifications.formBtnSubscr": "inscription"
, "ep_email_notifications.formBtnUnsubscr": "désinscription"
}

View file

@ -32,3 +32,33 @@
margin: .3em 0;
width:95%;
}
/* (un)subscription validation page */
.validationTitle {
margin: 0 auto;
width: 600px;
text-align: center;
}
.validationEmailSubscription {
width: 600px;
margin: 0 auto;
text-align: center;
font-size: bigger;
font-weight: bold;
font-color: green;
}
.validationEmailSubscription > div {
border: solid 2px #333;
padding: .3em;
margin: .5em 0;
}
.validationEmailSubscription > div > div {
margin:0;
padding:.2em;
font-weight:normal;
}
.validationGood {
background-color: green;
}
.validationBad {
background-color: red;
}

22
templates/response.ejs Normal file
View file

@ -0,0 +1,22 @@
<html>
<head>
<meta charset="utf-8">
<title>Email Notifications Subscription</title>
<link href="../../static/plugins/ep_email_notifications/static/css/email_notifications.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="validationTitle">
<h1>Email notifications</h1>
</div>
<div class="validationEmailSubscription">
<%action%>
<div class="<%classResult%>">
<%result%>
<div>
<%explanation%>
</div>
</div>
Go to the pad: <a href="<%padUrl%>"><%padUrl%></a>
</div>
</body>
</html>