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...> - 2004-12-05 19:33:24
|
Update of /cvsroot/openinteract/OpenInteract2/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20318/script Modified Files: oi2_manage Log Message: add some debugging info on exception Index: oi2_manage =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/script/oi2_manage,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** oi2_manage 9 Nov 2004 13:49:37 -0000 1.28 --- oi2_manage 5 Dec 2004 19:33:13 -0000 1.29 *************** *** 164,174 **** eval { $task->execute }; if ( $@ ) { ! $log->error( "Caught exception during task execution: $@" ); outl( 'Caught exception during task execution.' ); ! if ( $@->isa( 'OpenInteract2::Exception::Parameter' ) ) { ! warn show_parameter_error( $@ ); } else { ! warn "$@\n"; } exit(1); --- 164,179 ---- eval { $task->execute }; if ( $@ ) { ! my $error = $@; ! $log->error( "Caught exception during task execution: $error" ); ! for ( 0..10 ) { ! my ( $pkg, $file, $line, $sub ) = caller( $_ ); ! $log->error( "Call $_: $pkg, $file, $line, $sub" ); ! } outl( 'Caught exception during task execution.' ); ! if ( $error->isa( 'OpenInteract2::Exception::Parameter' ) ) { ! outl( show_parameter_error( $error ) ); } else { ! outl( "$error\n" ); } exit(1); |
From: Chris W. <la...@us...> - 2004-12-05 18:50:24
|
Update of /cvsroot/openinteract/OpenInteract2/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/t Modified Files: 00_manage_create_website.t config_readonly.t utils.pl Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: 00_manage_create_website.t =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/00_manage_create_website.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 00_manage_create_website.t 28 Nov 2004 20:29:09 -0000 1.1 --- 00_manage_create_website.t 5 Dec 2004 18:50:11 -0000 1.2 *************** *** 17,21 **** my $website_dir = get_test_site_dir(); ! # If the testing site already exists it's history if ( -d $website_dir ) { rmtree( $website_dir ); --- 17,21 ---- my $website_dir = get_test_site_dir(); ! # Delete the testing site if it already exists if ( -d $website_dir ) { rmtree( $website_dir ); Index: config_readonly.t =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/config_readonly.t,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config_readonly.t 6 Jun 2004 06:13:40 -0000 1.4 --- config_readonly.t 5 Dec 2004 18:50:11 -0000 1.5 *************** *** 7,12 **** require 'utils.pl'; use File::Copy qw( cp ); ! use File::Spec::Functions qw( catfile ); ! use Test::More tests => 12; require_ok( 'OpenInteract2::Config::Readonly' ); --- 7,12 ---- require 'utils.pl'; use File::Copy qw( cp ); ! use File::Spec::Functions qw( catfile ); ! use Test::More tests => 14; require_ok( 'OpenInteract2::Config::Readonly' ); *************** *** 14,64 **** my $use_dir = get_use_dir(); ! # Copy our test data to the right name ! cp( get_use_file( 'test_no_overwrite', 'name' ), ! get_use_file( '.no_overwrite', 'name' ) ); ! # Check reading the file ! my $readonly = OpenInteract2::Config::Readonly->read_config( $use_dir ); ! is( scalar @{ $readonly }, 2, 'Number of readonly entries' ); ! is( $readonly->[0], 'test_file.pdf', 'Readonly entry 1' ); ! is( $readonly->[1], 'test_file.gif', 'Readonly entry 2' ); ! # Check is_writeable_file against the list and directory ! my $write_enum_nok = OpenInteract2::Config::Readonly ! ->is_writeable_file( $readonly, 'test_file.pdf' ); ! my $write_dir_nok = OpenInteract2::Config::Readonly ! ->is_writeable_file( $use_dir, 'test_file.pdf' ); ! my $write_enum_ok = OpenInteract2::Config::Readonly ! ->is_writeable_file( $readonly, 'test_nonexist.pdf' ); ! my $write_dir_ok = OpenInteract2::Config::Readonly ! ->is_writeable_file( $use_dir, 'test_nonexist.pdf' ); ! ok( ! $write_enum_nok, "Marked readonly file from list" ); ! ok( ! $write_dir_nok, "Marked readonly file from dir" ); ! ok( $write_enum_ok, "Not marked readonly file from list" ); ! ok( $write_dir_ok, "Not marked readonly file from dir" ); ! # Check get_writeable_files against files in t/ using listing and $dir - opendir( USEDIR, $use_dir ); - my @test_files = grep { -f catfile( $use_dir, $_ ) } - readdir( USEDIR ); - my $writeable_enum = OpenInteract2::Config::Readonly - ->get_writeable_files( $readonly, \@test_files ); - my $writeable_dir = OpenInteract2::Config::Readonly - ->get_writeable_files( $use_dir, \@test_files ); - is( scalar @{ $writeable_enum }, scalar( @test_files ) - 2, "Number of writeable files from list" ); - is( scalar @{ $writeable_dir }, scalar( @test_files ) - 2, "Number of writeable files from dir" ); unlink( get_use_file( '.no_overwrite' ) ); ! # Check writing a config - my $file_written = eval { - OpenInteract2::Config::Readonly - ->write_config( $use_dir, [ 'file_a.txt', 'file_b.txt' ] ) - }; - ok( ! $@, 'Readonly listing written to file' ) || diag "Error: $@"; - my $read_written = get_use_file( '.no_overwrite', 'content' ); - is( $read_written, "file_a.txt\nfile_b.txt", 'Written readonly listing matches' ); unlink( get_use_file( '.no_overwrite' ) ); --- 14,88 ---- my $use_dir = get_use_dir(); ! # get rid of any leftovers ! unlink( get_use_file( '.no_overwrite', 'name' ) ); ! { ! # Copy our test data to the right name ! cp( get_use_file( 'test_no_overwrite', 'name' ), ! get_use_file( '.no_overwrite', 'name' ) ); ! my $ro = eval { OpenInteract2::Config::Readonly->new( $use_dir ) }; ! is( ref( $ro ), 'OpenInteract2::Config::Readonly', ! 'Constructor returned object of correct type' ); ! is( $ro->directory, $use_dir, ! 'Directory property same as what we passed into constructor' ); ! # Check number of files read in ! my $readonly_files = $ro->get_readonly_files; ! is( scalar @{ $readonly_files }, 2, 'Number of readonly entries' ); ! my %readonly_map = map { $_ => 1 } @{ $readonly_files }; ! for ( qw( test_file.pdf test_file.gif ) ) { ! ok( $readonly_map{ $_ }, "Readonly entry exists '$_'" ); ! } ! # Check is_writeable against the list and directory ! ok( ! $ro->is_writeable( 'test_file.pdf' ), ! 'Readonly file is not writeable' ); ! ok( $ro->is_writeable( 'test_nonexist.pdf' ), ! 'Non-readonly file is writeable' ); ! # Check case_sensitivity ! ok( $ro->is_writeable( 'test_file.PDF' ), ! 'Readonly file with uppercase extension is writeable' ); ! ! # Check list of all writeable files against what we read ! my $writeable_files = $ro->get_all_writeable_files; ! ! opendir( USEDIR, $use_dir ); ! my @test_files = grep { -f catfile( $use_dir, $_ ) } ! grep { $_ ne '.no_overwrite' } ! readdir( USEDIR ); ! ! is( scalar @{ $writeable_files }, scalar( @test_files ) - 2, ! 'Number of writeable files from dir' ) ! || diag( "Writeable: " . join( ', ', @{ $writeable_files } ) . "\n" . ! "Test: " . join( ', ', @test_files ) ); ! } unlink( get_use_file( '.no_overwrite' ) ); ! { ! # Check writing a config ! my $ro = OpenInteract2::Config::Readonly->new( $use_dir ); ! eval { ! $ro->write_readonly_files( [ 'file_a.txt', 'file_b.txt' ] ); ! }; ! ok( ! $@, 'Readonly listing written to file' ) || diag "Error: $@"; ! my $read_written = get_use_file( '.no_overwrite', 'content' ); ! is( $read_written, "file_a.txt\nfile_b.txt", ! 'Written readonly listing matches' ); ! ! # ...with comment ! eval { ! $ro->write_readonly_files( [ 'file_a.txt', 'file_b.txt' ], ! 'This is a comment' ); ! }; ! ok( ! $@, 'Readonly listing with comment written to file' ) ! || diag "Error: $@"; ! my $read_written_cmt = get_use_file( '.no_overwrite', 'content' ); ! is( $read_written_cmt, "# This is a comment\n\nfile_a.txt\nfile_b.txt", ! 'Written readonly listing with comment matches' ); ! } unlink( get_use_file( '.no_overwrite' ) ); + Index: utils.pl =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/utils.pl,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** utils.pl 5 Dec 2004 08:51:18 -0000 1.83 --- utils.pl 5 Dec 2004 18:50:11 -0000 1.84 *************** *** 23,32 **** BEGIN { ! $log = OpenInteract2::Log->init_file( 'oi2_tests.log', $DEBUG ); ! $log->info( "Starting test run" ); } END { ! $log->info( "Finished test run" ); } --- 23,35 ---- BEGIN { ! #my $log_level = $DEBUG; ! # TODO: Change before distributing! ! my $log_level = $WARN; ! $log = OpenInteract2::Log->init_file( 'oi2_tests.log', $log_level ); ! $log->warn( "Starting test run" ); } END { ! $log->warn( "Finished test run" ); } |
From: Chris W. <la...@us...> - 2004-12-05 18:50:23
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage/Website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/lib/OpenInteract2/Manage/Website Modified Files: Create.pm Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: Create.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage/Website/Create.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Create.pm 13 Jun 2004 18:19:54 -0000 1.22 --- Create.pm 5 Dec 2004 18:50:11 -0000 1.23 *************** *** 71,75 **** if ( $name eq 'website_dir' ) { if ( -d $value ) { ! return "Website directory [$value] already exists; cannot " . "create website over an existing site"; } --- 71,75 ---- if ( $name eq 'website_dir' ) { if ( -d $value ) { ! return "Website directory '$value' already exists; cannot " . "create website over an existing site"; } *************** *** 142,150 **** $self->_set_nowrite_files( $website_dir, $source_dir ); ! $self->_add_status_head( ! { action => 'create website', ! is_ok => 'yes', ! message => 'All directories and files created, all ' . ! 'packages installed' }); } --- 142,151 ---- $self->_set_nowrite_files( $website_dir, $source_dir ); ! $self->_add_status_head({ ! action => 'create website', ! is_ok => 'yes', ! message => 'All directories and files created, all ' . ! 'packages installed', ! }); } *************** *** 165,172 **** oi_error "Cannot create subdirectory in [$full_subdir]: $@"; } ! $self->_add_status( { is_ok => 'yes', ! action => 'create subdirectory', ! filename => $full_subdir, ! message => 'Directory created' } ); } } --- 166,175 ---- oi_error "Cannot create subdirectory in [$full_subdir]: $@"; } ! $self->_add_status({ ! is_ok => 'yes', ! action => 'create subdirectory', ! filename => $full_subdir, ! message => 'Directory created', ! }); } } *************** *** 180,187 **** ->run( $website_dir ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status( { is_ok => 'yes', ! action => 'copy widget', ! message => 'Copied file from sample site', ! filename => $copied } ); } } --- 183,192 ---- ->run( $website_dir ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status({ ! is_ok => 'yes', ! action => 'copy widget', ! message => 'Copied file from sample site', ! filename => $copied, ! }); } } *************** *** 195,202 **** ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status( { is_ok => 'yes', ! action => 'copy localized messages', ! message => 'Copied file from sample site', ! filename => $copied } ); } } --- 200,209 ---- ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status({ ! is_ok => 'yes', ! action => 'copy localized messages', ! message => 'Copied file from sample site', ! filename => $copied, ! }); } } *************** *** 210,217 **** ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status( { is_ok => 'yes', ! action => 'copy server config', ! message => 'Copied file from sample site', ! filename => $copied } ); } } --- 217,226 ---- ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status({ ! is_ok => 'yes', ! action => 'copy server config', ! message => 'Copied file from sample site', ! filename => $copied, ! }); } } *************** *** 253,260 **** ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status( { is_ok => 'yes', ! action => "copy $desc config", ! message => 'Copied file from sample site', ! filename => $copied } ); } --- 262,271 ---- ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status({ ! is_ok => 'yes', ! action => "copy $desc config", ! message => 'Copied file from sample site', ! filename => $copied, ! }); } *************** *** 269,276 **** ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status( { is_ok => 'yes', ! action => 'copy standalone daemon config', ! message => 'Copied file from sample site', ! filename => $copied } ); } } --- 280,289 ---- ->run( $website_dir, \%vars ); foreach my $copied ( @{ $transferred } ) { ! $self->_add_status({ ! is_ok => 'yes', ! action => 'copy standalone daemon config', ! message => 'Copied file from sample site', ! filename => $copied, ! }); } } *************** *** 282,305 **** my $action = 'set nowrite file'; my $html_dir = catdir( $website_dir, 'html' ); ! my $html_message = join( '', 'If a file is listed here it will not be ', ! 'updated when the package to which it ', ! 'belongs is updated.' ); eval { ! OpenInteract2::Config::Readonly->write_config( ! $html_dir, ! { file => [ 'index.html', 'main.css' ], ! comment => $html_message } ) ! }; if ( $@ ) { ! $self->_add_status( { is_ok => 'no', ! action => $action, ! filename => $html_dir, ! message => "$@" } ); } else { ! $self->_add_status( { is_ok => 'yes', ! action => $action, ! filename => $html_dir, ! message => 'Read-only file created ok' } ); } --- 295,322 ---- my $action = 'set nowrite file'; my $html_dir = catdir( $website_dir, 'html' ); ! my $html_message = ! 'If a file is listed here it will not be updated when the ' . ! 'package to which it belongs is updated.'; eval { ! OpenInteract2::Config::Readonly ! ->new( $html_dir ) ! ->write_readonly_files( [ 'index.html', 'main.css' ], $html_message ); ! }; if ( $@ ) { ! warn ! $self->_add_status({ ! is_ok => 'no', ! action => $action, ! filename => $html_dir, ! message => "$@", ! }); } else { ! $self->_add_status({ ! is_ok => 'yes', ! action => $action, ! filename => $html_dir, ! message => 'Read-only file created ok', ! }); } *************** *** 307,328 **** my $tmpl_status = { action => $action, filename => $tmpl_dir }; ! my $tmpl_message = join( '', 'These are templates that will not be ', ! 'overwritten when you run refresh the ', ! 'widgets (one template per line)' ); ! eval { OpenInteract2::Config::Readonly->write_config( ! $tmpl_dir, ! { file => [ 'base_main', 'base_simple' ], ! comment => $tmpl_message } ) }; if ( $@ ) { ! $self->_add_status( { is_ok => 'no', ! action => $action, ! filename => $tmpl_dir, ! message => "$@" } ); } else { ! $self->_add_status( { is_ok => 'yes', ! action => $action, ! filename => $tmpl_dir, ! message => 'Read-only file created ok' } ); } } --- 324,350 ---- my $tmpl_status = { action => $action, filename => $tmpl_dir }; ! my $tmpl_message = ! 'These are templates that will not be overwritten when you ' . ! 'refresh the widgets or upgrade your site (one template per line)'; ! eval { ! OpenInteract2::Config::Readonly ! ->new( $tmpl_dir ) ! ->write_readonly_files( [ 'base_main', 'base_simple' ], $tmpl_message ); ! }; if ( $@ ) { ! $self->_add_status({ ! is_ok => 'no', ! action => $action, ! filename => $tmpl_dir, ! message => "$@", ! }); } else { ! $self->_add_status({ ! is_ok => 'yes', ! action => $action, ! filename => $tmpl_dir, ! message => 'Read-only file created ok', ! }); } } |
From: Chris W. <la...@us...> - 2004-12-05 18:50:22
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/lib/OpenInteract2 Modified Files: Package.pm Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: Package.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Package.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Package.pm 9 Jun 2004 01:10:51 -0000 1.39 --- Package.pm 5 Dec 2004 18:50:10 -0000 1.40 *************** *** 257,262 **** } my $dir = $self->directory; ! my @action_files = map { catfile( $dir, $_ ) } ! @{ $base_files }; $self->_check_file_validity( \@action_files ); return $base_files --- 257,261 ---- } my $dir = $self->directory; ! my @action_files = map { catfile( $dir, $_ ) } @{ $base_files }; $self->_check_file_validity( \@action_files ); return $base_files *************** *** 268,273 **** my @base_doc_files = grep { m|^doc| } @{ $files }; my $dir = $self->directory; ! my @check_files = map { catfile( $dir, $_ ) } ! @base_doc_files; $self->_check_file_validity( \@check_files ); return \@base_doc_files; --- 267,271 ---- my @base_doc_files = grep { m|^doc| } @{ $files }; my $dir = $self->directory; ! my @check_files = map { catfile( $dir, $_ ) } @base_doc_files; $self->_check_file_validity( \@check_files ); return \@base_doc_files; *************** *** 555,559 **** return undef unless ( $full_file ); open( IN, '<', $full_file ) ! || die "Cannot read '$full_file': $!"; my @content = <IN>; close( IN ); --- 553,557 ---- return undef unless ( $full_file ); open( IN, '<', $full_file ) ! || oi_error "Cannot read '$full_file': $!"; my @content = <IN>; close( IN ); *************** *** 643,649 **** my ( $class, $config, $repository ) = @_; my $full_package_name = join( '-', $config->name, $config->version ); ! my $full_package_dir = catfile( ! $repository->full_package_dir, ! $full_package_name ); if ( -d $full_package_dir ) { oi_error "The directory into which the distribution should be ", --- 641,646 ---- my ( $class, $config, $repository ) = @_; my $full_package_name = join( '-', $config->name, $config->version ); ! my $full_package_dir = catfile( $repository->full_package_dir, ! $full_package_name ); if ( -d $full_package_dir ) { oi_error "The directory into which the distribution should be ", *************** *** 690,693 **** --- 687,692 ---- eval { my $count = 0; + my %ro_by_dir = (); + BASE_FILE: foreach my $from_base ( @{ $base_files } ) { *************** *** 698,719 **** my $to_base = $dest_files->[ $count ] || $from_base; my $full_dest_path = catfile( $website_dir, $to_base ); $self->_create_full_path( $full_dest_path ); ! # Yeah, this is slightly inefficient, but (a) it's much ! # simpler than the alternative, (2) there aren't many ! # times where packages have files to copy and (iii) you ! # don't install packages very often... ! ! my $can_copy = OpenInteract2::Config::Readonly ! ->is_writeable_file( dirname( $full_dest_path ), ! $full_dest_path ); ! next unless ( $can_copy ); ! my $full_source_path = catfile( ! $package_dir, $from_base ); ! # Backup the file if it already exists if ( -f $full_dest_path ) { rename( $full_dest_path, "$full_dest_path.$BACKUP_EXT" ) || die "Cannot backup '$full_dest_path': $!"; --- 697,722 ---- my $to_base = $dest_files->[ $count ] || $from_base; + my $full_source_path = catfile( $package_dir, $from_base ); my $full_dest_path = catfile( $website_dir, $to_base ); $self->_create_full_path( $full_dest_path ); ! my $full_dest_dir = dirname( $full_dest_path ); ! my $ro = $ro_by_dir{ $full_dest_dir }; ! unless ( $ro ) { ! $ro_by_dir{ $full_dest_dir } = ! OpenInteract2::Config::Readonly->new( $full_dest_dir ); ! $ro = $ro_by_dir{ $full_dest_dir }; ! } ! # If file already exists check if we can write, and if so ! # backup the file if ( -f $full_dest_path ) { + unless ( $ro->is_writeable( $to_base ) ) { + $log->is_debug && + $log->debug( "Will not copy '$full_source_path' ", + "to '$full_dest_path': marked readonly" ); + next BASE_FILE; + } rename( $full_dest_path, "$full_dest_path.$BACKUP_EXT" ) || die "Cannot backup '$full_dest_path': $!"; |
From: Chris W. <la...@us...> - 2004-12-05 18:50:21
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/lib/OpenInteract2/Config Modified Files: Readonly.pm TransferSample.pm Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: Readonly.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config/Readonly.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Readonly.pm 18 Feb 2004 05:25:27 -0000 1.9 --- Readonly.pm 5 Dec 2004 18:50:10 -0000 1.10 *************** *** 4,8 **** --- 4,10 ---- use strict; + use base qw( Class::Accessor ); use File::Basename qw( basename ); + use File::Spec::Functions qw( catfile rel2abs ); use Log::Log4perl qw( get_logger ); use OpenInteract2::Constants qw( :log ); *************** *** 13,16 **** --- 15,20 ---- $OpenInteract2::Config::Readonly::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); + __PACKAGE__->mk_accessors( 'directory' ); + my ( $log ); *************** *** 20,60 **** my $READONLY_FILE = '.no_overwrite'; ! sub is_writeable_file { ! my ( $class, $readonly, $filename ) = @_; ! return undef unless ( $filename ); ! my $writeable = $class->get_writeable_files( $readonly, [ $filename ] ); ! return ( defined $writeable->[0] && $filename eq $writeable->[0] ); } - sub get_writeable_files { - my ( $class, $readonly, $to_check ) = @_; ! # If $readonly is a scalar treat as a directory name ! unless ( ref $readonly ) { ! $readonly = $class->read_config( $readonly ); ! } ! # If $to_check isn't valid then we're saying nothing is writeable ! unless ( ref $to_check eq 'ARRAY' and scalar @{ $to_check } ) { ! return []; } ! # Only return files not in the readonly hash ! my %ro = map { $_ => 1 } @{ $readonly }; ! return [ grep { ! $ro{ basename( $_ ) } } @{ $to_check } ]; ! } ! ! # Read in the file that tells us what files in $dir should not be ! # overwritten ! sub read_config { ! my ( $class, $dir ) = @_; ! $log ||= get_logger( LOG_CONFIG ); ! my $overwrite_check_file = $class->_create_readonly_file( $dir ); return [] unless ( -f $overwrite_check_file ); ! my ( @no_write ); eval { open( NOWRITE, '<', $overwrite_check_file ) || die $! }; if ( $@ ) { ! $log->error( "Cannot read readonly file [$overwrite_check_file]: $@" ); return []; } --- 24,63 ---- my $READONLY_FILE = '.no_overwrite'; ! sub new { ! my ( $class, $directory ) = @_; ! unless ( -d $directory ) { ! oi_error "Must initialize a $class object with a valid directory"; ! } ! my $self = bless({ ! directory => $directory ! }, $class ); ! $self->get_readonly_files(); ! return $self; } ! sub is_writeable { ! my ( $self, $filename ) = @_; ! return 0 unless ( $filename ); ! return 0 if ( $self->{readonly_files}{ basename( $filename ) } ); ! return 1; ! } ! sub get_readonly_files { ! my ( $self ) = @_; ! if ( $self->{readonly_files} ) { ! return [ keys %{ $self->{readonly_files} } ]; } + $log ||= get_logger( LOG_CONFIG ); ! my $overwrite_check_file = $self->_create_readonly_file(); ! # This means everything is writeable... return [] unless ( -f $overwrite_check_file ); ! ! my ( @readonly ); eval { open( NOWRITE, '<', $overwrite_check_file ) || die $! }; if ( $@ ) { ! $log->error( "Cannot read readonly file '$overwrite_check_file': $@" ); return []; } *************** *** 65,93 **** s/^\s+//; s/\s+$//; ! push @no_write, $_; } close( NOWRITE ); ! return \@no_write; } ! sub write_config { ! my ( $class, $dir, $to_write ) = @_; ! my ( $comment, $files ); ! if ( ref $to_write eq 'HASH' ) { ! $comment = $to_write->{comment}; ! $files = $to_write->{file}; ! } ! elsif ( ref $to_write eq 'ARRAY' ) { ! $comment = undef; ! $files = $to_write; ! } unless ( ref $files eq 'ARRAY' and scalar @{ $files } ) { return undef; } ! my $overwrite_check_file = $class->_create_readonly_file( $dir ); eval { open( NOWRITE, '>', $overwrite_check_file ) || die $! }; if ( $@ ) { ! oi_error "Failed to create file [$overwrite_check_file]: $@"; } if ( $comment ) { --- 68,97 ---- s/^\s+//; s/\s+$//; ! push @readonly, $_; } close( NOWRITE ); ! $self->{readonly_files} = { map { $_ => 1 } @readonly }; ! return \@readonly; } + sub get_all_writeable_files { + my ( $self ) = @_; + my $dir = $self->directory; + opendir( DIR, $dir ) + || die sprintf( "Cannot read from '%s': %s", $dir, $! ); + my @files = grep { $_ ne $READONLY_FILE } grep { -f "$dir/$_" } readdir( DIR ); + closedir( DIR ); + return [ grep { $self->is_writeable( $_ ) } @files ]; + } ! sub write_readonly_files { ! my ( $self, $files, $comment ) = @_; unless ( ref $files eq 'ARRAY' and scalar @{ $files } ) { return undef; } ! my $overwrite_check_file = $self->_create_readonly_file(); eval { open( NOWRITE, '>', $overwrite_check_file ) || die $! }; if ( $@ ) { ! oi_error "Failed to create file '$overwrite_check_file': $@"; } if ( $comment ) { *************** *** 99,109 **** close( NOWRITE ); return $overwrite_check_file; - } sub _create_readonly_file { my ( $class, $dir ) = @_; ! return File::Spec->catfile( File::Spec->rel2abs( $dir ), ! $READONLY_FILE ); } --- 103,151 ---- close( NOWRITE ); return $overwrite_check_file; + } sub _create_readonly_file { + my ( $self ) = @_; + return catfile( rel2abs( $self->directory ), $READONLY_FILE ); + } + + + # Old class methods (is anyone using these?) + + sub is_writeable_file { + my ( $class, $readonly, $filename ) = @_; + deprecated( 'is_writeable_file', 'is_writeable' ); + return $class->new( $readonly )->is_writeable( $filename ); + } + + sub get_writeable_files { + my ( $class, $readonly, $to_check ) = @_; + deprecated( 'get_writeable_files', 'get_all_writeable_files' ); + return $class->new( $readonly )->get_all_writeable_files(); + } + + + sub read_config { my ( $class, $dir ) = @_; ! deprecated( 'read_config', 'get_readonly_files' ); ! return $class->new( $dir )->get_readonly_files(); ! } ! ! sub write_config { ! my ( $class, $dir, $to_write ) = @_; ! deprecated( 'write_config', 'write_readonly_files' ); ! return $class->new( $dir ) ! ->write_readonly_files( $to_write->{file}, ! $to_write->{comment} ); ! } ! ! sub deprecated { ! my ( $old_method, $new_method ) = @_; ! my @caller_info = caller(2); ! my $location = join( ': ', $caller_info[1], $caller_info[2] ); ! warn "Class methods in OpenInteract2::Config::Readonly are deprecated; ", ! "please replace your call of '$old_method' with the object ", ! "constructor and method call to '$new_method' at '$location'\n"; } *************** *** 123,135 **** my @files_to_write = ( 'blah.html', 'bleh.txt' ); ! my $files_writeable = OpenInteract2::Config::Readonly ! ->get_writeable_files( $dir, \@files_to_write ); ! ! # Same thing, but read the nonwriteable files first ! ! my $readonly_files = OpenInteract2::Config::Readonly->read_config( $dir ); ! my @files_to_write = ( 'blah.html', 'bleh.txt' ); ! my $files_writeable = OpenInteract2::Config::Readonly ! ->get_writeable_files( $readonly_files, \@files_to_write ); # See if a single file is writeable --- 165,172 ---- my @files_to_write = ( 'blah.html', 'bleh.txt' ); ! my $read_only = OpenInteract2::Config::Readonly->new( $dir ); ! foreach my $file ( @files_to_write ) { ! print "Writeable? ", $read_only->is_writeable( $file ); ! } # See if a single file is writeable *************** *** 137,141 **** my $original_path = '/path/to/distribution/foo.html'; my $can_write = OpenInteract2::Config::Readonly ! ->is_file_writeable( $dir, $original_path ); if ( $can_write ) { cp( $original_path, --- 174,179 ---- my $original_path = '/path/to/distribution/foo.html'; my $can_write = OpenInteract2::Config::Readonly ! ->new( $dir ) ! ->is_writeable( $original_path ); if ( $can_write ) { cp( $original_path, *************** *** 143,157 **** } ! # Write a set of readonly files with a comment... ! OpenInteract2::Config::Readonly->write_config( ! $dir, ! { file => [ 'file1', 'file2' ], ! comment => 'OI will not overwrite these files' } ); ! # ... or without ! OpenInteract2::Config::Readonly->write_config( ! $dir, ! [ 'file1', 'file2' ] ); =head1 DESCRIPTION --- 181,197 ---- } ! ! # Write a set of readonly files... ! OpenInteract2::Config::Readonly ! ->new( $dir ) ! ->write_config( [ 'file1', 'file2' ] ); ! # Write a set of readonly files with a comment... ! ! OpenInteract2::Config::Readonly ! ->new( $dir ) ! ->write_config( [ 'file1', 'file2' ], ! 'OI will not overwrite these files' ); =head1 DESCRIPTION *************** *** 166,169 **** --- 206,234 ---- L<File::Basename|File::Basename> C<basename> call. + B<new( $directory )> + + Constructor. Throws exception if C<$directory> is invalid. + + B<get_readonly_files()> + + Returns: arrayref of readonly files in the configured directory. + + B<is_writeable( $file )> + + Returns: true if C<$file> is writeable in the configured directory, + false if not. + + B<get_all_writeable_files()> + + Returns: arrayref of all writeable files in the configured directory. + + B<write_readonly_files( \@files, [ $comment ] )> + + Write a new readonly configuration file (typically C<.no_overwrite>) + to the configured directory. All filenames in C<\@files> will be + written to the file, as with the C<$comment> if given. + + Returns: full path to file written. + B<is_writeable_file( \@readonly_filenames | $directory, $filename )> *************** *** 260,262 **** =head1 AUTHORS ! Chris Winters E<lt>ch...@cw...E<gt> \ No newline at end of file --- 325,327 ---- =head1 AUTHORS ! Chris Winters E<lt>ch...@cw...E<gt> Index: TransferSample.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config/TransferSample.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TransferSample.pm 18 Feb 2004 05:25:27 -0000 1.8 --- TransferSample.pm 5 Dec 2004 18:50:10 -0000 1.9 *************** *** 4,8 **** use base qw( Class::Accessor::Fast ); use File::Copy qw( cp ); ! use File::Spec; use OpenInteract2::Constants qw( :log ); use OpenInteract2::Context qw( CTX ); --- 4,9 ---- use base qw( Class::Accessor::Fast ); use File::Copy qw( cp ); ! use File::Spec::Functions qw( catfile rel2abs ); ! use Log::Log4perl qw( get_logger ); use OpenInteract2::Constants qw( :log ); use OpenInteract2::Context qw( CTX ); *************** *** 15,22 **** __PACKAGE__->mk_accessors( @FIELDS ); sub new { my ( $class, $source_dir ) = @_; my $self = bless( {}, $class ); ! $source_dir = File::Spec->rel2abs( $source_dir ); unless ( -d $source_dir ) { oi_error "Given source directory [$source_dir] is invalid"; --- 16,26 ---- __PACKAGE__->mk_accessors( @FIELDS ); + my ( $log ); + sub new { my ( $class, $source_dir ) = @_; + $log ||= get_logger( LOG_CONFIG ); my $self = bless( {}, $class ); ! $source_dir = rel2abs( $source_dir ); unless ( -d $source_dir ) { oi_error "Given source directory [$source_dir] is invalid"; *************** *** 24,27 **** --- 28,33 ---- $self->source_dir( $source_dir ); $self->{_template} = Template->new( ABSOLUTE => 1 ); + $log->is_info && + $log->info( "Created new transfer object given source '$source_dir'" ); return $self; } *************** *** 35,39 **** sub read_file_spec { my ( $self, $template_vars ) = @_; ! my $copy_list_file = File::Spec->catfile( $self->source_dir, 'FILES' ); unless ( -f $copy_list_file ) { oi_error "File from which I read the file specifiecations ", --- 41,45 ---- sub read_file_spec { my ( $self, $template_vars ) = @_; ! my $copy_list_file = catfile( $self->source_dir, 'FILES' ); unless ( -f $copy_list_file ) { oi_error "File from which I read the file specifiecations ", *************** *** 68,71 **** --- 74,79 ---- } + my $ro_check = OpenInteract2::Config::Readonly->new( $dest_dir ); + $template_vars ||= {}; my @copied = (); *************** *** 73,76 **** --- 81,85 ---- my $source_spec = $info->[0]; my $dest_spec = $info->[1]; + my ( $copy_only ); if ( $source_spec->[-1] =~ /^\*/ ) { *************** *** 78,85 **** $source_spec->[-1] =~ s/^\*//; } ! my $full_source_file = File::Spec->catfile( $self->source_dir, ! @{ $source_spec } ); ! my $full_dest_file = File::Spec->catfile( $dest_dir, ! @{ $dest_spec } ); # NOTE: You shouldn't assume because ( ! keys %{ $template_vars } ) --- 87,101 ---- $source_spec->[-1] =~ s/^\*//; } ! ! my $full_source_file = catfile( $self->source_dir, @{ $source_spec } ); ! my $full_dest_file = catfile( $dest_dir, @{ $dest_spec } ); ! ! unless ( $ro_check->is_writeable( $full_dest_file ) ) { ! $log->is_info && ! $log->info( "Skipping '$full_source_file', it's marked as ", ! "readonly in the destination directory" ); ! next; ! } ! # NOTE: You shouldn't assume because ( ! keys %{ $template_vars } ) *************** *** 91,94 **** --- 107,113 ---- || oi_error "Cannot copy [$full_source_file] -> ", "[$full_dest_file]: $!"; + $log->is_info && + $log->info( "Copied w/o processing '$full_source_file' ", + "-> '$full_dest_file'" ); } *************** *** 98,101 **** --- 117,123 ---- "[$full_source_file] -> [$full_dest_file]: ", $self->{_template}->error; + $log->is_info && + $log->info( "Copied with processing '$full_source_file' ", + "-> '$full_dest_file'" ); } push @copied, $full_dest_file; |
From: Chris W. <la...@us...> - 2004-12-05 18:50:21
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/lib/OpenInteract2/Manage Modified Files: Website.pm Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: Website.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage/Website.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Website.pm 13 Jun 2004 18:19:54 -0000 1.20 --- Website.pm 5 Dec 2004 18:50:11 -0000 1.21 *************** *** 6,10 **** use base qw( OpenInteract2::Manage ); use File::Spec::Functions qw( catdir catfile ); - use OpenInteract2::Config::Readonly; use OpenInteract2::Exception qw( oi_error ); use OpenInteract2::Package qw( DISTRIBUTION_EXTENSION ); --- 6,9 ---- |
From: Chris W. <la...@us...> - 2004-12-05 18:50:19
|
Update of /cvsroot/openinteract/OpenInteract2/doc/Manual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10472/doc/Manual Modified Files: Changes.pod Log Message: modify OI2::Config::Readonly to be more usable (object instead of class methods); modify all usages, tests, etc. Index: Changes.pod =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/doc/Manual/Changes.pod,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Changes.pod 5 Dec 2004 08:57:22 -0000 1.58 --- Changes.pod 5 Dec 2004 18:50:10 -0000 1.59 *************** *** 398,401 **** --- 398,413 ---- =back + L<OpenInteract2::Config::Readonly> + + =over 4 + + =item * + + Modify to be used as object rather than series of class methods. Old + methods are still supported but are deprected, and any usage will + issue a 'warn' telling you what to change and where. + + =back + L<OpenInteract2::Context> |
From: Chris W. <la...@us...> - 2004-12-05 18:48:53
|
Update of /cvsroot/openinteract/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10207 Modified Files: MANIFEST Log Message: shouldn't be distributed; generated by tests Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/MANIFEST,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** MANIFEST 5 Dec 2004 08:51:18 -0000 1.104 --- MANIFEST 5 Dec 2004 18:48:45 -0000 1.105 *************** *** 352,356 **** t/util.t t/utils.pl - t/use/.no_overwrite t/use/Changes t/use/fruit-1.00.zip --- 352,355 ---- |
From: Chris W. <la...@us...> - 2004-12-05 18:47:44
|
Update of /cvsroot/openinteract/OpenInteract2/t/use In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9976 Removed Files: .no_overwrite Log Message: this is generated by tests, shouldn't be in CVS --- .no_overwrite DELETED --- |
From: Chris W. <la...@us...> - 2004-12-05 08:58:09
|
Update of /cvsroot/openinteract/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17754 Removed Files: META.yml Log Message: this gets generated with the dist, shouldn't be in CVS --- META.yml DELETED --- |
From: Chris W. <la...@us...> - 2004-12-05 08:57:31
|
Update of /cvsroot/openinteract/OpenInteract2/doc/Manual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17649/doc/Manual Modified Files: Changes.pod Log Message: latest changes Index: Changes.pod =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/doc/Manual/Changes.pod,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Changes.pod 4 Dec 2004 03:51:54 -0000 1.57 --- Changes.pod 5 Dec 2004 08:57:22 -0000 1.58 *************** *** 427,431 **** OIN-40: Add properties 'timezone' and 'timezone_object', and add 'create_date()' as a factory for DateTime objects with the given ! timezone. =item * --- 427,432 ---- OIN-40: Add properties 'timezone' and 'timezone_object', and add 'create_date()' as a factory for DateTime objects with the given ! timezone. (Allow 'from_epoch' as well param as standard DateTime ! constructor params.) =item * |
From: Chris W. <la...@us...> - 2004-12-05 08:57:01
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17543/lib/OpenInteract2 Modified Files: Util.pm Log Message: delegate date creation to CTX Index: Util.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Util.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Util.pm 18 Feb 2004 05:25:26 -0000 1.12 --- Util.pm 5 Dec 2004 08:56:49 -0000 1.13 *************** *** 4,8 **** use strict; - use DateTime; use Log::Log4perl qw( get_logger ); use Mail::Sendmail (); --- 4,7 ---- *************** *** 38,43 **** $p->{format} ||= '%Y-%m-%d %T'; $p->{time} ||= time; ! return DateTime->from_epoch( epoch => $p->{time} ) ! ->strftime( $p->{format} ); } --- 37,42 ---- $p->{format} ||= '%Y-%m-%d %T'; $p->{time} ||= time; ! return CTX->create_date( epoch => $p->{time} ) ! ->strftime( $p->{format} ); } *************** *** 48,52 **** sub today { ! return $_[0]->now( { format => '%Y-%m-%e' } ); } --- 47,51 ---- sub today { ! return $_[0]->now({ format => '%Y-%m-%e' }); } *************** *** 441,443 **** =head1 AUTHORS ! Chris Winters E<lt>ch...@cw...E<gt> \ No newline at end of file --- 440,442 ---- =head1 AUTHORS ! Chris Winters E<lt>ch...@cw...E<gt> |
From: Chris W. <la...@us...> - 2004-12-05 08:56:23
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17467/lib/OpenInteract2 Modified Files: Context.pm Log Message: create_date() can now take 'epoch' as parameter and call 'from_epoch()' instead of 'new()' Index: Context.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Context.pm,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** Context.pm 20 Nov 2004 20:12:18 -0000 1.76 --- Context.pm 5 Dec 2004 08:56:14 -0000 1.77 *************** *** 436,443 **** my ( $self, $params ) = @_; $params ||= {}; ! return ( $params->{year} ) ! ? DateTime->new( time_zone => $self->timezone_object, ! %{ $params } ) ! : DateTime->now( time_zone => $self->timezone_object ); } --- 436,456 ---- my ( $self, $params ) = @_; $params ||= {}; ! if ( $params->{year} ) { ! return DateTime->new( ! time_zone => $self->timezone_object, ! %{ $params } ! ); ! } ! elsif ( $params->{epoch} ) { ! return DateTime->now( ! time_zone => $self->timezone_object, ! from_epoch => $params->{epoch}, ! ); ! } ! else { ! return DateTime->now( ! time_zone => $self->timezone_object ! ); ! } } *************** *** 1221,1227 **** A factory for creating L<DateTime> objects using the C<timezone()> from the context. Any parameters in C<\%params> will be passed along ! to the L<DateTime> constructor, but if you do not specify a C<year> ! then we assume you want the current time and call the L<DateTime> ! C<now()> method. This is just a shortcut method and you instead may want to get the --- 1234,1243 ---- A factory for creating L<DateTime> objects using the C<timezone()> from the context. Any parameters in C<\%params> will be passed along ! to the L<DateTime> constructor (with one exception, see below) but if ! you do not specify a C<year> then we assume you want the current time ! and call the L<DateTime> C<now()> method. ! ! The exception: when you specify 'epoch' in C<\%params> we call the ! C<from_epoch()> method instead of the constructor. This is just a shortcut method and you instead may want to get the |
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16844/lib/OpenInteract2/Action Modified Files: Common.pm CommonAdd.pm CommonDisplay.pm CommonRemove.pm CommonSearch.pm CommonUpdate.pm Log Message: move common action messages into global message file Index: Common.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/Common.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Common.pm 4 Dec 2004 04:13:54 -0000 1.19 --- Common.pm 5 Dec 2004 08:52:55 -0000 1.20 *************** *** 98,106 **** unless ( $object_type ) { $log->warn( "No object type specified" ); ! my $msg = join( '', "Object type is undefined. How can we know ", ! "what to search or return? Please set it in ", ! "your action configuration using the key ", ! "c_object_type." ); ! $self->param_add( error_msg => $msg ); return 1; } --- 98,102 ---- unless ( $object_type ) { $log->warn( "No object type specified" ); ! $self->add_error_key( 'action.error.no_object_type' ); return 1; } *************** *** 108,115 **** if ( $@ or ! $object_class ) { $log->warn( "No object class for '$object_type'" ); ! my $msg = join( '', "Class for given object type '$object_type' ", ! "is undefined. Maybe a typo in your action ", ! "configuration using the key c_object_type." ); ! $self->param_add( error_msg => $msg ); return 1; } --- 104,108 ---- if ( $@ or ! $object_class ) { $log->warn( "No object class for '$object_type'" ); ! $self->add_error_key( 'action.error.no_class_for_type', $object_type ); return 1; } *************** *** 126,134 **** if ( ! $id_field or $@ ) { $log->warn( "No ID field for '$object_class'" ); ! my $msg = join( '', "Object ID field is undefined. We cannot know ", ! "how to fetch an existing object without it. ", ! "Please define the key 'id_field' in your ", ! "object configuration." ); ! $self->param_add( error_msg => $msg ); return 1; } --- 119,123 ---- if ( ! $id_field or $@ ) { $log->warn( "No ID field for '$object_class'" ); ! $self->add_error_key( 'action.error.no_id_field' ); return 1; } *************** *** 185,196 **** } else { ! my $msg = "No value found in action parameters or " . ! "request for ID field '$id_field'"; if ( $alt_id_field ) { ! $msg .= " or alternative ID field '$alt_id_field'"; } - $msg .= '.'; - $log->warn( $msg ); - $self->param_add( error_msg => $msg ); return 1; } --- 174,182 ---- } else { ! $log->warn( "No ID found in '$id_field' or '$alt_id_field'" ); ! $self->add_error_key( 'action.error.no_id_value', $id_field ); if ( $alt_id_field ) { ! $self->add_error_key( 'action.error.no_alt_id_value', $alt_id_field ); } return 1; } *************** *** 207,214 **** unless ( $self->param( $_ ) ) { $log->warn( "No value in template parameter '$_'" ); ! my $msg = join( '', "No template found in '$_' key. This " . ! "template is mandatory for the task to ", ! "function." ); ! $self->param_add( error_msg => $msg ); $num_errors++; } --- 193,197 ---- unless ( $self->param( $_ ) ) { $log->warn( "No value in template parameter '$_'" ); ! $self->add_error_key( 'action.error.no_template', $_ ); $num_errors++; } *************** *** 225,231 **** unless ( $self->param( $_ ) ) { $log->warn( "No value in parameter '$_'" ); ! my $msg = join( '', "Action parameter '$_' is undefined but ", ! "required for the task to function." ); ! $self->param_add( error_msg => $msg ); $num_errors++; } --- 208,212 ---- unless ( $self->param( $_ ) ) { $log->warn( "No value in parameter '$_'" ); ! $self->add_error_key( 'action.error.param_required', $_ ); $num_errors++; } *************** *** 318,333 **** if ( $@ ) { my $error = $@; ! $log->error( "Caught exception fetching object: $@" ); if ( $error->isa( 'SPOPS::Exception::Security' ) ) { ! my $msg = "Security violation: you do not have rights to " . ! "retrieve the requested object."; ! $self->param_add( error_msg => $msg ); ! oi_error $@; } else { ! $self->param_add( error_msg => "Cannot retrieve object: $@" ); ! oi_error $error; } } return $object || $object_class->new; } --- 299,312 ---- if ( $@ ) { my $error = $@; ! $log->error( "Caught exception fetching object: $error" ); if ( $error->isa( 'SPOPS::Exception::Security' ) ) { ! $self->add_error_key( 'action.error.security' ); } else { ! $self->add_error_key( 'action.error.fetch', $error ); } + oi_error $error; } + $self->param( c_id => $id ); return $object || $object_class->new; } Index: CommonAdd.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/CommonAdd.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CommonAdd.pm 1 Dec 2004 05:07:02 -0000 1.20 --- CommonAdd.pm 5 Dec 2004 08:52:55 -0000 1.21 *************** *** 73,77 **** if ( $@ ) { $log->error( "Failed to create object: $@" ); ! $self->param_add( error_msg => "Object creation failed: $@" ); my $fail_task = $self->param( 'c_add_fail_task' ); return $self->execute({ task => $fail_task }); --- 73,77 ---- if ( $@ ) { $log->error( "Failed to create object: $@" ); ! $self->add_error_key( 'action.error.create', $@ ); my $fail_task = $self->param( 'c_add_fail_task' ); return $self->execute({ task => $fail_task }); *************** *** 80,84 **** $self->param( c_id => scalar $object->id ); my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->param( status_msg => "$title created properly" ); $self->_add_post_action; $self->notify_observers( 'post add', $object ); --- 80,84 ---- $self->param( c_id => scalar $object->id ); my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->add_status_key( 'action.status.create', $title ); $self->_add_post_action; $self->notify_observers( 'post add', $object ); Index: CommonDisplay.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/CommonDisplay.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CommonDisplay.pm 1 Dec 2004 05:07:02 -0000 1.14 --- CommonDisplay.pm 5 Dec 2004 08:52:55 -0000 1.15 *************** *** 25,29 **** unless ( $object->is_saved ) { my $id = $self->param( 'c_id' ); ! $self->param_add( error_msg => "Object with ID '$id' not found" ); return $self->execute({ task => $fail_task }); } --- 25,29 ---- unless ( $object->is_saved ) { my $id = $self->param( 'c_id' ); ! $self->add_error_key( 'action.error.not_found', $id ); return $self->execute({ task => $fail_task }); } *************** *** 39,48 **** $log->info( "Object [$object_class] [$id] failed ", "'active' check [Status: $status]" ); ! $self->param_add( error_msg => "This object is currently " . ! "inactive. Please check later." ); return $self->execute({ task => $fail_task }); } ! $log->is_debug && ! $log->debug( "Object passed 'active' check" ); } --- 39,46 ---- $log->info( "Object [$object_class] [$id] failed ", "'active' check [Status: $status]" ); ! $self->add_error_key( 'action.error.inactive' ); return $self->execute({ task => $fail_task }); } ! $log->is_debug && $log->debug( "Object passed 'active' check" ); } *************** *** 75,79 **** $self->_common_check_template_specified( 'c_display_template' ); if ( $has_error ) { ! die $self->execute({ task => 'common_error' }); } } --- 73,77 ---- $self->_common_check_template_specified( 'c_display_template' ); if ( $has_error ) { ! die $self->execute({ task => 'common_error' }), "\n"; } } Index: CommonRemove.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/CommonRemove.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CommonRemove.pm 1 Dec 2004 05:07:02 -0000 1.17 --- CommonRemove.pm 5 Dec 2004 08:52:55 -0000 1.18 *************** *** 21,29 **** my $object = eval { $self->_common_fetch_object }; if ( $@ ) { return $self->execute({ task => $fail_task }); } ! unless ( $object and $object->is_saved ) { ! $self->param_add( error_msg => 'Cannot fetch object for removal. ' . ! 'No modifications made.' ); return $self->execute({ task => $fail_task }); } --- 21,34 ---- my $object = eval { $self->_common_fetch_object }; if ( $@ ) { + $self->add_eror_key( 'action.error.fetch_for_remove', $@ ); return $self->execute({ task => $fail_task }); } ! unless ( $object ) { ! $self->add_eror_key( 'action.error.not_found', ! $self->param( 'c_id' ) ); ! return $self->execute({ task => $fail_task }); ! } ! unless ( $object->is_saved ) { ! $self->add_eror_key( 'action.error.remove_not_saved' ); return $self->execute({ task => $fail_task }); } *************** *** 36,42 **** my $sec_fail_task = $self->param( 'c_remove_security_fail_task' ) || $fail_task; ! $self->param_add( ! error_msg => 'Insufficient access rights to remove this ' . ! 'object. No modifications made.' ); return $self->execute({ task => $sec_fail_task }); } --- 41,45 ---- my $sec_fail_task = $self->param( 'c_remove_security_fail_task' ) || $fail_task; ! $self->add_error_key( 'action.error.remove_security' ); return $self->execute({ task => $sec_fail_task }); } *************** *** 47,51 **** eval { $object->remove }; if ( $@ ) { ! $self->param_add( error_msg => "Object removal failed: $@" ); $log->error( "Failed to remove ", $self->param( 'c_object_class' ), "with ID" , $object->id, ": $@" ); --- 50,54 ---- eval { $object->remove }; if ( $@ ) { ! $self->add_error_key( 'action.error.remove', $@ ); $log->error( "Failed to remove ", $self->param( 'c_object_class' ), "with ID" , $object->id, ": $@" ); *************** *** 56,60 **** my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->param_add( status_msg => "$title successfully removed." ); my $success_task = $self->param( 'c_remove_task' ); return $self->execute({ task => $success_task }); --- 59,63 ---- my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->add_status_key( 'action.status.remove', $title ); my $success_task = $self->param( 'c_remove_task' ); return $self->execute({ task => $success_task }); Index: CommonSearch.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/CommonSearch.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CommonSearch.pm 1 Dec 2004 05:07:02 -0000 1.16 --- CommonSearch.pm 5 Dec 2004 08:52:55 -0000 1.17 *************** *** 32,40 **** my ( $self ) = @_; unless ( $self->param( 'c_search_form_template' ) ) { ! my $msg = join( '', "Template for search form is undefined. Please ", ! "set it in your action configuration using the ", ! "key 'c_search_form_template'." ); ! $self->param_add( error_msg => $msg ); ! die $self->execute({ task => 'common_error' }); } return undef; --- 32,37 ---- my ( $self ) = @_; unless ( $self->param( 'c_search_form_template' ) ) { ! $self->add_error_key( 'action.error.no_template', 'c_search_form_template' ); ! die $self->execute({ task => 'common_error' }), "\n"; } return undef; *************** *** 168,176 **** unless ( $num_id_links == 2 || $num_id_links == 4 ) { ! my $msg = join( '', "Misconfigured search: there should be ", ! "either two or four entries in the ", ! "'c_search_table_links' section for table ", ! "[$table] under action [", $self->name, "]" ); ! $self->param_add( error_msg => $msg ); $has_error++; } --- 165,170 ---- unless ( $num_id_links == 2 || $num_id_links == 4 ) { ! $self->add_error_key( 'action.error.search_table_links', ! $table, $self->name ); $has_error++; } *************** *** 179,183 **** } if ( $has_error ) { ! die $self->execute({ task => 'common_error' }); } --- 173,177 ---- } if ( $has_error ) { ! die $self->execute({ task => 'common_error' }), "\n"; } *************** *** 197,202 **** my ( $msg, $task ); if ( $caught =~ /^CAP: (.*)$/ ) { ! $msg = join( '', "Your search has returned too many ", ! "results ($1). Please try again." ); $task = $self->param( 'c_search_results_cap_fail_task' ); } --- 191,195 ---- my ( $msg, $task ); if ( $caught =~ /^CAP: (.*)$/ ) { ! $msg = $self->_msg( 'action.error.search_too_many_results', $1 ); $task = $self->param( 'c_search_results_cap_fail_task' ); } *************** *** 205,210 **** $task = $self->param( 'c_search_fail_task' ); } ! $self->param_add( error_msg => $msg ); ! die $self->execute({ task => $task }); } --- 198,203 ---- $task = $self->param( 'c_search_fail_task' ); } ! $self->add_error( $msg ); ! die $self->execute({ task => $task }), "\n"; } Index: CommonUpdate.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/CommonUpdate.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CommonUpdate.pm 1 Dec 2004 05:07:02 -0000 1.19 --- CommonUpdate.pm 5 Dec 2004 08:52:55 -0000 1.20 *************** *** 26,32 **** if ( $@ ) { $log->error( "Failed to fetch object [$object_class: $id]: $@" ); ! $self->param_add( ! error_msg => "Cannot fetch object for update: $@" ); ! return $self->execute( task => $fail_task ); } } --- 26,31 ---- if ( $@ ) { $log->error( "Failed to fetch object [$object_class: $id]: $@" ); ! $self->add_error_key( 'action.error.fetch_for_update', $@ ); ! return $self->execute({ task => $fail_task }); } } *************** *** 58,64 **** unless ( $object and $object->is_saved ) { $log->error( "Object does not exist or is not saved, cannot update" ); ! my $msg = join( '', "You cannot update this object because it ", ! "has not yet been saved." ); ! $self->param_add( error_msg => $msg ); return $self->execute({ task => $fail_task }); } --- 57,61 ---- unless ( $object and $object->is_saved ) { $log->error( "Object does not exist or is not saved, cannot update" ); ! $self->add_error_key( 'action.error.update_not_saved' ); return $self->execute({ task => $fail_task }); } *************** *** 69,75 **** my $sec_fail_task = $self->param( 'c_update_security_fail_task' ) || $fail_task; ! my $msg = join( '', 'You do not have sufficient access to ', ! 'update this object. No modifications made.' ); ! $self->param_add( error_msg => $msg ); return $self->execute({ task => $sec_fail_task }); } --- 66,70 ---- my $sec_fail_task = $self->param( 'c_update_security_fail_task' ) || $fail_task; ! $self->add_error_key( 'action.error.update_security' ); return $self->execute({ task => $sec_fail_task }); } *************** *** 100,108 **** if ( $@ ) { $log->error( "Update of $object_spec failed: $@" ); ! $self->param_add( error_msg => "Object update failed: $@" ); return $self->execute({ task => $fail_task }); } my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->param( status_msg => "$title updated with changes" ); $self->param( c_object_old_data => $old_data ); $self->_update_post_action; --- 95,103 ---- if ( $@ ) { $log->error( "Update of $object_spec failed: $@" ); ! $self->add_error_key( 'action.error.update', $@ ); return $self->execute({ task => $fail_task }); } my $title = "'" . $object->object_description->{title} . "'" || 'Object'; ! $self->add_status_key( 'action.status.update', $title ); $self->param( c_object_old_data => $old_data ); $self->_update_post_action; |
From: Chris W. <la...@us...> - 2004-12-05 08:53:09
|
Update of /cvsroot/openinteract/OpenInteract2/sample/website/msg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16844/sample/website/msg Modified Files: global-messages-en.msg Log Message: move common action messages into global message file Index: global-messages-en.msg =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/sample/website/msg/global-messages-en.msg,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** global-messages-en.msg 12 Jun 2004 23:26:32 -0000 1.10 --- global-messages-en.msg 5 Dec 2004 08:52:55 -0000 1.11 *************** *** 75,77 **** --- 75,110 ---- page_count.page_label = Page + # Common Actions + + action.error.no_object_type = Object type is undefined. How can we know what to search \ + or return? Please set it in your action configuration using the key 'c_object_type'. + action.error.no_class_for_type = Class for given object type '[_1]' is undefined. This may \ + be a typo in your action configuration (check the key 'c_object_type'). + action.error.no_id_field = Object ID field is undefined. We cannot know how to fetch an \ + existing object without it. Please define the key 'id_field' in your object configuration. + action.error.no_id_value = No value found in action parameters or request for ID field '[_1]' + action.error.no_alt_id_value = also checked alternative ID field '[_1]'. + action.error.no_template = No template found in '[_1]' key. This template is mandatory for the task to function. + action.error.param_required = Action parameter '[_1]' is empty but required for the task to function. + action.error.security = Security violation: you do not have rights to retrieve the requested object. + action.error.fetch = Cannot retrieve object: [_1] + action.error.create = Object creation failed: [_1] + action.error.not_found = Object with ID '[_1]' not found + action.error.inactive = This object is currently inactive. Please check later. + action.error.fetch_for_update = Cannot fetch object for update: [_1] + action.error.update_not_saved = You cannot update this object because it has not yet been saved. + action.error.update_security = You do not have sufficient access to update this object. No modifications made. + action.error.update = Object update failed: [_1] + action.error.fetch_for_remove = Cannot fetch object for removal: [_1] + action.error.remove_not_saved = You cannot remove this object because it has not yet been saved. + action.error.remove_security = You do not have sufficient access to remove this object. \ + No modifications made. + action.error.remove = Object removal failed: [_1] + action.error.search_table_links = Misconfigured search: there should be either two or four \ + entries in the 'c_search_table_links' section for table '[_1]' under action '[_2]'. + action.error.search_too_many_results = Your search has returned too many results ([_1]). \ + Please try again. + action.status.create = [_1] created properly. + action.status.update = [_1] updated with changes. + action.status.remove = [_1] successfully removed. \ No newline at end of file |
From: Chris W. <la...@us...> - 2004-12-05 08:53:06
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16844/lib/OpenInteract2 Modified Files: Action.pm Log Message: move common action messages into global message file Index: Action.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action.pm,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Action.pm 2 Dec 2004 03:18:54 -0000 1.64 --- Action.pm 5 Dec 2004 08:52:55 -0000 1.65 *************** *** 949,952 **** --- 949,953 ---- sub add_error_key { my ( $self, $key, @params ) = @_; + $log->is_debug && $log->debug( "Adding error with key '$key'" ); return $self->add_error( $self->_msg( $key, @params ) ); } *************** *** 954,957 **** --- 955,959 ---- sub add_status_key { my ( $self, $key, @params ) = @_; + $log->is_debug && $log->debug( "Adding status with key '$key'" ); return $self->add_status( $self->_msg( $key, @params ) ); } |
From: Chris W. <la...@us...> - 2004-12-05 08:52:25
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/comments/OpenInteract2/Action Modified Files: Comments.pm Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: Comments.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action/Comments.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Comments.pm 28 Nov 2004 06:46:09 -0000 1.8 --- Comments.pm 5 Dec 2004 08:51:22 -0000 1.9 *************** *** 117,122 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_listing', "$@" ) ); $log->error( "Cannot fetch comments: $@" ); } --- 117,121 ---- }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_listing', "$@" ); $log->error( "Cannot fetch comments: $@" ); } *************** *** 189,194 **** if ( $@ ) { $log->error( "Error fetching comments: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_by_object', "$@" ) ); } else { --- 188,192 ---- if ( $@ ) { $log->error( "Error fetching comments: $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch_by_object', "$@" ); } else { *************** *** 216,221 **** if ( $@ ) { $log->error( "Error retrieving comment '$comment_id': $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch', "$@" ) ); } if ( $comment ) { --- 214,218 ---- if ( $@ ) { $log->error( "Error retrieving comment '$comment_id': $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch', "$@" ); } if ( $comment ) { *************** *** 224,234 **** else { $log->error( "No comment found for given ID '$comment_id'" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.not_found' ) ); } } else { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.no_id' ) ); } --- 221,229 ---- else { $log->error( "No comment found for given ID '$comment_id'" ); ! $self->add_error_key( 'comments.error.not_found' ); } } else { ! $self->add_error_key( 'comments.error.no_id' ); } *************** *** 283,294 **** $object = eval { $obj_class->fetch( $comment->{object_id} ) }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_object', "$@" ) ); $object = undef; } } else { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.no_class_for_object' ) ); } return $object; --- 278,287 ---- $object = eval { $obj_class->fetch( $comment->{object_id} ) }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_object', "$@" ); $object = undef; } } else { ! $self->add_error_key( 'comments.error.no_class_for_object' ); } return $object; *************** *** 399,404 **** if ( scalar @required_missing ) { ! my $msg = $self->_msg( 'comments.error.data_missing', join( ', ', @required_missing ) ); ! $self->param_add( error_msg => $msg ); return $self->_show_editable; } --- 392,397 ---- if ( scalar @required_missing ) { ! $self->add_error_key( 'comments.error.data_missing', ! join( ', ', @required_missing ) ); return $self->_show_editable; } *************** *** 438,447 **** if ( $@ ) { $log->error( "Failed to add comment: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_add', "$@" ) ); } else { ! $self->param_add( ! status_msg => $self->_msg( 'comments.status.add_ok' ) ); # These are used for the listing page we go to next... --- 431,438 ---- if ( $@ ) { $log->error( "Failed to add comment: $@" ); ! $self->add_error_key( 'comments.error.cannot_add', "$@" ); } else { ! $self->add_error_key( 'comments.status.add_ok' ); # These are used for the listing page we go to next... *************** *** 456,460 **** my $notify_status = $self->_add_user_notification( $comment ); if ( $notify_status ) { ! $self->param_add( status_msg => $notify_status ); } } --- 447,451 ---- my $notify_status = $self->_add_user_notification( $comment ); if ( $notify_status ) { ! $self->add_status( $notify_status ); } } *************** *** 545,550 **** $log->info( "Posted wants to be notified but didn't ", "provide an email address" ); ! return join( '', 'Could not add notification since you did ' . ! 'not give me your email address. Sorry.' ); } --- 536,541 ---- $log->info( "Posted wants to be notified but didn't ", "provide an email address" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_no_email' ); ! return; } *************** *** 553,558 **** $log->info( "Posted wants to be notified but provided a bad ", "email address: '$comment->{poster_email}'" ); ! return $self->_msg( 'comments.error.cannot_add_notify_bad_email', ! $comment->{poster_email} ); } --- 544,550 ---- $log->info( "Posted wants to be notified but provided a bad ", "email address: '$comment->{poster_email}'" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_bad_email', ! $comment->{poster_email} ); ! return; } *************** *** 569,573 **** $log->error( "Error fetching notifications for: ", "'$comment->{class}: $comment->{object_id}': $@" ); ! return $self->_msg( 'comments.error.cannot_add_notify_error_dupe_check' ); } --- 561,566 ---- $log->error( "Error fetching notifications for: ", "'$comment->{class}: $comment->{object_id}': $@" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_error_dupe_check' ); ! return } *************** *** 576,580 **** $log->is_info && $log->info( "No notification added: already exists in thread" ); ! return $self->_msg( 'comments.error.cannot_add_notify_is_dupe' ); } --- 569,574 ---- $log->is_info && $log->info( "No notification added: already exists in thread" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_is_dupe' ); ! return; } *************** *** 589,595 **** if ( $@ ) { $log->error( "Failed to save notification: $@" ); ! return $self->_msg( 'comments.error.cannot_add_notify_persist', "$@" ); } ! return $self->_msg( 'comments.status.add_notify_ok' ); } --- 583,591 ---- if ( $@ ) { $log->error( "Failed to save notification: $@" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_persist', "$@" ); ! return; } ! $self->add_status_key( 'comments.status.add_notify_ok' ); ! return; } *************** *** 664,668 **** sub remove { my ( $self ) = @_; ! $self->param_add( error_msg => 'REMOVE not implemented yet' ); return $self->list_by_object; } --- 660,664 ---- sub remove { my ( $self ) = @_; ! $self->add_error( 'REMOVE not implemented yet' ); return $self->list_by_object; } *************** *** 700,705 **** $log->error( "Error fetching notifications for ", "[$obj_class: $obj_id]: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_notify', "$@" ) ); } else { --- 696,700 ---- $log->error( "Error fetching notifications for ", "[$obj_class: $obj_id]: $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch_notify', "$@" ); } else { *************** *** 730,735 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_recent', "$@" ) ); } else { --- 725,729 ---- }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_recent', "$@" ); } else { |
From: Chris W. <la...@us...> - 2004-12-05 08:52:24
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/base_user/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/base_user/OpenInteract2/Action Modified Files: ForgotPassword.pm NewUser.pm User.pm Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: ForgotPassword.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/base_user/OpenInteract2/Action/ForgotPassword.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForgotPassword.pm 19 Mar 2004 05:57:16 -0000 1.3 --- ForgotPassword.pm 5 Dec 2004 08:51:21 -0000 1.4 *************** *** 29,34 **** my $email = $request->param( 'email' ); unless ( $login or $email ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.enter_one' ) ); return $self->execute({ task => 'display' }); } --- 29,33 ---- my $email = $request->param( 'email' ); unless ( $login or $email ) { ! $self->add_error_key( 'base_user.password.enter_one' ); return $self->execute({ task => 'display' }); } *************** *** 49,54 **** if ( $@ ) { $log->error( "Failed to fetch user by $fetch_by: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.fetch_fail', $@ ) ); return $self->execute({ task => 'display' }); } --- 48,52 ---- if ( $@ ) { $log->error( "Failed to fetch user by $fetch_by: $@" ); ! $self->add_error_key('base_user.password.fetch_fail', $@ ); return $self->execute({ task => 'display' }); } *************** *** 56,61 **** unless ( $user ) { $self->param( lookup_user_by => ( $login ) ? 'login' : 'email' ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.no_user' ) ); $log->warn( "No user found with $fetch_by" ); return $self->execute({ task => 'display' }); --- 54,58 ---- unless ( $user ) { $self->param( lookup_user_by => ( $login ) ? 'login' : 'email' ); ! $self->add_error_key( 'base_user.password.no_user' ); $log->warn( "No user found with $fetch_by" ); return $self->execute({ task => 'display' }); *************** *** 72,77 **** if ( $@ ) { $log->error( "Failed to save user with new password: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.save_fail', $@ ) ); return $self->execute({ task => 'display' }); } --- 69,73 ---- if ( $@ ) { $log->error( "Failed to save user with new password: $@" ); ! $self->add_error_key( 'base_user.password.save_fail', $@ ); return $self->execute({ task => 'display' }); } *************** *** 81,97 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.mail_fail', $@ ) ); $user->{password} = $existing_password; eval { $user->save({ skip_security => 1 }) }; if ( $@ ) { my $admin = CTX->lookup_mail_config->{admin_mail}; ! $self->param_add( ! error_msg => $self->_msg( 'base_user.password.save_existing_fail', $@, $admin ) ); } return $self->execute({ task => 'display' }); } ! $self->param_add( ! status_msg => $self->_msg( 'base_user.password.mail_ok', $user->{email} ) ); return $self->generate_content( --- 77,90 ---- }; if ( $@ ) { ! $self->add_error_key( 'base_user.password.mail_fail', $@ ); $user->{password} = $existing_password; eval { $user->save({ skip_security => 1 }) }; if ( $@ ) { my $admin = CTX->lookup_mail_config->{admin_mail}; ! $self->add_error_key( 'base_user.password.save_existing_fail', $@, $admin ); } return $self->execute({ task => 'display' }); } ! $self->add_status_key( 'base_user.password.mail_ok', $user->{email} ); return $self->generate_content( Index: NewUser.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/base_user/OpenInteract2/Action/NewUser.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** NewUser.pm 1 Dec 2004 05:16:31 -0000 1.20 --- NewUser.pm 5 Dec 2004 08:51:21 -0000 1.21 *************** *** 54,68 **** unless ( $self->_validate_email( $email ) ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.invalid_email' ) ); $self->param( requested_login => $login ); ! die $self->execute({ task => 'display' }); } unless ( $login ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.no_login' ) ); $self->param( working_email => $email ); ! die $self->execute({ task => 'display' }); } --- 54,66 ---- unless ( $self->_validate_email( $email ) ) { ! $self->add_error_key( 'base_user.new.invalid_email' ); $self->param( requested_login => $login ); ! die $self->execute({ task => 'display' }), "\n"; } unless ( $login ) { ! $self->add_error_key( 'base_user.new.no_login' ); $self->param( working_email => $email ); ! die $self->execute({ task => 'display' }), "\n"; } *************** *** 76,81 **** } if ( $user ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.name_in_use' ) ); $self->param( working_email => $email ); die $self->execute({ task => 'display' }), "\n"; --- 74,78 ---- } if ( $user ) { ! $self->add_error_key( 'base_user.new.name_in_use' ); $self->param( working_email => $email ); die $self->execute({ task => 'display' }), "\n"; *************** *** 90,95 **** } if ( $user ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.duplicate_email' ) ); $self->param( working_email => $email ); die $self->execute({ task => 'display' }), "\n"; --- 87,91 ---- } if ( $user ) { ! $self->add_error_key( 'base_user.new.duplicate_email' ); $self->param( working_email => $email ); die $self->execute({ task => 'display' }), "\n"; *************** *** 119,125 **** "NOT loaded , cannot validate email. (You should ", "not have been able to install this package...)" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.no_mailcheck_module' ) ); ! die $self->execute({ task => 'display' }); } return Mail::RFC822::Address::valid( $email ); --- 115,120 ---- "NOT loaded , cannot validate email. (You should ", "not have been able to install this package...)" ); ! $self->add_error_key( 'base_user.new.no_mailcheck_module' ); ! die $self->execute({ task => 'display' }), "\n"; } return Mail::RFC822::Address::valid( $email ); *************** *** 146,157 **** $new_user->{password} = $password; $new_user->{theme_id} = CTX->lookup_default_object_id( 'theme' ); ! $new_user->{removal_date} = OpenInteract2::Util->now( ! { time => time + REMOVAL_TIME }); eval { $new_user->save }; if ( $@ ) { $log->error( "Failure to create new user: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.create_failure', $@ ) ); ! die $self->execute({ task => 'display' }); } return $new_user; --- 141,150 ---- $new_user->{password} = $password; $new_user->{theme_id} = CTX->lookup_default_object_id( 'theme' ); ! $new_user->{removal_date} = CTX->create_date({ epoch => time + REMOVAL_TIME }); eval { $new_user->save }; if ( $@ ) { $log->error( "Failure to create new user: $@" ); ! $self->add_error_key( 'base_user.new.create_failure', $@ ); ! die $self->execute({ task => 'display' }), "\n"; } return $new_user; *************** *** 165,175 **** eval { ! $new_user->set_item_security( ! { class => ref( $new_user ), ! object_id => $new_user->id, ! scope => SEC_SCOPE_USER, ! scope_id => $new_user->id, ! level => SEC_LEVEL_WRITE }) ! }; # Log the failed security set, if it happens... --- 158,169 ---- eval { ! $new_user->set_item_security({ ! class => ref( $new_user ), ! object_id => $new_user->id, ! scope => SEC_SCOPE_USER, ! scope_id => $new_user->id, ! level => SEC_LEVEL_WRITE ! }) ! }; # Log the failed security set, if it happens... *************** *** 178,183 **** $log->error( "Failed to set security so that new user ", "'$new_user->{login_name}' can see her record: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.security_failure', $@ ) ); die $self->execute({ task => 'display' }), "\n"; } --- 172,176 ---- $log->error( "Failed to set security so that new user ", "'$new_user->{login_name}' can see her record: $@" ); ! $self->add_error_key( 'base_user.new.security_failure', $@ ); die $self->execute({ task => 'display' }), "\n"; } *************** *** 199,205 **** my $server_name = $request->server_name; ! my %email_params = ( login => $new_user->{login_name}, ! password => $plain_password, ! server_name => $server_name ); $log->info( "Sending email to '$email_params{login}' for server ", "'$email_params{server_name}'" ); --- 192,200 ---- my $server_name = $request->server_name; ! my %email_params = ( ! login => $new_user->{login_name}, ! password => $plain_password, ! server_name => $server_name, ! ); $log->info( "Sending email to '$email_params{login}' for server ", "'$email_params{server_name}'" ); *************** *** 217,222 **** if ( $@ ) { $log->error( "Cannot send email! $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.new.mail_failure', $@ ) ); die $self->execute({ task => 'display' }), "\n"; } --- 212,216 ---- if ( $@ ) { $log->error( "Cannot send email! $@" ); ! $self->add_error_key( 'base_user.new.mail_failure', $@ ); die $self->execute({ task => 'display' }), "\n"; } Index: User.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/base_user/OpenInteract2/Action/User.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** User.pm 1 Dec 2004 05:18:16 -0000 1.18 --- User.pm 5 Dec 2004 08:51:21 -0000 1.19 *************** *** 30,35 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.user.search_error', $@ ) ); } return $self->generate_content({ user_iterator => $iter }); --- 30,34 ---- }; if ( $@ ) { ! $self->add_error_key( 'base_user.user.search_error', $@ ); } return $self->generate_content({ user_iterator => $iter }); *************** *** 112,117 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.user.group_fetch_fail', $@ ) ); } } --- 111,115 ---- }; if ( $@ ) { ! $self->add_error_key( 'base_user.user.group_fetch_fail', $@ ); } } *************** *** 124,129 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.user.lang_fetch_fail', $@ ) ); } } --- 122,126 ---- }; if ( $@ ) { ! $self->add_error_key( 'base_user.user.lang_fetch_fail', $@ ); } } *************** *** 132,137 **** my ( $self ) = @_; my $original_task = $self->param( 'c_task' ); ! return 'display_add' if ( $original_task eq 'add' ); ! return 'display_update' if ( $original_task eq 'update' ); return undef; } --- 129,134 ---- my ( $self ) = @_; my $original_task = $self->param( 'c_task' ); ! return 'display_add' if ( $original_task eq 'add' ); ! return 'display_form' if ( $original_task eq 'update' ); return undef; } *************** *** 149,165 **** sub on_modify_fail { my ( $self ) = @_; ! my $original_task = $self->_get_modify_fail_task; ! unless ( $original_task ) { return "This task cannot be called directly, only from an internal action."; } ! $self->param_clear( 'status_msg' ); # get rid of any 'Password changed...' messages ! my $original_fail_task = ( $original_task eq 'update' ) ! ? 'display_form' : 'display_add'; ! return $self->execute({ task => $original_fail_task }); } sub _check_password_change { ! my ( $self, $user, $fail_task ) = @_; $log ||= get_logger( LOG_APP ); --- 146,159 ---- sub on_modify_fail { my ( $self ) = @_; ! unless ( $self->param( 'c_task' ) ) { return "This task cannot be called directly, only from an internal action."; } ! $self->clear_status(); # get rid of any 'Password changed...' messages ! return $self->execute({ task => $self->_get_modify_fail_task }); } sub _check_password_change { ! my ( $self, $user ) = @_; $log ||= get_logger( LOG_APP ); *************** *** 167,180 **** my $password = $request->param( 'password' ); unless ( $password ) { ! $log->is_debug && ! $log->debug( "User DID NOT ask to change password" ); return; } my $password_confirm = $request->param( 'password_conf' ); unless ( $password eq $password_confirm ) { ! $self->param_add( ! error_msg => $self->_msg( 'base_user.user.password_mismatch' ) ); my $fail_task = $self->_get_modify_fail_task || 'display_add'; # just in case... ! die $self->execute({ task => $fail_task }); } $log->is_debug && --- 161,172 ---- my $password = $request->param( 'password' ); unless ( $password ) { ! $log->is_debug && $log->debug( "User DID NOT change password" ); return; } my $password_confirm = $request->param( 'password_conf' ); unless ( $password eq $password_confirm ) { ! $self->add_error_key( 'base_user.user.password_mismatch' ); my $fail_task = $self->_get_modify_fail_task || 'display_add'; # just in case... ! die $self->execute({ task => $fail_task }), "\n"; } $log->is_debug && *************** *** 184,189 **** } $user->{password} = $password; ! $self->param_add( ! status_msg => $self->_msg( 'base_user.user.password_changed' ) ); return undef; } --- 176,180 ---- } $user->{password} = $password; ! $self->add_status_key( 'base_user.user.password_changed' ); return undef; } *************** *** 207,215 **** if ( $@ ) { $log->error( "Error modifying group membership: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'base_user.user.group_add_fail' ) ); } ! $self->param_add( ! status_msg => $self->_msg( 'base_user.user.group_add_ok' ) ); return undef; } --- 198,204 ---- if ( $@ ) { $log->error( "Error modifying group membership: $@" ); ! $self->add_error_key( 'base_user.user.group_add_fail' ); } ! $self->add_status_key( 'base_user.user.group_add_ok' ); return undef; } |
From: Chris W. <la...@us...> - 2004-12-05 08:52:24
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/comments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/comments Modified Files: Changes package.conf Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/Changes,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Changes 29 Nov 2004 02:58:51 -0000 1.15 --- Changes 5 Dec 2004 08:51:21 -0000 1.16 *************** *** 1,4 **** --- 1,8 ---- Revision history for OpenInteract package comments. + 1.18 Sat Dec 4 01:28:53 EST 2004 + + Use status/error shortcuts + 1.17 Sun Nov 28 21:55:05 EST 2004 Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/package.conf,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** package.conf 29 Nov 2004 02:58:51 -0000 1.15 --- package.conf 5 Dec 2004 08:51:21 -0000 1.16 *************** *** 1,4 **** name comments ! version 1.17 author Chris Winters <ch...@cw...> url http://www.cwinters.com/ --- 1,4 ---- name comments ! version 1.18 author Chris Winters <ch...@cw...> url http://www.cwinters.com/ |
From: Chris W. <la...@us...> - 2004-12-05 08:52:22
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/news In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/news Modified Files: Changes package.conf Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/news/Changes,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Changes 25 Sep 2004 18:20:31 -0000 1.19 --- Changes 5 Dec 2004 08:51:23 -0000 1.20 *************** *** 1,4 **** --- 1,8 ---- Revision history for OpenInteract package news. + 2.20 Sat Dec 4 12:52:09 EST 2004 + + Move errors to l10n file; use status/error shortcuts + 2.19 Sun Jun 20 00:07:22 EDT 2004 Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/news/package.conf,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** package.conf 25 Sep 2004 18:20:31 -0000 1.18 --- package.conf 5 Dec 2004 08:51:23 -0000 1.19 *************** *** 1,4 **** name news ! version 2.19 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ --- 1,4 ---- name news ! version 2.20 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ |
From: Chris W. <la...@us...> - 2004-12-05 08:52:21
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/lookup/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/lookup/OpenInteract2/Action Modified Files: LookupEdit.pm Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: LookupEdit.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/lookup/OpenInteract2/Action/LookupEdit.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** LookupEdit.pm 14 Jun 2004 23:38:43 -0000 1.13 --- LookupEdit.pm 5 Dec 2004 08:51:23 -0000 1.14 *************** *** 59,71 **** $self->_find_lookup_info( $request->param( 'lookup_type' ) ); unless ( $lookup_info ) { ! $self->param_add( error_msg => $error_msg ); return $self->execute({ task => 'list_lookups' }); } } unless ( $lookup_info->{partition_field} ) { ! my $error_part_msg = join( '', ! "Cannot use $lookup_info->{lookup_type} as partitioned -- ", ! "no value for 'partition_field' specified in action config." ); ! $self->param_add( error_msg => $error_part_msg ); return $self->execute({ task => 'list_lookups' }); } --- 59,69 ---- $self->_find_lookup_info( $request->param( 'lookup_type' ) ); unless ( $lookup_info ) { ! $self->add_error( $error_msg ); return $self->execute({ task => 'list_lookups' }); } } unless ( $lookup_info->{partition_field} ) { ! $self->add_error_key( 'lookup.error.no_partition_value', ! $lookup_info->{lookup_type} ); return $self->execute({ task => 'list_lookups' }); } *************** *** 75,84 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => "Could not retrieve values for " . ! "$lookup_info->{partition_field}: $@" ); } ! my %params = ( value_list => $partition_values, ! lookup_type => $lookup_info->{lookup_type} ); return $self->generate_content( \%params ); } --- 73,83 ---- }; if ( $@ ) { ! $self->add_error_key( 'lookup.error.fetch_partition_values', ! $lookup_info->{partition_field}, $@ ); } ! my %params = ( ! value_list => $partition_values, ! lookup_type => $lookup_info->{lookup_type}, ! ); return $self->generate_content( \%params ); } *************** *** 96,100 **** $self->_find_lookup_info( $lookup_type ); unless ( $lookup_info ) { ! $self->param_add( error_msg => $error_msg ); return $self->execute({ task => 'list_lookups' }); } --- 95,99 ---- $self->_find_lookup_info( $lookup_type ); unless ( $lookup_info ) { ! $self->add_error( $error_msg ); return $self->execute({ task => 'list_lookups' }); } *************** *** 113,118 **** if ( $params{partition_field} ) { ! $params{partition_value} = ! $request->param( 'partition_value' ); unless ( $params{partition_value} ) { $self->param( lookup_info => $lookup_info ); --- 112,116 ---- if ( $params{partition_field} ) { ! $params{partition_value} = $request->param( 'partition_value' ); unless ( $params{partition_value} ) { $self->param( lookup_info => $lookup_info ); *************** *** 130,134 **** }; if ( $@ ) { ! $self->param_add( error_msg => "Failed to lookup entries: $@" ); } else { --- 128,132 ---- }; if ( $@ ) { ! $self->add_error_key( 'lookup.error.fetch_lookup_values', $@ ); } else { *************** *** 151,156 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => "Cannot lookup related $field_name: $@" ); } } --- 149,154 ---- }; if ( $@ ) { ! $self->add_error_key( 'lookup.error.fetch_lookup_related', ! $field_name, $@ ); } } *************** *** 175,179 **** $self->_find_lookup_info( $lookup_type ); unless ( $lookup_info ) { ! $self->param_add( error_msg => $error_msg ); return $self->execute({ task => 'list_lookups' }); } --- 173,177 ---- $self->_find_lookup_info( $lookup_type ); unless ( $lookup_info ) { ! $self->add_error( $error_msg ); return $self->execute({ task => 'list_lookups' }); } *************** *** 197,206 **** if ( $@ ) { $log->error( "Cannot save ID '$id': $@" ); ! $self->param_add( error_msg => "Error saving $id: $@" ); } else { if ( $value ) { my $show_id = ( $id =~ /^$NEW_KEY/ ) ? 'new item' : $id; ! $self->param_add( status_msg => "Saved $show_id ($value) ok" ); } } --- 195,205 ---- if ( $@ ) { $log->error( "Cannot save ID '$id': $@" ); ! $self->add_error_key( 'lookup.error.save', $id, $@ ); } else { if ( $value ) { my $show_id = ( $id =~ /^$NEW_KEY/ ) ? 'new item' : $id; ! $self->add_status_key( 'lookup.status.save', ! $show_id, $value ); } } *************** *** 236,241 **** my ( $lookup_info, $error_msg ) = $self->_find_lookup_info( $key ); if ( $lookup_info ) { ! $log->is_debug && ! $log->debug( "Found lookup item '$key'" ); push @lookup_list, $lookup_info; } --- 235,239 ---- my ( $lookup_info, $error_msg ) = $self->_find_lookup_info( $key ); if ( $lookup_info ) { ! $log->is_debug && $log->debug( "Found lookup item '$key'" ); push @lookup_list, $lookup_info; } *************** *** 248,257 **** my ( $self, $object_type, $field ) = @_; my $object_class = CTX->lookup_object( $object_type ); ! return $object_class->db_select( ! { select_modifier => 'DISTINCT', ! select => [ $field ], ! from => [ $object_class->table_name ], ! order => $field, ! return => 'single-list' }); } --- 246,256 ---- my ( $self, $object_type, $field ) = @_; my $object_class = CTX->lookup_object( $object_type ); ! return $object_class->db_select({ ! select_modifier => 'DISTINCT', ! select => [ $field ], ! from => [ $object_class->table_name ], ! order => $field, ! return => 'single-list', ! }); } *************** *** 262,271 **** unless ( $lookup_type ) { ! return ( undef, 'Cannot list lookup entries without a lookup type.' ); } my $lookup_info = CTX->lookup_action_info( $lookup_type ); unless ( ref $lookup_info and $lookup_info->{action_type} eq 'lookup' ) { ! return ( undef, "Cannot list lookup entries: $lookup_type " . ! "is not a valid lookup." ); } $log->is_debug && --- 261,269 ---- unless ( $lookup_type ) { ! return ( undef, $self->_msg( 'lookup.error.no_lookup_type' ) ); } my $lookup_info = CTX->lookup_action_info( $lookup_type ); unless ( ref $lookup_info and $lookup_info->{action_type} eq 'lookup' ) { ! return ( undef, $self->_msg( 'lookup.error.no_lookup_type', $lookup_type ) ); } $log->is_debug && *************** *** 324,329 **** foreach my $field ( @{ $field_list } ) { my $value = $request->param( "$field-$id" ); ! $log->is_debug && ! $log->debug( "Found in '$id' [$field: $value]" ); $object->{ $field } = $value; $not_blank++ if ( $value ); --- 322,326 ---- foreach my $field ( @{ $field_list } ) { my $value = $request->param( "$field-$id" ); ! $log->is_debug && $log->debug( "Found in '$id' [$field: $value]" ); $object->{ $field } = $value; $not_blank++ if ( $value ); |
From: Chris W. <la...@us...> - 2004-12-05 08:52:20
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/comments/msg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/comments/msg Modified Files: comments-messages-en.msg Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: comments-messages-en.msg =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/msg/comments-messages-en.msg,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comments-messages-en.msg 28 Nov 2004 05:58:43 -0000 1.4 --- comments-messages-en.msg 5 Dec 2004 08:51:22 -0000 1.5 *************** *** 52,55 **** --- 52,56 ---- comments.error.list_for_object_data_missing = Insufficient data supplied to fetch comments by object. comments.error.cannot_fetch_object_for_listing = Failed to fetch object with supplied information. Error logged. + comments.error.cannot_add_notify_no_email = Could not add notification since you did not give me your email address. Sorry. comments.error.cannot_add_notify_bad_email = Could not add notification since the email address you gave ([_1]) seems to be invalid. Sorry. comments.error.cannot_add_notify_error_dupe_check = Failed to fetch existing notifications for dupe check, so I could not add yours. |
From: Chris W. <la...@us...> - 2004-12-05 08:52:20
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/lookup In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/lookup Modified Files: Changes package.conf Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/lookup/Changes,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Changes 14 Jun 2004 23:38:43 -0000 1.7 --- Changes 5 Dec 2004 08:51:22 -0000 1.8 *************** *** 1,4 **** --- 1,8 ---- Revision history for OpenInteract package lookup. + 2.07 Sat Dec 4 12:52:09 EST 2004 + + Move errors to l10n file; use status/error shortcuts + 2.06 Mon Jun 14 19:33:08 EDT 2004 Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/lookup/package.conf,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** package.conf 14 Jun 2004 23:38:43 -0000 1.8 --- package.conf 5 Dec 2004 08:51:22 -0000 1.9 *************** *** 1,4 **** name lookup ! version 2.06 author Chris Winters <ch...@cw...> url http://www.openinteract.org/ --- 1,4 ---- name lookup ! version 2.07 author Chris Winters <ch...@cw...> url http://www.openinteract.org/ |
From: Chris W. <la...@us...> - 2004-12-05 08:52:14
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/news/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/news/OpenInteract2/Action Modified Files: News.pm Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: News.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/news/OpenInteract2/Action/News.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** News.pm 25 Sep 2004 18:20:31 -0000 1.10 --- News.pm 5 Dec 2004 08:51:23 -0000 1.11 *************** *** 40,52 **** num_items => $num_items ); my $where = "active_on <= ? AND active = ? "; ! my @values = ( OpenInteract2::Util->now, 'yes' ); my $news_class = CTX->lookup_object( 'news' ); my $items = eval { ! $news_class->fetch_group({ where => $where, ! value => \@values, ! order => 'posted_on DESC', ! limit => $num_items }) }; ! $params{news_list} = $self->_massage_news_list( $items ); return $self->generate_content( \%params ); } --- 40,59 ---- num_items => $num_items ); my $where = "active_on <= ? AND active = ? "; ! my @values = ( CTX->create_date, 'yes' ); my $news_class = CTX->lookup_object( 'news' ); my $items = eval { ! $news_class->fetch_group({ ! where => $where, ! value => \@values, ! order => 'posted_on DESC', ! limit => $num_items, ! }) }; ! if ( $@ ) { ! $self->add_error_key( 'news.error.fetch_multiple', $@ ); ! } ! else { ! $params{news_list} = $self->_massage_news_list( $items ); ! } return $self->generate_content( \%params ); } *************** *** 285,296 **** $log ||= get_logger( LOG_APP ); ! my $sections = eval { ! CTX->lookup_object( 'news_section' ) ! ->fetch_group({ order => 'section' }) ! }; ! if ( $@ ) { ! $log->error( "Failed to get news sections: $@" ); ! $self->param_add( error_msg => "Failed to get news sections: $@" ); ! } my $news = eval { CTX->lookup_object( 'news' ) --- 292,296 ---- $log ||= get_logger( LOG_APP ); ! my $sections = $self->_get_sections; my $news = eval { CTX->lookup_object( 'news' ) *************** *** 299,303 **** if ( $@ ) { $log->error( "Failed to get news objects: $@" ); ! $self->param_add( error_msg => "Failed to get news items: $@" ); } return $self->generate_content( --- 299,303 ---- if ( $@ ) { $log->error( "Failed to get news objects: $@" ); ! $self->add_error_key( 'news.error.fetch_multiple', $@ ); } return $self->generate_content( *************** *** 320,326 **** my $news = eval { $news_class->fetch( $news_id ) }; if ( $@ ) { ! my $msg = "Failed to fetch news object [$news_id]: $@"; ! $log->error( $msg ); ! $self->param_add( error_msg => $msg ); next NEWS; } --- 320,325 ---- my $news = eval { $news_class->fetch( $news_id ) }; if ( $@ ) { ! $log->error( "Cannot fetch news '$news_id': $@" ); ! $self->add_error_key( 'news.error.fetch', $news_id, $@ ); next NEWS; } *************** *** 330,336 **** eval { $news->save }; if ( $@ ) { ! my $msg = "Failed to save news object [$news_id]: $@"; ! $log->error( $msg ); ! $self->param_add( error_msg => $msg ); } else { --- 329,334 ---- eval { $news->save }; if ( $@ ) { ! $log->error( "Failed to save news object '$news_id': $@" ); ! $self->add_error_key( 'news.error.save', $news_id, $@ ); } else { *************** *** 338,343 **** } } ! $self->param_add( ! status_msg => "Attempted: $attempt; successful updates $success" ); $self->clear_cache(); return $self->execute({ task => 'home' }); --- 336,340 ---- } } ! $self->add_status_key( 'news.status.multi_updates', $attempt, $success ); $self->clear_cache(); return $self->execute({ task => 'home' }); *************** *** 353,358 **** }; if ( $@ ) { ! my $msg = "Failed to retrieve news sections: $@"; ! $self->param_add( error_msg => $msg ); } $sections ||= []; --- 350,355 ---- }; if ( $@ ) { ! $log->error( "Failed to get news sections: $@" ); ! $self->add_error_key( 'news.error.fetch_sections', $@ ); } $sections ||= []; *************** *** 360,363 **** } - 1; --- 357,359 ---- |
From: Chris W. <la...@us...> - 2004-12-05 08:52:14
|
Update of /cvsroot/openinteract/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278 Modified Files: MANIFEST Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/MANIFEST,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** MANIFEST 1 Dec 2004 05:28:35 -0000 1.103 --- MANIFEST 5 Dec 2004 08:51:18 -0000 1.104 *************** *** 157,176 **** lib/OpenInteract2/Upload.pm lib/OpenInteract2/Util.pm ! pkg/base-2.10.zip pkg/base_box-2.17.zip pkg/base_error-2.10.zip ! pkg/base_group-2.15.zip pkg/base_page-2.28.zip ! pkg/base_security-2.17.zip ! pkg/base_template-3.14.zip ! pkg/base_theme-2.09.zip ! pkg/base_user-2.34.zip ! pkg/comments-1.17.zip ! pkg/full_text-2.57.zip ! pkg/lookup-2.06.zip ! pkg/news-2.19.zip pkg/object_activity-2.11.zip ! pkg/system_doc-2.07.zip ! pkg/whats_new-2.09.zip sample/README sample/apache/FILES --- 157,176 ---- lib/OpenInteract2/Upload.pm lib/OpenInteract2/Util.pm ! pkg/base-2.11.zip pkg/base_box-2.17.zip pkg/base_error-2.10.zip ! pkg/base_group-2.16.zip pkg/base_page-2.28.zip ! pkg/base_security-2.18.zip ! pkg/base_template-3.15.zip ! pkg/base_theme-2.10.zip ! pkg/base_user-2.35.zip ! pkg/comments-1.18.zip ! pkg/full_text-2.58.zip ! pkg/lookup-2.07.zip ! pkg/news-2.20.zip pkg/object_activity-2.11.zip ! pkg/system_doc-2.08.zip ! pkg/whats_new-2.10.zip sample/README sample/apache/FILES |