From d6e1257ed8e8b16842b098bce76fab79558d81d0 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 17 Nov 2016 11:51:49 +0100 Subject: [PATCH] LSmail : add possibilty to set some display options from JS --- public_html/includes/class/class.LSmail.php | 2 ++ public_html/includes/js/LSmail.js | 25 +++++++++++++++++++-- public_html/templates/default/LSmail.tpl | 10 ++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/public_html/includes/class/class.LSmail.php b/public_html/includes/class/class.LSmail.php index 636e00b6..4f0fe9d3 100644 --- a/public_html/includes/class/class.LSmail.php +++ b/public_html/includes/class/class.LSmail.php @@ -52,6 +52,8 @@ class LSmail { LStemplate :: assign('LSmail_msg',$msg); LStemplate :: assign('LSmail_subject',$subject); + LStemplate :: assign('LSmail_options',$_REQUEST['options']); + if (is_array($_REQUEST['mails'])) { LStemplate :: assign('LSmail_mails',$_REQUEST['mails']); } diff --git a/public_html/includes/js/LSmail.js b/public_html/includes/js/LSmail.js index f32da875..c17eaa87 100644 --- a/public_html/includes/js/LSmail.js +++ b/public_html/includes/js/LSmail.js @@ -6,6 +6,10 @@ var LSmail = new Class({ this.setSubject(subject); this.object = {}; this.opened = 0; + this.options = { + display_mail_field: 1, + display_subject_field: 1 + }; this.listeners = { close: new Array(), valid: new Array() @@ -45,7 +49,23 @@ var LSmail = new Class({ dn: dn }; }, - + + setOption: function(option,value) { + this.options[option]=value; + }, + + hideMailField: function() { + this.setOption('display_mail_field',0); + }, + + hideSubjectField: function() { + this.setOption('display_subject_field',0); + }, + + setClass: function(c) { + this.setOption('class',c); + }, + open: function(startElement) { if (this.opened==0) { var data = { @@ -54,7 +74,8 @@ var LSmail = new Class({ object: this.object, mails: this.mails, msg: this.msg, - subject: this.subject + subject: this.subject, + options: this.options }; if ($type(startElement)) { diff --git a/public_html/templates/default/LSmail.tpl b/public_html/templates/default/LSmail.tpl index 8f550cc4..66bb0023 100644 --- a/public_html/templates/default/LSmail.tpl +++ b/public_html/templates/default/LSmail.tpl @@ -1,4 +1,5 @@ -
+
+ {if $LSmail_options.display_mail_field}
{$LSmail_mail_label}
{if $LSmail_mails != ""} @@ -13,10 +14,17 @@ {/if}
+ {else} + + {/if} + {if $LSmail_options.display_subject_field}
{$LSmail_subject_label}
+ {else} + + {/if}
{$LSmail_msg_label}