From e5a06635dc56a5f848861e04f8a2d859fc6655f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Jun 2014 20:50:46 +0200 Subject: [PATCH] Fix css for agenda box Make different view of agenda into different tabs. --- htdocs/comm/action/index.php | 44 ++++++++++++++++++++++-------- htdocs/comm/action/listactions.php | 16 +++++++++-- htdocs/core/lib/agenda.lib.php | 39 ++++++++++++++++++-------- htdocs/theme/eldy/style.css.php | 1 + 4 files changed, 74 insertions(+), 26 deletions(-) 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 ''; @@ -68,13 +69,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print $langs->trans("ActionsAskedBy"); print '  '; - print ''; - - print ''; - print ''; @@ -120,7 +116,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; // Buttons - 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 ''; print '
'; print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); - 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 ''; } @@ -465,11 +462,29 @@ function calendars_prepare_head($param) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php'.($param?'?'.$param:''); - $head[$h][1] = $langs->trans("Agenda"); - $head[$h][2] = 'card'; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewCal"); + $head[$h][2] = 'cardmonth'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewWeek"); + $head[$h][2] = 'cardweek'; + $h++; + + //$paramday=$param; + //if (preg_match('/&month=\d+/',$paramday) && ! preg_match('/&day=\d+/',$paramday)) $paramday.='&day=1'; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewDay"); + $head[$h][2] = 'cardday'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:''); + $head[$h][1] = $langs->trans("ViewList"); + $head[$h][2] = 'cardlist'; + $h++; + + $object=new stdClass(); // Show more tabs from modules diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 63b789a4597..84c449f8e90 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2243,6 +2243,7 @@ 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_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_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; }