From e7ac2f14ed642a41b0c078784af5d55fbcee3435 Mon Sep 17 00:00:00 2001
From: skeeter <skeeter@alumni.egroupware.org>
Date: Fri, 19 Apr 2002 14:02:31 +0000
Subject: [PATCH] Small fixes, GNU Patch #264, and now puts printer friendly
 format with more details.

---
 calendar/inc/class.bocalendar.inc.php |  8 +++-----
 calendar/inc/class.uicalendar.inc.php | 12 ++++++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php
index dbfab38c90..146296e60d 100755
--- a/calendar/inc/class.bocalendar.inc.php
+++ b/calendar/inc/class.bocalendar.inc.php
@@ -130,7 +130,6 @@
 		function bocalendar($session=0)
 		{
 			$this->grants = $GLOBALS['phpgw']->acl->get_grants('calendar');
-
 			@reset($this->grants);
 			if($this->debug)
 			{
@@ -205,7 +204,6 @@
 				)
 			);
 			$this->datetime = $this->so->datetime;
-			
 			$localtime = $this->datetime->gmtnow + $this->datetime->tz_offset;
 
 			$date = get_var('date',Array('HTTP_GET_VARS','HTTP_POST_VARS'));
@@ -374,7 +372,7 @@
 			{
 				echo '<!-- '."\n".'Read:'."\n"._debug_array($data,False)."\n".' -->'."\n";
 			}
-			
+
 			$this->filter = $data['filter'];
 			$this->cat_id = $data['cat_id'];
 			$this->owner  = intval($data['owner']);
@@ -1235,11 +1233,11 @@
 
 		function get_short_field($event,$is_private=True,$field='')
 		{
-			if ($is_private)
+			if($is_private)
 			{
 				return 'private';
 			}
-			elseif (strlen($event[$field]) > 19)
+			elseif(strlen($event[$field]) > 19 && !$this->printer_friendly)
 			{
 				return substr($event[$field], 0 , 19) . '...';
 			}
diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php
index 6c3db44def..8ff65f2afd 100755
--- a/calendar/inc/class.uicalendar.inc.php
+++ b/calendar/inc/class.uicalendar.inc.php
@@ -1947,7 +1947,7 @@
 				. '  .event-on { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
 				. '  .event-off { background: '.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
 				. '  .event-holiday { background: '.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
-				. '  .time { background: '.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 65%/100% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px '.$this->theme['navbar_text'].'; vertical-align: middle; }'."\n"
+				. '  .time { background: '.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 65%/100% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px '.$this->theme['navbar_text'].'; vertical-align: middle }'."\n"
 				. '  .tablecell { width: 80px; height: 80px }';
 		}
 
@@ -2021,13 +2021,13 @@
 			{
 				$time = '';
 			}
-			$text = '';;
+			$text = '';
 			if(!$is_private)
 			{
 				$text .= $this->bo->display_status($event['users_status']);
 			}
 			$text = '<font size="-2" face="'.$this->theme['font'].'"><nobr>'.$time.'</nobr>&nbsp;'.$this->bo->get_short_field($event,$is_private,'title').$text.'</font>'.$GLOBALS['phpgw']->browser->br;
-		
+
 			if ($editable)
 			{
 				$date = sprintf('%04d%02d%02d',$year,$month,$day);
@@ -2099,6 +2099,10 @@
 					$this->output_template_array($p,'picture','pict',$var);
 				}
 			}
+			else
+			{
+				$text .= '<font size="-2" face="'.$this->theme['font'].'">'.nl2br($this->bo->get_short_field($event,$is_private,'description')).'</font>'.$GLOBALS['phpgw']->browser->br;
+			}
 			if ($text)
 			{
 				$var = Array(
@@ -2563,7 +2567,7 @@
 
 		function view_event($event,$alarms=False)
 		{
-			if(!$event['participants'][$this->bo->owner] && !$this->bo->member_of_group())
+			if((!$event['participants'][$this->bo->owner] && !$this->bo->member_of_group()) || (!$event['public'] && !$this->bo->check_perms(PHPGW_ACL_PRIVATE)))
 			{
 				return '<center>'.lang('You do not have permission to read this record!').'</center>';
 			}