From 93d784614b3ff49d2ae7a610b5de92560d52c698 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Mar 2006 20:52:01 +0000 Subject: [PATCH] =?UTF-8?q?Look:=20Modif=20esth=E9tiques=20mineures=20sur?= =?UTF-8?q?=20page=20des=20cat=E9gories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/categories/fiche.php | 362 +++++++++++++++-------------- htdocs/categories/viewcat.php | 106 +++++---- htdocs/langs/en_US/categories.lang | 3 +- htdocs/langs/fr_FR/categories.lang | 1 + 4 files changed, 248 insertions(+), 224 deletions(-) diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index a49d637860a..f5d677afd32 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -22,9 +22,9 @@ */ /** - \file htdocs/categories/fiche.php - \ingroup categorie - \brief Page creation nouvelle categorie + \file htdocs/categories/fiche.php + \ingroup categorie + \brief Page creation nouvelle categorie */ require "./pre.inc.php"; @@ -34,11 +34,11 @@ if (!$user->rights->categorie->lire) accessforbidden(); if (isset ($_REQUEST['choix'])) { - $nbcats = $_REQUEST['choix']; + $nbcats = $_REQUEST['choix']; } else { // par défault, une nouvelle catégorie sera dans une seule catégorie mère - $nbcats = 1; + $nbcats = 1; } llxHeader("","",$langs->trans("Categories")); @@ -49,56 +49,57 @@ $html = new Form($db); // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { - $categorie = new Categorie($db); + $categorie = new Categorie($db); + + $categorie->label = stripslashes($_POST["nom"]); + $categorie->description = stripslashes($_POST["description"]); + $cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array(); + $ok = true; + + if (!$categorie->label || !$categorie->description) + { + $_GET["action"] = 'create'; + $ok = false; + } + + if ($ok) + { + if (sizeof($cats_meres) > 1 && sizeof(array_unique($cats_meres)) != sizeof($cats_meres)) + { + // alors il y a des valeurs en double + print '

'.$langs->trans("ErrSameCatSelected").'

'; + $_GET["action"] = 'create'; + $ok = false; + } + } + + if ($ok) + { + $res = $categorie->create(); + if ($res < 0) + { + $_error = 3; + } + else + { + foreach ($cats_meres as $id) + { + $mere = new Categorie($db, $id); + $res = $mere->add_fille($categorie); + if ($res < 0) + { + $_error = 2; + } + else + { + $_GET["action"] = 'confirmed'; + $_POST["addcat"] = ''; + } + } + } + } - $categorie->label = stripslashes($_POST["nom"]); - $categorie->description = stripslashes($_POST["description"]); - $cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array(); - $ok = true; - - if (!$categorie->label || !$categorie->description) - { - $_GET["action"] = 'create'; - $ok = false; - } - - if ($ok) - { - if (sizeof($cats_meres) > 1 && sizeof(array_unique($cats_meres)) != sizeof($cats_meres)) - { // alors il y a des valeurs en double - print '

'.$langs->trans("ErrSameCatSelected").'

'; - $_GET["action"] = 'create'; - $ok = false; - } - } - - if ($ok) - { - $res = $categorie->create(); - if ($res < 0) - { - $_error = 3; - } - else - { - foreach ($cats_meres as $id) - { - $mere = new Categorie($db, $id); - $res = $mere->add_fille($categorie); - if ($res < 0) - { - $_error = 2; - } - else - { - $_GET["action"] = 'confirmed'; - $_POST["addcat"] = ''; - } - } - } - } - } @@ -108,72 +109,73 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) if ($user->rights->produit->creer) { - if ($_GET["action"] == 'create' || $_POST["addcat"] == 'addcat') - { - print '
'; - print ''; - print ''; - print ''; - print ''; - - foreach ($catsMeres as $id => $cat_mere) - { - print ''; - } - - print_fiche_titre($langs->trans("CreateCat")); - - print ''; - print ''; - print ''; - print ''; - print ''; - print $html->select_all_categories($nbcats); - print ''; - - } - - -/* - * Action confirmation de création de la catégorie - */ - - if ($_GET["action"] == 'confirmed') - { - print_titre($langs->trans("CatCreated")); - - print '
'.$langs->trans("Label").''; - if ($_error == 1) - { - print $lang->trans("ErrCatAlreadyExists"); - } - print'
'.$langs->trans("Description").''; - print '
'; - print $langs->trans("AddIn").' '; - print $html->select_nombre_sous_categorie($nbcats,"choix").' '; - print $langs->trans("categories"); - print ''; - print ''; - print '
'; - print ''; - print '
'; - print '
'; - - if ($_error == 3) + if ($_GET["action"] == 'create' || $_POST["addcat"] == 'addcat') { - print '

'.$langs->trans("ImpossibleAddCat").' '.$categorie->label.'

'; + print '
'; + print ''; + print ''; + print ''; + print ''; + + $catsMeres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array(); + foreach ($catsMeres as $id => $cat_mere) + { + print ''; + } + + print_fiche_titre($langs->trans("CreateCat")); + + print ''; + print ''; + print ''; + print ''; + print ''; + print $html->select_all_categories($nbcats); + print ''; + } - else + + + /* + * Action confirmation de création de la catégorie + */ + + if ($_GET["action"] == 'confirmed') { - print '

'.$langs->trans("TheCategorie").' '.$categorie->label.' '.$langs->trans("WasAddedSuccessfully").'

'; - if ($_error == 2) - { - print '

'.$langs->trans("TheCategorie").' '.$mere->label.' ('.$res.').

'; - } + print_titre($langs->trans("CatCreated")); + + print '
'.$langs->trans("Label").''; + if ($_error == 1) + { + print $lang->trans("ErrCatAlreadyExists"); + } + print'
'.$langs->trans("Description").''; + print '
'; + print $langs->trans("AddIn").' '; + print $html->select_nombre_sous_categorie($nbcats,"choix").' '; + print $langs->trans("categories"); + print ''; + print ''; + print '
'; + print ''; + print '
'; + print '
'; + + if ($_error == 3) + { + print '

'.$langs->trans("ImpossibleAddCat").' '.$categorie->label.'

'; + } + else + { + print '

'.$langs->trans("TheCategorie").' '.$categorie->label.' '.$langs->trans("WasAddedSuccessfully").'

'; + if ($_error == 2) + { + print '

'.$langs->trans("TheCategorie").' '.$mere->label.' ('.$res.').

'; + } + } + print '
'; } - print '
'; - } } @@ -181,77 +183,77 @@ if ($user->rights->produit->creer) print ''; /* - - 1 && sizeof (array_unique ($cats_meres)) != sizeof ($cats_meres)) - { // alors il y a des valeurs en double - echo "

".$langs->trans ("ErrSameCatSelected")."

"; - $OK = false; - } + $cat_mere) - { - if ($cat_mere == -1) - { - echo "

".$langs->trans ("ErrForgotCat")." ".($nb+1)."

"; - $OK = false; - } - } - - // si les champs de description sont mal renseignés - if ($_POST["nom"] == '') - { - echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"

"; - $OK = false; - } - else if ($categorie->already_exists($_POST["nom"],$cat_mere)) // on regarde si le nom n'existe pas déjà en tant que catégorie ou sous-catégorie - { - echo "

".$langs->trans ("ErrCatAlreadyExists")."

"; - $OK = false; - } +$cats_meres = isset ($_REQUEST['catsMeres']) ? $_REQUEST['catsMeres'] : array (); - if ($_POST["description"] == '') - { - echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Description")."\"

"; - $OK = false; - } - - // vérification pour savoir si tous les champs sont corrects - if ($OK) - { - $nom = htmlspecialchars(stripslashes($_REQUEST['nom']) ,ENT_QUOTES); - $description = htmlspecialchars(stripslashes($_REQUEST['description']),ENT_QUOTES); - // creation de champs caches pour etre appele dans la classe de traitement - ?> -
-
-

trans ("ValidateFields"); ?> ? - - - +if (sizeof ($cats_meres) > 1 && sizeof (array_unique ($cats_meres)) != sizeof ($cats_meres)) +{ // alors il y a des valeurs en double +echo "

".$langs->trans ("ErrSameCatSelected")."

"; +$OK = false; +} - $cat_mere) - { - echo ""; - } - ?> -

-
- $cat_mere) +{ +if ($cat_mere == -1) +{ +echo "

".$langs->trans ("ErrForgotCat")." ".($nb+1)."

"; +$OK = false; +} +} + +// si les champs de description sont mal renseignés +if ($_POST["nom"] == '') +{ +echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"

"; +$OK = false; +} +else if ($categorie->already_exists($_POST["nom"],$cat_mere)) // on regarde si le nom n'existe pas déjà en tant que catégorie ou sous-catégorie +{ +echo "

".$langs->trans ("ErrCatAlreadyExists")."

"; +$OK = false; +} + +if ($_POST["description"] == '') +{ +echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Description")."\"

"; +$OK = false; +} + +// vérification pour savoir si tous les champs sont corrects +if ($OK) +{ +$nom = htmlspecialchars(stripslashes($_REQUEST['nom']) ,ENT_QUOTES); +$description = htmlspecialchars(stripslashes($_REQUEST['description']),ENT_QUOTES); +// creation de champs caches pour etre appele dans la classe de traitement +?> +
+
+

trans ("ValidateFields"); ?> ? + + + + + $cat_mere) +{ +echo ""; +} +?> +

+
+close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index b5c051cb1ca..2df8463b82a 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -18,8 +18,6 @@ require "./pre.inc.php"; -llxHeader ("","",$langs->trans("Categories")); - if ($_REQUEST['id'] == "") { dolibarr_print_error (); @@ -28,11 +26,17 @@ if ($_REQUEST['id'] == "") $c = new Categorie ($db, $_REQUEST['id']); -print_titre ($langs->trans("Categorie")." ".$c->label); -?> - -
-trans("Categories")); + +print_fiche_titre($langs->trans("Categorie")." ".$c->label); + +print ''; +print '
'; $ways = $c->print_all_ways (); print "
"; @@ -46,26 +50,31 @@ $cats = $c->get_filles (); if ($cats < 0) { - dolibarr_print_error(); -} -else if (sizeof ($cats) > 0) -{ - print "\n"; - print "\n"; - - foreach ($cats as $cat) - { - $i++; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - } - print "
".$langs->trans("SubCats")."
".$cat->label."".$cat->description."
\n
\n"; + dolibarr_print_error(); } else { - print "

".$langs->trans("NoSubCat")."

"; + print "
"; + print "\n"; + print "\n"; + if (sizeof ($cats) > 0) + { + $var=true; + foreach ($cats as $cat) + { + $i++; + $var=!$var; + print "\t\n"; + print "\t\t\n"; + print "\t\t\n"; + print "\t\n"; + } + } + else + { + print ""; + } + print "
".$langs->trans("SubCats")."
".$cat->label."".$cat->description."
".$langs->trans("NoSubCat")."
\n"; } $i = 0; @@ -76,33 +85,44 @@ if ($prods < 0) { dolibarr_print_error(); } -else if (sizeof ($prods) > 0) -{ - print "\n"; - print "\n"; - - foreach ($prods as $prod) - { - $i++; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - } - print "
".$langs->trans("Products")."
".$prod->libelle."".$prod->description."
\n"; -} else { - print "

".$langs->trans ("NoProd")."

"; + print "
"; + print "\n"; + print "\n"; + + if (sizeof ($prods) > 0) + { + $var=true; + foreach ($prods as $prod) + { + $i++; + $var=!$var; + print "\t\n"; + print "\t\t\n"; + print "\t\t\n"; + print "\t\n"; + } + } + else + { + print ""; + } + print "
".$langs->trans("ProductsAndServices")."
".$prod->libelle."".$prod->description."
".$langs->trans ("NoProd")."
\n"; } +/* + * Boutons actions + */ print "
\n"; -print "Éditer"; -print "Supprimer"; +print "".$langs->trans("Edit").""; +print "".$langs->trans("Delete").""; print "
"; + + print '
'; $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index efd6b122df8..33f47b28c16 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -32,4 +32,5 @@ AddProductToCat=Add this product to a category? ImpossibleAddCat=Impossible to add the category ImpossibleAssociateCategory=Impossible to associate the category to WasAddedSuccessfully=was added successfully. -ProductIsInCategories=Product/Service is in following categories \ No newline at end of file +ProductIsInCategories=Product/Service is in following categories +ClassifyInCategory=Classify in category \ No newline at end of file diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index f9f654e626b..fba0b4ed409 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -33,3 +33,4 @@ ImpossibleAddCat=Impossible d'ajouter la cat ImpossibleAssociateCategory=Impossible d'associer la catégorie à WasAddedSuccessfully=a été ajoutée avec succès. ProductIsInCategories=Ce produit/service est dans les catégorie suivantes +ClassifyInCategory=Classer dans la catégorie