diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2fff1a681dc..29ad7182e5b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -343,10 +343,6 @@ $showextcals=$listofextcals; if ($conf->use_javascript_ajax) { $s=''; - //print ''; - - //print $langs->trans("Calendars").': '; - //print ''; $s.=' -'; -*/ - llxFooter(); $db->close(); -/** - * Change color with a delta - * - * @param string $color Color - * @param int $minus Delta - * @return string New color - */ -function dol_color_minus($color, $minus) -{ - $newcolor=$color; - $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); - $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); - $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); - return $newcolor; -} - - - - - -/** - * - * @param unknown_type $h - * @param unknown_type $cases - */ -function mafonction($h, &$cases) -{ - if (isset($cases[$h])) - if ($cases[$h] != '') - { - $title = (int) $cases[$h]; - $title .= 'h'; - if ((int) $cases[$h] != $cases[$h]) - $title .= '30'; - else - $title .= '00'; - print "$title"; - } - else - { - print ""; - } - else - print ""; -} /** @@ -791,166 +665,157 @@ function mafonction($h, &$cases) */ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false) { - global $db; - global $user, $conf, $langs; - global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form - global $theme_datacolor; - global $cachethirdparties, $cachecontacts, $colorindexused; - global $begin_h, $end_h; + global $db; + global $user, $conf, $langs; + global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $theme_datacolor; + global $cachethirdparties, $cachecontacts, $colorindexused; + global $begin_h, $end_h; - $cases = array(); + $cases1 = array(); // Color first half hour + $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year); + $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); + $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, ... + $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... - foreach ($eventarray as $daykey => $notused) - { - $annee = date('Y',$daykey); - $mois = date('m',$daykey); - $jour = date('d',$daykey); - if ($day==$jour && $month==$mois && $year==$annee) - { - //Tout les events à la même date : - foreach ($eventarray[$daykey] as $index => $event) - { - if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show - - if (1 == 1) - { - $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); - - // Define $color and $cssclass of event - $color=-1; $cssclass=''; $colorindex=-1; - if ((! empty($event->author->id) && $event->author->id == $user->id) - || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) - || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) - { - $nummytasks++; $cssclass='family_mytasks'; - } - else if ($event->type_code == 'ICALEVENT') - { - $numical++; - if (! empty($event->icalname)) { - if (! isset($numicals[dol_string_nospecial($event->icalname)])) { - $numicals[dol_string_nospecial($event->icalname)] = 0; - } - $numicals[dol_string_nospecial($event->icalname)]++; - } - $color=$event->icalcolor; - $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); - } - else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } - else { $numother++; $cssclass='family_other'; } - if ($color == -1) // Color was not forced. Set color according to color index. - { - // Define color index if not yet defined - $idusertouse=($event->usertodo->id?$event->usertodo->id:0); - if (isset($colorindexused[$idusertouse])) - { - $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user - } - else - { - $colorindex=$nextindextouse; - $colorindexused[$idusertouse]=$colorindex; - if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next 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; - - // Show rect of event - //print '
'; - //print ''; - //print ''; - for ($h = $begin_h; $h < ($end_h*2); $h++) - { - $color = ''; //init - if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h/2,0,0,$month,$day,$year); - $b = dol_mktime((int) $h/2,30,0,$month,$day,$year); - //$c = $b+($b-$a); - - if ($h % 2 == 1) { - if ($event->date_start_in_calendar <= $a && $event->date_end_in_calendar > $b) { - $color = $h/2; - } - } else { - if ($event->date_start_in_calendar <= $b - && $event->date_end_in_calendar > $a) { - $color = $h/2; - } - if ($h == 0 && $event->date_start_in_calendar <= $b && $event->date_end_in_calendar > $a) - $cases[0] = "0"; - } - } else { - $color = $h/2; - } - //if ($color != '') - //if(!isset($cases[$h])) - if (!isset($cases[$h]) || $cases[$h] == '') - $cases[$h] = $color; - //echo ""; //DEBUG - } - $i++; - } - else - { - print ''.img_picto("all","1downarrow_selected.png").' ...'; - print ' +'.(count($eventarray[$daykey])-$maxprint); - print ''; - break; - //$ok=false; // To avoid to show twice the link - } - } - - break; - } - } - - for ($h = $begin_h; $h < $end_h; $h++) - { - echo ""; - } + if ($h == $begin_h) echo ''; + } } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 436c0eef48e..80dfbf65e38 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -141,7 +141,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; } - if ($canedit && $action == 'show_week') + if ($canedit && $action == 'show_peruser') { // Filter on hours print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1a0423d2b16..2c8fc342fe3 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2312,15 +2312,22 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_oneday { border-right: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0 !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 2px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } +.cal_peruser { padding: 0px; } +.peruser_busy { background: #FF8888; } table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); @@ -2562,7 +2569,7 @@ A.none, A.none:active, A.none:visited, A.none:hover { /* CKEditor */ /* ============================================================================== */ -.cke_editable +.cke_editable { margin: 5px !important; }
$color"; - - $h2=$h*2; - if (isset($cases[$h2])) + foreach ($eventarray as $daykey => $notused) + { + $annee = date('Y',$daykey); + $mois = date('m',$daykey); + $jour = date('d',$daykey); + if ($day==$jour && $month==$mois && $year==$annee) { - if ($cases[$h2] != '') + //Tout les events à la même date : + foreach ($eventarray[$daykey] as $index => $event) { - $title = (int) $cases[$h2]; + if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show + + $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + + // Define $color and $cssclass of event + $color=-1; $cssclass=''; $colorindex=-1; + if ((! empty($event->author->id) && $event->author->id == $user->id) + || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) + || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) + { + $nummytasks++; $cssclass='family_mytasks'; + } + else if ($event->type_code == 'ICALEVENT') + { + $numical++; + if (! empty($event->icalname)) { + if (! isset($numicals[dol_string_nospecial($event->icalname)])) { + $numicals[dol_string_nospecial($event->icalname)] = 0; + } + $numicals[dol_string_nospecial($event->icalname)]++; + } + $color=$event->icalcolor; + $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); + } + else if ($event->type_code == 'BIRTHDAY') { + $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + else { $numother++; $cssclass='family_other'; + } + if ($color == -1) // Color was not forced. Set color according to color index. + { + // Define color index if not yet defined + $idusertouse=($event->usertodo->id?$event->usertodo->id:0); + if (isset($colorindexused[$idusertouse])) + { + $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user + } + else + { + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; + if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next 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; + + // Show rect of event + for ($h = $begin_h; $h < $end_h; $h++) + { + $color = ''; //init + if (empty($event->fulldayevent)) + { + $a = dol_mktime((int) $h,0,0,$month,$day,$year); + $b = dol_mktime((int) $h,30,0,$month,$day,$year); + $c = dol_mktime((int) $h+1,0,0,$month,$day,$year); + + if ($event->date_start_in_calendar < $b && $event->date_end_in_calendar > $a) + { + $cases1[$h][$event->id]++; + } + if ($event->date_start_in_calendar < $c && $event->date_end_in_calendar > $b) + { + $cases2[$h][$event->id]++; + } + } + else + { + $cases1[$h][$event->id]=1; + $cases2[$h][$event->id]=1; + break; + } + } + $i++; + } + + break; + } + } + + for ($h = $begin_h; $h < $end_h; $h++) + { + $style1='';$style2=''; + $string1=' ';$string2=' '; + if (isset($cases1[$h])) + { + if ($cases1[$h] != '') + { + $title = (int) $cases1[$h]; $title .= 'h'; - if ((int) $cases[$h2] != $cases[$h2]) + if ((int) $cases1[$h] != $cases1[$h]) $title .= '30'; else $title .= '00'; - print "$title"; + $string1=' '; + $style1='peruser_busy'; + $url=''.$title.''; } } - $h2=$h*2+1; - if (isset($cases[$h2])) + if (isset($cases2[$h])) { - if ($cases[$h2] != '') + if ($cases2[$h] != '') { - $title = (int) $cases[$h2]; + $title = (int) $cases2[$h]; $title .= 'h'; - if ((int) $cases[$h2] != $cases[$h2]) $title .= '30'; + if ((int) $cases2[$h] != $cases2[$h]) $title .= '30'; else $title .= '00'; - print "$title"; + $string2=' '; + $style2='peruser_busy'; + $url=''.$title.''; } } -// mafonction($h*2, $cases); -// mafonction($h*2+1,$cases); - print "'; + else echo ''; + print ''; + print ''; + print '
'; + print $string1; + print ''; + print $string2; + print '
'; + print '