Ajout du wysiwyg pour le mailing

This commit is contained in:
Regis Houssin 2006-07-22 12:17:30 +00:00
parent ff79933df2
commit c57c870e5a
2 changed files with 71 additions and 36 deletions

View File

@ -35,22 +35,28 @@ $langs->load("fckeditor");
if (!$user->admin)
accessforbidden();
// Constante et traduction de la description du module
$modules = array(
'PRODUCTDESC'=>'FCKeditorForProductDescription',
'MAILING'=>'FCKeditorForMailing',
);
if ($_GET["action"] == 'activate_productdesc')
foreach($modules as $const => $desc)
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_PRODUCTDESC", "1");
if ($_GET["action"] == 'activate_'.strtolower($const))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1");
Header("Location: fckeditor.php");
exit;
}
else if ($_GET["action"] == 'disable_productdesc')
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_PRODUCTDESC");
}
else if ($_GET["action"] == 'disable_'.strtolower($const))
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const);
Header("Location: fckeditor.php");
exit;
}
}
/*
* Affiche page
*/
@ -79,41 +85,45 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
$var=true;
// Module Propale
$var=!$var;
print "<form method=\"post\" action=\"fckeditor.php\">";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ActivateFCKeditor").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Action").'</td>';
print "</tr>\n";
print "<input type=\"hidden\" name=\"action\" value=\"productdesc\">";
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("FCKeditorForProductDescription").'</td>';
print '<td align="center" width="20">';
if($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC == 1)
// Modules
foreach($modules as $const => $desc)
{
print img_tick();
$var=!$var;
print "<form method=\"post\" action=\"fckeditor.php\">";
print '<input type="hidden" name="action" value="'.strtolower($const).'">';
print '<tr ".$bc[$var].">';
print '<td>'.$langs->trans($desc).'</td>';
print '<td align="center" width="20">';
if($conf->global->FCKEDITOR_ENABLE_.$const == 1)
{
print img_tick();
}
print '</td>';
print '<td align="center" width="100">';
if($conf->global->FCKEDITOR_ENABLE_.$const == 0)
{
print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.$langs->trans("Activate").'</a>';
}
else if($conf->global->FCKEDITOR_ENABLE_.$cont == 1)
{
print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.$langs->trans("Disable").'</a>';
}
print '</form>';
}
print '</td>';
print '<td align="center" width="100">';
if($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC == 0)
{
print '<a href="fckeditor.php?action=activate_productdesc">'.$langs->trans("Activate").'</a>';
}
else if($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC == 1)
{
print '<a href="fckeditor.php?action=disable_productdesc">'.$langs->trans("Disable").'</a>';
}
print "</td>";
print '</tr>';
print '</table>';
print '</form>';
print "</td>";
print '</tr>';
print '</table>';
$db->close();

View File

@ -244,7 +244,19 @@ if ($_GET["action"] == 'create')
print '__LASTNAME__ = '.$langs->trans("Lastname").'<br>';
print '__FIRSTNAME__ = '.$langs->trans("Firstname").'<br>';
print '</i></td>';
print '<td><textarea cols="70" rows="10" name="body"></textarea></td></tr>';
print '<td>';
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
{
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('body');
$oFCKeditor->Create() ;
}
else
{
print '<textarea cols="70" rows="10" name="body"></textarea>';
}
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></td></tr>';
print '</table>';
print '</form>';
@ -430,8 +442,21 @@ else
print '__LASTNAME__ = '.$langs->trans("Lastname").'<br>';
print '__FIRSTNAME__ = '.$langs->trans("Firstname").'<br>';
print '</i></td>';
print '<td colspan="3"><textarea name="body" cols=70 rows=10>';
print $mil->body.'</textarea></td></tr>';
print '<td colspan="3">';
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
{
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('body');
$oFCKeditor->Value = $mil->body;
$oFCKeditor->Create() ;
}
else
{
print '<textarea name="body" cols=70 rows=10>';
print $mil->body.'</textarea>';
}
print '</td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print '</table>';