#2386: Patch for function wfSajaxSearchArticleFCKeditor
-----------------------+----------------------------------------------------
Reporter: tmanthey | Owner:
Type: Bug | Status: new
Priority: Normal | Milestone:
Component: General | Version: FCKeditor 2.6.2
Resolution: | Keywords: patch wfSajaxSearchArticleFCKeditor
-----------------------+----------------------------------------------------
Comment(by tmanthey):
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 ) {
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, "Media:") === 0) {
$ns = NS_IMAGE;
$term = substr($term, 6);
$prefix = "Media:";
}
else if (strpos($term, ":Image:") === 0) {
$ns = NS_IMAGE;
$term = substr($term, 7);
$prefix = ":Image:";
}
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);
}
}
---------------------------------------------------------
--
Ticket URL: <http://dev.fckeditor.net/ticket/2386#comment:1>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac