Removed duplicated code

This commit is contained in:
Marcos García 2012-07-21 23:54:23 +02:00
parent 3d10d6a559
commit 49d943e57f
6 changed files with 245 additions and 215 deletions

View File

@ -101,6 +101,9 @@ print "<br>\n";
if ($action == 'edit') // Edit if ($action == 'edit') // Edit
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -132,12 +135,10 @@ if ($action == 'edit') // Edit
print '</table><br>'."\n"; print '</table><br>'."\n";
// Themes // Themes
show_theme('',1); show_theme('',1);
print '<br>'; print '<br>';
// Liste des zone de recherche permanantes supportees // Liste des zone de recherche permanantes supportees
print '<table summary="search" class="noborder" width="100%">'; print '<table summary="search" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
@ -227,18 +228,19 @@ if ($action == 'edit') // Edit
// Message on login page // Message on login page
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageLogin").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageLogin").'</td><td colspan="2">';
// Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $doleditor = new DolEditor('main_home', $conf->global->MAIN_HOME, '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90);
$doleditor=new DolEditor('main_home',$conf->global->MAIN_HOME,'',142,'dolibarr_notes','In',false,true,true,ROWS_4,90);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Message of the day on home page // Message of the day on home page
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageOfDay").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageOfDay").'</td><td colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('main_motd',$conf->global->MAIN_MOTD,'',142,'dolibarr_notes','In',false,true,true,ROWS_4,90); $doleditor = new DolEditor('main_motd', $conf->global->MAIN_MOTD, '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'."\n"; print '</td></tr>'."\n";
/* /*

View File

@ -1480,21 +1480,23 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
} }
//WYSIWYG Editor
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
// Template to use by default // Template to use by default
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
$liste=ModelePDFCommandes::liste_modeles($db); $liste=ModelePDFCommandes::liste_modeles($db);
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF); print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Note publique // Note publique
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1); print $doleditor->Create(1);
//print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>'; //print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>'; print '</td></tr>';
@ -1505,7 +1507,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor=new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1); print $doleditor->Create(1);
//print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; //print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';

View File

@ -255,6 +255,9 @@ $form = new Form($db);
*/ */
if ($action == 'create') if ($action == 'create')
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print_fiche_titre($langs->trans("NewTrip")); print_fiche_titre($langs->trans("NewTrip"));
dol_htmloutput_errors($mesg); dol_htmloutput_errors($mesg);
@ -295,9 +298,10 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note_public',GETPOST('note_public','alpha'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100); $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
// Private note // Private note
@ -306,9 +310,10 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note_private',GETPOST('note_private','alpha'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100); $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
} }
@ -332,6 +337,9 @@ else if ($id)
if ($action == 'edit' && $user->rights->deplacement->creer) if ($action == 'edit' && $user->rights->deplacement->creer)
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$soc = new Societe($db); $soc = new Societe($db);
if ($object->socid) if ($object->socid)
{ {
@ -382,9 +390,10 @@ else if ($id)
// Public note // Public note
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td valign="top" colspan="3">'; print '<td valign="top" colspan="3">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note_public',$object->note_public,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100'); $doleditor = new DolEditor('note_public', $object->note_public, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
print $doleditor->Create(1); print $doleditor->Create(1);
print "</td></tr>"; print "</td></tr>";
// Private note // Private note
@ -392,9 +401,10 @@ else if ($id)
{ {
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td valign="top" colspan="3">'; print '<td valign="top" colspan="3">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note_private',$object->note_private,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100'); $doleditor = new DolEditor('note_private', $object->note_private, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
print $doleditor->Create(1); print $doleditor->Create(1);
print "</td></tr>"; print "</td></tr>";
} }

View File

@ -1346,6 +1346,9 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'editline') if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'editline')
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print '<a name="add"></a>'; // ancre print '<a name="add"></a>'; // ancre
@ -1372,11 +1375,9 @@ if ($id > 0 || ! empty($ref))
if ($forceall || ($conf->product->enabled && $conf->service->enabled) if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>'; || (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
// Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor=new DolEditor('dp_desc',$_POST["dp_desc"],'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); $doleditor = new DolEditor('dp_desc', $_POST["dp_desc"], '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create(); $doleditor->Create();
print '</td>'; print '</td>';
@ -1430,11 +1431,9 @@ if ($id > 0 || ! empty($ref))
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
} }
// Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor=new DolEditor('np_desc',$_POST["np_desc"],'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); $doleditor = new DolEditor('np_desc', $_POST["np_desc"], '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create(); $doleditor->Create();
print '</td>'; print '</td>';

View File

@ -697,6 +697,9 @@ else
// ----------------------------------------- // -----------------------------------------
if ($action == 'create' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($action == 'create' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print '<form action="fiche.php" method="post">'; print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -747,8 +750,7 @@ else
// Description (used in invoice, propal...) // Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $doleditor = new DolEditor('desc', $_POST["desc"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90);
$doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
@ -823,8 +825,8 @@ else
// Note (private, no output on invoices, propales...) // Note (private, no output on invoices, propales...)
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); $doleditor = new DolEditor('note', $_POST["note"], '', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70);
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
@ -880,6 +882,9 @@ else
// Fiche en mode edition // Fiche en mode edition
if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$type = $langs->trans('Product'); $type = $langs->trans('Product');
if ($object->isservice()) $type = $langs->trans('Service'); if ($object->isservice()) $type = $langs->trans('Service');
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, ""); print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, "");
@ -934,9 +939,10 @@ else
// Description (used in invoice, propal...) // Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('desc',$object->description,'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90);
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
print "\n"; print "\n";
@ -1026,9 +1032,10 @@ else
// Note // Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); $doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70);
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
print '</table>'; print '</table>';

View File

@ -157,6 +157,9 @@ print '</table>';
if ($_GET["action"] == 'edit') if ($_GET["action"] == 'edit')
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print '<form action="" method="POST">'; print '<form action="" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="vedit">'; print '<input type="hidden" name="action" value="vedit">';
@ -168,14 +171,16 @@ if ($_GET["action"] == 'edit')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>'; print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('desc-'.$key.'',$product->multilangs[$key]["description"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); $doleditor = new DolEditor("desc-$key", $product->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note-'.$key.'',$product->multilangs[$key]["note"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); $doleditor = new DolEditor("note-$key", $product->multilangs[$key]["note"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
@ -232,6 +237,9 @@ print "\n</div>\n";
if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
//WYSIWYG Editor
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
print '<br>'; print '<br>';
print '<form action="" method="post">'; print '<form action="" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -244,14 +252,16 @@ if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights-
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>'; print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('desc','','',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note','','',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); $doleditor = new DolEditor('note', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';