Last modified: 2013-04-11 13:19:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44198, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42198 - Cancel Button saves text, Publish Button does nothing
Cancel Button saves text, Publish Button does nothing
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikiEditor (Other open bugs)
master
All All
: Highest major with 2 votes (vote)
: ---
Assigned To: Bartosz Dziewoński
:
: 44671 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-16 15:23 UTC by Peter
Modified: 2013-04-11 13:19 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Peter 2012-11-16 15:23:24 UTC
WikiEditor:

Button "Cancel" does saves edited wikitext
Button "Publish" does nothing.

relevant parts of LocalSettings.php:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.

# If you customize your file layout, set $IP to the directory that contains
# the other MediaWiki files. It will be used as a base to locate files.

if( defined( 'MW_INSTALL_PATH' ) ) {
  $IP = MW_INSTALL_PATH;
} else {
  $IP = dirname( __FILE__ );
}
$path = array( $IP, "$IP/includes", "$IP/languages" );
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );

require_once( 'includes/DefaultSettings.php' );

$wgDisableOutputCompression = true;

$wgSitename = "Berater-Wiki";

## For more information on customizing the URLs please see:
## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
## If using PHP as a CGI module, the ?title= style usually must be used.

$wgScriptPath = "/w2";         # Path to the actual files. This should already be there
$wgArticlePath = "/wiki2/$1";  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;        # Enable use of pretty URLs

$wgRedirectScript   = "$wgScriptPath/redirect.php";
$wgUploadPath       = "$wgScriptPath/images";
$wgStylePath        = "$wgScriptPath/skins";

$wgLogo             = "$wgStylePath/common/images/rv-logo-2.png";
$wgStyleDirectory   = "$IP/skins";
$wgUploadDirectory  = "$IP/images";
$wgAllowExternalImages = true;

$wgEnableEmail      = true;
$wgEnableUserEmail  = true;
$wgEmergencyContact = 'wiki@intra.local';
$wgPasswordSender   = 'wiki@intra.local';

$wgEnableMWSuggest  = true;

$wgExternalLinkTarget = '_blank';

## For a detailed description of the following switches see
## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
## There are many more options for fine tuning available see
## /includes/DefaultSettings.php
## UPO means: this is also a user preference option

$wgEnotifUserTalk       = true; // Set to true to allow e-mail notification for the own user_talk page. # UPO
$wgEnotifWatchlist      = true; // Set to true to allow e-mail notification for watched pages. # UPO
$wgEmailAuthentication  = true;

$wgAllowUserJs = true;
$wgUseSiteJs = true;

$wgUseFileCache = true; /* default: false */
$wgFileCacheDirectory = "$IP/cache";
$wgShowIPinHeader = false;

$wgUsersNotifiedOnAllChanges = array( 'Wikisysop' );

$wgDBtype     = 'mysql';
$wgDBserver   = 'localhost';
$wgDBname     = 'mwiki';
$wgDBuser     = 'xxx';
$wgDBpassword = 'xxx';
$wgDBport     = '5432';
$wgDBprefix   = '';

# Schemas for Postgres
$wgDBmwschema   = 'mediawiki';
$wgDBts2schema  = 'public';

# Experimental charset support for MySQL 4.1/5.0.
$wgDBmysql5 = true;

## Shared memory settings
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = array();

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/bin/convert';

## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX           = false;
$wgMathPath         = "{$wgUploadPath}/math";
$wgMathDirectory    = "{$wgUploadDirectory}/math";
$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";

$wgLocalInterwiki   = $wgSitename;
$wgLanguageCode     = 'de';
$wgProxyKey         = 'c65e62d92923e09cd9194c2e445c39f8be5daf02eae58a33a8e6b0e826cd4ddf';

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
$wgDefaultSkin = 'vector';

$wgSkipSkins = array
( 'simple'
, 'standard'
, 'monobook'
, 'modern'
);


# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage   = ''; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl    = '';
$wgRightsText   = '';
$wgRightsIcon   = '';
$wgUseTwoButtonsSearchForm = true;

$wgDiff3 = '/usr/bin/diff3';

/**
 * Fix double redirects after a page move.
 * Tends to conflict with page move vandalism, use only on a private wiki.
 */
$wgFixDoubleRedirects = true;

# When you make changes to this configuration file, this will make
# sure that cached pages are cleared.

$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
$wgCacheEpoch = max( $wgCacheEpoch, $configdate );

$wgEmailConfirmToEdit = true;
$wgWhitelistRead = array( "Hauptseite", "Special:UserLogin", "Special:UserLogout", "Special:PasswordReset", "MediaWiki:Common.css" );


// ~~~ give credit to author ~~~~~~~~~~~~~~~~~~~~

$wgMaxCredits = 0;  // Set this to the number of authors that you want to be credited below an article text.
                    // Set it to zero to hide the attribution block, and a negative number (like -1) to show all authors.


// ~~~ set default timezone ~~~~~~~~~~~~~~~~~~~~~

$wgLocalTZoffset = date( 'Z' ) / 60;


// ~~~ category settings ~~~~~~~~~~~~~~~~~~~~~~~

$wgCategoryPagingLimit = 500;


// ~~~ handling of file upload ~~~~~~~~~~~~~~~~~~

$wgUploadSizeWarning = 64 * 1024 * 1024;  // max file size - here 64MB

$wgCheckFileExtensions = true;  // true: check against $wgFileExtensions  | false: don't check
$wgStrictFileExtensions = true; // true: strict checking                  | false: warn for wrong extensions
$wgVerifyMimeType = false;      // true: check type of file               | false: don't check
$wgFileExtensions = array       // --- list of allowed file extensions
( '7z', 'zip'                   // archives
, 'bm2'                         // boardmaker
, 'exe'                         // executables
, 'mp3'                         // sound
, 'cdd'                         // ??
, 'gif', 'jpeg', 'jpg', 'png'   // pics
, 'doc', 'ppt', 'xls'           // MS documents
, 'odp', 'ods', 'odt'           // OOo documents
, 'pdf'                         // pdf documents
, 'epg', 'pak'                  // dynavox type files
);


// ~~~ permissions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$wgImplicitGroups = array
( '*'
, 'user'
, 'autoconfirmed'
, 'bureaucrat'
, 'sysop'
, 'emailconfirmed'
);

$wgGroupPermissions['sysop']['userrights'] = true;
$wgGroupPermissions['sysop']['specialpages'] = true;

// ~~~ '*' = implicit group for all visitors
$wgGroupPermissions['*']['createaccount'] = false; // 1.5.0 - default = true
$wgGroupPermissions['*']['read'] = false;          // 1.5.0 - default = true
$wgGroupPermissions['*']['edit'] = false;          // 1.5.0 - default = true
$wgGroupPermissions['*']['createpage'] = false;    // 1.6.0 - default = true
$wgGroupPermissions['*']['createtalk'] = false;    // 1.6.0 - default = true

$wgGroupPermissions['wikieditor']['delete'] = true;

// enable subpage feature for ...

# $wgNamespacesWithSubpages[600]
# = $wgNamespacesWithSubpages[601]
# = true;

$wgNamespacesWithSubpages = array_fill(0, 601, true);

$wgShowExceptionDetails = true;


// ~~~ extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#~#require_once( "$IP/extensions/UsabilityInitiative/Vector/Vector.php" );
require_once( "$IP/extensions/Vector/Vector.php" );
$wgDefaultSkin = 'vector'; // If you want to change the default skin for new users

#~#require_once( "$IP/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php" );
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );

# Enables use of WikiEditor by default but still allow users to disable it in preferences
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;

# Displays the Preview and Changes tabs
$wgDefaultUserOptions['wikieditor-preview'] = 1;

# Displays the Publish and Cancel buttons on the top right side
$wgDefaultUserOptions['wikieditor-publish'] = 1;

# Displays a navigation column (summary) on the right side
$wgDefaultUserOptions['usenavigabletoc'] = 1;

$wgWikiEditorModules['toc']['global'] = true; // Enable the TOC for everyone
$wgWikiEditorModules['toc']['user'] = false; // Don't allow users to turn the TOC on/off individually
Comment 1 Andre Klapper 2012-12-11 18:34:18 UTC
Thanks for taking the time to report this!

Which WikiEditor and which exact MediaWiki versions is this about?
Comment 2 nikus0pokus 2012-12-12 00:29:33 UTC
I have the same problem (Button "Cancel" does saves edited wikitext and Button "Publish" does nothing) with Mediawiki 1.20.2 and WikiEditor 0.3.1.

While waiting for a fix, I modified the modules/jquery.wikiEditor.publish.js file :

// an empty function do the publish action
context.fn.addButton( {
    'captionMsg': 'wikieditor-publish-button-publish',
    'action': function () {
        // $( '#' + dialogID ).dialog( 'open' );
        // return false;
    }
} );
 
// simulate a click on the Cancel link
context.fn.addButton( {
    'captionMsg': 'wikieditor-publish-button-cancel',
    'action': function () {
        $('#mw-editform-cancel')[0].click();
        return false;
    }
} );
Comment 3 Andre Klapper 2012-12-12 12:08:52 UTC
.
Comment 4 taraathan@gmail.com 2012-12-19 21:35:36 UTC
I have the same problem with Mediawiki 1.19.3 and WikiEditor 0.3.1
Comment 5 Andre Klapper 2012-12-19 23:19:42 UTC
Trevor / Roan: Could you investigate here?
Comment 6 Peter 2012-12-24 09:08:08 UTC
(In reply to comment #1)
> Thanks for taking the time to report this!
> 
> Which WikiEditor and which exact MediaWiki versions is this about?

MediaWiki 	1.20.0
WikiEditor (Version 0.2.0)

Peter
Comment 7 Andre Klapper 2013-01-10 12:36:34 UTC
Peter, nikus0pokus, Tara: 
Any accessible wikisites where I could try to reproduce the problem? 
Are there any Java Script errors in the webconsole of your browser? 
Which browser did you test this with?
Could you attach a screenshot of the problem (without any private data shown)?
Comment 8 nikus0pokus 2013-01-11 11:20:11 UTC
Andre,

I did my tests with Firefox 18.0 and Chromium Version 23.0.1271.97 (171054); and I didn't see any Javascript error in the web browser console.
There is no valuable screeshot to do because the Cancel button does the commit action and the Commit button does nothing. So there is nothing to see neither to capture.

Tell me if you absolutely need an access to my wikisite to do your tests.
Comment 9 taraathan@gmail.com 2013-01-18 15:42:55 UTC
I tested with Firefox 18.0. When I turned on Firebug, there were no errors. I have asked, but I doubt my client will be willing to grant write access to his wiki.

However, I'm not sure why all this is needed. The cause of the problem in the PHP script seems clear based on the post of nikus0pokus.
Comment 10 taraathan@gmail.com 2013-01-18 15:44:15 UTC
Correction- not PHP script, but Javascript.
Comment 11 Andre Klapper 2013-01-21 08:17:30 UTC
(In reply to comment #2)
> While waiting for a fix, I modified modules/jquery.wikiEditor.publish.js

No recent changes as per
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/WikiEditor.git;a=history;f=modules/jquery.wikiEditor.publish.js;h=bb631cf22bd0e48f0117fdd5d4d431a7beedfbba;hb=refs/heads/master
and WikiEditor code in that place has not been changed since 2010 (except for coding style cleanups):
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/WikiEditor.git;a=blame;f=modules/jquery.wikiEditor.publish.js;h=bb631cf22bd0e48f0117fdd5d4d431a7beedfbba;hb=HEAD
Comment 12 nikus0pokus 2013-01-21 11:37:07 UTC
Andre,

I think you misundertood me, when I wrote :  
While waiting for a fix, I modified modules/jquery.wikiEditor.publish.js  
It was about my local file on my mediawiki server.

I didn't commit my changes to the git repo because I was not sure that my fix was good (it works, but as I don't underdand the original code I don't know why this fix is needed)

So the best this to do now is understanding once and for all the original code.
According to the blame, Trevor Pascal made this code. Do you have a way to ask him about his code?
For instance :
# what is the meaning of an action function that does nothing
# what is the meaning of an action function that returns false (or true)
# what is the meaning of :  #dialogID.dialog( 'open' )

Thanks
Comment 13 Andre Klapper 2013-01-21 15:40:41 UTC
CC'ing Matma.Rex: Do you have any idea what these JS functions are supposed to do, or maybe even why this fails for several users?
Comment 14 Bartosz Dziewoński 2013-01-21 18:01:05 UTC
Quite simply these button don't do what the text claims they do. (In fact, they don't do anything, except that the "Publish" one cancels the submitting of the form.)

Patch on the way.

Side-note: this can be tested on basically any site with WikiEditor (including Wikipedias) after running the following JS snippet in your browser's JS console: (or adding it to skin.js)

    mw.loader.load('ext.wikiEditor.publish');
Comment 15 Bartosz Dziewoński 2013-01-21 18:09:18 UTC
(In reply to comment #12)
> So the best this to do now is understanding once and for all the original
> code.
> According to the blame, Trevor Pascal made this code. Do you have a way to
> ask
> him about his code?
> For instance :
> # what is the meaning of an action function that does nothing
> # what is the meaning of an action function that returns false (or true)
> # what is the meaning of :  #dialogID.dialog( 'open' )

While I am not the author, I can explain this briefly.

Action function that does nothing simply does nothing. It doesn't even cancel form submission, which is what normally happens when a form button is clicked. That's why the cancelling saved the page.

Action function that returns false cancels form submission. Returning true has no "meaning".

`$( '#' + dialogID ).dialog( 'open' )` (which is what I assume you're referring to) opens a dialog which has the id contained in the `dialogID` variable. (This is a WikiEditor-only extension to jQuery.) The dialog apparently has to be initialized first, and since it wasn't, this didn't work.
Comment 16 Bartosz Dziewoński 2013-01-21 18:10:09 UTC
gerrit change I64589985 submitted. It should fix both issues.
Comment 17 nikus0pokus 2013-01-21 20:59:03 UTC
Bartosz,

Thanks for your explanation and for the fix.
I tested it and it works for me, but it displays a confirmation form on commit. As I'm not interesting in it I'm wondering if you know how to deactivate it (in the settings for instance) ?
And to finish, do you know when your fix will be available on the git repo?

Regards
Comment 18 Bartosz Dziewoński 2013-01-21 21:22:06 UTC
(In reply to comment #17)
> I tested it and it works for me, but it displays a confirmation form on
> commit.
> As I'm not interesting in it I'm wondering if you know how to deactivate it
> (in
> the settings for instance) ?

I think it's another "feature" of Vector. In my user prefs on Wikipedia, it's called "Warn me when I leave an edit page with unsaved changes" in the Editing section, I'm not sure where it comes from. (I didn't notice since Opera doesn't support this, I think intentionally.)


> And to finish, do you know when your fix will be available on the git repo?

Whenever someone with access merges it. This might take a while, since this week most WMF employees will be more busy than usually, dealing with the datacenter migration.
Comment 19 Andre Klapper 2013-01-21 22:10:22 UTC
matma.rex: Thanks so much for taking a look at this, analyzing and explaining it, and coming up with a patch. Really appreciated!
Comment 20 nikus0pokus 2013-01-22 10:03:25 UTC
(In reply to comment #18)
> I think it's another "feature" of Vector. In my user prefs on Wikipedia, it's
> called "Warn me when I leave an edit page with unsaved changes" in the
> Editing
> section, I'm not sure where it comes from. (I didn't notice since Opera
> doesn't
> support this, I think intentionally.)

I don't think it's a Vector feature since I don't install the Vector extension neither I use the Vector skin.
I take a look in the user prefs and I only find in the Edit -> Lab section a way to display hide :
# the WikiEditor toolbar
# the WikiEditor buttons
# a navigation bar

In addition, the display of the commit form is only linked to the WikiEditor commit button, because when I commit with the classic button the commit form is not displayed.
To conclude, it seems the only way to not display the commit form is to change the Javascript code in the jquery.wikiEditor.publish.js file.
A test and a setting could allow to choose between both.


		context.fn.addButton( {
			'captionMsg': 'wikieditor-publish-button-publish',
			'action': function () {
				$( '#editform' ).submit();
				return false;
			}
		} );
Comment 21 Bartosz Dziewoński 2013-01-30 17:25:44 UTC
Patch merged, so I'm marking this as fixed.

Please open a separate bug for any other issues with this :) I'm pretty sure that's how the Publish button was intended to work, but I'm not the one who wrote the code.
Comment 22 Andre Klapper 2013-04-11 13:19:57 UTC
*** Bug 44671 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links