NEW Include a color syntaxed HTML editor for emailing edition.
This commit is contained in:
parent
9a0576ff79
commit
61cf69f2bb
@ -463,7 +463,7 @@ if (empty($reshook))
|
|||||||
$object->email_errorsto = trim($_POST["errorsto"]);
|
$object->email_errorsto = trim($_POST["errorsto"]);
|
||||||
$object->titre = trim($_POST["titre"]);
|
$object->titre = trim($_POST["titre"]);
|
||||||
$object->sujet = trim($_POST["sujet"]);
|
$object->sujet = trim($_POST["sujet"]);
|
||||||
$object->body = trim($_POST["body"]);
|
$object->body = trim($_POST["bodyemail"]);
|
||||||
$object->bgcolor = trim($_POST["bgcolor"]);
|
$object->bgcolor = trim($_POST["bgcolor"]);
|
||||||
$object->bgimage = trim($_POST["bgimage"]);
|
$object->bgimage = trim($_POST["bgimage"]);
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ if (empty($reshook))
|
|||||||
$mesgs = array();
|
$mesgs = array();
|
||||||
|
|
||||||
$object->sujet = trim($_POST["sujet"]);
|
$object->sujet = trim($_POST["sujet"]);
|
||||||
$object->body = trim($_POST["body"]);
|
$object->body = trim($_POST["bodyemail"]);
|
||||||
$object->bgcolor = trim($_POST["bgcolor"]);
|
$object->bgcolor = trim($_POST["bgcolor"]);
|
||||||
$object->bgimage = trim($_POST["bgimage"]);
|
$object->bgimage = trim($_POST["bgimage"]);
|
||||||
|
|
||||||
@ -686,7 +686,13 @@ $form = new Form($db);
|
|||||||
$htmlother = new FormOther($db);
|
$htmlother = new FormOther($db);
|
||||||
|
|
||||||
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||||
llxHeader('',$langs->trans("Mailing"),$help_url);
|
llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
|
||||||
|
array(
|
||||||
|
'/includes/ace/ace.js',
|
||||||
|
'/includes/ace/ext-statusbar.js',
|
||||||
|
'/includes/ace/ext-language_tools.js',
|
||||||
|
//'/includes/ace/ext-chromevox.js'
|
||||||
|
), array());
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@ -740,7 +746,7 @@ if ($action == 'create')
|
|||||||
print '<div style="padding-top: 10px">';
|
print '<div style="padding-top: 10px">';
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
$doleditor=new DolEditor('bodyemail',GETPOST('bodyemail','none'),'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -780,7 +786,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action != 'edit')
|
if ($action != 'edit' && $action != 'edithtml')
|
||||||
{
|
{
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
||||||
|
|
||||||
@ -935,7 +941,9 @@ else
|
|||||||
|
|
||||||
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
|
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
|
||||||
|
|
||||||
|
if (! empty($conf->use_javascript_ajax)) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<a class="butAction" href="card.php?action=test&id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>';
|
//print '<a class="butAction" href="card.php?action=test&id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>';
|
||||||
@ -1095,7 +1103,7 @@ else
|
|||||||
$readonly=1;
|
$readonly=1;
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
|
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else print dol_htmlentitiesbr($object->body);
|
else print dol_htmlentitiesbr($object->body);
|
||||||
@ -1107,7 +1115,7 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Mailing en mode edition
|
* Mailing en mode edition (CKeditor or HTML source)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
||||||
@ -1187,7 +1195,8 @@ else
|
|||||||
// Print mail content
|
// Print mail content
|
||||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
||||||
|
|
||||||
dol_fiche_head();
|
|
||||||
|
dol_fiche_head(null, '', '', -1);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -1203,6 +1212,7 @@ else
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
// List of files
|
// List of files
|
||||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||||
|
|
||||||
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||||
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||||
$out.= '<script type="text/javascript" language="javascript">';
|
$out.= '<script type="text/javascript" language="javascript">';
|
||||||
@ -1242,17 +1252,29 @@ else
|
|||||||
|
|
||||||
// Message
|
// Message
|
||||||
print '<div style="padding-top: 10px">';
|
print '<div style="padding-top: 10px">';
|
||||||
|
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
}
|
||||||
|
if ($action == 'edithtml')
|
||||||
|
{
|
||||||
|
// Editor HTML source
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',true,true,'ace',20,'90%');
|
||||||
|
$doleditor->Create(0, '', false, 'HTML Source', 'php');
|
||||||
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
|
print '<input type="submit" class="button buttonforacesave" value="'.$langs->trans("Save").'" name="save">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -52,13 +52,14 @@ class DolEditor
|
|||||||
* @param string $content Content of WYSIWIG field
|
* @param string $content Content of WYSIWIG field
|
||||||
* @param int $width Width in pixel of edit area (auto by default)
|
* @param int $width Width in pixel of edit area (auto by default)
|
||||||
* @param int $height Height in pixel of edit area (200px by default)
|
* @param int $height Height in pixel of edit area (200px by default)
|
||||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace').
|
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
|
||||||
* @param string $toolbarlocation Where bar is stored :
|
* @param string $toolbarlocation Where bar is stored :
|
||||||
* 'In' each window has its own toolbar
|
* 'In' each window has its own toolbar
|
||||||
* 'Out:name' share toolbar into the div called 'name'
|
* 'Out:name' share toolbar into the div called 'name'
|
||||||
* @param boolean $toolbarstartexpanded Bar is visible or not at start
|
* @param boolean $toolbarstartexpanded Bar is visible or not at start
|
||||||
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
|
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
|
||||||
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like fckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
|
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
|
||||||
|
* Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
|
||||||
* @param int $rows Size of rows for textarea tool
|
* @param int $rows Size of rows for textarea tool
|
||||||
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
|
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
|
||||||
* @param int $readonly 0=Read/Edit, 1=Read only
|
* @param int $readonly 0=Read/Edit, 1=Read only
|
||||||
@ -310,7 +311,7 @@ class DolEditor
|
|||||||
'."\n";
|
'."\n";
|
||||||
|
|
||||||
$out.= 'jQuery(document).ready(function() {
|
$out.= 'jQuery(document).ready(function() {
|
||||||
jQuery("#savefile").click(function() {
|
jQuery(".buttonforacesave").click(function() {
|
||||||
console.log("We click on savefile button for component '.$this->htmlname.'");
|
console.log("We click on savefile button for component '.$this->htmlname.'");
|
||||||
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
|
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
|
||||||
console.log(aceEditor.getSession().getValue());
|
console.log(aceEditor.getSession().getValue());
|
||||||
|
|||||||
@ -707,6 +707,8 @@ LinkToIntervention=Link to intervention
|
|||||||
CreateDraft=Create draft
|
CreateDraft=Create draft
|
||||||
SetToDraft=Back to draft
|
SetToDraft=Back to draft
|
||||||
ClickToEdit=Click to edit
|
ClickToEdit=Click to edit
|
||||||
|
EditWithEditor=Edit with CKEditor
|
||||||
|
EditHTMLSource=Edit HTML Source
|
||||||
ObjectDeleted=Object %s deleted
|
ObjectDeleted=Object %s deleted
|
||||||
ByCountry=By country
|
ByCountry=By country
|
||||||
ByTown=By town
|
ByTown=By town
|
||||||
|
|||||||
@ -15,8 +15,6 @@ EditCss=Edit Style/CSS or HTML header
|
|||||||
EditMenu=Edit menu
|
EditMenu=Edit menu
|
||||||
EditMedias=Edit medias
|
EditMedias=Edit medias
|
||||||
EditPageMeta=Edit Meta
|
EditPageMeta=Edit Meta
|
||||||
EditPageSource=Edit HTML Source
|
|
||||||
EditPageContent=Edit with CKEditor
|
|
||||||
Website=Web site
|
Website=Web site
|
||||||
AddWebsite=Add website
|
AddWebsite=Add website
|
||||||
Webpage=Web page/container
|
Webpage=Web page/container
|
||||||
|
|||||||
@ -759,7 +759,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$objectpage->content = GETPOST('PAGE_CONTENT');
|
$objectpage->content = GETPOST('PAGE_CONTENT','none');
|
||||||
|
|
||||||
// Clean data. We remove all the head section.
|
// Clean data. We remove all the head section.
|
||||||
$objectpage->content = preg_replace('/<head>.*<\/head>/s', '', $objectpage->content);
|
$objectpage->content = preg_replace('/<head>.*<\/head>/s', '', $objectpage->content);
|
||||||
@ -1010,8 +1010,8 @@ if (count($object->records) > 0)
|
|||||||
|
|
||||||
if (in_array($action, array('editcss','editmenu','editmedias')))
|
if (in_array($action, array('editcss','editmenu','editmedias')))
|
||||||
{
|
{
|
||||||
if (preg_match('/^create/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
if (preg_match('/^create/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if (preg_match('/^edit/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
if (preg_match('/^edit/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,8 +1118,8 @@ if (count($object->records) > 0)
|
|||||||
print ' ';
|
print ' ';
|
||||||
|
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageSource")).'" name="editsource">';
|
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditHTMLSource")).'" name="editsource">';
|
||||||
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||||
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ClonePage")).'" name="createpagefromclone">';
|
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ClonePage")).'" name="createpagefromclone">';
|
||||||
@ -1160,8 +1160,8 @@ if (count($object->records) > 0)
|
|||||||
}
|
}
|
||||||
if (! in_array($action, array('editcss','editmenu','editmedias','createsite','create','createpagefromclone')))
|
if (! in_array($action, array('editcss','editmenu','editmedias','createsite','create','createpagefromclone')))
|
||||||
{
|
{
|
||||||
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user