Extension talk:Drafts/Archive 1

GPL ?
Sounds like an interesting extension! But what is its licence? I don't see anything in the source, and the extensions page says "GPL" without saying whether it's 1, 2, or 3, with or without later versions. NSK Nikolaos S. Karastathis 03:29, 28 October 2008 (UTC)
 * GPL v2. It's now defined in the code. --Trevor Parscal 18:29, 29 October 2008 (UTC)

Don't work with Extension:DeletePagePermanently and Extension:Proofread Page

Opt out?
What if this is installed on a wiki, and a user doesn't want their drafts automatically saved while they are editing and/or in show preview mode? Cirt 10:41, 18 January 2009 (UTC)
 * See 17064. --MZMcBride 01:33, 21 January 2009 (UTC)

Snapshot ?
Why is the snapshot page don't have the Drafts Extension ? --Phd0 11:33, 29 January 2009 (UTC)

Don't have an empty box
In some circumstances a [Drafts:_____________] empty box will appear. Jidanni 02:06, 2 April 2009 (UTC)

FCKEditor...
This extension, when the rich editor is enabled, does not paste in the changes as wikitext.

Also is there a possibility you could preserve line breaks? Even if this is pasted in with fckeditor the text will not be parsed properly for editing with the rich editor.

67.97.209.36 19:03, 24 July 2009 (UTC)

How private are drafts?
Are drafts only visible to the user who made the edit? More explicitly, if I have $wgGroupPermissions['*']['edit'] = false; then will non-logged-in users not ever be able to see drafts? Thanks. 20:03, 19 May 2010 (UTC)

One draft per-page per-user?
Just looking for a confirmation on this: It looks like there's a single draft per-page per-user, right? The "You have 1 draft for this page" confused me a bit, since I'm the only editing user on my mediawiki, but looking at the extension code seems to indicate that it's a single draft per page for a given user. Thanks! 21:09, 19 May 2010 (UTC)

Installation Guide
Saving drafts as conceived by your hard work an important prerequisite to avoid user annoyance in the case their editings are lost due to volatile server availability. Since a it employes own tables I would expect the installation to be supported a bit better. Suggestion: name the tables used in the documentation page or provide a quick SQL for creating those tables for MySQL. Thanks for your devotion! Wolfgang

Internal Error
Running the following specs

with Drafts (Version r46751), I get the following when I try to save a page with an existing draft: Detected bug in an extension! Hook DraftHooks::discard failed to return a value; should return true to continue hook processing or false to abort. Backtrace:
 * 0 C:\Inetpub\wwwroot\mediawiki\includes\Article.php(1779): wfRunHooks('ArticleSaveComp...', Array)
 * 1 C:\Inetpub\wwwroot\mediawiki\includes\Article.php(1472): Article->doEdit('__NEWSECTIONLIN...', 'drafts extensio...', 98)
 * 2 C:\Inetpub\wwwroot\mediawiki\includes\EditPage.php(1027): Article->updateArticle('__NEWSECTIONLIN...', 'drafts extensio...', false, false, false, '')
 * 3 C:\Inetpub\wwwroot\mediawiki\includes\EditPage.php(2483): EditPage->internalAttemptSave(false, false)
 * 4 C:\Inetpub\wwwroot\mediawiki\includes\EditPage.php(449): EditPage->attemptSave
 * 5 C:\Inetpub\wwwroot\mediawiki\includes\EditPage.php(340): EditPage->edit
 * 6 C:\Inetpub\wwwroot\mediawiki\includes\Wiki.php(510): EditPage->submit
 * 7 C:\Inetpub\wwwroot\mediawiki\includes\Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 8 C:\Inetpub\wwwroot\mediawiki\index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
 * 1) 9 {main}

Note: Discarding by clicking on the discard link works fine. Any help? 202.167.15.162 10:22, 10 November 2010 (UTC)

Try to use more recent version of the extention. For example, I personally had the same problem with MediaWiki 1.15 and Drafts 1.15. After I have installed Drafts ver. 1.16 everything became OK.

MYSQL TABLE ERROR
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "Drafts::num". Database returned error "1146: Table 'sunjayc_mwki1.wiki_drafts' doesn't exist (localhost)".

That is the error I got, and here are my specs:

Any Help? --199.126.247.197 20:20, 29 December 2010 (UTC)


 * You need to run the update script. —Emufarmers(T 00:19, 30 December 2010 (UTC)

Internet Explorer undo broken with Drafts
After debugging for a while, I found out Drafts extensions breaks Internet Explorer undo function because it updates the "Save Draft" button for each key press, so adding an if to update the button when the state is modified only fixes it.

Here is the patch to Drafts.js, of course the patch is big because of indentention changes, the only new line added is diff -udpr Drafts/Drafts.js Drafts.iefix/Drafts.js --- Drafts/Drafts.js    2009-10-15 12:02:14.000000000 -0400 +++ Drafts.iefix/Drafts.js     2011-03-12 19:22:12.000000000 -0500 @@ -27,30 +27,32 @@ function Draft { newState ) {               // Stores state information -               state = newState; -               // Updates UI elements -               switch ( state ) { -                       case 'unchanged': -                               form.wpDraftSave.disabled = true; -                               form.wpDraftSave.value = messages.saveDraft; -                               break; -                       case 'changed': -                               form.wpDraftSave.disabled = false; -                               form.wpDraftSave.value = messages.saveDraft; -                               break; -                       case 'saved': -                               form.wpDraftSave.disabled = true; -                               form.wpDraftSave.value = messages.saved; -                               break; -                       case 'saving': -                               form.wpDraftSave.disabled = true; -                              form.wpDraftSave.value = messages.saving; -                              break; -                      case 'error': -                              form.wpDraftSave.disabled = true; -                              form.wpDraftSave.value = messages.error; -                              break; -                      default: break; +              if (state != newState) { +                      state = newState; +                      // Updates UI elements +                      switch ( state ) { +                              case 'unchanged': +                                      form.wpDraftSave.disabled = true; +                                      form.wpDraftSave.value = messages.saveDraft; +                                      break; +                              case 'changed': +                                      form.wpDraftSave.disabled = false; +                                      form.wpDraftSave.value = messages.saveDraft; +                                      break; +                              case 'saved': +                                      form.wpDraftSave.disabled = true; +                                      form.wpDraftSave.value = messages.saved; +                                      break; +                              case 'saving': +                                      form.wpDraftSave.disabled = true; +                                      form.wpDraftSave.value = messages.saving; +                                      break; +                              case 'error': +                                      form.wpDraftSave.disabled = true; +                                      form.wpDraftSave.value = messages.error; +                                      break; +                              default: break; +                      }                }        } TiCPU 00:26, 13 March 2011 (UTC)

Doesn't support MediaWiki running on SQLite?
Creating drafts table...A database query syntax error has occurred. The last attempted database query was: "CREATE TABLE drafts ( draft_id INTEGER AUTOINCREMENT, draft_token BLOB, draft_user INTEGER NOT NULL default 0, draft_page INTEGER NOT NULL default 0, draft_namespace INTEGER NOT NULL, draft_title BLOB NOT NULL default '', draft_section INTEGER NULL, draft_starttime BLOB, draft_edittime BLOB, draft_savetime BLOB, draft_scrolltop INTEGER, draft_text BLOB NOT NULL, draft_summary BLOB, draft_minoredit INTEGER, PRIMARY KEY (draft_id), INDEX draft_user_savetime ( draft_user, draft_savetime ), INDEX draft_user_page_savetime ( draft_user, draft_page, draft_namespace, draft_title, draft_savetime ), INDEX draft_savetime (draft_savetime), INDEX draft_page (draft_page) )" from within function "DatabaseBase::sourceFile( /www/vhosts/.../wiki/extensions/Drafts/Drafts.sql )". Database returned error "1: near &quot;AUTOINCREMENT&quot;: syntax error"

Not just articles please
Hi can we broaden this from articles to pages? This would have three advantages: I'm going to change the first sentence to reflect this, if anyone has a problem with that change please don't revert without giving an explanation here. WereSpielChequers 11:15, 26 August 2011 (UTC) WereSpielChequers 11:15, 26 August 2011 (UTC)
 * 1) User experience would be similar regardless of namespace.
 * 2) coding would also be similar
 * 3) I've lost drafts several times outside of mainspace, unless I'm unusual this would be a positive for lots of editors.

Display other people's drafts?
If I'm editing a page, I'd like anyone else who wants to edit that page to know. A message like "1 other user has saved draft edits to this page (last edited 2011-March-23)" would be great to save wasted effort. Either as a warning at the top of the edit page, or even when viewing the article. -- 62.49.26.154 20:37, 1 October 2011 (UTC)

PostgreSQL update script
-- -- Name: drafts_draft_id_seq; Type: SEQUENCE; Schema: mediawiki; Owner: wiki --

CREATE SEQUENCE drafts_draft_id_seq INCREMENT BY 1 NO MAXVALUE MINVALUE 0 CACHE 1;

ALTER TABLE mediawiki.drafts_draft_id_seq OWNER TO wiki;

-- -- Name: drafts; Type: TABLE; Schema: mediawiki; Owner: wiki; Tablespace: --

CREATE TABLE drafts (   draft_id integer DEFAULT nextval('drafts_draft_id_seq'::regclass) NOT NULL,    draft_token integer,    draft_user integer DEFAULT 0 NOT NULL,    draft_page integer DEFAULT 0 NOT NULL,    draft_namespace integer NOT NULL,    draft_title text DEFAULT ''::text NOT NULL,    draft_section integer,    draft_starttime timestamp with time zone,    draft_edittime timestamp with time zone,    draft_savetime timestamp with time zone,    draft_scrolltop integer,    draft_text text NOT NULL,    draft_summary text,    draft_minoredit boolean );

ALTER TABLE mediawiki.drafts OWNER TO wiki;

-- Name: drafts_pkey; Type: CONSTRAINT; Schema: mediawiki; Owner: wiki; Tablespace: --

ALTER TABLE ONLY drafts ADD CONSTRAINT drafts_pkey PRIMARY KEY (draft_id);

-- Name: draft_savetime; Type: INDEX; Schema: mediawiki; Owner: wiki; Tablespace: --

CREATE INDEX draft_savetime ON drafts USING btree (draft_savetime);

-- -- Name: draft_user_page_savetime; Type: INDEX; Schema: mediawiki; Owner: wiki; Tablespace: --

CREATE INDEX draft_user_page_savetime ON drafts USING btree (draft_user, draft_page, draft_namespace, draft_title, draft_savetime);

-- -- Name: draft_user_savetime; Type: INDEX; Schema: mediawiki; Owner: wiki; Tablespace: --

CREATE INDEX draft_user_savetime ON drafts USING btree (draft_user, draft_savetime);

-- Name: drafts_draft_id_seq; Type: ACL; Schema: mediawiki; Owner: wiki --

REVOKE ALL ON SEQUENCE drafts_draft_id_seq FROM PUBLIC; REVOKE ALL ON SEQUENCE drafts_draft_id_seq FROM wiki; GRANT ALL ON SEQUENCE drafts_draft_id_seq TO wiki;

(Alter this to your own owner, schema, etc. This may not be the simplest because I actually got the commands from pg_dump, but it does work.)

awesome extension
Trevor, thank you for this awesome extesnion. I install it in every wiki I administer. --Katkov Yury 20:02, 13 November 2011 (UTC)

Alert when autosave fails
just quick and dirty, but it will help if you have an unstable internet connection --Patrick 17:02, 15 November 2011 (UTC) this.respond = function( request ) { if ( request.responseText == '' ) { alert("Saving draft failed"); }		// Checks that an error did not occur if ( request.responseText > -1 ) { // Changes state to saved self.setState( 'saved' ); // Gets id of newly inserted draft (or updates if it already exists) // and stores it in a hidden form field form.wpDraftID.value = request.responseText; } else { // Changes state to error self.setState( 'error' ); }	}

Bugs
When I access http://en.wikipedia.beta.wmflabs.org/ (where this extension was installed recently) I get the following messages on Google Chrome's console: GET http://en.wikipedia.beta.wmflabs.org/w/extensions/Drafts/Drafts.css?3 404 (Not Found) GET http://en.wikipedia.beta.wmflabs.org/w/extensions/Drafts/Drafts.js?3 404 (Not Found) Maybe the extension needs to be migrated to Resource Loader? Helder 14:46, 11 April 2012 (UTC)

Improvements & possible deployment on Wikimedia Foundation sites
Trevor Parscal is improving this extension so it can, potentially, be deployed on Wikimedia Foundation sites. Sumana Harihareswara, Engineering Community Manager (talk) 21:36, 4 September 2012 (UTC)

Doesn't work in firefox
When I click 'save draft' in firefox the page saves as if I had clicked 'save'. How do I make it work in firefox? I'm using mediawiki 1.20. --LTech (talk) 07:39, 9 October 2013 (UTC)

AutoSave doesn't work
Autosave isn't working in firefox or chrome. I'm using mediawiki 1.20. I waited 120 seconds and nothing happens. I've tried adding $egDraftsAutoSaveWait = 20; $egDraftsAutoSaveInputBased = false; to localsettings.php but it still didn't work. Any ideas why? --LTech (talk) 07:53, 9 October 2013 (UTC)