Fix css for agenda box

Make different view of agenda into different tabs.
This commit is contained in:
Laurent Destailleur 2014-06-27 20:50:46 +02:00
parent 96da5bf0e0
commit e5a06635dc
4 changed files with 74 additions and 26 deletions

View File

@ -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 ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y");
$nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)";
$picto='calendar';
}
if ($action=='show_week')
{
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
$nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$picto='calendarweek';
}
if ($action=='show_day')
{
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
$nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$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;

View File

@ -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();

View File

@ -54,6 +54,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<input type="hidden" name="year" value="' . $year . '">';
print '<input type="hidden" name="month" value="' . $month . '">';
print '<input type="hidden" name="day" value="' . $day . '">';
print '<input type="hidden" name="action" value="' . $action . '">';
print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
print '<table class="nobordernopadding" width="100%">';
@ -68,13 +69,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print $langs->trans("ActionsAskedBy");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
print '</td>';
print '</tr>';
print '<tr>';
print '<td class="nowrap">';
print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print ' &nbsp; '.$langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
print ' &nbsp;';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
print '</td></tr>';
@ -120,7 +116,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '</td>';
// Buttons
print '<td align="center" valign="middle" class="nowrap">';
/*print '<td align="center" valign="middle" class="nowrap">';
print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewcal" value="' . $langs->trans("ViewCal") . '">';
print '<br>';
print img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewweek" value="' . $langs->trans("ViewWeek") . '">';
@ -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"') . ' <input type="submit" class="button" style="min-width:120px" name="viewday" value="' . $langs->trans("ViewDay") . '">';
print '<br>';
print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewlist" value="' . $langs->trans("ViewList") . '">';
print '</td>';
print '</td>';*/
// 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 '</tr>';
print '<tr><td><input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '"></td></tr>';
print '</table>';
print '</form>';
}
@ -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

View File

@ -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; }