phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] tasks/class.base.php, 1.1.2.10


From: nomail
Subject: [Phpgroupware-cvs] tasks/class.base.php, 1.1.2.10
Date: Thu, 3 Jun 2004 08:44:03 +0200

Update of /tasks
Modified Files:
        Branch: proposal-branch
          class.base.php

date: 2004/06/03 06:44:03;  author: jengo;  state: Exp;  lines: +56 -23

Log Message:
More work on tasks I didn't have a chance to fix
=====================================================================
Index: tasks/class.base.php
diff -u tasks/class.base.php:1.1.2.9 tasks/class.base.php:1.1.2.10
--- tasks/class.base.php:1.1.2.9        Sat May 15 09:07:47 2004
+++ tasks/class.base.php        Thu Jun  3 06:44:03 2004
@@ -60,7 +60,18 @@
                (
                        'task_id'    => array('type' => 'number', 'default' => 
REQUIRED, 'desc' => 'Task ID number')
                )
-       );
+       );
+
+       $functions['delete']   = array
+       (
+               'type'         => 'public',
+               'title'        => 'Delete Task',
+               'abstract'     => 'Delete Task',
+               'params'       => array
+               (
+                       'task_id'    => array('type' => 'number', 'default' => 
REQUIRED, 'desc' => 'Task ID number')
+               )
+       );
 
        $GLOBALS['docs']['tasks']['classes']['tasks_base'] = array
        (
@@ -81,7 +92,7 @@
                        // durring _datamine_get(), I am currently working on 
another solution to it
                        if (! $GLOBALS['tasks_menus_loaded'] && ! 
$GLOBALS['no_app_menu'])
                        {
-                               $GLOBALS['phpgw']->add_appmenu('Task manager 
menu','Add task','tasks.base.create');
+                               $GLOBALS['phpgw']->add_appmenu('Task manager 
menu','Add task','tasks.base.create&dm_type=N');
 
                                $GLOBALS['tasks_menus_loaded'] = true;
                        }
@@ -282,6 +293,7 @@
                        $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');
                        $args = $args->get(func_get_args());
 
@@ -293,7 +305,9 @@
                                'status'      => 
$this->__restore_cache_value('status',$args),
                                'description' => 
$this->__restore_cache_value('description',$args),
                                'start_date'  => 
$this->__restore_cache_value('start_date',$args),
-                               'end_date'    => 
$this->__restore_cache_value('end_date',$args)
+                               'end_date'    => 
$this->__restore_cache_value('end_date',$args),
+                               'dm_type'     => 
$this->__restore_cache_value('dm_type',$args),
+                               'dm_location' => 
$this->__restore_cache_value('dm_location',$args)
                        );
                        $result['tab_widget']        = 
$this->__create_tabs($args['select_tab']);
                        $result['current_tab_index'] = $args['select_tab'];
@@ -363,6 +377,9 @@
                                        $epoch_end_timestamp = 0;
                                }
 
+                               // If there are fields missing on the 2nd tab, 
and the 1st tab is valid
+                               // we should re-direct the user to the 2nd tab, 
regardless of which tab they
+                               // have selected.
                                if ($missing_fields)
                                {
                                        
$_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create.missing_fields']
 = $result['missing_fields'];
@@ -401,7 +418,7 @@
                                                        " . $end_timestamp . ",
                                                        '" . $args['status'] . 
"',
                                                        '" . 
$args['task_access'] . "',
-                                                       'N'
+                                                       '" . $args['dm_type'] . 
"'
                                                )");
 
                                        $history_data = array
@@ -422,15 +439,27 @@
                                                $this->history = 
createObject('api_history');
                                                
$this->history->set('tasks.base.' . $task_id,$history_data,array());
                                                
$GLOBALS['msgbox']->add(lang('Task has been successfully created'),'notice');
-       
-                                               if ($args['dm_type'] == 'D')
-                                               {
-                                                       
execMethod('api.datamine._set',array('location_from' => 
$args['datamine_location'], 'location_to' => 'tasks.base.' . $task_id));
-                                               }
-       
+
                                                
unset($_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create']);
                                                
unset($_SESSION['phpgw_session']['phpgw_data']['statecache']['tasks.base.create.missing_fields']);
-                                               return $this->view($task_id);
+
+                                               if ($args['dm_type'] != 'N')
+                                               {
+                                                       $dm_params = array
+                                                       (
+                                                               'location_from' 
=> $args['datamine_location'],
+                                                               'location_to'   
=> 'tasks.base.' . $task_id,
+                                                               'type'          
=> $args['dm_type']
+                                                       );
+                                                       
execMethod('api.datamine._set',$dm_params);
+                                                       list($app,$class,$id) = 
explode('.',$args['datamine_location']);
+
+                                                       return 
execMethod(sprintf('%s.%s.view.%s',$app,$class,$id));
+                                               }
+                                               else
+                                               {
+                                                       return 
$this->view($task_id);
+                                               }
                                        }
                                        else
                                        {
@@ -449,20 +478,24 @@
                                $this->set_cache_value('start_time',$args);
                                $this->set_cache_value('end_date',$args);
                                $this->set_cache_value('end_time',$args);
-                               $this->set_cache_value('status',$args);         
                
+                               $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'],
-                                       'responsible' => $args['responsible'],
-                                       'description' => $args['description'],
-                                       'category'    => $args['category'],
-                                       'priority'    => $args['priority'],
-                                       'start_date'  => $args['start_date'],
-                                       'start_time'  => $args['start_time'],
-                                       'end_date'    => $args['end_date'],
-                                       'end_time'    => $args['end_time'],
-                                       'status'      => $args['status']
+                                       'subject'           => $args['subject'],
+                                       'responsible'       => 
$args['responsible'],
+                                       'description'       => 
$args['description'],
+                                       'category'          => 
$args['category'],
+                                       'priority'          => 
$args['priority'],
+                                       'start_date'        => 
$args['start_date'],
+                                       'start_time'        => 
$args['start_time'],
+                                       'end_date'          => 
$args['end_date'],
+                                       'end_time'          => 
$args['end_time'],
+                                       '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'];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]