Changeset 941


Ignore:
Timestamp:
Mar 17, 2007, 3:05:27 PM (15 years ago)
Author:
kake
Message:

Add config option to omit recent changes from home page (ticket #187).

Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r937 r941  
    4141   qw(use_plucene enable_page_deletion navbar_on_home_page backlinks_in_title
    4242      moderation_requires_password enable_node_image enable_common_categories
    43       enable_common_locales);
     43      enable_common_locales recent_changes_on_home_page);
    4444
    4545my $skip_config = Module::Build->y_n("Skip OpenGuides configuration?", "n");
     
    9494   install_directory template_path custom_template_path script_url
    9595   custom_lib_path use_plucene indexing_directory enable_page_deletion
    96    admin_pass stylesheet_url site_name navbar_on_home_page home_name
     96   admin_pass stylesheet_url site_name navbar_on_home_page
     97   recent_changes_on_home_page home_name
    9798   site_desc default_city default_country contact_email default_language
    9899   formatting_rules_node backlinks_in_title gmaps_api_key centre_long
  • trunk/Changes

    r937 r941  
    1313        Let people add name of copyright holder, licence URL, and info page
    1414          URL for node images (#179).
     15        Add config option to omit recent changes from home page.
    1516        Write tests for and fix:
    1617          #48 (Edit conflict page erroneously converts lat/lon to os_x, os_y).
  • trunk/INSTALL

    r886 r941  
    149149
    150150  "Do you want the navigation bar included on the home page?"
     151
     152Answer "y" or "n".
     153
     154
     155  "Do you want the ten most recent changes included on the home page?"
    151156
    152157Answer "y" or "n".
  • trunk/MANIFEST

    r938 r941  
    9898t/43_preview_edits.t
    9999t/44_node_image.t
     100t/45_home_recent_changes.t
    100101t/51_display_node.t
    101102t/52_display_diffs.t
  • trunk/README.CSS

    r937 r941  
    139139    Purpose: Recent changes summary box on the home node
    140140
     141div#home_page_edit_link
     142    Used in: home_node.tt
     143    Purpose: "Edit this page" link on the home node - only displayed if neither
     144    the navbar or the recent changes box are shown, since both those divs also
     145    contain an edit link.
     146
    141147div#search_form
    142148    Used in: footer.tt
  • trunk/lib/OpenGuides.pm

    r934 r941  
    285285        $self->display_recent_changes(%args);
    286286    } elsif ( $id eq $self->config->home_name ) {
    287         my @recent = $wiki->list_recent_changes(
    288             last_n_changes => 10,
    289             metadata_was   => { edit_type => "Normal edit" },
    290         );
    291         @recent = map {
    292                           {
     287        if ( $self->config->recent_changes_on_home_page ) {
     288            my @recent = $wiki->list_recent_changes(
     289                last_n_changes => 10,
     290                metadata_was   => { edit_type => "Normal edit" },
     291            );
     292            @recent = map {
     293                            {
    293294                              name          => CGI->escapeHTML($_->{name}),
    294                               last_modified => CGI->escapeHTML($_->{last_modified}),
     295                              last_modified =>
     296                                  CGI->escapeHTML($_->{last_modified}),
    295297                              version       => CGI->escapeHTML($_->{version}),
    296                               comment       => CGI->escapeHTML($_->{metadata}{comment}[0]),
    297                               username      => CGI->escapeHTML($_->{metadata}{username}[0]),
     298                              comment       =>
     299                                  CGI->escapeHTML($_->{metadata}{comment}[0]),
     300                              username      =>
     301                                  CGI->escapeHTML($_->{metadata}{username}[0]),
    298302                              url           => $config->script_name . "?"
    299                                                . CGI->escape($wiki->formatter->node_name_to_node_param($_->{name}))
    300                           }
    301                       } @recent;
    302         $tt_vars{recent_changes} = \@recent;
     303                                             . CGI->escape($wiki->formatter->node_name_to_node_param($_->{name}))
     304                            }
     305                          } @recent;
     306            $tt_vars{recent_changes} = \@recent;
     307        }
    303308        return %tt_vars if $args{return_tt_vars};
    304309        my $output = $self->process_template(
  • trunk/lib/OpenGuides/Config.pm

    r911 r941  
    1010   script_name install_directory script_url
    1111   custom_lib_path use_plucene indexing_directory enable_page_deletion
    12    admin_pass stylesheet_url site_name navbar_on_home_page home_name
     12   admin_pass stylesheet_url site_name navbar_on_home_page
     13   recent_changes_on_home_page home_name
    1314   site_desc default_city default_country contact_email
    1415   default_language http_charset ping_services
     
    7980                     site_name => "Unconfigured OpenGuides site",
    8081                     navbar_on_home_page => 1,
     82                     recent_changes_on_home_page => 1,
    8183                     home_name => "Home",
    8284                     site_desc => "A default configuration of OpenGuides",
     
    152154        site_name => "What's the site called? (should be unique)",
    153155        navbar_on_home_page => "Do you want the navigation bar included on the home page?",
     156        recent_changes_on_home_page => "Do you want the ten most recent "
     157          . "changes included on the home page?",
    154158        home_name => "What should the home page of the wiki be called?",
    155159        site_desc => "How would you describe the site?",
     
    240244=item * navbar_on_home_page (default: true)
    241245
     246=item * recent_changes_on_home_page (default: true)
     247
    242248=item * home_name (default: C<Home>)
    243249
     
    290296=head1 COPYRIGHT
    291297
    292      Copyright (C) 2004-2006 The OpenGuides Project.  All Rights Reserved.
     298     Copyright (C) 2004-2007 The OpenGuides Project.  All Rights Reserved.
    293299
    294300The OpenGuides distribution is free software; you can redistribute it
  • trunk/t/51_display_node.t

    r785 r941  
    3838    is( $@, "", "->display_node doesn't die" );
    3939
    40     like( $output, qr{\<a.*?\Qhref="alternate.cgi?id=Test_Page;action=edit">Edit this page</a>\E}, "...and edit link is redirected to source URL" );
     40    like( $output, qr{\<a.*?\Qhref="alternate.cgi?id=Test_Page;action=edit"\E>Edit\s+this\s+page</a>}, "...and edit link is redirected to source URL" );
    4141    $config->home_name( "My Home Page" );
    4242    $output = $guide->display_node( return_output => 1 );
    43     like( $output, qr/My Home Page/, "...and defaults to the home node, and takes notice of what we want to call it" );
    44     like( $output, qr{\Q<a href="wiki.cgi?action=edit;id=My_Home_Page">Edit this page</a>\E}, "...and home page has an edit link" );
     43    like( $output, qr/My\s+Home\s+Page/, "...and defaults to the home node, and takes notice of what we want to call it" );
     44    like( $output, qr{\Q<a href="wiki.cgi?action=edit;id=My_Home_Page"\E>Edit\s+this\s+page</a>}, "...and home page has an edit link" );
    4545    my %tt_vars = $guide->display_node( return_tt_vars => 1 );
    4646    ok( defined $tt_vars{recent_changes}, "...and recent_changes is set for the home node even if we have changed its name" );
  • trunk/templates/home_node.tt

    r756 r941  
    2424[% END %]
    2525
     26[% IF !navbar_on_home_page AND !config.recent_changes_on_home_page %]
     27  <div id="home_page_edit_link">
     28    <a href="[% cgi_url %]?action=edit;id=[% node_param %]">Edit this page</a>
     29  </div>
     30[% END %]
     31
    2632<div id="maincontent">
    27 <div id="recent">
     33  [% IF config.recent_changes_on_home_page %]
     34    <div id="recent">
    2835
    29 <h3>Ten most <a href="[% cgi_url %]?action=rc">recent changes</a>
    30     (<a href="[% full_cgi_url %]?action=rc;format=rss">RSS</a>):</h3>
     36      <h3>Ten most <a href="[% cgi_url %]?action=rc">recent changes</a>
     37          (<a href="[% full_cgi_url %]?action=rc;format=rss">RSS</a>):</h3>
    3138
    32 <dl>
    33   [% FOREACH node = recent_changes %]
    34   <dt><a href="[% node.url %]">[% node.name %]</a>
    35   [% IF node.version == "1" %]
    36     [new]
     39      <dl>
     40        [% FOREACH node = recent_changes %]
     41          <dt><a href="[% node.url %]">[% node.name %]</a>
     42            [% IF node.version == "1" %]
     43              [new]
     44            [% END %]
     45          </dt>
     46          [% IF node.comment or node.username %]
     47            <dd>
     48              [% node.comment %]
     49              [% IF node.username %]
     50                <b><small>([% node.username %])</small></b>
     51              [% END %]
     52            </dd>
     53          [% END %]
     54        [% END %]
     55      </dl>
     56
     57      <p><b><a href="[% cgi_url %]?action=edit;id=[% node_param %]">Edit
     58      this page</a></b></p>
     59
     60    </div>
    3761  [% END %]
    38   </dt>
    39   [% IF node.comment or node.username %]
    40     <dd>
    41       [% node.comment %]
    42       [% IF node.username %]
    43         <b><small>([% node.username %])</small></b>
    44       [% END %]
    45     </dd>
    46   [% END %]
    47 [% END %]
    48 </dl>
    4962
    50 <p><b><a href="[% cgi_url %]?action=edit;id=[% node_param %]">Edit this page</a></b></p>
    51 
    52 </div>
    53 [% content %]
     63  [% content %]
    5464
    5565</div>
Note: See TracChangeset for help on using the changeset viewer.