Author: nick Date: 2006-08-24 16:45:37 +0100 (Thu, 24 Aug 2006) New Revision: 841
Modified: trunk/Changes trunk/lib/OpenGuides.pm trunk/lib/OpenGuides/Config.pm trunk/lib/OpenGuides/Template.pm trunk/t/17_commit_node.t trunk/templates/edit_form.tt trunk/wiki.cgi Log: Fix a typo, and support the node image for editing (but not yet display)
Modified: trunk/Changes =================================================================== --- trunk/Changes 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/Changes 2006-08-24 15:45:37 UTC (rev 841) @@ -5,7 +5,7 @@ Nodes missing metadata interface Moderation support (based on Wiki::Toolkit moderation) Four new config file options: moderation_requires_password, - enabled_node_image, enable_common_categories, enable_common_locales + enable_node_image, enable_common_categories, enable_common_locales Search::InvertedIndex support is deprecated as of this release. Please upgrade to Plucene if you are still using it.
Modified: trunk/lib/OpenGuides/Config.pm =================================================================== --- trunk/lib/OpenGuides/Config.pm 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/lib/OpenGuides/Config.pm 2006-08-24 15:45:37 UTC (rev 841) @@ -13,7 +13,7 @@ custom_template_path geo_handler ellipsoid gmaps_api_key centre_long centre_lat default_gmaps_zoom default_gmaps_search_zoom force_wgs84 licence_name licence_url licence_info_url moderation_requires_password - enabled_node_image enable_common_categories enable_common_locales + enable_node_image enable_common_categories enable_common_locales ); my @questions = map { $_ . "__qu" } @variables; OpenGuides::Config->mk_accessors( @variables ); @@ -69,7 +69,7 @@ enable_page_deletion => 0, moderation_requires_password => 1, admin_pass => "Change This!", - enabled_node_image => 1, + enable_node_image => 1, enable_common_categories => 1, enable_common_locales => 1, site_name => "Unconfigured OpenGuides site", @@ -138,7 +138,7 @@ moderation_requires_password => "Is the admin password required for moderating pages?", admin_pass => "Please specify a password for the site admin.", stylesheet_url => "What's the URL of the site's stylesheet?", - enabled_node_image => "Should nodes be allowed to have an externally hosted image?", + enable_node_image => "Should nodes be allowed to have an externally hosted image?", enable_common_categories => "Do you want a common list of categories shown on all node pages?", enable_common_locales => "Do you want a common list of locales shown on all node pages?", site_name => "What's the site called? (should be unique)",
Modified: trunk/lib/OpenGuides/Template.pm =================================================================== --- trunk/lib/OpenGuides/Template.pm 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/lib/OpenGuides/Template.pm 2006-08-24 15:45:37 UTC (rev 841) @@ -320,6 +320,12 @@ summary => $summary, );
+ my $node_image = $args{metadata} ? $metadata{node_image}[0] + : $q->param("node_image"); + if ($config->enable_node_image && $node_image) { + $vars{node_image} = $node_image; + } + if (exists $metadata{source}) { ($vars{source_site}) = $metadata{source}[0] =~ /^(.*?)(?:?|$)/; }
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/lib/OpenGuides.pm 2006-08-24 15:45:37 UTC (rev 841) @@ -973,7 +973,7 @@ my %metadata = OpenGuides::Template->extract_metadata_vars( wiki => $wiki, config => $config, - cgi_obj => $q + cgi_obj => $q );
delete $metadata{website} if $metadata{website} eq 'http://';
Modified: trunk/t/17_commit_node.t =================================================================== --- trunk/t/17_commit_node.t 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/t/17_commit_node.t 2006-08-24 15:45:37 UTC (rev 841) @@ -67,6 +67,7 @@ $q->param( -name => "os_y", -value => "" ); $q->param( -name => "username", -value => "bob" ); $q->param( -name => "comment", -value => "foo" ); +$q->param( -name => "node_image", -value => "image" ); $q->param( -name => "edit_type", -value => "Minor tidying" ); $ENV{REMOTE_ADDR} = "127.0.0.1";
Modified: trunk/templates/edit_form.tt =================================================================== --- trunk/templates/edit_form.tt 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/templates/edit_form.tt 2006-08-24 15:45:37 UTC (rev 841) @@ -58,7 +58,13 @@ <fieldset> <legend>Metadata (optional)</legend> <table summary="Form for entering metadata about the subject of this node"> +[% IF config.enable_node_image %] <tr> + <td class="label"><label for="node_image">Node Image:</label></td> + <td><input type="text" size="50" id="node_image" name="node_image" value="[% node_image %]" /></td> + </tr> +[% END %] + <tr> <td class="label"><label for="phone">Phone:</label></td> <td><input type="text" size="50" id="phone" name="phone" value="[% phone %]" /></td> </tr>
Modified: trunk/wiki.cgi =================================================================== --- trunk/wiki.cgi 2006-08-24 15:01:04 UTC (rev 840) +++ trunk/wiki.cgi 2006-08-24 15:45:37 UTC (rev 841) @@ -264,15 +264,17 @@ if ($wiki->verify_checksum($node, $checksum)) { my %tt_vars = ( %tt_metadata_vars, + config => $config, content => $q->escapeHTML($content), preview_html => $wiki->format($content), preview_above_edit_box => get_cookie( "preview_above_edit_box" ), checksum => $q->escapeHTML($checksum) - ); + ); process_template("edit_form.tt", $node, %tt_vars); } else { my %node_data = $wiki->retrieve_node($node); my %tt_vars = ( checksum => $node_data{checksum}, + config => $config, new_content => $content, stored_content => $node_data{content} ); foreach my $mdvar ( keys %tt_metadata_vars ) { @@ -312,7 +314,8 @@ my %tt_vars = ( content => $q->escapeHTML($content), checksum => $q->escapeHTML($checksum), %metadata_vars, - username => $username, + config => $config, + username => $username, edit_type => $edit_type, deter_robots => 1, );
openguides-commits@lists.openguides.org