You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(381) |
Nov
(176) |
Dec
(310) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(334) |
Feb
(96) |
Mar
(149) |
Apr
(214) |
May
(120) |
Jun
(56) |
Jul
(10) |
Aug
(273) |
Sep
(182) |
Oct
(56) |
Nov
(125) |
Dec
(22) |
| 2003 |
Jan
(63) |
Feb
(181) |
Mar
(498) |
Apr
(433) |
May
(39) |
Jun
(512) |
Jul
(276) |
Aug
(156) |
Sep
(101) |
Oct
(66) |
Nov
(24) |
Dec
(161) |
| 2004 |
Jan
(1) |
Feb
(377) |
Mar
(68) |
Apr
(26) |
May
(107) |
Jun
(333) |
Jul
(13) |
Aug
|
Sep
(76) |
Oct
(88) |
Nov
(170) |
Dec
(91) |
| 2005 |
Jan
(52) |
Feb
(239) |
Mar
(402) |
Apr
(15) |
May
(2) |
Jun
(1) |
Jul
(13) |
Aug
|
Sep
(71) |
Oct
(34) |
Nov
|
Dec
|
| 2006 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Chris W. <la...@us...> - 2001-10-24 23:08:04
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv22705/OpenInteract
Modified Files:
Page.pm
Log Message:
more updates (stability! functionality!)
Index: Page.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Page.pm 2001/10/24 20:55:11 1.2
--- Page.pm 2001/10/24 23:04:12 1.3
***************
*** 6,9 ****
--- 6,11 ----
use Data::Dumper qw( Dumper );
use File::Basename qw();
+ use OpenInteract::Page::Database;
+ use OpenInteract::Page::File;
$OpenInteract::Page::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
***************
*** 71,75 ****
# whenever we save the object
! sub ruleset_behavior {
my ( $class, $rs_table ) = @_;
push @{ $rs_table->{pre_save_action} }, \&find_directory;
--- 73,77 ----
# whenever we save the object
! sub ruleset_factory {
my ( $class, $rs_table ) = @_;
push @{ $rs_table->{pre_save_action} }, \&find_directory;
***************
*** 91,96 ****
return 1 unless ( $self->{content} );
return ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File::save( $self )
! : OpenInteract::Page::Database::save( $self );
}
--- 93,98 ----
return 1 unless ( $self->{content} );
return ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File::save( $self, $self->{content} )
! : OpenInteract::Page::Database::save( $self, $self->{content} );
}
|
|
From: Chris W. <la...@us...> - 2001-10-24 23:08:04
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/template
In directory usw-pr-cvs1:/tmp/cvs-serv22705/template
Modified Files:
edit_document_box.tmpl page_directory_list.tmpl page_form.tmpl
Log Message:
more updates (stability! functionality!)
Index: edit_document_box.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/template/edit_document_box.tmpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** edit_document_box.tmpl 2001/10/20 15:14:30 1.2
--- edit_document_box.tmpl 2001/10/24 23:04:19 1.3
***************
*** 1,7 ****
[%- DEFAULT theme = OI.theme_properties;
! SET new_url = OI.make_url( base = '/BasePage/show/', edit = 1 );
! SET edit_url = OI.make_url( base = '/BasePage/show/', edit = 1,
location = location );
! SET remove_url = OI.make_url( base = '/BasePage/remove/',
location = location ); -%]
<font size="-1"">
--- 1,7 ----
[%- DEFAULT theme = OI.theme_properties;
! SET new_url = OI.make_url( base = '/Page/create/' );
! SET edit_url = OI.make_url( base = '/Page/show/', edit = 1,
location = location );
! SET remove_url = OI.make_url( base = '/Page/remove/',
location = location ); -%]
<font size="-1"">
Index: page_directory_list.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/template/page_directory_list.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** page_directory_list.tmpl 2001/10/20 15:14:30 1.1
--- page_directory_list.tmpl 2001/10/24 23:04:21 1.2
***************
*** 18,23 ****
[%- MACRO create_expand_choice BLOCK -%]
- [%- SET is_chosen = ( dir_info.0 == selected_dir ) ? 1 : 0 -%]
- [%- SET is_last = ( dir_info.0 == last_dir ) ? 1 : 0 -%]
[%- IF is_chosen -%]
[%- ( is_last ) ? '/images/file_minus_collapse_last.gif'
--- 18,21 ----
***************
*** 32,36 ****
[% MACRO show_files_in_directory BLOCK -%]
[%- WHILE ( page = children_files.get_next ) -%]
! [%- edit_url = OI.make_url( base = '/BasePage/show/', edit = 1,
location = page.location ) -%]
<tr bgcolor="[% PROCESS row_color %]">
--- 30,34 ----
[% MACRO show_files_in_directory BLOCK -%]
[%- WHILE ( page = children_files.get_next ) -%]
! [%- edit_url = OI.make_url( base = '/Page/show/', edit = 1,
location = page.location ) -%]
<tr bgcolor="[% PROCESS row_color %]">
***************
*** 52,56 ****
[%- DEFAULT theme = OI.theme_properties -%]
-
[%- PROCESS error_message -%]
--- 50,53 ----
***************
*** 62,66 ****
<div align="center">
! [% INCLUDE table_bordered_begin( table_width = '90%' ) -%]
[%- last_dir_index = dir_list.max;
--- 59,63 ----
<div align="center">
! [% INCLUDE table_bordered_begin( internal_padding = 1, table_width = '90%' ) -%]
[%- last_dir_index = dir_list.max;
***************
*** 68,74 ****
[% FOREACH dir_info = dir_list -%]
! [%- expand_choice = create_expand_choice();
! dir_url = OI.make_url( base = '/BasePage/listing/',
! selected_dir = dir_info.0 -%]
<tr bgcolor="[% PROCESS row_color( count = loop.count ) %]">
<td align="right">
--- 65,73 ----
[% FOREACH dir_info = dir_list -%]
! [%- is_chosen = ( dir_info.0 == selected_dir ) ? 1 : 0;
! is_last = ( dir_info.0 == last_dir ) ? 1 : 0;
! expand_choice = create_expand_choice();
! dir_url = OI.make_url( base = '/Page/directory_list/',
! selected_dir = dir_info.0 ) -%]
<tr bgcolor="[% PROCESS row_color( count = loop.count ) %]">
<td align="right">
Index: page_form.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/template/page_form.tmpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** page_form.tmpl 2001/10/24 20:53:51 1.2
--- page_form.tmpl 2001/10/24 23:04:21 1.3
***************
*** 1,7 ****
[%- DEFAULT theme = OI.theme_properties; count = 0 -%]
! [%- OI.box_add( 'edit_document_box', location = page.location );
[%- PROCESS error_message -%]
! [%- PROCESS static_message -%]
<div align="center">
--- 1,7 ----
[%- DEFAULT theme = OI.theme_properties; count = 0 -%]
! [%- OI.box_add( 'edit_document_box', location = page.location ); -%]
[%- PROCESS error_message -%]
! [%- PROCESS status_message -%]
<div align="center">
***************
*** 23,27 ****
[%- count = count + 1 -%]
! [%- location_plabel = '<br><font size="-1">(must be unique)</font>' -%]
[% INCLUDE label_form_text_row( label = 'Location', is_required = 1,
required_display = theme.required,
--- 23,27 ----
[%- count = count + 1 -%]
! [%- location_plabel = '<br><font size="-1"><em>must be unique</em></font>' -%]
[% INCLUDE label_form_text_row( label = 'Location', is_required = 1,
required_display = theme.required,
***************
*** 46,50 ****
[%- count = count + 1 -%]
! [%- box_plabel = '<font size="-1"><em>Separate each box by whitespace; order is not important</em></font>' -%]
[% INCLUDE label_form_text_row( label = 'Boxes', post_label = box_plabel,
name = 'boxes', value = page.boxes,
--- 46,50 ----
[%- count = count + 1 -%]
! [%- box_plabel = '<br><font size="-1"><em>Separate each box by whitespace; order is not important</em></font>' -%]
[% INCLUDE label_form_text_row( label = 'Boxes', post_label = box_plabel,
name = 'boxes', value = page.boxes,
***************
*** 52,56 ****
[%- count = count + 1 -%]
! [%- template_plabel = '<font size="-1"><em>main template to use; blank uses the default</em></font>' -%]
[% INCLUDE label_form_text_row( label = 'Main Template', post_label = template.plabel,
name = 'main_template', value = page.main_template,
--- 52,56 ----
[%- count = count + 1 -%]
! [%- template_plabel = '<br><font size="-1"><em>main template to use; blank uses the default</em></font>' -%]
[% INCLUDE label_form_text_row( label = 'Main Template', post_label = template.plabel,
name = 'main_template', value = page.main_template,
***************
*** 72,76 ****
[%- count = count + 1 -%]
! <tr bgcolor="[% PROCESS row_color %]"><td align="center">
<table border="0" cellpadding="1">
<tr align="center" valign="bottom">
--- 72,76 ----
[%- count = count + 1 -%]
! <tr bgcolor="[% PROCESS row_color %]"><td align="center" colspan="2">
<table border="0" cellpadding="1">
<tr align="center" valign="bottom">
***************
*** 91,100 ****
[%- count = count + 1 -%]
! [% INCLUDE label_row_begin( label = 'Updates' ) -%]
! <td>[%- PROCESS object_updates -%]</td>
! </tr>
[%- count = count + 1 -%]
! [% INCLUDE label_form_submit_row( value = 'Modify', reset = 1 ) -%]
[% PROCESS table_bordered_end -%]
--- 91,101 ----
[%- count = count + 1 -%]
! <tr bgcolor="[% PROCESS row_color %]"><td align="center" colspan="2">
! [% PROCESS show_label( label = 'Updates' ) %]<br>
! [%- PROCESS object_updates -%]
! </td></tr>
[%- count = count + 1 -%]
! [% INCLUDE form_submit_row( value = 'Modify', reset = 1 ) -%]
[% PROCESS table_bordered_end -%]
|
|
From: Chris W. <la...@us...> - 2001-10-24 22:16:28
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/template In directory usw-pr-cvs1:/tmp/cvs-serv11107 Removed Files: static_page_form.meta static_page_form.tmpl Log Message: remove old templates --- static_page_form.meta DELETED --- --- static_page_form.tmpl DELETED --- |
|
From: Chris W. <la...@us...> - 2001-10-24 21:54:03
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Template
In directory usw-pr-cvs1:/tmp/cvs-serv4441/Template
Modified Files:
Process.pm
Log Message:
futz with the content passed into handler; throw an error if the
content isn't available via the means listed
Index: Process.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Template/Process.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Process.pm 2001/10/11 13:28:55 1.15
--- Process.pm 2001/10/24 21:54:00 1.16
***************
*** 90,94 ****
my ( $name, $to_process );
if ( $template_source->{text} ) {
! $to_process = \$template_source->{text};
$name = '_anonymous_';
$R->DEBUG && $R->scrib( 1, "Using raw template source for processing" );
--- 90,95 ----
my ( $name, $to_process );
if ( $template_source->{text} ) {
! $to_process = ( ref $template_source->{text} eq 'SCALAR' )
! ? $template_source->{text} : \$template_source->{text};
$name = '_anonymous_';
$R->DEBUG && $R->scrib( 1, "Using raw template source for processing" );
***************
*** 121,124 ****
--- 122,132 ----
}
+ # Uh oh...
+
+ else {
+ $R->scrib( 0, "No template to process! Information given for source:\n",
+ Dumper( $template_source ) );
+ die "No template to process!\n";
+ }
# Grab the template object and the OI plugin, making the OI plugin
# available to every template
|
|
From: Chris W. <la...@us...> - 2001-10-24 21:53:24
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv4258
Modified Files:
SPOPS.pm
Log Message:
rename ruleset_add -> ruleset_behavior
Index: SPOPS.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/SPOPS.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** SPOPS.pm 2001/10/24 11:31:35 1.16
--- SPOPS.pm 2001/10/24 21:53:21 1.17
***************
*** 18,22 ****
########################################
! sub ruleset_add {
my ( $class, $rs_table ) = @_;
push @{ $rs_table->{post_save_action} }, \&save_object_key;
--- 18,22 ----
########################################
! sub ruleset_factory {
my ( $class, $rs_table ) = @_;
push @{ $rs_table->{post_save_action} }, \&save_object_key;
|
|
From: Chris W. <la...@us...> - 2001-10-24 21:05:12
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/doc In directory usw-pr-cvs1:/tmp/cvs-serv25281/doc Modified Files: base_page.pod Log Message: copy over docs from static_page Index: base_page.pod =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/doc/base_page.pod,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** base_page.pod 2001/10/17 12:11:04 1.1 --- base_page.pod 2001/10/24 21:05:10 1.2 *************** *** 1,35 **** =head1 NAME ! base_page - This package will do everything! =head1 SYNOPSIS =head1 DESCRIPTION ! =head1 OBJECTS ! No objects created by this package. ! =head1 ACTIONS ! No actions defined in this package. ! =head1 RULESETS ! No rulesets defined in this package. ! =head1 ERRORS ! No custom error handlers defined in this package. ! =head1 BUGS ! None known. =head1 TO DO =head1 SEE ALSO =head1 AUTHORS ! Who AmI <me...@wh...> --- 1,193 ---- + =pod + =head1 NAME ! base_page - Package for displaying and editing 'static' web pages in OpenInteract =head1 SYNOPSIS + # Too many actions to list, since by default this module picks up all + # requests not found in the action table + =head1 DESCRIPTION ! This module displays pages. ! Well, ok, it does more than that. Each page is a template in its own ! right and you can store the pages in the database or the filesystem, ! or both. A configuration option in your 'conf/action.perl' controls ! which option you want to use. ! So a request like: ! http://www.mysite.com/reports/q1/sales ! Can be mapped to a database object which displays the report. But your ! users never know the difference. ! =head2 Non-HTML pages ! This module can also deal with other types of files, although its main ! purpose is to impose security on them. After security is checked it ! generally hands the filename to OpenInteract so the file contents can ! be sent to the user further along in the process. ! =head2 Handling all unspecified requests ! How does this module handle all unspecified requests? In the ! OpenInteract server configuration file, toward the bottom, there's a ! section that looks something like this: ! [action_info none] ! redir = page ! ! [action_info not_found] ! redir = page ! ! ! This means if no action is found (an 'empty request') it will be ! serviced by the 'page' action, which is defined in this module's ! 'conf/action.perl' file. The empty request is typically ! 'http://www.mysite.com/', or your home page. (Want to see all the ! actions defined for your site? Try: ! ! 'oi_manage list_actions --website_dir=/path/to/my/site' ! ! from the command-line.) ! ! Similarly, the 'not_found' action definition will automatically get ! picked up by the same 'page' action. This means any request ! OpenInteract can't match up to an action will get sent to the 'page' ! action unless rquested not to do so. ! ! =head1 RECORDS USED ! ! Static pages used to be only displayed from the database using the ! 'basic_page' SPOPS object. No longer. You can now display HTML pages ! from the filesystem as well as objects from the database, and refer to ! them in the exact same way. ! ! There are a few differences. Objects ! ! For instance, say you have database records representing HTML pages ! identified by the following locations: ! ! /mytest/test1 ! /mytest/test2 ! ! And HTML pages in the filesystem at the following locations: ! ! $SITE_HOME/html/mytest/test3.html ! $SITE_HOME/html/mytest/test4.html ! ! Then the following applies: ! ! Request Result ! =============== ========================= ! /mytest/test1 Served by SPOPS object from database ! /mytest/test3.html Served by filesystem ! /mytest/test4 File not found! ! /mytest/test2.html Served by SPOPS object from database ! ! The first three are pretty easy to understand, but the fourth is ! odd. When searching for files in the database, we take the requests ! and, if a file extension exists, chop it off as another name to ! check. This could lead to a nasty 'error' where you have a file in the ! filesystem '$SITE_HOME/html/mytest/test2.html' and a database object ! '/mytest/test2' -- if the database is being checked first, then the ! filesystem file will B<never be displayed>. ! ! =head1 SECURITY ! ! Pages are different from other objects in how their security is ! treated. Typically, you want to set security for a directory and have ! that security setting be inherited by all files in that directory, all ! directories in that directory and files within each of those ! directories, and so on. This is how Apache does file-based security. ! ! OpenInteract implements security the same way, but using a slightly ! more generic mechanism. Using the L<SPOPS::Secure::Hierarchy> ! module, we simply split up each URL using the directory separator ! ('/') and apply security at each level under that. Here's an example ! from the L<SPOPS::Secure::Hierarchy> documentation: ! ! ------------------------- ! ! To accomplish this, every record needs to have an identifier that can ! be manipulated into a parent identifier. With filesystems (or URLs) ! this is simple. Given the pseudo-file: ! ! /docs/release/devel-only/v1.3/mydoc.html ! ! You have the following parents: ! ! /docs/release/devel-only/v1.3 ! /docs/release/devel-only ! /docs/release/ ! /docs/ ! <ROOT OBJECT> (explained below) + ------------------------- + + So setting security for '/docs/release' when it's protected by + hierarchical security will also protect '/docs/release/devel-only' and + on down the line, as long as the child doesn't have security defined + of its own. + + One additional note: since security is typically set by directory, + B<any> file in that directory is protected by the security, HTML and + non-HTML alike. This allows you to put graphics, PDF documents, Excel + spreadsheets or what have you into a filesystem directory, protect the + directory and let OpenInteract deal with the rest. Cool. + + =head1 BUGS + + =over 4 + + =item * + + Documentation: ensure we have all the action and SPOPS items in the + docs. + + =item * + + See that we handle file extensions (or lack thereof) consistently no + matter whether we're requesting an object from the database or a file + from the filesystem. + + =back + =head1 TO DO + B<Map multiple URLs to one 'file'> + + Sometimes you might accidentally give out the wrong URL, or you might + find that people constantly misspell the correct URL. It should be + pretty simple to have a separate table of URL -> real URL mappings + which we consult if we don't find a page. + + B<Map requests to URL fetches from other sites> + + It would be kind of interesting to map certain URLs to grab pages (or + sections of pages) from other sites. (Probably illegal, but whatever.) + =head1 SEE ALSO + B<base_security> package + + L<SPOPS::Secure::Hierarchy|SPOPS::Secure::Hierarchy> + =head1 AUTHORS ! Chris Winters <ch...@cw...> ! ! =head1 COPYRIGHT ! ! Copyright (c) 2001 intes.net, inc.. All rights reserved. ! ! This library is free software; you can redistribute it and/or modify ! it under the same terms as Perl itself. ! ! $Id$ ! ! =cut \ No newline at end of file |
|
From: Chris W. <la...@us...> - 2001-10-24 21:04:59
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page In directory usw-pr-cvs1:/tmp/cvs-serv25188 Modified Files: MANIFEST Log Message: meta Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/MANIFEST,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MANIFEST 2001/10/24 20:55:37 1.3 --- MANIFEST 2001/10/24 21:04:56 1.4 *************** *** 5,8 **** --- 5,9 ---- conf/action.perl conf/spops.perl + data/install_security.dat doc/base_page.pod doc/titles |
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:41
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/struct In directory usw-pr-cvs1:/tmp/cvs-serv22637/struct Modified Files: page.sql Log Message: latest updates Index: page.sql =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/struct/page.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** page.sql 2001/10/20 15:14:10 1.1 --- page.sql 2001/10/24 20:55:37 1.2 *************** *** 6,9 **** --- 6,10 ---- keywords varchar(75) null, boxes varchar(75) null, + template_parse char(3) default 'yes', main_template varchar(40) null, active_on datetime null, |
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:41
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/conf
In directory usw-pr-cvs1:/tmp/cvs-serv22637/conf
Modified Files:
action.perl spops.perl
Log Message:
latest updates
Index: action.perl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/conf/action.perl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** action.perl 2001/10/20 15:12:52 1.2
--- action.perl 2001/10/24 20:55:37 1.3
***************
*** 1,7 ****
$action = {
'page' => {
! 'class' => 'OpenInteract::Handler::BasePage',
! 'security' => 'yes',
! 'directory_index' => [ 'index.html', 'home.html', 'index', 'home' ],
},
--- 1,7 ----
$action = {
'page' => {
! 'class' => 'OpenInteract::Handler::BasePage',
! 'security' => 'yes',
! 'directory_index' => [ 'index.html', 'home.html', 'index', 'home' ],
},
Index: spops.perl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/conf/spops.perl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** spops.perl 2001/10/20 15:12:52 1.2
--- spops.perl 2001/10/24 20:55:37 1.3
***************
*** 12,21 ****
id_field => 'location',
no_insert => [],
! skip_undef => [],
no_update => [],
base_table => 'page',
! sql_defaults => [],
alias => [ 'static_page', 'basicpage' ],
! has_a => {},
links_to => {},
track => { create => 1, update => 1, remove => 1 },
--- 12,21 ----
id_field => 'location',
no_insert => [],
! skip_undef => [ qw/ template_parse is_active is_file / ],
no_update => [],
base_table => 'page',
! sql_defaults => [ qw/ template_parse is_active is_file / ],
alias => [ 'static_page', 'basicpage' ],
! has_a => { 'OpenInteract::PageContent' => 'location' },
links_to => {},
track => { create => 1, update => 1, remove => 1 },
***************
*** 24,30 ****
object_name => 'Document',
default_storage => 'file',
- content_table => 'page_content',
hierarchy_separator => '/',
hierarchy_field => 'location',
},
};
--- 24,40 ----
object_name => 'Document',
default_storage => 'file',
hierarchy_separator => '/',
hierarchy_field => 'location',
+ },
+ 'page_content' => {
+ class => 'OpenInteract::PageContent',
+ code_class => '',
+ isa => [ qw/ SPOPS::DBI / ],
+ field => [ qw/ location content / ],
+ id_field => 'location',
+ base_table => 'page_content',
+ has_a => { 'OpenInteract::Page' => 'location' },
+ links_to => {},
+ object_name => 'Document',
},
};
|
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:40
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page
In directory usw-pr-cvs1:/tmp/cvs-serv22637/OpenInteract/Page
Modified Files:
Database.pm File.pm
Log Message:
latest updates
Index: Database.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page/Database.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Database.pm 2001/10/20 15:12:34 1.1
--- Database.pm 2001/10/24 20:55:37 1.2
***************
*** 1,19 ****
package OpenInteract::Page::Database;
! # Read in the page content from a separate table/object
! sub _load {
my ( $self ) = @_;
! my $page_content = $self->page_content;
! $self->{pagetext} = $page_content->{pagetext};
! $self->{script} = $page-content->{script};
}
! sub _save {
}
! sub _remove {
}
--- 1,29 ----
package OpenInteract::Page::Database;
! # $Id$
! use strict;
!
! sub load {
my ( $self ) = @_;
! my $page_content = eval { $self->page_content };
! return $page_content->{content};
}
! sub save {
! my ( $self, $content ) = @_;
! my $R = OpenInteract::Request->instance;
! my $page_content = eval { $self->page_content } || $R->page_content->new;
! $page_content->{location} = $self->{location};
! $page_content->{content} = $content;
! return $page_content->save;
}
! sub remove {
! my ( $self ) = @_;
! my $page_content = eval { $self->page_content };
! return $page_content->remove;
}
Index: File.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page/File.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** File.pm 2001/10/20 15:12:34 1.1
--- File.pm 2001/10/24 20:55:37 1.2
***************
*** 5,58 ****
use strict;
# Read in the content from a file
! sub load_content {
my ( $self ) = @_;
my $R = OpenInteract::Request->instance;
! my $html_dir = $R->CONFIG->get_dir( 'html' );
! $html_dir =~ s|/$||;
! my $full_location = join( '', $html_dir, $self->{location} );
! next unless ( -f $full_location );
! $R->DEBUG && $R->scrib( 1, "Filesystem location ($full_location) ",
! "exists. Trying to read file." );
! open( STATIC, $full_location ) || die "Cannot access file: no access";
local $/ = undef;
! $self->{pagetext} = <STATIC>;
!
! # Pull out the title, main template, author, extra boxes (if they
! # exist)
! if ( $self->{pagetext} =~ s|<title>(.*)?</title>|| ) {
! $self->{title} ||= $1;
! }
! if ( $self->{pagetext} =~ s|<template>(.*)?</template>|| ) {
! $self->{main_template} ||= $1;
! }
! if ( $self->{pagetext} =~ s|<author>(.*)?</author>|| ) {
! $self->{author} ||= $1;
! }
! if ( $self->{pagetext} =~ s|<boxes>(.*)?</boxes>|| ) {
! $self->{boxes} ||= $1;
! }
# Only use the information between the $BODY_DEMARCATION tags (if
# they exist)
! $self->{pagetext} =~ s/$BODY_DEMARCATION(.*)?$BODY_DEMARCATION/$1/;
# If the page still has <body> tags, only use the information
# between them
! $self->{pagetext} =~ s|<body>(.*)?</body>|$1|i;
}
! sub _save {
}
! sub _remove {
}
--- 5,97 ----
use strict;
+ # Use this to mark the beginning and end of the "good" content in a
+ # page in the filesystem; this allows you to use an HTML editor to
+ # create the content and to save a full html page to the filesystem
+
+ my $BODY_DEMARCATION = '<!-- OI BODY -->';
+
+
# Read in the content from a file
! sub load {
my ( $self ) = @_;
+ my $full_location = $self->_create_file_location;
+ return undef unless ( -f $full_location );
my $R = OpenInteract::Request->instance;
! $R->DEBUG && $R->scrib( 1, "File ($full_location) exists. Trying to read file." );
! open( STATIC, $full_location ) || die "Cannot access file: $!";
local $/ = undef;
! my $content = <STATIC>;
! close( STATIC );
! $R->DEBUG && $R->scrib( 1, "File read ok. Scanning for valid content then returning." );
# Only use the information between the $BODY_DEMARCATION tags (if
# they exist)
! $content =~ s/$BODY_DEMARCATION(.*)?$BODY_DEMARCATION/$1/;
# If the page still has <body> tags, only use the information
# between them
! $content =~ s|<body>(.*)?</body>|$1|i;
!
! return $content;
}
+ # Wrap this sucker in an eval {} -- if there's an error, the old file
+ # is still in place (even if that was nothing); if there's no error,
+ # everything is consistent
! sub save {
! my ( $self, $content ) = @_;
! my $R = OpenInteract::Request->instance;
! my $full_location = $self->_create_file_location;
! $R->DEBUG && $R->scrib( 1, "Trying to save content to ($full_location)" );
!
! my $tmp_location = $full_location;
! if ( -f $full_location ) {
! $R->DEBUG && $R->scrib( 1, "File already exists; writing content to temp file." );
! $tmp_location = "$full_location.tmp";
! if ( -f $tmp_location ) {
! unlink( $tmp_location ) || die "Cannot remove old temp file: $!";
! }
! }
! open( NEW, "> $tmp_location" ) || die "Cannot open temp file for writing: $!";
! print NEW $content;
! close( NEW );
! $R->DEBUG && $R->scrib( 1, "Wrote content to file ok." );
!
! if ( $full_location ne $tmp_location ) {
! $R->DEBUG && $R->scrib( 1, "Trying to delete old content file and rename temp file." );
! unlink( $full_location ) || die "Cannot remove old content file: $!";
! rename( $tmp_location, $full_location ) || die "Cannot rename temp file to content file: $!";
! $R->DEBUG && $R->scrib( 1, "Old file removed, new file renamed ok." );
! }
!
! return $full_location;
}
! sub remove {
! my ( $self ) = @_;
! my $full_location = $self->_create_file_location;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && $R->scrib( 1, "Trying to delete content file ($full_location)" );
! return 1 unless ( -f $full_location );
! unlink( $full_location ) || die "Cannot remove stale content file: $!";
! $R->DEBUG && $R->scrib( 1, "File deleted ok" );
! return 1;
! }
!
!
! sub _create_file_location {
! my ( $self ) = @_;
! my $R = OpenInteract::Request->instance;
! my $html_dir = $R->CONFIG->get_dir( 'html' );
! $html_dir =~ s|/$||;
! return join( '', $html_dir, $self->{location} );
}
|
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:40
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page In directory usw-pr-cvs1:/tmp/cvs-serv22637 Modified Files: Changes MANIFEST package.conf Log Message: latest updates Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/Changes,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Changes 2001/10/17 12:09:41 1.1 --- Changes 2001/10/24 20:55:37 1.2 *************** *** 1,6 **** Revision history for OpenInteract package base_page. ! 0.01 Mon Oct 15 22:11:22 2001 ! Package skeleton created by oi_manage --- 1,9 ---- Revision history for OpenInteract package base_page. ! 0.01 Wed Oct 24 16:47:01 EDT 2001 ! Package skeleton created by oi_manage -- ported the ! 'static_page' package to OI::CommonHandler, cleaned it up and ! extended it so we can use the filesystem or the database to ! store page objects. Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/MANIFEST,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MANIFEST 2001/10/20 15:10:10 1.2 --- MANIFEST 2001/10/24 20:55:37 1.3 *************** *** 12,21 **** OpenInteract/Handler/Page.pm OpenInteract/SQLInstall/BasePage.pm template/edit_document_box.meta template/edit_document_box.tmpl template/page_directory_list.meta template/page_directory_list.tmpl template/page_search_form.meta template/page_search_form.tmpl template/static_page_form.meta ! template/static_page_form.tmpl --- 12,25 ---- OpenInteract/Handler/Page.pm OpenInteract/SQLInstall/BasePage.pm + struct/page.sql + struct/page_content.sql template/edit_document_box.meta template/edit_document_box.tmpl template/page_directory_list.meta template/page_directory_list.tmpl + template/page_form.meta + template/page_form.tmpl template/page_search_form.meta template/page_search_form.tmpl template/static_page_form.meta ! template/static_page_form.tmpl \ No newline at end of file Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/package.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.conf 2001/10/17 12:09:41 1.1 --- package.conf 2001/10/24 20:55:37 1.2 *************** *** 3,7 **** author Chris Winters <ch...@cw...> module File::Basename ! module Date::Calc template_plugin url http://www.openinteract.org/ --- 3,7 ---- author Chris Winters <ch...@cw...> module File::Basename ! module Class::Date template_plugin url http://www.openinteract.org/ *************** *** 9,15 **** description Object and handler representing a static web page, either from the ! filesystem or from objects stored within a database. You choose which ! (or both) you would like to use from the <conf/action.perl> file. This ! will be the default handler for most OpenInteract applications, and is ! a fundamental part of the system. --- 9,15 ---- description Object and handler representing a static web page, either from the ! filesystem or from objects stored within a database, or both. (Choose ! the default in 'conf/spops.perl'.) This will be the default handler ! for most OpenInteract applications, and is a fundamental part of the ! system. |
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:40
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv22637/OpenInteract/Handler
Modified Files:
Page.pm
Log Message:
latest updates
Index: Page.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Handler/Page.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Page.pm 2001/10/22 02:00:29 1.2
--- Page.pm 2001/10/24 20:55:37 1.3
***************
*** 19,38 ****
);
- use constant MAIN_SCRIPT => '/Page';
-
- # Use this to signal that we shouldn't send the content through TT --
- # this is useful for documentation :-)
-
- use constant NO_PARSE_STATUS => 'no_parse';
-
# 52 weeks -- default expiration for page
-
- use constant DEFAULT_EXPIRE => 60 * 60 * 24 * 7 * 52;
-
- # Use this to mark the beginning and end of the "good" content in a
- # page in the filesystem; this allows you to use an HTML editor to
- # create the content and to save a full html page to the filesystem
! my $BODY_DEMARCATION = '<!-- OI BODY -->';
# Use this to check whether the file retrieved is displayable in the
--- 19,25 ----
);
# 52 weeks -- default expiration for page
! use constant DEFAULT_EXPIRE => '365D';
# Use this to check whether the file retrieved is displayable in the
***************
*** 51,61 ****
sub MY_OBJECT_CLASS { return OpenInteract::Request->instance->page }
sub MY_SEARCH_FIELDS { return () }
- sub MY_OBJECT_FORM_TITLE { return 'Edit Page' }
- sub MY_OBJECT_FORM_TEMPLATE { return '' }
sub MY_EDIT_RETURN_URL { return '/' }
sub MY_EDIT_DISPLAY_TASK { return 'show' }
sub MY_EDIT_FIELDS { return qw( location title author keywords
boxes main_template notes ) }
! sub MY_EDIT_FIELDS_TOGGLED { return qw( is_active is_file ) }
sub MY_EDIT_FIELDS_DATE { return qw( active_on expires_on ) }
sub MY_ALLOW_SEARCH_FORM { return 1 }
--- 38,46 ----
sub MY_OBJECT_CLASS { return OpenInteract::Request->instance->page }
sub MY_SEARCH_FIELDS { return () }
sub MY_EDIT_RETURN_URL { return '/' }
sub MY_EDIT_DISPLAY_TASK { return 'show' }
sub MY_EDIT_FIELDS { return qw( location title author keywords
boxes main_template notes ) }
! sub MY_EDIT_FIELDS_TOGGLED { return qw( is_active is_file template_parse ) }
sub MY_EDIT_FIELDS_DATE { return qw( active_on expires_on ) }
sub MY_ALLOW_SEARCH_FORM { return 1 }
***************
*** 63,66 ****
--- 48,52 ----
sub MY_ALLOW_EDIT { return 1 }
sub MY_ALLOW_REMOVE { return 1 }
+ sub MY_ALLOW_NOTIFY { return 1 }
sub MY_ALLOW_WIZARD { return undef }
***************
*** 80,87 ****
# Retrieve all directories, expanding the one we were asked to (if at
# all). Note that these are just the objects in the database, although
! # hopefully there's one of these corresponding to every file in the
! # filesystem.
! sub listing {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
--- 66,73 ----
# Retrieve all directories, expanding the one we were asked to (if at
# all). Note that these are just the objects in the database, although
! # there should be a corresponding content entry for every one of these
! # in the filesystem or database.
! sub directory_list {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
***************
*** 89,93 ****
my $selected_dir = $R->apache->param( 'selected_dir' );
my $params = { selected_dir => $selected_dir,
! error_msg => $p->{error_msg} };
$params->{dir_list} = eval { $R->page->list_directories };
--- 75,80 ----
my $selected_dir = $R->apache->param( 'selected_dir' );
my $params = { selected_dir => $selected_dir,
! error_msg => $p->{error_msg},
! status_msg => $p->{status_msg} };
$params->{dir_list} = eval { $R->page->list_directories };
***************
*** 95,98 ****
--- 82,86 ----
OpenIntereact::Error->set( SPOPS::Error->get );
$R->throw({ code => 403 });
+ $params->{error_msg} .= "\nCannot retrieve directories: $@";
$params->{dir_list} = [];
}
***************
*** 102,111 ****
if ( $selected_dir ) {
! $params->{children_files} = $R->static_page->fetch_iterator({
where => 'directory = ?',
value => [ $selected_dir ] });
}
! $R->{page}{title} = 'Listing of Documents';
return $R->template->handler( {}, $params,
{ name => 'page::page_directory_list' } );
--- 90,99 ----
if ( $selected_dir ) {
! $params->{children_files} = $R->page->fetch_iterator({
where => 'directory = ?',
value => [ $selected_dir ] });
}
! $R->{page}{title} = 'Document Listing';
return $R->template->handler( {}, $params,
{ name => 'page::page_directory_list' } );
***************
*** 113,121 ****
sub show {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
! my $params = { main_script => MAIN_SCRIPT,
! error_msg => $p->{error_msg},
status_msg => $p->{status_msg} };
--- 101,136 ----
+ # Yes, this is out of the normal order. It's just that show() is so
+ # big and includes so much stuff...
+
+ sub _edit_customize {
+ my ( $class, $page, $old_data ) = @_;
+ my %opts = ();
+
+ # If the user changed the location, then we need to set the ID so
+ # the UPDATE works properly.
+
+ if ( $page->{location} ne $old_data->{location} ) {
+ $opts{use_id} = $old_data->{location};
+ }
+
+ # Default the expires_on field
+
+ unless ( $page->{expires_on} ) {
+ my $expire_date = Class::Date->now + DEFAULT_EXPIRE;
+ $page->{expires_on} = $expire_date->strftime( '%Y-%m-%d' );;
+ }
+ return ( OK, \%opts );
+ }
+
+
+
+ # Why do we set the content-type when returning errors? See note on
+ # error content-type forcing in POD...
+
sub show {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
! my $params = { error_msg => $p->{error_msg},
status_msg => $p->{status_msg} };
***************
*** 123,178 ****
# directly, specified in a parameter or taken from the URL.
! my $location = $class->_clean_location( $class->_find_location( $p ) );
# Try and find a page object (just the metadata) matching with our
# location. Note that _find_page_object() will also treat
# $location as a directory request, where appropriate
-
- my $page = eval { $p->{page} || $class->_find_page_object( $location ) };
- my $error_type = $@;
- my $do_edit = ( $R->apache->param( 'edit' ) and
- $p->{level} >= SEC_LEVEL_WRITE );
-
- unless ( $page or $do_edit ) {
- $R->DEBUG && $R->scrib( 1, "",
- "Error type: ($error_type)" );
! # We have to force the content-type here because the user
! # might have requested a file that actually exists in the
! # filesystem and which Apache has already mapped a
! # content-type. You'll know when this happens because you'll
! # be prompted to d/l the file or a plugin (like Acrobat
! # Reader) will try to display it, but the *actual* content
! # will be plain old HTML...
!
$R->{page}{content_type} = 'text/html';
!
! if ( $error_type =~ /^security/ ) {
my $admin_email = $R->CONFIG->{mail}{admin_email};
! return <<FORBID;
! <h2>Access Forbidden</h2>
! <p>You do not have access rights to view this page. Please e-mail the
! administrator at <a href="mailto:$admin_email">$admin_email</a> if you
! feel you have received this message in error.</p>
! FORBID
}
! elsif ( $error_type =~ /^access/ ) {
return "<h2>Cannot Access</h2><p>Failure accessing page.</p>";
}
- return <<NOTFOUND;
- <h2>Page Not Found</h2>
- <p>Could not find page with location you requested
- (<tt>$location</tt>). Did you mistype the address?</p>
- NOTFOUND
}
# If we specified that we're going to send a separate file to the
# user (usually not HTML, text, etc.) then set the information and
# quit processing
! unless ( $class->_is_page_displayable( $page ) ) {
$R->{page}{send_file} = $page->{location};
! $R->DEBUG && $R->scrib( 1, "File being retrieved is not displayable.",
! "Set 'send_file' to $page->{location}" );
return undef;
}
--- 138,175 ----
# directly, specified in a parameter or taken from the URL.
! my $location = $class->_clean_location( $class->_find_location( $p ) );
# Try and find a page object (just the metadata) matching with our
# location. Note that _find_page_object() will also treat
# $location as a directory request, where appropriate
! my $page = $p->{page} || eval { $class->_find_page_object( $location ) };
! if ( $@ ) {
$R->{page}{content_type} = 'text/html';
! $R->DEBUG && $R->scrib( 1, "Could not retrieve page. Error ($@)" );
! if ( $@ =~ /^security/ ) {
my $admin_email = $R->CONFIG->{mail}{admin_email};
! return $class->_forbiden_message( $admin_email )
}
! elsif ( $@ =~ /^access/ ) {
return "<h2>Cannot Access</h2><p>Failure accessing page.</p>";
}
}
+ my $do_edit = $p->{edit} || $R->apache->param( 'edit' );
+ unless ( $page or $do_edit ) {
+ $R->{page}{content_type} = 'text/html';
+ return $class->_notfound_message( $location );
+ }
+
+
# If we specified that we're going to send a separate file to the
# user (usually not HTML, text, etc.) then set the information and
# quit processing
! unless ( $class->_is_displayable( $page ) ) {
$R->{page}{send_file} = $page->{location};
! $R->DEBUG && $R->scrib( 1, "File being retrieved is not directly displayable.",
! "Set 'send_file' to ($page->{location})" );
return undef;
}
***************
*** 180,184 ****
# We have a page and we can display it, so grab the content
! $page->load_content;
# Now figure out if we're editing or not
--- 177,181 ----
# We have a page and we can display it, so grab the content
! $page->content;
# Now figure out if we're editing or not
***************
*** 192,220 ****
if ( $do_edit ) {
$page ||= $R->page->new;
$params->{page} = $page;
$text_params = { name => 'page::page_form' };
$R->{page}{title} = 'Edit a Document';
- my $update_items = ( $page->is_saved ) ? eval { $page->fetch_updates( 5 ) } : [];
- foreach my $update_info ( @{ $update_items } ) {
- my $user = eval { $R->user->fetch( $update_info->[0] ) };
- my $username = ( $user ) ? $user->{login_name} : 'administrator';
- push @{ $params->{update_list} }, { login_name => $username, date => $update_info->[1] };
- }
}
else {
-
- # Ensure the page is viewable right now
-
unless ( $class->_is_active( $page ) ) {
$R->DEBUG && $R->scrib( 1, "Page is not currently active; return error" );
! $R->{page}{title} = 'Page not yet active';
! return '<h2 align="center">Not Active</h2><p>Sorry, this page is not currentlyactive.</p>';
}
! $R->{page}{title} = $page->{title};
# Allows the page to define the main template it will use; if
# the page doesn't define one then the main UI module will use
! # the default
$R->{page}{_template_name_} = $page->{main_template};
--- 189,209 ----
if ( $do_edit ) {
$page ||= $R->page->new;
+ $page->{is_file} ||= 'yes' if ( $page->CONFIG->{default_storage} eq 'file' );
$params->{page} = $page;
$text_params = { name => 'page::page_form' };
$R->{page}{title} = 'Edit a Document';
}
else {
unless ( $class->_is_active( $page ) ) {
$R->DEBUG && $R->scrib( 1, "Page is not currently active; return error" );
! $R->{page}{title} = 'Page not active';
! return '<h2 align="center">Not Active</h2><p>Sorry, this page is not active.</p>';
}
! $R->{page}{title} = $page->{title};
# Allows the page to define the main template it will use; if
# the page doesn't define one then the main UI module will use
! # the default for the current theme
$R->{page}{_template_name_} = $page->{main_template};
***************
*** 230,236 ****
# its content.
! if ( $page->{_template_status} eq NO_PARSE_STATUS ) {
! return $page->{content};
! }
return $R->template->handler( {}, $params, $text_params );
--- 219,223 ----
# its content.
! return $page->{content} if ( $page->{template_parse} eq 'no' );
return $R->template->handler( {}, $params, $text_params );
***************
*** 349,355 ****
$this_page .= <<PCOUNT;
<p align="right"><font size="-1">
! [% OI.comp( 'page_count', total_pages = $total_pages,
! url = '$page->{location}',
! current_pagenum = $current_pagenum ) %]
</font></p>
PCOUNT
--- 336,342 ----
$this_page .= <<PCOUNT;
<p align="right"><font size="-1">
! [%- PROCESS page_count( total_pages = $total_pages,
! url = '$page->{location}',
! current_pagenum = $current_pagenum ) -%]
</font></p>
PCOUNT
***************
*** 366,398 ****
my $box_string = $page->{boxes};
! # If this page has specified any boxes, push them onto the stack
! # unless they start with a '-', in which case set that name aside
! # so we can go through all of the boxes and remove it.
- my %box_remove = ();
if ( $box_string ) {
my @boxes = split /\s+/, $box_string;
foreach my $box_name ( @boxes ) {
next if ( $box_name =~ /^\s*$/ );
$R->DEBUG && $R->scrib( 1, "Adding box name ($box_name) from page definition" );
if ( $box_name =~ s/^\-// ) {
! $box_remove{ $box_name }++;
! }
! else {
! push @{ $R->{boxes} }, $box_name;
}
}
-
- # Go through ALL the boxes and do a removal if necessary
-
- # TODO: we should move this processing to base_box)
-
- my @box_keep = ();
- foreach my $box_info ( @{ $R->{boxes} } ) {
- next if ( ref $box_info and $box_remove{ $box_info->{name} } );
- next if ( ! ref $box_info and $box_remove{ $box_info } );
- push @box_keep, $box_info;
- }
- $R->{boxes} = \@box_keep;
}
--- 353,372 ----
my $box_string = $page->{boxes};
! # Add boxes as necessary -- names beginning with a '-' should be
! # tagged for removal
if ( $box_string ) {
+ $box_string =~ s/^\s+//;
my @boxes = split /\s+/, $box_string;
foreach my $box_name ( @boxes ) {
next if ( $box_name =~ /^\s*$/ );
$R->DEBUG && $R->scrib( 1, "Adding box name ($box_name) from page definition" );
+ my $box_params = { name => $box_name };
if ( $box_name =~ s/^\-// ) {
! $box_params->{name} = $box_name;
! $box_params->{remove} = 'yes';
}
+ push @{ $R->{boxes} }, $box_params
}
}
***************
*** 414,434 ****
return 1 unless ( $page->{active_on} );
! my $active = Class::Date::date([ split '-', $page->{active_on} ]);
my $now = Class::Date->now;
! my $expires = Class::Date::date([ split '-', $page->{expires_on} ]);
my $R = OpenInteract::Request->instance;
$R->DEBUG && $R->scrib( 1, "Active on: $active; Expires on: $expires" );
! return undef if ( $now < $active );
! return undef if ( $now > $expires );
! return 1;
}
! sub _edit_customize {
}
1;
--- 388,464 ----
return 1 unless ( $page->{active_on} );
! my $active = Class::Date::date([ split /\D/, $page->{active_on} ]);
my $now = Class::Date->now;
! my $expires = Class::Date::date([ split /\D/, $page->{expires_on} ]);
my $R = OpenInteract::Request->instance;
$R->DEBUG && $R->scrib( 1, "Active on: $active; Expires on: $expires" );
! return ( $active <= $now and $now <= $expires );
!
}
! sub _forbidden_message {
! my ( $class, $mail ) = @_;
! return <<FORBID;
! <h2>Access Forbidden</h2>
! <p>You do not have access rights to view this page. Please e-mail the
! administrator at <a href="mailto:$mail">$mail</a> if you feel you have
! received this message in error.</p>
! FORBID
}
+ sub _notfound_message {
+ my ( $class, $location ) = @_;
+ return <<NOTFOUND;
+ <h2>Page Not Found</h2>
+ <p>Could not find page with location you requested
+ (<tt>$location</tt>). Did you mistype the address?</p>
+ NOTFOUND
+ }
1;
+
+ =pod
+
+ =head1 NAME
+
+ =head1 SYNOPSIS
+
+ =head1 DESCRIPTION
+
+ =head2 Error Content-Type Forcing
+
+ We have to force the content-type when returning an error in C<show()>
+ because the user might have requested a file that actually exists in
+ the filesystem and which Apache has already mapped a content-type. You
+ will know when this happens because you will be prompted to d/l the
+ file or a plugin (like Acrobat Reader) will try to display it, but the
+ *actual* content will be plain old HTML...
+
+ =head1 METHODS
+
+ =head1 BUGS
+
+ None known.
+
+ =head1 TO DO
+
+ Nothing known.
+
+ =head1 SEE ALSO
+
+ =head1 COPYRIGHT
+
+ Copyright (c) 2001 intes.net, inc.. All rights reserved.
+
+ This library is free software; you can redistribute it and/or modify
+ it under the same terms as Perl itself.
+
+ =head1 AUTHORS
+
+ Chris Winters <ch...@cw...>
+
+ =cut
|
|
From: Chris W. <la...@us...> - 2001-10-24 20:55:13
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv22563/OpenInteract
Modified Files:
Page.pm
Log Message:
more updates
Index: Page.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Page.pm 2001/10/20 15:11:48 1.1
--- Page.pm 2001/10/24 20:55:11 1.2
***************
*** 59,69 ****
my ( $self ) = @_;
return $self->{content} = ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File->load( $self )
! : OpenInteract::Page::Database->load( $self );
}
########################################
! # RULESET METHODS
########################################
--- 59,69 ----
my ( $self ) = @_;
return $self->{content} = ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File::load( $self )
! : OpenInteract::Page::Database::load( $self );
}
########################################
! # RULES
########################################
***************
*** 73,77 ****
sub ruleset_behavior {
my ( $class, $rs_table ) = @_;
! push @{ $rs_table->{pre_save_action} }, \&find_directory;
return __PACKAGE__;
}
--- 73,79 ----
sub ruleset_behavior {
my ( $class, $rs_table ) = @_;
! push @{ $rs_table->{pre_save_action} }, \&find_directory;
! push @{ $rs_table->{post_save_action} }, \&save_content;
! push @{ $rs_table->{post_remove_action} }, \&remove_content;
return __PACKAGE__;
}
***************
*** 84,87 ****
--- 86,106 ----
}
+
+ sub save_content {
+ my ( $self, $p ) = @_;
+ return 1 unless ( $self->{content} );
+ return ( $self->{is_file} eq 'yes' )
+ ? OpenInteract::Page::File::save( $self )
+ : OpenInteract::Page::Database::save( $self );
+ }
+
+
+ sub remove_content {
+ my ( $self, $p ) = @_;
+ return ( $self->{is_file} eq 'yes' )
+ ? OpenInteract::Page::File::remove( $self )
+ : OpenInteract::Page::Database::remove( $self );
+ }
+
1;
***************
*** 101,105 ****
$page->{location} = '/mysite/home';
$page->{is_file} = 'no';
! $page->{pagetext} = "<h2>Headline</h2><p>This is the text for my page</p>";
$page->{author} = "Scooby Doo";
$page->save;
--- 120,124 ----
$page->{location} = '/mysite/home';
$page->{is_file} = 'no';
! $page->{content} = "<h2>Headline</h2><p>This is the text for my page</p>";
$page->{author} = "Scooby Doo";
$page->save;
***************
*** 116,120 ****
=head1 DESCRIPTION
! This class adds methods to the SPOPS class that represents static pages.
=head1 METHODS
--- 135,141 ----
=head1 DESCRIPTION
! This class adds methods to the SPOPS class that represents static
! pages. Depending on a property in the object, it will save the content
! to the filesystem or in the database.
=head1 METHODS
***************
*** 129,132 ****
--- 150,159 ----
directory.
+ B<content()>
+
+ Retrieve content for this page. Note that we do not make this a
+ B<post_fetch_action> since there are likely times when you want to
+ just deal with the page metadata, not the content.
+
B<object_description()>
***************
*** 140,144 ****
B<pre_save_action>
! Set the C<directory> property from the C<location> property
=head1 BUGS
--- 167,179 ----
B<pre_save_action>
! Set the C<directory> property from the C<location> property.
!
! B<post_save_action>
!
! If there is content, save it to either the db or filesystem.
!
! B<post_remove_action>
!
! Remove content from either the database or filesystem.
=head1 BUGS
|
|
From: Chris W. <la...@us...> - 2001-10-24 20:54:49
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Handler In directory usw-pr-cvs1:/tmp/cvs-serv22392/OpenInteract/Handler Removed Files: BasePage.pm Log Message: removed old handler --- BasePage.pm DELETED --- |
|
From: Chris W. <la...@us...> - 2001-10-24 20:53:58
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/template In directory usw-pr-cvs1:/tmp/cvs-serv22158 Modified Files: page_form.tmpl Log Message: shuffle shuffle Index: page_form.tmpl =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/template/page_form.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** page_form.tmpl 2001/10/20 15:14:30 1.1 --- page_form.tmpl 2001/10/24 20:53:51 1.2 *************** *** 1,4 **** ! [%- DEFAULT theme = OI.theme_properties; ! count = 0 -%] [%- OI.box_add( 'edit_document_box', location = page.location ); --- 1,3 ---- ! [%- DEFAULT theme = OI.theme_properties; count = 0 -%] [%- OI.box_add( 'edit_document_box', location = page.location ); *************** *** 13,18 **** made instantly.</p> ! <form name="page" method="POST" ! action="/Page/edit/"> [% INCLUDE table_bordered_begin( table_width = '90%' ) -%] --- 12,16 ---- made instantly.</p> ! <form name="page" method="POST" action="/Page/edit/"> [% INCLUDE table_bordered_begin( table_width = '90%' ) -%] *************** *** 74,79 **** [%- count = count + 1 -%] ! [% INCLUDE label_form_checkbox_row( label = 'Active?', name = 'is_active', ! value = 'yes', picked = page.is_active ) -%] [%- count = count + 1 -%] --- 72,92 ---- [%- count = count + 1 -%] ! <tr bgcolor="[% PROCESS row_color %]"><td align="center"> ! <table border="0" cellpadding="1"> ! <tr align="center" valign="bottom"> ! <td>[% PROCESS show_label( label = 'Active?') %]</td> ! <td>[% PROCESS show_label( label = 'Store as file?') %]</td> ! <td>[% PROCESS show_label( label = 'Parse as template?') %]</td> ! </tr> ! <tr align="center" valign="middle"> ! <td>[% INCLUDE form_checkbox( name = 'is_active', value = 'yes', ! picked = page.is_active ) %]</td> ! <td>[% INCLUDE form_checkbox( name = 'is_file', value = 'yes', ! picked = page.is_file ) %]</td> ! <td>[% INCLUDE form_checkbox( name = 'template_parse', value = 'yes', ! picked = page.template_parse ) %]</td> ! </tr> ! </table> ! </tr> [%- count = count + 1 -%] *************** *** 83,91 **** [%- count = count + 1 -%] ! [% INCLUDE label_form_submit_row( value = 'Modify' ) -%] [% PROCESS table_bordered_end -%] ! [%- form_hidden( name = 'old_location', value = page.location ) -%] </form> --- 96,104 ---- [%- count = count + 1 -%] ! [% INCLUDE label_form_submit_row( value = 'Modify', reset = 1 ) -%] [% PROCESS table_bordered_end -%] ! [%- PROCESS form_hidden( name = 'old_location', value = page.location ) -%] </form> |
|
From: Chris W. <la...@us...> - 2001-10-24 20:52:04
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/template In directory usw-pr-cvs1:/tmp/cvs-serv21836 Removed Files: static_dir_listing.meta static_dir_listing.tmpl Log Message: remove old template --- static_dir_listing.meta DELETED --- --- static_dir_listing.tmpl DELETED --- |
|
From: Chris W. <la...@us...> - 2001-10-24 19:56:42
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_box/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv7379/OpenInteract/Handler
Modified Files:
Box.pm
Log Message:
allow you to remove boxes
Index: Box.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_box/OpenInteract/Handler/Box.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Box.pm 2001/10/11 03:53:21 1.12
--- Box.pm 2001/10/24 19:56:38 1.13
***************
*** 55,62 ****
# Next, weed out boxes without at least a name and assign
! # class/method or template information as needed
!
! my @good_boxes = ();
BOX:
foreach my $box_info ( @{ $R->{boxes} } ) {
--- 55,66 ----
# Next, weed out boxes without at least a name and assign
! # class/method or template information as needed. Also be able to
! # remove a box from the boxes previously marked as good if someone
! # has asked us NOT to display it. For instance, if an app doesn't
! # want a login box it can do:
! # push @{ $R->{boxes} }, { name => 'login_box', remove => 'yes' };
+ my %good_boxes = ();
+ my @to_remove = ();
BOX:
foreach my $box_info ( @{ $R->{boxes} } ) {
***************
*** 70,73 ****
--- 74,84 ----
}
+ # See if this is a 'remove' request
+
+ if ( $box_info->{remove} ) {
+ push @to_remove, $box_info->{name};
+ next;
+ }
+
unless ( $box_info->{name} ) {
$R->scrib( 0, "Box put into the holding area without a name! Not processed.\n",
***************
*** 116,127 ****
$R->DEBUG && $R->scrib( 1, "Putting box ($box_info->{name}) onto the",
"stack with weight $box_info->{weight}" );
! push @good_boxes, $box_info;
}
! # Now, sort the boxes by weight then name
my @sorted_boxes = sort { $a->{weight} <=> $b->{weight} ||
$a->{name} cmp $b->{name} }
! @good_boxes;
# Grab the template that we'll plug the box content into
--- 127,144 ----
$R->DEBUG && $R->scrib( 1, "Putting box ($box_info->{name}) onto the",
"stack with weight $box_info->{weight}" );
! $good_boxes{ $box_info->{name} } = $box_info;
}
! # Remove the boxes as requested
!
! foreach my $remove_name ( @to_remove ) {
! delete $good_boxes{ $remove_name } if ( $remove_name );
! }
!
! # Sort the boxes by weight then name
my @sorted_boxes = sort { $a->{weight} <=> $b->{weight} ||
$a->{name} cmp $b->{name} }
! values %good_boxes;
# Grab the template that we'll plug the box content into
***************
*** 216,219 ****
--- 233,240 ----
push @{ $R->{boxes} }, $box;
+ # Remove a box added in another part of the system
+
+ push @{ $R->{boxes} }, { name => 'motd', remove => 'yes' };
+
=head1 DESCRIPTION
***************
*** 333,336 ****
--- 354,372 ----
Just used to identify the box.
+
+ =item *
+
+ B<remove> ($) (optional)
+
+ If you use this parameter you are telling the box handler to remove a
+ box with name 'name'. This box does not have to be added by you or in
+ your package -- for instance, you might want to always get rid of the
+ 'user_info' and 'login' boxes that come with OI:
+
+ push @{ $R->{boxes} }, { name => 'user_info_box', remove => 'yes' },
+ { name => 'login_box', remove => 'yes' };
+
+ This does require you to know the name, but that should not be too
+ onerous a burden.
=item *
|
|
From: Chris W. <la...@us...> - 2001-10-24 19:56:41
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_box
In directory usw-pr-cvs1:/tmp/cvs-serv7379
Modified Files:
Changes package.conf
Log Message:
allow you to remove boxes
Index: Changes
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_box/Changes,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Changes 2001/10/18 02:18:24 1.22
--- Changes 2001/10/24 19:56:38 1.23
***************
*** 1,4 ****
--- 1,10 ----
Revision history for OpenInteract package base_box.
+ 0.35 Wed Oct 24 16:03:29 EDT 2001
+
+ You can now specify boxes to be removed as:
+
+ push @{ $R->{boxes} }, { name => 'name', remove => 'yes' }
+
0.34 Wed Oct 17 22:33:05 EDT 2001
Index: package.conf
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_box/package.conf,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** package.conf 2001/10/18 02:18:25 1.21
--- package.conf 2001/10/24 19:56:38 1.22
***************
*** 1,4 ****
name base_box
! version 0.34
author Chris Winters <ch...@cw...>
url http://www.openinteract.org/
--- 1,4 ----
name base_box
! version 0.35
author Chris Winters <ch...@cw...>
url http://www.openinteract.org/
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:36:35
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_error In directory usw-pr-cvs1:/tmp/cvs-serv16783 Modified Files: Changes MANIFEST package.conf Log Message: meta Index: Changes =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/Changes,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Changes 2001/10/24 02:49:19 1.20 --- Changes 2001/10/24 16:36:32 1.21 *************** *** 1,4 **** --- 1,13 ---- Revision history for OpenInteract package base_error. + 1.34 Tue Oct 23 23:20:40 EDT 2001 + + - Transitioned the error display handler to use + OI::CommonHandler, which included rewriting ALL the templates, + and adding several new ones. Also rewrote OI/Handler/Error.pm. + + - Moved error message templates to main template directory + (where the widgets are); + 1.33 Tue Oct 23 23:04:22 EDT 2001 Index: MANIFEST =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/MANIFEST,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MANIFEST 2001/09/06 14:34:06 1.2 --- MANIFEST 2001/10/24 16:36:32 1.3 *************** *** 14,23 **** doc/package.pod doc/titles - template/err_not_found.meta - template/err_not_found.tmpl - template/err_task_forbidden.meta - template/err_task_forbidden.tmpl - template/err_task_no_default.meta - template/err_task_no_default.tmpl template/error_detail.meta template/error_detail.tmpl --- 14,17 ---- *************** *** 28,29 **** --- 22,27 ---- template/error_list.meta template/error_list.tmpl + template/error_search_form.meta + template/error_search_form.tmpl + template/error_search_results.meta + template/error_search_results.tmpl \ No newline at end of file Index: package.conf =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/package.conf,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** package.conf 2001/10/24 02:49:19 1.20 --- package.conf 2001/10/24 16:36:32 1.21 *************** *** 1,4 **** name base_error ! version 1.33 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ --- 1,4 ---- name base_error ! version 1.34 author Chris Winters (ch...@cw...) url http://www.openinteract.org/ |
|
From: Chris W. <la...@us...> - 2001-10-24 16:36:26
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_error/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv16709/OpenInteract
Modified Files:
ErrorObject.pm
Log Message:
cosmetic
Index: ErrorObject.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/OpenInteract/ErrorObject.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ErrorObject.pm 2001/09/06 14:34:54 1.4
--- ErrorObject.pm 2001/10/24 16:36:23 1.5
***************
*** 14,18 ****
my $DEFAULT_TYPE = 'n/a';
! #
# Routines to manipulate the list of errors during a request
#
--- 14,18 ----
my $DEFAULT_TYPE = 'n/a';
! #
# Routines to manipulate the list of errors during a request
#
***************
*** 42,47 ****
! # Called when we do: OpenInteract::ErrorObject->new()
! # (see SPOPS->new() for more info and how ->initialize()
# is called)
--- 42,47 ----
! # Called when we do: OpenInteract::ErrorObject->new()
! # (see SPOPS->new() for more info and how ->initialize()
# is called)
***************
*** 66,72 ****
my $extra_info = undef;
foreach my $key ( keys %{ $p->{extra} } ) {
! $R->DEBUG && $R->scrib( 1, "Set (tmp_$key) to $p->{extra}->{ $key }" );
! $self->{ "tmp_$key" } = $p->{extra}->{ $key };
! $extra_info .= $p->{extra}->{ $key } . "<br>\n";
}
--- 66,72 ----
my $extra_info = undef;
foreach my $key ( keys %{ $p->{extra} } ) {
! $R->DEBUG && $R->scrib( 1, "Set (tmp_$key) to $p->{extra}{ $key }" );
! $self->{ "tmp_$key" } = $p->{extra}{ $key };
! $extra_info .= $p->{extra}{ $key } . "<br>\n";
}
***************
*** 87,91 ****
# Get the action from $R if not already set
! $p->{action} ||= $R->{current_context}->{action} || $DEFAULT_ACTION;
# Give a default type if not set
--- 87,91 ----
# Get the action from $R if not already set
! $p->{action} ||= $R->{current_context}{action} || $DEFAULT_ACTION;
# Give a default type if not set
***************
*** 113,119 ****
# Set meta information
! $self->{action} ||= $R->{current_context}->{action};
! $self->{user_id} = $R->{auth}->{user}->id if ( ref $R->{auth}->{user} );
! $self->{session_id} = $R->{session}->{_session_id} if ( ref $R->{session} );
$self->{browser} = $head_in->{'User-Agent'};
$self->{error_time} = SPOPS::Utility->now;
--- 113,119 ----
# Set meta information
! $self->{action} ||= $R->{current_context}{action};
! $self->{user_id} = $R->{auth}{user}->id if ( ref $R->{auth}{user} );
! $self->{session_id} = $R->{session}{_session_id} if ( ref $R->{session} );
$self->{browser} = $head_in->{'User-Agent'};
$self->{error_time} = SPOPS::Utility->now;
***************
*** 166,183 ****
Messages
- ========
- User
========
$user_msg
========
! System
! ========
$sys_msg
STRING
! if ( $opt->{html} ) {
! $string =~ s/\n/<br>\n/g;
! }
return $string;
}
--- 166,179 ----
Messages
========
+ User
$user_msg
========
! System
$sys_msg
STRING
! $string =~ s/\n/<br>\n/g if ( $opt->{html} );
return $string;
}
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:35:52
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_error/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv16508/OpenInteract/Handler
Modified Files:
Error.pm
Log Message:
rewrite entirely the handler to display and manipulate errors, to work with OI::CommonHandler
Index: Error.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/OpenInteract/Handler/Error.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Error.pm 2001/10/24 02:49:19 1.10
--- Error.pm 2001/10/24 16:35:49 1.11
***************
*** 4,11 ****
use strict;
use SPOPS::Secure qw( :level );
use Text::Wrap qw();
! @OpenInteract::Handler::Error::ISA = qw( OpenInteract::Handler::GenericDispatcher SPOPS::Secure );
$OpenInteract::Handler::Error::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
--- 4,13 ----
use strict;
+ use OpenInteract::CommonHandler;
+ use OpenInteract::Handler::GenericDispatcher qw( DEFAULT_SECURITY_KEY );
use SPOPS::Secure qw( :level );
use Text::Wrap qw();
! @OpenInteract::Handler::Error::ISA = qw( OpenInteract::CommonHandler SPOPS::Secure );
$OpenInteract::Handler::Error::VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
***************
*** 14,243 ****
@OpenInteract::Handler::Error::forbidden_methods = ();
%OpenInteract::Handler::Error::security = (
! listing => SEC_LEVEL_READ,
! show => SEC_LEVEL_READ,
! remove => SEC_LEVEL_WRITE,
! notify => SEC_LEVEL_READ,
! );
- use constant MAIN_SCRIPT => '/Error';
! sub listing {
! my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
my $apr = $R->apache;
-
- # See if we were passed any sort directives
-
my $order = $apr->param( 'sort' ) || 'error_time';
! my $db_order = ( $order eq 'error_time' ) ? 'error_time DESC' : $order;
!
! # See if we were passed any filtering directives -- if so process
! # them so we can determine which error objects to display
!
! my $where = undef;
! my @value = ();
! my %filter = ();
!
! # See if they asked for a particular code
!
! if ( my $filter_code = $apr->param( 'filter_code' ) ) {
! $filter{code} = $filter_code;
! $where = ' AND code = ?';
! push @value, $filter_code;
! }
!
! # See if they asked for a particular type
!
! if ( my $filter_type = $apr->param( 'filter_type' ) ) {
! $filter{type} = $filter_type;
! $where = ' AND type = ?';
! push @value, $filter_type;
! }
! # Figure out the date stuff
! if ( my $filter_from_year = $apr->param( 'filter_date_from_year' ) ) {
! my $from_date = $class->date_read( 'filter_date_from' );
! ( $filter{from_year}, $filter{from_month}, $filter{from_day} ) = split /\-/, $from_date;
! $where .= ' AND error_time > ?';
! push @value, $from_date;
}
! if ( my $filter_to_year = $apr->param( 'filter_date_to_year' ) ) {
! my $to_date = $class->date_read( 'filter_date_to' );
! ( $filter{to_year}, $filter{to_month}, $filter{to_day} ) = split /\-/, $to_date;
! $where .= ' AND error_time < ?';
! push @value, $to_date;
}
- $where =~ s/^ AND //;
! my $params = { main_script => MAIN_SCRIPT,
! sort => $order,
! filterby => \%filter,
! error_msg => $p->{error_msg} };
!
! # Now actually retrieve the errors
!
! $params->{error_iterator} = eval { $R->error_object->fetch_iterator({
! order => $db_order,
! where => $where,
! value => \@value }) };
! if ( $@ ) {
! OpenInteract::Error->set( SPOPS::Error->get );
! $OpenInteract::Error::user_msg = 'Cannot retrieve list of errors.';
! $R->throw( { code => 403 } );
! $params->{error_msg} .= "Error retrieving list of errors $OpenInteract::Error::system_msg";
! }
- # Set the template and title and we're done.
! $R->{page}->{title} = 'Listing of Errors';
! return $R->template->handler( {}, $params,
! { db => 'error_list',
! package => 'base_error' } );
}
- sub show {
- my ( $class, $p ) = @_;
- my $params = { main_script => MAIN_SCRIPT };
- my $R = OpenInteract::Request->instance;
- my $error = $p->{error};
- $error ||= eval { $R->error_object->fetch( $R->apache->param( 'error_id' ) ) };
- if ( $@ ) {
- my $ei = SPOPS::Error->get;
- if ( $ei->{type} ne 'security' ) {
- $R->throw( { code => 404 } );
- $params->{error_msg} = "Could not retrieve Error object. Error logged.";
- }
- else {
- $params->{error_msg} = "You do not have permission to view this error object.";
- }
- }
! # Grab the user here since sometimes the user might be 'superuser'
! # who cannot be seen by mere mortals. This throws an error if you
! # do in the template [% error_user = err.user %] and rather than a
! # TRY/CATCH block we'll just do it here.
!
! $params->{error_user} = eval { $error->user };
! local $Text::Wrap::columns = 60;
! $error->{system_msg} = Text::Wrap::wrap( '', '', $error->{system_msg} );
! $error->{user_msg} = Text::Wrap::wrap( '', '', $error->{user_msg} );
! $R->{page}->{title} = 'Detail of Error';
! $params->{err} = $error;
! return $R->template->handler( {}, $params,
! { db => 'error_detail',
! package => 'base_error' } );
}
sub remove {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
my @error_id = $R->apache->param( 'error_id' );
my ( @error_items );
foreach my $eid ( @error_id ) {
$R->DEBUG && $R->scrib( 1, "Removing error: $eid" );
my $error = eval { $R->error_object->fetch( $eid ); };
if ( $@ or ! $error ) {
! push @error_items, "Could not retrieve error $eid to remove: $SPOPS::Error::system_msg" if ( $@ );
! push @error_items, "Error $eid apparently does not exist, so it was not removed." if ( ! $@ );;
next;
}
! eval { $error->remove; };
! push @error_items, SPOPS::Error->get if ( $@ );
! }
! $p->{error_msg} = join "\n\n", map { $_->{system_msg} } @error_items if ( scalar @error_items );
! return $class->listing( $p );
! }
!
!
! sub notify {
! my ( $class ) = @_;
! my $R = OpenInteract::Request->instance;
! my @error_id = $R->apache->param( 'error_id' );
! my $email = $R->apache->param( 'email' );
! if ( ! $email or ! scalar @error_id ) {
! return '<h2 align="center">Error</h2>' .
! '<p>Error: Cannot notify anyone about an object when no ID/email is given.</p>';
! }
! my @error_list = ();
! foreach my $eid ( @error_id ) {
! my $error = eval { $R->error_object->fetch( $eid ) };
! push @error_list, $error if ( $error );
! }
! if ( $R->error_object->notify({ email => $email,
! subject => 'Error object notification',
! object => \@error_list,
! type => 'error' } ) ) {
! return '<h2 align="center">Success!</h2>' .
! '<p>Notification sent properly!</p>';
}
! return '<h2 align="center">Error</h2>' .
! '<p>Error sending email. Please check error logs!</p>';
}
1;
-
- __END__
-
- =pod
-
- =head1 NAME
-
- OpenInteract::Handler::Error - Browse the error logs
-
- =head1 SYNOPSIS
-
- =head1 DESCRIPTION
-
- This module has four simple handlers to deal with error messages
- currently logged:
-
- =over 4
-
- =item *
-
- B<list>: Display all messages, or those that fit the filter
-
- =item *
-
- B<show>: Display detail regarding a particular message
-
- =item *
-
- B<remove>: Delete one or more messages from the system
-
- =item *
-
- B<notify>: Send via email one or more messages
-
- =back
-
- =head1 TO DO
-
- B<Page?>
-
- Should we page results?
-
- B<Change initial page?>
-
- Should the initial page be just the filter component so people can
- browse by date without seeing ALL the errors?
-
- =head1 BUGS
-
- =head1 COPYRIGHT
-
- Copyright (c) 2001 intes.net, inc.. All rights reserved.
-
- This library is free software; you can redistribute it and/or modify
- it under the same terms as Perl itself.
-
- =head1 AUTHORS
-
- Chris Winters <ch...@cw...>
-
- =cut
--- 16,118 ----
@OpenInteract::Handler::Error::forbidden_methods = ();
%OpenInteract::Handler::Error::security = (
! DEFAULT_SECURITY_KEY() => SEC_LEVEL_READ, remove => SEC_LEVEL_WRITE );
! sub MY_PACKAGE { return 'base_error' }
! sub MY_HANDLER_PATH { return '/Error' }
! sub MY_OBJECT_TYPE { return 'error' }
! sub MY_OBJECT_CLASS { return OpenInteract::Request->instance->error }
! sub MY_SEARCH_FIELDS { return qw( code type) }
! sub MY_SEARCH_FORM_TITLE { return 'Search for Errors' }
! sub MY_SEARCH_FORM_TEMPLATE { return 'error_search_form' }
! sub MY_SEARCH_RESULTS_TITLE { return 'Error Search Results' }
! sub MY_SEARCH_RESULTS_TEMPLATE { return 'error_search_results' }
! sub MY_OBJECT_FORM_TITLE { return 'Error Detail' }
! sub MY_OBJECT_FORM_TEMPLATE { return 'error_detail' }
! sub MY_ALLOW_SEARCH_FORM { return 1 }
! sub MY_ALLOW_SEARCH { return 1 }
! sub MY_ALLOW_SHOW { return 1 }
! sub MY_ALLOW_REMOVE { return 1 }
! sub MY_ALLOW_NOTIFY { return 1 }
!
! sub MY_SEARCH_RESULTS_ORDER {
my $R = OpenInteract::Request->instance;
my $apr = $R->apache;
my $order = $apr->param( 'sort' ) || 'error_time';
! return ( $order eq 'error_time' ) ? 'error_time DESC' : $order;
! }
! sub _search_build_where_customize {
! my ( $class, $from, $where, $value ) = @_;
! my $R = OpenInteract::Request->instance;
! my $apr = $R->apache;
! if ( my $from_date = $class->_read_field_date( 'filter_date_from' ) ) {
! push @{ $where }, 'error_time >= ?';
! push @{ $value }, $from_date;
}
! if ( my $to_date = $class->_read_field_date( 'filter_date_to' ) ) {
! push @{ $where }, 'error_time <= ?';
! push @{ $value }, $to_date;
}
! }
! sub _search_customize {
! my ( $class, $params ) = @_;
! my $apr = OpenInteract::Request->instance->apache;
! my %filter = (
! sort => $apr->param( 'sort' ),
! code => $apr->param( 'code' ),
! type => $apr->param( 'type' ),
! date_from => $class->_read_field_date_object( 'filter_date_from' ),
! date_to => $class->_read_field_date_object( 'filter_date_to' ),
! );
! $params->{filterby} = \%filter;
}
! # Grab the user here since sometimes the user might be 'superuser'
! # who cannot be seen by mere mortals. This throws an error if you
! # do in the template [% error_user = err.user %] and rather than a
! # TRY/CATCH block we'll just do it here.
! sub _show_customize {
! my ( $class, $params ) = @_;
! $params->{error_user} = eval { $params->{error}->user };
}
+ # Override 'remove()' so we can delete multiple objects at once
sub remove {
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
+ unless ( $class->MY_ALLOW_REMOVE ) {
+ $R->scrib( 0, "User tried to remove error object - not allowed." );
+ return '<h2>Error</h2><p>Removal of error objects has been disallowed.</p>';
+ }
+
my @error_id = $R->apache->param( 'error_id' );
my ( @error_items );
+ my $success = 0;
foreach my $eid ( @error_id ) {
$R->DEBUG && $R->scrib( 1, "Removing error: $eid" );
my $error = eval { $R->error_object->fetch( $eid ); };
if ( $@ or ! $error ) {
! push @error_items, "Could not retrieve error ($eid) to remove: $SPOPS::Error::system_msg" if ( $@ );
! push @error_items, "Error ($eid) apparently does not exist, so it was not removed." if ( ! $@ );;
next;
}
! eval { $error->remove };
! if ( $@ ) { push @error_items, SPOPS::Error->get }
! else { $success++ }
}
! $p->{error_msg} = join "\n\n", map { $_->{system_msg} } @error_items if ( scalar @error_items );
! $p->{status_msg} = "$success objects removed successfully";
! return $class->search_form( $p );
}
1;
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:35:20
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_error/template
In directory usw-pr-cvs1:/tmp/cvs-serv16308/template
Modified Files:
error_detail.tmpl error_filter.meta error_filter.tmpl
error_list.tmpl
Log Message:
update templates for the CommonHandler conversion
Index: error_detail.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/template/error_detail.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** error_detail.tmpl 2001/09/06 15:10:41 1.5
--- error_detail.tmpl 2001/10/24 16:35:17 1.6
***************
*** 1,133 ****
! [%- th = OI.theme_properties -%]
! [% OI.comp( 'showerror', error_msg = error_msg ) %]
<div align="center">
! <p><a href="[% main_script %]/listing/">Back to list</a></p>
! <h1 align="center">Error Detail</h1>
! <table border="0" width="75%">
! <tr><td>
! <p>Below is the detail for an error that occurred. Please contact the
administrator if you have any ideas as to what else <b>should</b> be
in such an entry.</p>
- </td></tr>
- </table>
-
- <table border="0" bgcolor="#000000" cellpadding="2" cellspacing="0" width="75%">
- <tr><td>
! <table border="0" cellpadding="3" cellspacing="0" width="100%">
!
! <tr valign="middle" bgcolor="[% th.head_bgcolor %]" align="center">
! <td colspan="2"><font color="[% th.head_font_color %]">
! <b>Information about Error <tt>[% err.error_id %]</tt></b>
! </font></td>
! </tr>
!
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>Date</b></td>
! <td>[% err.error_time %]
! </td>
! </tr>
!
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>Code</b></td>
! <td>[% err.code %]
! </td>
! </tr>
!
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>Type</b></td>
! <td>[% err.type %]
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>System Message</b></td>
! <td><font size="-1"><pre>[% err.system_msg %]</pre></font>
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>User Message</b></td>
! <td><font size="-1"><pre>[% err.user_msg %]</pre></font>
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>Calling Info</b></td>
! <td align="left">
! <table border="0" cellpadding="2" cellspacing="0">
! <tr>
! <td align="right"><font size="-1"><b>File</b></font></td>
! <td><font size="-1">[% err.filename %]</font></td>
! </tr>
! <tr>
! <td align="right"><font size="-1"><b>Package</b></font></td>
! <td><font size="-1">[% err.package %]</font></td>
! </tr>
! <tr>
! <td align="right"><font size="-1"><b>Line #</b></font></td>
! <td><font size="-1">[% err.line %]</font></td>
! </tr>
! <tr>
! <td align="right"><font size="-1"><b>Action</b></font></td>
! <td><font size="-1">[% err.action %]</font></td>
! </tr>
! </table>
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>User</b></td>
! <td>
! [%- IF error_user %]<a href="/User/show/?user_id=[% user.user_id %]">[% user.login_name %]</a>
! [%- ELSE %](no user tracked)[% END -%]
</td>
</tr>
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>Session</b></td>
! <td>
! [%- IF err.session_id %][% err.session_id %][% ELSE %](no session tracked)[% END -%]
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>URL</b></td>
! <td>[% err.url %]
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>Browser</b></td>
! <td>[% err.browser %]
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.even_color %]">
! <td align="right"><b>Referer</b></td>
! <td>[% IF err.referer %]<a href="[% err.referer %]">[% err.referer %]</a>[% ELSE %](none recorded)[% END %]
! </td>
! </tr>
! <tr valign="top" bgcolor="[% th.odd_color %]">
! <td align="right"><b>Notes</b></td>
! <td>[% err.notes %]
! </td>
! </tr>
! <tr bgcolor="[% th.head_bgcolor %]">
! <td colspan="2"> </td>
! </tr>
! </table>
! </td></tr>
! </table>
</div>
--- 1,72 ----
! [%- DEFAULT theme = OI.theme_properties -%]
! [%- PROCESS error_message -%]
<div align="center">
! <p align="right"><a href="/Error/search_form/">Back to search form</a></p>
! <h1>Error Detail</h1>
! <p align="left">Below is the detail for an error that occurred. Please contact the
administrator if you have any ideas as to what else <b>should</b> be
in such an entry.</p>
! [%- INCLUDE table_bordered_begin -%]
! [%- count = 0;
! valign = 'top' -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Date', text = err.error_time ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Code', text = err.code ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Type', text = err.type ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'System Message', text = "<pre>$err.system_msg</pre>" ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'User Message', text = "<pre>$err.user_msg</pre>" ) -%]
! [%- count = count + 1 -%]
! [%- INCLUDE label_row_begin( label = 'Calling Info' ) -%]
! <td align="left">
! <table border="0" cellpadding="1" cellspacing="0">
! [% INCLUDE label_text_row( label = 'File', text = err.filename ) %]
! [% INCLUDE label_text_row( label = 'Package', text = err.package ) %]
! [% INCLUDE label_text_row( label = 'Line #', text = err.line ) %]
! [% INCLUDE label_text_row( label = 'Action', text = err.action ) %]
! </table>
</td>
</tr>
! [% IF error_user %]
! [%- user_view_url = OI.make_url( base = '/User/show/', user_id = error_user.user_id );
! user_text = "<a href='$user_view_url'>$error_user.login_name</a>"; -%]
! [% ELSE -%]
! [%- user_text = '(no user tracked)' -%]
! [% END -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'User', text = user_text ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Session', text = err.session_id || '(no session tracked)' ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'URL', text = err.url ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Browser', text = err.browser ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Referer', text = err.referer ) -%]
! [%- count = count + 1 -%]
! [% INCLUDE label_text_row( label = 'Notes', text = err.notes ) -%]
! [% PROCESS table_bordered_end -%]
</div>
Index: error_filter.meta
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/template/error_filter.meta,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** error_filter.meta 2001/02/02 06:19:51 1.1.1.1
--- error_filter.meta 2001/10/24 16:35:17 1.2
***************
*** 1,8 ****
name: error_filter
! title: Component for sorting, filtering error objects
package: base_error
! Parameters:
!
! --sort: radio button selected pressed for sort
! --filterby: hashref of filtering options
! --main_script
--- 1,4 ----
name: error_filter
! title: Error filtering form criteria
package: base_error
! Standalone component for sorting, filtering error objects
\ No newline at end of file
Index: error_filter.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/template/error_filter.tmpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** error_filter.tmpl 2001/08/13 16:10:14 1.2
--- error_filter.tmpl 2001/10/24 16:35:17 1.3
***************
*** 1,21 ****
! <form name="error_filter" action="[% main_script %]/listing/"
! method="get">
!
! <table border="0" bgcolor="#000000" cellpadding="2" cellspacing="0">
! <tr><td>
! <table border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="#eeeeee">
<tr bgcolor="#cccccc">
! <td align="center" colspan="2"><font size="-1"><b>Sort by</b></font></td>
</tr>
<tr>
! <td align="center" colspan="2">
! <font size="-1">
! <input type="radio" name="sort" value="error_time"[% IF sort == 'error_time' %]checked[% END %]> Date
! <input type="radio" name="sort" value="code"[% IF sort == 'code' %]checked[% END %]> Code
! <input type="radio" name="sort" value="type"[% IF sort == 'type' %]checked[% END %]> Type
! </font>
! </td>
</tr>
--- 1,18 ----
! <form name="error_filter" method="GET"
! action="/Error/listing/">
! [% INCLUDE table_bordered_begin -%]
<tr bgcolor="#cccccc">
! <td align="center" colspan="2"><font size="-1">
! <b>Sort by</b>
! </font></td>
</tr>
<tr>
! <td align="center" colspan="2"><font size="-1">
! [% INCLUDE form_radio( name = 'sort', value = 'error_time', picked = sort ) %] Date
! [% INCLUDE form_radio( name = 'sort', value = 'code', picked = sort ) %] Code
! [% INCLUDE form_radio( name = 'sort', value = 'type', picked = sort ) %] Type
! </font></td>
</tr>
***************
*** 26,57 ****
<td><font size="-1">Date</font></td>
<td><font size="-1">
! <tt>Fr: </tt>
! [% OI.comp( 'date_select', month_value = filterby.from_month,
! day_value = filterby.from_day,
! year_value = filterby.from_year, blank = 1,
field_prefix = 'filter_date_from' ) %]<br>
! <tt>To: </tt>
! [% OI.comp( 'date_select', month_value = filterby.to_month,
! day_value = filterby.to_day,
! year_value = filterby.to_year, blank = 1,
field_prefix = 'filter_date_to' ) %]
! </font>
! </td>
</tr>
<tr valign="middle">
<td><font size="-1">Code</font></td>
! <td><font size="-1"><input type="text" size="12" name="filter_code" value="[% filterby.code %]"></font></td>
</tr>
<tr valign="middle">
<td><font size="-1">Type</font></td>
! <td><font size="-1"><input type="text" size="12" name="filter_type" value="[% filterby.type %]"></td>
</tr>
<tr bgcolor="#cccccc">
! <td colspan="2" align="right"><input type="submit" value="Filter"></td>
</tr>
- </table>
! </td></tr>
! </table>
</form>
--- 23,51 ----
<td><font size="-1">Date</font></td>
<td><font size="-1">
! <tt>From: </tt>
! [% INCLUDE date_select( object = filterby.date_from, blank = 1,
field_prefix = 'filter_date_from' ) %]<br>
! <tt>To: </tt>
! [% INCLUDE date_select( object = filterby.date_to, blank = 1,
field_prefix = 'filter_date_to' ) %]
! </font></td>
</tr>
<tr valign="middle">
<td><font size="-1">Code</font></td>
! <td><font size="-1">[% INCLUDE form_text( name = 'filter_code', size = '12',
! value = filterby.code ) %]</font></td>
</tr>
<tr valign="middle">
<td><font size="-1">Type</font></td>
! <td><font size="-1">[% INCLUDE form_text( name = 'filter_type', size = '12',
! value = filterby.type ) %]</font></td>
</tr>
<tr bgcolor="#cccccc">
! <td colspan="2" align="right"><font size="-1">
! [% INCLUDE form_submit( value = 'Filter', reset = 1 ) %]
! </font></td>
</tr>
! [% PROCESS table_bordered_end -%]
</form>
Index: error_list.tmpl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_error/template/error_list.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** error_list.tmpl 2001/08/13 16:10:14 1.5
--- error_list.tmpl 2001/10/24 16:35:17 1.6
***************
*** 1,39 ****
! [%- th = OI.theme_properties -%]
! [%- OI.comp( 'showerror', error_msg = error_msg ) -%]
!
! <div align="center">
!
! <h2>Browse the Error Log</h2>
!
! [%- OI.comp( 'error_filter', sort = sort, main_script = main_script,
! filterby = filterby ) -%]
!
! <form name="error_action" method="post" action="[% main_script %]/remove/">
! <table border="0" bgcolor="#000000" width="75%"
! cellpadding="2" cellspacing="0">
! <tr><td>
! [%- font_header = 'size="+1" color="$th.head_font_color"' -%]
! <table border="0" width="100%"
! cellpadding="3" cellspacing="0" >
! <tr bgcolor="[% th.head_bgcolor %]" align="center" valign="bottom">
! <td><b><font [% font_header %]>ID</font></b></td>
! <td><b><font [% font_header %]>Date</font></b></td>
! <td><b><font [% font_header %]>Code</font></b></td>
! <td><b><font [% font_header %]>Type</font></b></td>
! <td><b><font [% font_header %]>Message</font></b></td>
! <td><b><font [% font_header %]>Actions</font></b></td>
! </tr>
! [%- count = 0 -%]
! [% WHILE ( item = error_iterator.get_next ) -%]
! [%- SET row_color = th.odd_color -%]
! [%- SET row_color = th.even_color IF count mod 2 == 0 -%]
! <tr bgcolor="[% row_color %]">
! <td>
! <font size="-1">
! <tt><a href="[% main_script %]/show/?error_id=[% item.error_id %]">[% item.error_id %]</a></tt>
! </font>
! </td>
<td><font size="-1">[% item.error_time %]</font></td>
<td align="center"><font size="-1">[% item.code %]</font></td>
--- 1,15 ----
! [%########################################
! MACROS
! ########################################-%]
! [%# NOTE: We use 'item' here because 'error' is or is likely to be a
! reserved word.-%]
! [% MACRO error_row BLOCK -%]
! [%- view_url = OI.make_url( base = '/Error/show/', error_id = item.error_id ) -%]
! <tr bgcolor="[% PROCESS row_color %]">
! <td><font size="-1"><tt>
! <a href="[% view_url %]">[% item.error_id %]</a>
! </tt></font></td>
<td><font size="-1">[% item.error_time %]</font></td>
<td align="center"><font size="-1">[% item.code %]</font></td>
***************
*** 43,74 ****
<a href="javascript:notify( '[% item.error_id %]' )">Notify</a><br>
<a href="javascript:confirm_remove( '[% item.error_id %]' )">Remove</a><br>
! Tag: <input type="checkbox" name="error_id" value="[% item.error_id %]">
</tr>
- [%- count = count + 1 -%]
- [% END %]
! <tr bgcolor="#ffffff">
! <td colspan="6" align="right"><font size="-1">
! <input type="button" value="Remove Tagged" onClick="submit_it( 'remove' )"><br>
! <input type="button" value="Notify Tagged" onClick="submit_it( 'notify' )"><br>
! <input type="button" value="Select All Toggle" onClick="tag_all()">
! </font></td>
! </tr>
- <tr bgcolor="[% th.head_bgcolor %]">
- <td colspan="6"> </td>
- </tr>
! </table>
! </td></tr>
! </table>
! <input type="hidden" name="email" value="">
! </form>
! </div>
<script lanaguage="Javascript">
--- 19,51 ----
<a href="javascript:notify( '[% item.error_id %]' )">Notify</a><br>
<a href="javascript:confirm_remove( '[% item.error_id %]' )">Remove</a><br>
! [% IF is_form -%]
! Tag: [% INCLUDE form_checkbox( name = 'error_id', value = item.error_id ) %]
! [% END -%]
! </td>
</tr>
! [% END -%]
! [%########################################
! DISPLAY
! ########################################-%]
! [% INCLUDE table_bordered_begin -%]
! [% INCLUDE header_row( labels = [ 'ID', 'Date', 'Code', 'Type', 'Message', 'Actions' ] ) -%]
! [%- count = 0 -%]
! [% WHILE ( item = error_iterator.get_next ) -%]
! [% error_row() -%]
! [%- count = count + 1 -%]
! [% END %]
! [% PROCESS table_bordered_end -%]
!
+ [%########################################
+ JAVASCRIPT
+ ########################################-%]
<script lanaguage="Javascript">
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:35:02
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_error/template
In directory usw-pr-cvs1:/tmp/cvs-serv16116/template
Added Files:
error_search_form.meta error_search_form.tmpl
error_search_results.meta error_search_results.tmpl
Log Message:
add new templates for the CommonHandler conversion
--- NEW FILE: error_search_form.meta ---
name: error_search_form
title: Search form for filtering errors
package: base_error
Search form for filtering errors
--- NEW FILE: error_search_form.tmpl ---
[%- DEFAULT theme = OI.theme_properties -%]
[%- PROCESS error_message -%]
[%- PROCESS status_message -%]
<div align="center">
<h2>Search Error Log</h2>
<p align="left">Enter criteria below to search the error log. The more
criteria you enter, the more restrictive your search and the fewer
results you will retrieve.</p>
[% PROCESS base_error::error_filter -%]
</div>
--- NEW FILE: error_search_results.meta ---
name: error_search_results
title: Show errors matching criteria
package: base_error
Display matching errors using the error_list template
--- NEW FILE: error_search_results.tmpl ---
[%- DEFAULT theme = OI.theme_properties;
DEFAULT table_width = '90%'; -%]
[%- PROCESS error_message -%]
[%- PROCESS status_message -%]
<div align="center">
<h2>Browse the Error Log</h2>
[%- INCLUDE base_error::error_filter -%]
<form name="error_action" method="POST" action="/Error/remove/">
[% IF iterator AND iterator.has_next -%]
<p>Following are the errors that match your criteria.</p>
[% PROCESS base_error::error_list( is_form = 1 ) -%]
<table border="0" cellpadding="2" cellspacing="0" width="[% table_width %]">
<tr bgcolor="[% theme.bgcolor %]">
<td colspan="6" align="right"><font size="-1">
<input type="button" value="Remove Tagged" onClick="submit_it( 'remove' )"><br>
<input type="button" value="Notify Tagged" onClick="submit_it( 'notify' )"><br>
<input type="button" value="Select All Toggle" onClick="tag_all()">
</font></td>
</tr>
</table>
<input type="hidden" name="email" value="">
</form>
[% ELSE -%]
<p align="left">No errors matching your criteria are currently in the
system.</p>
[% END -%]
</div>
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:22:23
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv11887
Modified Files:
CommonHandler.pm
Log Message:
added tons of docs, added 'notify()' task; added 'create()' task which
wraps around 'show()'
Index: CommonHandler.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/CommonHandler.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** CommonHandler.pm 2001/10/20 15:17:00 1.25
--- CommonHandler.pm 2001/10/24 16:22:20 1.26
***************
*** 25,34 ****
sub search_form {
my ( $class, $p ) = @_;
unless ( $class->MY_ALLOW_SEARCH_FORM ) {
return '<h1>Error</h1><p>Objects of this type cannot be searched.</p>';
}
$p ||= {};
- my $R = OpenInteract::Request->instance;
my %params = %{ $p };
$R->{page}{title} = $class->MY_SEARCH_FORM_TITLE;
[...1930 lines suppressed...]
! which it returns. This is probably the method you will most often
! override, depending on how you present dates to your users.
=head1 BUGS
***************
*** 1541,1553 ****
=head1 TO DO
-
- B<Finish documenting>
-
- Document customization methods and give examples.
-
- B<Add simple listing>
-
- Add an optional 'listing' method which allows you to just list all
- objects of a particular type.
B<GenericDispatcher items available thru methods>
--- 1905,1908 ----
|
|
From: Chris W. <la...@us...> - 2001-10-24 16:21:36
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv11689
Modified Files:
Auth.pm
Log Message:
added 'is_admin()' method so we can determine once if a user is an
administrator and then use that throughout the request
Index: Auth.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Auth.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Auth.pm 2001/10/11 03:55:39 1.10
--- Auth.pm 2001/10/24 16:21:33 1.11
***************
*** 17,20 ****
--- 17,22 ----
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
+ my $apr = $R->apache;
+
if ( my $uid = $R->{session}{user_id} ) {
$R->DEBUG && $R->scrib( 1, "Found session and uid ($uid); creating user." );
***************
*** 82,88 ****
}
! my $login_name = $R->apache->param( $login_field );
unless ( $login_name ) {
! $R->{auth}{user} = $class->create_nologin_user();
return undef;
}
--- 84,91 ----
}
! my $login_name = $apr->param( $login_field );
unless ( $login_name ) {
! $R->DEBUG && $R->scrib( 1, "Creating the not-logged-in user." );
! $R->{auth}{user} = $class->create_nologin_user;
return undef;
}
***************
*** 98,102 ****
$R->scrib( 0, "User with login ($login_name) not found. Throwing auth error" );
$R->throw({ code => 401,
! type => 'authenticate',
extra => { login_name => $login_name } });
return undef;
--- 101,105 ----
$R->scrib( 0, "User with login ($login_name) not found. Throwing auth error" );
$R->throw({ code => 401,
! type => 'authenticate',
extra => { login_name => $login_name } });
return undef;
***************
*** 173,176 ****
--- 176,203 ----
}
+
+ sub is_admin {
+ my ( $class ) = @_;
+ my $R = OpenInteract::Request->instance;
+
+ return unless ( $R->{auth}{logged_in} );
+ return unless ( ref $R->{auth}{group} eq 'ARRAY' );
+
+ my $CONFIG = $R->CONFIG;
+
+ if ( $R->{auth}{user}->id eq $CONFIG->{default_objects}{superuser} ) {
+ return $R->{auth}{is_admin}++;
+ }
+
+ my $site_admin_id = $CONFIG->{default_objects}{site_admin_group};
+ my $supergroup_id = $CONFIG->{default_objects}{supergroup};
+ foreach my $group ( @{ $R->{auth}{group} } ) {
+ my $group_id = $group->id;
+ if ( $group_id eq $site_admin_id or $group_id eq $supergroup_id ) {
+ return $R->{auth}{is_admin}++ ;
+ }
+ }
+ }
+
1;
***************
*** 194,202 ****
OpenInteract::Auth->group;
=head1 DESCRIPTION
! This class is responsible for authenticating users to the system. It
! does this in one of two ways:
=over 4
--- 221,238 ----
OpenInteract::Auth->group;
+ # See whether this user is an administrator
+
+ OpenInteract::Auth->is_admin;
+
=head1 DESCRIPTION
! This class/interface is responsible for authenticating users to the
! system and other authentication checks. If you have custom
! authentication needs you can specify your class in the server
! configuration and create your own or subclass this class and use
! pieces of it as needed.
+ This class tries to create a user in one of two ways:
+
=over 4
***************
*** 280,283 ****
--- 316,338 ----
$R->{auth}{group}
+ B<create_nologin_user()>
+
+ If a user is not logged in, we create transient user object so that
+ $R->{auth}{user} has something in it. It is not a valid user and it
+ gets created anew with every request where the user is not logged in.
+
+ If you want to rename the login_name, first/last name, etc, just
+ subclass this class, create your own method, then specify your class
+ in the server configuration.
+
+ B<is_admin()>
+
+ Looks at the user and groups and determines whether the user is an
+ administrator. If the user is an administrator, then:
+
+ $R->{auth}{is_admin}
+
+ is set to a true value.
+
=head1 TO DO
***************
*** 295,301 ****
=head1 SEE ALSO
! L<OpenInteract::User>
! L<OpenInteract::Group>
=head1 COPYRIGHT
--- 350,356 ----
=head1 SEE ALSO
! L<OpenInteract::User|OpenInteract::User>
! L<OpenInteract::Group|OpenInteract::Group>
=head1 COPYRIGHT
|