phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: todo/inc class.bo.inc.php,1.1,1.2 class.so.inc.p


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: todo/inc class.bo.inc.php,1.1,1.2 class.so.inc.php,1.1,1.2 class.ui.inc.php,1.2,1.3
Date: Sun, 27 Jan 2002 17:24:41 -0500

Update of /cvsroot/phpgroupware/todo/inc
In directory subversions:/tmp/cvs-serv12770/inc

Modified Files:
        class.bo.inc.php class.so.inc.php class.ui.inc.php 
Log Message:
added 'assigned to' field

Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.bo.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.bo.inc.php    3 Dec 2001 19:44:38 -0000       1.1
--- class.bo.inc.php    27 Jan 2002 22:24:38 -0000      1.2
***************
*** 11,15 ****
        *  option) any later version.                                           
   *
        
\**************************************************************************/
- 
        /* $Id$ */
  
--- 11,14 ----
***************
*** 39,44 ****
                function bo($session=False)
                {
-                       global $phpgw;
- 
                        $this->sotodo = CreateObject('todo.so');
  
--- 38,41 ----
***************
*** 116,124 ****
                function save_sessiondata($data)
                {
-                       global $phpgw;
- 
                        if ($this->use_session)
                        {
!                               
$phpgw->session->appsession('session_data','todo',$data);
                        }
                }
--- 113,119 ----
                function save_sessiondata($data)
                {
                        if ($this->use_session)
                        {
!                               
$GLOBALS['phpgw']->session->appsession('session_data','todo',$data);
                        }
                }
***************
*** 126,132 ****
                function read_sessiondata()
                {
!                       global $phpgw;
! 
!                       $data = 
$phpgw->session->appsession('session_data','todo');
  
                        $this->start    = $data['start'];
--- 121,125 ----
                function read_sessiondata()
                {
!                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','todo');
  
                        $this->start    = $data['start'];
***************
*** 138,159 ****
                }
  
- /*            function check_record_rights($todo_id, $required_rights)
-               {
-                       global $phpgw_info;
- 
-                       $this->db->query("select todo_owner from phpgw_todo 
where todo_id='$todo_id'");
-                       $this->db->next_record();
- 
-                       // Make sure this user has access to this item
-                       if (! 
$this->check_perms($this->grants[$this->db->f('todo_owner')],$required_rights) 
&& $this->db->f('todo_owner') != $phpgw_info['user']['account_id'])
-                       {
-                               return False;
-                       }
-                       else
-                       {
-                               return True;
-                       }
-               } */
- 
                function check_perms($has, $needed)
                {
--- 131,134 ----
***************
*** 163,168 ****
                function cached_accounts($account_id)
                {
-                       global $phpgw;
- 
                        $this->accounts = 
CreateObject('phpgwapi.accounts',$account_id);
                        $this->accounts->read_repository();
--- 138,141 ----
***************
*** 175,178 ****
--- 148,185 ----
                }
  
+               function employee_list()
+               {               
+                       $employees = 
$GLOBALS['phpgw']->accounts->get_list('accounts');
+                       return $employees;
+               }
+ 
+               function format_assigned($a = '')
+               {
+                       if (substr($a,0,1) == ',' && 
(substr($a,strlen($a-1),1)) == ',')
+                       {
+                               $a = substr($a,1,strlen($a)-2);
+                       }
+                       $a = explode(',',$a);
+                       return $a;
+               }
+ 
+               function list_assigned($assi = '')
+               {
+                       if (is_array($assi))
+                       {
+                               while (list($null,$a) = each($assi))
+                               {
+                                       $cached_data = 
$this->cached_accounts($a);                                              
+                                       $aout  .= 
$GLOBALS['phpgw']->common->display_fullname($cached_data[$a]['account_lid'],
+                                                                               
$cached_data[$a]['firstname'],$cached_data[$a]['lastname']) . '<br>';
+                               }
+                       }
+                       else
+                       {
+                               $aout = '---';
+                       }
+                       return $aout;
+               }
+ 
                function _list($start = 0, $limit = '', $query = '', $filter = 
'', $order = '', $sort = '', $cat_id = 0, $tree = '', $parent = '')
                {
***************
*** 208,211 ****
--- 215,223 ----
                                }
  
+                               if ($v['assigned'])
+                               {
+                                       $v['assigned'] = 
$this->format_assigned($v['assigned']);
+                               }
+ 
                                $cached_data = 
$this->cached_accounts($v['owner']);
  
***************
*** 214,237 ****
  
                                $r[] = array(
!                                       'id'       => (int)$v['id'],
!                                       'main'     => (int)$v['main'],
!                                       'parent'   => (int)$v['parent'],
!                                       'level'    => (int)$v['level'],
!                                       'owner'    => $v['owner'],
!                                       'owner_id' => (int)$v['owner_id'],
!                                       'access'   => $v['access'],
!                                       'cat'      => (int)$v['cat'],
!                                       'title'    => $v['title'],
!                                       'descr'    => $v['descr'],
!                                       'pri'      => (int)$v['pri'],
!                                       'status'   => (int)$v['status'],
!                                       'sdate'    => $v['sdate'],
!                                       'edate'    => $v['edate'],
!                                       'grants'   => (int)$v['grants'],
!                                       'sdate_epoch' => (int)$v['sdate_epoch'],
!                                       'edate_epoch' => (int)$v['edate_epoch']
                                );
                        }
- 
                        return $r;
                }
--- 226,249 ----
  
                                $r[] = array(
!                                       'id'                    => 
(int)$v['id'],
!                                       'main'                  => 
(int)$v['main'],
!                                       'parent'                => 
(int)$v['parent'],
!                                       'level'                 => 
(int)$v['level'],
!                                       'owner'                 => $v['owner'],
!                                       'owner_id'              => 
(int)$v['owner_id'],
!                                       'access'                => $v['access'],
!                                       'cat'                   => 
(int)$v['cat'],
!                                       'title'                 => $v['title'],
!                                       'descr'                 => $v['descr'],
!                                       'pri'                   => 
(int)$v['pri'],
!                                       'status'                => 
(int)$v['status'],
!                                       'sdate'                 => $v['sdate'],
!                                       'edate'                 => $v['edate'],
!                                       'grants'                => 
(int)$v['grants'],
!                                       'sdate_epoch'   => 
(int)$v['sdate_epoch'],
!                                       'edate_epoch'   => 
(int)$v['edate_epoch'],
!                                       'assigned'              => 
$v['assigned']
                                );
                        }
                        return $r;
                }
***************
*** 246,251 ****
                function check_values($values)
                {
-                       global $phpgw;
- 
                        if (!$values['title'])
                        {
--- 258,261 ----
***************
*** 341,351 ****
                }
  
-               function select_todo_list($parent)
-               {
-                       $list = $this->sotodo->select_todo_list($parent);
- 
-                       return $list;
-               }
- 
                function exists($todo_id)
                {
--- 351,354 ----
***************
*** 380,382 ****
                }
        }
! ?>
\ No newline at end of file
--- 383,385 ----
                }
        }
! ?>

Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.so.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.so.inc.php    3 Dec 2001 19:44:38 -0000       1.1
--- class.so.inc.php    27 Jan 2002 22:24:38 -0000      1.2
***************
*** 21,31 ****
                function so()
                {
!                       global $phpgw, $phpgw_info;
! 
!                       $this->db             = $phpgw->db;
!                       $this->db2            = $this->db;
!                       $this->grants         = $phpgw->acl->get_grants('todo');
!                       $this->owner          = 
$phpgw_info['user']['account_id'];
!                       $this->historylog     = 
CreateObject('phpgwapi.historylog','todo');
  
                        // This is so our transactions follow across classes
--- 21,29 ----
                function so()
                {
!                       $this->db                       = $GLOBALS['phpgw']->db;
!                       $this->db2                      = $this->db;
!                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('todo');
!                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
!                       $this->historylog       = 
CreateObject('phpgwapi.historylog','todo');
  
                        // This is so our transactions follow across classes
***************
*** 33,54 ****
                }
  
- /*            function check_record_rights($todo_id, $required_rights)
-               {
-                       global $phpgw_info;
- 
-                       $this->db->query("select todo_owner from phpgw_todo 
where todo_id='$todo_id'");
-                       $this->db->next_record();
- 
-                       // Make sure this user has access to this item
-                       if (! 
$this->check_perms($this->grants[$this->db->f('todo_owner')],$required_rights) 
&& $this->db->f('todo_owner') != $phpgw_info['user']['account_id'])
-                       {
-                               return False;
-                       }
-                       else
-                       {
-                               return True;
-                       }
-               } */
- 
                function type($tree)
                {
--- 31,34 ----
***************
*** 64,69 ****
                function read_todos($start = 0, $limit = True, $query = '', 
$filter = '', $order = '', $sort = '', $cat_id = '', $tree = '', $parent = '')
                {
-                       global $phpgw;
- 
                        $type = $this->type($tree);
  
--- 44,47 ----
***************
*** 86,90 ****
                        if ($filter == 'none')
                        {
!                               $filtermethod = "( todo_owner=" . $this->owner;
                                if (is_array($this->grants))
                                {
--- 64,69 ----
                        if ($filter == 'none')
                        {
!                               $filtermethod = "(( todo_owner='" . 
$this->account . "' OR todo_assigned like '%," . $this->account . ",%' OR 
todo_assigned='"
!                                                               . 
$this->account . "')";
                                if (is_array($this->grants))
                                {
***************
*** 104,112 ****
                        elseif ($filter == 'yours')
                        {
!                               $filtermethod = " todo_owner='" . $this->owner 
. "'";
                        }
                        else
                        {
!                               $filtermethod =  " todo_owner='" . $this->owner 
. "' AND todo_access='private'";
                        }
  
--- 83,93 ----
                        elseif ($filter == 'yours')
                        {
!                               $filtermethod = " (todo_owner='" . 
$this->account . "' OR todo_assigned like '%," . $this->account . ",%' OR 
todo_assigned='"
!                                                               . 
$this->account . "')";
                        }
                        else
                        {
!                               $filtermethod =  " (todo_owner='" . 
$this->owner . "' OR todo_assigned like '%," . $this->account . ",%' OR 
todo_assigned='"
!                                                               . 
$this->account . "' AND todo_access='private')";
                        }
  
***************
*** 142,163 ****
                        while ($this->db->next_record())
                        {
!                               $todos[] = array(
!                                       'id'       => 
(int)$this->db->f('todo_id'),
!                                       'main'     => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'   => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'    => 
(int)$this->db->f('todo_level'),
!                                       'owner'    => 
$this->db->f('todo_owner'),
!                                       'owner_id' => 
$this->db->f('todo_owner'),
!                                       'access'   => 
$this->db->f('todo_access'),
!                                       'cat'      => 
(int)$this->db->f('todo_cat'),
!                                       'title'    => 
$this->db->f('todo_title'),
!                                       'descr'    => $this->db->f('todo_des'),
!                                       'pri'      => 
(int)$this->db->f('todo_pri'),
!                                       'status'   => 
(int)$this->db->f('todo_status'),
!                                       'sdate'    => 
$this->db->f('todo_startdate'),
!                                       'edate'    => 
$this->db->f('todo_enddate'),
!                                       'grants'   => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch' => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch' => 
(int)$this->db->f('todo_enddate')
                                );
                        }
--- 123,146 ----
                        while ($this->db->next_record())
                        {
!                               $todos[] = array
!                               (
!                                       'id'                    => 
(int)$this->db->f('todo_id'),
!                                       'main'                  => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'                => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'                 => 
(int)$this->db->f('todo_level'),
!                                       'owner'                 => 
$this->db->f('todo_owner'),
!                                       'owner_id'              => 
$this->db->f('todo_owner'),
!                                       'access'                => 
$this->db->f('todo_access'),
!                                       'cat'                   => 
(int)$this->db->f('todo_cat'),
!                                       'title'                 => 
$this->db->f('todo_title'),
!                                       'descr'                 => 
$this->db->f('todo_des'),
!                                       'pri'                   => 
(int)$this->db->f('todo_pri'),
!                                       'status'                => 
(int)$this->db->f('todo_status'),
!                                       'sdate'                 => 
$this->db->f('todo_startdate'),
!                                       'edate'                 => 
$this->db->f('todo_enddate'),
!                                       'grants'                => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch'   => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch'   => 
(int)$this->db->f('todo_enddate'),
!                                       'assigned'              => 
$this->db->f('todo_assigned')
                                );
                        }
***************
*** 171,222 ****
                        if ($this->db->next_record())
                        {
!                               $todo['id']             = 
$this->db->f('todo_id');
!                               $todo['main']   = $this->db->f('todo_id_main');
!                               $todo['parent'] = 
$this->db->f('todo_id_parent');
!                               $todo['level']  = $this->db->f('todo_level');
!                               $todo['owner']  = $this->db->f('todo_owner');
!                               $todo['access'] = $this->db->f('todo_access');
!                               $todo['cat']    = $this->db->f('todo_cat');
!                               $todo['title']  = $this->db->f('todo_title');
!                               $todo['descr']  = $this->db->f('todo_des');
!                               $todo['pri']    = $this->db->f('todo_pri');
!                               $todo['status'] = $this->db->f('todo_status');
!                               $todo['sdate']  = 
$this->db->f('todo_startdate');
!                               $todo['edate']  = $this->db->f('todo_enddate');
                        }
                        return $todo;
                }
  
-               function select_todo_list($selected = '')
-               {
-                       global $phpgw;
- 
-                       $todos = $this->read_todos($start, False, $query, 
$filter, $sort, $order, $cat_id, $tree);
- 
-                       for ($i=0;$i<count($todos);$i++)
-                       {
-                               $todo_select .= '<option value="' . 
$todos[$i]['id'] . '"';
-                               if ($todos[$i]['id'] == $selected)
-                               {
-                                       $todo_select .= ' selected';
-                               }
-                               if (! $todos[$i]['title'])
-                               {
-                                       $words = split(' 
',$phpgw->strip_html($todos[$i]['descr']));
-                                       $title = "$words[0] $words[1] $words[2] 
$words[3] ...";
-                                       $todo_select .= '>' . $title;           
                
-                               }
-                               else
-                               {
-                                       $todo_select .= '>' . 
$phpgw->strip_html($todos[$i]['title']);
-                               }
-                               $todo_select .= '</option>';
-                       }
-                       return $todo_select;
-               }
- 
                function add_todo($values)
                {
-                       global $phpgw;
                        ob_start();
                        print_r($values);
--- 154,177 ----
                        if ($this->db->next_record())
                        {
!                               $todo['id']                     = 
$this->db->f('todo_id');
!                               $todo['main']           = 
$this->db->f('todo_id_main');
!                               $todo['parent']         = 
$this->db->f('todo_id_parent');
!                               $todo['level']          = 
$this->db->f('todo_level');
!                               $todo['owner']          = 
$this->db->f('todo_owner');
!                               $todo['access']         = 
$this->db->f('todo_access');
!                               $todo['cat']            = 
$this->db->f('todo_cat');
!                               $todo['title']          = 
$this->db->f('todo_title');
!                               $todo['descr']          = 
$this->db->f('todo_des');
!                               $todo['pri']            = 
$this->db->f('todo_pri');
!                               $todo['status']         = 
$this->db->f('todo_status');
!                               $todo['sdate']          = 
$this->db->f('todo_startdate');
!                               $todo['edate']          = 
$this->db->f('todo_enddate');
!                               $todo['assigned']       = 
$this->db->f('todo_assigned');
                        }
                        return $todo;
                }
  
                function add_todo($values)
                {
                        ob_start();
                        print_r($values);
***************
*** 224,228 ****
                        ob_end_clean();
  
!                       $phpgw->log->message(array(
                                'text' => 'debug, so add_todo values: %1',
                                'p1'   => $contents,
--- 179,183 ----
                        ob_end_clean();
  
!                       $GLOBALS['phpgw']->log->message(array(
                                'text' => 'debug, so add_todo values: %1',
                                'p1'   => $contents,
***************
*** 230,234 ****
                                'file' => __FILE__
                        ));
!                       $phpgw->log->commit();
  
                        if ($values['parent'] && $values['parent'] != 0)
--- 185,189 ----
                                'file' => __FILE__
                        ));
!                       $GLOBALS['phpgw']->log->commit();
  
                        if ($values['parent'] && $values['parent'] != 0)
***************
*** 238,250 ****
                        }
  
!                       $values['title'] = addslashes($values['title']);
!                       $values['descr'] = addslashes($values['descr']);
  
                        $this->db->transaction_begin();
                        $this->db->query("insert into phpgw_todo 
(todo_id_main,todo_id_parent,todo_level,todo_owner,todo_access,todo_cat,"
!                               . 
"todo_des,todo_title,todo_pri,todo_status,todo_datecreated,todo_startdate,todo_enddate)
 values ('" . $values['main'] . "','"
!                               . $values['parent'] . "','" . $values['level'] 
. "','" . $this->owner . "','" . $values['access'] . "','"
!                               . $values['cat'] . "','" . $values['descr'] . 
"','" . $values['title'] . "','" . $values['pri'] . "','"
!                               . $values['status'] . "','" . time() . "','" . 
$values['sdate'] . "','" . $values['edate'] . "')",__LINE__,__FILE__);
                        $this->db->get_last_insert_id('phpgw_todo','todo_id');
  
--- 193,206 ----
                        }
  
!                       $values['title'] = 
$this->db->db_addslashes($values['title']);
!                       $values['descr'] = 
$this->db->db_addslashes($values['descr']);
  
                        $this->db->transaction_begin();
                        $this->db->query("insert into phpgw_todo 
(todo_id_main,todo_id_parent,todo_level,todo_owner,todo_access,todo_cat,"
!                               . 
"todo_des,todo_title,todo_pri,todo_status,todo_datecreated,todo_startdate,todo_enddate,todo_assigned)
 values ('"
!                               . $values['main'] . "','" . $values['parent'] . 
"','" . $values['level'] . "','" . $this->owner . "','" . $values['access']
!                               . "','" . $values['cat'] . "','" . 
$values['descr'] . "','" . $values['title'] . "','" . $values['pri'] . "','"
!                               . $values['status'] . "','" . time() . "','" . 
$values['sdate'] . "','" . $values['edate'] . "','" . $values['assigned']
!                               . "')",__LINE__,__FILE__);
                        $this->db->get_last_insert_id('phpgw_todo','todo_id');
  
***************
*** 337,342 ****
                        }
  
!                       $values['title'] = addslashes($values['title']);
!                       $values['descr'] = addslashes($values['descr']);
  
                        $this->db->query("update phpgw_todo set todo_des='". 
$values['descr'] . "', todo_id_parent='" . $values['parent']
--- 293,298 ----
                        }
  
!                       $values['title'] = 
$this->db->db_addslashes($values['title']);
!                       $values['descr'] = 
$this->db->db_addslashes($values['descr']);
  
                        $this->db->query("update phpgw_todo set todo_des='". 
$values['descr'] . "', todo_id_parent='" . $values['parent']
***************
*** 344,348 ****
                                . "', todo_access='" . $values['access'] . "', 
todo_level='" . $values['level']
                                . "', todo_startdate='" . $values['sdate'] . 
"', todo_enddate='" . $values['edate'] . "', todo_title='" . $values['title']
!                               . "', todo_cat='" . $values['cat'] . "' where 
todo_id='" . $values['id']
                                . "'",__LINE__,__FILE__);
                        $this->db->transaction_commit();
--- 300,304 ----
                                . "', todo_access='" . $values['access'] . "', 
todo_level='" . $values['level']
                                . "', todo_startdate='" . $values['sdate'] . 
"', todo_enddate='" . $values['edate'] . "', todo_title='" . $values['title']
!                               . "', todo_cat='" . $values['cat'] . "' 
todo_assigned='" . $values['assigned'] . "'where todo_id='" . $values['id']
                                . "'",__LINE__,__FILE__);
                        $this->db->transaction_commit();

Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.ui.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.ui.inc.php    7 Jan 2002 10:50:42 -0000       1.2
--- class.ui.inc.php    27 Jan 2002 22:24:38 -0000      1.3
***************
*** 23,28 ****
                        'add'       => True,
                        'edit'      => True,
!                       'delete'                => True,
!                       'matrix'                => True
                );
  
--- 23,28 ----
                        'add'       => True,
                        'edit'      => True,
!                       'delete'        => True,
!                       'matrix'        => True
                );
  
***************
*** 85,88 ****
--- 85,91 ----
                {
                        
$this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+                       
$this->t->set_var('row_on',$GLOBALS['phpgw_info']['theme']['row_on']);
+                       
$this->t->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
+ 
                        $this->t->set_var('lang_category',lang('Category'));
                        $this->t->set_var('lang_select',lang('Select'));
***************
*** 90,95 ****
                        $this->t->set_var('lang_title',lang('Title'));
                        $this->t->set_var('lang_none',lang('None'));
                        $this->t->set_var('lang_urgency',lang('Urgency'));
!                       $this->t->set_var('lang_completed',lang('completed'));
                        $this->t->set_var('lang_start_date',lang('Start Date'));
                        $this->t->set_var('lang_end_date',lang('End Date'));
--- 93,99 ----
                        $this->t->set_var('lang_title',lang('Title'));
                        $this->t->set_var('lang_none',lang('None'));
+                       $this->t->set_var('lang_nobody',lang('Nobody'));
                        $this->t->set_var('lang_urgency',lang('Urgency'));
!                       $this->t->set_var('lang_completed',lang('Completed'));
                        $this->t->set_var('lang_start_date',lang('Start Date'));
                        $this->t->set_var('lang_end_date',lang('End Date'));
***************
*** 97,100 ****
--- 101,108 ----
                        $this->t->set_var('lang_access',lang('Private'));
                        $this->t->set_var('lang_parent',lang('Parent project'));
+                       $this->t->set_var('lang_submit',lang('Submit'));
+                       $this->t->set_var('lang_save',lang('Save'));
+                       $this->t->set_var('lang_assigned',lang('Assigned to'));
+                       $this->t->set_var('lang_owner',lang('Created by'));
                }
  
***************
*** 142,152 ****
                
$this->t->set_var(sort_urgency,$this->nextmatchs->show_sort_order($this->sort,'todo_pri',$this->order,'/todo/index.php',lang('Urgency')));
                
$this->t->set_var(sort_title,$this->nextmatchs->show_sort_order($this->sort,'todo_title',$this->order,'/todo/index.php',lang('title')));
!               
$this->t->set_var(sort_lastupdated,$this->nextmatchs->show_sort_order($this->sort,'todo_startdate',$this->order,'/todo/index.php',lang('start
 date')));
!               
$this->t->set_var(sort_datedue,$this->nextmatchs->show_sort_order($this->sort,'todo_enddate',$this->order,'/todo/index.php',lang('end
 date')));
                
$this->t->set_var(sort_owner,$this->nextmatchs->show_sort_order($this->sort,'todo_owner',$this->order,'/todo/index.php',lang('created
 by')));
!               $this->t->set_var(h_lang_sub,lang('Add Sub'));
                $this->t->set_var(h_lang_view,lang('View'));
                $this->t->set_var(h_lang_edit,lang('Edit'));
-               $this->t->set_var(h_lang_delete,lang('Delete'));
  
  // -------------- end header declaration 
--------------------------------------- 
--- 150,160 ----
                
$this->t->set_var(sort_urgency,$this->nextmatchs->show_sort_order($this->sort,'todo_pri',$this->order,'/todo/index.php',lang('Urgency')));
                
$this->t->set_var(sort_title,$this->nextmatchs->show_sort_order($this->sort,'todo_title',$this->order,'/todo/index.php',lang('title')));
!               
$this->t->set_var(sort_sdate,$this->nextmatchs->show_sort_order($this->sort,'todo_startdate',$this->order,'/todo/index.php',lang('start
 date')));
!               
$this->t->set_var(sort_edate,$this->nextmatchs->show_sort_order($this->sort,'todo_enddate',$this->order,'/todo/index.php',lang('end
 date')));
                
$this->t->set_var(sort_owner,$this->nextmatchs->show_sort_order($this->sort,'todo_owner',$this->order,'/todo/index.php',lang('created
 by')));
!               
$this->t->set_var(sort_assigned,$this->nextmatchs->show_sort_order($this->sort,'todo_assigned',$this->order,'/todo/index.php',lang('assigned
 to')));    
!                       $this->t->set_var(h_lang_sub,lang('Add Sub'));
                $this->t->set_var(h_lang_view,lang('View'));
                $this->t->set_var(h_lang_edit,lang('Edit'));
  
  // -------------- end header declaration 
--------------------------------------- 
***************
*** 213,222 ****
                                }
  
- //                            $cached_data = 
$this->bo->cached_accounts($todo_list[$i]['owner']);                     
- 
-                               $ownerout = $todo_list[$i]['owner']; 
//$phpgw->strip_html($cached_data[$todo_list[$i]['owner']]['account_lid']
- //                                                                            
. ' <' . $cached_data[$todo_list[$i]['owner']]['firstname'] . ' '
- //                                                                            
. $cached_data[$todo_list[$i]['owner']]['lastname'] . '>');
- 
  // --------------- template declaration for list records 
-------------------------------------
  
--- 221,224 ----
***************
*** 228,232 ****
                                        'datecreated'   => 
$todo_list[$i]['sdate'],
                                        'datedue'               => $datedueout,
!                                       'owner'                 => $ownerout
                                ));
  
--- 230,235 ----
                                        'datecreated'   => 
$todo_list[$i]['sdate'],
                                        'datedue'               => $datedueout,
!                                       'owner'                 => 
$todo_list[$i]['owner'],
!                                       'assigned'              => 
$this->bo->list_assigned($todo_list[$i]['assigned'])
                                ));
  
***************
*** 308,314 ****
                }
  
                function add()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent;
  
                        if ($new_parent)
--- 311,368 ----
                }
  
+               function formatted_user($selected = '')
+               {
+                       if (!$selected)
+                       {
+                               $selected = $this->account;
+                       }
+ 
+                       if (! is_array($selected))
+                       {
+                               $selected = explode(',',$selected);
+                       }
+ 
+                       $employees = $this->bo->employee_list();
+ 
+                       while (list($null,$account) = each($employees))
+                       {
+                               $user_list .= '<option value="' . 
$account['account_id'] . '"';
+                               if (in_array($account['account_id'],$selected))
+                               $user_list .= ' selected';
+                               $user_list .= '>' . 
$account['account_firstname'] . ' ' . $account['account_lastname']
+                                                                               
. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
+                       }
+                       return $user_list;
+               }
+ 
+               function formatted_todo($selected = '')
+               {
+                       $todos = $this->bo->_list($start, False, $query, 
$filter, $sort, $order, $cat_id, $tree);
+ 
+                       for ($i=0;$i<count($todos);$i++)
+                       {
+                               $todo_select .= '<option value="' . 
$todos[$i]['id'] . '"';
+                               if ($todos[$i]['id'] == $selected)
+                               {
+                                       $todo_select .= ' selected';
+                               }
+                               if (! $todos[$i]['title'])
+                               {
+                                       $words = split(' 
',$GLOBALS['phpgw']->strip_html($todos[$i]['descr']));
+                                       $title = "$words[0] $words[1] $words[2] 
$words[3] ...";
+                                       $todo_select .= '>' . $title;
+                               }
+                               else
+                               {
+                                       $todo_select .= '>' . 
$GLOBALS['phpgw']->strip_html($todos[$i]['title']);
+                               }
+                               $todo_select .= '</option>';
+                       }
+                       return $todo_select;
+               }
+ 
                function add()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $assigned;
  
                        if ($new_parent)
***************
*** 327,330 ****
--- 381,393 ----
                                $values['parent'] = $parent;
  
+                               if (is_array($assigned))
+                               {
+                                       $values['assigned'] = 
implode(',',$assigned);
+                                       if (count($assigned) > 1)
+                                       {
+                                               $values['assigned'] = ',' . 
$values['assigned'] . ',';
+                                       }
+                               }
+ 
                                $error = $this->bo->check_values($values);
                                if (is_array($error))
***************
*** 359,363 ****
  
                        
$this->t->set_var('cat_list',$this->cats->formated_list('select','all',$cat_id,'True'));
!                       
$this->t->set_var('todo_list',$this->bo->select_todo_list($parent));
  
                        $this->t->set_var('descr',$values['descr']);
--- 422,426 ----
  
                        
$this->t->set_var('cat_list',$this->cats->formated_list('select','all',$cat_id,'True'));
!                       
$this->t->set_var('todo_list',$this->formatted_todo($parent));
  
                        $this->t->set_var('descr',$values['descr']);
***************
*** 366,369 ****
--- 429,434 ----
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',0));
  
+                       
$this->t->set_var('user_list',$this->formatted_user($assigned));
+ 
                        if (!$values['smonth'])
                        {
***************
*** 410,434 ****
                        $this->t->set_file('_view','view.tpl');
  
!                       $this->t->set_var('lang_todo_action',lang('View todo 
item'));
! 
!                       $this->t->set_var('lang_title',lang('Title'));
!                       $this->t->set_var('value_title',$values['title']);
  
!                       $this->t->set_var('lang_descr',lang('Description'));
!                       $this->t->set_var('value_descr',$values['descr']);
  
-                       $this->t->set_var('lang_start_date',lang('Start date'));
                        
$this->t->set_var('value_start_date',$GLOBALS['phpgw']->common->show_date($values['sdate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']));
- 
-                       $this->t->set_var('lang_end_date',lang('End date'));
                        
$this->t->set_var('value_start_date',$GLOBALS['phpgw']->common->show_date($values['edate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']));
  
                        $parent_values = $this->bo->read($values['parent']);
!                       $this->t->set_var('lang_parent',lang('Parent'));
!                       
$this->t->set_var('value_parent',$parent_values['title']);
  
-                       $this->t->set_var('lang_completed',lang('Completed'));
                        $this->t->set_var('value_completed',$values['status']);
  
  
                        switch ($values['pri'])
--- 475,497 ----
                        $this->t->set_file('_view','view.tpl');
  
!                       $this->set_app_langs();
  
!                       $this->t->set_var('lang_todo_action',lang('View todo 
item'));
!                       
$this->t->set_var('value_title',$GLOBALS['phpgw']->strip_html($values['title']));
!                       
$this->t->set_var('value_descr',$GLOBALS['phpgw']->strip_html($values['descr']));
!                       
$this->t->set_var('value_category',$this->cats->id2name($values['cat']));
  
                        
$this->t->set_var('value_start_date',$GLOBALS['phpgw']->common->show_date($values['sdate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']));
                        
$this->t->set_var('value_start_date',$GLOBALS['phpgw']->common->show_date($values['edate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']));
  
                        $parent_values = $this->bo->read($values['parent']);
!                       
$this->t->set_var('value_parent',$GLOBALS['phpgw']->strip_html($parent_values['title']));
  
                        $this->t->set_var('value_completed',$values['status']);
+                       
$this->t->set_var('assigned',$this->bo->list_assigned($this->bo->format_assigned($values['assigned'])));
  
+                       $cached_data = 
$this->bo->cached_accounts($values['owner']);
+                       
$this->t->set_var('owner',$GLOBALS['phpgw']->common->display_fullname($cached_data[$values['owner']]['account_lid'],
+                                                                       
$cached_data[$values['owner']]['firstname'],$cached_data[$values['owner']]['lastname']));
  
                        switch ($values['pri'])
***************
*** 439,446 ****
                        }
  
-                       $this->t->set_var('lang_urgency',lang('Urgency'));
                        $this->t->set_var('value_urgency',$pri);
  
                        $this->t->set_var('lang_access',lang('Access'));
  
                        
$this->t->set_var('history',$this->historylog->return_html(array(),'','',$GLOBALS['todo_id']));
--- 502,509 ----
                        }
  
                        $this->t->set_var('value_urgency',$pri);
  
                        $this->t->set_var('lang_access',lang('Access'));
+                       $this->t->set_var('access',lang($values['access']));
  
                        
$this->t->set_var('history',$this->historylog->return_html(array(),'','',$GLOBALS['todo_id']));
***************
*** 450,454 ****
                function edit()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $todo_id;
  
                        if ($new_parent)
--- 513,517 ----
                function edit()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $todo_id, $assigned;
  
                        if ($new_parent)
***************
*** 468,471 ****
--- 531,543 ----
                  $values['id'] = $todo_id;
  
+                               if (is_array($assigned))
+                               {
+                                       $values['assigned'] = 
implode(',',$assigned);
+                                       if (count($assigned) > 1)
+                                       {
+                                               $values['assigned'] = ',' . 
$values['assigned'] . ',';
+                                       }
+                               }
+ 
                                $error = $this->bo->check_values($values);
                                if (is_array($error))
***************
*** 502,506 ****
  
                        
$this->t->set_var('cat_list',$this->cats->formated_list('select','all',$values['cat'],'True'));
!                       
$this->t->set_var('todo_list',$this->bo->select_todo_list($values['parent']));
  
                        
$this->t->set_var('descr',$GLOBALS['phpgw']->strip_html($values['descr']));
--- 574,578 ----
  
                        
$this->t->set_var('cat_list',$this->cats->formated_list('select','all',$values['cat'],'True'));
!                       
$this->t->set_var('todo_list',$this->formatted_todo($values['parent']));
  
                        
$this->t->set_var('descr',$GLOBALS['phpgw']->strip_html($values['descr']));
***************
*** 509,512 ****
--- 581,585 ----
                        
$this->t->set_var('pri_list',$this->sbox->getPriority('values[pri]',$values['pri']));
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',$values['status']));
+                       
$this->t->set_var('user_list',$this->formatted_user($this->bo->format_assigned($values['assigned'])));
  
                        if ($values['sdate'] == 0)




reply via email to

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