Prepare calendars to be able to show calendars with selection on several

users.
This commit is contained in:
Laurent Destailleur 2014-06-28 18:04:32 +02:00
parent 2c493a4fe3
commit a8e4391887
6 changed files with 64 additions and 36 deletions

View File

@ -532,7 +532,7 @@ if ($action == 'create')
// Busy
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Busy").'</td><td>';
print '<input id="transparency" type="checkbox" name="transparency"'.($actioncomm->transparency?' checked="checked"':'').'>';
print '<input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked="checked"':'').'>';
print '</td></tr>';
// Realised by

View File

@ -296,7 +296,7 @@ $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);
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode,1);
dol_fiche_end();
$link='';
@ -327,7 +327,7 @@ $sql.= ' a.datea,';
$sql.= ' a.datea2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
$sql.= ' a.priority, a.fulldayevent, a.location,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code';
$sql.= ' FROM ('.MAIN_DB_PREFIX.'c_actioncomm as ca,';
@ -409,6 +409,7 @@ if ($resql)
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
$event->societe->id=$obj->fk_soc;
$event->contact->id=$obj->fk_contact;
@ -1033,7 +1034,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$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);
$nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ...
//print $nextindextouse;
foreach ($eventarray as $daykey => $notused)
@ -1074,7 +1075,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$color=$event->icalcolor;
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other');
}
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; }
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; $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.
{
@ -1086,21 +1087,25 @@ 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.'<br>';
// 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 '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'">';
print '<ul class="cal_event"><li class="cal_event">';
print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).')); " width="100%"><tr>';
print '<td class="nowrap cal_event">';
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="';
print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
print ' -moz-border-radius:4px;" width="100%"><tr>';
print '<td class="nowrap cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
if ($event->type_code == 'BIRTHDAY') // It's a birthday
{
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');

View File

@ -210,7 +210,7 @@ if ($resql)
$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);
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1,'',0);
dol_fiche_end();
// Add link to show birthdays

View File

@ -41,9 +41,10 @@
* @param int $socid Third party id
* @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
* @param string $actioncode Preselected value of actioncode for filter on type
* @param int $showbirthday Show check to toggle birthday events
* @return void
*/
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals=array(), $actioncode='')
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals=array(), $actioncode='', $showbirthday=0)
{
global $conf, $user, $langs, $db;
@ -56,9 +57,13 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
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%">';
print '<tr><td class="nowrap">';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
//print '<table class="nobordernopadding" width="100%">';
//print '<tr><td class="nowrap">';
print '<table class="nobordernopadding">';
@ -66,12 +71,15 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{
print '<tr>';
print '<td class="nowrap">';
print $langs->trans("ActionsAskedBy");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
print ' &nbsp; '.$langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
print ' &nbsp;';
//print $langs->trans("ActionsAskedBy");
//print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
//print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
//print ' &nbsp; '.$langs->trans("or") . ' ';
print $langs->trans("ActionsForUser").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">';
//print ' &nbsp;';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
print ajax_combobox('usertodo');
print '</td></tr>';
/*print '<tr>';
@ -113,7 +121,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
}
print '</table>';
print '</td>';
//print '</td>';
print '</div>';
// Buttons
/*print '<td align="center" valign="middle" class="nowrap">';
@ -126,10 +137,22 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
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 align="center" valign="middle" class="nowrap">';
print '<div class="fichehalfright" valign="middle">';
print '<table><tr><td align="center">';
print '<div class="formleftzone">';
print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
print '</div>';
print '</td></tr>';
// Legend
if ($conf->use_javascript_ajax && is_array($showextcals))
if ($conf->use_javascript_ajax)
{
print '<td align="center" valign="middle" class="nowrap">';
print '<tr><td>';
//print $langs->trans("Calendars").': ';
//print '<td align="center" valign="middle" class="nowrap">';
print '<script type="text/javascript">' . "\n";
print 'jQuery(document).ready(function () {' . "\n";
print 'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
@ -137,16 +160,14 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print 'jQuery(".family_birthday").toggle();' . "\n";
print '});' . "\n";
print '</script>' . "\n";
print '<table>';
if (! empty($conf->use_javascript_ajax))
{
if (count($showextcals) > 0)
if (is_array($showextcals) && count($showextcals) > 0)
{
print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>';
print '<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
foreach ($showextcals as $val)
{
$htmlname = dol_string_nospecial($val['name']);
print '<tr><td>';
print '<script type="text/javascript">' . "\n";
print 'jQuery(document).ready(function () {' . "\n";
print ' jQuery("#check_' . $htmlname . '").click(function() {';
@ -155,20 +176,21 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print ' });' . "\n";
print '});' . "\n";
print '</script>' . "\n";
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
print '</td></tr>';
print '<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' &nbsp; </div>';
}
}
}
print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
print '</table>';
print '</td>';
if ($showbirthday) print '<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
print '</td></tr>';
}
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 '</div>';
print '</div>';
print '<div style="clear:both"></div>';
print '</form>';
}

View File

@ -25,6 +25,7 @@ ListOfEvents= List of Dolibarr events
ActionsAskedBy=Events reported by
ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by
ActionsAskedBy=Events for user
AllMyActions= All my events/tasks
AllActions= All events/tasks
ViewList=List view

View File

@ -2265,7 +2265,7 @@ li.cal_event { border: none; list-style-type: none; }
.cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); }
.cal_event_busy { }
/* ============================================================================== */
/* Ajax - Liste deroulante de l'autocompletion */