From dc0af179e94a7717cfdaf08e517e8c34cd38efe4 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 18 Dec 2015 01:41:30 +0100 Subject: [PATCH 1/2] add icalname on default event allow to manipulate it (show/hide) when we add some other calendar on main (eg fichinter calendar) --- htdocs/comm/action/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2324b6ee799..a8f1c6f5939 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1230,7 +1230,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - $numother++; $cssclass='family_other'; + $numother++; + $color=$event->icalcolor; + $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); + if (empty($cacheusers[$event->userownerid])) { From efb1e91a2368e8bb7719e83fed9e5fd233c909a4 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 19 Dec 2015 10:29:56 +0100 Subject: [PATCH 2/2] Update index.php i have add an icalcolor test for icalevent too and made some reindentation --- htdocs/comm/action/index.php | 63 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a8f1c6f5939..f13e48a56e4 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1171,14 +1171,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Line with td contains all div of each events print ''; - print '
'; + print '
'; //$curtime = dol_mktime (0, 0, 0, $month, $day, $year); $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... - //print $nextindextouse; + //print $nextindextouse; foreach ($eventarray as $daykey => $notused) { @@ -1191,23 +1191,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) { - $keysofuserassigned=array_keys($event->userassigned); + $keysofuserassigned=array_keys($event->userassigned); - $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); // Define $color (Hex string like '0088FF') and $cssclass of event $color=-1; $colorindex=-1; - if (in_array($user->id, $keysofuserassigned)) - { - $nummytasks++; $cssclass='family_mytasks'; + if (in_array($user->id, $keysofuserassigned)) + { + $nummytasks++; $cssclass='family_mytasks'; - if (empty($cacheusers[$event->userownerid])) - { - $newuser=new User($db); - $newuser->fetch($event->userownerid); - $cacheusers[$event->userownerid]=$newuser; - } - //var_dump($cacheusers[$event->userownerid]->color); + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; @@ -1221,7 +1221,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } $numicals[dol_string_nospecial($event->icalname)]++; } - $color=$event->icalcolor; + $color=($event->icalcolor?$event->icalcolor:-1); $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); } else if ($event->type_code == 'BIRTHDAY') @@ -1229,23 +1229,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } else - { - $numother++; - $color=$event->icalcolor; - $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); - + { + $numother++; + $color=($event->icalcolor?$event->icalcolor:-1); + $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); - if (empty($cacheusers[$event->userownerid])) - { - $newuser=new User($db); - $newuser->fetch($event->userownerid); - $cacheusers[$event->userownerid]=$newuser; - } - //var_dump($cacheusers[$event->userownerid]->color); + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; - } + } if ($color == -1) // Color was not forced. Set color according to color index. { // Define color index if not yet defined @@ -1256,14 +1255,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - $colorindex=$nextindextouse; - $colorindexused[$idusertouse]=$colorindex; + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color } //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
'; - // Define color + // Define color $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); - } + } $cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; // Defined style to disable drag and drop feature