[RFC] Autosave

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC] Autosave

Post by Pony99CA »

Fyorl wrote:I started work on this, the PR is here: https://github.com/phpbb/phpbb3/pull/1063

Some questions that have cropped up: Do we need to keep track of more than one post at a time? It seems to me that a user will only be working on one post at a time per board. If we want to distinguish posts, how should they be uniquely identified? Forum and/or topic combo?

When do we clear autosave data? Can we rely on the 'post success' page to reliably delete the data before it redirects?

Update:
Decided on saving post data uniquely with the topic id and/or forum id (in the case of a new topic). Also the window creation time will be used in the case that a user opens multiple tabs in the same topic.
That wouldn't work for me. At times, I've opened multiple responses to posts in a topic and written answers to them all "simultaneously" (in a multi-tasking way).

My proposal would modify yours slightly. If somebody is editing or quoting a post, use the post ID of the post being edited/replied to; if they're writing a new post, use the topic ID (if it's not edited or quoted) or the forum ID (if they're not in a topic at all).

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Weskey
Registered User
Posts: 16
Joined: Mon Nov 04, 2013 4:57 pm

Re: [RFC] Autosave

Post by Weskey »

This project is still being implemented or already discarded?
Any chance of appearing in 3.1?

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC] Autosave

Post by EXreaction »

Nobody has worked on this as far as I've seen. If someone does, it could go into 3.2, but not very unlikely for 3.1.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] Autosave

Post by brunoais »

The idea as it is now is to add SCE to phpBB.
I'm waiting for help from it's owner, seems like he is very busy at the moment.
Until then I can't advance more unless I pickup the code myself which is not what I intend to do unless I'm "forced" to.

wGEric
Registered User
Posts: 521
Joined: Wed Jun 11, 2003 2:07 am
Contact:

Re: [RFC] Autosave

Post by wGEric »

brunoais wrote:
Pony99CA wrote:
brunoais wrote:
Pony99CA wrote:Maybe it should be tied to events, not time or changes. For example, autosave when a Preview is done or when a Close Window event is fired.
That's not fast enough. The whole DOM may be gone before you can properly send the contents of the post.
If that's the case, then the warn user on closing edtior when text changed wouldn't really have worked, right?
Right. That code would never work. And doing an alert, prompt or whatever can be ignored by the browser so, also no go.
On that event callback, the only real thing you can do is to manipulate the DOM to give different looks (some companies use it to show a modal window stating that the request is being processed) and to ask for a js popup asking if the user wants to stay or leave the page. Some browsers may allow other interactions but it's just because they wanted to.
That code would have worked just fine. onbeforeunload != onunload.
https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload wrote:An event that fires when a window is about to unload its resources. The document is still visible and the event is still cancelable.

...

When this event returns a non-void value, the user is prompted to confirm the page unload.
Eric

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] Autosave

Post by brunoais »

wGEric wrote:
https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload wrote:An event that fires when a window is about to unload its resources. The document is still visible and the event is still cancelable.

...

When this event returns a non-void value, the user is prompted to confirm the page unload.
The prompt is generic the reason is never given to the user. It just say that there is unsaved information and if he wants to leave or not.

wGEric
Registered User
Posts: 521
Joined: Wed Jun 11, 2003 2:07 am
Contact:

Re: [RFC] Autosave

Post by wGEric »

brunoais wrote:
wGEric wrote:
https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload wrote:An event that fires when a window is about to unload its resources. The document is still visible and the event is still cancelable.

...

When this event returns a non-void value, the user is prompted to confirm the page unload.
The prompt is generic the reason is never given to the user. It just say that there is unsaved information and if he wants to leave or not.
Let me finish a line that I quoted above:
When this event returns a non-void value, the user is prompted to confirm the page unload. In most browsers, the return value of the event is displayed in this dialog.
There is some default text that can't be changed/removed but you can show some custom text.

In my own testing Chrome showed the message, Firefox did not and I didn't test IE. Here is a sample page: http://samples.msdn.microsoft.com/works ... unload.htm
Eric

User avatar
Jacob
Registered User
Posts: 102
Joined: Wed Jan 04, 2012 1:41 pm

Re: [RFC] Autosave

Post by Jacob »

Please, don't use that. When I leave a page I don't want to be asked if I'm sure. Yes, I'm f*cking sure, that's why I clicked the exit button.
If there is no other way to implement autosave, then I can live without autosave.

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC] Autosave

Post by Pony99CA »

Jacob wrote:Please, don't use that. When I leave a page I don't want to be asked if I'm sure. Yes, I'm f*cking sure, that's why I clicked the exit button.
If there is no other way to implement autosave, then I can live without autosave.
So let admins decide if they want that. You may be sure that you wanted to close a tab, but maybe you accidentally closed the wrong tab (the phpBB one instead of the one you intended). Asking the question at least warns you that you'll lose your message data. I occasionally type a post and then decide not to post it, and I don't think that I'd be annoyed by the occasional confirmation prompt.

The other alternative would be to add a Cancel button to the Save draft, Preview, Submit line, but that would still be two clicks to close the page without getting prompted, so why bother?

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Post Reply