mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
Changes to calendar list view:
- Add button to add timesheet for one entry - Disable delete button for other apps that got integrated - Fix edit link for integrated apps - Add scrollbar to long descriptions - Create timesheet now works for integrated apps as well
This commit is contained in:
parent
58fe8a7cd8
commit
09539d3ca2
@ -104,6 +104,13 @@ class calendar_uilist extends calendar_ui
|
|||||||
$content['action'] = 'delete';
|
$content['action'] = 'delete';
|
||||||
$content['nm']['rows']['checked'] = array($id);
|
$content['nm']['rows']['checked'] = array($id);
|
||||||
}
|
}
|
||||||
|
if (is_array($content) && $content['nm']['rows']['timesheet'])
|
||||||
|
{
|
||||||
|
// handle a single timesheet like timesheet with the checkboxes
|
||||||
|
list($id) = @each($content['nm']['rows']['timesheet']);
|
||||||
|
$content['action'] = 'timesheet-add';
|
||||||
|
$content['nm']['rows']['checked'] = array($id);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle actions
|
// Handle actions
|
||||||
if ($content['action'] != '')
|
if ($content['action'] != '')
|
||||||
@ -123,6 +130,7 @@ class calendar_uilist extends calendar_ui
|
|||||||
$msg .= lang('%1 event(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
|
$msg .= lang('%1 event(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$content['nm']['rows']['checked'] = array();
|
||||||
}
|
}
|
||||||
$content = array(
|
$content = array(
|
||||||
'nm' => egw_session::appsession('calendar_list','calendar'),
|
'nm' => egw_session::appsession('calendar_list','calendar'),
|
||||||
@ -329,7 +337,8 @@ class calendar_uilist extends calendar_ui
|
|||||||
foreach((array) $this->bo->search($search_params) as $event)
|
foreach((array) $this->bo->search($search_params) as $event)
|
||||||
{
|
{
|
||||||
$readonlys['view['.$event['id'].']'] = !($readonlys['edit['.$event['id'].']'] = !$this->bo->check_perms(EGW_ACL_EDIT,$event));
|
$readonlys['view['.$event['id'].']'] = !($readonlys['edit['.$event['id'].']'] = !$this->bo->check_perms(EGW_ACL_EDIT,$event));
|
||||||
$readonlys['delete['.$event['id'].']'] = !$this->bo->check_perms(EGW_ACL_DELETE,$event);
|
// Delete disabled for other applications
|
||||||
|
$readonlys['delete['.$event['id'].']'] = !$this->bo->check_perms(EGW_ACL_DELETE,$event) || !is_numeric($event['id']);
|
||||||
|
|
||||||
$event['recure'] = $this->bo->recure2string($event);
|
$event['recure'] = $this->bo->recure2string($event);
|
||||||
if ($params['csv_export'])
|
if ($params['csv_export'])
|
||||||
@ -473,13 +482,19 @@ class calendar_uilist extends calendar_ui
|
|||||||
}
|
}
|
||||||
foreach($checked as $event)
|
foreach($checked as $event)
|
||||||
{
|
{
|
||||||
$id = $event['id'];
|
if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches))
|
||||||
$recur_date = $event['recur_date'];
|
{
|
||||||
|
$app = $matches[1];
|
||||||
|
$app_id = $matches[2];
|
||||||
|
} else {
|
||||||
|
$id = $event['id'];
|
||||||
|
$recur_date = $event['recur_date'];
|
||||||
|
}
|
||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$action_msg = lang('deleted');
|
$action_msg = lang('deleted');
|
||||||
if ($this->bo->check_perms(EGW_ACL_DELETE,$id))
|
if ($id && $this->bo->check_perms(EGW_ACL_DELETE,$id))
|
||||||
{
|
{
|
||||||
if($this->bo->delete($id, $recur_date))
|
if($this->bo->delete($id, $recur_date))
|
||||||
{
|
{
|
||||||
@ -492,22 +507,42 @@ class calendar_uilist extends calendar_ui
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'status':
|
case 'status':
|
||||||
$event = $this->bo->read($id, $recur_date);
|
if($id && $event = $this->bo->read($id, $recur_date))
|
||||||
$old_status = $event['participants'][$GLOBALS['egw_info']['user']['account_id']];
|
|
||||||
calendar_so::split_status($old_status, $quantity, $role);
|
|
||||||
if ($old_status != $status)
|
|
||||||
{
|
{
|
||||||
//echo "<p>$uid: status changed '$data[old_status]' --> '$status<'/p>\n";
|
$old_status = $event['participants'][$GLOBALS['egw_info']['user']['account_id']];
|
||||||
$new_status = calendar_so::combine_status($status, $quantity, $role);
|
calendar_so::split_status($old_status, $quantity, $role);
|
||||||
if ($this->bo->set_status($id,$GLOBALS['egw_info']['user']['account_id'],$new_status,$recur_date))
|
if ($old_status != $status)
|
||||||
{
|
{
|
||||||
$success++;
|
//echo "<p>$uid: status changed '$data[old_status]' --> '$status<'/p>\n";
|
||||||
$msg = lang('Status changed');
|
$new_status = calendar_so::combine_status($status, $quantity, $role);
|
||||||
|
if ($this->bo->set_status($id,$GLOBALS['egw_info']['user']['account_id'],$new_status,$recur_date))
|
||||||
|
{
|
||||||
|
$success++;
|
||||||
|
$msg = lang('Status changed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$failure++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'timesheet-add':
|
case 'timesheet-add':
|
||||||
$event = $this->bo->read($id, $recur_date);
|
if($id && !$app)
|
||||||
|
{
|
||||||
|
$event = $this->bo->read($id, $recur_date);
|
||||||
|
}
|
||||||
|
elseif ($app)
|
||||||
|
{
|
||||||
|
$query = egw_session::appsession('calendar_list','calendar');
|
||||||
|
$query['query'] = $app_id;
|
||||||
|
$query['search'] = $app_id;
|
||||||
|
$result = $this->bo->search($query);
|
||||||
|
$event = $result[$app.$app_id];
|
||||||
|
}
|
||||||
|
if(!$event)
|
||||||
|
{
|
||||||
|
$failure++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$timesheet = array(
|
$timesheet = array(
|
||||||
'ts_title' => $event['title'],
|
'ts_title' => $event['title'],
|
||||||
'ts_description' => $event['description'],
|
'ts_description' => $event['description'],
|
||||||
@ -539,9 +574,10 @@ class calendar_uilist extends calendar_ui
|
|||||||
$success++;
|
$success++;
|
||||||
|
|
||||||
// Can't link to just one of a recurring series of events
|
// Can't link to just one of a recurring series of events
|
||||||
if(!$recur_date) {
|
if(!$recur_date || $app) {
|
||||||
// Create link
|
// Create link
|
||||||
egw_link::link('calendar', $id, 'timesheet', $timesheet_bo->data['ts_id']);
|
$link_id = $app ? $app_id : $id;
|
||||||
|
egw_link::link($app ? $app : 'calendar', $link_id, 'timesheet', $timesheet_bo->data['ts_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user