Salut,

Les catégories c'est super, on en avait vraiment besoin ;)

Cependant cela semble perturber les utilisateurs.

Le petit correctif proposé permet de retrouver l'affichage habituel des
logiciels tant que les catégories ne sont pas utilisées (rendant, en
quelque sorte, ce comportement optionnel).

=> nom de la catégorie affiché uniquement s'il y a des catégories.

=> logiciels "sans catégorie" affichés par défaut s'il n'y a pas de
catégorie (surtout que dans ce cas il n'y a plus l'entête).

Après cela pourra être amélioré par des préférences (visiblement on ne
partage pas tous la même vision / objectif pour leur utilisation).

A+
--- inc/software.function.php.orig	2007-07-26 08:26:52.000000000 +0200
+++ inc/software.function.php	2007-07-26 08:42:12.000000000 +0200
@@ -683,7 +683,7 @@
 			displaySoftsByCategory($data,$instID,$withtemplate);
 		}
 	
-		echo "</table></div></td></tr>";
+		echo "</table></div></td></tr>\n";
 			
 		$q="SELECT count(*) FROM glpi_software WHERE deleted='0' AND is_template='0'";
 		$result = $DB->query($q);
@@ -711,36 +711,39 @@
 }
 
 
-function displayCategoryHeader($data,$cat)
+function displayCategoryHeader($data,$prevcat)
 {
 	global $LANG,$CFG_GLPI;
 	$expirecss='';
 	
 	// Close old one
-	if ($cat != -1){
-		echo "</table></div></td></tr>";
+	if ($prevcat != -1){
+		echo "</table></div></td></tr>\n";
 	}
-						
+
 	$cat = $data["category_id"];
 	$catname=$data["category"];
 	if (!$cat){
 		$catname=$LANG["rulesoftwarecategories"][4];
 	} 
 
+	if ($prevcat>0 || $cat>0) { // Category header only if categories used
 	echo "	<tr class='tab_bg_2$expirecss'>";
 	echo "  	<td align='center' colspan='5'>"; 
 	echo "			<a  href=\"javascript:showHideDiv('softcat$cat','imgcat$cat','".GLPI_ROOT."/pics/folder.png','".GLPI_ROOT."/pics/folder-open.png');\">";
 	echo "				<img alt='' name='imgcat$cat' src=\"".GLPI_ROOT."/pics/folder".(!$cat?'':"-open").".png\">&nbsp;<strong>".$catname."</strong>";
 	echo "			</a>"; 
 	echo "		</td>"; 
-	echo "	</tr>"; 
+	echo "	</tr>\n"; 
+	}
 	echo "<tr class='tab_bg_2$expirecss'>";
 	echo "		<td colspan='5'>
-			     <div align='center' id='softcat$cat' ".(!$cat?"style=\"display:none;\"":'').">"; 
+			     <div align='center' id='softcat$cat' ".($prevcat>0 && !$cat?"style=\"display:none;\"":'').">"; 
 	echo"			<table class='tab_cadre_fixe'>";
 	echo "				<tr>"; 
 	echo "					<th>".$LANG["common"][16]."</th><th>".$LANG["software"][32]."</th><th>".$LANG["software"][28]."</th><th>".$LANG["software"][35]."</th><th>&nbsp;</th>"; 
-	echo"				</tr>";
+	echo"				</tr>\n";
+
 	return $cat;
 }
 
@@ -804,7 +807,7 @@
 		echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/software.licenses.php?uninstall=uninstall&amp;ID=$ID&amp;cID=$instID\">";
 		echo "<strong>".$LANG["buttons"][5]."</strong></a>";
 	}
-	echo "</td></tr>";
+	echo "</td></tr>\n";
 }
 
 
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to