lnovy / phpbb-iphone-style

Automatically exported from code.google.com/p/phpbb-iphone-style
0 stars 0 forks source link

After posting reply, link to view post is not working #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As the subject says, if I write a reply to a post, the following
viewtopic.php?... link does not work. The page also does not automatically
move to the new post. Link to return to the forum does work, however.

using phpBB 3.0.5 and r55 of phpbb-iphone-style.

Original issue reported on code.google.com by robmcampbell on 14 Nov 2009 at 1:51

GoogleCodeExporter commented 9 years ago
I think I've tracked down the cause of the redirect problem:

in phpbb-iphone-style/template/overall_header.html: adding a line with {META} 
on it
should allow the meta_refresh() function (from phpbb/includes/functions.php) to 
add
the redirect.

Still not sure why the view topic link doesn't work. It appears to be the same 
link I
get from other templates (added at the end of posting.php). My initial hunch 
was that
iui.js has overridden either click handlers or is doing something else that 
prevents
the link from working. Running Firebug on it, I do get frequent calls to
checkOrientAndLocation(), so maybe there's something going on.

I'll post patches if I come up with anything.

Original comment by robmcampbell on 14 Nov 2009 at 2:48

GoogleCodeExporter commented 9 years ago
verified that the link (all links on a page with iui.js in it) have a custom 
link
handler applied to them.

from line 178: addEventListener("click", function(event) {...
...
line 187:
        } else if (link.href && link.hash && link.hash != "#")
        {
            link.setAttribute("selected", "true");
            iui.showPage($(link.hash.substr(1))); // this is pulling out post id and
trying to navigate to it as a link. which fails.
            setTimeout(unselect, 500);
        }

Checking to see if there's an updated version of iui which fixes this.

Original comment by robmcampbell on 14 Nov 2009 at 3:07

GoogleCodeExporter commented 9 years ago
there is a newer version of iui online here, http://code.google.com/p/iui/, but 
it
doesn't fix the problem. It's still looking for hashes in links and failing to 
load
the page. I'm tempted to just rip that block out of iui to see what happens, but
would prefer a cleaner fix.

Original comment by robmcampbell on 14 Nov 2009 at 3:33

GoogleCodeExporter commented 9 years ago
I think the problem is that IUI doesn't handle URL's with #'s in them 
correctly.  It 
automatically assumes that a link with a # in (regardless of whether the # is 
the 
first character or not) should be treated as a div within the page that should 
be 
displayed, rather than replacing the whole page.

I think this will be a case of having to modify IUI for our own needs for the 
time 
being.

Original comment by plawre...@gmail.com on 23 Nov 2009 at 7:42

GoogleCodeExporter commented 9 years ago
yeah, that's exactly it. I played around with a couple of variations on this and
think I have a fix that works for me.

line 178:
addEventListener("click", function(event)
{
    var link = findParent(event.target, "a");
    var upToHash = /(.*)(#)/;

    if (link)
    {
        function unselect() { link.removeAttribute("selected"); }

        if (link.href && upToHash.exec(link.href)[1] == upToHash.exec(location.href)[1]
                        && link.hash && link.hash != "#")
        {
            link.setAttribute("selected", "true");
            iui.showPage($(link.hash.substr(1)));
            setTimeout(unselect, 500);
        } if (link.href && !link.target && link != $("backButton"))

----

for pages with hashes in them, iui tries to use the showPage method which 
unpacks the
new section. The problem arises when the href doesn't match the hash page's 
href. I
added that regex to split the url into chunks. I haven't tested this 
exhaustively
yet, but will post back if I find any problems.

Original comment by robmcampbell on 23 Nov 2009 at 12:14

GoogleCodeExporter commented 9 years ago
@robmcampbell

This worked perfect. Thanks for the fix. 

Original comment by mdp...@gmail.com on 28 Nov 2009 at 5:16

GoogleCodeExporter commented 9 years ago
@robmcapbell - thanks for that fix, it's been added in r.58.

I'll keep this open however, to see what the IUI developers come up with.

Original comment by plawre...@gmail.com on 29 Nov 2009 at 8:03

GoogleCodeExporter commented 9 years ago
Issue 34 has been merged into this issue.

Original comment by plawre...@gmail.com on 29 Nov 2009 at 3:01