phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.2.21, 1.42.2.5.2.22 class.soprojects.inc.php, 1.34.2.6.2.22, 1.34.2.6.2.23 class.uiprojects.inc.php, 1.47.2.7.2.24, 1.47.2.7.2.25
Date: Sat, 26 Jul 2003 18:31:27 -0400

Update of /cvsroot/phpgroupware/projects/inc
In directory subversions:/tmp/cvs-serv8138/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boprojects.inc.php class.soprojects.inc.php 
        class.uiprojects.inc.php 
Log Message:
update

Index: class.boprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.42.2.5.2.21
retrieving revision 1.42.2.5.2.22
diff -C2 -r1.42.2.5.2.21 -r1.42.2.5.2.22
*** class.boprojects.inc.php    25 Jul 2003 23:00:36 -0000      1.42.2.5.2.21
--- class.boprojects.inc.php    26 Jul 2003 22:31:25 -0000      1.42.2.5.2.22
***************
*** 841,844 ****
--- 841,910 ----
                        $this->so->change_owner($old, $new);
                }
+ 
+               function get_mstones($project_id)
+               {
+                       $mstones = $this->so->get_mstones($project_id);
+ 
+                       while (is_array($mstones) && list(,$ms) = 
each($mstones))
+                       {
+                               $stones[] = array
+                               (
+                                       'title'         => 
$GLOBALS['phpgw']->strip_html($ms['title']),
+                                       'edate'         => $ms['edate'],
+                                       's_id'          => $ms['s_id']
+                               );
+                       }
+                       return $stones;
+               }
+ 
+               function get_single_mstone($s_id)
+               {
+                       return $this->so->get_single_mstone($s_id);
+               }
+ 
+               function save_mstone($values)
+               {
+                       $values['edate'] = 
mktime(0,0,0,$values['emonth'],$values['eday'],$values['eyear']);
+ 
+                       if ($values['s_id'] && $values['s_id'] > 0)
+                       {
+                               $this->so->edit_mstone($values);
+                       }
+                       else
+                       {
+                               return $this->so->add_mstone($values);
+                       }
+               }
+ 
+               function delete_mstone($s_id)
+               {
+                       $this->so->delete_mstone($s_id);
+               }
+ 
+               function formatted_edate($edate = '')
+               {
+                       $edate = intval($edate);
+ 
+                       $month  = 
$GLOBALS['phpgw']->common->show_date(time(),'n');
+                       $day    = 
$GLOBALS['phpgw']->common->show_date(time(),'d');
+                       $year   = 
$GLOBALS['phpgw']->common->show_date(time(),'Y');
+ 
+                       if ($edate > 0)
+                       {
+                               $edate = $edate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
+                               $edateout = 
$GLOBALS['phpgw']->common->show_date($edate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       }
+ 
+                       if (mktime(2,0,0,$month,$day,$year) == $edate)
+                       {
+                               $edateout = '<b>' . $edateout . '</b>';
+                       }
+                       if (mktime(2,0,0,$month,$day,$year) >= $edate)
+                       {
+                               $edateout = '<font color="CC0000"><b>' . 
$edateout . '</b></font>';
+                       }
+ 
+                       return $edateout;
+               }
        }
  ?>

Index: class.soprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.soprojects.inc.php,v
retrieving revision 1.34.2.6.2.22
retrieving revision 1.34.2.6.2.23
diff -C2 -r1.34.2.6.2.22 -r1.34.2.6.2.23
*** class.soprojects.inc.php    25 Jul 2003 23:00:37 -0000      1.34.2.6.2.22
--- class.soprojects.inc.php    26 Jul 2003 22:31:25 -0000      1.34.2.6.2.23
***************
*** 1262,1265 ****
--- 1262,1314 ----
                        }
                }
+ 
+               function get_mstones($project_id = '')
+               {
+                       $this->db->query("SELECT * FROM phpgw_p_mstones WHERE 
project_id=" . intval($project_id),__LINE__,__FILE__);
+ 
+                       while($this->db->next_record())
+                       {
+                               $stones[] = array
+                               (
+                                       's_id'  => $this->db->f('s_id'),
+                                       'title' => $this->db->f('title'),
+                                       'edate' => $this->db->f('edate')
+                               );
+                       }
+                       return $stones;
+               }
+ 
+               function get_single_mstone($s_id = '')
+               {
+                       $this->db->query("SELECT * FROM phpgw_p_mstones WHERE 
s_id=" . intval($s_id),__LINE__,__FILE__);
+ 
+                       if($this->db->next_record())
+                       {
+                               $stone = array
+                               (
+                                       's_id'  => $this->db->f('s_id'),
+                                       'title' => $this->db->f('title'),
+                                       'edate' => $this->db->f('edate')
+                               );
+                       }
+                       return $stone;
+               }
+ 
+               function add_mstone($values)
+               {
+                       $this->db->query('INSERT into phpgw_p_mstones 
(project_id,title,edate) VALUES (' . intval($values['project_id']) . ",'"
+                                                       . 
$this->db->db_addslashes($values['title']) . "'," . intval($values['edate']) . 
')',__LINE__,__FILE__);
+               }
+ 
+               function edit_mstone($values)
+               {
+                       $this->db->query('UPDATE phpgw_p_mstones set edate=' . 
intval($values['edate']) . ", title='" . 
$this->db->db_addslashes($values['title']) . "' "
+                                                       . 'WHERE s_id=' . 
intval($values['s_id']),__LINE__,__FILE__);
+               }
+ 
+               function delete_mstone($s_id = '')
+               {
+                       $this->db->query('DELETE from phpgw_p_mstones where 
s_id=' . intval($s_id),__LINE__,__FILE__);
+               }
        }
  ?>

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.47.2.7.2.24
retrieving revision 1.47.2.7.2.25
diff -C2 -r1.47.2.7.2.24 -r1.47.2.7.2.25
*** class.uiprojects.inc.php    25 Jul 2003 23:00:37 -0000      1.47.2.7.2.24
--- class.uiprojects.inc.php    26 Jul 2003 22:31:25 -0000      1.47.2.7.2.25
***************
*** 53,57 ****
                        'accounts_popup'        => True,
                        'list_budget'           => True,
!                       'view_pcosts'           => True
                );
  
--- 53,58 ----
                        'accounts_popup'        => True,
                        'list_budget'           => True,
!                       'view_pcosts'           => True,
!                       'edit_mstone'           => True
                );
  
***************
*** 146,149 ****
--- 147,153 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('cancel'));
                        
$GLOBALS['phpgw']->template->set_var('lang_search',lang('search'));
+ 
+                       
$GLOBALS['phpgw']->template->set_var('lang_add_milestone',lang('add 
milestone'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones'));
                }
  
***************
*** 310,330 ****
              {
                                
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
! 
!                               $month  = 
$GLOBALS['phpgw']->common->show_date(time(),'n');
!                               $day    = 
$GLOBALS['phpgw']->common->show_date(time(),'d');
!                               $year   = 
$GLOBALS['phpgw']->common->show_date(time(),'Y');
! 
!                               $edate = $pro[$i]['edate'];
!                               if ($edate == 0)
!                               {
!                                       $edateout = '&nbsp;';
!                               }
!                               else
!                               {
!                                       $edate = $edate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
!                                       $edateout = 
$GLOBALS['phpgw']->common->show_date($edate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
!                                       if (mktime(2,0,0,$month,$day,$year) == 
$edate) { $edateout = '<b>' . $edateout . '</b>'; }
!                                       if (mktime(2,0,0,$month,$day,$year) >= 
$edate) { $edateout = '<font color="CC0000"><b>' . $edateout . '</b></font>'; }
!                               }
  
                                if ($action == 'mains')
--- 314,318 ----
              {
                                
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
!                               $edateout = 
$this->bo->formatted_edate($pro[$i]['edate']);
  
                                if ($action == 'mains')
***************
*** 350,354 ****
                                        'td_action'             => $td_action,
                                        'title'                 => $spaceset . 
($pro[$i]['title']?$pro[$i]['title']:'&nbsp;'),
!                                       'end_date'              => $edateout,
                                        'coordinator'   => 
$pro[$i]['coordinatorout']
                                ));
--- 338,342 ----
                                        'td_action'             => $td_action,
                                        'title'                 => $spaceset . 
($pro[$i]['title']?$pro[$i]['title']:'&nbsp;'),
!                                       'end_date'              => 
(isset($pro[$i]['edate'])?$edateout:'&nbsp;'),
                                        'coordinator'   => 
$pro[$i]['coordinatorout']
                                ));
***************
*** 520,523 ****
--- 508,517 ----
                        }
  
+                       if($_POST['mstone'])
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.edit_mstone';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+ 
                        if ($action == 'mains' || $action == 'amains')
                        {
***************
*** 534,539 ****
                        
$GLOBALS['phpgw']->template->set_block('edit_form','clist','clisthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','cfield','cfieldhandle');
! 
                        $nopref = $this->bo->check_prefs();
                        if (is_array($nopref))
                        {
--- 528,536 ----
                        
$GLOBALS['phpgw']->template->set_block('edit_form','clist','clisthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','cfield','cfieldhandle');
!                       
$GLOBALS['phpgw']->template->set_block('edit_form','msfield1','msfield1handle');
!                       
$GLOBALS['phpgw']->template->set_block('edit_form','msfield2','msfield2handle');
!                       
$GLOBALS['phpgw']->template->set_block('edit_form','mslist','mslisthandle');
                        $nopref = $this->bo->check_prefs();
+ 
                        if (is_array($nopref))
                        {
***************
*** 572,575 ****
--- 569,587 ----
                                        $values['syear'] = 
date('Y',$values['sdate']);
                                }
+ 
+                               
$GLOBALS['phpgw']->template->fp('msfield1handle','msfield1',True);
+                               $mstones = $this->bo->get_mstones($project_id);
+ 
+                               $link_data['menuaction'] = 
'projects.uiprojects.edit_mstone';
+ 
+                               while (is_array($mstones) && list(,$ms) = 
each($mstones))
+                               {
+                                       $link_data['s_id'] = $ms['s_id'];
+                                       
$GLOBALS['phpgw']->template->set_var('s_title',$ms['title']);
+                                       
$GLOBALS['phpgw']->template->set_var('mstone_edit_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                                       
$GLOBALS['phpgw']->template->set_var('s_edateout',$this->bo->formatted_edate($ms['edate']));
+                                       
$GLOBALS['phpgw']->template->fp('mslisthandle','mslist',True);
+                               }
+                               
$GLOBALS['phpgw']->template->fp('msfield2handle','msfield2',True);
                        }
                        else
***************
*** 762,765 ****
--- 774,778 ----
  
                        $GLOBALS['phpgw']->template->set_file(array('view' => 
'view.tpl'));
+                       
$GLOBALS['phpgw']->template->set_block('view','mslist','mslisthandle');
  
                        $nopref = $this->bo->check_prefs();
***************
*** 862,865 ****
--- 875,890 ----
                        
$GLOBALS['phpgw']->template->set_var('customer',$customerout);
  
+                       $mstones = $this->bo->get_mstones($project_id);
+                       //$link_data['menuaction'] = 
'projects.uiprojects.edit_mstone';
+ 
+                       while (is_array($mstones) && list(,$ms) = 
each($mstones))
+                       {
+                               //$link_data['s_id'] = $ms['s_id'];
+                               
$GLOBALS['phpgw']->template->set_var('s_title',$ms['title']);
+                               
//$GLOBALS['phpgw']->template->set_var('mstone_edit_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                               
$GLOBALS['phpgw']->template->set_var('s_edateout',$this->bo->formatted_edate($ms['edate']));
+                               
$GLOBALS['phpgw']->template->fp('mslisthandle','mslist',True);
+                       }
+ 
                        $GLOBALS['phpgw']->template->pfp('out','view');
                        $GLOBALS['phpgw']->hooks->process(array(
***************
*** 1902,1905 ****
--- 1927,2008 ----
                        }
                        
$GLOBALS['phpgw']->template->pfp('out','projects_list_t',True);
+               }
+ 
+               function edit_mstone()
+               {
+                       $action         = get_var('action',array('GET','POST'));
+                       $s_id           = get_var('s_id',array('GET','POST'));
+                       $project_id     = 
get_var('project_id',array('GET','POST'));
+                       $values         = get_var('values',array('POST'));
+ 
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uiprojects.edit_project',
+                               'action'                => $action,
+                               'project_id'    => $project_id,
+                               's_id'                  => $s_id
+                       );
+ 
+                       if ($_POST['save'])
+                       {
+                               $values['s_id']                 = $s_id;
+                               $values['project_id']   = $project_id;
+                               $this->bo->save_mstone($values);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+ 
+                       if ($_POST['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+ 
+                       if ($_POST['delete'])
+                       {
+                               $this->bo->delete_mstone($values);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+ 
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . (isset($s_id)?lang('edit milestone'):lang('add 
milestone'));
+                       $this->display_app_header();
+ 
+                       
$GLOBALS['phpgw']->template->set_file(array('mstone_edit' => 
'form_mstone.tpl'));
+ 
+                       if($s_id)
+                       {
+                               $values = $this->bo->get_single_mstone($s_id);
+ 
+                               //if 
($this->bo->check_perms($this->grants[$values['coordinator']],PHPGW_ACL_DELETE) 
|| $values['coordinator'] == $this->account)
+                               //{
+                               
$GLOBALS['phpgw']->template->set_var('delete','<input type="submit" 
name="delete" value="' . lang('Delete') .'">');
+                               /*}
+                               else
+                               {
+                                       
$GLOBALS['phpgw']->template->set_var('delete','&nbsp;');
+                               }*/
+                       }
+ 
+                       $link_data['menuaction'] = 
'projects.uiprojects.edit_mstone';
+                       
$GLOBALS['phpgw']->template->set_var('edit_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+ 
+                       
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw']->strip_html($values['title']));
+ 
+                       if (!$values['edate'])
+                       {
+                               $values['emonth'] = date('m',time());
+                               $values['eday'] = date('d',time());
+                               $values['eyear'] = date('Y',time());
+                       }
+                       else
+                       {
+                               $values['eday'] = date('d',$values['edate']);
+                               $values['emonth'] = date('m',$values['edate']);
+                               $values['eyear'] = date('Y',$values['edate']);
+                       }
+ 
+                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[eyear]',$values['eyear']),
+                                                                               
                                                                                
                        
$this->sbox->getMonthText('values[emonth]',$values['emonth']),
+                                                                               
                                                                                
                        $this->sbox->getDays('values[eday]',$values['eday'])));
+ 
+                       $GLOBALS['phpgw']->template->pfp('out','mstone_edit');
                }
        }





reply via email to

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