[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] tasks/class.base.php, 1.1.2.12
From: |
nomail |
Subject: |
[Phpgroupware-cvs] tasks/class.base.php, 1.1.2.12 |
Date: |
Tue, 6 Jul 2004 09:22:00 +0200 |
Update of /tasks
Modified Files:
Branch: proposal-branch
class.base.php
date: 2004/07/06 07:22:00; author: jengo; state: Exp; lines: +121 -30
Log Message:
Initial work to ACL, more info is in the wiki journal
=====================================================================
Index: tasks/class.base.php
diff -u tasks/class.base.php:1.1.2.11 tasks/class.base.php:1.1.2.12
--- tasks/class.base.php:1.1.2.11 Wed Jun 30 08:36:48 2004
+++ tasks/class.base.php Tue Jul 6 07:22:00 2004
@@ -186,7 +186,6 @@
'responsible_id' =>
$dbresult->fields['task_responsible'],
'category' =>
$this->_temp_cat($dbresult->fields['task_category']),
'category_id' =>
$dbresult->fields['task_category'],
- 'access' =>
$dbresult->fields['task_access'],
'status' =>
$this->_convert_status($dbresult->fields['task_status']),
'status_id' =>
$dbresult->fields['task_status'],
'subject' =>
$dbresult->fields['task_subject'],
@@ -209,17 +208,41 @@
$dbresult = $GLOBALS['phpgw']->db->execute("
SELECT
- *
+ DISTINCT task_id,
+ task_subject,
+ task_owner,
+ task_responsible,
+ task_status,
+ task_category,
+ task_subject,
+ task_description,
+ task_priority,
+ task_start,
+ task_end
FROM
- phpgw_tasks
+ phpgw_tasks AS t,
+ phpgw_acl AS a
WHERE
(
- task_owner=" .
$GLOBALS['phpgw_data']['user']['id'] . "
- OR
- task_responsible=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ t.acl_id != -1
+ AND
+ t.acl_id=a.acl_id
+ AND
+ (1 & acl_rights)=1
+ AND
+ acl_account=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ )
+ OR
+ (
+ t.task_owner=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ )
+ OR
+ (
+ t.task_responsible=" .
$GLOBALS['phpgw_data']['user']['id'] . "
)
AND
- task_dm_type='N'");
+ t.task_dm_type='N'
+ ");
while (! $dbresult->EOF)
{
@@ -302,10 +325,10 @@
function create()
{
$args = new safe_args();
- $args->set('select_tab',1,'number');
+ $args->set('select_tab',NOTSET,'number');
$args->set('form_submit',NOTSET,'any');
$args->set('type',NOTSET,'any');
- $args->set('subject',NOTSET,'any');
+ $args->set('subject',NOTSET,'any',60);
$args->set('category',NOTSET,'any');
$args->set('description',NOTSET,'any');
$args->set('priority',0,'any');
@@ -314,10 +337,12 @@
$args->set('end_date',NOTSET,'any');
$args->set('end_time',NOTSET,'any');
$args->set('status',0,'number');
- $args->set('access',array('private','public'),'enum');
$args->set('dm_type',array('N','H','S'),'enum');
$args->set('datamine_location',NOTSET,'any');
- $args->set('responsible','0','number');
+ // The following is a string on purpose
+ $args->set('responsible','0','number');
+ $acl_mgr = createObject('api_acl_mgr');
+ $acl_mgr->_handle_safe_args(&$args);
$args = $args->get(func_get_args());
$result['task_data'] = array
@@ -332,8 +357,30 @@
'dm_type' =>
$this->__restore_cache_value('dm_type',$args),
'dm_location' =>
$this->__restore_cache_value('dm_location',$args)
);
+
+ // We need to remeber our position, so when we submit
the ACL add / remove, it will
+ // bring us back to the proper tab
+ if (! $args['select_tab'])
+ {
+ if
(strlen($_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']['select_tab']))
+ {
+ $args['select_tab'] =
$_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']['select_tab'];
+ }
+ else
+ {
+ $args['select_tab'] = 1;
+
$_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']['select_tab']
= $args['select_tab'];
+ }
+ }
+ else
+ {
+
$_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']['select_tab']
= $args['select_tab'];
+ }
+
$result['tab_widget'] =
$this->__create_tabs($args['select_tab']);
$result['current_tab_index'] = $args['select_tab'];
+
+ $result =
$acl_mgr->_handle_request('tasks.base.create',$args,$result);
if ($args['form_submit'] == 'True')
{
@@ -425,8 +472,8 @@
task_start,
task_end,
task_status,
- task_access,
- task_dm_type
+ task_dm_type,
+ acl_id
)
VALUES
(
@@ -440,8 +487,8 @@
" . $start_timestamp .
",
" . $end_timestamp . ",
'" . $args['status'] .
"',
- '" .
$args['task_access'] . "',
- '" . $args['dm_type'] .
"'
+ '" . $args['dm_type'] .
"',
+ -1
)");
$history_data = array
@@ -466,6 +513,18 @@
unset($_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']);
unset($_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create.missing_fields']);
+ $acl_id =
$acl_mgr->_set('tasks.base.create',$task_id);
+ // FIXME: This would be better
off in a transaction above
+ $GLOBALS['phpgw']->db->execute("
+ UPDATE
+ phpgw_tasks
+ SET
+ acl_id=" .
$acl_id . "
+ WHERE
+ task_id=" .
$task_id
+ );
+
$acl_mgr->_clear_cache('tasks.base.create');
+
if ($args['dm_type'] != 'N')
{
$dm_params = array
@@ -504,7 +563,8 @@
$this->set_cache_value('status',$args);
$this->set_cache_value('dm_type',$args);
$this->set_cache_value('datamine_location',$args);
-
+
+ /*
$GLOBALS['phpgw_session']['phpgw_data']['statecache']['tasks.base.create'] =
array
(
'subject' => $args['subject'],
@@ -519,7 +579,8 @@
'status' => $args['status'],
'dm_type' => $args['dm_type'],
'datamine_location' =>
$args['datamine_location']
- );
+ );
+ */
$result['task_data'] =
$GLOBALS['phpgw_session']['phpgw_data']['statecache']['tasks.base.create'];
@@ -558,7 +619,6 @@
$args->set('end_date',NOTSET,'any');
$args->set('end_time',NOTSET,'any');
$args->set('status',0,'number');
- $args->set('access',array('private','public'),'enum');
$args->set('dm_type',array('N','H','S'),'enum');
$args->set('datamine_location',NOTSET,'any');
$args->set('responsible','0','number');
@@ -576,7 +636,10 @@
return array();
}
- $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Delete task','tasks.base.delete&task_id=' . $args['task_id']);
+ if ($GLOBALS['phpgw']->acl->check('tasks.base.' .
$args['task_id'],PHPGW_ACL_DELETE))
+ {
+ $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Delete task','tasks.base.delete&task_id=' . $args['task_id']);
+ }
$result['task_data'] = $task;
@@ -652,8 +715,15 @@
return array();
}
- $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Edit task','tasks.base.edit&task_id=' . $args['task_id']);
- $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Delete task','tasks.base.delete&task_id=' . $args['task_id']);
+ if ($GLOBALS['phpgw']->acl->check('tasks.base.' .
$args['task_id'],PHPGW_ACL_EDIT))
+ {
+ $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Edit task','tasks.base.edit&task_id=' . $args['task_id']);
+ }
+
+ if ($GLOBALS['phpgw']->acl->check('tasks.base.' .
$args['task_id'],PHPGW_ACL_DELETE))
+ {
+ $GLOBALS['phpgw']->add_appmenu('Task manager
menu','Delete task','tasks.base.delete&task_id=' . $args['task_id']);
+ }
$result['action_type'] = 'task_view';
$result['task_data'] = $task;
@@ -669,6 +739,8 @@
$this->history->field_execMethod['task_end'] =
'api.prefs._show_date';
$result['history_data'] =
$this->history->get('tasks.base.' . $args['task_id']);
+ $acl_mgr = createObject('api_acl_mgr');
+ $result = $acl_mgr->_handle_view('tasks.base.' .
$args['task_id'],$result);
if (! $args['select_tab'])
{
@@ -778,17 +850,38 @@
$dbresult = $GLOBALS['phpgw']->db->execute("
SELECT
- *
+ DISTINCT task_id,
+ task_subject,
+ task_owner,
+ task_responsible,
+ task_status,
+ task_category,
+ task_subject,
+ task_description,
+ task_priority,
+ task_start,
+ task_end
FROM
- phpgw_tasks
+ phpgw_tasks AS t,
+ phpgw_acl AS a
WHERE
(
- task_owner=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ t.task_owner=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ OR
+ t.task_responsible=" .
$GLOBALS['phpgw_data']['user']['id'] . "
OR
- task_responsible=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ (
+ t.acl_id != -1
+ AND
+ t.acl_id=a.acl_id
+ AND
+ (1 & acl_rights)=1
+ AND
+ acl_account=" .
$GLOBALS['phpgw_data']['user']['id'] . "
+ )
)
AND
- task_id=" . $args['id']);
+ t.task_id=" . $args['id']);
if ($dbresult->EOF)
{
@@ -813,8 +906,7 @@
$args->set('start_time',NOTSET,'any');
$args->set('end_date',NOTSET,'any');
$args->set('end_time',NOTSET,'any');
- $args->set('status',NOTSET,'any');
- $args->set('access',array('private','public'),'enum');
+ $args->set('status',NOTSET,'any');
$args = $args->get(func_get_args());
$update_result = $GLOBALS['phpgw']->db->execute("
@@ -828,7 +920,6 @@
task_start'" . $args['start'] . "',
task_end'" . $args['end'] . "',
task_status'" . $args['status'] . "',
- task_access'" . $args['access'] . "',
task_dm_type'" . $args['dm_type'] . "',
task_modified=now()
WHERE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] tasks/class.base.php, 1.1.2.12,
nomail <=