phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] calendar inc/class.bocalendar.inc.php inc/class...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] calendar inc/class.bocalendar.inc.php inc/class...
Date: Thu, 07 Dec 2006 15:18:15 +0000

CVSROOT:        /sources/phpgroupware
Module name:    calendar
Changes by:     Sigurd Nes <sigurdne>   06/12/07 15:18:15

Modified files:
        inc            : class.bocalendar.inc.php 
                         class.uicalendar.inc.php 
        templates/base : view.tpl 

Log message:
        various fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.bocalendar.inc.php?cvsroot=phpgroupware&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.uicalendar.inc.php?cvsroot=phpgroupware&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/calendar/templates/base/view.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: inc/class.bocalendar.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.bocalendar.inc.php,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- inc/class.bocalendar.inc.php        7 Dec 2006 11:50:51 -0000       1.112
+++ inc/class.bocalendar.inc.php        7 Dec 2006 15:18:15 -0000       1.113
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.bocalendar.inc.php,v 1.112 2006/12/07 11:50:51 sigurdne 
Exp $ */
+       /* $Id: class.bocalendar.inc.php,v 1.113 2006/12/07 15:18:15 sigurdne 
Exp $ */
 
        class bocalendar
        {
@@ -1389,6 +1389,7 @@
                 */
                function check_perms($needed, $event=0, $other=0)
                {
+
                        if ( $event === 0)
                        {
                                //convert back to phpgw account id for acls
@@ -1397,7 +1398,7 @@
                                                : $this->owner
                                        );
                */
-                               $owner = ($other > 0 ? 
$GLOBALS['phpgw']->accounts->search_person($other): 
$GLOBALS['phpgw_info']['user']['account_id']);
+                               $owner = ($other > 0 ? $other : 
$GLOBALS['phpgw_info']['user']['account_id']);
                        }
                        else
                        {
@@ -1409,7 +1410,8 @@
                                {
                                        return False;
                                }
-                               $owner = 
$GLOBALS['phpgw']->accounts->search_person($event['owner']);
+//                             $owner = 
$GLOBALS['phpgw']->accounts->search_person($event['owner']);
+                               $owner = $event['owner'];
                                $private = $event['public'] == False || 
$event['public'] == 0;
                        }
                        $user = $GLOBALS['phpgw_info']['user']['account_id'];
@@ -1457,7 +1459,7 @@
                        }
                        else
                        {
-                               $access = $user == $owner || $grants & $needed 
&& (!$private || $grants & PHPGW_ACL_PRIVATE);
+                               $access = $user == $owner || $grants & $needed 
&& ((!isset($private) || !$private) || $grants & PHPGW_ACL_PRIVATE);
                        }
                        //echo "<p>bo_calendar::check_perms for user $user and 
needed_acl $needed: event=$event[title]: owner=$owner, privat=$private, 
grants=$grants ==> access=$access is_group: {$this->is_group}</p>\n";
 

Index: inc/class.uicalendar.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.uicalendar.inc.php,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- inc/class.uicalendar.inc.php        7 Dec 2006 11:50:51 -0000       1.132
+++ inc/class.uicalendar.inc.php        7 Dec 2006 15:18:15 -0000       1.133
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.uicalendar.inc.php,v 1.132 2006/12/07 11:50:51 sigurdne 
Exp $ */
+       /* $Id: class.uicalendar.inc.php,v 1.133 2006/12/07 15:18:15 sigurdne 
Exp $ */
 
        class uicalendar
        {
@@ -2474,10 +2474,20 @@
                        $cat_color_div_start = '<div style="border-left:3px 
solid '.$cat_color.';padding:3px;">';
                        $cat_color_div_end = '</div>';
 
+                       if(isset($event['participants']) && 
is_array($event['participants']))
+                       {
+                               foreach ($event['participants'] as $participant 
=> $accept)
+                               {
+                                       $participants[] = 
$this->bo->contacts->get_name_of_person_id($participant);
+                               }
+                               $str_participants = implode(', ',$participants);
+                       }
+
                        switch 
($this->bo->prefs['calendar']['show_descrpt_ovr'])
                        {
                                case '0':
-                                       $text = '<span style="font-size: 
x-small; font-family:'.$this->theme['font'].'">' . $str_participants
+                                       $text = '<span style="font-size: 
x-small; font-family:'.$this->theme['font'].'"><pre>' . $str_participants
+                                               . $GLOBALS['phpgw']->browser->br
                                                . '<span style="white-space: 
nowrap;">'.$time.' </span> '
                                                . 
wordwrap($this->bo->get_short_field($event,$is_private,'title'), 30, 
$GLOBALS['phpgw']->browser->br, True)
                                                . $text
@@ -2486,6 +2496,7 @@
 
                                default:
                                        $text = '<span style="font-size: 
x-small; font-family:'.$this->theme['font'].'">' . $str_participants 
+                                               . $GLOBALS['phpgw']->browser->br
                                                . '<span style="white-space: 
nowrap;">'.$time.' </span> '
                                                . 
wordwrap($this->bo->get_short_field($event,$is_private,'title'), 30, 
$GLOBALS['phpgw']->browser->br, True)
                                                . $text.': <em>'
@@ -2867,10 +2878,15 @@
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_unknowns('keep');
                
-                       $p->set_file('month_day', 'month_day.tpl');
+                       $p->set_file(
+                               Array(
+                                       'month_header'  => 'month_header.tpl',
+                                       'month_day'     => 'month_day.tpl'
+                               )
+                       );
 
-                       
//$p->set_block('month_day','monthly_header','monthly_header');
-                       
//$p->set_block('month_day','month_column','month_column');
+                       
$p->set_block('month_header','monthly_header','monthly_header');
+                       
$p->set_block('month_header','month_column','month_column');
                        $p->set_block('month_day','month_daily','month_daily');
                        $p->set_block('month_day','day_event','day_event');
                        $p->set_block('month_day','event','event');
@@ -2886,6 +2902,7 @@
                                $p->set_var('column_data', 
$this->bo->contacts->get_name_of_person_id($owner));
                                $p->parse('column_header','month_column',True);
                        }
+
                        $today = 
date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
                        $daily = $this->set_week_array($startdate - 
$GLOBALS['phpgw']->datetime->tz_offset,$cellclass,$weekly);
                        foreach($daily as $date => $day_params)
@@ -2900,7 +2917,6 @@
                                $p->set_var($var);
                                if ($weekly || ($date >= $monthstart && $date 
<= $monthend))
                                {
-
                                        if ($day_params['new_event'])
                                        {
                                                $new_event_link = ' <a 
href="'.$this->page('add','&date='.$date).'">'
@@ -3046,7 +3062,7 @@
                        {
                                $this->index();
                        }
-
+//_debug_array($params);
                        $year = substr($params['date'],0,4);
                        $month = substr($params['date'],4,2);
                        $day = substr($params['date'],6,2);
@@ -3069,6 +3085,8 @@
 
                        $cellcolor = $this->theme['row_off'];
 
+//                     $true_printer_friendly = $this->bo->printer_friendly;
+
                        if(is_array($owners))
                        {
                                $display_name = True;
@@ -3088,6 +3106,7 @@
                           'cols'         => $cols,
                           'day_events'   => 
$this->week_header($month,$year,$display_name)
                        );
+
                        $this->output_template_array($p,'row','event',$var);
 
                        $tstart = $start - 
$GLOBALS['phpgw']->datetime->tz_offset;
@@ -3122,7 +3141,7 @@
                        }
 
                        $p = &$GLOBALS['phpgw']->template;
-
+                       $p->set_root(PHPGW_APP_TPL);
                        $p->set_file(
                                array(
                                        'view'  => 'view.tpl'
@@ -3135,7 +3154,6 @@
                        $vars = $this->bo->event2array($event);
 
                        $vars['title']['tr_color'] = $this->theme['th_bg'];
-
                        foreach($vars['participants']['data'] as $user => $str)
                        {
                                if 
($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user) && ereg('^(.*) 
\((.*)\)$',$str,$parts))
@@ -3145,11 +3163,14 @@
                        }
                        $vars['participants']['data'] = implode("<br 
/>\n",$vars['participants']['data']);
                        
+                       $j =0;
                        foreach($vars as $var)
                        {
                                if (strlen($var['data']))
                                {
+                                       $var['class'] = $j % 2 ? 'row_on' : 
'row_off';
                                        
$this->output_template_array($p,'row','list',$var);
+                                       $j ++;
                                }
                        }
 
@@ -3440,7 +3461,7 @@
                                        $k = ($j == 0 ? sprintf('%02d',$i).'<br 
/>':'').sprintf('%02d',$j*$increment);
                                        
                                        $str .= '<td align="left" 
bgcolor="'.$this->theme['bg_color'].'">'
-                                               . '<a 
href="'.$this->page('add','&date='.$date['full'].'&hour='.$i.'&minute='.(interval
 * $j))."\" onMouseOver=\"window.status='".$i.':'.(($increment * 
$j)<=9?'0':'').($increment * $j)."'; return true;\">"
+                                               . '<a 
href="'.$this->page('add','&date='.$date['full'].'&hour='.$i.'&minute='.($interval
 * $j))."\" onMouseOver=\"window.status='".$i.':'.(($increment * 
$j)<=9?'0':'').($increment * $j)."'; return true;\">"
                                                . $k."</a></td>\n";
                                }
                        }
@@ -3675,6 +3696,7 @@
                                $this->index();
                        }
 
+                       $str = '';
                        if(isset($param['event']))
                        {
                                $event = $param['event'];
@@ -3705,9 +3727,10 @@
                        $p->set_block('edit','hr','hr');
 
 // Recurrence Exeptions
-                       if ($event[recur_exception]>0)
+                       $recur_exception = '';
+                       if (isset($event['recur_exception']) && 
$event['recur_exception']>0)
                        {
-                               $recur_exception = implode (",", 
$event[recur_exception]);
+                               $recur_exception = implode (",", 
$event['recur_exception']);
                        }
        
                        //FIXME this is ugly and should use templates better
@@ -3719,7 +3742,7 @@
                                'common_hidden' => '<input type="hidden" 
name="cal[id]" value="'.$event['id'].'" />'."\n"
                                                                                
. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'" />'."\n"
                                                                                
. '<input type="hidden" name="recur_exception" value="'.$recur_exception.'" 
/>'."\n"
-                                                                               
. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden" 
name="cal[reference]" value="'.$_GET['cal_id'].'" />'."\n":
+                                                                               
. (isset($_GET['cal_id']) && $_GET['cal_id'] && $event['id'] == 0?'<input 
type="hidden" name="cal[reference]" value="'.$_GET['cal_id'].'" />'."\n":
                                                                                
  (@isset($event['reference'])?'<input type="hidden" name="cal[reference]" 
value="'.$event['reference'].'" />'."\n":''))
                                                                                
. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && 
$GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
                                                                                
  '<input type="hidden" name="participants[]" value="'.$this->bo->owner.'" 
/>'."\n":''),
@@ -3741,7 +3764,7 @@
                        );
 
 // Display Categories
-                       if(strpos($event['category'],','))
+                       if(isset($event['category']) && 
strpos($event['category'],','))
                        {
                                $temp_cats = explode(',',$event['category']);
                                @reset($temp_cats);
@@ -3750,7 +3773,7 @@
                                        $check_cats[] = intval($value);
                                }
                        }
-                       elseif($event['category'])
+                       elseif(isset($event['category']) && $event['category'])
                        {
                                $check_cats[] = intval($event['category']);
                        }
@@ -3875,10 +3898,10 @@
 
                        if ($event['id'] == 0) {
                                // get defaults
-                               $days = 
$this->bo->prefs['calendar']['default_email_days'];
-                               $hours = 
$this->bo->prefs['calendar']['default_email_hours'];
-                               $min = 
$this->bo->prefs['calendar']['default_email_min'];
-                               if (count($event['alarm']) > 1)
+                               $days = 
(isset($this->bo->prefs['calendar']['default_email_days'])?$this->bo->prefs['calendar']['default_email_days']:'');
+                               $hours = 
(isset($this->bo->prefs['calendar']['default_email_hours'])?$this->bo->prefs['calendar']['default_email_hours']:'');
+                               $min = 
(isset($this->bo->prefs['calendar']['default_email_min'])?$this->bo->prefs['calendar']['default_email_min']:'');
+                               if (isset($event['alarm']) && 
count($event['alarm']) > 1)
                                {
                                        // this should not happen because when 
creating a new event
                                        // only 1 alarm is displayed on the 
screen
@@ -3987,7 +4010,7 @@
                        $preserved = False;
                        foreach($this->fields as $field => $data)
                        {
-                               if (!$data['disabled'])
+                               if (!isset($data['disabled']) || 
!$data['disabled'])
                                {
                                        if (isset($var[$field]))
                                        {

Index: templates/base/view.tpl
===================================================================
RCS file: /sources/phpgroupware/calendar/templates/base/view.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/view.tpl     28 Jul 2006 03:30:43 -0000      1.1
+++ templates/base/view.tpl     7 Dec 2006 15:18:15 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: view.tpl,v 1.1 2006/07/28 03:30:43 skwashd Exp $ -->
+<!-- $Id: view.tpl,v 1.2 2006/12/07 15:18:15 sigurdne Exp $ -->
 <!-- BEGIN view_event -->
 <center>
  <table border="0" width="90%">
@@ -12,7 +12,7 @@
 </center>
 <!-- END view_event -->
 <!-- BEGIN list -->
-  <tr bgcolor="{tr_color}">
+  <tr class="{class}">
    <td valign="top" width="30%">&nbsp;<b>{field}:</b></td>
    <td colspan="2" valign="top" width="70%">{data}</td>
   </tr>




reply via email to

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