diff options
| author | Nick Palmer <nick@sluggardy.net> | 2007-04-05 18:33:12 +0000 |
|---|---|---|
| committer | Nick Palmer <nick@sluggardy.net> | 2007-04-05 18:33:12 +0000 |
| commit | 16f093924f550889173b5cfaeb0e7aee50ea12d1 (patch) | |
| tree | 1e110463f08b279ad8f7443c4990fbcbbb859455 | |
| parent | a4ba68fca33a1532c95b30eafa5883d21edb96a1 (diff) | |
| download | calendar-16f093924f550889173b5cfaeb0e7aee50ea12d1.tar.gz calendar-16f093924f550889173b5cfaeb0e7aee50ea12d1.tar.bz2 calendar-16f093924f550889173b5cfaeb0e7aee50ea12d1.zip | |
Added better integration with events at the expense of queries. Will ajaxify sometime soon to reduce the cost. Added p_calendar_view_changes which needs to be on for users to use the calendar the old way.
| -rw-r--r-- | Calendar.php | 4 | ||||
| -rw-r--r-- | admin/schema_inc.php | 1 | ||||
| -rw-r--r-- | index.php | 24 | ||||
| -rw-r--r-- | templates/calendar.tpl | 11 | ||||
| -rw-r--r-- | templates/calendar_box.tpl | 9 | ||||
| -rw-r--r-- | templates/calendar_nav_inc.tpl | 4 |
6 files changed, 43 insertions, 10 deletions
diff --git a/Calendar.php b/Calendar.php index 6c7ffe2..01ee4bf 100644 --- a/Calendar.php +++ b/Calendar.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.35 2007/02/27 17:33:02 lsces Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.36 2007/04/05 18:33:12 nickpalmer Exp $ * @package calendar */ @@ -42,6 +42,7 @@ class Calendar extends LibertyContent { **/ function getList( $pListHash ) { $ret = array(); + $pListHash['include_data'] = TRUE; if( $this->prepGetList( $pListHash ) ) { include_once( LIBERTY_PKG_PATH.'LibertyContent.php' ); $content = new LibertyContent(); @@ -55,6 +56,7 @@ class Calendar extends LibertyContent { $item['created'] = $item['created'] + $this->display_offset;; $item['last_modified'] = $item['last_modified'] + $this->display_offset;; $item['event_time'] = $item['event_time'] + $this->display_offset;; + $item['parsed'] = $content->parseData($item['data'], $item['format_guid']); $dstart = $this->mDate->gmmktime( 0, 0, 0, $this->mDate->date( "m", $item['timestamp'], true ), $this->mDate->date( "d", $item['timestamp'], true ), $this->mDate->date( "Y", $item['timestamp'], true ) ); $ret[$dstart][] = $item; } diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 82b0eb6..58c0129 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -18,6 +18,7 @@ $gBitInstaller->registerPreferences( KERNEL_PKG_NAME, array( // ### Default User Permissions $gBitInstaller->registerUserPermissions( CALENDAR_PKG_NAME, array( array('p_calendar_view', 'Can browse the calendar', 'basic', CALENDAR_PKG_NAME), + array('p_calendar_view_changes', 'Can browse content changes in the calendar', 'editor', CALENDAR_PKG_NAME), ) ); // this empty table registration is needed for the installer to pick it up to install the preferences @@ -1,6 +1,6 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_calendar/index.php,v 1.45 2007/02/27 17:33:02 lsces Exp $ +// $Header: /cvsroot/bitweaver/_bit_calendar/index.php,v 1.46 2007/04/05 18:33:12 nickpalmer Exp $ // Copyright( c ) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See copyright.txt for details and a complete list of authors. @@ -62,8 +62,12 @@ $gBitSmarty->assign( 'navigation', $gCalendar->buildCalendarNavigation( $_SESSIO $calMonth = $gCalendar->buildCalendar( $_SESSION['calendar'] ); $calDay = $gCalendar->buildDay( $_SESSION['calendar'] ); -if( $_SESSION['calendar']['content_type_guid'] ) { +if( $gBitUser->hasPermission("p_calendar_view_changes") && $_SESSION['calendar']['content_type_guid'] ) { $listHash = $_SESSION['calendar']; +} else if ($gBitSystem->isPackageActive('events')) { + $listHash['content_type_guid'] = "bitevents"; +} +if (!empty($listHash)) { $listHash['user_id'] = !empty( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL; $listHash['sort_mode'] = !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'event_time_asc'; $listHash['offset'] = 0; @@ -74,6 +78,9 @@ if( $_SESSION['calendar']['content_type_guid'] ) { } // finally we have all the stuff ready to populate the $calMonth and $calDay arrays +if ($gBitSystem->isPackageActive('events')) { + $be = new BitEvents(); +} foreach( $calMonth as $w => $week ) { foreach( $week as $d => $day ) { $dayEvents = array(); @@ -81,7 +88,18 @@ foreach( $calMonth as $w => $week ) { $i = 0; foreach( $bitEvents[$day['day']] as $bitEvent ) { $dayEvents[$i] = $bitEvent; - $gBitSmarty->assign( 'cellHash', $bitEvent ); + // Terrible hack for the moment to get + // event description loaded. + // This goes away with ajax popups for + // the boxes which can render the content. + if ($bitEvent['content_type_guid'] == 'bitevents' && $gBitSystem->isPackageActive('events')) { + $be->mContentId = $bitEvent['content_id']; + $be->load(); + $gBitSmarty->assign('cellHash', $be->mInfo); + } + else { + $gBitSmarty->assign( 'cellHash', $bitEvent ); + } $dayEvents[$i]["over"] = $gBitSmarty->fetch( "bitpackage:calendar/calendar_box.tpl" ); // populate $calDay array with events diff --git a/templates/calendar.tpl b/templates/calendar.tpl index 6cd3e4b..314f1e7 100644 --- a/templates/calendar.tpl +++ b/templates/calendar.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_calendar/templates/calendar.tpl,v 1.43 2006/09/03 20:05:42 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_calendar/templates/calendar.tpl,v 1.44 2007/04/05 18:33:12 nickpalmer Exp $ *} {strip} {if !$gBitSystem->isFeatureActive( 'site_help_popup' )} {popup_init src="`$smarty.const.UTIL_PKG_URL`javascript/libs/overlib.js"} @@ -115,10 +115,11 @@ {/if} </table> {/jstab} - - {jstab title="Display Options"} - {include file="bitpackage:calendar/calendar_options_inc.tpl"} - {/jstab} + {if $gBitUser->hasPermission('p_calendar_view_changes')} + {jstab title="Display Options"} + {include file="bitpackage:calendar/calendar_options_inc.tpl"} + {/jstab} + {/if} {/jstabs} </div><!-- end .body --> </div><!-- end .calendar --> diff --git a/templates/calendar_box.tpl b/templates/calendar_box.tpl index f699604..e434f8a 100644 --- a/templates/calendar_box.tpl +++ b/templates/calendar_box.tpl @@ -1,5 +1,12 @@ +{strip} <div class="calendar popup box"> <h3>{$cellHash.title|escape}</h3> + {if $cellHash.content_type_guid == 'bitevents' && $gBitSystem->isPackageActive('events')} + <div class="center"> + {include file="bitpackage:events/render_header_inc.tpl" contentHash=$cellHash} + </div> + {/if} + {if $gBitUser->hasPermission('p_calendar_view_changes')} <div class="boxcontent"> {tr}Content Type{/tr}: {$cellHash.content_description} <br /> @@ -7,4 +14,6 @@ <br /> <strong>{tr}Last modified{/tr}</strong>: {displayname login=$cellHash.modifier_user real_name=$cellHash.modifier_real_name}<br />{$cellHash.last_modified|cal_date_format:"%Y-%m-%d - %H:%M %Z"} </div> + {/if} </div> +{/strip} diff --git a/templates/calendar_nav_inc.tpl b/templates/calendar_nav_inc.tpl index 206d669..80e2f36 100644 --- a/templates/calendar_nav_inc.tpl +++ b/templates/calendar_nav_inc.tpl @@ -6,9 +6,11 @@ {else} <li>{smartlink ititle="Only my items" user_id=$gBitUser->mUserId sort_mode=$smarty.request.sort_mode}</li> {/if} + {if $gBitUser->hasPermission('p_calendar_view_changes')} <li>{smartlink ititle="Creation date" isort="created"}</li> <li>{smartlink ititle="Modification date" isort="last_modified"}</li> <li>{smartlink ititle="Event time" idefault=1 isort="event_time"}</li> + {/if} </ul> </div> @@ -34,7 +36,7 @@ {rdelim} /* ]]> */</script> - {jscalendar inputField=todate time=$navigation.focus_date onUpdate=gotocal displayArea=datrigger} + {jscalendar inputField=todate time=$navigation.focus_date onUpdate=gotocal displayArea=datrigger daFormat=$gBitSystem->getConfig('site_long_date_format')} </td> <td style="white-space:nowrap; width:140px; text-align:right;"> <a href="{$smarty.const.CALENDAR_PKG_URL}index.php?view_mode=day&{$url_string}" class="{if $smarty.session.calendar.view_mode eq 'day'}highlight{/if}">{biticon ipackage=calendar iname=day iexplain=Day}</a> |
