Fix: W3C no form into table

This commit is contained in:
Laurent Destailleur
2015-10-23 14:40:45 +02:00
parent 8d24adc97e
commit f6d30d8b9e
3 changed files with 63 additions and 39 deletions

View File

@@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if (! isValidEmail($email)) if (! isValidEmail($email))
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadEMail",$email),'errors'); setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
} }
else else
{ {
@@ -118,11 +118,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($mailmanspip->error,'errors'); setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
} }
else else
{ {
setEventMessage($langs->trans("MailmanCreationSuccess")); setEventMessages($langs->trans("MailmanCreationSuccess"), null);
} }
} }
if ($action == 'testunsubscribe') if ($action == 'testunsubscribe')
@@ -131,11 +131,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($mailmanspip->error,'errors'); setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
} }
else else
{ {
setEventMessage($langs->trans("MailmanDeletionSuccess")); setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
} }
} }
} }
@@ -156,12 +156,15 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head(); $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$var=true; $var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
@@ -200,21 +203,30 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
}); });
</script>'; </script>';
form_constantes($constantes,1); form_constantes($constantes,2);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
} }
else else
{ {
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate") //$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>'; $link.='</a>';
print load_fiche_titre($langs->trans('MailmanTitle'), $link,''); print load_fiche_titre($langs->trans('MailmanTitle'), $link,'');
dol_fiche_end();
} }
dol_fiche_end();
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {

View File

@@ -54,28 +54,30 @@ if ($action == 'update' || $action == 'add')
$constname=GETPOST("constname"); $constname=GETPOST("constname");
$constvalue=GETPOST("constvalue"); $constvalue=GETPOST("constvalue");
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue=''; // Action mise a jour ou ajout d'une constante
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice if ($action == 'update' || $action == 'add')
{ {
if ($constvalue) $constvalue=0; foreach($_POST['constname'] as $key => $val)
else $constvalue=1; {
} $constname=$_POST["constname"][$key];
$constvalue=$_POST["constvalue"][$key];
$consttype=$_POST["consttype"][$key];
$constnote=$_POST["constnote"][$key];
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname]; $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
$consttype=$_POST["consttype"];
$constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
}
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessage($langs->trans("Error"),'errors');
} }
}
} }
// Action activation d'un sous module du module adherent // Action activation d'un sous module du module adherent
@@ -115,7 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head(); $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$var=true; $var=true;
@@ -124,6 +125,10 @@ $var=true;
*/ */
if (! empty($conf->global->ADHERENT_USE_SPIP)) if (! empty($conf->global->ADHERENT_USE_SPIP))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
@@ -139,21 +144,28 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
print '<br>'; print '<br>';
form_constantes($constantes);
print '<br>'; form_constantes($constantes,2);
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
} }
else else
{ {
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Activate"); //$link.=$langs->trans("Activate");
$link.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>'; $link.='</a>';
print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
dol_fiche_end();
} }
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@@ -1053,7 +1053,7 @@ function complete_elementList_with_modules(&$elementList)
* Show array with constants to edit * Show array with constants to edit
* *
* @param array $tableau Array of constants * @param array $tableau Array of constants
* @param int $strictw3c Respect W3C (no form into table) * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all
* @return void * @return void
*/ */
function form_constantes($tableau,$strictw3c=0) function form_constantes($tableau,$strictw3c=0)
@@ -1062,7 +1062,7 @@ function form_constantes($tableau,$strictw3c=0)
$form = new Form($db); $form = new Form($db);
if (! empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@@ -1199,7 +1199,7 @@ function form_constantes($tableau,$strictw3c=0)
} }
print '</table>'; print '</table>';
if (! empty($strictw3c)) if (! empty($strictw3c) && $strictw3c == 1)
{ {
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print "</form>\n"; print "</form>\n";