Changeset 309


Ignore:
Timestamp:
Dec 29, 2003, 2:29:25 PM (18 years ago)
Author:
kake
Message:

Page deletion must now be explicitly enabled in wiki.conf. Added some deletion-related tests. Sorted out PREREQUISITES.

Location:
trunk
Files:
3 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r308 r309  
    4343  variable => "indexing_directory",
    4444  default  => "/usr/lib/cgi-bin/openguides/indexes/"
     45  },
     46{ question => "Do you want to enable page deletion?",
     47  variable => "enable_page_deletion",
     48  default  => "n",
     49  type     => "y_n"
    4550  },
    4651{ question => "What's the URL of the wiki's stylesheet?",
     
    160165    unless ( $skip_config ) {
    161166        if ( $type eq "y_n" ) {
    162             $def = $def ? "y" : "n";
     167            # may be stored as true/false integer value
     168            if ( $def =~ /^\d+$/ ) {
     169                $def = $def ? "y" : "n";
     170            }
    163171            $val = Module::Build->y_n("\n$qu ", $def);
    164172        } else {
     
    194202#####
    195203##### When updating the prereqs PLEASE REMEMBER to update PREREQUISITES.
     204##### Ivor, this means you too.
    196205#####
    197206
  • trunk/Changes

    r308 r309  
    1 0.30   
    2         Added method for adminds to delete nodes.
    3         Major overhaul of templates. Added numerous style hooks and replaced
    4           Oxford Guide stylesheet in examples/ with generic wiki.css that
    5           takes advantage of them. Added new banner template for page
    6           headers. Also ensured presence of navigation bar is consistent.
     10.30    29 December 2003
     2        Added method to allow admins to delete nodes.  You will need to
     3          explicitly enable this option in your wiki.conf, since it brings
     4          with it the risk of accidental data loss.
     5        Major overhaul of templates - added numerous style hooks.  See
     6          examples/ for two stylesheet designs that take advantage of these.
     7          Added new banner template for page headers. Also ensured presence
     8          of navigation bar is consistent.
    79          *** INCOMPATIBLE CHANGE: *** The navbar class in the stylesheet
    810          has been renamed to, unsurprisingly, "navbar", for consistency
    9           (from "toolbar"). You are advised to create a duplicate wiki.cgi
    10           that reads its data from your database but its stylesheet and
    11           templates from the new ones in order to test them *before*
    12           deploying them.
     11          (from "toolbar"). *** YOU WILL NEED TO REWRITE YOUR STYLESHEET. ***
     12          You are advised to create a duplicate wiki.cgi that reads its data
     13          from your database but its stylesheet and templates from the new
     14          ones in order to test them *before* deploying them.
    1315        Added "FAQ", "How To Get Started" and "Wiki Etiquette" to the
    1416          navigation, under "Help" - these won't exist unless you create them
  • trunk/INSTALL

    r308 r309  
    9292
    9393
     94  "Do you want to enable page deletion?"
     95
     96The default is to disable page deletion.  If you choose to enable the
     97page deletion mechanism then you will need to add a password to your
     98wiki.conf using a line such as
     99  admin_pass = putyourpasswordhere
     100Users who know this password will be able to delete unwanted pages -
     101along with all their history - from your wiki.
     102*** USE WITH CAUTION.  DELETED PAGES CANNOT BE RECOVERED. ***
     103
     104
    94105  "What's the URL of the wiki's stylesheet?"
    95106
    96 Supplying an answer to this question is optional.  There is an example
    97 stylesheet in the examples/ directory - note that this will not be
     107Supplying an answer to this question is optional.  There are example
     108stylesheets in the examples/ directory - note that these will not be
    98109automatically installed.
    99110
  • trunk/MANIFEST

    r308 r309  
    5757t/31_supersearch.t
    5858t/32_supersearch_simple_metadata.t
     59t/41_deletion.t
    5960t/51_diff.t
    6061t/61_bug_textareas.t
  • trunk/PREREQUISITES

    r308 r309  
    99CGI::Wiki::Formatter::UseMod (version 0.09 or later)
    1010CGI::Wiki::Plugin::Categoriser
     11CGI::Wiki::Plugin::Diff
    1112CGI::Wiki::Plugin::GeoCache
    1213CGI::Wiki::Plugin::Locator::UK (version 0.06 or later)
     
    3031Time::Piece
    3132URI::Escape
    32 VCS::Lite (version 0.04 or later)
  • trunk/lib/OpenGuides.pm

    r308 r309  
    44use vars qw( $VERSION );
    55
    6 $VERSION = '0.30_01';
     6$VERSION = '0.30';
    77
    88=head1 NAME
  • trunk/lib/OpenGuides/Template.pm

    r308 r309  
    7373=item * C<full_cgi_url>
    7474
     75=item * C<enable_page_deletion> (gets set to true or false - defaults to false)
     76
    7577=item * C<contact_email>
    7678
     
    123125        $formatting_rules_link = $script_url . $script_name . "?"
    124126                               . uri_escape($args{wiki}->formatter->node_name_to_node_param($formatting_rules_node));
     127    }
     128
     129    my $enable_page_deletion = 0;
     130    if ( $config->{_}->{enable_page_deletion}
     131         and ( lc($config->{_}->{enable_page_deletion}) eq "y"
     132               or $config->{_}->{enable_page_deletion} eq "1" )
     133       ) {
     134        $enable_page_deletion = 1;
    125135    }
    126136
     
    136146                    formatting_rules_node => $formatting_rules_node,
    137147                    openguides_version    => $OpenGuides::VERSION,
     148                    enable_page_deletion  => $enable_page_deletion,
    138149    };
    139150
  • trunk/t/15_template.t

    r308 r309  
    11use strict;
    2 use Test::More tests => 23;
     2use Test::More tests => 28;
    33use Config::Tiny;
    44use Cwd;
     
    150150like( $output, qr/OMIT FORMATTING LINK: fish/,
    151151      "explicitly supplied TT vars override cookie ones" );
     152
     153# Test that enable_page_deletion is set correctly in various circumstances.
     154$config = Config::Tiny->new;
     155$config->{_}->{template_path} = cwd . "/t/templates";
     156$config->{_}->{site_name} = "Test Site";
     157
     158$output = OpenGuides::Template->output(
     159    wiki     => $fake_wiki,
     160    config   => $config,
     161    template => "15_test.tt",
     162);
     163like( $output, qr/ENABLE PAGE DELETION: 0/,
     164      "enable_page_deletion var set correctly when not specified in conf" );
     165
     166$config->{_}->{enable_page_deletion} = "n";
     167$output = OpenGuides::Template->output(
     168    wiki     => $fake_wiki,
     169    config   => $config,
     170    template => "15_test.tt",
     171);
     172like( $output, qr/ENABLE PAGE DELETION: 0/,
     173      "enable_page_deletion var set correctly when set to 'n' in conf" );
     174
     175$config->{_}->{enable_page_deletion} = "y";
     176$output = OpenGuides::Template->output(
     177    wiki     => $fake_wiki,
     178    config   => $config,
     179    template => "15_test.tt",
     180);
     181like( $output, qr/ENABLE PAGE DELETION: 1/,
     182      "enable_page_deletion var set correctly when set to 'y' in conf" );
     183
     184$config->{_}->{enable_page_deletion} = 0;
     185$output = OpenGuides::Template->output(
     186    wiki     => $fake_wiki,
     187    config   => $config,
     188    template => "15_test.tt",
     189);
     190like( $output, qr/ENABLE PAGE DELETION: 0/,
     191      "enable_page_deletion var set correctly when set to '0' in conf" );
     192
     193$config->{_}->{enable_page_deletion} = 1;
     194$output = OpenGuides::Template->output(
     195    wiki     => $fake_wiki,
     196    config   => $config,
     197    template => "15_test.tt",
     198);
     199like( $output, qr/ENABLE PAGE DELETION: 1/,
     200      "enable_page_deletion var set correctly when set to '1' in conf" );
  • trunk/t/templates/15_test.tt

    r308 r309  
    1616FORMATTING RULES LINK: [% formatting_rules_link %]
    1717OMIT FORMATTING LINK: [% omit_formatting_link %]
     18
     19ENABLE PAGE DELETION: [% enable_page_deletion %]
  • trunk/templates/footer.tt

    r308 r309  
    77</div>
    88<div id="footer">
    9 <p>
    10 <a href="[% full_cgi_url %]?id=[% node_param %];action=delete">Delete page</a> (admins only)
    11 </p>
     9[% IF enable_page_deletion %]
     10  <p>
     11  <a href="[% full_cgi_url %]?id=[% node_param %];action=delete">Delete page</a> (admins only)
     12  </p>
     13[% END %]
    1214<p>
    1315This wiki powered by <a
  • trunk/wiki.cgi

    r308 r309  
    55
    66use vars qw( $VERSION );
    7 $VERSION = '0.30_02';
     7$VERSION = '0.30';
    88
    99use CGI qw/:standard/;
     
    106106                           origin_param => $formatter->node_name_to_node_param($node),
    107107                           limit  => "$metres metres" } );
    108     } elsif ($action eq 'delete') {
     108    } elsif ( $action eq 'delete'
     109              and ( lc($config->{_}->{enable_page_deletion}) eq "y"
     110                    or $config->{_}->{enable_page_deletion} eq "1" )
     111            ) {
    109112        delete_node($node);
    110113    } elsif ($action eq 'userstats') {
Note: See TracChangeset for help on using the changeset viewer.