Changeset 634


Ignore:
Timestamp:
May 27, 2005, 7:51:25 PM (17 years ago)
Author:
Earle Martin
Message:

fix RDF test failures; new redirection message

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides.pm

    r633 r634  
    143143    my $wiki = $self->wiki;
    144144    my $config = $self->config;
     145    my $oldid = $args{oldid} || '';
    145146
    146147    my %tt_vars;
     
    171172        # See if this is a valid node, if not then just show the page as-is.
    172173        if ( $wiki->node_exists($redirect) ) {
    173             my $output = $self->redirect_to_node($redirect);
     174            my $output = $self->redirect_to_node($redirect, $id);
    174175            return $output if $return_output;
    175176            print $output;
     
    194195                 node          => $id,
    195196                 language      => $config->default_language,
     197                 oldid         => $oldid,
    196198               );
    197199
     
    850852
    851853sub redirect_to_node {
    852     my ($self, $node) = @_;
     854    my ($self, $node, $redirect) = @_;
    853855    my $script_url = $self->config->script_url;
    854856    my $script_name = $self->config->script_name;
    855857    my $formatter = $self->wiki->formatter;
    856     my $param = $formatter->node_name_to_node_param( $node );
    857     return CGI->redirect( "$script_url$script_name?$param" );
     858    my $id = $formatter->node_name_to_node_param( $node );
     859   
     860    my $oldid;
     861    $oldid = $formatter->node_name_to_node_param( $redirect ) if $redirect;
     862   
     863    my $redir_param ='';
     864    $redir_param = "&oldid=$oldid" if $oldid;
     865   
     866    return CGI->redirect( "$script_url$script_name?id=$id$redir_param" );   
    858867}
    859868
  • trunk/lib/OpenGuides/RDF.pm

    r633 r634  
    8383            return $config->script_url . uri_escape($config->script_name) . "?id=" . uri_escape($wiki->formatter->node_name_to_node_param($node_name)) . ";version=" . uri_escape($version);
    8484        } else {
    85             return $config->script_url . uri_escape($config->script_name) . "?id=" . uri_escape($wiki->formatter->node_name_to_node_param($node_name));
     85            return $config->script_url . uri_escape($config->script_name) . "?" . uri_escape($wiki->formatter->node_name_to_node_param($node_name));
    8686        }
    8787    };
     
    163163    $latitude, $longitude, $version, $os_x, $os_y, $catrefs, @locales)
    164164    {
    165       $_ =~ s/&/&/g;
    166       $_ =~ s/</&lt;/g;
    167       $_ =~ s/>/&gt;/g;
     165      if ($_)
     166      {
     167        $_ =~ s/&/&amp;/g;
     168        $_ =~ s/</&lt;/g;
     169        $_ =~ s/>/&gt;/g;
     170      }
    168171    }
    169172   
  • trunk/t/21_rdf.t

    r633 r634  
    6666    like( $rdfxml, qr|<\?xml version="1.0"\?>|, "RDF is encoding-neutral" );
    6767
    68     like( $rdfxml, qr|<foaf:based_near><wn:Neighborhood><foaf:name>Bloomsbury</foaf:name></wn:Neighborhood></foaf:based_near>|,
     68    like( $rdfxml, qr|<foaf:name>Bloomsbury</foaf:name>|,
    6969          "finds the first locale" );
    70     like( $rdfxml, qr|<foaf:based_near><wn:Neighborhood><foaf:name>St Pancras</foaf:name></wn:Neighborhood></foaf:based_near>|,
     70    like( $rdfxml, qr|<foaf:name>St Pancras</foaf:name>|,
    7171         "finds the second locale" );
    7272
     
    7777          "picks up opening hours text" );
    7878
    79     like( $rdfxml, qr|<homePage>test website</homePage>|, "picks up website" );
     79    like( $rdfxml, qr|<foaf:homepage rdf:resource="test website" />|, "picks up website" );
    8080
    8181    like( $rdfxml,
  • trunk/t/54_redirect.t

    r633 r634  
    4646    # Old versions of CGI.pm mistakenly print location: instead of Location:
    4747    like( $output,
    48           qr/[lL]ocation: http:\/\/example.com\/wiki.cgi\?Test_Page_2/,
     48          qr/[lL]ocation: http:\/\/example.com\/wiki.cgi\?id=Test_Page_2\&oldid=Test_Page/,
    4949          "...and redirects to the right place" );
    5050}
  • trunk/templates/node.tt

    r633 r634  
    55[% INCLUDE navbar.tt %]
    66<div id="maincontent">
     7[% IF oldid %]
     8<div id="redirect_message">(redirected from <a href="[% full_cgi_url %]?action=edit&id=[% oldid %]">[% oldid %]</a></div>
     9[% END %]
     10
    711[% IF current %]
    812  [% IF backlinks_in_title AND is_indexable_node %]
  • trunk/wiki.cgi

    r633 r634  
    4141    $node = $formatter->node_param_to_node_name( $node );
    4242
    43     my $action = $q->param('action') || 'display';
    44     my $commit = $q->param('Save') || 0;
    45     my $preview = $q->param('preview') || 0;
    46     my $search_terms = $q->param('terms') || $q->param('search') || '';
    47     my $format = $q->param('format') || '';
     43    my $action       = $q->param('action')  || 'display';
     44    my $commit       = $q->param('Save')    || 0;
     45    my $preview      = $q->param('preview') || 0;
     46    my $search_terms = $q->param('terms')   || $q->param('search') || '';
     47    my $format       = $q->param('format')  || '';
     48    my $oldid        = $q->param('oldid')   || '';
    4849
    4950    # Alternative method of calling search, supported by usemod.
     
    122123                                     );
    123124            } else {
    124                 $guide->display_node( id => $node, version => $version );
     125                $guide->display_node(
     126                                      id      => $node,
     127                                      version => $version,
     128                                      oldid   => $oldid,
     129                );
     130               
    125131            }
    126132        }
Note: See TracChangeset for help on using the changeset viewer.