Page MenuHomePhabricator

Cancel Button saves text, Publish Button does nothing
Closed, ResolvedPublic

Description

Author: dadofekl

Description:
WikiEditor:

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

relevant parts of LocalSettings.php:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  1. See includes/DefaultSettings.php for all configurable settings
  2. and their default values, but don't forget to make changes in _this_
  3. file, not there.
  1. If you customize your file layout, set $IP to the directory that contains
  2. 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";

  1. For more information on customizing the URLs please see:
  2. http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
  3. 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';

  1. For a detailed description of the following switches see
  2. http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
  3. There are many more options for fine tuning available see
  4. /includes/DefaultSettings.php
  5. 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();

  1. To enable image uploads, make sure the 'images' directory
  2. is writable, then set this to true:

$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/bin/convert';

  1. If you have the appropriate support software installed
  2. you can enable inline LaTeX equations:

$wgUseTeX = false;
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

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

  1. Default skin: you can change the default skin. Use the internal symbolic
  2. 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;

  1. When you make changes to this configuration file, this will make
  2. 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 ...

  1. $wgNamespacesWithSubpages[600]
  2. = $wgNamespacesWithSubpages[601]
  3. = 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


Version: master
Severity: major

Details

Reference
bz42198

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 1:11 AM
bzimport added a project: WikiEditor.
bzimport set Reference to bz42198.

Thanks for taking the time to report this!

Which WikiEditor and which exact MediaWiki versions is this about?

nikus0pokus wrote:

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;
}

} );

taraathan wrote:

I have the same problem with Mediawiki 1.19.3 and WikiEditor 0.3.1

Trevor / Roan: Could you investigate here?

dadofekl wrote:

(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

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)?

nikus0pokus wrote:

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.

taraathan wrote:

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.

taraathan wrote:

Correction- not PHP script, but Javascript.

nikus0pokus wrote:

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 :

  1. what is the meaning of an action function that does nothing
  2. what is the meaning of an action function that returns false (or true)
  3. what is the meaning of : #dialogID.dialog( 'open' )

Thanks

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?

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');

(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 :

  1. what is the meaning of an action function that does nothing
  2. what is the meaning of an action function that returns false (or true)
  3. 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.

gerrit change I64589985 submitted. It should fix both issues.

nikus0pokus wrote:

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

(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.

matma.rex: Thanks so much for taking a look at this, analyzing and explaining it, and coming up with a patch. Really appreciated!

nikus0pokus wrote:

(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 :

  1. the WikiEditor toolbar
  2. the WikiEditor buttons
  3. 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;
			}
		} );

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.

  • Bug 44671 has been marked as a duplicate of this bug. ***