Fix drag and drop in agenda view
This commit is contained in:
parent
3ebaaa38d2
commit
8fb6ade27a
@ -339,7 +339,7 @@ dol_fiche_end();
|
|||||||
|
|
||||||
$showextcals=$listofextcals;
|
$showextcals=$listofextcals;
|
||||||
// Legend
|
// Legend
|
||||||
if ($conf->use_javascript_ajax)
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
$s='';
|
$s='';
|
||||||
$s.='<script type="text/javascript">' . "\n";
|
$s.='<script type="text/javascript">' . "\n";
|
||||||
@ -349,29 +349,27 @@ if ($conf->use_javascript_ajax)
|
|||||||
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
||||||
if ($action=="show_week" || $action=="show_month" || empty($action))
|
if ($action=="show_week" || $action=="show_month" || empty($action))
|
||||||
{
|
{
|
||||||
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
|
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {';
|
||||||
$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
|
$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
|
||||||
}
|
}
|
||||||
$s.='});' . "\n";
|
$s.='});' . "\n";
|
||||||
$s.='</script>' . "\n";
|
$s.='</script>' . "\n";
|
||||||
if (! empty($conf->use_javascript_ajax))
|
|
||||||
|
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
||||||
|
if (is_array($showextcals) && count($showextcals) > 0)
|
||||||
{
|
{
|
||||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
foreach ($showextcals as $val)
|
||||||
if (is_array($showextcals) && count($showextcals) > 0)
|
|
||||||
{
|
{
|
||||||
foreach ($showextcals as $val)
|
$htmlname = dol_string_nospecial($val['name']);
|
||||||
{
|
$s.='<script type="text/javascript">' . "\n";
|
||||||
$htmlname = dol_string_nospecial($val['name']);
|
$s.='jQuery(document).ready(function () {' . "\n";
|
||||||
$s.='<script type="text/javascript">' . "\n";
|
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||||
$s.='jQuery(document).ready(function () {' . "\n";
|
$s.=' /* alert("'.$htmlname.'"); */';
|
||||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||||
$s.=' /* alert("'.$htmlname.'"); */';
|
$s.=' });' . "\n";
|
||||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
$s.='});' . "\n";
|
||||||
$s.=' });' . "\n";
|
$s.='</script>' . "\n";
|
||||||
$s.='});' . "\n";
|
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||||
$s.='</script>' . "\n";
|
|
||||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||||
@ -1092,11 +1090,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
global $theme_datacolor;
|
global $theme_datacolor;
|
||||||
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
||||||
|
|
||||||
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
print "\n".'<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">';
|
||||||
|
|
||||||
// Line with title of day
|
// Line with title of day
|
||||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="nobordernopadding" width="100%">'."\n";
|
||||||
|
|
||||||
print '<tr><td align="left" class="nowrap">';
|
print '<tr><td align="left" class="nowrap">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
|
||||||
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
||||||
@ -1116,7 +1115,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
print img_picto($langs->trans("NewAction"),'edit_add.png');
|
print img_picto($langs->trans("NewAction"),'edit_add.png');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// Line with td contains all div of each events
|
// Line with td contains all div of each events
|
||||||
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
|
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
|
||||||
@ -1171,11 +1170,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||||
}
|
}
|
||||||
$color=$event->icalcolor;
|
$color=$event->icalcolor;
|
||||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
|
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable');
|
||||||
}
|
}
|
||||||
else if ($event->type_code == 'BIRTHDAY')
|
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]);
|
$numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1213,32 +1212,35 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||||
|
|
||||||
// Defined style to disable drag and drop feature
|
// Defined style to disable drag and drop feature
|
||||||
if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
|
if ($event->type_code =='AC_OTH_AUTO')
|
||||||
|
{
|
||||||
|
$cssclass.= " unmovable";
|
||||||
|
}
|
||||||
|
else if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
|
||||||
{
|
{
|
||||||
$tmpyearend = date('Y',$event->date_end_in_calendar);
|
$tmpyearend = date('Y',$event->date_end_in_calendar);
|
||||||
$tmpmonthend = date('m',$event->date_end_in_calendar);
|
$tmpmonthend = date('m',$event->date_end_in_calendar);
|
||||||
$tmpdayend = date('d',$event->date_end_in_calendar);
|
$tmpdayend = date('d',$event->date_end_in_calendar);
|
||||||
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
|
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
|
||||||
{
|
{
|
||||||
$cssclass.= " unsortable";
|
$cssclass.= " unmovable";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($event->type_code =='AC_OTH_AUTO')
|
else $cssclass.= " movable";
|
||||||
{
|
|
||||||
$cssclass.= " unsortable";
|
|
||||||
}
|
|
||||||
|
|
||||||
$h=''; $nowrapontd=1;
|
$h=''; $nowrapontd=1;
|
||||||
if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }
|
if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }
|
||||||
if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
|
if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
|
||||||
|
|
||||||
// Show rect of event
|
// Show rect of event
|
||||||
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
|
print "\n";
|
||||||
|
print '<!-- start event '.$i.' --><div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
|
||||||
//print ' style="height: 100px;';
|
//print ' style="height: 100px;';
|
||||||
//print ' position: absolute; top: 40px; width: 50%;';
|
//print ' position: absolute; top: 40px; width: 50%;';
|
||||||
//print '"';
|
//print '"';
|
||||||
print '>';
|
print '>';
|
||||||
print '<ul class="cal_event" style="'.$h.'"><li class="cal_event" style="'.$h.'">';
|
print '<ul class="cal_event" style="'.$h.'">'; // always 1 li per ul, 1 ul per event
|
||||||
|
print '<li class="cal_event" style="'.$h.'">';
|
||||||
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
|
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
|
||||||
print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
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).'));';
|
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||||
@ -1369,8 +1371,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
|
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</li></ul>';
|
print '</li>';
|
||||||
print '</div>';
|
print '</ul>';
|
||||||
|
print '</div><!-- end event '.$i.' -->'."\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1413,8 +1416,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
|
||||||
print '</div>'."\n";
|
print '</table></div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -424,6 +424,9 @@ th .button {
|
|||||||
background-color: #777;
|
background-color: #777;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
.movable {
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
|
||||||
.borderrightlight
|
.borderrightlight
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user