From bruno at mkdoc.demon.co.uk Mon Jan 3 18:58:48 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Mon Jan 3 18:58:30 2005 Subject: [MKDoc-commit] Added example MKDoc::Apache_Cache cache_policy file Message-ID: <20050103185848.A380A2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Added example MKDoc::Apache_Cache cache_policy file Tags: ---- mkdoc-1-6 Added Files: ----------- mkd/conf: cache_policy.conf -------------- next part -------------- --- /dev/null +++ conf/cache_policy.conf @@ -0,0 +1,59 @@ +# example of an MKDoc configuration + +# some different kinds of requests + +CONDITION is_slash $ENV{PATH_INFO} =~ /\/$/ + +CONDITION is_sitemap $ENV{PATH_INFO} =~ /\/\.sitemap\.html$/ +CONDITION is_print $ENV{PATH_INFO} =~ /\/\.print\.html$/ +CONDITION is_rdf $ENV{PATH_INFO} =~ /\/\.meta\.rdf$/ +CONDITION is_rss $ENV{PATH_INFO} =~ /\/\.headlines\.rss$/ +CONDITION is_search $ENV{PATH_INFO} =~ /\/\.search\.html$/ + +CONDITION is_photo $ENV{PATH_INFO} =~ /\/[a-z0-9-]+\.[a-z]+,html$/ + +CONDITION is_poll $ENV{PATH_INFO} =~ /\/poll(-[0-9]+)?\.html$/ + +CONDITION is_discussion $ENV{PATH_INFO} =~ /\/discussion(-[0-9]+)?\.html$/ +CONDITION is_postmessage $ENV{PATH_INFO} =~ /\/discussion(-[0-9]+)?\.html,post$/ +CONDITION is_viewmessage $ENV{PATH_INFO} =~ /\/discussion(-[0-9]+)?\.html,view$/ + +CONDITION is_subscribe $ENV{PATH_INFO} =~ /\/\.account\.subscribe$/ +CONDITION is_reminder $ENV{PATH_INFO} =~ /\/\.account\.reminder$/ +CONDITION is_preferences $ENV{PATH_INFO} =~ /\/\.account\.preferences$/ +CONDITION is_remove $ENV{PATH_INFO} =~ /\/\.account\.remove$/ + +CONDITION is_user defined $ENV{REMOTE_USER} + +# some different times + +RET_VALUE never 0 +RET_VALUE ten_minutes "10 min" +RET_VALUE thirty_minutes "30 min" +RET_VALUE eight_hours "8 hours" +RET_VALUE one_day "24 hours" +RET_VALUE one_week "7 days" + +# non-default retrieval keys + +RET_VALUE no_query_string $ENV{REQUEST_METHOD} . ":" . $ENV{SERVER_NAME} . $ENV{PATH_INFO} +RET_VALUE dev_null 'dev_null' + +# the control list + +RULE never dev_null WHEN is_user +RULE never dev_null WHEN is_poll +RULE never dev_null WHEN is_search + +RULE one_day no_query_string WHEN is_sitemap + +RULE thirty_minutes no_query_string WHEN is_slash +RULE thirty_minutes no_query_string WHEN is_print +RULE thirty_minutes no_query_string WHEN is_photo + +RULE eight_hours no_query_string WHEN is_rdf +RULE eight_hours no_query_string WHEN is_rss + +RULE eight_hours WHEN is_discussion +RULE eight_hours WHEN is_viewmessage + From chris at mkdoc.demon.co.uk Wed Jan 5 11:08:57 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Wed Jan 5 11:08:38 2005 Subject: [MKDoc-commit] Added select list and table row examples from the email list to the Message-ID: <20050105110857.4BE712E28E2@mkdoc.demon.co.uk> Log Message: ----------- Added select list and table row examples from the email list to the documentation. Modified Files: -------------- Petal/lib: Petal.pm -------------- next part -------------- Index: Petal.pm =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal.pm,v retrieving revision 1.122 retrieving revision 1.123 diff -Llib/Petal.pm -Llib/Petal.pm -u -r1.122 -r1.123 --- lib/Petal.pm +++ lib/Petal.pm @@ -1054,6 +1054,48 @@
  • $user/real_name
  • +A select list with one item selected: + + + +A table with rows of alternation colours set via CSS: + + +
    +
    + + + + + + +
    + This a odd row, it comes before the even row. +
    + This a even row. +
    + Why? Repeat statements are used to loop through a list of values, From chris at mkdoc.demon.co.uk Wed Jan 5 11:09:49 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Wed Jan 5 11:09:30 2005 Subject: [MKDoc-commit] spelling mistake fix... Message-ID: <20050105110949.7CFD42E28E2@mkdoc.demon.co.uk> Log Message: ----------- spelling mistake fix... Modified Files: -------------- Petal/lib: Petal.pm -------------- next part -------------- Index: Petal.pm =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal.pm,v retrieving revision 1.123 retrieving revision 1.124 diff -Llib/Petal.pm -Llib/Petal.pm -u -r1.123 -r1.124 --- lib/Petal.pm +++ lib/Petal.pm @@ -1070,7 +1070,7 @@ >Klingon -A table with rows of alternation colours set via CSS: +A table with rows of alternating colours set via CSS:
    Log Message: ----------- [1.6] New methods determine which child of the root document is an ancestor and lay out lists of children with percentages. Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/flo/Record: Document.pm -------------- next part -------------- Index: Document.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/Record/Document.pm,v retrieving revision 1.25.2.68 retrieving revision 1.25.2.69 diff -Lflo/Record/Document.pm -Lflo/Record/Document.pm -u -r1.25.2.68 -r1.25.2.69 --- flo/Record/Document.pm +++ flo/Record/Document.pm @@ -1093,6 +1093,21 @@ ## +# $self->root_child(); +# -------------------- +# Returns the ancestor of this document that is a child of the root document. +## +sub root_child +{ + my $self = shift; + my $ancestors = $self->ancestors; + return unless $ancestors; + return $self unless $ancestors->[1]; + return $ancestors->[1]; +} + + +## # $self->position(); # ------------------ # Gets the sibling position of that document, i.e. where it @@ -1682,6 +1697,22 @@ ## +# $self->children_showable_percent_each() +# --------------------------------------- +# returns 25% if there are 4 children, 12.5% if there are eight etc.. +# css percentages are decimal numbers, not necessarily integers +# http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number +## +sub children_showable_percent_each +{ + my $self = shift; + my $children_showable = $self->children_showable; + my $number = @$children_showable || return; + return (100 / $number) . '%'; +} + + +## # $self->cousins_homonyms(); # -------------------------- # Returns a list of cousins which are also homonyms. From bruno at mkdoc.demon.co.uk Wed Jan 5 15:29:44 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Wed Jan 5 15:29:26 2005 Subject: [MKDoc-commit] New Directory Message-ID: <20050105152944.C45A12E28E2@mkdoc.demon.co.uk> Update of /var/spool/cvs/Petal/t/data/test_attributes_chars In directory devil.webarch.net:/tmp/cvs-serv5810/t/data/test_attributes_chars Log Message: Directory /var/spool/cvs/Petal/t/data/test_attributes_chars added to the repository From bruno at mkdoc.demon.co.uk Wed Jan 5 15:33:48 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Wed Jan 5 15:33:29 2005 Subject: [MKDoc-commit] release 2.15. Message-ID: <20050105153348.C19752E28E2@mkdoc.demon.co.uk> Log Message: ----------- release 2.15. Added support for non-alphanumeric xml attribute names in tal:attributes + tests. Modified Files: -------------- Petal: Changes MANIFEST META.yml README Petal/lib/Petal/Canonicalizer: XML.pm Added Files: ----------- Petal: .cvsignore Petal/t: 083_test_attributes_chars.t Petal/t/data/test_attributes_chars: test_attributes_chars1.xml -------------- next part -------------- --- /dev/null +++ .cvsignore @@ -0,0 +1,5 @@ +.swp +Makefile +blib +pm_to_blib + Index: MANIFEST =================================================================== RCS file: /var/spool/cvs/Petal/MANIFEST,v retrieving revision 1.45 retrieving revision 1.46 diff -LMANIFEST -LMANIFEST -u -r1.45 -r1.46 --- MANIFEST +++ MANIFEST @@ -1,3 +1,4 @@ +.cvsignore Changes lib/Petal.pm lib/Petal/Cache/Disk.pm @@ -85,6 +86,7 @@ t/080_Petal_TranslationService_h4x0r.t t/081_Petal_I18NProcessor.t t/082_Petal_Gettext.t +t/083_test_attributes_chars.t t/benchmark.pl t/data/access_obj_array.html t/data/access_obj_hash.html @@ -178,6 +180,7 @@ t/data/string_count.html t/data/style_andamp.html t/data/test_attributes2.xml +t/data/test_attributes_chars/test_attributes_chars1.xml t/data/test_ns_attributes/test_ns_attributes1.xml t/data/test_ns_attributes/test_ns_attributes2.xml t/data/test_ns_attributes/test_ns_attributes3.xml Index: META.yml =================================================================== RCS file: /var/spool/cvs/Petal/META.yml,v retrieving revision 1.7 retrieving revision 1.8 diff -LMETA.yml -LMETA.yml -u -r1.7 -r1.8 --- META.yml +++ META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Petal -version: 2.14 +version: 2.15 version_from: lib/Petal.pm installdirs: site requires: Index: Changes =================================================================== RCS file: /var/spool/cvs/Petal/Changes,v retrieving revision 1.123 retrieving revision 1.124 diff -LChanges -LChanges -u -r1.123 -r1.124 --- Changes +++ Changes @@ -1,7 +1,9 @@ Revision history for Petal. -2.15 +2.15 Wed Jan 5 15:31:00 2005 - Fixed some 'used of uninitialized values' warnings + - Added support for non-alphanumeric xml attribute names in tal:attributes + - removed defunct email address 2.14 Thu Sep 2 15:07:39 2004 - Fixed broken I18N attributes parsing Index: README =================================================================== RCS file: /var/spool/cvs/Petal/README,v retrieving revision 1.41 retrieving revision 1.42 diff -LREADME -LREADME -u -r1.41 -r1.42 --- README +++ README @@ -48,6 +48,7 @@ Sean M. Burke Chris Croome Paul Arzul +Bruno Postle Kurt Stephens Steve Purkis Holland, Mark Index: XML.pm =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal/Canonicalizer/XML.pm,v retrieving revision 1.34 retrieving revision 1.35 diff -Llib/Petal/Canonicalizer/XML.pm -Llib/Petal/Canonicalizer/XML.pm -u -r1.34 -r1.35 --- lib/Petal/Canonicalizer/XML.pm +++ lib/Petal/Canonicalizer/XML.pm @@ -544,7 +544,7 @@ { next unless (defined $string); next if ($string =~ /^\s*$/); - my ($attr, $expr) = $string =~ /^\s*((?:\w|\:)+)\s+(.*?)\s*$/; + my ($attr, $expr) = $string =~ /^\s*([A-Za-z_:][A-Za-z0-9_:.-]*)\s+(.*?)\s*$/; if (not defined $attr or not defined $expr) { warn "Attributes expression '$string' does not seem valid - Skipped"; --- /dev/null +++ t/083_test_attributes_chars.t @@ -0,0 +1,24 @@ +#!/usr/bin/perl +use warnings; +use strict; +use lib ('lib'); +use Test::More 'no_plan'; +use Petal; + +$Petal::DISK_CACHE = 0; +$Petal::MEMORY_CACHE = 0; +$Petal::TAINT = 1; +$Petal::BASE_DIR = './t/data/test_attributes_chars/'; + +my $template; + + +##### + +$template = new Petal('test_attributes_chars1.xml'); + +my $string = $template->process (value1 => 'new_value1', value2 => 'new_value2'); +like ($string => qr/new_value1/); +like ($string => qr/new_value2/); + +__END__ --- /dev/null +++ t/data/test_attributes_chars/test_attributes_chars1.xml @@ -0,0 +1,4 @@ + + + + From bruno at mkdoc.demon.co.uk Fri Jan 7 13:14:37 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 7 13:14:19 2005 Subject: [MKDoc-commit] New Directory Message-ID: <20050107131437.925A62E28E2@mkdoc.demon.co.uk> Update of /var/spool/cvs/mkd/templates/macros/timerange In directory devil.webarch.net:/tmp/cvs-serv12657/templates/macros/timerange Log Message: Directory /var/spool/cvs/mkd/templates/macros/timerange added to the repository --> Using per-directory sticky tag `mkdoc-1-6' From bruno at mkdoc.demon.co.uk Fri Jan 7 13:25:48 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 7 13:25:30 2005 Subject: [MKDoc-commit] [1.6] Methods and templates to make timeranges easier on the eye Message-ID: <20050107132548.4C6302E28E2@mkdoc.demon.co.uk> Log Message: ----------- [1.6] Methods and templates to make timeranges easier on the eye Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/flo/editor: TimeRange.pm mkd/templates/component/headlines: en.html mkd/templates/component/timerange: en.html Added Files: ----------- mkd/templates/macros/timerange: en.html -------------- next part -------------- Index: TimeRange.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/editor/TimeRange.pm,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -Lflo/editor/TimeRange.pm -Lflo/editor/TimeRange.pm -u -r1.1.2.1 -r1.1.2.2 --- flo/editor/TimeRange.pm +++ flo/editor/TimeRange.pm @@ -471,6 +471,52 @@ } } DateTime::TimeZone->all_names ]; } +=item C<< $self->same_day() >> + +This method returns true if both the start and end times of the event are on +the same day and are in the same timezone. + +=cut + +sub same_day +{ + my $self = shift; + return 0 unless ($self->{'from_day'} eq $self->{'to_day'}); + return 0 unless ($self->{'from_month'} eq $self->{'to_month'}); + return 0 unless ($self->{'from_year'} eq $self->{'to_year'}); + return 0 unless ($self->{'from_tz'} eq $self->{'to_tz'}); + return 1; +} + +=item C<< $self->different_year() >> + +This method returns true if the start and end times of the event are in +different years. + +=cut + +sub different_year +{ + my $self = shift; + return 0 if ($self->{'from_year'} eq $self->{'to_year'}); + return 1; +} + +=item C<< $self->same_year_different_day() >> + +This method returns true if the start and end times of the event are in +the same year but on different days. + +=cut + +sub same_year_different_day +{ + my $self = shift; + return 0 if $self->different_year; + return 0 if $self->same_day; + return 1; +} + =item C<< $self->generate_xml() >> This class overrides generate_xml() in order to update the Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/component/headlines/Attic/en.html,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -Ltemplates/component/headlines/en.html -Ltemplates/component/headlines/en.html -u -r1.1.2.24 -r1.1.2.25 --- templates/component/headlines/en.html +++ templates/component/headlines/en.html @@ -14,6 +14,7 @@ align_opposite self/align_opposite; " xmlns:petal="http://purl.org/petal/1.0/" + xmlns:metal="http://xml.zope.org/namespaces/metal" >

    - Starts - - DATE - - - TZ - -
    -
    - Ends - - DATE - - - DATE - + + 10:11am to 5:10pm Monday December 18 2005 +

    @@ -239,32 +220,12 @@
    - Starts - - DATE - - - TZ - -
    -
    - Ends - - DATE - - - DATE - + + 10:11am to 5:10pm Monday December 18 2005 +
    @@ -353,32 +314,12 @@
    - Starts - - DATE - - - TZ - -
    -
    - Ends - - DATE - - - DATE - + + 10:11am to 5:10pm Monday December 18 2005 +
    Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/component/timerange/Attic/en.html,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -Ltemplates/component/timerange/en.html -Ltemplates/component/timerange/en.html -u -r1.1.2.2 -r1.1.2.3 --- templates/component/timerange/en.html +++ templates/component/timerange/en.html @@ -7,6 +7,8 @@
    Timerange Title
    -
    - Starts - - Start Time - - - Time Zone - -
    -
    - Ends - - End Time - - - Time Zone - +
    + + 10:11am to 5:10pm Monday December 18 2005 +
    --- /dev/null +++ templates/macros/timerange/en.html @@ -0,0 +1,65 @@ + + + + Macros for formatting timerange output + + + +
    +
    This item has a title
    +
    + + + 10:11am + to 10:11am + Monday December 18 2005 + + + 12:00pm Monday 18 January, + to 5:00pm Monday 02 February 2005 + + + 7:00pm Monday 31 December 2004, + to 4:00am Monday 01 January 2005 + + +
    +
    + + From bruno at mkdoc.demon.co.uk Fri Jan 7 15:41:54 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 7 15:41:34 2005 Subject: [MKDoc-commit] mod_perl bug where $::MKD_CONFIG would appear to exist even when it Message-ID: <20050107154154.2D7842E28E2@mkdoc.demon.co.uk> Log Message: ----------- mod_perl bug where $::MKD_CONFIG would appear to exist even when it didn't Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/MKDoc: Config.pm -------------- next part -------------- Index: Config.pm =================================================================== RCS file: /var/spool/cvs/mkd/MKDoc/Config.pm,v retrieving revision 1.8.2.45 retrieving revision 1.8.2.46 diff -LMKDoc/Config.pm -LMKDoc/Config.pm -u -r1.8.2.45 -r1.8.2.46 --- MKDoc/Config.pm +++ MKDoc/Config.pm @@ -261,7 +261,7 @@ ## sub new { - $::MKD_CONFIG ||= { _make_config() }; + $::MKD_CONFIG = { _make_config() } unless $::MKD_CONFIG->{'do_i_really_exist'}; my $class = shift; $class = ref $class || $class; @@ -272,6 +272,7 @@ sub _make_config { + 'do_i_really_exist' => '', 'flo.plugin.Discussion.List.slice_thickness' => get_env ('MKD__PLUGIN_DISCUSSION_PER_PAGE') || 50, 'flo.plugin.Photo.scaled_max_x' => get_env ('MKD__PLUGIN_PHOTO_SCALED_X') || 512, 'flo.plugin.Photo.scaled_max_y' => get_env ('MKD__PLUGIN_PHOTO_SCALED_Y') || 384, From bruno at mkdoc.demon.co.uk Sun Jan 16 23:09:36 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Sun Jan 16 23:09:16 2005 Subject: [MKDoc-commit] Added William McKee's "Cookbook" pod document Message-ID: <20050116230936.341EC2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Added William McKee's "Cookbook" pod document Modified Files: -------------- Petal: MANIFEST Added Files: ----------- Petal/lib/Petal: Cookbook.pod -------------- next part -------------- Index: MANIFEST =================================================================== RCS file: /var/spool/cvs/Petal/MANIFEST,v retrieving revision 1.46 retrieving revision 1.47 diff -LMANIFEST -LMANIFEST -u -r1.46 -r1.47 --- MANIFEST +++ MANIFEST @@ -6,6 +6,7 @@ lib/Petal/Canonicalizer/XHTML.pm lib/Petal/Canonicalizer/XML.pm lib/Petal/CodeGenerator.pm +lib/Petal/Cookbook.pod lib/Petal/Deprecated.pm lib/Petal/Entities.pm lib/Petal/Functions.pm --- /dev/null +++ lib/Petal/Cookbook.pod @@ -0,0 +1,212 @@ +=head1 NAME + +Petal::Cookbook - Recipes for building templates with Petal + +=head1 SYNOPSIS + +Not Applicable + +=head1 DESCRIPTION + +This document contains some examples of L template usage. + + +=head1 NOTES +I tend to use Petal to generate HTML files from HTML templates. I name these templates with the .tmpl extension to help distinguish templates from static html. Nonetheless, the templates should be in a non-web accessible directory if you are using Petal for developing web applications. + + +=head1 BASICS + +=head2 Passing a hashreference to Petal::process +An effective way to collate data to send to the Petal process command is via a hash reference. Used as follows, this technique allows you to build up your data to be passed to the template slowly: + + my $hash = { object => $some_object, number => 3 }; + $hash->{'foo'} = "bar"; + my $template = new Petal ( 'test.tmpl' ); + my $html = $template->process($hash); + # Output the results + print "Content-type: text/html\n\n"; + print $html; + + +=head1 INTERMEDIATE TIPS + +=head2 Assigning attributes (submitted by Warren Smith) + +Up until now, if I wanted to use petal to pre-select an item in a selectbox, I +would have to do each item twice, like so: + + + + $VAR1 = [ + { value => 1, label => 'Option 1', selected => 1 }, + { value => 2, label => 'Option 2', selected => 0 }, + { value => 4, label => 'Option 3', selected => 0 }, + ]; + + +After reading the Petal source, I found that if you use petal:attributes +to assign an attribute an undefined value, the attribute gets omitted, +thus the above code can be replaced with the simpler version below: + + + + $VAR1 = [ + { value => 1, label => 'Option 1', selected => 1 }, + { value => 2, label => 'Option 2' }, + { value => 4, label => 'Option 3' }, + ]; + +It turns out that although not documented in Petal's documentation, this +behavior is part of the TAL specification: + + http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL + +Thanks to Warren Smith for this tip and Fergal Daly for his knowledge of the TAL specification. + + +=head2 Generating even/odd rows (submitted by Warren Smith) +I developed a decode: modifier that works similar to Oracle's decode +statement. It should be making it into the next release of Petal::Utils. So, +making even/odd rows of a table different classes, which allows you to do +things like alter color, font-size, etc, is relatively easy. + +Example: + +
    + ... +
    + + +Thanks to Warren Smith for this tip. + + +=head1 ADVANCED + +=head2 Invoking methods on objects +Petal supports the ability to call an object's methods if passed in to Petal::process via the %hash. Say you wish to check whether a particular record is contained in a recordset returned from an SQL query. Using OO-Perl techniques, you could use the following technique as described by Jean-Michel: + +* all your records are hashrefs which come from some database +* you have a list of them to display + +Let's say that the database table looks like this: + +Raters (id, first_name, last_name, relation, phone, email) + +You could bless each record into a package as is: + + use MyApplication::Record::Rater; + my @records = complicated_query_somewhere_else(); + bless $_, "MyApplication::Record::Rater" for (@records); + + +Your module could look like that: + + package MyApplication::Record::Rater; + use strict; + use warnings; + use CGI; + use Carp; + + sub is_current_id + { + my $self = shift; + my $cgi = CGI->new; + my $id = $cgi->param ('rater.id'); + return unless (defined $id and $id and $id =~ /^\d+$/); + return $id == $self->{id}; + } + + 1; + +Then on top of your existing data, you have a method which you can call +from Petal, i.e. + + + blah blah blah... + + +This trick can also be used when you have foreign keys in database +fields. + + + +For example, let's imagine that you have a column called +'friend_id'. It references another 'rater' which is supposed to be a +friend of that person. + +You could defined the following subroutine: + + # give me the friend record for that person + sub friend + { + my $self = shift; + my $friend_id = $self->{friend_id}; + my $sql = 'select * from rater where id = ?'; + my $sth = $::DBH_CONNECTION->prepare_cached ($sql); + $sth->execute ($friend_id); + my $hash = $sth->fetchrow_hashref; + return unless (defined $hash); + + bless $hash, "MyApplication::Record::Rater"; + return $hash; + } + +Then in your template, you could do: + + + Your friend is: + $encode:rater/friend/first_name + $encode:rater/friend/last_name + + + + +Thanks to Jean-Michel Hiver for this tip. + + + NEEDS TO BE TESTED + NEEDS TO BE TESTED +=head2 Using CGI.pm to build forms + NEEDS TO BE TESTED + NEEDS TO BE TESTED +Be sure to call CGI with the -compile option as follows: + use CGI(-compile [:all]); + +Calling the HTML generating methods of CGI.pm from the Petal template provides +an extremely simple means to develop forms. For example, the ususal ratnest of +loops used to populate a checkbox group can be replaced by the simple elegant +construct below. You can put in a dummy checkbox to give the HTML designer +something to look at. + + +Test + +Thanks to Kurt Stephens for this tip. + + + +=head1 COPYRIGHT + +Copyright (c) 2002-2005 Knowmad Services Inc. All rights reserved. + +This program is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. + +=head1 AUTHOR + + William McKee . + +=head1 SEE ALSO + +L, L + +=cut + From chris at mkdoc.demon.co.uk Mon Jan 17 11:16:16 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Mon Jan 17 11:15:56 2005 Subject: [MKDoc-commit] Powered by MKDoc meta tag moved up and link changed to mkdoc.org Message-ID: <20050117111616.1D9412E28E2@mkdoc.demon.co.uk> Log Message: ----------- Powered by MKDoc meta tag moved up and link changed to mkdoc.org Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/fragments/head: en.html mkd/templates/fragments/head_admin: en.html mkd/templates/fragments/menu_children/user: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/fragments/head/Attic/en.html,v retrieving revision 1.1.2.32 retrieving revision 1.1.2.33 diff -Ltemplates/fragments/head/en.html -Ltemplates/fragments/head/en.html -u -r1.1.2.32 -r1.1.2.33 --- templates/fragments/head/en.html +++ templates/fragments/head/en.html @@ -31,6 +31,10 @@ content="#" petal:attributes="content uri" /> + - fixed, the macro that someone set it to use doesn't work Message-ID: <20050117134031.3D7A62E28E2@mkdoc.demon.co.uk> Log Message: ----------- fixed, the macro that someone set it to use doesn't work Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/fragments/head_public: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/fragments/head_public/Attic/en.html,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -Ltemplates/fragments/head_public/en.html -Ltemplates/fragments/head_public/en.html -u -r1.1.2.11 -r1.1.2.12 --- templates/fragments/head_public/en.html +++ templates/fragments/head_public/en.html @@ -9,7 +9,9 @@ xmlns:petal="http://purl.org/petal/1.0/" xmlns:metal="http://xml.zope.org/namespaces/metal" > - <title metal:use-macro="../head/#title">Document Title + Document Title Log Message: ----------- Conditions added to top and parent link rels Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/fragments/head_public: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/fragments/head_public/Attic/en.html,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -Ltemplates/fragments/head_public/en.html -Ltemplates/fragments/head_public/en.html -u -r1.1.2.12 -r1.1.2.13 --- templates/fragments/head_public/en.html +++ templates/fragments/head_public/en.html @@ -65,6 +65,7 @@ title="Document Parent Title" type="text/html" petal:attributes="href parent_uri; hreflang parent_lang; title parent_title" + petal:condition="true parent_uri" /> From chris at mkdoc.demon.co.uk Thu Jan 20 12:00:34 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Thu Jan 20 12:00:15 2005 Subject: [MKDoc-commit] Added a clear: both for fieldset's to fix a Safari / Konq rendering bug Message-ID: <20050120120034.DD5712E28E2@mkdoc.demon.co.uk> Log Message: ----------- Added a clear: both for fieldset's to fix a Safari / Konq rendering bug on properties page. Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/skin: admin.css -------------- next part -------------- Index: admin.css =================================================================== RCS file: /var/spool/cvs/mkd/skin/Attic/admin.css,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -Lskin/admin.css -Lskin/admin.css -u -r1.1.2.12 -r1.1.2.13 --- skin/admin.css +++ skin/admin.css @@ -82,6 +82,7 @@ margin-bottom: 1em; padding: 0.6em; border: 0; + clear: both; } div.admin-content legend { font-size: larger; From bruno at mkdoc.demon.co.uk Thu Jan 20 21:51:59 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Thu Jan 20 21:51:39 2005 Subject: [MKDoc-commit] Initial commit Message-ID: <20050120215159.428F42E28E2@mkdoc.demon.co.uk> Log Message: ----------- Initial commit Added Files: ----------- Petal-Parser-HTB: .cvsignore -------------- next part -------------- --- /dev/null +++ .cvsignore @@ -0,0 +1,4 @@ +.swp +Makefile +blib +pm_to_blib From bruno at mkdoc.demon.co.uk Fri Jan 21 00:53:53 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 21 00:53:34 2005 Subject: [MKDoc-commit] Incremented version and fixed Name in Makefile.PL Message-ID: <20050121005353.DE2B42E28E2@mkdoc.demon.co.uk> Log Message: ----------- Incremented version and fixed Name in Makefile.PL Modified Files: -------------- Petal-Parser-HTB: Changes MANIFEST META.yml Makefile.PL Petal-Parser-HTB/lib/Petal/Parser: HTB.pm -------------- next part -------------- Index: MANIFEST =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/MANIFEST,v retrieving revision 1.1 retrieving revision 1.2 diff -LMANIFEST -LMANIFEST -u -r1.1 -r1.2 --- MANIFEST +++ MANIFEST @@ -1,3 +1,4 @@ +.cvsignore Changes lib/Petal/Parser/HTB.pm Makefile.PL Index: META.yml =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/META.yml,v retrieving revision 1.1 retrieving revision 1.2 diff -LMETA.yml -LMETA.yml -u -r1.1 -r1.2 --- META.yml +++ META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Petal-Parser-HTB -version: 1.03 +version: 1.04 version_from: lib/Petal/Parser/HTB.pm installdirs: site requires: Index: Changes =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/Changes,v retrieving revision 1.4 retrieving revision 1.5 diff -LChanges -LChanges -u -r1.4 -r1.5 --- Changes +++ Changes @@ -1,5 +1,9 @@ Revision history for Petal::Parser::HTB. +1.04 + - Removed defunct email address + - Fixed Name in Makefile.PL + 1.03 Mon Mar 15 15:59:06 2004 - Updated entities test Index: Makefile.PL =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/Makefile.PL,v retrieving revision 1.3 retrieving revision 1.4 diff -LMakefile.PL -LMakefile.PL -u -r1.3 -r1.4 --- Makefile.PL +++ Makefile.PL @@ -2,7 +2,7 @@ # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( - 'NAME' => 'Petal-Parser-HTB', + 'NAME' => 'Petal::Parser::HTB', 'VERSION_FROM' => 'lib/Petal/Parser/HTB.pm', # finds $VERSION 'PREREQ_PM' => { 'Petal' => '1.10', Index: HTB.pm =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/lib/Petal/Parser/HTB.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -Llib/Petal/Parser/HTB.pm -Llib/Petal/Parser/HTB.pm -u -r1.3 -r1.4 --- lib/Petal/Parser/HTB.pm +++ lib/Petal/Parser/HTB.pm @@ -18,7 +18,7 @@ $Petal::INPUTS->{HTML} = 'Petal::Parser::HTB'; $Petal::INPUTS->{XHTML} = 'Petal::Parser::HTB'; -our $VERSION = '1.03'; +our $VERSION = '1.04'; # this avoid silly warnings sub sillyness From bruno at mkdoc.demon.co.uk Fri Jan 21 12:31:47 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 21 12:31:28 2005 Subject: [MKDoc-commit] Incremented VERSION and added Cookbook from William McKee Message-ID: <20050121123147.9B89F2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Incremented VERSION and added Cookbook from William McKee Modified Files: -------------- Petal: Changes MANIFEST META.yml Petal/lib: Petal.pm Petal/lib/Petal: Cookbook.pod Added Files: ----------- Petal/t: 084_Cookbook.t Petal/t/data: cookbook.html -------------- next part -------------- Index: MANIFEST =================================================================== RCS file: /var/spool/cvs/Petal/MANIFEST,v retrieving revision 1.47 retrieving revision 1.48 diff -LMANIFEST -LMANIFEST -u -r1.47 -r1.48 --- MANIFEST +++ MANIFEST @@ -88,6 +88,7 @@ t/081_Petal_I18NProcessor.t t/082_Petal_Gettext.t t/083_test_attributes_chars.t +t/084_Cookbook.t t/benchmark.pl t/data/access_obj_array.html t/data/access_obj_hash.html @@ -101,6 +102,7 @@ t/data/comment_does_not_die.xml t/data/comments.xml t/data/content_encoded.html +t/data/cookbook.html t/data/decl.xml t/data/delete_attribute.xml t/data/dummy_data.xml Index: META.yml =================================================================== RCS file: /var/spool/cvs/Petal/META.yml,v retrieving revision 1.8 retrieving revision 1.9 diff -LMETA.yml -LMETA.yml -u -r1.8 -r1.9 --- META.yml +++ META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Petal -version: 2.15 +version: 2.16 version_from: lib/Petal.pm installdirs: site requires: Index: Changes =================================================================== RCS file: /var/spool/cvs/Petal/Changes,v retrieving revision 1.124 retrieving revision 1.125 diff -LChanges -LChanges -u -r1.124 -r1.125 --- Changes +++ Changes @@ -1,5 +1,8 @@ Revision history for Petal. +2.16 + - Added Cookbook.pod documentation and associated tests from William McKee + 2.15 Wed Jan 5 15:31:00 2005 - Fixed some 'used of uninitialized values' warnings - Added support for non-alphanumeric xml attribute names in tal:attributes Index: Petal.pm =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal.pm,v retrieving revision 1.124 retrieving revision 1.125 diff -Llib/Petal.pm -Llib/Petal.pm -u -r1.124 -r1.125 --- lib/Petal.pm +++ lib/Petal.pm @@ -101,7 +101,7 @@ # this is for CPAN -our $VERSION = '2.15'; +our $VERSION = '2.16'; # The CodeGenerator class backend to use. Index: Cookbook.pod =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal/Cookbook.pod,v retrieving revision 1.1 retrieving revision 1.2 diff -Llib/Petal/Cookbook.pod -Llib/Petal/Cookbook.pod -u -r1.1 -r1.2 --- lib/Petal/Cookbook.pod +++ lib/Petal/Cookbook.pod @@ -2,35 +2,57 @@ Petal::Cookbook - Recipes for building templates with Petal -=head1 SYNOPSIS -Not Applicable =head1 DESCRIPTION -This document contains some examples of L template usage. +This document contains some examples of L template usage. Most of +these examples deal with using Petal to generate HTML files from HTML +templates. -=head1 NOTES -I tend to use Petal to generate HTML files from HTML templates. I name these templates with the .tmpl extension to help distinguish templates from static html. Nonetheless, the templates should be in a non-web accessible directory if you are using Petal for developing web applications. - =head1 BASICS + +=head2 Template location + +When using Petal for web application development, your templates should not +need to be accessible by the webserver. In fact, it could be a security +risk if they are available since there may be code or comments which users +should not see prior to processing by Petal. Thus, you should strive to store +your templates in a non-web accessible directory. Personally I prefer to place +the directory outside of the web root but you could also use permissions or +.htaccess files to control access to the directory. This directory path should +go into the $Petal::BASE_DIR global setting or the 'base_dir' argument for the +new() constructor. + + +=head2 Template naming + +Although not necessary, I like to name my templates with the .tmpl extension +to help myself and designers distinguish templates from static html. + + =head2 Passing a hashreference to Petal::process -An effective way to collate data to send to the Petal process command is via a hash reference. Used as follows, this technique allows you to build up your data to be passed to the template slowly: - my $hash = { object => $some_object, number => 3 }; - $hash->{'foo'} = "bar"; - my $template = new Petal ( 'test.tmpl' ); - my $html = $template->process($hash); - # Output the results - print "Content-type: text/html\n\n"; - print $html; +An effective way to collate data to send to the Petal process command is via a +hash reference. Used as follows, this technique allows you to build up your +data to be passed to the template slowly: + + my $hash = { string => 'Three', 'number' => 3 }; + $hash->{'foo'} = "bar"; + my $template = new Petal ( 'test.tmpl' ); + my $html = $template->process($hash); + # Output the results + print "Content-type: text/html\n\n"; + print $html; + =head1 INTERMEDIATE TIPS + =head2 Assigning attributes (submitted by Warren Smith) Up until now, if I wanted to use petal to pre-select an item in a selectbox, I @@ -73,10 +95,12 @@ =head2 Generating even/odd rows (submitted by Warren Smith) + I developed a decode: modifier that works similar to Oracle's decode -statement. It should be making it into the next release of Petal::Utils. So, -making even/odd rows of a table different classes, which allows you to do -things like alter color, font-size, etc, is relatively easy. +statement. It provides an if/then/else construct and is part of the +L collection of modifiers. Using decode, it is +possible to make even/odd rows of a table different classes, which allows you +to do things like alter color, font-size, etc, is relatively easy. Example: @@ -85,16 +109,24 @@ -Thanks to Warren Smith for this tip. +Thanks to Warren Smith for this tip. See L for more information. + =head1 ADVANCED + =head2 Invoking methods on objects + Petal supports the ability to call an object's methods if passed in to Petal::process via the %hash. Say you wish to check whether a particular record is contained in a recordset returned from an SQL query. Using OO-Perl techniques, you could use the following technique as described by Jean-Michel: -* all your records are hashrefs which come from some database -* you have a list of them to display +=over 4 + +=item * all your records are hashrefs which come from some database + +=item * you have a list of them to display + +=back Let's say that the database table looks like this: @@ -105,6 +137,7 @@ use MyApplication::Record::Rater; my @records = complicated_query_somewhere_else(); bless $_, "MyApplication::Record::Rater" for (@records); + $hash->{'records'} = \@records; Your module could look like that: @@ -129,20 +162,18 @@ Then on top of your existing data, you have a method which you can call from Petal, i.e. - - blah blah blah... - +
      +
    • Current id
    • +
    -This trick can also be used when you have foreign keys in database -fields. +This trick can also be used when you have foreign keys in database fields. -For example, let's imagine that you have a column called -'friend_id'. It references another 'rater' which is supposed to be a -friend of that person. +For example, let's imagine that you have a column called 'friend_id'. It +references another 'rater' which is supposed to be a friend of that person. -You could defined the following subroutine: +You could define the following subroutine: # give me the friend record for that person sub friend @@ -161,33 +192,36 @@ Then in your template, you could do: - - Your friend is: - $encode:rater/friend/first_name - $encode:rater/friend/last_name - +
    + Your friend is: First Last +
    Thanks to Jean-Michel Hiver for this tip. +If you are doing a lot of database manipulation via Petal, you probably should +consider an object-relational mapping library . Personally, I recommend +L. There is a list of many of these tools at Perl +Object Oriented Persistence (L). + - NEEDS TO BE TESTED - NEEDS TO BE TESTED =head2 Using CGI.pm to build forms - NEEDS TO BE TESTED - NEEDS TO BE TESTED -Be sure to call CGI with the -compile option as follows: - use CGI(-compile [:all]); Calling the HTML generating methods of CGI.pm from the Petal template provides an extremely simple means to develop forms. For example, the ususal ratnest of -loops used to populate a checkbox group can be replaced by the simple elegant -construct below. You can put in a dummy checkbox to give the HTML designer -something to look at. - - -Test +loops used to populate a checkbox group can be replaced by the simple and +elegant construct below. You can put in a dummy checkbox to give the HTML +designer something to look at. Be sure to call CGI with the -compile option as +follows: + + use CGI qw(-compile [:all]); + $hash->{'query'} = new CGI; + $hash->{'choices'} = [1, 2, 3, 4]; + + + Test + Thanks to Kurt Stephens for this tip. @@ -195,18 +229,29 @@ =head1 COPYRIGHT -Copyright (c) 2002-2005 Knowmad Services Inc. All rights reserved. - This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. +All code examples in these files are hereby placed into the public domain. You +are permitted and encouraged to use this code in your own programs for fun or +for profit as you see fit. A simple comment in the code giving credit would be +courteous but is not required. + + + =head1 AUTHOR - William McKee . +William McKee . + +Thanks to the following contributors: Jean-Michel Hiver, Kurt Stephens, Warren +Smith, Fergal Daly. + + =head1 SEE ALSO -L, L +L, L, the test file t/084_Cookbook.t +and the test template t/data/cookbook.html. =cut --- /dev/null +++ t/084_Cookbook.t @@ -0,0 +1,114 @@ +#!/usr/bin/perl + +# +# Tests for Petal::Cookbook recipes +# +# To view output, use DEBUG environment setting. +# DEBUG=1 perl t/084_Cookbook.t +# the output can be piped to w3m +# DEBUG=1 perl t/084_Cookbook.t | w3m -T text/html +# or redirected to a file for viewing with a browser +# DEBUG=1 perl t/084_Cookbook.t > output.html + +use warnings; +use strict; +use lib ('lib'); +use Test::More 'no_plan'; +use Petal; +use Data::Dumper; + +my $template_file = 'cookbook.html'; +$Petal::BASE_DIR = './t/data/'; + +# Fixup path for taint support +$ENV{PATH} = "/bin:/usr/bin"; + +# Setup Petal environment +$Petal::DISK_CACHE = 0; +$Petal::MEMORY_CACHE = 0; +$Petal::TAINT = 1; +$Petal::INPUT = "XHTML"; +$Petal::OUTPUT = "XHTML"; + +# Create object +my $template = new Petal($template_file); + + +# Basic - Passing a hashreference to Petal::process +my $hash = { string => 'Three', 'number' => 3 }; +$hash->{'foo'} = "bar"; +$hash->{'arrayref'} = [ {foo => 'Craig'}, {foo => 'Jim'} ]; +$hash->{'arrayref'}->[2] = {'foo' => 'William'}; + + +# Advanced - Invoking methods on objects +{ + package MyApplication::Record::Rater; + use strict; + use warnings; + use CGI; + use Carp; + + sub is_current_id { + my $self = shift; + return $self->{id} == 2; + # Alternative way to evaluate current_id + #my $cgi = CGI->new; + #my $id = $cgi->param('rater.id'); + #return unless (defined $id and $id and $id =~ /^\d+$/); + #return $id == $self->{id}; + } + 1; +} +package main; +#use MyApplication::Record::Rater; +# Raters (id, first_name, last_name, relation, phone, email) +my @records = ( +{ +id => 1, +first_name => 'George', +last_name => 'Jetson', +relation => 'father', +phone => '411-232-3333', +email => 'george@spacely.com', +}, +{ +id => 2, +first_name => 'Judy', +last_name => 'Jetson', +relation => 'mother', +phone => '411-232-3333', +email => 'judy@spacely.com', +}, +{ +id => 3, +first_name => 'Jane', +last_name => 'Jetson', +relation => 'daughter', +phone => '411-232-3333', +email => 'jane@spacely.com', +}, +); +bless $_, "MyApplication::Record::Rater" for (@records); +$hash->{'records'} = \@records; + + +# Advanced - Using CGI.pm to generate forms +use CGI qw(-compile [:all]); +$hash->{'query'} = new CGI; +$hash->{'choices'} = [1, 2, 3, 4]; + + +my $out; +eval { +$out = $template->process($hash); +}; +is($@, '', 'No errors during processing'); +ok($out, 'Output was received'); + +print $out if $ENV{'DEBUG'}; + +1; + + +__END__ --- /dev/null +++ t/data/cookbook.html @@ -0,0 +1,86 @@ + + + Petal Test + + + + +

    Petal Test

    + +

    Basic - Passing a hashreference to Petal::process

    + + + + + + + +
    No elements
    $rec/foo
    + +

    String

    +

    #

    +

    foo

    + + + +

    Advanced - Invoking methods on objects

    + + + + + + + + + + + + + + + + +
    IDNamePhoneActive
    No elements
    IDFirst LastPhonex
    + +
      +
    • Current id
    • +
    + + + + + +

    Advanced - Using CGI.pm to generate forms

    + + + + + + + + + + + + + +
    Checkbox groupSelect groupRadio button group
    + + Test + + + + Test + + + + Test + +
    + + + From bruno at mkdoc.demon.co.uk Fri Jan 21 17:52:41 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 21 17:52:23 2005 Subject: [MKDoc-commit] Section on producing valid XML from William McKee Message-ID: <20050121175241.C99642E28E2@mkdoc.demon.co.uk> Log Message: ----------- Section on producing valid XML from William McKee Modified Files: -------------- Petal/lib/Petal: Cookbook.pod -------------- next part -------------- Index: Cookbook.pod =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal/Cookbook.pod,v retrieving revision 1.2 retrieving revision 1.3 diff -Llib/Petal/Cookbook.pod -Llib/Petal/Cookbook.pod -u -r1.2 -r1.3 --- lib/Petal/Cookbook.pod +++ lib/Petal/Cookbook.pod @@ -20,7 +20,7 @@ When using Petal for web application development, your templates should not need to be accessible by the webserver. In fact, it could be a security risk if they are available since there may be code or comments which users -should not see prior to processing by Petal. Thus, you should strive to store +should not see prior to processing by Petal. Thus, it is recommended to store your templates in a non-web accessible directory. Personally I prefer to place the directory outside of the web root but you could also use permissions or .htaccess files to control access to the directory. This directory path should @@ -30,8 +30,55 @@ =head2 Template naming -Although not necessary, I like to name my templates with the .tmpl extension -to help myself and designers distinguish templates from static html. +Petal is indifferent about the name of the template files. Personally, I like +to name my templates with the .tmpl extension to help myself and designers +distinguish templates from static html. Some GUI editors, though, will not +open files without a htm/html extension (esp. under Windows). + + +=head2 Fixing invalid templates (Is this XML well-formed?) + +If you are getting a parse_error when trying to process your template, you +will need to clean up your XHTML template in order for Petal to process it. +Two tools will be of great assistance in taking the step towards better +standards compliance--HTML Tidy (L) and xmllint. In +addition, you can use the page validation services at W3C +(L). Alternatively, you could use the +L module which will parse non well-formed HTML documents +using L. + +HTML Tidy will rewrite your document into valid XHTML and, if requested, even +replace legacy formatting tags with their CSS counterparts. You can safely +ignore the warnings about proprietary attributes. Be sure to read the output +of what HTML Tidy is doing or else you may find it removing important tags +which it thinks are empty or invalid (e.g., inline elements outside of a +block). One of the important options that should be set is output_xhtml +(-asxhtml from the command-line). Here's an example of how to use it (see the +documentation for complete details): + + tidy --asxhtml original_file.html > new_file.html + +Once your document is well-formed, you can use xmllint to do day-to-day +checking that it stays well-formed without having to wade through the warnings +that HTML Tidy will generate about proprietary attributes. The following command will check that a document is well-formed: + + xmllint --noout + +To prevent errors about undefined namespace prefix, be sure to include these +in your template like so: + + + +You may receive errors from xmllint about unknown entities such as nbsp. These +can be safely ignored. If you find a way to suppress these warnings, please +let us know. In the meantime, you can pass the output through grep to ignore +these bogus warnings:. + + xmllint --noout tmpl/contact_info.tmpl >& grep -v 'Entity' + +Now you have no excuse for not creating well-formed XHTML documents. =head2 Passing a hashreference to Petal::process From chris at mkdoc.demon.co.uk Mon Jan 24 01:02:13 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Mon Jan 24 01:01:53 2005 Subject: [MKDoc-commit] Added missing : from true Message-ID: <20050124010213.4CCA72E28E2@mkdoc.demon.co.uk> Log Message: ----------- Added missing : from true Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/fragments/head_public: en.html mkd/templates/metadata: rss100sitemap.rdf.xml -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/fragments/head_public/Attic/en.html,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -Ltemplates/fragments/head_public/en.html -Ltemplates/fragments/head_public/en.html -u -r1.1.2.13 -r1.1.2.14 --- templates/fragments/head_public/en.html +++ templates/fragments/head_public/en.html @@ -65,7 +65,7 @@ title="Document Parent Title" type="text/html" petal:attributes="href parent_uri; hreflang parent_lang; title parent_title" - petal:condition="true parent_uri" + petal:condition="true: parent_uri" /> Index: rss100sitemap.rdf.xml =================================================================== RCS file: /var/spool/cvs/mkd/templates/metadata/Attic/rss100sitemap.rdf.xml,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -Ltemplates/metadata/rss100sitemap.rdf.xml -Ltemplates/metadata/rss100sitemap.rdf.xml -u -r1.2.2.1 -r1.2.2.2 --- templates/metadata/rss100sitemap.rdf.xml +++ templates/metadata/rss100sitemap.rdf.xml @@ -141,7 +141,7 @@ in the same order in the XHTML child lists and XHTML sitemap. --> + petal:condition="true: children"> Log Message: ----------- Added requirement for HTML::Parser 3.45 (William McKee) Modified Files: -------------- Petal-Parser-HTB: Changes Makefile.PL -------------- next part -------------- Index: Changes =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/Changes,v retrieving revision 1.5 retrieving revision 1.6 diff -LChanges -LChanges -u -r1.5 -r1.6 --- Changes +++ Changes @@ -1,6 +1,9 @@ Revision history for Petal::Parser::HTB. -1.04 +1.04 Wed Jan 26 11:00:00 2005 + - Add requirement for HTML::Parser v3.45 which fixes problems with entity + encoding that resulted in the mysterious appearance of  characters in + the output (William McKee). - Removed defunct email address - Fixed Name in Makefile.PL Index: Makefile.PL =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/Makefile.PL,v retrieving revision 1.4 retrieving revision 1.5 diff -LMakefile.PL -LMakefile.PL -u -r1.4 -r1.5 --- Makefile.PL +++ Makefile.PL @@ -7,6 +7,7 @@ 'PREREQ_PM' => { 'Petal' => '1.10', 'HTML::TreeBuilder' => '3.12', + 'HTML::Parser' => '3.45', }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/Petal/Parser/HTB.pm', # retrieve abstract from module From chris at mkdoc.demon.co.uk Wed Jan 26 11:08:14 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Wed Jan 26 11:07:55 2005 Subject: [MKDoc-commit] Commented out stuff that doesn't work Message-ID: <20050126110814.055D22E28E2@mkdoc.demon.co.uk> Log Message: ----------- Commented out stuff that doesn't work Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/component/headlines: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/component/headlines/Attic/en.html,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -Ltemplates/component/headlines/en.html -Ltemplates/component/headlines/en.html -u -r1.1.2.25 -r1.1.2.26 --- templates/component/headlines/en.html +++ templates/component/headlines/en.html @@ -26,8 +26,10 @@ petal:content="self/title" >Demain, on rase gratis! - - +
    Log Message: ----------- Updated metafile for 1.04 release Modified Files: -------------- Petal-Parser-HTB: META.yml -------------- next part -------------- Index: META.yml =================================================================== RCS file: /var/spool/cvs/Petal-Parser-HTB/META.yml,v retrieving revision 1.2 retrieving revision 1.3 diff -LMETA.yml -LMETA.yml -u -r1.2 -r1.3 --- META.yml +++ META.yml @@ -5,6 +5,7 @@ version_from: lib/Petal/Parser/HTB.pm installdirs: site requires: + HTML::Parser: 3.45 HTML::TreeBuilder: 3.12 Petal: 1.10 From bruno at mkdoc.demon.co.uk Wed Jan 26 13:19:54 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Wed Jan 26 13:19:36 2005 Subject: [MKDoc-commit] Patch to add user-group functionality (Sam Tregar). Message-ID: <20050126131954.E71632E28E2@mkdoc.demon.co.uk> Log Message: ----------- Patch to add user-group functionality (Sam Tregar). Note: 3 SQL tables need to be created to avoid breaking existing sites. Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/MKDoc/Site/ConfigWriter: Httpd_Conf.pm mkd/MKDoc/Site/Deploy/DB: Schema.pm mkd/flo/plugin/Admin: UserDelete.pm UserInsert.pm UserModify.pm mkd/templates/admin/user_insert: en.html mkd/templates/admin/user_modify: en.html Added Files: ----------- mkd/MKDoc/Handler: GroupAuthz.pm -------------- next part -------------- --- /dev/null +++ MKDoc/Handler/GroupAuthz.pm @@ -0,0 +1,123 @@ +# ---------------------------------------------------------------------------- +# MKDoc::Handler::GroupAuthz +# ---------------------------------------------------------------------------- +# Author: Sam Tregar +# Copyright: (c) MKDoc Holdings Ltd, 2005 +# +# This file is part of MKDoc. +# +# MKDoc is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# MKDoc is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with MKDoc; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# --------------------------------------------------------------------------- +package MKDoc::Handler::GroupAuthz; +use strict; +use warnings; +use Apache::Constants qw/:common/; +use flo::Standard; +use strict; +use Carp; + +=head1 NAME + +MKDoc::Handler::GroupAuthz - enforce group-based security + +=head1 SYNOPSIS + +In httpd.conf for an authenticating host (like the default users.* setup): + + PerlAuthzHandler MKDoc::Handler::GroupAuthz + +In httpd.conf for a non-authenticating host (like the default www.* setup): + + + PerlModule MKDoc::Handler::GroupAuthz + PerlAuthenHandler MKDoc::Handler::GroupAuthz->null_authen_handler + PerlAuthzHandler MKDoc::Handler::GroupAuthz + AuthName "Group Authorization" + AuthType GroupAuthz + require valid-group + + +=head1 DESCRIPTION + +Checks for group authorization in MKDoc's Grp tables. If the document +requested is assigned to one or more groups in Document_Grp then the +user must be assigned to one of the groups in Editor_Grp. + +Users may be assigned to groups in the user editor by the admin. +Groups are managed directly in the database (for now). + +=head1 AUTHOR + +Sam Tregar + +=cut + +sub handler { + my $r = shift; + my $user = $::MKD_USER; + + # get the current document, locally setting PATH_INFO which is + # needed by the current_document() code but not yet setup by + # Apache at this stage + my $document = do { + local $ENV{PATH_INFO} = $r->path_info; + flo::Standard::current_document(); + }; + + # if it wasn't found then this request can't be group protected + # (could be a CSS link, an image, etc) + return OK unless $document; + + # check if this document is assigned to one or more groups + my $document_grp_t = flo::Standard::table('Document_Grp'); + my @res = $document_grp_t->select ( + cols => 'Grp_ID', + where => lib::sql::Condition->new(Document_ID => $document->id) + )->fetch_all(); + + # no results means this document is available to all + return OK unless @res; + + # if the user isn't correctly logged in then they can't see this + # page + return FORBIDDEN unless $user and ref $user and $user->can('id'); + + # get a list of the user's groups. (It would be nice to just do a + # query against Editor_Grp like (editor_id = ? AND (grp_id = ? OR + # ...)) but I can't figure out how to get lib::sql to do anything + # that complicated. SQL replacements are great, huh?) + my $editor_grp_t = flo::Standard::table('Editor_Grp'); + my $con = lib::sql::Condition->new(Editor_ID => $user->id); + my @groups = $editor_grp_t->select(cols => 'Grp_ID', + where => $con)->fetch_all; + + # no results means the user wasn't in any of the groups, denied + return FORBIDDEN unless @groups; + + # allow through if the user is in one of the document's groups + my %groups = map { ($_->{Grp_ID}, 1) } @groups; + return OK if grep { $groups{$_->{Grp_ID}} } @res; + + # otherwise, no dice + return FORBIDDEN; +} + +# an authen handler that does nothing. This is needed to allow the +# group authz mechanism to work on www.* which doesn't do +# authentication. +sub null_authen_handler ($$) { OK } + +1; Index: Httpd_Conf.pm =================================================================== RCS file: /var/spool/cvs/mkd/MKDoc/Site/ConfigWriter/Httpd_Conf.pm,v retrieving revision 1.1.2.28 retrieving revision 1.1.2.29 diff -LMKDoc/Site/ConfigWriter/Httpd_Conf.pm -LMKDoc/Site/ConfigWriter/Httpd_Conf.pm -u -r1.1.2.28 -r1.1.2.29 --- MKDoc/Site/ConfigWriter/Httpd_Conf.pm +++ MKDoc/Site/ConfigWriter/Httpd_Conf.pm @@ -208,6 +208,7 @@ #Editor: vim:syn=apache PerlAuthenHandler MKDoc::Handler::Authenticate + PerlAuthzHandler MKDoc::Handler::GroupAuthz AuthName "Please enter your user credentials" AuthType Basic require valid-user @@ -239,6 +240,16 @@ PerlInitHandler MKDoc::Handler::Initialize Include $SITE_DIR/httpd/httpd-static.conf Include $SITE_DIR/httpd/httpd-mkdoc.conf + + + PerlModule MKDoc::Handler::GroupAuthz + PerlAuthenHandler MKDoc::Handler::GroupAuthz->null_authen_handler + PerlAuthzHandler MKDoc::Handler::GroupAuthz + AuthName "Group Authorization" + AuthType GroupAuthz + require valid-group + + Index: Schema.pm =================================================================== RCS file: /var/spool/cvs/mkd/MKDoc/Site/Deploy/DB/Schema.pm,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -LMKDoc/Site/Deploy/DB/Schema.pm -LMKDoc/Site/Deploy/DB/Schema.pm -u -r1.1.2.6 -r1.1.2.7 --- MKDoc/Site/Deploy/DB/Schema.pm +++ MKDoc/Site/Deploy/DB/Schema.pm @@ -364,6 +364,63 @@ fk => { Document => { Document_ID => 'ID' } }, ); +## GRP TABLE - holds user groups. (The table can't be named Group +## because group is a reserved word in SQL.) +new lib::sql::Table + ( + name => 'Grp', + pk => [ 'ID' ], + ai => 1, + cols => [ + { name => 'ID', + type => lib::sql::type::Int->new( not_null => 1 ) }, + { name => 'Name', + type => lib::sql::type::Char->new( size => 255 ) }, + { name => 'Description', + type => lib::sql::type::Char->new( size => 255 ) }, + ] + ); + +## EDITOR GRP TABLE - holds assignments of editors (users) to +## groups. When a user is assigned to a group she can access +## documents assigned to that group. +new lib::sql::Table + ( + name => 'Editor_Grp', + pk => [ 'Editor_ID', 'Grp_ID' ], + cols => [ + { name => 'Editor_ID', + type => lib::sql::type::Int->new( not_null => 1 ) }, + { name => 'Grp_ID', + type => lib::sql::type::Int->new( not_null => 1 ) }, + ], + fk => { + Grp => { Grp_ID => 'ID' }, + Editor => { Editor_ID => 'ID' }, + }, + index => { ReverseGrpEditorIndex => [ 'Grp_ID', 'Editor_ID' ] }, + ); + +## DOCUMENT GRP TABLE - holds assignments of documents to groups. +## When a document is assigned to one or more groups only members of +## that group can access the document. +new lib::sql::Table + ( + name => 'Document_Grp', + pk => [ 'Document_ID', 'Grp_ID' ], + cols => [ + { name => 'Document_ID', + type => lib::sql::type::Int->new( not_null => 1 ) }, + { name => 'Grp_ID', + type => lib::sql::type::Int->new( not_null => 1 ) }, + ], + fk => { + Grp => { Grp_ID => 'ID' }, + Document => { Document_ID => 'ID' }, + }, + index => { ReverseGrpDocumentIndex => [ 'Grp_ID', 'Document_ID' ] }, + ); + 1; __END__ Index: UserDelete.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/plugin/Admin/UserDelete.pm,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -Lflo/plugin/Admin/UserDelete.pm -Lflo/plugin/Admin/UserDelete.pm -u -r1.1.2.4 -r1.1.2.5 --- flo/plugin/Admin/UserDelete.pm +++ flo/plugin/Admin/UserDelete.pm @@ -47,6 +47,11 @@ { my $self = shift; my $user_edit = $self->user_edit(); + + # clear grp assignments + my $editor_group_t = flo::Standard::table ('Editor_Grp'); + $editor_group_t->delete(Editor_ID => $user_edit->id); + $user_edit->delete(); use flo::plugin::Admin::UserList; Index: UserModify.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/plugin/Admin/UserModify.pm,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -Lflo/plugin/Admin/UserModify.pm -Lflo/plugin/Admin/UserModify.pm -u -r1.1.2.5 -r1.1.2.6 --- flo/plugin/Admin/UserModify.pm +++ flo/plugin/Admin/UserModify.pm @@ -70,6 +70,7 @@ $user_edit->save(); $self->insert_base_document ($user_edit->id()); + $self->insert_groups ($user_edit->id()); $self->{ok} = 1; return $self->http_get(); } @@ -88,6 +89,19 @@ $base_document_t->insert (Editor_ID => $id, Document_ID => $_) for (@base_documents); } +# create entries in Editor_Grp for group choices +sub insert_groups +{ + my ($self, $id) = @_; + my $cgi = flo::Standard::cgi(); + my @groups = $cgi->param('groups'); + + my $editor_group_t = flo::Standard::table ('Editor_Grp'); + $editor_group_t->delete(Editor_ID => $id); + $editor_group_t->insert(Editor_ID => $id, Grp_ID => $_) + for @groups; +} + sub documents { @@ -102,7 +116,20 @@ return wantarray ? @res : \@res; } +# return list of available groups for template +sub groups { + my $self = shift; + my $document_t = flo::Standard::table ('Grp'); + my @res = $document_t->select ( + cols => ['ID', 'Name' ], + sort => [ 'Name' ], + desc => 0, + )->fetch_all(); + return wantarray ? @res : \@res; +} + +# returns true if the document is selected, false if not sub is_selected { my $self = shift; @@ -114,5 +141,21 @@ return; } +# returns true if the group is selected, false if not +sub is_group_selected { + my ($self, $id) = @_; + + # look for a row for this editor and group in the Editor_Grp table + my $grp_t = flo::Standard::table ('Editor_Grp'); + my @res = $grp_t->select ( + cols => ['Grp_ID'], + where => lib::sql::Condition->new(Grp_ID => $id, + Editor_ID => $self->user_edit->id) + )->fetch_all(); + + return 1 if @res; + return; +} + 1; Index: UserInsert.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/plugin/Admin/UserInsert.pm,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -Lflo/plugin/Admin/UserInsert.pm -Lflo/plugin/Admin/UserInsert.pm -u -r1.1.2.3 -r1.1.2.4 --- flo/plugin/Admin/UserInsert.pm +++ flo/plugin/Admin/UserInsert.pm @@ -45,6 +45,7 @@ $self->has_errors() and return $self->http_get(); $self->insert_base_document ($user->id()); + $self->insert_groups ($user->id()); $self->{ok} = 1; $cgi->delete ($cgi->param()); @@ -64,6 +65,18 @@ $base_document_t->insert (Editor_ID => $id, Document_ID => $_) for (@base_documents); } +# create entries in Editor_Grp for group choices +sub insert_groups +{ + my ($self, $id) = @_; + my $cgi = flo::Standard::cgi(); + my @groups = $cgi->param('groups'); + + my $editor_group_t = flo::Standard::table ('Editor_Grp'); + $editor_group_t->delete(Editor_ID => $id); + $editor_group_t->insert(Editor_ID => $id, Grp_ID => $_) + for @groups; +} sub documents { @@ -78,6 +91,18 @@ return wantarray ? @res : \@res; } +# return list of available groups for template +sub groups { + my $self = shift; + my $document_t = flo::Standard::table ('Grp'); + my @res = $document_t->select ( + cols => ['ID', 'Name' ], + sort => [ 'Name' ], + desc => 0, + )->fetch_all(); + + return wantarray ? @res : \@res; +} sub is_selected { Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/admin/user_insert/Attic/en.html,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -Ltemplates/admin/user_insert/en.html -Ltemplates/admin/user_insert/en.html -u -r1.1.2.16 -r1.1.2.17 --- templates/admin/user_insert/en.html +++ templates/admin/user_insert/en.html @@ -292,6 +292,43 @@ + Users may belong to one or more groups. + You can use groups to restrict access to areas + of your site to groups of users. This restriction affects + both editing and viewing. To select multiple groups or + select no groups you might need to use the + Ctrl key. + + +
    + +

    + +

    + Accounts can be enabled, which means that they can be used, or disabled which means that they can't be used. Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/admin/user_modify/Attic/en.html,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -Ltemplates/admin/user_modify/en.html -Ltemplates/admin/user_modify/en.html -u -r1.1.2.16 -r1.1.2.17 --- templates/admin/user_modify/en.html +++ templates/admin/user_modify/en.html @@ -288,6 +288,44 @@ >/foo/bar/

    + +

    + + Users may belong to one or more groups. + You can use groups to restrict access to areas + of your site to groups of users. This restriction affects + both editing and viewing. To select multiple groups or + select no groups you might need to use the + Ctrl key. + + +
    + +

    Log Message: ----------- Add note about xmllint preferring numeric entities rather than html entities. Modified Files: -------------- Petal/lib/Petal: Cookbook.pod -------------- next part -------------- Index: Cookbook.pod =================================================================== RCS file: /var/spool/cvs/Petal/lib/Petal/Cookbook.pod,v retrieving revision 1.3 retrieving revision 1.4 diff -Llib/Petal/Cookbook.pod -Llib/Petal/Cookbook.pod -u -r1.3 -r1.4 --- lib/Petal/Cookbook.pod +++ lib/Petal/Cookbook.pod @@ -71,10 +71,11 @@ xmlns:petal="http://purl.org/petal/1.0/" xmlns:metal="http://purl.org/petal/1.0/"> -You may receive errors from xmllint about unknown entities such as nbsp. These -can be safely ignored. If you find a way to suppress these warnings, please -let us know. In the meantime, you can pass the output through grep to ignore -these bogus warnings:. +You may receive errors from xmllint about unknown entities such as  . +These can be safely ignored, though you can use the numeric version   +instead to keep xmllint happy. If you find a way to suppress these warnings, +please let us know. In the meantime, you can pass the output through grep to +ignore these bogus warnings:. xmllint --noout tmpl/contact_info.tmpl >& grep -v 'Entity' From bruno at mkdoc.demon.co.uk Wed Jan 26 15:47:48 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Wed Jan 26 15:47:30 2005 Subject: [MKDoc-commit] HTML::TreeBuilder hasn't been required for a loooong time Message-ID: <20050126154748.6D3972E28E2@mkdoc.demon.co.uk> Log Message: ----------- HTML::TreeBuilder hasn't been required for a loooong time Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd: INSTALL.TXT -------------- next part -------------- Index: INSTALL.TXT =================================================================== RCS file: /var/spool/cvs/mkd/INSTALL.TXT,v retrieving revision 1.3.2.30 retrieving revision 1.3.2.31 diff -LINSTALL.TXT -LINSTALL.TXT -u -r1.3.2.30 -r1.3.2.31 --- INSTALL.TXT +++ INSTALL.TXT @@ -160,7 +160,6 @@ Text::Unidecode Unicode::String Mail::IMAPClient - HTML::TreeBuilder Time::ParseDate XML::RSS Cache::Cache From chris at mkdoc.demon.co.uk Thu Jan 27 10:14:52 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Thu Jan 27 10:14:34 2005 Subject: [MKDoc-commit] New Directory Message-ID: <20050127101452.D2A0F2E28E2@mkdoc.demon.co.uk> Update of /var/spool/cvs/mkd/templates/account/preferences/audiences In directory devil.webarch.net:/tmp/cvs-serv14325/audiences Log Message: Directory /var/spool/cvs/mkd/templates/account/preferences/audiences added to the repository --> Using per-directory sticky tag `mkdoc-1-6' From chris at mkdoc.demon.co.uk Thu Jan 27 10:15:15 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Thu Jan 27 10:14:57 2005 Subject: [MKDoc-commit] Audiences split into a seperate file Message-ID: <20050127101515.F05FB2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Audiences split into a seperate file Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/account/preferences: en.html Added Files: ----------- mkd/templates/account/preferences/audiences: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/account/preferences/Attic/en.html,v retrieving revision 1.3.2.34 retrieving revision 1.3.2.35 diff -Ltemplates/account/preferences/en.html -Ltemplates/account/preferences/en.html -u -r1.3.2.34 -r1.3.2.35 --- templates/account/preferences/en.html +++ templates/account/preferences/en.html @@ -557,74 +557,8 @@ -

    - - - Audience Preferences - - -

    - This section of the form allows you to indicate which audience keywords - best describe your interests. This information is used to generate - customised email newsletters and listings of documents on the site. -

    - - -
    -

    - -
    - - -

    - -
    -
    + +
    +
    + + + Audience Preferences + + +

    + This section of the form allows you to indicate which audience keywords + best describe your interests. This information is used to generate + customised email newsletters and listings of documents on the site. +

    + + +
    +

    + +
    + + +

    + +
    +
    From chris at mkdoc.demon.co.uk Thu Jan 27 10:33:52 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Thu Jan 27 10:33:35 2005 Subject: [MKDoc-commit] Omit tag on span added for XHTML validity Message-ID: <20050127103352.E1FF92E28E2@mkdoc.demon.co.uk> Log Message: ----------- Omit tag on span added for XHTML validity Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/account/preferences/audiences: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/account/preferences/audiences/Attic/en.html,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -Ltemplates/account/preferences/audiences/en.html -Ltemplates/account/preferences/audiences/en.html -u -r1.1.2.1 -r1.1.2.2 --- templates/account/preferences/audiences/en.html +++ templates/account/preferences/audiences/en.html @@ -51,6 +51,7 @@
    From chris at mkdoc.demon.co.uk Fri Jan 28 11:16:51 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Fri Jan 28 11:16:32 2005 Subject: [MKDoc-commit] Audiences preferences moved to the end of the form Message-ID: <20050128111651.E93AB2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Audiences preferences moved to the end of the form Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/account/preferences: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/account/preferences/Attic/en.html,v retrieving revision 1.3.2.35 retrieving revision 1.3.2.36 diff -Ltemplates/account/preferences/en.html -Ltemplates/account/preferences/en.html -u -r1.3.2.35 -r1.3.2.36 --- templates/account/preferences/en.html +++ templates/account/preferences/en.html @@ -209,20 +209,20 @@ href="#newsletter-preferences" >Newsletter Preferences | Audience Preferences | + href="#language-preferences" + >Language Preferences | Language Preferences + href="#audience-preferences" + >Audience Preferences

    @@ -557,9 +557,6 @@ - - -
    + + +

    Log Message: ----------- Moved prefixed audiences into seperate fieldsets but un prefixed ones not in an extra fieldset now... Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/account/preferences/audiences: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/account/preferences/audiences/Attic/en.html,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -Ltemplates/account/preferences/audiences/en.html -Ltemplates/account/preferences/audiences/en.html -u -r1.1.2.3 -r1.1.2.4 --- templates/account/preferences/audiences/en.html +++ templates/account/preferences/audiences/en.html @@ -25,70 +25,119 @@ customised email newsletters and listings of documents on the site.

    -
    - Fruit + +
    +

    + +
    + + +

    + +
    - Miscellaneous +
    -
    -

    - -
    - - -

    - + +
    + + +

    +
    + - + From chris at mkdoc.demon.co.uk Fri Jan 28 11:51:22 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Fri Jan 28 11:51:01 2005 Subject: [MKDoc-commit] true: added Message-ID: <20050128115122.20A8C2E28E2@mkdoc.demon.co.uk> Log Message: ----------- true: added Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/account/preferences/audiences: en.html -------------- next part -------------- Index: en.html =================================================================== RCS file: /var/spool/cvs/mkd/templates/account/preferences/audiences/Attic/en.html,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -Ltemplates/account/preferences/audiences/en.html -Ltemplates/account/preferences/audiences/en.html -u -r1.1.2.4 -r1.1.2.5 --- templates/account/preferences/audiences/en.html +++ templates/account/preferences/audiences/en.html @@ -58,15 +58,15 @@ petal:repeat="option self/preferences/audience_options $current_val" > @@ -122,15 +122,15 @@ petal:repeat="option self/preferences/audience_options $current_val" > From bruno at mkdoc.demon.co.uk Fri Jan 28 18:52:26 2005 From: bruno at mkdoc.demon.co.uk (bruno@mkdoc.demon.co.uk) Date: Fri Jan 28 18:52:06 2005 Subject: [MKDoc-commit] [1.6] fix config: petal errors Message-ID: <20050128185226.3B0C82E28E2@mkdoc.demon.co.uk> Log Message: ----------- [1.6] fix config: petal errors Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/flo: Object.pm -------------- next part -------------- Index: Object.pm =================================================================== RCS file: /var/spool/cvs/mkd/flo/Attic/Object.pm,v retrieving revision 1.4.2.4 retrieving revision 1.4.2.5 diff -Lflo/Object.pm -Lflo/Object.pm -u -r1.4.2.4 -r1.4.2.5 --- flo/Object.pm +++ flo/Object.pm @@ -32,6 +32,12 @@ use strict; use CGI::Carp; +$Petal::Hash::MODIFIERS->{'config:'} = sub { + my $hash = shift; + my $key = shift; + return MKDoc::Config->$key(); +}; + ## # $class->config; From chris at mkdoc.demon.co.uk Mon Jan 31 14:11:16 2005 From: chris at mkdoc.demon.co.uk (chris@mkdoc.demon.co.uk) Date: Mon Jan 31 14:10:56 2005 Subject: [MKDoc-commit] Bug fix to make copyright info appear in the rdf metedata file Message-ID: <20050131141116.B3ADD2E28E2@mkdoc.demon.co.uk> Log Message: ----------- Bug fix to make copyright info appear in the rdf metedata file Tags: ---- mkdoc-1-6 Modified Files: -------------- mkd/templates/metadata: dcq.rdf.xml -------------- next part -------------- Index: dcq.rdf.xml =================================================================== RCS file: /var/spool/cvs/mkd/templates/metadata/Attic/dcq.rdf.xml,v retrieving revision 1.9.2.9 retrieving revision 1.9.2.10 diff -Ltemplates/metadata/dcq.rdf.xml -Ltemplates/metadata/dcq.rdf.xml -u -r1.9.2.9 -r1.9.2.10 --- templates/metadata/dcq.rdf.xml +++ templates/metadata/dcq.rdf.xml @@ -180,9 +180,9 @@