Ticket #2116 (new Bug)

Opened 2 years ago

Last modified 13 months ago

MediaWiki and file links

Reported by: wwalc Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version: SVN (FCKeditor)
Keywords: Confirmed Cc: fwoelk@…

Description

Source:  http://www.fckeditor.net/forums/viewtopic.php?f=6&t=9289

we are using wiki extension FCKeditor 2.6 in media wiki 1.11.0 to edit the wiki text. The editor is working fine with just one exception. Because we don't want to upload all documents to the wiki, we link documents to our wiki pages with the following syntax:

<html><a href="file://servername/directoryname/documentname.doc" target="_blank">description</a></html>

After editing the page with FCKeditor the code is replaced by the editor with:

[file://servername/directoryname/documentname.doc description]

So the link doesn't work any more.

Attachments

locallink.jpg Download (71.2 KB) - added by conjur3r 21 months ago.
Local File Link extension
locallink.zip Download (4.6 KB) - added by conjur3r 21 months ago.
Local File Link extension files
es.js Download (1.2 KB) - added by Daynras 18 months ago.
Spanish translation for locallink extension
tb_locallink.gif Download (179 bytes) - added by arczi 18 months ago.
Button image
2116.patch Download (10.3 KB) - added by arczi 18 months ago.
All in 1 patch

Change History

  Changed 22 months ago by w.olchawa

  • keywords Confirmed added

Confirmed using MW 1.12 and the latest FCKeditor SVN extension.

To reproduce just add $wgRawHtml = true; in LocalSetting.php and paste in the above html code.

  Changed 22 months ago by conjur3r

You have to add $wgUrlProtocols[] = "file:"; to your LocalSettings.php file. Here is the reference:  http://meta.wikimedia.org/wiki/MediaWiki_FAQ#Is_it_somehow_possible_to_use_a_.22file.22_URI-qualifier_for_local_intranets_e.g._.5Bfile:.2F.2Flocalhost.2FC:_C-Drive.5D.3F

Also, I'm very close to completing a plugin for Mediawiki+FCKeditor which will allow you to do this easily. This will be my first contribution to this project so I'll need some direction as to who to talk to?

  Changed 22 months ago by wwalc

Sounds great!

You can create new ticket and attach a plugin here at dev.fckeditor.net. If you need any help, you may try to catch me at #fckeditor IRC channel at irc.freenode.net.

We can either add a link to your plugin at  http://mediawiki.fckeditor.net or even include it in the package.

Also please feel free to email me directly:

wiktor AAA fckeditor DDD net 
(AAA = @, DDD = .)

Changed 21 months ago by conjur3r

Local File Link extension

Changed 21 months ago by conjur3r

Local File Link extension files

follow-up: ↓ 5   Changed 21 months ago by conjur3r

I've attached the work I've been working on. I think it's ready for others to give it a bash. I've also attached a preview of what it looks like (on Linux).

Installation:

1. Unzip the file into:

/wiki/extensions/FCKeditor/plugins/

2. Edit /wiki/extensions/FCKeditor/fckeditor_config.js

Add to the top of the page:

FCKConfig.Plugins.Add("locallink", "en");

Add to your desired placement for the button

'Local_Link'

eg:

['Link','Unlink','Anchor','Local_Link'],

Let me know of any feedback/bugs/etc.

Changed 18 months ago by Daynras

Spanish translation for locallink extension

in reply to: ↑ 4 ; follow-up: ↓ 6   Changed 18 months ago by Daynras

Hello conjur3r,

when installing the 'locallink' extension, I proceed as you comment in your install instructions.

However, when loading FCKeditor I get an error "Unknown item "Local_Link"" when loading the toolbars.

I have tried also to replace the " " by ' ' in both "LocalSetting.php" and "fckeditor_config.js" but it is still not working.

I have also set the extension to spanish (created a file es.js, which I attach, by translating your en.js), but I am getting the message always, regardless of the language set.

Therefore, although I have tried with all the possible combinations, my lines in LocalSettings.php now look like:

FCKConfig.Plugins.Add( 'locallink', 'es' );
...
$wgUrlProtocols = array(
 'http://',
 'https://',
 'file:',
 'ftp://',
 'irc://',
 'gopher://',
 'telnet://', // Well if we're going to support the above.. -ævar
 'nntp://', // @bug 3808 RFC 1738
 'worldwind://',
 'mailto:',
 'news:'
);

while fckeditor_config.js contains:

      ['Link','Unlink','Anchor','Local_Link'],

and fckplugin.js now contains:

// register the local link command
FCKCommands.RegisterCommand( 'Local_Link', new FCKDialogCommand( FCKLang['DlgLocalLinkTitle'],
FCKLang['DlgLocalLinkTitle'], FCKConfig.PluginsPath + 'locallink/dialogs/locallink.html', 500, 300 ) );
// create the local link toolbar button
var objLocalLink = new FCKToolbarButton( 'Local_Link', FCKLang['DlgLocalLinkTitle'], null, FCK_TOOLBARITEM_ICONTEXT);
objLocalLink.IconPath = FCKConfig.PluginsPath + 'locallink/images/locallink.gif';
FCKToolbarItems.RegisterItem('Local_Link', objLocalLink);

Thank you for your help.

Replying to conjur3r:

I've attached the work I've been working on. I think it's ready for others to give it a bash. I've also attached a preview of what it looks like (on Linux). Installation: 1. Unzip the file into: /wiki/extensions/FCKeditor/plugins/ 2. Edit /wiki/extensions/FCKeditor/fckeditor_config.js Add to the top of the page: FCKConfig.Plugins.Add("locallink", "en"); Add to your desired placement for the button 'Local_Link' eg: ['Link','Unlink','Anchor','Local_Link'], Let me know of any feedback/bugs/etc.

in reply to: ↑ 5   Changed 18 months ago by conjur3r

Your LocalSettings.php file shouldn't have

FCKConfig.Plugins.Add( 'locallink', 'es' );

This line goes to the top of your fckeditor_config.js file.

As for the language file, I'll take a look at that shortly. I've already discovered one bit of text that isn't translatable :(

follow-up: ↓ 8   Changed 18 months ago by Daynras

Sorry, I mistyped it.

That line is in fact in my fckeditor_config.js, together with the 'mediawiki' plugin already present.

Do I need to insert the line on the very top of my config file?

Thanks for the plugin.

in reply to: ↑ 7 ; follow-up: ↓ 9   Changed 18 months ago by conjur3r

Try putting that line to the top of the config file. That's where I have mine at present.

in reply to: ↑ 8   Changed 18 months ago by Daynras

It was simply a file permissions problem. Now everything works perfect.

Ah, in the translation file es.js, please replace the string "File:" by "Archivo:", now I have it completely translated.

Thank you for your help.

Replying to conjur3r:

Try putting that line to the top of the config file. That's where I have mine at present.

Changed 18 months ago by arczi

Button image

  Changed 18 months ago by arczi

  • keywords Review? added

Changed 18 months ago by arczi

All in 1 patch

follow-up: ↓ 12   Changed 18 months ago by jdm

Hi,

I've installed the extension, and it's exactly what i need for an intranet-based wiki. But unfortunately it doesn't work.

I can add a filelink in FCK-Editor, but after saving the article (or switching to wikitext-view) the link is corrupt: The path to the file looks like "C:\directory\file.jpg", but the link points to " file:///file.jpg". I'm running MediaWiki 1.13.1 and the current FCKEditor extension.

Do you have any ideas how to solve this?

in reply to: ↑ 11   Changed 18 months ago by conjur3r

Replying to jdm:

Hi, I've installed the extension, and it's exactly what i need for an intranet-based wiki. But unfortunately it doesn't work. I can add a filelink in FCK-Editor, but after saving the article (or switching to wikitext-view) the link is corrupt: The path to the file looks like "C:\directory\file.jpg", but the link points to " file:///file.jpg". I'm running MediaWiki 1.13.1 and the current FCKEditor extension. Do you have any ideas how to solve this?

Just a quick question: what browser have you tried in and on which operating system?

I'm on MW 1.12 so I can't confirm on MW 1.13.x

  Changed 18 months ago by jdm

I've tested it on WindowsXP Pro and Firefox 3 and it doesn't work. After reading your post I tried it in Internet Explorer 7, and the links are being created correctly, so it seems there's a FF problem.

Here's what I learned about the problem so far: The updateParent() function in "childfile.html" extracts the filepath and name from the HTML-form. In IE everything works fine, in FF3 only the filename is read. I have currently no idea why this happens, i'll try to find a work-around in the next days...

  Changed 18 months ago by conjur3r

I just gave it a test on XP and got a similar result with FF 3. It is fine with FF 2.x though. I noticed this happen in Opera 9.5 on linux as well.

I assume it is a security feature of the browsers to stop accidental leakage? I'm also hopeful there is a bypass method for firefox...

  Changed 18 months ago by arczi

  • keywords Review? removed

Could you attach sample content which doesn't work?

  Changed 18 months ago by jdm

I just did find the reason for that behavior: It's a FF3 "feature" that was implemented for security reasons. See here:  http://support.mozilla.com/tiki-view_forum_thread.php?locale=tr&comments_parentId=91513&forumId=1 and here:  https://bugzilla.mozilla.org/show_bug.cgi?id=143220

@arczi: Just download and install the "locallink"-extension from above and try to create a link to a local file using FF3.

  Changed 13 months ago by jhfslkjdfaks

  • cc fwoelk@… added
Note: See TracTickets for help on using tickets.