calendar performance issues: disable (nearly) all dragdrop function calls if dragdrop is user-disabled or auto-disabled

This commit is contained in:
Christian Binder 2006-12-30 07:26:49 +00:00
parent 6dcc378964
commit dab7c1a922

View File

@ -94,7 +94,7 @@ class uiviews extends uical
/** /**
* Dragdrop Object * Dragdrop Object
* *
* @var dragdrop; * @var object;
*/ */
var $dragdrop; var $dragdrop;
@ -147,10 +147,13 @@ class uiviews extends uical
$this->check_owners_access(); $this->check_owners_access();
// ToDo jaytraxx: if($GLOBALS['egw_info']['user']['preferences']['common']['enable_dragdrop'])
// we should check if dragdrop is enabled and instanciate the dragdrop class only then {
// as long as drag&drop is only used in calendar, we should move the preference to the calendar (at the end!) $this->dragdrop = new dragdrop();
$this->dragdrop = new dragdrop(); // if the object would auto-disable itself unset object
// to avoid unneccesary dragdrop calls later
if(!$this->dragdrop->validateBrowser()) { $this->dragdrop = false; }
}
} }
/** /**
@ -335,7 +338,7 @@ class uiviews extends uical
} }
// make wz_dragdrop elements work // make wz_dragdrop elements work
$this->dragdrop->setJSCode(); if(is_object($this->dragdrop)) { $this->dragdrop->setJSCode(); }
return $content; return $content;
} }
@ -461,7 +464,7 @@ class uiviews extends uical
} }
// make wz_dragdrop elements work // make wz_dragdrop elements work
$this->dragdrop->setJSCode(); if(is_object($this->dragdrop)) { $this->dragdrop->setJSCode(); }
return $content; return $content;
} }
@ -536,14 +539,14 @@ class uiviews extends uical
echo $cols[0]; echo $cols[0];
} }
// make wz_dragdrop elements work // make wz_dragdrop elements work
$this->dragdrop->setJSCode(); if(is_object($this->dragdrop)) { $this->dragdrop->setJSCode(); }
} }
else else
{ {
$content = $this->timeGridWidget($this->bo->search($this->search_params),$this->cal_prefs['interval'],300); $content = $this->timeGridWidget($this->bo->search($this->search_params),$this->cal_prefs['interval'],300);
// make wz_dragdrop elements work // make wz_dragdrop elements work
$this->dragdrop->setJSCode(); if(is_object($this->dragdrop)) { $this->dragdrop->setJSCode(); }
return $content; return $content;
} }
@ -910,15 +913,17 @@ class uiviews extends uical
if ($this->use_time_grid) if ($this->use_time_grid)
{ {
// drag and drop: check if the current user has EDIT permissions on the grid // drag and drop: check if the current user has EDIT permissions on the grid
if($owner) if(is_object($this->dragdrop))
{ {
$dropPermission = $this->bo->check_perms(EGW_ACL_EDIT,0,$owner); if($owner)
{
$dropPermission = $this->bo->check_perms(EGW_ACL_EDIT,0,$owner);
}
else
{
$dropPermission = true;
}
} }
else
{
$dropPermission = true;
}
// adding divs to click on for each row / time-span // adding divs to click on for each row / time-span
for($t = $this->scroll_to_wdstart ? 0 : $this->wd_start,$i = 1+$this->extraRows; for($t = $this->scroll_to_wdstart ? 0 : $this->wd_start,$i = 1+$this->extraRows;
$t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24*60; $t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24*60;
@ -938,7 +943,7 @@ class uiviews extends uical
$html .= $indent."\t".'<div id="' . $droppableID . '" style="height:'. $this->rowHeight .'%; top: '. $i*$this->rowHeight . $html .= $indent."\t".'<div id="' . $droppableID . '" style="height:'. $this->rowHeight .'%; top: '. $i*$this->rowHeight .
'%;" class="calAddEvent" onclick="'.$this->popup($GLOBALS['egw']->link('/index.php',$linkData)).';return false;"></div>'."\n"; '%;" class="calAddEvent" onclick="'.$this->popup($GLOBALS['egw']->link('/index.php',$linkData)).';return false;"></div>'."\n";
if($dropPermission) if(is_object($this->dragdrop) && $dropPermission)
{ {
$this->dragdrop->addDroppable( $this->dragdrop->addDroppable(
$droppableID, $droppableID,
@ -1225,7 +1230,8 @@ class uiviews extends uical
$indent."</div>"."\n"; $indent."</div>"."\n";
// ATM we do not support whole day events or recurring events for dragdrop // ATM we do not support whole day events or recurring events for dragdrop
if ($this->use_time_grid && if ( is_object($this->dragdrop) &&
$this->use_time_grid &&
$this->bo->check_perms(EGW_ACL_EDIT,$event) && $this->bo->check_perms(EGW_ACL_EDIT,$event) &&
!$event['whole_day_on_top'] && !$event['whole_day_on_top'] &&
!$event['whole_day'] && !$event['whole_day'] &&