2008-07-31 11:16:25 +02:00
|
|
|
var LSformElement_mail = new Class({
|
|
|
|
initialize: function(){
|
|
|
|
this.initialiseLSformElement_mail();
|
|
|
|
if (typeof(varLSform) != "undefined") {
|
|
|
|
varLSform.addModule("LSformElement_mail",this);
|
|
|
|
}
|
2008-09-25 17:15:33 +02:00
|
|
|
this.LSmail_open = 0;
|
2008-07-31 11:16:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
initialiseLSformElement_mail: function(el) {
|
|
|
|
if (typeof(el) == 'undefined') {
|
|
|
|
el = document;
|
|
|
|
}
|
2008-09-27 02:55:58 +02:00
|
|
|
el.getElements('input.LSformElement_mail').each(function(input) {
|
2010-12-03 18:04:40 +01:00
|
|
|
if (!input.hasClass('LSformElement_mail_disableMailSending')) {
|
|
|
|
this.addBtnAfter.bind(this)(input);
|
|
|
|
}
|
2008-07-31 11:16:25 +02:00
|
|
|
}, this);
|
2008-09-27 02:55:58 +02:00
|
|
|
el.getElements('a.LSformElement_mail').each(function(a) {
|
2011-01-21 16:11:02 +01:00
|
|
|
if (!a.hasClass('LSformElement_mail_disableMailSending')) {
|
2010-12-03 18:04:40 +01:00
|
|
|
this.addBtnAfter.bind(this)(a);
|
|
|
|
}
|
2008-09-27 02:55:58 +02:00
|
|
|
}, this);
|
|
|
|
},
|
|
|
|
|
|
|
|
addBtnAfter: function(el) {
|
|
|
|
var btn = new Element('img');
|
|
|
|
btn.setProperties({
|
2013-06-19 02:17:39 +02:00
|
|
|
src: varLSdefault.imagePath('mail')
|
2008-09-27 02:55:58 +02:00
|
|
|
});
|
|
|
|
btn.addClass('btn');
|
|
|
|
btn.injectAfter(el);
|
|
|
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
2008-11-10 04:07:28 +01:00
|
|
|
varLSdefault.addHelpInfo(btn,'LSformElement_mail','mail');
|
2008-07-31 11:16:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
reinitialize: function(el) {
|
2008-10-15 19:40:04 +02:00
|
|
|
varLSform.initializeModule('LSformElement_text',el);
|
2008-07-31 11:16:25 +02:00
|
|
|
this.initialiseLSformElement_mail(el);
|
|
|
|
},
|
|
|
|
|
|
|
|
onBtnClick: function(btn) {
|
2008-09-25 17:15:33 +02:00
|
|
|
if (this.LSmail_open==0) {
|
|
|
|
var mail = btn.getParent().getFirst().innerHTML;
|
|
|
|
if ((typeof(mail)!='string')||(mail=='')) {
|
|
|
|
mail = btn.getParent().getFirst().value;
|
|
|
|
}
|
|
|
|
if(!$type(this.LSmail)) {
|
|
|
|
this.LSmail = new LSmail();
|
|
|
|
this.LSmail.addEvent('close',this.onLSmailClose.bind(this));
|
|
|
|
this.LSmail.addEvent('valid',this.onLSmailValid.bind(this));
|
|
|
|
}
|
|
|
|
if ((mail!="")) {
|
|
|
|
this.LSmail_open = 1;
|
|
|
|
this.LSmail.setMails([mail]);
|
2008-11-03 20:25:22 +01:00
|
|
|
this.LSmail.setObject(varLSform.objecttype,varLSform.objectdn);
|
2008-09-25 17:15:33 +02:00
|
|
|
this.LSmail.open(btn);
|
|
|
|
}
|
2008-07-31 11:16:25 +02:00
|
|
|
}
|
2008-09-25 17:15:33 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
onLSmailClose: function(LSmail) {
|
|
|
|
LSdebug('LSformElement_mail : close LSmail');
|
|
|
|
this.LSmail_open = 0;
|
|
|
|
},
|
|
|
|
|
|
|
|
onLSmailValid: function(LSmail) {
|
|
|
|
LSdebug('LSformElement_mail : valid LSmail');
|
|
|
|
LSmail.send();
|
2008-07-31 11:16:25 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
|
|
|
varLSformElement_mail = new LSformElement_mail();
|
|
|
|
});
|