Update of /cvs/scoop/scoop/lib
In directory lithium.sabren.com:/tmp/cvs-serv21684/lib

Modified Files:
	Scoop.pm 
Log Message:
Event Calendar module, also includes janra's get_sids() and story_data() patches.


Index: Scoop.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop.pm,v
retrieving revision 1.139
retrieving revision 1.140
diff -C2 -d -r1.139 -r1.140
*** Scoop.pm	15 Jan 2005 02:41:58 -0000	1.139
--- Scoop.pm	21 Jan 2005 14:14:30 -0000	1.140
***************
*** 124,127 ****
--- 124,131 ----
  	# Load all boxes
  	$self->_load_box_data();
+ 
+ 	# Load event property definitions
+ 	$self->_load_event_properties_data();
+ 	$self->_load_calendar_data();
  	
  #	$self->_check_subscription();
***************
*** 556,559 ****
--- 560,617 ----
  }
  
+ sub _load_event_properties_data {
+ 	my $self = shift;
+ 	my $time = time();
+ 
+ 	if (my $cached = $self->cache->fetch('events')) {
+ 		$self->{EVENT_PROPERTIES} = $cached;
+ 		warn "(_load_event_properties_data) getting from cache" if $DEBUG;
+ 		return $self;
+ 	}
+ 
+ 	warn "Reloading event properties cache.\n" if $CACHE_DEBUG;	
+ 	# Get all the event properties data
+ 	my ($rv, $sth) = $self->db_select({
+ 		WHAT => '*',
+ 		FROM => 'event_property_items'});
+ 
+ 	# stick it in $self
+ 	while (my $prop = $sth->fetchrow_hashref()) {
+ 		$self->{EVENT_PROPERTIES}->{$prop->{property}} = $prop;
+ 	}
+ 	warn "(_load_event_properties_data) getting from db" if $DEBUG;
+ 
+ 	# And also update the cache
+ 	$self->cache->cache_data({resource => 'events', 
+ 		                  element => 'EVENTS', 
+ 				  data => $self->{EVENT_PROPERTIES}});
+ 							  		
+ 	return $self;
+ 	
+ }
+ 
+ sub _load_calendar_data {
+ 	my $self = shift;
+ 	my $time = time();
+ 
+ 	if ( my $cached = $self->cache->fetch('calendars') ) {
+ 		$self->{CALENDARS} = $cached;
+ 		warn "(_load_calendar_data) getting from cache" if $DEBUG;
+ 		return $self;
+ 	}
+ 
+ 	warn "Reloading calendar cache." if $CACHE_DEBUG;
+ 	my ($rv,$sth) = $self->db_select({
+ 		WHAT => '*',
+ 		FROM => 'calendars'});
+ 
+ 	$self->{CALENDARS} = $sth->fetchall_hashref('cal_id');
+ 	warn "(_load_calendar_data) got all calendars from db" if $DEBUG;
+ 	# update the cache
+ 	$self->cache->store('calendars', $self->{CALENDARS});
+ 
+ 	return $self;
+ }
+ 
  sub _load_topic_data {
  	my $self = shift;
***************
*** 1203,1206 ****
--- 1261,1266 ----
  	$self->{UI}->{BLOCKS}->{maxtitles} = $self->pref('maxtitles');
  	$self->{UI}->{BLOCKS}->{imagedir} = $self->pref('imagedir');
+ 	$self->{UI}->{BLOCKS}->{textarea_rows} = $self->pref('textarea_rows');
+ 	$self->{UI}->{BLOCKS}->{textarea_cols} = $self->pref('textarea_cols');
  	
  #	warn "  (Scoop::_update_pref_config) Cache norm_font is $self->cache->{DATA}->{BLOCKS}->{norm_font}\n" if $DEBUG;