[RFC|Merged] AJAX

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] AJAX

Post by Oleg »

Rebased on develop, the only conflict was with the temporary jquery reference, and fixed whitespace: https://github.com/p/phpbb3/compare/dev ... ure%2Fajax

Actually my whitespace commit is too aggressive, ignore it for now.

Without php json extension installed, I am told that "request timed out" whenever I try to do anything (tried reordering forums in acp). First, this is not true. Distinguish between the client side not receiving a response and receiving a response that it does not understand.

Second, the actual error should be logged in error log so that the admin knows what the problem is and can fix it.

Check if json extension is installed and if it is not installed, don't ajax-enable any page elements as none of them will work.

The "loading" message shows up on the very bottom of everything after all normal page markup. It took me a while to notice it there. What I see is a black overlay with nothing on it until the "request timed out" box appears.

Once a request "times out" that information box stays visible forever. After I installed json extension I was repeatedly moving forums up and down. At some point one of the requests "timed out" and now every time that black overlay appears it appears with the "request timed out" box in it, even though subsequent requests work fine.

Please compile a list of everything that has been ajaxified so far and put it in the first post in this topic. Right now I can only see this information in the list of commits.

There is still html in .js files. All markup should be moved into templates.

The flickering that happens when I move forums is annoying. How about waiting a certain time before showing the loading overlay, say 500 ms. If the action completes in less time don't show the overlay at all.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] AJAX

Post by callumacrae »

Oleg wrote:Without php json extension installed, I am told that "request timed out" whenever I try to do anything (tried reordering forums in acp). First, this is not true. Distinguish between the client side not receiving a response and receiving a response that it does not understand.
So? phpBB 3.1 requires PHP 5.2, and the json extension is packaged by default in 5.2. If someone is attempting to be clever by installed as few extensions as possible, that's their problem, imo.
Oleg wrote:There is still html in .js files. All markup should be moved into templates.
document.createElement has been in JavaScript longer than event listeners. JavaScript was designed for stuff like this, please realise that separation of logic isn't best absolutely everywhere.
Oleg wrote:The flickering that happens when I move forums is annoying. How about waiting a certain time before showing the loading overlay, say 500 ms. If the action completes in less time don't show the overlay at all.
What happens if I tell it to take 500ms and the request takes 510ms? There will still be an annoying flickering.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] AJAX

Post by Oleg »

callumacrae wrote: So? phpBB 3.1 requires PHP 5.2, and the json extension is packaged by default in 5.2. If someone is attempting to be clever by installed as few extensions as possible, that's their problem, imo.
You are not getting anywhere by restating this repeatedly.
callumacrae wrote: this, please realise that separation of logic isn't best absolutely everywhere.
If you're going to make an actual argument, please make it. Otherwise move html into templates.
callumacrae wrote: What happens if I tell it to take 500ms and the request takes 510ms? There will still be an annoying flickering.
The first request, maybe. Subsequent requests, probably not. Make a hidden config setting for the waiting time, then board admin will be able to set it appropriately for their board.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] AJAX

Post by callumacrae »

Oleg wrote:
callumacrae wrote: this, please realise that separation of logic isn't best absolutely everywhere.
If you're going to make an actual argument, please make it. Otherwise move html into templates.
No, a counter-argument. Except that you haven't made an actual argument, either. I see absolutely no advantage of moving it, short of HUR DUR A BOOK SAID TO KEEP EVERYTHING SEPARATE (the arguments for which are invalid in this context - if you actually have anything, please enlighten me.)
Oleg wrote:
callumacrae wrote: What happens if I tell it to take 500ms and the request takes 510ms? There will still be an annoying flickering.
The first request, maybe. Subsequent requests, probably not. Make a hidden config setting for the waiting time, then board admin will be able to set it appropriately for their board.
The request time usually depends on the user, not the board.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] AJAX

Post by Oleg »

callumacrae wrote: No, a counter-argument. Except that you haven't made an actual argument, either. I see absolutely no advantage of moving it, short of HUR DUR A BOOK SAID TO KEEP EVERYTHING SEPARATE (the arguments for which are invalid in this context - if you actually have anything, please enlighten me.)
Lacking an argument to the contrary, markup goes in the templates.
callumacrae wrote: The request time usually depends on the user, not the board.
Do the 500 ms variant like I initially said, we'll see how well it works.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] AJAX

Post by callumacrae »

Oleg wrote:Lacking an argument to the contrary, markup goes in the templates.
It's easier to have it in the JavaScript, as moving it to the template would involve large changes and it would be very tricky to make the page work when javascript is disabled.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] AJAX

Post by Oleg »

I understand that you will have to do more work to improve the architecture, but the current version is not acceptable.

If the html/js mix is needed for the last 2/3 of the functionality as discussed in our last irc conversation, you can split the first 1/3 out and fix the functionality issues (json, loading, etc.) into a separate pull request. I estimate the result will be sufficiently useful by itself to be merged.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] AJAX

Post by naderman »

phpBB should simply require the json extension. All that is needed is an install check, and once we have those, a check in the ACP. You don't need to dynamically check it, because it should always be available on any sane installation of php.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] AJAX

Post by Oleg »

Congrats on having the largest pull request yet. Is it the first one to break 100 commits?

We still need a list of ajaxified things for testing.

User avatar
hanakin
Front-End Dev Team Lead
Front-End Dev Team Lead
Posts: 907
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: [RFC] AJAX

Post by hanakin »

callumacrae wrote:
Oleg wrote:
callumacrae wrote: What do you mean by the giant switch statement?
https://github.com/callumacrae/phpbb3/b ... le/ajax.js would be an example.
That's a horrible piece of code, but there is no way around it without rewriting the buttons / removing support for users with js disabled. I still don't understand what you mean by giant switch statement.

That could totaly be cleaned up, I agree with oleg take another look at this if i ever manage to get my computer back up and running I will attempt to provide some alternatives
Donations welcome via Paypal Image

Post Reply