From e71103ed021b12965234731094544a11171e5624 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sat, 16 Mar 2013 09:23:34 +0100 Subject: [PATCH 1/5] task #768: https://doliforge.org/tracker/?func=detail&aid=768&group_id=144 task #769 : https://doliforge.org/tracker/?func=detail&aid=769&group_id=144 --- htdocs/admin/fckeditor.php | 6 ++++++ htdocs/core/class/html.formmail.class.php | 5 +++++ htdocs/core/modules/modFckeditor.class.php | 9 ++++++--- htdocs/langs/en_US/admin.lang | 4 +++- htdocs/langs/es_ES/admin.lang | 4 +++- htdocs/langs/fr_FR/admin.lang | 4 +++- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 125c3cb12d0..57bc089c6a5 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -41,6 +41,8 @@ $modules = array( 'PRODUCTDESC' => 'FCKeditorForProduct', 'MAILING' => 'FCKeditorForMailing', 'DETAILS' => 'FCKeditorForProductDetails', +'USERSIGN' => 'FCKeditorForUserSignature', +'MAIL' => 'FCKeditorForMail' ); // Conditions pour que l'option soit proposee $conditions = array( @@ -48,6 +50,8 @@ $conditions = array( 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'MAILING' => ! empty($conf->mailing->enabled), 'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)), +'USERSIGN' => 1, +'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)) ); // Picto $picto = array( @@ -55,6 +59,8 @@ $picto = array( 'PRODUCTDESC' => 'product', 'MAILING' => 'email', 'DETAILS' => 'generic', +'USERSIGN' => 'user', +'MAIL' => 'email' ); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index bca6463055b..656679a66f0 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -77,6 +77,8 @@ class FormMail */ function __construct($db) { + global $conf; + $this->db = $db; $this->withform=1; @@ -593,6 +595,9 @@ class FormMail // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { + $this->withfckeditor=1; + } $doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72); $out.= $doleditor->Create(1); } diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 10bd7414722..5c3f3f266bb 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -67,9 +67,12 @@ class modFckeditor extends DolibarrModules // Constantes $this->const = array(); - $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE","yesno","1","Activation fckeditor sur notes autres"); - $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC","yesno","1","Activation fckeditor sur notes produits"); - $this->const[2] = array("FCKEDITOR_ENABLE_MAILING","yesno","1","Activation fckeditor sur emailing"); + $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE","yesno","1","WYSIWIG for description and note (except products/services)"); + $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC","yesno","1","WYSIWIG for products/services description and note"); + $this->const[2] = array("FCKEDITOR_ENABLE_MAILING","yesno","1","WYSIWIG for mass emailings"); + $this->const[3] = array("FCKEDITOR_ENABLE_DETAILS","yesno","1","WYSIWIG for products details lines for all entities"); + $this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN","yesno","1","WYSIWIG for products details lines for all entities"); + $this->const[5] = array("FCKEDITOR_ENABLE_MAIL","yesno","1","WYSIWIG for products details lines for all entities"); // Boites $this->boxes = array(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3b13ef6e834..b27ab4e0301 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1274,7 +1274,9 @@ ActivateFCKeditor=Activate advanced editor for: FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services) FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files. -FCKeditorForMailing=WYSIWIG creation/edition of mailings +FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing) +FCKeditorForUserSignature=WYSIWIG creation/edition of user signature +FCKeditorForMail=WYSIWIG creation/edition for all mail (except Outils->eMailing) ##### OSCommerce 1 ##### OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be an OSCommerce database (Key %s not found in table %s). OSCommerceTestOk=Connection to server '%s' on database '%s' with user '%s' successfull. diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 6c6239b9522..811d9166b57 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -1270,7 +1270,9 @@ ActivateFCKeditor=Activar editor avanzado para : FCKeditorForCompany=Creación/edición WYSIWIG de la descripción y notas de los terceros FCKeditorForProduct=Creación/edición WYSIWIG de la descripción y notas de los productos/servicios FCKeditorForProductDetails=Creación/edición WYSIWIG de las líneas de detalle de los productos (en pedidos, presupuestos, facturas, etc.) -FCKeditorForMailing=Creación/edición WYSIWIG de los E-Mails +FCKeditorForMailing=Creación/edición WYSIWIG de los E-Mails (Utilidades->E-Mailings) +FCKeditorForUserSignature=Creación/edición WYSIWIG de los usuario firma +FCKeditorForMail=Creación/edición WYSIWIG de todos los E-Mails (excepto Utilidades->E-Mailings) ##### OSCommerce 1 ##### OSCommerceErrorConnectOkButWrongDatabase=La conexión se ha establecido, pero la base de datos no parece de OSCommerce. OSCommerceTestOk=La conexión al servidor '%s' sobre la base '%s' por el usuario '%s' es correcta. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 04a95bf5980..6d5b639378f 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1274,7 +1274,9 @@ ActivateFCKeditor= Activer éditeur avancé pour : FCKeditorForCompany= Création/édition WYSIWIG de la description et note des éléments (autre que produits/services) FCKeditorForProduct= Création/édition WYSIWIG de la description et note des produits/services FCKeditorForProductDetails= Création/édition WYSIWIG des lignes détails produits (sur commandes, propales, factures, etc...). Attention: L'utilisation pour ce cas est fortement déconseillée car peut poser des problèmes dans la gestion de caractères et mise en page des fichiers PDF générés. -FCKeditorForMailing= Création/édition WYSIWIG des mailings +FCKeditorForMailing= Création/édition WYSIWIG des mailings (Outils->EMailings) +FCKeditorForUserSignature=Création/édition WYSIWIG de la signature des utilisateurs +FCKeditorForMail=Création/édition WYSIWIG tous les mails (sauf Outils->EMailings) ##### OSCommerce 1 ##### OSCommerceErrorConnectOkButWrongDatabase= La connexion a réussi mais la base ne semble pas être une base OSCommerce (clé %s non trouvée dans la table %s). OSCommerceTestOk= La connexion au serveur '%s' sur la base '%s' par l'utilisateur '%s' a réussi. From 1f5ebb594a0ef9fa00f8b613b7fd6fc791813819 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sat, 16 Mar 2013 09:43:09 +0100 Subject: [PATCH 2/5] [ task #769 ] WYSIWYG for user signature --- htdocs/user/class/user.class.php | 6 +++++- htdocs/user/fiche.php | 24 ++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index feb1b6164e0..63db83634a8 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -201,7 +201,11 @@ class User extends CommonObject $this->user_mobile = $obj->user_mobile; $this->email = $obj->email; $this->job = $obj->job; - $this->signature = $obj->signature; + if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) && dol_textishtml(dol_html_entity_decode($obj->signature, ENT_COMPAT | ENT_HTML401))) { + $this->signature = dol_html_entity_decode($obj->signature, ENT_COMPAT | ENT_HTML401); + }else { + $this->signature = $obj->signature; + } $this->admin = $obj->admin; $this->note = $obj->note; $this->statut = $obj->statut; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 5c4ddac9718..cec4686ba5f 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -886,7 +886,17 @@ if (($action == 'create') || ($action == 'adduserldap')) // Signature print ''.$langs->trans("Signature").''; print ''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)) { + $withfckeditor=1; + //Mailing is mandatory to have dolHTMLencode done by ckeditor + $ckeditortoolbar='dolibarr_mailings'; + } else { + $withfckeditor=0; + $ckeditortoolbar=''; + } + $doleditor=new DolEditor('signature',GETPOST('signature'),'',280,$ckeditortoolbar,'In',true,true,$withfckeditor,8,72); + print $doleditor->Create(1); print ''; // Multicompany @@ -1794,7 +1804,17 @@ else // Signature print "".''.$langs->trans("Signature").''; print ''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)) { + $withfckeditor=1; + //Mailing is mandatory to have dolHTMLencode done by ckeditor + $ckeditortoolbar='dolibarr_mailings'; + } else { + $withfckeditor=0; + $ckeditortoolbar=''; + } + $doleditor=new DolEditor('signature',$object->signature,'',280,$ckeditortoolbar,'In',true,true,$withfckeditor,8,72); + print $doleditor->Create(1); print ''; // openid From cf21b32eb1e953448341a4696f27bf8f46f57545 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sat, 16 Mar 2013 09:46:34 +0100 Subject: [PATCH 3/5] task #768 --- htdocs/core/class/html.formmail.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 656679a66f0..37ad8a6384c 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -76,9 +76,7 @@ class FormMail * @param DoliDB $db Database handler */ function __construct($db) - { - global $conf; - + { $this->db = $db; $this->withform=1; From 07bc0cd09e314a2c4866ba7b629670071ef1708e Mon Sep 17 00:00:00 2001 From: fhenry Date: Sat, 16 Mar 2013 17:01:17 +0100 Subject: [PATCH 4/5] Taking account remark https://github.com/FHenry/dolibarr/commit/1f5ebb594a0ef9fa00f8b613b7fd6fc791813819 --- htdocs/user/class/user.class.php | 6 +----- htdocs/user/fiche.php | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 63db83634a8..feb1b6164e0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -201,11 +201,7 @@ class User extends CommonObject $this->user_mobile = $obj->user_mobile; $this->email = $obj->email; $this->job = $obj->job; - if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) && dol_textishtml(dol_html_entity_decode($obj->signature, ENT_COMPAT | ENT_HTML401))) { - $this->signature = dol_html_entity_decode($obj->signature, ENT_COMPAT | ENT_HTML401); - }else { - $this->signature = $obj->signature; - } + $this->signature = $obj->signature; $this->admin = $obj->admin; $this->note = $obj->note; $this->statut = $obj->statut; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index cec4686ba5f..7a1059acd89 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1205,7 +1205,11 @@ else // Signature print ''.$langs->trans('Signature').''; - print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false); + if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) && dol_textishtml(dol_html_entity_decode($object->signature, ENT_COMPAT | ENT_HTML401))) { + print dol_html_entity_decode($object->signature, ENT_COMPAT | ENT_HTML401); + }else { + print dol_nl2br($object->signature,1,false); + } print "\n"; // Hierarchy From 9e46a55bbf8fb852cb197fc3498fc19d5098a114 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 17 Mar 2013 22:26:06 +0100 Subject: [PATCH 5/5] Taking account remark on pull request --- htdocs/user/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 7a1059acd89..2e3a14777b2 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1208,7 +1208,7 @@ else if (!empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) && dol_textishtml(dol_html_entity_decode($object->signature, ENT_COMPAT | ENT_HTML401))) { print dol_html_entity_decode($object->signature, ENT_COMPAT | ENT_HTML401); }else { - print dol_nl2br($object->signature,1,false); + print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false); } print "\n";