diff options
author | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2010-08-05 11:14:18 +0200 |
---|---|---|
committer | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2010-08-05 11:14:18 +0200 |
commit | 1c4967095e1e3f4e3ea7b36e540da0fca7fec403 (patch) | |
tree | b48ad87da5c9723970a97247bcba146e4c94ebb7 | |
parent | a3464e8e24e5c2bf1a824f2e6a581f095e244b7a (diff) |
Make non-ajax interface redirect ajax urls to plain urls.
-rw-r--r-- | lib/LXRng/Web.pm | 6 | ||||
-rw-r--r-- | tmpl/tree_list.tt2 | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/LXRng/Web.pm b/lib/LXRng/Web.pm index ba7943f..2ae3fa4 100644 --- a/lib/LXRng/Web.pm +++ b/lib/LXRng/Web.pm @@ -219,9 +219,11 @@ sub print_tree_list { $base =~ s,[+]trees/?$,,; $template->process('tree_list.tt2', {'context' => $context, - 'base_url' => $base}) + 'base_url' => $base, + 'is_ajax' => ($context->prefs and + $context->prefs->{'navmethod'} eq 'ajax')}) or die $template->error(); -} +} sub print_release_list { my ($context, $template) = @_; diff --git a/tmpl/tree_list.tt2 b/tmpl/tree_list.tt2 index d862cae..e517d0c 100644 --- a/tmpl/tree_list.tt2 +++ b/tmpl/tree_list.tt2 @@ -8,7 +8,14 @@ <script type="text/javascript" src=".static/js/lxrng-funcs.js"></script> <link rel="shortcut icon" href=".static/gfx/favicon.png" type="image/png"> <link rel="stylesheet" href=".static/css/lxrng.css" type="text/css" title="LXRng"> - + [% IF !is_ajax %] + <script type="text/javascript"> + var hashnav = location.hash.match(/^#(.+)/); + if (hashnav) { + document.write('<meta http-equiv="Refresh" content="0;url=[% base_url | html %]' + hashnav[1] + '">'); + } + </script> + [% END %] <title id="title">LXR Inventory</title> </head> <body> |