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.54, 1.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.54, 1.55 class.uiprojects.inc.php, 1.67, 1.68
Date: Sun, 14 Sep 2003 20:53:31 -0400

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

Modified Files:
        class.boprojects.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.54
retrieving revision 1.55
diff -C2 -r1.54 -r1.55
*** class.boprojects.inc.php    12 Sep 2003 00:07:11 -0000      1.54
--- class.boprojects.inc.php    15 Sep 2003 00:53:28 -0000      1.55
***************
*** 234,238 ****
                                $prefs['allsize'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['allsize'];
                                $prefs['notify_mstone'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_mstone'];
!                               $prefs['notify_task'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_task'];
                                $prefs['notify_assign'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_assign'];
                        }
--- 234,238 ----
                                $prefs['allsize'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['allsize'];
                                $prefs['notify_mstone'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_mstone'];
!                               $prefs['notify_pro'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_pro'];
                                $prefs['notify_assign'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_assign'];
                        }
***************
*** 253,257 ****
                                
$GLOBALS['phpgw']->preferences->change('projects','allsize',$prefs['allsize']);
                                
$GLOBALS['phpgw']->preferences->change('projects','notify_mstone',(isset($prefs['notify_mstone'])?'yes':''));
!                               
$GLOBALS['phpgw']->preferences->change('projects','notify_task',(isset($prefs['notify_task'])?'yes':''));
                                
$GLOBALS['phpgw']->preferences->change('projects','notify_assign',(isset($prefs['notify_assign'])?'yes':''));
  
--- 253,257 ----
                                
$GLOBALS['phpgw']->preferences->change('projects','allsize',$prefs['allsize']);
                                
$GLOBALS['phpgw']->preferences->change('projects','notify_mstone',(isset($prefs['notify_mstone'])?'yes':''));
!                               
$GLOBALS['phpgw']->preferences->change('projects','notify_pro',(isset($prefs['notify_pro'])?'yes':''));
                                
$GLOBALS['phpgw']->preferences->change('projects','notify_assign',(isset($prefs['notify_assign'])?'yes':''));
  
***************
*** 300,307 ****
                        $prefs['country']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
  
! 
!                       if ($this->isprojectadmin('pad') || 
$this->isprojectadmin('pbo'))
                        {
!                               if 
($GLOBALS['phpgw_info']['user']['preferences']['projects'])
                                {
                                        $prefs['abid']          = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['abid'];
--- 300,306 ----
                        $prefs['country']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
  
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['projects'])
                        {
!                               if ($this->isprojectadmin('pad') || 
$this->isprojectadmin('pbo'))
                                {
                                        $prefs['abid']          = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['abid'];
***************
*** 311,318 ****
                                        $prefs['mysize']        = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['mysize'];
                                        $prefs['allsize']       = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['allsize'];
-                                       $prefs['notify_mstone'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_mstone'];
-                                       $prefs['notify_task']   = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_task'];
-                                       $prefs['notify_assign'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_assign'];
                                }
                        }
                        return $prefs;
--- 310,317 ----
                                        $prefs['mysize']        = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['mysize'];
                                        $prefs['allsize']       = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['allsize'];
                                }
+                               $prefs['notify_mstone'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_mstone'];
+                               $prefs['notify_pro']    = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_pro'];
+                               $prefs['notify_assign'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_assign'];
                        }
                        return $prefs;
***************
*** 995,1001 ****
                }
  
!               function send_alarm($values)
                {
  
                }
        }
--- 994,1086 ----
                }
  
!               function send_alarm($type = 'assign',$values)
                {
+                       $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences();
+                       $sender = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
+                       //$msgtype = '"projects";';
+ 
+                       switch($type)
+                       {
+                               case 'assign':
+                                       $subject = lang('assignment to project 
%1',$values['title']);
+                                       $msg = lang('assignment to project %1, 
ID: %2',$values['title'], $values['number']);
+                                       break;
+                               case 'update':
+                                       $subject = lang('project %1 has been 
updated',$values['title']);
+                                       $msg = lang('project %1 has been 
updated',$values['title']);
+                                       break;
+                               case 'mstone':
+                                       $action = lang('date due of milestone 
%1 of project %2 has been updated', $values['m_title'],$values['title']);
+                                       $msg = lang('new date due of milestone 
%1: %2', $values['m_title'], $values['edateformatted']);
+                                       break;
+                       }
+ 
+                       if(!is_object($GLOBALS['phpgw']->send))
+                       {
+                               $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
+                       }
+ 
+                       for($i=0;$i<count($values['employees']);$i++)
+                       {
+                               //$GLOBALS['phpgw']->preferences->account_id = 
$values['employees'][$i];
+                               
//$GLOBALS['phpgw']->preferences->read_repository();
+ 
+                               $prefs = 
CreateObject('phpgwapi.preferences',$values['employees'][$i]);
+                               $prefs->read_repository();
+ 
+                               switch($type)
+                               {
+                                       case 'assign':
+                                               if 
($GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_assign'] == 
'yes')
+                                               {
+                                                       $to_notify = True;
+                                               }
+                                               break;
+                                       case 'pro':
+                                               
if($GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_pro'] == 
'yes')
+                                               {
+                                                       $to_notify = True;
+                                               }
+                                               break;
+                                       case 'mstone':
+                                               
if($GLOBALS['phpgw_info']['user']['preferences']['projects']['notify_mstone'] 
== 'yes')
+                                               {
+                                                       $to_notify = True;
+                                               }
+                                               break;
+                               }
+ 
+                               if($to_notify)
+                               {
+                                       /*print_debug('Msg Type',$msg_type);
+                                       print_debug('UserID',$userid);
+ 
+                                       
$GLOBALS['phpgw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']);
+                                       $details['to-fullname'] = 
$GLOBALS['phpgw']->common->display_fullname('',$details['to-firstname'],$details['to-lastname']);*/
+ 
+                                       $to = 
$prefs->email_address($values['employees'][$i]);
+                                       /*if (empty($to) || $to[0] == '@' || 
$to[0] == '$')     // we have no valid email-address
+                                       {
+                                               //echo 
"<p>boprojects::send_update: Empty email adress for user 
'".$details['to-fullname']."' ==> ignored !!!</p>\n";
+                                               continue;
+                                       }
+                                       print_debug('Email being sent 
to',$to);*/
  
+                                       $subject = 
$GLOBALS['phpgw']->send->encode_subject($subject);
+ 
+                                       $returncode = 
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$msg,''/*$msgtype*/,'','','',$sender);
+                                       //echo "<p>send(to='$to', 
sender='$sender'<br>subject='$subject') 
returncode=$returncode<br>".nl2br($body)."</p>\n";
+ 
+                                       if (!$returncode)       // not nice, 
but better than failing silently
+                                       {
+                                               echo 
'<p><b>boprojects::send_alarm</b>: '.lang("Failed sending message to '%1' #%2 
subject='%3', sender='%4' 
!!!",$to,$values['employees'][$i],htmlspecialchars($subject), $sender)."<br>\n";
+                                               echo 
'<i>'.$GLOBALS['phpgw']->send->err['desc']."</i><br>\n";
+                                               echo lang('This is mostly 
caused by a not or wrongly configured SMTP server. Notify your 
administrator.')."</p>\n";
+                                               echo '<p>'.lang('Click %1here%2 
to return to projects.','<a 
href="'.$GLOBALS['phpgw']->link('/projects/').'">','</a>')."</p>\n";
+                                       }
+                               }
+                       }
+                       //unset($send);
+                       return $returncode;
                }
        }

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -r1.67 -r1.68
*** class.uiprojects.inc.php    12 Sep 2003 00:07:11 -0000      1.67
--- class.uiprojects.inc.php    15 Sep 2003 00:53:28 -0000      1.68
***************
*** 150,153 ****
--- 150,156 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_search',lang('search'));
  
+                       
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent project'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_main',lang('Main project'));
+ 
                        
$GLOBALS['phpgw']->template->set_var('lang_add_milestone',lang('add 
milestone'));
                        
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones'));
***************
*** 841,844 ****
--- 844,848 ----
  
                        $GLOBALS['phpgw']->template->set_file(array('view' => 
'view.tpl'));
+                       
$GLOBALS['phpgw']->template->set_block('view','sub','subhandle');
                        
$GLOBALS['phpgw']->template->set_block('view','mslist','mslisthandle');
  
***************
*** 890,911 ****
                                
$GLOBALS['phpgw']->template->set_var('pcosts',$values['pcosts']);
                        }
!                       else
                        {
!                               if ($pro_main && $action == 'subs')
!                               {
!                                       $main = 
$this->bo->read_single_project($pro_main);
  
!                                       
$GLOBALS['phpgw']->template->set_var('pro_main',$GLOBALS['phpgw']->strip_html($main['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($main['title']));
!                                       
$GLOBALS['phpgw']->template->set_var('cat',$this->bo->cats->id2name($main['cat']));
!                                       
$GLOBALS['phpgw']->template->set_var('investment_nr',($main['investment_nr']?$main['investment_nr']:'&nbsp;'));
!                                       
$GLOBALS['phpgw']->template->set_var('pcosts',$parent['pcosts']);
!                               }
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Job ID'));
-                               
$GLOBALS['phpgw']->template->set_var('lang_main',lang('Main project'));
  
!                               
//$GLOBALS['phpgw']->template->set_var('pro_parent',$GLOBALS['phpgw']->strip_html($main['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($main['title']));      
!                               
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent project'));
                        }
  
                        
$GLOBALS['phpgw']->template->set_var('number',$GLOBALS['phpgw']->strip_html($values['number']));
                        
$GLOBALS['phpgw']->template->set_var('title',($values['title']?$values['title']:'&nbsp;'));
--- 894,915 ----
                                
$GLOBALS['phpgw']->template->set_var('pcosts',$values['pcosts']);
                        }
!                       else if($pro_main && $action == 'subs')
                        {
!                               $main = 
$this->bo->read_single_project($pro_main);
  
!                               
$GLOBALS['phpgw']->template->set_var('pro_main',$GLOBALS['phpgw']->strip_html($main['title'])
 . ' [' . $GLOBALS['phpgw']->strip_html($main['number']) . ']');
!                               
$GLOBALS['phpgw']->template->set_var('cat',$this->bo->cats->id2name($main['cat']));
!                               
$GLOBALS['phpgw']->template->set_var('investment_nr',($main['investment_nr']?$main['investment_nr']:'&nbsp;'));
!                               
$GLOBALS['phpgw']->template->set_var('pcosts',$main['pcosts']);
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Job ID'));
  
!                               
$GLOBALS['phpgw']->template->set_var('pro_parent',$this->bo->return_value('pro',$values['parent']));
    
!                               
$GLOBALS['phpgw']->template->fp('subhandle','sub',True);
                        }
  
+                       if ($values['previous'])
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('previous',$this->bo->return_value('pro',$values['previous']));
    
+                       }
                        
$GLOBALS['phpgw']->template->set_var('number',$GLOBALS['phpgw']->strip_html($values['number']));
                        
$GLOBALS['phpgw']->template->set_var('title',($values['title']?$values['title']:'&nbsp;'));
***************
*** 914,917 ****
--- 918,922 ----
                        
$GLOBALS['phpgw']->template->set_var('budget',$values['budget']);
                        
$GLOBALS['phpgw']->template->set_var('currency',$prefs['currency']);
+ 
                        $month = $this->bo->return_date();
                        
$GLOBALS['phpgw']->template->set_var('month',$month['monthformatted']);
***************
*** 1539,1551 ****
                        
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_mstone',lang('would you like 
to get notified via email about changes of milestones date due'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_task',lang('would you like to 
get notified via email about changes of tasks'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_assign',lang('would you like 
to get notified via email if you get assigned to a project'));
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_notifications',lang('notifications'));
  
                        $prefs = $this->bo->read_prefs();
                        
$GLOBALS['phpgw']->template->set_var('notify_mstone_selected',($prefs['notify_mstone']
 == 'yes'? ' checked':''));
!                       
$GLOBALS['phpgw']->template->set_var('notify_task_selected',($prefs['notify_task']
 == 'yes'? ' checked':''));
                        
$GLOBALS['phpgw']->template->set_var('notify_assign_selected',($prefs['notify_assign']
 == 'yes'? ' checked':''));
  
--- 1544,1556 ----
                        
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_mstone',lang('would you like 
to get notified if milestones date due change'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_pro',lang('would you like to 
get notified if projects data get updated'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_notify_assign',lang('would you like 
to get notified if you get assigned to a project'));
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_notifications',lang('email 
notifications'));
  
                        $prefs = $this->bo->read_prefs();
                        
$GLOBALS['phpgw']->template->set_var('notify_mstone_selected',($prefs['notify_mstone']
 == 'yes'? ' checked':''));
!                       
$GLOBALS['phpgw']->template->set_var('notify_pro_selected',($prefs['notify_pro']
 == 'yes'? ' checked':''));
                        
$GLOBALS['phpgw']->template->set_var('notify_assign_selected',($prefs['notify_assign']
 == 'yes'? ' checked':''));
  





reply via email to

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