Show
Ignore:
Timestamp:
04/24/08 17:38:41 (5 years ago)
Author:
tokuhirom
Message:

やっぱり ?moxy_q= みたいな形式だと form まわりの処理がうまくいかないので、もとにもどす。

Location:
lang/perl/Moxy/branches/hsw
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Moxy/branches/hsw/assets/plugins/QRCode/panel.tt

    r10133 r10322  
    22    function __MOXY_insert_image() { 
    33        var qrdiv = document.getElementById('qrcode_placeholder'); 
    4         var url = "http://" + location.host + "/?moxy_q=" + encodeURIComponent("http://qrcode.moxy/[% current | uri %]"); 
     4        var url = "http://" + location.host + "/" + encodeURIComponent("http://qrcode.moxy/[% current | uri %]"); 
    55        qrdiv.innerHTML = "<img src='" + url + "' />"; 
    66        return false; 
  • lang/perl/Moxy/branches/hsw/lib/Moxy.pm

    r10133 r10322  
    110110        for my $node ( $tree->findnodes("//$tag") ) { 
    111111            if ( my $attr = $node->attr($attr_name) ) { 
    112                 my $uri = URI->new($attr)->abs($base_url); 
    113                 if ($tag eq 'form') { 
    114                     my $query = +{ $uri->query_form }; 
    115                     while (my ($key, $val) = each %$query) { 
    116                         my $element = HTML::Element->new( 
    117                             'input', 
    118                             type  => 'hidden', 
    119                             name  => $key, 
    120                             value => $val 
    121                         ); 
    122                         $node->push_content($element); 
    123                     } 
    124                     $uri->query_form({}); # strip query. 
    125                 } 
    126112                $node->attr( 
    127                     $attr_name => sprintf( qq{%s?moxy_q=%s}, 
     113                    $attr_name => sprintf( qq{%s%s%s}, 
    128114                        $base, 
    129                         uri_escape( $uri ) ) 
     115                        ($base =~ m{/$} ? '' : '/'), 
     116                        uri_escape( URI->new($attr)->abs($base_url) ) ) 
    130117                ); 
    131118            } 
     
    164151</head> 
    165152<body> 
    166     <form method="get" action="$base"> 
    167         <input type="text" size="40" name="moxy_q" id="moxy_url" /> 
     153    <form method="get" action="$base" onsubmit="location.href=location.href+encodeURIComponent(document.getElementById('moxy_url').value);return false;"> 
     154        <input type="text" size="40" id="moxy_url" /> 
    168155        <input type="submit" value="go" /> 
    169156    </form> 
     
    194181        my $auth = decode_base64($1); 
    195182        $self->log(debug => "auth: $auth"); 
    196         my $url = uf_uristr(+{$uri->query_form()}->{moxy_q}); 
     183        (my $url = $uri->path_query) =~ s!^/!!; 
     184        $url = uf_uristr(uri_unescape $url); 
    197185        $self->log(info => "REQUEST $auth, @{[ $url || '' ]}"); 
    198186        my $response = $self->_make_response( 
     
    243231                $location->port($uri->port); 
    244232            } 
    245             $res->header( 'Location' => $base_url . '/?moxy_q=' . uri_escape( $location ) ); 
     233            $res->header( 'Location' => $base_url . '/' . uri_escape( $location ) ); 
    246234            $self->log(debug => "redirect to " . $res->header('Location')); 
    247235        } else { 
  • lang/perl/Moxy/branches/hsw/lib/Moxy/Plugin/LocationBar.pm

    r10320 r10322  
    2121 
    2222    return sprintf(<<"...", encode_entities($current_url)); 
    23     <form method="get" style="width: 100%%;"> 
    24         <input type="text" value="\%s" size="40" name="moxy_q" /> 
     23    <script> 
     24        var moxy_base = location.protocol.replace(':', '') + '://' + location.host; 
     25    </script> 
     26    <form method="get" onsubmit="location.href=moxy_base +'/'+encodeURIComponent(document.getElementById('moxy_url').value);return false;"> 
     27        <input type="text" value="\%s" size="40" id="moxy_url" style="width:90%%;" /> 
    2528        <input type="submit" value="go" /> 
    2629    </form> 
  • lang/perl/Moxy/branches/hsw/t/Plugin-Server-rewrite.t

    r10133 r10322  
    2929<a href="http://example.com/foo" title="foo">bar</a> 
    3030--- expected 
    31 <html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html> 
     31<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html> 
    3232 
    3333=== relative 
     
    3535<a href="/foo" title="foo">bar</a> 
    3636--- expected 
    37 <html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Ffoo" title="foo">bar</a></html> 
     37<html><a href="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Ffoo" title="foo">bar</a></html> 
    3838 
    3939=== upper case tag 
     
    4141<A href="http://example.com/foo" title="foo">bar</A> 
    4242--- expected 
    43 <html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html> 
     43<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html> 
    4444 
    4545=== 
     
    4747<a href="http://example.com/foo">bar</a> 
    4848--- expected 
    49 <html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo">bar</a></html> 
     49<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo">bar</a></html> 
    5050 
    5151=== no href. 
     
    5959<form method="post" action="http://example.com/search"><input type="submit" value="go" /></form> 
    6060--- expected 
    61 <html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /></form></html> 
    62  
    63 === form with query 
    64 --- input 
    65 <form method="post" action="http://example.com/search?k=foo"><input type="submit" value="go" /></form> 
    66 --- expected 
    67 <html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /><input name="k" type="hidden" value="foo" /></form></html> 
     61<html><form action="http://localhost:9999/http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /></form></html> 
    6862 
    6963=== relative 
     
    7165<form method="post" action="/search"><input type="submit" value="go" /></form> 
    7266--- expected 
    73 <html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Fsearch" method="post"><input type="submit" value="go" /></form></html> 
     67<html><form action="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Fsearch" method="post"><input type="submit" value="go" /></form></html> 
    7468 
    7569=== relative img 
     
    7771<img src="/foo.jpg" /> 
    7872--- expected 
    79 <html><img src="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Ffoo.jpg" /></html> 
     73<html><img src="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Ffoo.jpg" /></html> 
    8074 
    8175=== abs img 
     
    8377<img src="http://example.com/bar.jpg"> 
    8478--- expected 
    85 <html><img src="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fbar.jpg" /></html> 
     79<html><img src="http://localhost:9999/http%3A%2F%2Fexample.com%2Fbar.jpg" /></html> 
    8680