Instead of going the complicated way, why not have it as a feature based on group permission? Kind of like only allowing administrators or moderators, and contributors set up with the "Yes" permission to have "Autosave drafts" enabled, that way the administrator controls who has this ability and it won't be a major drain, you can implement a client-side autosave draft later on as part of this, depending on what the team would want.
But I would definitely like this feature seeing as I have accidentally closed my browser about 3 times posting long topics, but have since taken kin to hitting the save draft button, it would be nice to have something like what Google does for their e-mails or YouTube video edits, where it automatically saves.
+1 for me.
[RFC] Autosave
Re: [RFC] Autosave
Ooohh This topic has quite some time.
I think saving should be in the client side. We now have the LocaStorage interface, which is a simple key-value to store. We can just store there with a key we can decide to be wildly used in phpBB.
Each key-value table follows the same origin rules. This means that there's a different table available for each sub-domain, and such.
We may use some randomization with the keys to make sure that no clashes happen for multiple forums in the same domain/subdomain, anyway.
+ info:
https://developer.mozilla.org/en-US/doc ... calStorage
I think saving should be in the client side. We now have the LocaStorage interface, which is a simple key-value to store. We can just store there with a key we can decide to be wildly used in phpBB.
Each key-value table follows the same origin rules. This means that there's a different table available for each sub-domain, and such.
We may use some randomization with the keys to make sure that no clashes happen for multiple forums in the same domain/subdomain, anyway.
+ info:
https://developer.mozilla.org/en-US/doc ... calStorage
- bantu
- 3.0 Release Manager
- Posts: 557
- Joined: Thu Sep 07, 2006 11:22 am
- Location: Karlsruhe, Germany
- Contact:
Re: [RFC] Autosave
I'd like to see this feature. Not sure whether client side or server side is better. Major exisisting implementations (e.g. Gmail) are probably server side.
- Pony99CA
- Registered User
- Posts: 986
- Joined: Sun Feb 08, 2009 2:35 am
- Location: Hollister, CA
- Contact:
Re: [RFC] Autosave
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.
This should probably also be tied into the Drafts system unless you don't want Autosave to overwrite an existing draft. That would give people a standard place to find autosaved items.
Steve
This should probably also be tied into the Drafts system unless you don't want Autosave to overwrite an existing draft. That would give people a standard place to find autosaved items.
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.
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.
Re: [RFC] Autosave
That's not fast enough. The whole DOM may be gone before you can properly send the contents of the post.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.
I still think that using the LocalStorage interface seem to be one of the best approaches for this problem.
- Pony99CA
- Registered User
- Posts: 986
- Joined: Sun Feb 08, 2009 2:35 am
- Location: Hollister, CA
- Contact:
Re: [RFC] Autosave
If that's the case, then the warn user on closing edtior when text changed wouldn't really have worked, right?brunoais wrote:That's not fast enough. The whole DOM may be gone before you can properly send the contents of the post.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.
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.
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.
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] Autosave
Code: Select all
var timeout;
$('textarea').keyup(function () {
clearTimeout(timeout);
timeout = setTimeout(function () {
//save post here
}, 2000);
});
Re: [RFC] Autosave
Right. That code would never work. And doing an alert, prompt or whatever can be ignored by the browser so, also no go.Pony99CA wrote:If that's the case, then the warn user on closing edtior when text changed wouldn't really have worked, right?brunoais wrote:That's not fast enough. The whole DOM may be gone before you can properly send the contents of the post.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.
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.
- Fyorl
- Google Summer of Code Student
- Posts: 27
- Joined: Mon Apr 02, 2012 4:51 am
- Location: UK
- Contact:
Re: [RFC] Autosave
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.
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.
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] Autosave
I feel that it should tell the user as it saves.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.
Another approach would be to either save it fairly often (like every few seconds), or save it every time the user stops typing for a couple seconds. As you're saving it at the client side, it won't cost much, and the user won't notice.