From 00a658143d5f159a937749b2065e2b7248068383 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 23 Apr 2016 16:51:22 +0200
Subject: [PATCH] NEW List of user in agenda view per user show photo thumb

---
 htdocs/comm/action/card.php        | 10 +++++-----
 htdocs/comm/action/index.php       |  3 ++-
 htdocs/comm/action/listactions.php | 20 +++++++++++++-------
 htdocs/comm/action/peruser.php     |  6 ++++--
 htdocs/core/lib/agenda.lib.php     | 23 +++++++++++++----------
 htdocs/core/tpl/contacts.tpl.php   | 12 ++++++++----
 htdocs/theme/eldy/style.css.php    |  3 ++-
 htdocs/theme/md/style.css.php      |  3 ++-
 8 files changed, 49 insertions(+), 31 deletions(-)

diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 4ca75ade9b9..9734602c41d 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -937,7 +937,7 @@ if ($id > 0)
 		print '<table class="border" width="100%">';
 
 		// Ref
-		print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
 
 		// Type of event
 		if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@@ -951,7 +951,7 @@ if ($id > 0)
 		print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
 
         // Full day event
-        print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
+        print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
 
 		// Date start
 		print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
@@ -1090,7 +1090,7 @@ if ($id > 0)
 		// Thirdparty - Contact
 		if ($conf->societe->enabled)
 		{
-			print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
+			print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
 			print '<td>';
 			print '<div class="maxwidth200onsmartphone">';
 			$events=array();
@@ -1115,7 +1115,7 @@ if ($id > 0)
 
 			$langs->load("projects");
 
-			print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
+			print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td colspan="3">';
 			$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
 			if ($numprojet==0)
 			{
@@ -1125,7 +1125,7 @@ if ($id > 0)
 		}
 
 		// Priority
-		print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
+		print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
 		print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
 		print '</td></tr>';
 
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index c894647bb29..29191fce68a 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -360,6 +360,7 @@ $showextcals=$listofextcals;
 
 if (! empty($conf->use_javascript_ajax))	// If javascript on
 {
+    $s.='<!-- Div to calendars selectors -->'."\n";
 	$s.='<script type="text/javascript">' . "\n";
 	$s.='jQuery(document).ready(function () {' . "\n";
 	$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
@@ -373,7 +374,7 @@ if (! empty($conf->use_javascript_ajax))	// If javascript on
 	$s.='</script>' . "\n";
 
 	// Local calendar
-	$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
+	$s.='<div class="nowrap clear float minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
 
 	// External calendars
 	if (is_array($showextcals) && count($showextcals) > 0)
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index ed8227a1cb8..cfb3bc92333 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -306,10 +306,11 @@ if ($resql)
 	if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
+	print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
+	print_liste_field_titre("");
 	print "</tr>\n";
 
 	print '<tr class="liste_titre">';
@@ -329,9 +330,12 @@ if ($resql)
 	print '<td class="liste_titre"></td>';
 	//print '<td class="liste_titre"></td>';
 	print '<td class="liste_titre"></td>';
-	print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
-	print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
-    print '</td>';
+    print '<td></td>';
+	// Action column
+	print '<td class="liste_titre" align="middle">';
+	$searchpitco=$form->showFilterAndCheckAddButtons(0);
+	print $searchpitco;
+	print '</td>';
 	print "</tr>\n";
 
 	$contactstatic = new Contact($db);
@@ -371,7 +375,7 @@ if ($resql)
 		{
 		    $labeltype=$obj->type_code;
 		    if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype];
-		    print '<td>'.dol_trunc($labeltype,24).'</td>';   
+		    print '<td>'.dol_trunc($labeltype,28).'</td>';   
 		}
 		
 		// Start date
@@ -397,7 +401,7 @@ if ($resql)
 			$societestatic->id=$obj->socid;
 			$societestatic->client=$obj->client;
 			$societestatic->name=$obj->societe;
-			print $societestatic->getNomUrl(1,'',10);
+			print $societestatic->getNomUrl(1,'',28);
 		}
 		else print '&nbsp;';
 		print '</td>';
@@ -409,7 +413,7 @@ if ($resql)
 			$contactstatic->lastname=$obj->lastname;
 			$contactstatic->firstname=$obj->firstname;
 			$contactstatic->id=$obj->fk_contact;
-			print $contactstatic->getNomUrl(1,'',10);
+			print $contactstatic->getNomUrl(1,'',28);
 		}
 		else
 		{
@@ -430,6 +434,8 @@ if ($resql)
 		// Status/Percent
 		print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
 
+		print '<td></td>';
+		
 		print "</tr>\n";
 		$i++;
 	}
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index fa24935316e..033c67839f0 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -420,7 +420,7 @@ if ($filtert > 0 || $usergroup > 0)
 $sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
 //print $sql;
 
-dol_syslog("comm/action/index.php", LOG_DEBUG);
+dol_syslog("comm/action/peruser.php", LOG_DEBUG);
 $resql=$db->query($sql);
 if ($resql)
 {
@@ -703,7 +703,9 @@ foreach ($usernames as $username)
 {
 	$var = ! $var;
 	echo "<tr>";
-	echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">' . $username->getNomUrl(1). '</td>';
+	echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
+	print $username->getNomUrl(-1,'',0,0,24,1,'');
+	print '</td>';
 	$tmpday = $sav;
 
 	// Lopp on each day of week
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index bfd9314f945..919a72c5ec5 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -65,7 +65,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 	print '<div class="fichecenter">';
 
 	if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
-	else print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap borderright">';
+	else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
 
 	print '<table class="nobordernopadding">';
 
@@ -74,7 +74,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 		print '<tr>';
 		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
 		print $langs->trans("ActionsToDoBy").' &nbsp; ';
-		print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
+		print '</td><td class="maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
 		print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
 		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
 		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
@@ -95,14 +95,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 		}
         print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, $multiselect);
 		print '</td></tr>';
-
-		// Status
-		print '<tr>';
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
-		print $langs->trans("Status");
-		print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
-		$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
-		print '</td></tr>';
 	}
 
 	if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
@@ -128,6 +120,17 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 		print '</td></tr>';
 	}
 
+	if ($canedit)
+	{
+		// Status
+		print '<tr>';
+		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
+		print $langs->trans("Status");
+		print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
+		$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
+		print '</td></tr>';
+	}
+
 	if ($canedit && $action == 'show_peruser')
 	{
 		// Filter on hours
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index 88169314211..b3eaeeec503 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -54,7 +54,9 @@ $userstatic=new User($db);
 <!-- BEGIN PHP TEMPLATE CONTACTS -->
 <div class="tagtable centpercent noborder allwidth">
 
-<?php if ($permission) { ?>
+<?php 
+if ($permission) { 
+?>
 	<form class="tagtr liste_titre">
 		<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
 		<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
@@ -132,10 +134,12 @@ $userstatic=new User($db);
 		</div>
 	</form>
 
-<?php }
-	} ?>
+<?php 
+	}
+} 
+?>
 
-	<form class="tagtr liste_titre">
+	<form class="tagtr liste_titre formnoborder">
 		<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
 		<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
 		<div class="tagtd"><?php echo $langs->trans("Users").'/'.$langs->trans("Contacts"); ?></div>
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 21e8fcd8cac..ca27d42c995 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -582,6 +582,7 @@ div.myavailability {
 .maxwidth400 { max-width: 400px; }
 .maxwidth500 { max-width: 500px; }
 .minheight20 { min-height: 20px; }
+.minheight40 { min-height: 40px; }
 .titlefield { width: 25%; }
 .titlefieldcreate { width: 20%; }
 
@@ -2204,7 +2205,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
 	-webkit-border-radius: 0.2em;
 	border-radius: 0.2em;*/
 }
-#tablelines tr.liste_titre td, tr.liste_titre.trnoborder td {
+#tablelines tr.liste_titre td, form.formnoborder div, tr.liste_titre.trnoborder td {
     border-top-width: 1px;
     border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
     border-top-style: solid;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 63b42726382..5cb3995c6ba 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -580,6 +580,7 @@ div.myavailability {
 .maxwidth400 { max-width: 400px; }
 .maxwidth500 { max-width: 500px; }
 .minheight20 { min-height: 20px; }
+.minheight40 { min-height: 40px; }
 .titlefield { width: 30%; }
 .titlefieldcreate { width: 20%; }
 
@@ -2074,7 +2075,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
 	-webkit-border-radius: 0.1em;
 	border-radius: 0.1em;
 }
-#tablelines tr.liste_titre td, tr.liste_titre.trnoborder td {
+#tablelines tr.liste_titre td, form.formnoborder, tr.liste_titre.trnoborder td {
     border-top-width: 1px;
     border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
     border-top-style: solid;
-- 
GitLab