diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 044ded65d82..cfe6c3c210d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -84,13 +84,19 @@ $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GET if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month -if (GETPOST('viewweek')) { +if (GETPOST('viewweek') || $action == 'show_week') { $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); } // View by week -if (GETPOST('viewday')) { +if (GETPOST('viewday') || $action == 'show_day') { $action='show_day'; $day=($day?$day:date("d")); } // View by day +if (empty($action)) +{ + if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_month'; + else $action=$conf->global->AGENDA_DEFAULT_VIEW; +} + $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); @@ -134,6 +140,10 @@ $companystatic=new Societe($db); $contactstatic=new Contact($db); $now=dol_now(); +$nowarray=dol_getdate($now); +$nowyear=$nowarray['year']; +$nowmonth=$nowarray['mon']; +$nowday=$nowarray['mday']; // Define list of all external calendars $listofextcals=array(); @@ -226,7 +236,6 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -$region=''; if ($status) $param="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtera) $param.="&filtera=".$filtera; @@ -243,26 +252,29 @@ $param.="&maxprint=".$maxprint; // Show navigation bar if (empty($action) || $action=='show_month') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.=" (".$langs->trans("Today").")"; $picto='calendar'; } if ($action=='show_week') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.=" (".$langs->trans("Today").")"; $picto='calendarweek'; } if ($action=='show_day') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.=" (".$langs->trans("Today").")"; $picto='calendarday'; } @@ -273,9 +285,17 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); -$head = calendars_prepare_head(''); +$tabactive=''; +if ($action == 'show_month') $tabactive='cardmonth'; +if ($action == 'show_week') $tabactive='cardweek'; +if ($action == 'show_day') $tabactive='cardday'; +if ($action == 'show_list') $tabactive='cardlist'; -dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto); +$paramnoaction=preg_replace('/action=[a-z_]+/','',$param); + +$head = calendars_prepare_head($paramnoaction); + +dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode); dol_fiche_end(); @@ -919,7 +939,7 @@ else // View by day $newparam=preg_replace('/viewday=[0-9]+&?/i','',$newparam); $newparam.='&viewday=1'; // Code to show just one day - $style='cal_current_month'; + $style='cal_current_month cal_current_month_oneday'; $today=0; $todayarray=dol_getdate($now,'fast'); if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index da9534a0f07..18aab7bdc1a 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -43,6 +43,12 @@ $pid=GETPOST("projectid",'int',3); $status=GETPOST("status",'alpha'); $type=GETPOST('type'); +if (empty($action)) +{ + if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_list'; + else $action=$conf->global->AGENDA_DEFAULT_VIEW; +} + $filter=GETPOST("filter",'',3); $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); @@ -195,9 +201,15 @@ if ($resql) } - $head = calendars_prepare_head(''); + $tabactive=''; + if ($action == 'show_month') $tabactive='cardmonth'; + if ($action == 'show_week') $tabactive='cardweek'; + if ($action == 'show_day') $tabactive='cardday'; + if ($action == 'show_list') $tabactive='cardlist'; - dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list'); + $head = calendars_prepare_head(''); + + dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1); dol_fiche_end(); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index bdb068d71b5..7df4543b12d 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -54,6 +54,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print ''; print ''; + print ''; print ''; print '
| '; print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); - print ' | '; - print ''; - - print '|
| '; - print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy"); - print ' | '; + print ' '.$langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy"); + print ' '; print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print ' | '; + /*print ' | ';
print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' ';
print ' '; print img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone"') . ' '; @@ -128,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone"') . ' '; print ' '; print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' '; - print ' | ';
+ print '';*/
// Legend
if ($conf->use_javascript_ajax && is_array($showextcals))
@@ -171,6 +167,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '';
+ print '