You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(381) |
Nov
(176) |
Dec
(310) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(334) |
Feb
(96) |
Mar
(149) |
Apr
(214) |
May
(120) |
Jun
(56) |
Jul
(10) |
Aug
(273) |
Sep
(182) |
Oct
(56) |
Nov
(125) |
Dec
(22) |
| 2003 |
Jan
(63) |
Feb
(181) |
Mar
(498) |
Apr
(433) |
May
(39) |
Jun
(512) |
Jul
(276) |
Aug
(156) |
Sep
(101) |
Oct
(66) |
Nov
(24) |
Dec
(161) |
| 2004 |
Jan
(1) |
Feb
(377) |
Mar
(68) |
Apr
(26) |
May
(107) |
Jun
(333) |
Jul
(13) |
Aug
|
Sep
(76) |
Oct
(88) |
Nov
(170) |
Dec
(91) |
| 2005 |
Jan
(52) |
Feb
(239) |
Mar
(402) |
Apr
(15) |
May
(2) |
Jun
(1) |
Jul
(13) |
Aug
|
Sep
(71) |
Oct
(34) |
Nov
|
Dec
|
| 2006 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Chris W. <la...@us...> - 2001-11-06 15:41:19
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_theme In directory usw-pr-cvs1:/tmp/cvs-serv2832/pkg/base_theme Modified Files: Changes MANIFEST package.conf Log Message: moved the base_main and base_simple templates to the server root so they don't get updated every time Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_theme/Changes,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Changes 2001/10/17 12:05:53 1.18 --- Changes 2001/11/06 15:18:24 1.19 *************** *** 1,4 **** --- 1,10 ---- Revision history for OpenInteract package base_theme. + 1.29 Tue Nov 6 10:33:51 EST 2001 + + Move the base templates (base_main and base_simple) to the + server directory so they don't get replaced every time + base_theme is updated. + 1.28 Wed Oct 17 08:19:55 EDT 2001 Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_theme/MANIFEST,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MANIFEST 2001/02/02 06:20:05 1.1.1.1 --- MANIFEST 2001/11/06 15:18:24 1.2 *************** *** 15,22 **** struct/theme.sql struct/theme_prop.sql - template/base_main.meta - template/base_main.tmpl - template/base_simple.meta - template/base_simple.tmpl template/theme_form.meta template/theme_form.tmpl --- 15,18 ---- Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_theme/package.conf,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** package.conf 2001/10/17 12:05:53 1.18 --- package.conf 2001/11/06 15:18:24 1.19 *************** *** 1,4 **** name base_theme ! version 1.28 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ --- 1,4 ---- name base_theme ! version 1.29 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ |
|
From: Chris W. <la...@us...> - 2001-11-06 15:41:19
|
Update of /cvsroot/openinteract/OpenInteract/template
In directory usw-pr-cvs1:/tmp/cvs-serv3905
Added Files:
base_main base_simple
Log Message:
moved from base_theme package
--- NEW FILE: base_main ---
[%- DEFAULT theme = OI.theme_properties -%]
<html>
<head>
<title>[% page.title %]</title>
<script language="javascript">
<!--
[% page.script %]
[% PROCESS global_javascript %]
// -->
</script>
</head>
<body bgcolor="[% theme.bgcolor %]">
<a href="/"><img src="/images/oi_logo.gif" width="316" height="74"
border="0" alt="OpenInteract logo"></a>
<br clear="all">
<table border="0" width="100%" cellpadding="2" bgcolor="[% theme.main_menu_border_color %]">
<tr><td>
<table border="0" width="100%" bgcolor="[% theme.main_menu_bgcolor %]"
cellpadding="4" cellspacing="0">
<tr align="center" valign="middle">
<td><font size="+1">
<b><a href="/">Home</a></b> |
<b><a href="/User/">Users</a></b> |
<b><a href="/Group/">Groups</a></b> |
<b><a href="/Page/directory_listing/">Pages</a></b>
</td>
</tr>
</table>
</td></tr>
</table>
<table border="0" width="100%" bgcolor="[% theme.bgcolor %]"
cellpadding="1" cellspacing="0">
<tr valign="top">
<td width="75%" align="left">
<br>
[% page.content %]
</td>
<td width="25%" align="right">
<br>
[%- OI.comp( 'boxes' ) -%]
</td></tr>
</table>
<hr width="50%" noshade="noshade">
<p align="center">
Questions? Check out <a href="http://www.openinteract.org/">the website</a>
</p>
<p align="right">
<a href="http://www.openinteract.org/powered_by"><img src="/images/pw_by_oi.gif" width="88" height="31"
border="0" alt="Powered by OpenInteract!"></a>
</p>
</body>
</html>
--- NEW FILE: base_simple ---
[%- DEFAULT theme = OI.theme_properties -%]
<html>
<head><title>[% page.title %]</title>
<script language="javascript">
<!--
[% page.script %]
[%- PROCESS global_javascript -%]
// -->
</script>
</head>
<body bgcolor="[% theme.bgcolor %]">
[% page.content %]
</body>
</html>
|
|
From: Chris W. <la...@us...> - 2001-11-06 15:41:19
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_theme/data
In directory usw-pr-cvs1:/tmp/cvs-serv2832/pkg/base_theme/data
Modified Files:
install_theme_prop.dat
Log Message:
moved the base_main and base_simple templates to the server root so they don't get updated every time
Index: install_theme_prop.dat
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_theme/data/install_theme_prop.dat,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** install_theme_prop.dat 2001/08/28 22:35:51 1.3
--- install_theme_prop.dat 2001/11/06 15:18:24 1.4
***************
*** 19,24 ****
[1,'label_font_color','#ffffff','Color of label font (embedded in border)'],
[1,'admin_color','#ffffe0','Color for rows in a form that are for admin only'],
! [1,'main_template','base_theme::base_main','Name of base main template'],
! [1,'simple_template','base_theme::base_simple',q{Name of 'simple' template -- no menus, boxes, or anything}],
[1,'bullet','<img src="/images/bullet.gif" width="12" height="12" alt="*">',q{Generic bullet that doesn't take up much space}],
];
--- 19,24 ----
[1,'label_font_color','#ffffff','Color of label font (embedded in border)'],
[1,'admin_color','#ffffe0','Color for rows in a form that are for admin only'],
! [1,'main_template','base_main','Name of base main template'],
! [1,'simple_template','base_simple',q{Name of 'simple' template -- no menus, boxes, or anything}],
[1,'bullet','<img src="/images/bullet.gif" width="12" height="12" alt="*">',q{Generic bullet that doesn't take up much space}],
];
|
|
From: Chris W. <la...@us...> - 2001-11-06 15:08:08
|
Update of /cvsroot/openinteract/OpenInteract/conf
In directory usw-pr-cvs1:/tmp/cvs-serv25155/conf
Modified Files:
sample-httpd_modperl.conf sample-httpd_modperl_solo.conf
Log Message:
Apache config updates
Index: sample-httpd_modperl.conf
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/conf/sample-httpd_modperl.conf,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sample-httpd_modperl.conf 2001/08/12 03:11:16 1.4
--- sample-httpd_modperl.conf 2001/11/06 15:01:26 1.5
***************
*** 44,47 ****
--- 44,50 ----
PerlPostReadRequestHandler OpenInteract::ProxyRemoteAddr
+ PerlSetVar OIStashClass %%STASH_CLASS%%
+ PerlSetVar OIRootDir %%WEBSITE_DIR%%
+
# This sends all incoming requests to the OpenInteract Apache content
# handler (OpenInteract.pm)
***************
*** 49,53 ****
<Location />
SetHandler perl-script
- PerlSetVar StashClass %%STASH_CLASS%%
PerlHandler OpenInteract
</Location>
--- 52,55 ----
Index: sample-httpd_modperl_solo.conf
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/conf/sample-httpd_modperl_solo.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sample-httpd_modperl_solo.conf 2001/08/12 03:11:39 1.1
--- sample-httpd_modperl_solo.conf 2001/11/06 15:01:26 1.2
***************
*** 32,35 ****
--- 32,38 ----
PerlRequire %%WEBSITE_DIR%%/conf/startup.pl
+ PerlSetVar OIStashClass %%STASH_CLASS%%
+ PerlSetVar OIRootDir %%WEBSITE_DIR%%
+
# This sends all incoming requests (except for the 'Location'
# directives below) to the OpenInteract Apache content handler
***************
*** 38,42 ****
<Location />
SetHandler perl-script
- PerlSetVar StashClass %%STASH_CLASS%%
PerlHandler OpenInteract
</Location>
--- 41,44 ----
|
|
From: Chris W. <la...@us...> - 2001-11-06 15:03:12
|
Update of /cvsroot/openinteract/OpenInteract/pkg/classified In directory usw-pr-cvs1:/tmp/cvs-serv26216/pkg/classified Modified Files: package.conf Log Message: date and other updates Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/classified/package.conf,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** package.conf 2001/10/14 23:25:21 1.19 --- package.conf 2001/11/06 15:03:08 1.20 *************** *** 4,7 **** --- 4,8 ---- author Marcus Baker <mb...@in...> url http://www.openinteract.org/ + module Class::Date sql_installer OpenInteract::SQLInstall::Classified description |
|
From: Chris W. <la...@us...> - 2001-11-06 15:03:11
|
Update of /cvsroot/openinteract/OpenInteract/pkg/classified/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv26216/pkg/classified/OpenInteract/Handler
Modified Files:
Classified.pm
Log Message:
date and other updates
Index: Classified.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/classified/OpenInteract/Handler/Classified.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Classified.pm 2001/10/14 23:19:33 1.8
--- Classified.pm 2001/11/06 15:03:09 1.9
***************
*** 4,7 ****
--- 4,8 ----
use strict;
+ use Class::Date qw();
use Data::Dumper qw( Dumper );
use OpenInteract::CommonHandler;
***************
*** 17,25 ****
%OpenInteract::Handler::Classified::security = (
DEFAULT_SECURITY_KEY() => SEC_LEVEL_NONE,
! edit => SEC_LEVEL_READ,
remove => SEC_LEVEL_WRITE,
);
! use constant DEFAULT_EXPIRE => 60 * 60 * 24 * 7 * 12; # 12 weeks
sub MY_PACKAGE { return 'classified' }
--- 18,26 ----
%OpenInteract::Handler::Classified::security = (
DEFAULT_SECURITY_KEY() => SEC_LEVEL_NONE,
! create => SEC_LEVEL_READ, edit => SEC_LEVEL_READ,
remove => SEC_LEVEL_WRITE,
);
! use constant DEFAULT_EXPIRE => '+84D';
sub MY_PACKAGE { return 'classified' }
***************
*** 32,35 ****
--- 33,37 ----
sub MY_SEARCH_RESULTS_TITLE { return 'Classified Search Results' }
sub MY_SEARCH_RESULTS_TEMPLATE { return 'classified_search_results' }
+ sub MY_OBJECT_CREATE_SECURITY { return SEC_LEVEL_READ }
sub MY_OBJECT_FORM_TITLE { return 'Classified Detail' }
***************
*** 50,53 ****
--- 52,56 ----
sub MY_ALLOW_SEARCH_FORM { return 1 }
sub MY_ALLOW_SEARCH { return 1 }
+ sub MY_ALLOW_CREATE { return 1 }
sub MY_ALLOW_SHOW { return 1 }
sub MY_ALLOW_EDIT { return 1 }
***************
*** 71,93 ****
}
! my $post_after = $class->_read_field_date( $apr, 'posted_after' );
if ( $post_after ) {
push @{ $where }, 'posted_on >= ?';
! push @{ $value }, $post_after;
}
}
-
- # We present dates to the user in three separate fields
-
- sub _read_field_date {
- my ( $class, $apr, $field ) = @_;
- return join( '-', $apr->param( $field . '_year' ),
- $apr->param( $field . '_month' ),
- $apr->param( $field . '_day' ) );
- }
-
-
# If the user has WRITE access to the object, then he/she is an admin
# and can set active, expires_on and active_on
--- 74,85 ----
}
! my $post_after = $class->_read_field_date_object( $apr, 'posted_after' );
if ( $post_after ) {
push @{ $where }, 'posted_on >= ?';
! push @{ $value }, $post_after->strftime( '%Y-%m-%d' );
}
}
# If the user has WRITE access to the object, then he/she is an admin
# and can set active, expires_on and active_on
***************
*** 119,123 ****
my $site_admin_id = $R->CONFIG->{default_objects}{site_admin_group};
foreach my $group ( @{ $R->{auth}{group} } ) {
! $is_admin++ if ( $group->id == $site_admin_id );
}
--- 111,115 ----
my $site_admin_id = $R->CONFIG->{default_objects}{site_admin_group};
foreach my $group ( @{ $R->{auth}{group} } ) {
! $is_admin++ if ( $group->id == $site_admin_id );
}
***************
*** 127,133 ****
$classified->{active_on} ||= $now;
unless ( $classified->{expires_on} ) {
! my $expire_time = $R->{time} + DEFAULT_EXPIRE;
! my @t = localtime( $expire_time );
! $classified->{expires_on} = join '-', $t[5] + 1900, $t[4] + 1, $t[3];
}
}
--- 119,124 ----
$classified->{active_on} ||= $now;
unless ( $classified->{expires_on} ) {
! my $expire_date = Class::Date->new( $R->{time} ) + DEFAULT_EXPIRE;
! $classified->{expires_on} = $expire_date->strftime( '%Y-%m-%d' );;
}
}
|
|
From: Chris W. <la...@us...> - 2001-11-06 15:00:31
|
Update of /cvsroot/openinteract/OpenInteract In directory usw-pr-cvs1:/tmp/cvs-serv24456 Modified Files: MANIFEST Log Message: file tracking Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/MANIFEST,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** MANIFEST 2001/10/30 02:23:23 1.70 --- MANIFEST 2001/11/06 15:00:28 1.71 *************** *** 119,122 **** --- 119,123 ---- template/form_hidden template/form_login + template/form_password template/form_radio template/form_reset |
|
From: Chris W. <la...@us...> - 2001-11-06 15:00:21
|
Update of /cvsroot/openinteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv24238
Modified Files:
Changes
Log Message:
latest changes
Index: Changes
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/Changes,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** Changes 2001/10/29 15:13:16 1.77
--- Changes 2001/11/06 15:00:14 1.78
***************
*** 1,5 ****
Revision history for Perl extension OpenInteract.
! 1.31
Overall:
--- 1,5 ----
Revision history for Perl extension OpenInteract.
! 1.35
Overall:
***************
*** 13,17 ****
configuration file with the newer releases.
! - Added 'object_activity' package to browse object activity logs.
- Package 'base_page' now replaces 'static_page'. The new package
--- 13,19 ----
configuration file with the newer releases.
! - Added 'object_activity' package to browse object activity
! logs. Hopefully this won't encourage any latent bigbrotherish
! tendencies you might have...
- Package 'base_page' now replaces 'static_page'. The new package
***************
*** 21,25 ****
can still keep your editable content in the database, but it's now in
a separate table, and there are no separate fields for 'content' and
! 'script'. A migration scripts are provided.
Individual:
--- 23,32 ----
can still keep your editable content in the database, but it's now in
a separate table, and there are no separate fields for 'content' and
! 'script'. A migration script is provided.
!
! - Modified the Apache startup procedures so we have a single, non
! anonymous child initialization subroutine. This requires small
! modifications to your Apache configuration -- see 'UPGRADE' for
! details.
Individual:
***************
*** 89,92 ****
--- 96,106 ----
Steven Devijver <st...@de...> for prompting its revision.
+ * OpenInteract/ApacheStartup.pm:
+
+ - Rewrote much of this so that we do all SPOPS initialization in
+ the ChildInit handler rather than the server handler, since we were
+ in some cases asking for a database handle in the server and never
+ lettnig it go. (This can be bad)
+
* OpenInteract/Auth.pm:
***************
*** 97,100 ****
--- 111,118 ----
configuration to provide your own criteria.
+ - Broke the 'user()' method down into pieces so it can be
+ overridden more easily. (See docs for details.) Thanks to Stefano
+ di Sandro <st...@an...> for suggesting it.
+
* OpenInteract/CommonHandler.pm:
***************
*** 151,155 ****
Packages changed:
! OpenInteract 1.30 -> 1.31
----------------------------
base: 1.62 -> 1.63
--- 169,173 ----
Packages changed:
! OpenInteract 1.30 -> 1.35
----------------------------
base: 1.62 -> 1.63
|
|
From: Chris W. <la...@us...> - 2001-11-06 14:59:51
|
Update of /cvsroot/openinteract/OpenInteract In directory usw-pr-cvs1:/tmp/cvs-serv23926 Modified Files: UPGRADE Log Message: added upgrade notes regarding server and Apache configuration Index: UPGRADE =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/UPGRADE,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UPGRADE 2001/10/15 05:38:01 1.5 --- UPGRADE 2001/11/06 14:59:40 1.6 *************** *** 54,61 **** As we improve OpenInteract, we occasionally add new configuration ! options to the 'server.perl' file. Since we have not yet developed a ! utility to integrate these changes automatically, check here to see ! what updates there have been between the versions. ============================== UPGRADING TO 1.3 --- 54,155 ---- As we improve OpenInteract, we occasionally add new configuration ! options to the 'server.perl' or 'server.ini' file. Since we have not ! yet developed a utility to integrate these changes automatically, ! check here to see what updates there have been between the versions. ! ! ! ============================== ! UPGRADING TO 1.35 ! ============================== ! ! OpenInteract configuration changes ! -------------------- ! ! With the additional option of using a INI-style configuration file, we ! made a number of changes to the server configuration. It's probably ! easiest if you have the sample and your existing file open ! side-by-side for comparison. ! ! - Moved 'template_ext' ! to: 'template_info'->'template_ext' ! ! - Moved 'default_connection_db' ! to: 'datasource'->'default_connection_db' ! ! - Moved 'default_connection_ldap' ! to: 'datasource'->'default_connection_ldap' ! ! - Moved 'error_object_class' ! to: 'error'->'error_object_class' ! ! - Moved 'default_error_handler' ! to: 'error'->'default_error_handler' ! ! - Moved 'smtp_host' ! to: 'mail'->'smtp_host' ! ! - Moved 'admin_email' ! to: 'mail'->'admin_email' ! ! - Moved 'content_email' ! to: 'mail'->'content_email' ! ! - Reverse and flatten the 'system_alias' hashref. For instance: ! ! OpenInteract::Auth => [ qw/ auth auth_user auth_group / ] ! ! becomes: ! ! auth => 'OpenInteract::Auth', ! auth_user => 'OpenInteract::Auth', ! auth_group => 'OpenInteract::Auth', ! ! - Moved 'action'->'_default_action_info' ! to: 'action_info'->'default' ! ! - Moved 'action'->'_notfound' ! to: 'action_info'->'not_found' ! ! - Moved 'action'->"''" ! to: 'action_info'->'none' ! ! - Moved 'stash_class' ! to: 'server_info'->'stash_class' ! ! - Moved 'request_class' ! to: 'server_info'->'request_class' ! ! - Moved 'website_name' ! to: 'server_info'->'website_name' ! ! ! Apache configuration changes ! -------------------- ! ! The location and name of the variables set in your Apache ! configuration have changed. Instead of: + <Location /> + SetHandler perl-script + PerlSetVar StashClass MySite::Stash + PerlHandler OpenInteract + </Location> + + + Change it to: + + PerlSetVar OIStashClass MySite::Stash + PerlSetVar OIRootDir /path/to/my/website + + <Location /> + SetHandler perl-script + PerlHandler OpenInteract + </Location> + + So we added 'PerlSetVar', modified the variable name to be more + namespace-friendly and moved the declarations to the server rather + than the Location. + + ============================== UPGRADING TO 1.3 *************** *** 72,76 **** You'll also need to create this directory in any websites you're upgrading. For websites created with 'oi_manage create_website' after ! the upgrade, you will not need to create this directory. --- 166,172 ---- You'll also need to create this directory in any websites you're upgrading. For websites created with 'oi_manage create_website' after ! the upgrade, you will not need to create this directory. Also ensure ! that it has permissions so that the website server user has permission ! to create and delete files. |
|
From: Chris W. <la...@us...> - 2001-11-06 14:59:27
|
Update of /cvsroot/openinteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv23714
Modified Files:
OpenInteract.pm
Log Message:
added 'use Apache::Request'
Index: OpenInteract.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** OpenInteract.pm 2001/10/30 02:24:00 1.18
--- OpenInteract.pm 2001/11/06 14:59:23 1.19
***************
*** 5,12 ****
use strict;
use Apache::Constants qw( :common :remotehost );
use Data::Dumper qw( Dumper );
@OpenInteract::ISA = ();
! $OpenInteract::VERSION = 1.31;
--- 5,13 ----
use strict;
use Apache::Constants qw( :common :remotehost );
+ use Apache::Request;
use Data::Dumper qw( Dumper );
@OpenInteract::ISA = ();
! $OpenInteract::VERSION = 1.35;
***************
*** 81,85 ****
# object
! my $STASH_CLASS = $apache->dir_config( 'StashClass' );
unless ( $REQ{ $STASH_CLASS } ) {
eval "require $STASH_CLASS";
--- 82,86 ----
# object
! my $STASH_CLASS = $apache->dir_config( 'OIStashClass' );
unless ( $REQ{ $STASH_CLASS } ) {
eval "require $STASH_CLASS";
|
|
From: Chris W. <la...@us...> - 2001-11-06 14:41:17
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv8741
Modified Files:
ApacheStartup.pm
Log Message:
NOTE: THIS RELIES ON CHANGES TO THE APACHE CONFIG; created a more
self-contained childinit handler so that we don't generate SPOPS
classes until the child init rather than at server startup
Index: ApacheStartup.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/ApacheStartup.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ApacheStartup.pm 2001/10/08 21:34:41 1.16
--- ApacheStartup.pm 2001/11/06 14:34:15 1.17
***************
*** 4,7 ****
--- 4,8 ----
use strict;
+ use Apache::DBI;
use OpenInteract::DBI;
use OpenInteract::Startup;
***************
*** 36,40 ****
my $BASE_CONFIG = OpenInteract::Startup->read_base_config({ filename => $bc_file });
unless ( $BASE_CONFIG ) { die "Cannot create base configuration from ($bc_file)!"; }
! DEBUG && _w( 1, " --base configuration read in ok." );
# Read in all the Apache classes -- do this separately since we need
--- 37,41 ----
my $BASE_CONFIG = OpenInteract::Startup->read_base_config({ filename => $bc_file });
unless ( $BASE_CONFIG ) { die "Cannot create base configuration from ($bc_file)!"; }
! DEBUG && _w( 1, "SERVER INIT: base configuration read in ok." );
# Read in all the Apache classes -- do this separately since we need
***************
*** 51,74 ****
$BASE_CONFIG->{config_dir} );
OpenInteract::Startup->require_module({ filename => "$config_dir/apache.dat" });
! DEBUG && _w( 1, " --apache modules read in ok." );
!
! # The big enchilada -- do just about everything here and get back the
! # list of classes that need to be initialized along with the config object.
! # Note that we do not pass the necessary parameters to initialize aliases
! # and to create/initialize the SPOPS classes -- we do that in the child
! # init handler below
!
! my ( $init_class, $C ) = OpenInteract::Startup->main_initialize({
! base_config => $BASE_CONFIG });
! unless ( $C ) { die "No configuration object returned from initialization!\n"; }
! DEBUG && _w( 1, " --main initialization completed ok." );
!
! OpenInteract::Startup->require_module({ class => $C->{session_info}{class} });
! DEBUG && _w( 1, " -- require the session class ok" );
!
! # Figure out how to do this more cleanly in the near future -- maybe
! # just do it by hand for this special class?
! push @{ $init_class }, 'OpenInteract::PackageRepository';
# Initialize the DBI drivers. Stas Beckman (st...@st...) wrote
--- 52,58 ----
$BASE_CONFIG->{config_dir} );
OpenInteract::Startup->require_module({ filename => "$config_dir/apache.dat" });
! DEBUG && _w( 1, "SERVER INIT: apache modules read in ok." );
! my $C = OpenInteract::Startup->create_config({ base_config => $BASE_CONFIG });
# Initialize the DBI drivers. Stas Beckman (st...@st...) wrote
***************
*** 82,86 ****
next if ( $dbd_installed{ $db_info->{ $db_key }{driver_name} } );
DBI->install_driver( $db_info->{ $db_key }{driver_name} );
! DEBUG && _w( 1, " --installed DBD driver ($db_info->{ $db_key }{driver_name}) ok." );
}
--- 66,70 ----
next if ( $dbd_installed{ $db_info->{ $db_key }{driver_name} } );
DBI->install_driver( $db_info->{ $db_key }{driver_name} );
! DEBUG && _w( 1, "SERVER INIT: installed DBD driver ($db_info->{ $db_key }{driver_name}) ok." );
}
***************
*** 92,104 ****
eval $PROXY_SUB;
die "Cannot create proxy subroutine! $@" if ( $@ );
! DEBUG && _w( 1, " --installed proxy subroutine ok." );
}
- # Setup caching info for use in the child init handler below
-
- my $cache_info = $C->{cache_info}{data};
- my $cache_class = $cache_info->{class};
- my $ipc_cache_class = $C->{cache}{ipc}{class};
-
# If we're told, cleanup the Template Toolkit compile directory
--- 76,82 ----
eval $PROXY_SUB;
die "Cannot create proxy subroutine! $@" if ( $@ );
! DEBUG && _w( 1, "SERVER INIT: installed proxy subroutine ok." );
}
# If we're told, cleanup the Template Toolkit compile directory
***************
*** 107,189 ****
}
! # Do these initializations every time, unless we're on Win32 (they
! # have just call the routine to call something else...)
! my ( $init_sub, $OS );
! unless ($OS = $^O) {
! require Config;
! $OS = $Config::Config{'osname'};
! }
- # See the second sub for comments...
! if ( $OS=~/Win/i ) {
! DEBUG && _w( 1, "Running initialization for Windows." );
! srand;
! $cache_class->class_initialize({ config => $C }) if ( $cache_info->{use} );
! $ipc_cache_class->class_initialize({ config => $C }) if ( $cache_info->{use_ipc} );
! my $REQUEST_CLASS = $BASE_CONFIG->{request_class};
! $REQUEST_CLASS->setup_aliases;
! OpenInteract::Startup->initialize_spops({ config => $C, class => $init_class });
! eval { OpenInteract::Error::Main->initialize({ config => $C }) };
! my $err_status = ( $@ ) ? $@ : 'ok';
! DEBUG && _w( 1, sprintf( "%-40s: %-30s","init: Error Dispatcher", $err_status ) );
! }
! else {
! DEBUG && _w( 1, "Seeding childinit handler (non-Windows)" );
! my $init_sub = sub {
! DEBUG && _w( 1, "PerlChildInitHandler being executed for Child ($$)" );
! # seed the random number generator per child -- note that we can
! # probably take this out as of mod_perl >= 1.25
! srand;
! # Connect to the db but throw away the handle that is returned
! # -- this just 'primes the pump' and makes the DB connection
! # when the child is started versus when the first request is
! # received (probably not necessary using mysql, but for heavier
! # databases it can be a Good Thing)
! # TODO: See if this is the reason why we get the 'not
! # creating $R' problems discussed briefly at the bottom of
! # OpenInteract.pm
! foreach my $db_key ( keys %{ $db_info } ) {
! eval { OpenInteract::DBI->connect( $db_info->{ $db_key } ) };
! if ( $@ ) {
! warn "Error trying to run first connect for database ",
! "connection key ($db_key): $@\n";
! }
! }
! $cache_class->class_initialize({ config => $C }) if ( $cache_info->{use} );
! $ipc_cache_class->class_initialize({ config => $C }) if ( $cache_info->{use_ipc} );
! # Tell OpenInteract::Request to setup aliases if it hasn't already
! my $REQUEST_CLASS = $BASE_CONFIG->{request_class};
! $REQUEST_CLASS->setup_aliases;
! # Initialize all the SPOPS object classes
! OpenInteract::Startup->initialize_spops({ config => $C,
! class => $init_class });
! # Create a list of error handlers for our website
! eval { OpenInteract::Error::Main->initialize({ config => $C }) };
! my $err_status = ( $@ ) ? $@ : 'ok';
! DEBUG && _w( 0, sprintf( "%-40s: %-30s","init: Error Dispatcher", $err_status ) );
! };
! Apache->push_handlers( PerlChildInitHandler => $init_sub );
! }
}
--- 85,158 ----
}
! # This should now work on both Win32 and Unix, without separate
! # handlers for both
! Apache->push_handlers( PerlChildInitHandler => \&child_init );
! }
! sub child_init {
! my ( $r ) = @_;
! my $stash_class = $r->server->dir_config( 'OIStashClass' );
! my $website_dir = $r->server->dir_config( 'OIRootDir' );
! DEBUG && _w( 1, "PerlChildInitHandler being executed for Child ($$) with stash ($stash_class)" );
! my $BASE_CONFIG = OpenInteract::Startup->read_base_config({ website_dir => $website_dir });
! unless ( $BASE_CONFIG ) { die "Cannot create base configuration from ($website_dir)!"; }
! DEBUG && _w( 1, "CHILD INIT: base configuration read in ok." );
! # seed the random number generator per child -- note that we can
! # probably take this out as of mod_perl >= 1.25 but since it
! # doesn't do any harm...
! srand;
! # The big enchilada -- do just about everything here and get back the
! # list of classes that need to be initialized along with the config object.
! # Note that we do not pass the necessary parameters to initialize aliases
! # and to create/initialize the SPOPS classes -- we do that in the child
! # init handler below
! my ( $init_class, $C ) = OpenInteract::Startup->main_initialize({
! base_config => $BASE_CONFIG });
! unless ( $C ) { die "No configuration object returned from initialization!\n"; }
! DEBUG && _w( 1, "CHILD INIT: main initialization completed ok." );
! OpenInteract::Startup->require_module({ class => $C->{session_info}{class} });
! DEBUG && _w( 1, "CHILD INIT: require the session class ok" );
! # Figure out how to do this more cleanly in the near future -- maybe
! # just do it by hand for this special class?
! push @{ $init_class }, 'OpenInteract::PackageRepository';
! # Setup caching info for use in the child init handler below
! my $cache_info = $C->{cache_info}{data};
! my $cache_class = $cache_info->{class};
! my $ipc_cache_class = $C->{cache}{ipc}{class};
! $cache_class->class_initialize({ config => $C }) if ( $cache_info->{use} );
! $ipc_cache_class->class_initialize({ config => $C }) if ( $cache_info->{use_ipc} );
! # Tell OpenInteract::Request to setup aliases if it hasn't already
! my $REQUEST_CLASS = $BASE_CONFIG->{request_class};
! $REQUEST_CLASS->setup_aliases;
! DEBUG && _w( 1, "CHILD INIT: setup \$R aliases ok" );
! # Initialize all the SPOPS object classes
! OpenInteract::Startup->initialize_spops({ config => $C,
! class => $init_class });
! DEBUG && _w( 1, "CHILD INIT: initialize SPOPS classes ok" );
! # Create a list of error handlers for our website
+ eval { OpenInteract::Error::Main->initialize({ config => $C }) };
+ my $err_status = ( $@ ) ? $@ : 'ok';
+ DEBUG && _w( 1, sprintf( "CHILD INIT: %-40s: %-30s","init: Error Dispatcher", $err_status ) );
}
|
|
From: Chris W. <la...@us...> - 2001-11-06 14:36:42
|
Update of /cvsroot/openinteract/OpenInteract/conf In directory usw-pr-cvs1:/tmp/cvs-serv10305 Modified Files: sample-apache.dat Log Message: remove unnecessary stuff Index: sample-apache.dat =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/conf/sample-apache.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sample-apache.dat 2001/05/30 17:29:38 1.3 --- sample-apache.dat 2001/11/06 14:36:39 1.4 *************** *** 5,10 **** Apache::Constants Apache::URI ! Apache::Request ! Apache::Cookie ! Apache::DBI ! Apache::StatINC \ No newline at end of file --- 5,7 ---- Apache::Constants Apache::URI ! Apache::Request \ No newline at end of file |
|
From: Chris W. <la...@us...> - 2001-11-06 14:31:53
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Cookies In directory usw-pr-cvs1:/tmp/cvs-serv7446 Modified Files: Apache.pm Log Message: move the 'use' out of the conf/apache.dat file and into here Index: Apache.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Cookies/Apache.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Apache.pm 2001/10/17 04:47:07 1.3 --- Apache.pm 2001/11/06 14:31:44 1.4 *************** *** 4,7 **** --- 4,8 ---- use strict; + use Apache::Cookie; use Data::Dumper qw( Dumper ); |
|
From: Chris W. <la...@us...> - 2001-11-06 14:30:31
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv6730
Modified Files:
Auth.pm
Log Message:
decomposed the monolithic user() method into methods that can be more
easily overridden by subclasses
Index: Auth.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Auth.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Auth.pm 2001/10/24 16:21:33 1.11
--- Auth.pm 2001/11/06 14:30:28 1.12
***************
*** 17,31 ****
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! my $apr = $R->apache;
!
! if ( my $uid = $R->{session}{user_id} ) {
! $R->DEBUG && $R->scrib( 1, "Found session and uid ($uid); creating user." );
!
! # You MUST skip security here as a bootstrapping maneuver,
! # otherwise the superuser can never login (since WORLD has
! # SEC_LEVEL_NONE to the record)
! $R->{auth}{user} = eval { $R->user->fetch( $uid,
! { skip_security => 1 } ) };
# If there's a failure fetching the user, we need to ensure that
--- 17,25 ----
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! my $uid = $class->fetch_user_id;
! if ( $uid ) {
! $R->DEBUG && $R->scrib( 1, "Found session and uid ($uid); fetching user" );
! $R->{auth}{user} = eval { $class->fetch_user( $uid ) };
# If there's a failure fetching the user, we need to ensure that
***************
*** 34,82 ****
if ( $@ or ! $R->{auth}{user} ) {
! OpenInteract::Error->set( SPOPS::Error->get );
! $R->throw({ code => 311 });
! $R->{session}{user_id} = undef;
! return undef;
}
! # We use this to note that the user is logged in, since we'll
! # shortly modify OI to create a record for a 'not-logged-in' user
! # instead of leaving it empty.
!
$R->{auth}{logged_in} = 1;
! $R->DEBUG && $R->scrib( 2, "User: ", Dumper( $R->{auth}{user} ) );
! $R->DEBUG && $R->scrib( 1, "User found: $R->{auth}{user}{login_name}" );
! # If there's a removal date, then this is the user's first
! # login
! # TODO: Check if this is working, if it's needed, ...
! if ( $R->{auth}{user}{removal_date} ) {
! $R->DEBUG && $R->scrib( 1, "First login for user! Do some cleanup." );
! $R->{auth}{user}{removal_date} = undef;
! # blank out the removal date -- note that this doesn't seem to
! # work properly, and put the user in the public group
! eval {
! $R->{auth}{user}->save;
! $R->{auth}{user}->make_public;
! };
! # need to check for save/security errors here
}
- return undef;
}
- $R->DEBUG && $R->scrib( 1, "No uid found in session. Finding login info." );
! # If the user didn't previously exist, try to create
! # from the fields login_name and password
my $CONFIG = $R->CONFIG;
my $login_field = $CONFIG->{login}{login_field};
my $password_field = $CONFIG->{login}{password_field};
- my $remember_field = $CONFIG->{login}{remember_field};
unless ( $login_field and $password_field ) {
$R->throw({ code => 205, type => 'system' });
--- 28,137 ----
if ( $@ or ! $R->{auth}{user} ) {
! return $class->fetch_user_failed( $uid );
}
! $R->DEBUG && $R->scrib( 1, "User found: $R->{auth}{user}{login_name}" );
$R->{auth}{logged_in} = 1;
! $class->check_first_login;
! return undef;
! }
! $R->DEBUG && $R->scrib( 1, "No uid found in session. Finding login info." );
! # If no user info found, check to see if the user logged in
! $R->{auth}{user} = $class->login_user;
! # If not, create an 'empty' user and we're done
! unless ( $R->{auth}{user} ) {
! $R->DEBUG && $R->scrib( 1, "Creating the not-logged-in user." );
! $class->create_nologin_user;
! return undef;
! }
! $R->{auth}{logged_in} = 1;
! my $CONFIG = $R->CONFIG;
! if ( my $custom_class = $CONFIG->{login}{custom_login_handler} ) {
! my $custom_method = $CONFIG->{login}{custom_login_handler} || 'handler';
! $R->scrib( 1, "Custom login handler/method being used: ($custom_class) ($custom_method)" );
! eval { $custom_class->$custom_method() };
! if ( $@ ) {
! $R->scrib( 0, "Custom login handler died with: $@" );
! $class->custom_login_failed;
}
}
! return undef;
! }
!
! # Just grab the user_id from somewhere
!
! sub fetch_user_id {
! my ( $class ) = @_;
! my $R = OpenInteract::Request->instance;
! return $R->{session}{user_id};
! }
!
+ # Use the user_id to create a user (don't use eval {} around the
+ # fetch(), this should die if it fails)
+
+ sub fetch_user {
+ my ( $class, $uid ) = @_;
+ my $R = OpenInteract::Request->instance;
+ return $R->user->fetch( $uid, { skip_security => 1 } );
+ }
+
+
+ # What to do if the user fetch fails
+
+ sub fetch_user_failed {
+ my ( $class, $uid ) = @_;
+ my $R = OpenInteract::Request->instance;
+ OpenInteract::Error->set( SPOPS::Error->get );
+ $R->throw({ code => 311 });
+ $R->{session}{user_id} = undef;
+ return undef;
+ }
+
+
+ # If there's a removal date, then this is the user's first login
+
+ # TODO: Check if this is working, if it's needed, ...
+
+ sub check_first_login {
+ my ( $class ) = @_;
+ my $R = OpenInteract::Request->instance;
+ if ( $R->{auth}{user}{removal_date} ) {
+ $R->DEBUG && $R->scrib( 1, "First login for user! Do some cleanup." );
+ $R->{auth}{user}{removal_date} = undef;
+
+ # blank out the removal date -- note that this doesn't seem to
+ # work properly, and put the user in the public group
+
+ eval {
+ $R->{auth}{user}->save;
+ $R->{auth}{user}->make_public;
+ };
+
+ # need to check for save/security errors here
+ }
+ }
+
+
+ # If no user found elsewhere, see if a login_name and password were
+ # passed in; if so, try and login the user and track the info
+
+ sub login_user {
+ my ( $class ) = @_;
+ my $R = OpenInteract::Request->instance;
+
+ my $apr = $R->apache;
my $CONFIG = $R->CONFIG;
+
my $login_field = $CONFIG->{login}{login_field};
my $password_field = $CONFIG->{login}{password_field};
unless ( $login_field and $password_field ) {
$R->throw({ code => 205, type => 'system' });
***************
*** 85,93 ****
my $login_name = $apr->param( $login_field );
- unless ( $login_name ) {
- $R->DEBUG && $R->scrib( 1, "Creating the not-logged-in user." );
- $R->{auth}{user} = $class->create_nologin_user;
- return undef;
- }
$R->DEBUG && $R->scrib( 1, "Found login name from form: ($login_name)" );
my $user = eval { $R->user->fetch_by_login_name( $login_name,
--- 140,143 ----
***************
*** 124,157 ****
# closes) unless the user clicked the 'Remember Me' checkbox
unless ( $R->apache->param( $remember_field ) ) {
$R->{session}{expiration} = undef;
}
- $R->{auth}{logged_in} = 1;
$R->{session}{user_id} = $user->id;
! $R->{auth}{user} = $user;
!
! if ( my $custom_class = $CONFIG->{login}{custom_login_handler} ) {
! my $custom_method = $CONFIG->{login}{custom_login_handler} || 'handler';
! $R->scrib( 1, "Custom login handler/method being used: ($custom_class) ($custom_method)" );
! eval { $custom_class->$custom_method() };
! if ( $@ ) {
! $R->scrib( 0, "Custom login handler died with: $@" );
! $R->{auth}{logged_in} = 0;
! delete $R->{session}{user_id};
! delete $R->{auth}{user};
! }
! }
!
! return undef;
}
sub create_nologin_user {
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! return $R->user->new({ login_name => 'anonymous', first_name => 'Anonymous',
! last_name => 'User', user_id => 99999 });
}
# If the user is logged in, retrieve the groups he/she/it belongs to
--- 174,203 ----
# closes) unless the user clicked the 'Remember Me' checkbox
+ my $remember_field = $CONFIG->{login}{remember_field};
unless ( $R->apache->param( $remember_field ) ) {
$R->{session}{expiration} = undef;
}
$R->{session}{user_id} = $user->id;
! return $user;
}
+ # Create a 'dummy' user
+
sub create_nologin_user {
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! $R->{auth}{logged_in} = 0;
! delete $R->{session}{user_id};
! return $R->{auth}{user} = $R->user->new({ login_name => 'anonymous',
! first_name => 'Anonymous',
! last_name => 'User',
! user_id => 99999 });
}
+
+ sub custom_login_failed { $_[0]->create_nologin_user }
+
+
# If the user is logged in, retrieve the groups he/she/it belongs to
***************
*** 316,337 ****
$R->{auth}{group}
B<create_nologin_user()>
If a user is not logged in, we create transient user object so that
! $R->{auth}{user} has something in it. It is not a valid user and it
! gets created anew with every request where the user is not logged in.
If you want to rename the login_name, first/last name, etc, just
subclass this class, create your own method, then specify your class
! in the server configuration.
! B<is_admin()>
! Looks at the user and groups and determines whether the user is an
! administrator. If the user is an administrator, then:
! $R->{auth}{is_admin}
! is set to a true value.
=head1 TO DO
--- 362,498 ----
$R->{auth}{group}
+ B<is_admin()>
+
+ Looks at the user and groups and determines whether the user is an
+ administrator. If the user is an administrator, then:
+
+ $R->{auth}{is_admin}
+
+ is set to a true value.
+
+ =head1 SUBCLASSING
+
+ As of OpenInteract 1.35, this module is now more amenable to
+ subclassing. Both the C<user()> and C<group()> methods are broken down
+ into more discrete actions which you can override as you need.
+
+ =head2 User Fetching Actions
+
+ B<fetch_user_id()>
+
+ Retrieves the user ID for this request.
+
+ Default: get the 'user_id' key from the session.
+
+ Returns: user ID value.
+
+ B<fetch_user( $user_id )>
+
+ Called only if a user ID is found using C<fetch_user_id()>. This
+ method retrieves the user object corresponding to C<$user_id>.
+
+ Note that if you are using SPOPS for this (recommended), you almost
+ certainly want to pass a true value for the 'skip_security' parameter,
+ such as:
+
+ return $R->user->fetch( $uid, { skip_security => 1 } );
+
+ Because otherwise the superuser will never be able to login
+
+ Default: get the SPOPS user object matching C<$user_id>.
+
+ Returns: user object on success, undef if user object not found, a
+ C<die> on failure.
+
+ B<fetch_user_failed( $user_id )>
+
+ Called only if C<fetch_user()> throws a C<die>.
+
+ Default: Throws a code '311' error, blanks out the 'user_id' key of
+ the session and returns undef.
+
+ Returns: not checked
+
+ B<check_first_login()>
+
+ Called if C<fetch_user()> succeeds. Many times you want to execute
+ certain actions when the user logs in for the first time. This is a
+ hook for you to do so.
+
+ Default: Make the user part of the 'public' group (this should
+ probably done elsewhere)
+
+ Returns: not checked
+
+ B<login_user()>
+
+ Called if C<fetch_user_id()> does not find a user ID. This should look
+ at the form values passed in and find at least a login name and
+ password. If values for these are not found, the function returns undef.
+
+ If these values are found, the function should fetch the user and
+ authenticate the user by whatever means are appropriate. If the user
+ is properly authenticated, the function should set whatever values are
+ necessary to ensure the user can be found by C<fetch_user_id()> -- by
+ default, this means setting 'user_id' in the session, but your
+ application might use a different means to track the user.
+
+ Default: Look at the 'login_field' and 'password_field' as set in the
+ server configuration under 'login' for the username and password. If
+ found and the user is authenticated, check if 'remember_field' is true
+ and if so, make the session last for the value found in the server
+ configuration under 'session_info'->'expiration'. Otherwise the
+ session is transient and only lasts as long as the browser is open.
+
+ Returns: A user object. If you cannot create one, just return undef.
+
+ B<custom_login_failed()>
+
+ Executed if the execution of the custom login handler fails. (The
+ custom login handler is specified by the class and method defined in
+ the server configuration under 'login', 'custom_login_handler' and
+ 'custom_login_method'.)
+
+ Default: Run C<create_nologin_user()>.
+
+ Returns: not checked
+
B<create_nologin_user()>
If a user is not logged in, we create transient user object so that
! all OpenInteract handlers have something they can refer to. It is not
! a valid user and it gets created anew with every request where the
! user is not logged in.
If you want to rename the login_name, first/last name, etc, just
subclass this class, create your own method, then specify your class
! in the server configuration under 'auth'.
! This method should ensure that the system knows a user is not logged
! in by setting:
! $R->{auth}{logged_in} = undef;
! and by blanking out any tracking information your application sets in
! the session.
! Finally, the method should set:
!
! $R->{auth}{user}
!
! To the transient user object you have created.
!
! =head2 Group Fetching Actions
!
! None! The C<group()> method is so simple that we thought breaking it
! into pieces would make it overly complex. If you override it, your
! code should look something like:
!
! if ( $R->{auth}{logged_in} ) {
! $R->{auth}{group} = $R->{auth}{user}->group;
! }
!
! Which is basically all this method does, with some error checking and
! debugging thrown in.
=head1 TO DO
|
|
From: Chris W. <la...@us...> - 2001-11-06 14:29:57
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv6381
Modified Files:
Session.pm
Log Message:
cosmetic
Index: Session.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Session.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Session.pm 2001/10/01 22:08:40 1.4
--- Session.pm 2001/11/06 14:29:52 1.5
***************
*** 11,15 ****
$OpenInteract::Session::COOKIE_NAME = 'session';
! sub parse {
my ( $class, $session_id ) = @_;
my $R = OpenInteract::Request->instance;
--- 11,15 ----
$OpenInteract::Session::COOKIE_NAME = 'session';
! sub parse {
my ( $class, $session_id ) = @_;
my $R = OpenInteract::Request->instance;
|
|
From: Chris W. <la...@us...> - 2001-11-06 14:04:33
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page In directory usw-pr-cvs1:/tmp/cvs-serv24293 Modified Files: Changes MANIFEST package.conf Log Message: meta Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/Changes,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Changes 2001/10/30 02:25:07 1.9 --- Changes 2001/11/06 14:04:30 1.10 *************** *** 1,4 **** --- 1,8 ---- Revision history for OpenInteract package base_page. + 0.28 Tue Nov 6 09:20:36 EST 2001 + + Added login page and graphics for directory listing. + 0.27 Mon Oct 29 19:42:47 EST 2001 Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/MANIFEST,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MANIFEST 2001/10/29 05:09:45 1.7 --- MANIFEST 2001/11/06 14:04:30 1.8 *************** *** 11,14 **** --- 11,22 ---- doc/titles html/index.html + html/login.html + html/images/file_minus_collapse.gif + html/images/file_minus_collapse_last.gif + html/images/file_plus_expand.gif + html/images/file_plus_expand_last.gif + html/images/file_tree_line.gif + html/images/file_tree_line_last.gif + html/images/file_tree_line_select.gif OpenInteract/ContentType.pm OpenInteract/Page.pm Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/package.conf,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** package.conf 2001/10/30 02:25:08 1.9 --- package.conf 2001/11/06 14:04:30 1.10 *************** *** 1,4 **** name base_page ! version 0.27 author Chris Winters <ch...@cw...> module File::Basename --- 1,4 ---- name base_page ! version 0.28 author Chris Winters <ch...@cw...> module File::Basename |
|
From: Chris W. <la...@us...> - 2001-11-06 14:04:23
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/html In directory usw-pr-cvs1:/tmp/cvs-serv24162/html Added Files: login.html Log Message: added login page -- use this if you don't want to have the login box everywhere --- NEW FILE: login.html --- <div align="center"> <h2>Login</h2> [% INCLUDE table_bordered_begin( table_width = '50%' ) -%] <tr><td> [% INCLUDE base_box::login_box -%] </td></tr> [% PROCESS table_bordered_end -%] </div> |
|
From: Chris W. <la...@us...> - 2001-11-06 14:02:06
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/html/images In directory usw-pr-cvs1:/tmp/cvs-serv22321 Added Files: file_minus_collapse.gif file_minus_collapse_last.gif file_plus_expand.gif file_plus_expand_last.gif file_tree_line.gif file_tree_line_last.gif file_tree_line_select.gif Log Message: added images used in the directory listing --- NEW FILE: file_minus_collapse.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_minus_collapse_last.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_plus_expand.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_plus_expand_last.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_tree_line.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_tree_line_last.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set --- NEW FILE: file_tree_line_select.gif --- GIF89a Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set |
|
From: Chris W. <la...@us...> - 2001-11-06 14:01:41
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/html/images In directory usw-pr-cvs1:/tmp/cvs-serv22090/images Log Message: Directory /cvsroot/openinteract/OpenInteract/pkg/base_page/html/images added to the repository |
|
From: Chris W. <la...@us...> - 2001-11-06 08:43:57
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv13991
Modified Files:
CommonHandler.pm
Log Message:
always use the full field list
Index: CommonHandler.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/CommonHandler.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** CommonHandler.pm 2001/11/01 05:24:57 1.27
--- CommonHandler.pm 2001/11/06 04:25:07 1.28
***************
*** 161,182 ****
$R->DEBUG && $R->scrib( 1, "RUN SEARCH (before): ", scalar localtime );
- # If the results are paged, only retrieve the ID field of our
- # object, and add any fields specified in the ORDER clause as
- # well. Otherwise just select all fields
-
- my ( @field_list );
my $order = $class->MY_SEARCH_RESULTS_ORDER;
- if ( $p->{is_paged} ) {
- @field_list = ( $object_class->id_field );
- if ( $order ) {
- my @order_items = split( /\s*,\s*/, $order );
- push @field_list, grep ! /^(ASC|DESC)$/, @order_items;
- }
- }
- else {
- @field_list = @{ $object_class->field_list };
- }
my $iter = eval { $object_class->fetch_iterator({
- field_list => \@field_list,
from => $tables, where => $where,
value => $values, limit => $limit,
--- 161,166 ----
***************
*** 187,193 ****
$R->scrib( 0, "Search failed: $@ ($SPOPS::Error::system_msg)\nClass: $class\n",
! "FROM:", join( ',', @{ $tables } ), "\n",
! "WHERE: $where\n",
! "VALUES: ", join( ',', @{ $values } ) );
die "Search failed ($SPOPS::Error::system_msg)\n";
}
--- 171,178 ----
$R->scrib( 0, "Search failed: $@ ($SPOPS::Error::system_msg)\nClass: $class\n",
! "FROM", join( ',', @{ $tables } ), "\n",
! "WHERE $where\n",
! "ORDER BY $order\n",
! "VALUES", join( ',', @{ $values } ) );
die "Search failed ($SPOPS::Error::system_msg)\n";
}
|
|
From: Chris W. <la...@us...> - 2001-11-06 08:43:47
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv14341
Modified Files:
Request.pm
Log Message:
cosmetic
Index: Request.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Request.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Request.pm 2001/10/17 04:47:07 1.12
--- Request.pm 2001/11/06 04:25:44 1.13
***************
*** 293,301 ****
$stash_class->clean_stash;
! # Clear out all the content
! foreach my $key ( keys %{ $self } ) {
! delete $self->{ $key };
! }
}
--- 293,299 ----
$stash_class->clean_stash;
! # Clear out all the content in the object
! delete $self->{ $_ } for ( keys %{ $self } );
}
|
|
From: Chris W. <la...@us...> - 2001-11-06 08:43:42
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Session
In directory usw-pr-cvs1:/tmp/cvs-serv14595/Session
Modified Files:
DBI.pm
Log Message:
cosmetic
Index: DBI.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Session/DBI.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DBI.pm 2001/10/01 22:08:52 1.5
--- DBI.pm 2001/11/06 04:26:07 1.6
***************
*** 9,18 ****
$OpenInteract::Session::DBI::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
! sub _create_session {
my ( $class, $session_id ) = @_;
my $R = OpenInteract::Request->instance;
my $session_class = $R->CONFIG->{session_info}{class};
my $session_params = $R->CONFIG->{session_info}{params} || {};
! $session_params->{Handle} = $R->db;
# Detect Apache::Session::MySQL and modify parameters
--- 9,18 ----
$OpenInteract::Session::DBI::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
! sub _create_session {
my ( $class, $session_id ) = @_;
my $R = OpenInteract::Request->instance;
my $session_class = $R->CONFIG->{session_info}{class};
my $session_params = $R->CONFIG->{session_info}{params} || {};
! $session_params->{Handle} = $R->db( 'main' );
# Detect Apache::Session::MySQL and modify parameters
***************
*** 20,24 ****
if ( $session_class =~ /MySQL$/ ) {
! $session_params->{LockHandle} = $R->db;
$R->DEBUG && $R->scrib( 2, "Using MySQL session store, with LockHandle parameter" );
}
--- 20,24 ----
if ( $session_class =~ /MySQL$/ ) {
! $session_params->{LockHandle} = $session_params->{Handle};
$R->DEBUG && $R->scrib( 2, "Using MySQL session store, with LockHandle parameter" );
}
|
|
From: Chris W. <la...@us...> - 2001-11-04 17:54:59
|
Update of /cvsroot/openinteract/SPOPS/t
In directory usw-pr-cvs1:/tmp/cvs-serv5699
Modified Files:
dbi_config.pl
Log Message:
pass in the SPOPS object class being used/tested to check_dbd_compliance()
Index: dbi_config.pl
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/t/dbi_config.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dbi_config.pl 2001/11/04 17:42:27 1.1
--- dbi_config.pl 2001/11/04 17:54:56 1.2
***************
*** 1,4 ****
--- 1,6 ----
#!/usr/bin/perl
+ # $Id$
+
use strict;
use DBI;
***************
*** 115,119 ****
sub check_dbd_compliance {
! my ( $config, $driver_name ) = @_;
if ( $driver_name eq 'ASAny' ) {
--- 117,121 ----
sub check_dbd_compliance {
! my ( $config, $driver_name, $spops_class ) = @_;
if ( $driver_name eq 'ASAny' ) {
***************
*** 150,154 ****
warn "\nDBD Driver $driver_name does not support {TYPE} information\n",
"Installing manual types for test.\n";
! assign_manual_types( 'DBITest' );
}
--- 152,156 ----
warn "\nDBD Driver $driver_name does not support {TYPE} information\n",
"Installing manual types for test.\n";
! assign_manual_types( $spops_class );
}
|
|
From: Chris W. <la...@us...> - 2001-11-04 17:54:29
|
Update of /cvsroot/openinteract/SPOPS/t
In directory usw-pr-cvs1:/tmp/cvs-serv5645
Modified Files:
30_dbi.t
Log Message:
make the SPOPS class a variable instead of hardcoded, other small changes
Index: 30_dbi.t
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/t/30_dbi.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** 30_dbi.t 2001/11/04 17:42:50 1.3
--- 30_dbi.t 2001/11/04 17:54:26 1.4
***************
*** 13,16 ****
--- 13,18 ----
use constant TEST_TABLE_NAME => 'spops_test';
+ my $SPOPS_CLASS = 'DBITest';
+
{
***************
*** 26,30 ****
my $driver_name = $config->{DBI_driver};
! my $spops_dbi_driver = check_dbd_compliance( $config, $driver_name );
# Ensure we can get to SPOPS::Initialize
--- 28,32 ----
my $driver_name = $config->{DBI_driver};
! my $spops_dbi_driver = check_dbd_compliance( $config, $driver_name, $SPOPS_CLASS );
# Ensure we can get to SPOPS::Initialize
***************
*** 37,41 ****
my $spops_config = {
tester => {
! class => 'DBITest',
isa => [ $spops_dbi_driver, 'SPOPS::DBI' ],
field => [ qw/ spops_id spops_name spops_goop spops_num / ],
--- 39,43 ----
my $spops_config = {
tester => {
! class => $SPOPS_CLASS,
isa => [ $spops_dbi_driver, 'SPOPS::DBI' ],
field => [ qw/ spops_id spops_name spops_goop spops_num / ],
***************
*** 49,53 ****
my $class_init_list = eval { SPOPS::Initialize->process({ config => $spops_config }) };
ok( ! $@, 'Initialize process run' );
! ok( $class_init_list->[0] eq 'DBITest', 'Initialize class' );
--- 51,55 ----
my $class_init_list = eval { SPOPS::Initialize->process({ config => $spops_config }) };
ok( ! $@, 'Initialize process run' );
! ok( $class_init_list->[0] eq $SPOPS_CLASS, 'Initialize class' );
***************
*** 59,66 ****
# Create an object
{
! my $obj = eval { DBITest->new({ spops_name => 'MyProject',
! spops_goop => 'oopie doop',
! spops_num => 241,
! spops_id => 42 } ) };
ok( ! $@, 'Create object' );
--- 61,68 ----
# Create an object
{
! my $obj = eval { $SPOPS_CLASS->new({ spops_name => 'MyProject',
! spops_goop => 'oopie doop',
! spops_num => 241,
! spops_id => 42 } ) };
ok( ! $@, 'Create object' );
***************
*** 76,80 ****
# Fetch an object, then update it
{
! my $obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch object (perform)' );
if ( $@ ) {
--- 78,82 ----
# Fetch an object, then update it
{
! my $obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch object (perform)' );
if ( $@ ) {
***************
*** 92,96 ****
}
! my $new_obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( $new_obj->{spops_name} eq $obj->{spops_name}, 'Fetch object (after update)' );
}
--- 94,98 ----
}
! my $new_obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( $new_obj->{spops_name} eq $obj->{spops_name}, 'Fetch object (after update)' );
}
***************
*** 98,102 ****
# Fetch an object then clone it and save it
{
! my $obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
my $new_obj = eval { $obj->clone({ spops_name => 'YourProject',
spops_goop => 'this n that',
--- 100,104 ----
# Fetch an object then clone it and save it
{
! my $obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
my $new_obj = eval { $obj->clone({ spops_name => 'YourProject',
spops_goop => 'this n that',
***************
*** 115,119 ****
# field and see if the default comes through
{
! my $obj = DBITest->new({ spops_id => 1588,
spops_goop => 'here we go!',
spops_name => 'AnotherProject' });
--- 117,121 ----
# field and see if the default comes through
{
! my $obj = $SPOPS_CLASS->new({ spops_id => 1588,
spops_goop => 'here we go!',
spops_name => 'AnotherProject' });
***************
*** 124,128 ****
# Fetch the three objects in the db and be sure we got them all
{
! my $obj_list = eval { DBITest->fetch_group({ db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch group' );
if ( $@ ) {
--- 126,130 ----
# Fetch the three objects in the db and be sure we got them all
{
! my $obj_list = eval { $SPOPS_CLASS->fetch_group({ db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch group' );
if ( $@ ) {
***************
*** 135,139 ****
# Fetch a count of the objects in the database
{
! my $obj_count = eval { DBITest->fetch_count({ db => $db }) };
ok( $obj_count == 3, 'Fetch count' );
}
--- 137,141 ----
# Fetch a count of the objects in the database
{
! my $obj_count = eval { $SPOPS_CLASS->fetch_count({ db => $db }) };
ok( $obj_count == 3, 'Fetch count' );
}
***************
*** 141,145 ****
# Create an iterator and run through the objects
{
! my $iter = eval { DBITest->fetch_iterator({ db => $db, skip_cache => 1 }) };
ok( $iter->isa( 'SPOPS::Iterator' ), 'Iterator returned' );
my $count = 0;
--- 143,147 ----
# Create an iterator and run through the objects
{
! my $iter = eval { $SPOPS_CLASS->fetch_iterator({ db => $db, skip_cache => 1 }) };
ok( $iter->isa( 'SPOPS::Iterator' ), 'Iterator returned' );
my $count = 0;
|
|
From: Chris W. <la...@us...> - 2001-11-04 17:54:00
|
Update of /cvsroot/openinteract/SPOPS/t
In directory usw-pr-cvs1:/tmp/cvs-serv5581
Added Files:
31_dbi_multifield.t
Log Message:
added new test suite for SPOPS::DBI objects with multiple field primary keys
--- NEW FILE: 31_dbi_multifield.t ---
# -*-perl-*-
# $Id: 31_dbi_multifield.t,v 1.1 2001/11/04 17:53:57 lachoy Exp $
# Almost exactly the same as 30_dbi.t, but here we're testing whether
# multiple-field primary keys work ok
use strict;
use Data::Dumper qw( Dumper );
use constant NUM_TESTS => 18;
use constant TEST_TABLE_NAME => 'spops_multi_test';
my $SPOPS_CLASS = 'DBIMultiTest';
{
# Grab our DBI routines and be sure we're supposed to run.
do "t/dbi_config.pl";
my $config = test_dbi_run();
require Test::More;
Test::More->import( tests => NUM_TESTS );
my $driver_name = $config->{DBI_driver};
my $spops_dbi_driver = check_dbd_compliance( $config, $driver_name, $SPOPS_CLASS );
# Ensure we can get to SPOPS::Initialize
eval { require SPOPS::Initialize };
ok( ! $@, 'SPOPS::Initialize load' );
# Create the class using SPOPS::Initialize
my $spops_config = {
tester => {
class => $SPOPS_CLASS,
isa => [ $spops_dbi_driver, 'SPOPS::DBI' ],
field => [ qw/ spops_time spops_user spops_name spops_goop spops_num / ],
id_field => [ 'spops_time', 'spops_user' ],
skip_undef => [ 'spops_num' ],
sql_defaults => [ 'spops_num' ],
base_table => TEST_TABLE_NAME,
table_name => TEST_TABLE_NAME,
},
};
my $class_init_list = eval { SPOPS::Initialize->process({ config => $spops_config }) };
ok( ! $@, 'Initialize process run' );
ok( $class_init_list->[0] eq $SPOPS_CLASS, 'Initialize class' );
# Create a database handle and create our testing table
my $db = get_db_handle( $config );
create_table( $db, 'multi', TEST_TABLE_NAME );
my $obj_time = 1004897158;
my $obj_user = 5;
# Create an object
{
my $obj = eval { $SPOPS_CLASS->new({ spops_name => 'MyProject',
spops_goop => 'oopie doop',
spops_num => 241,
spops_time => $obj_time,
spops_user => $obj_user } ) };
ok( ! $@, 'Create object' );
# Save the object
eval { $obj->save({ is_add => 1, db => $db, skip_cache => 1 }) };
ok( ! $@, 'Save object (create)' );
if ( $@ ) {
warn "Error saving object: $@\n", Dumper( SPOPS::Error->get ), "\n";
}
}
# Fetch an object, then update it
{
my $obj = eval { $SPOPS_CLASS->fetch( "$obj_time,$obj_user", { db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch object (perform)' );
if ( $@ ) {
warn "Cannot fetch object: $@\n", Dumper( SPOPS::Error->get ), "\n";
}
ok( $obj->{spops_name} eq 'MyProject', 'Fetch object (correct data)' );
$obj->{spops_name} = 'TheirProject';
$obj->{spops_goop} = 'over there';
eval { $obj->save({ db => $db, skip_cache => 1 }) };
ok( ! $@, 'Save object (update)' );
if ( $@ ) {
warn "Cannot update object: $@\n", Dumper( SPOPS::Error->get ), "\n";
}
my $new_obj = eval { $SPOPS_CLASS->fetch( "$obj_time,$obj_user", { db => $db, skip_cache => 1 } ) };
ok( $new_obj->{spops_name} eq $obj->{spops_name}, 'Fetch object (after update)' );
}
# Fetch an object then clone it and save it
{
my $obj = eval { $SPOPS_CLASS->fetch( "$obj_time,$obj_user", { db => $db, skip_cache => 1 } ) };
my $new_obj = eval { $obj->clone({ spops_name => 'YourProject',
spops_goop => 'this n that',
spops_time => 1004897257 } ) };
ok( ! $@, 'Clone object (perform)' );
ok( $new_obj->{spops_name} ne $obj->{spops_name}, 'Clone object (correct data)');
eval { $new_obj->save( { is_add => 1, db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Save object (create, after clone)' );
if ( $@ ) {
warn "Cannot save object: $@\n", Dumper( SPOPS::Error->get ), "\n";
}
}
# Create another object, but this time don't define the spops_num
# field and see if the default comes through
{
my $obj = $SPOPS_CLASS->new({ spops_time => 1004897292,
spops_user => 5,
spops_goop => 'here we go!',
spops_name => 'AnotherProject' });
eval { $obj->save({ is_add => 1, db => $db, skip_cache => 1 }) };
ok( $obj->{spops_num} == 2, 'Fetch object (correct data with default' );
}
# Fetch the three objects in the db and be sure we got them all
{
my $obj_list = eval { $SPOPS_CLASS->fetch_group({ db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch group' );
if ( $@ ) {
warn "Cannot retrieve objects: $@\n", Dumper( SPOPS::Error->get ), "\n";
}
ok( ref $obj_list eq 'ARRAY' && scalar @{ $obj_list } == 3, 'Fetch group (return check)' );
}
# Fetch a count of the objects in the database
{
my $obj_count = eval { $SPOPS_CLASS->fetch_count({ db => $db }) };
ok( $obj_count == 3, 'Fetch count' );
}
# Create an iterator and run through the objects
{
my $iter = eval { $SPOPS_CLASS->fetch_iterator({ db => $db, skip_cache => 1 }) };
ok( $iter->isa( 'SPOPS::Iterator' ), 'Iterator returned' );
my $count = 0;
while ( my $obj = $iter->get_next ) {
$count++;
}
ok( $count == 3, 'Iterator fetch count' );
}
# cleanup( $db, TEST_TABLE_NAME );
# Future testing ideas:
# - security
# - timestamp checking
# - fetch_group using 'where'
}
|