diff --git a/htdocs/core/ajax/mailtemplate.php b/htdocs/core/ajax/mailtemplate.php index c8312095af7..1c5b76c1a62 100644 --- a/htdocs/core/ajax/mailtemplate.php +++ b/htdocs/core/ajax/mailtemplate.php @@ -38,9 +38,6 @@ if (!defined('NOREQUIREHTML')) { if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } -if (!defined('NOREQUIRESOC')) { - define('NOREQUIRESOC', '1'); -} require_once '../../main.inc.php'; require_once '../lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -51,10 +48,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php'; * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager + * @var Societe $mysoc * @var Translate $langs * @var User $user */ +/* + * Actions + */ + +// None + /* * View @@ -80,22 +84,43 @@ if (GETPOSTISSET('template')) { $specificSubstitutionArray = array( - '__LOGO_URL__' => !empty($mysoc->logo) && dol_is_file($conf->mycompany->dir_output.'/logos/'.$mysoc->logo) ? $urlwithroot.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo) : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAABGklEQVR4nO3SwQ3AIBDAsNLJb3SWIEJC9gR5ZM3MB6f9twN4k7FIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIvEBtxYAkgpLmAeAAAAAElFTkSuQmCC', '__TITLEOFMAILHOLDER__' => $langs->trans('TitleOfMailHolder'), '__CONTENTOFMAILHOLDER__' => 'Lorem ipsum ...', - '__USERSIGNATURE__' => !empty($user->signature) ? dol_htmlentities($user->signature) : '', '__GRAY_RECTANGLE__' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAABGklEQVR4nO3SwQ3AIBDAsNLJb3SWIEJC9gR5ZM3MB6f9twN4k7FIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIvEBtxYAkgpLmAeAAAAAElFTkSuQmCC', '__LAST_NEWS__' => $langs->trans('LastNews'), '__LIST_PRODUCTS___' => $langs->trans('ListProducts'), '__SUBJECT__' => GETPOST('subject') ); + if (!empty($mysoc->logo) && dol_is_file($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $specificSubstitutionArray['__LOGO_URL__'] = $urlwithroot.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } else { + $specificSubstitutionArray['__LOGO_URL__'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAABGklEQVR4nO3SwQ3AIBDAsNLJb3SWIEJC9gR5ZM3MB6f9twN4k7FIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIvEBtxYAkgpLmAeAAAAAElFTkSuQmCC'; + } + + $specificSubstitutionArray['__USERSIGNATURE__'] = empty($user->signature) ? '' : $user->signature; + + if (GETPOST('fromtype') == 'user') { + $specificSubstitutionArray['__SENDEREMAIL_SIGNATURE__'] = empty($user->signature) ? '' : $user->signature; + } elseif (GETPOST('fromtype') == 'company') { + $specificSubstitutionArray['__SENDEREMAIL_SIGNATURE__'] = $mysoc->name.' '.$mysoc->email; + } elseif (GETPOST('fromtype') == 'main_from') { + $specificSubstitutionArray['__SENDEREMAIL_SIGNATURE__'] = $mysoc->name.' '.getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + } else { + // GETPOST('fromtype') is senderprofile_x_y (x = ID profile) + $specificSubstitutionArray['__SENDEREMAIL_SIGNATURE__'] = 'TODO Read database to get the signature of the profile'; + } + + + // Must replace // __SUBJECT__, __CONTENTOFMAILHOLDER__, __USERSIGNATURE__, __NEWS_LIST__, __PRODUCTS_LIST__ foreach ($specificSubstitutionArray as $key => $val) { $content = str_replace($key, $val, $content); } + // Parse all strings __(...)__ to replace with the translated value. + // TODO $selectedPostsStr = GETPOST('selectedPosts', 'alpha'); $selectedPosts = explode(',', $selectedPostsStr); diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 405439b2ee5..1ed220d982b 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -133,7 +133,7 @@ class DolEditor // Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor') $defaulteditor = 'ckeditor'; - $this->tool = !getDolGlobalString('FCKEDITOR_EDITORNAME') ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME; + $this->tool = getDolGlobalString('FCKEDITOR_EDITORNAME', $defaulteditor); $this->uselocalbrowser = $uselocalbrowser; $this->readonly = $readonly; @@ -207,7 +207,7 @@ class DolEditor $fullpage = false; - $extraAllowedContent = 'a[target];section[contenteditable,id];div{background-color,display,float,height,margin,margin-top,margin-bottom,padding,width,border-top-left-radius,border-top-right-radius,box-shadow}'; + $extraAllowedContent = 'a[target];section[contenteditable,id];div{background-color,color,display,float,height,margin,margin-top,margin-bottom,padding,width,border-top-left-radius,border-top-right-radius,box-shadow}'; if (is_string($restrictContent)) { $extraAllowedContent = $restrictContent; } diff --git a/htdocs/install/doctemplates/maillayout/basic.html b/htdocs/install/doctemplates/maillayout/basic.html index 7884e03db4f..94fbbcd9f4b 100644 --- a/htdocs/install/doctemplates/maillayout/basic.html +++ b/htdocs/install/doctemplates/maillayout/basic.html @@ -1,8 +1,6 @@ - -
- - +
+

__SUBJECT__

diff --git a/htdocs/install/doctemplates/maillayout/news.html b/htdocs/install/doctemplates/maillayout/news.html index 429a92112e2..c3ed3a0fb12 100644 --- a/htdocs/install/doctemplates/maillayout/news.html +++ b/htdocs/install/doctemplates/maillayout/news.html @@ -7,22 +7,22 @@ body {
-
+
-
- +
+
- Hello + __(Hello)__
-

__LAST_NEWS__

-

__CONTENTOFMAILHOLDER__

+

__(LastNews)__

+ __NEWS_LIST__ @@ -30,15 +30,15 @@ body {
- Social networks... + __MYCOMPANY_SOCIAL_NETWORKS__
- Unsubscribe -
- Company address + __MYCOMPANY_ADDRESS__
+ __MYCOMPANY_EMAIL__
+ __CHECK_READ__
diff --git a/htdocs/install/doctemplates/maillayout/products.html b/htdocs/install/doctemplates/maillayout/products.html index 1e4423f8c1e..76b93a8689a 100644 --- a/htdocs/install/doctemplates/maillayout/products.html +++ b/htdocs/install/doctemplates/maillayout/products.html @@ -7,38 +7,38 @@ body {
-
+
-
- +
+
-
- Hello +
+ __(Hello)__
-

__LAST_NEWS__

-

__CONTENTOFMAILHOLDER__

+

__(OurProductSelection)__

+ __PRODUCTS_LIST__
-
- Social networks... +
+ __MYCOMPANY_SOCIAL_NETWORKS__
- Unsubscribe -
- Company address + __MYCOMPANY_ADDRESS__
+ __MYCOMPANY_EMAIL__
+ __CHECK_READ__