From a8c3ce4e55e799a0bce6dd3bb54255dc22425661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Nov 2016 12:21:50 +0100 Subject: [PATCH] FIX A form should not be inside a table. Create javascript troubles. --- htdocs/comm/mailing/cibles.php | 105 ++++++++++----- .../modules/mailings/modules_mailings.php | 14 +- .../modules/mailings/xinputfile.modules.php | 5 +- .../modules/mailings/xinputuser.modules.php | 7 +- htdocs/langs/en_US/mails.lang | 2 + htdocs/main.inc.php | 1 + htdocs/public/test/test_arrays.php | 127 +----------------- 7 files changed, 91 insertions(+), 170 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 3767ba17add..e22b8538a66 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -238,14 +238,22 @@ if ($object->fetch($id) >= 0) { print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic'); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - + //print '
'.$langs->trans("RecipientSelectionModules").''.$langs->trans("NbOfUniqueEMails").''.$langs->trans("Filter").' 
'; + print '
'; + + //print '
'; + print '
'; + //print '
'; + print '
'.$langs->trans("RecipientSelectionModules").'
'; + //print ''; + print '
'.$langs->trans("NbOfUniqueEMails").'
'; + //print ''; + print '
'.$langs->trans("Filter").'
'; + //print ''; + print '
 
'; + //print "\n"; + print ''; + clearstatcache(); $var=true; @@ -303,19 +311,28 @@ if ($object->fetch($id) >= 0) if ($qualified) { $var = !$var; - print ''; + //print ''; +// print '
'; if ($allowaddtarget) { - print '
'; + print ''; print ''; } + else + { + print '
'; + } - print '
'; - + print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto); + print ' '; + print $obj->getDesc(); + //print ''; + print ''; + try { $nbofrecipient=$obj->getNbOfRecipients(''); } @@ -324,7 +341,8 @@ if ($object->fetch($id) >= 0) dol_syslog($e->getMessage(), LOG_ERR); } - print ''; - - print ''; - - print ''; + print ''; + + //print ''; + print ''; + + //print ''; - + //print ''; + print ''; + if ($allowaddtarget) print ''; - - print "\n"; + else print ''; + + //print "\n"; +// print ''."\n"; } } } // End foreach dir - print '
'.$langs->trans("RecipientSelectionModules").''.$langs->trans("NbOfUniqueEMails").''.$langs->trans("Filter").' 
'; + //print ''; + print '
'; if (empty($obj->picto)) $obj->picto='generic'; - print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc(); - print '
'; + //print ''; + print '
'; if ($nbofrecipient >= 0) { print $nbofrecipient; @@ -333,41 +351,54 @@ if ($object->fetch($id) >= 0) { print $langs->trans("Error").' '.img_error($obj->error); } - print '
'; - try { - $filter=$obj->formFilter(); - } - catch(Exception $e) - { - dol_syslog($e->getMessage(), LOG_ERR); - } - if ($filter) print $filter; - else print $langs->trans("None"); - print ''; + //print ''; + print '
'; if ($allowaddtarget) { - print ''; + try { + $filter=$obj->formFilter(); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } + if ($filter) print $filter; + else print $langs->trans("None"); + } + //print '
'; + print '
'; + if ($allowaddtarget) + { + print ''; } else { + print ''; //print $langs->trans("MailNoChangePossible"); print " "; } - print '
'; - print '
'; + //print ''; + print ''; + + print '

'; } // List of selected targets diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index c75e22ed334..16b930e8907 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -33,7 +33,8 @@ class MailingTargets // This can't be abstract as it is used for some method { var $db; var $error; - + var $tooltip=''; + /** * Constructor @@ -52,11 +53,16 @@ class MailingTargets // This can't be abstract as it is used for some method */ function getDesc() { - global $langs; + global $langs, $form; + $langs->load("mails"); $transstring="MailingModuleDesc".$this->name; - if ($langs->trans($transstring) != $transstring) return $langs->trans($transstring); - else return $this->desc; + $s=''; + if ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring); + else $s=$this->desc; + + if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1); + return $s; } /** diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 7b6f8361d24..04c4be3ce2e 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -31,12 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class mailing_xinputfile extends MailingTargets { var $name='EmailsFromFile'; // Identifiant du module mailing - var $desc='EMails issus d\'un fichier'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_admin=0; // Module mailing actif pour user admin ou non var $picto='generic'; - - var $db; + var $tooltip='UseFormatFileEmailToTarget'; /** diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 7832d1f6a93..4c5567f574d 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -35,9 +35,8 @@ class mailing_xinputuser extends MailingTargets var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_admin=0; // Module mailing actif pour user admin ou non var $picto='generic'; - - var $db; - + var $tooltip='UseFormatInputEmailToTarget'; + /** * Constructor @@ -104,7 +103,7 @@ class mailing_xinputuser extends MailingTargets global $langs; $s=''; - $s.=''; + $s.=''; return $s; } diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 072bbdd9750..d036a72186b 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -118,6 +118,8 @@ MailSendSetupIs2=You must first go, with an admin account, into menu %sHome - Se MailSendSetupIs3=If you have any questions on how to setup your SMTP server, you can ask to %s. YouCanAlsoUseSupervisorKeyword=You can also add the keyword __SUPERVISOREMAIL__ to have email being sent to the supervisor of user (works only if an email is defined for this supervisor) NbOfTargetedContacts=Current number of targeted contact emails +UseFormatFileEmailToTarget=Imported file must have format email;name;firstname;other +UseFormatInputEmailToTarget=Enter a string with format email;name;firstname;other MailAdvTargetRecipients=Recipients (advanced selection) AdvTgtTitle=Fill input fields to preselect the thirdparties or contacts/addresses to target AdvTgtSearchTextHelp=Use %% as magic caracters. For exemple to find all item like jean, joe, jim, you can input j%%, you can also use ; as separator for value, and use ! for except this value. For exemple jean;joe;jim%%;!jimo;!jima% will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 12ed77dd36e..3a9ef61d7ec 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -849,6 +849,7 @@ if (! defined('NOREQUIRETRAN')) $bc=array(0=>'class="impair"',1=>'class="pair"'); $bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"'); $bcnd=array(0=>'class="impair nodrag nodrop nohover"',1=>'class="pair nodrag nodrop nohoverpair"'); // Used for tr to add new lines +$bctag=array(0=>'class="impair tagtr"',1=>'class="pair tagtr"'); // Define messages variables $mesg=''; $warning=''; $error=0; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 5eaa20003af..175352f404b 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -242,8 +242,8 @@ if (! empty($moreforfilter))
- -


Example 2 : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables
+ -


Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

+


Example 2 : Table using tags: div.tagtable+(div|form).tagtr+div[.tagtd] => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> -
+
Title A
title B