Changeset 739


Ignore:
Timestamp:
Mar 5, 2006, 11:53:09 AM (16 years ago)
Author:
Ivor Williams
Message:

Closes #87 Editing a mirrored page now edits on source site

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r738 r739  
    1515        Fix mod_perl redirect bug.
    1616        Fix test failure with CGI.pm 3.16.
     17        #87 Edit on mirrored pages now goes to source site
    1718
    18190.51    15 November 2005
  • trunk/lib/OpenGuides/Template.pm

    r730 r739  
    305305    );
    306306
     307    if (exists $metadata{source}) {
     308        ($vars{source_site}) = $metadata{source}[0] =~ /^(.*?)(?:\?|$)/;
     309    }
     310   
    307311    if ( $args{metadata} ) {
    308312        foreach my $var ( qw( phone fax address postcode os_x os_y osie_x
  • trunk/t/51_display_node.t

    r594 r739  
    33use OpenGuides::Config;
    44use OpenGuides;
    5 use Test::More tests => 5;
     5use Test::More tests => 7;
    66
    77eval { require DBD::SQLite; };
     
    3232    my $wiki = $guide->wiki;
    3333    isa_ok( $wiki, "CGI::Wiki" );
    34     $wiki->write_node( "Test Page", "foo" );
     34    $wiki->write_node( "Test Page", "foo", undef, { source => "alternate.cgi?Test_Page" } );
    3535    my $output = eval {
    3636        $guide->display_node( id => "Test Page", return_output => 1 );
     
    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" );
    4041    $config->home_name( "My Home Page" );
    4142    $output = $guide->display_node( return_output => 1 );
    4243    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" );
    4345    my %tt_vars = $guide->display_node( return_tt_vars => 1 );
    4446    ok( defined $tt_vars{recent_changes}, "...and recent_changes is set for the home node even if we have changed its name" );
  • trunk/templates/map_index.tt

    r731 r739  
    3636          var point[% i %] = new GPoint([% metadata.longitude.list.first %], [% metadata.latitude.list.first %]);
    3737          var marker[% i %] = new GMarker(point[% i %],baseIcon);
    38           var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a>&nbsp;<a style='text-decoration:none;' href=\"?id=[% node.param %];action=edit\">(edit)</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]";
     38          [% IF metadata.source %]
     39            [% source_url = metadata.source.list.first.match('^(.*?)\?(?:\?|$)').first %]
     40          [% END %]
     41          var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a>&nbsp;<a style='text-decoration:none;' href=\"%[ source_url %]?id=[% node.param %];action=edit\">(edit)</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]";
    3942          GEvent.addListener(marker[% i %], "click", function() {
    4043            marker[% i %].openInfoWindowHtml(htmlString[% i %]);
  • trunk/templates/navbar.tt

    r716 r739  
    5555
    5656    <ul>
    57       <li><a class="edit_page_link" href="[% full_cgi_url %]?id=[% node_param %];action=edit">Edit this page</a></li>
     57      <li><a class="edit_page_link" href="[% source_site or full_cgi_url %]?id=[% node_param %];action=edit">Edit this page</a></li>
    5858      <li><a href="[% cgi_url %]?action=show_backlinks;id=[% node_param %]">Show pages linking here</a></li>
    5959      [% IF version AND version > 1 %]
Note: See TracChangeset for help on using the changeset viewer.