From: Chris W. <la...@us...> - 2004-11-30 02:11:38
|
Update of /cvsroot/openinteract/OpenInteract2/doc/Manual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3057/Manual Modified Files: SPOPS.pod Log Message: inline SPOPS examples Index: SPOPS.pod =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/doc/Manual/SPOPS.pod,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SPOPS.pod 17 Feb 2004 04:30:11 -0000 1.8 --- SPOPS.pod 30 Nov 2004 02:11:15 -0000 1.9 *************** *** 18,22 **** configuration: ! [% INCLUDE examples/spops_datasource_default_config | indent 2 %] At startup time OI2 will rewrite the 'isa' key in every SPOPS object --- 18,25 ---- configuration: ! [datasource_config] ! spops = main ! system = main ! manager = OpenInteract2::DatasourceManager At startup time OI2 will rewrite the 'isa' key in every SPOPS object *************** *** 26,39 **** datasource declared in your server configuration: ! [% INCLUDE examples/spops_datasource_declare | indent 2 %] The declaration for a simple object might look like this: ! [% INCLUDE examples/spops_simple_object_declare | indent 2 %] Notice that the 'isa' field is absolutely empty. Here's what it would look like after the rewriting process at server startup: ! [% INCLUDE examples/spops_simple_object_declare_post_rewrite | indent 2 %] =head1 SECURITY TAGGING --- 29,69 ---- datasource declared in your server configuration: ! [datasource main] ! type = DBI ! spops = SPOPS::DBI::Pg ! ... The declaration for a simple object might look like this: ! [news_section] ! class = OpenInteract2::NewsSection ! isa = ! field = ! field_discover = yes ! id_field = news_section_id ! no_insert = news_section_id ! increment_field = yes ! sequence_name = oi_news_section_seq ! base_table = news_section ! name = section ! object_name = News Section Notice that the 'isa' field is absolutely empty. Here's what it would look like after the rewriting process at server startup: ! [news_section] ! class = OpenInteract2::NewsSection ! isa = OpenInteract2::SPOPS::DBI ! isa = SPOPS::DBI::Pg ! isa = SPOPS::DBI ! field = ! field_discover = yes ! id_field = news_section_id ! no_insert = news_section_id ! increment_field = yes ! sequence_name = oi_news_section_seq ! base_table = news_section ! name = section ! object_name = News Section =head1 SECURITY TAGGING *************** *** 44,52 **** to specify 'yes' for the 'is_secure' configuration key. Here's an example: ! [% INCLUDE examples/spops_simple_object_declare_security | indent 2 %] And after the rewriting process: ! [% INCLUDE examples/spops_simple_object_declare_security_post_rewrite | indent 2 %] =head1 CREATION SECURITY CONVERSION --- 74,93 ---- to specify 'yes' for the 'is_secure' configuration key. Here's an example: ! [news_section] ! class = OpenInteract2::NewsSection ! isa = ! is_secure = yes ! ... And after the rewriting process: ! [news_section] ! class = OpenInteract2::NewsSection ! isa = OpenInteract2::SPOPS::DBI ! isa = SPOPS::Secure ! isa = SPOPS::DBI::Pg ! isa = SPOPS::DBI ! is_secure = yes ! ... =head1 CREATION SECURITY CONVERSION *************** *** 59,68 **** 'document'. We'd first declare the group in the server configuration: ! [% INCLUDE examples/security_config_default_objects | indent 2 %] And then we'd be able to set relevant SPOPS 'creation_security' key with the group name and level: ! [% INCLUDE examples/security_creation_security_newgroup | indent 2 %] =head1 DISPLAY/EDIT URL --- 100,121 ---- 'document'. We'd first declare the group in the server configuration: ! [default_objects] ! ... ! public_group = 2 ! site_admin_group = 3 ! content_admin_group = 5 And then we'd be able to set relevant SPOPS 'creation_security' key with the group name and level: ! [document] ! class = OpenInteract2::Document ! is_secure = yes ! ... ! ! [document creation_security] ! user = ! group = content_admin_group:WRITE ! world = READ =head1 DISPLAY/EDIT URL *************** *** 76,80 **** Here's an example using the 'news' object: ! [% INCLUDE examples/spops_display_action_declare | indent 2 %] So this says to generate the URL to display a news object, first --- 129,140 ---- Here's an example using the 'news' object: ! [news] ! class = OpenInteract2::News ! ... ! ! [news display] ! ACTION = news ! TASK = display ! TASK_EDIT = display_form So this says to generate the URL to display a news object, first *************** *** 82,95 **** append the ID of the object as necessary. So when you call: ! [% INCLUDE examples/spops_object_info_call | indent 4 %] the result would be: ! [% INCLUDE examples/spops_object_info_result | indent 2 %] And if you were deployed under the URL space '/MyApp' it would look like this: ! [% INCLUDE examples/spops_object_info_result_context | indent 2 %] =head1 DATE CONVERSION --- 142,162 ---- append the ID of the object as necessary. So when you call: ! my $news = eval { ! CTX->lookup_object( 'news ' )->fetch( 15 ) ! }; ! my $object_info = $news->object_description; ! print "URL to display this news object: $object_info->{url}"; ! print "URL to edit this news object: $object_info->{url_edit}"; the result would be: ! URL to display this news object: /News/display/?news_id=15 ! URL to edit this news object: /News/display_form/?news_id=15 And if you were deployed under the URL space '/MyApp' it would look like this: ! URL to display this news object: /MyApp/News/display/?news_id=15 ! URL to edit this news object: /MyApp/News/display_form/?news_id=15 =head1 DATE CONVERSION *************** *** 97,103 **** OpenInteract can perform round-trip date conversion for you. This means that when a date is pulled out of the database it will be ! converted into an object (normally L<DateTime|DateTime>) and when you ! execute a C<save()> against an object it will be converted from the ! object format into one your database can understand. Setting it up is simple. Just set the key 'convert_date_field' in your --- 164,170 ---- OpenInteract can perform round-trip date conversion for you. This means that when a date is pulled out of the database it will be ! converted into a L<DateTime|DateTime> object and when you execute a ! C<save()> against an object it will be converted from the object ! format into one your database can understand. Setting it up is simple. Just set the key 'convert_date_field' in your *************** *** 106,114 **** object again: ! [% INCLUDE examples/spops_news_date_declare | indent 2 %] And an example of usage: ! [% INCLUDE examples/spops_news_date_use | indent 2 %] You also need to specify the format your database requires for --- 173,191 ---- object again: ! [news] ! class = OpenInteract2::News ! ... ! convert_date_field = posted_on ! convert_date_field = active_on ! convert_date_field = expires_on And an example of usage: ! my $news = eval { ! CTX->lookup_object( 'news ' )->fetch( 15 ) ! }; ! my $posted_on_display = "Posted on " . ! $news->posted_on->day_of_year . ! " day of the year"; You also need to specify the format your database requires for *************** *** 132,139 **** that should be indexed: ! [% INCLUDE examples/spops_fulltext_use | indent 2 %] =head1 SEE ALSO L<DateTime|DateTime> --- 209,221 ---- that should be indexed: ! is_searchable = yes ! fulltext_field = indexable_field_one ! fulltext_field = indexable_field_two ! fulltext_field = indexable_field_three =head1 SEE ALSO + L<OpenInteract2::Config::Initializer|OpenInteract2::Config::Initializer> + L<DateTime|DateTime> |