This commit is contained in:
John McLear 2013-01-31 02:00:07 +00:00
parent ce5ca913aa
commit fd92f7e288
3 changed files with 2 additions and 65 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
node_modules/ node_modules/
.ep_initialized
.cache.json

View file

@ -1,31 +0,0 @@
exports.expressServer = function (hook_name, args, cb) {
args.app.get('/server_invite_via_email', function(req, res) {
console.log(req);
// Get the parameters from the POST request
var name = req.param('name', null); // the name of the recipient
var emailAddy = req.param('email', null); // the email address of the recipient
var padurl = req.param('padurl', null); // the url of the pad the recipient is being invited to
// Get email and buffer tools dependencies
var email = require("emailjs/email");
var buffertools = require("buffertools");
// Define the server connection
var server = email.server.connect({
host: "localhost",
port: "25",
ssl: false
});
// Send the message and get a callback with an error or details of the message that was sent
server.send({
text: "You have been invited to collaboratively edit the pad at: " +padurl,
from: "Etherpad <email-invite@etherpad.org>",
to: "<"+emailAddy+">",
subject: "You have been invited to a pad"
}, function(err, message){
// console.log(err || message);
res.send(err || message); // Send the response back to the client
});
});
}

View file

@ -1,34 +0,0 @@
var $ = require('ep_etherpad-lite/static/js/rjquery').$; // use jQuery
exports.postAceInit = function (hook_name, args, cb){
// add email invite to then embed div
$("#embedcode").append(
'</div>'+
'<br><br>'+
'<a>Invite someone to this pad:</a>'+
'<br><br>'+
'<div id="emailform">'+
' Your name: <br><input id="youremailnameinput" style="height:24px;width:375px;" type="text" value=""><br>'+
' The email address of the person you want to invite: <br><input style="height:24px;width:375px;" id="emailrcptinput" type="text" value=""><br><br>'+
' <button class="sendEmailButton" style="height:40px;width:200px;">Send invitation</button>'+
'</div>'
);
$('.sendEmailButton').click(function(){
var padurl = $("#linkinput").val();
var name = $('#youremailnameinput').val();
var email = $('#emailrcptinput').val();
var data = "name="+name+"&email="+email+"&padurl="+padurl;
url = "/server_invite_via_email";
$.ajax({
type: "GET",
url: url,
data: data,
}).done(
function(msg){
}
);
alert("Invitation sent...");
$('#embed').fadeOut();
});
}