Opened 16 years ago

Closed 12 years ago

#1649 closed New Feature (invalid)

Editor will not change the category

Reported by: Brad F Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version:
Keywords: Discussion Cc:

Description

If a page has a category entry, ex: category:animals, if you edit the page and type over the old category name with a new category name, such as reptiles, the category name does not change when you save the page.

Change History (5)

comment:1 Changed 16 years ago by Alfonso Martínez de Lizarrondo

Component: GeneralProject : MediaWiki+FCKeditor
Keywords: category edit removed

comment:2 Changed 16 years ago by Wojciech Olchawa

Keywords: Confirmed added

Confirmed - steps to reproduce:

1. Type this code in the Wikitext view

[[ex: category:animals]]

2. Go to WYSIWYG view and back to Wikitext again

3. Notice that the entry is changed to

[[Ex: category:animals|ex: category:animals]]

which is an expected behavior.

4. Go back to WYSIWYG view and change the name from ex: category:animals to ex: category:reptiles

5. Switch to Wikitext again. You will see that the text is transformed to:

[[Ex: category:animals|ex: category:reptiles]]

so only the viewable name is changed however the name of the category still remains the same.

The expected behavior would be for the editor to change it to

[[Ex: category:reptiles|ex: category:reptiles]]

comment:3 Changed 16 years ago by Wiktor Walc

Keywords: Discussion added; Confirmed removed
Type: BugNew Feature

I think it is not a bug.

To change the category, right-click with your mouse and change the link (category). What you see is the "Sort key" (http://meta.wikimedia.org/wiki/Help:Category).

This is not intuitive, so the default behaviour could be slight different: if someone change the "Sort key" to Category:other, we can assume that one wanted to change the category, not the sort key, and change it automatically.

Example: start with

[[Category:Ferrari]]

change the name to Category:Cars in WYSIWYG mode, you should get

[[Category:Ferrari|Category:Cars]]

and the proposal is that it should be automatically converted into

[[Category:Cars]]

comment:4 Changed 16 years ago by Doru Moisa

This will do it:

function replaceCategories($text){
	$s1 = '/\[\[\s*[\w]*\s*:\s*[\w]*\s*\|\s*([\w]*)\s*:([\w\s]*)\]\]/';
	$r1 = '[[$1:$2]]';
	return preg_replace($s1, $r1, $text);
}

function fixCategories($parset, $text) {	
	$text =  replaceCategories($text);
	return true;
}

function fixCategoriesSave($article, $user, $text) {
	$text =  replaceCategories($text);
	return true;
}
function fixCategoriesSaveConflict() {
	global $fckPageEditor;
	$fckPageEditor->textbox2 = replaceCategories($fckPageEditor->textbox2);
	$fckPageEditor->textbox1 = replaceCategories($fckPageEditor->textbox1);
	return true;
}
$wgHooks['ArticleAfterFetchContent'][] = 'fixCategories';
$wgHooks['ArticleSave'][] = 'fixCategoriesSave';
$wgHooks['EditPageBeforeConflictDiff'][] = 'fixCategoriesSaveConflict';



Please see bug http://dev.fckeditor.net/ticket/1385 for details regarding the "EditPageBeforeConflictDiff" hook.

comment:5 Changed 12 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

Since FCKeditor is no longer supported and was replaced with CKEditor, active development of the MediaWiki extension and support for it are also finished.

I’m closing this ticket as it is no longer valid.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy