Opened 16 years ago
Closed 16 years ago
#2386 closed Bug (fixed)
Patch for function wfSajaxSearchArticleFCKeditor
Reported by: | Tobias Manthey | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Project : MediaWiki+FCKeditor | Version: | FCKeditor 2.6.2 |
Keywords: | HasPatch Review+ | Cc: |
Description
The function searches by default only the NS_MAIN namespace. It does not extract the namespace from search term and thus does not find articles that are not located in NS_MAIN.
The below code adds this functionality:
function wfSajaxSearchArticleFCKeditor( $term ) {
global $wgContLang, $wgOut,$wgExtraNamespaces;
$limit = 10;
$ns = NS_MAIN;
$term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
if (strpos($term, "Category:") === 0) {
$ns = NS_CATEGORY; $term = substr($term, 9); $prefix = "Category:";
} else if (strpos($term, ":Category:") === 0) {
$ns = NS_CATEGORY; $term = substr($term, 10); $prefix = ":Category:";
} else if (strpos($term,":")) {
$pos = strpos($term,":"); $find_ns = array_search(substr($term,0,$pos),$wgExtraNamespaces); if ($find_ns) {
$ns = $find_ns; $prefix = substr($term,0,$pos+1); $term = substr($term,$pos+1);
}
}
Attachments (4)
Change History (13)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Component: | General → Project : MediaWiki+FCKeditor |
---|---|
Keywords: | HasPatch added; patch wfSajaxSearchArticleFCKeditor removed |
Changed 16 years ago by
Attachment: | 2386.patch added |
---|
comment:3 Changed 16 years ago by
Keywords: | Review? added |
---|
comment:4 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
There is an error when there is no extra namespace defined in $wgExtraNamespaces.
Additional check must be performed when this condition returns true:
else if (strpos($term,":")) {
I mean something like
is_array($wgExtraNamespaces)
Changed 16 years ago by
Attachment: | 2386_2.patch added |
---|
comment:5 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:6 Changed 16 years ago by
When I search for:
:Image:Monz
I get valid results, so it generally works, but when I select one of the links to images, I get:
[[:Image:Monza_3.gif|rtecolonImage:Monza_3.gif]]
("rtecolon" is added)
comment:7 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
Changed 16 years ago by
Attachment: | 2386_3.patch added |
---|
comment:8 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:9 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
The old patch did't work with the current trunk so I have manually applied all changes. It seems that it works (tested on 1.13.5 and 1.14.0).
Committed with [3185].
The function searches by default only the NS_MAIN namespace. It does not extract the namespace from search term and thus does not find articles that are not located in NS_MAIN. Addititionally the functionality to add Media: and :Image: links was added.
The below code adds this functionality:
function wfSajaxSearchArticleFCKeditor( $term ) {