Extension talk:Embed Document

A note from the author: I dropped this simple and small extension here to share it with you as a typical pareto principle solution for legacy documents. Such documents are frequently encountered in corporate Wikis. I cannot check back here very often, but at some time I might work on the extension again. Until then you mainly might want to take it as an initial start for your own solution. Posting ideas here is welcome here, though, to probably help others.

-

Error with Large Files & FCKEditor
When using this extension along with the Extension:FCKeditor, I receive a php timeout error. This is understandable as it does take longer to load these files. Changing the settings to allow PHP to execute longer, would probably fix the error. However, It removes the safeguard to prevent problems. I don't know that there is a reasonable solution to this dilemma. I guess you cant just have it all.


 * Answer

PDFs usually are larger in nature sadly. They anyway are kind of evil for a Wiki because they lack fulltext searchability. The extension is available only to support legacy documents which frequently occur in some inhouse corporation Wikis sadly. In such Wikis you probably need to increase the timeout tolerance.

Conflict with thumb
Using this script, I got a conflict with the display of thumbs - "thumbs.php" didn't work anymore. Right now I haven't got a clue to fix this problem. Only solution so far is to remove the extension.


 * Answer

Has not yet been observed here. Can you describe the problem in more detail?

Firefox behavior
Working AWESOME for me on Safari. On Firefox it wants to Launch the PDF in a new browser window. Check it out - caseyk 1-3-2008


 * Answer

This depends on the local browser configuration of the client, i.e., how it handles embedded  HTML tags and cannot be controlled by the Wiki. The only workaround that jumps to my mind would perhaps be to detect the client browser via JavaScript and render a link instead of an iframe in such cases :-( Any other ideas?

Modification request
Hello. It is simple to tweak this so that is complains if you are no logged in - I am using it for my PDF articles and I want people to log in to be able to read the PDF files. www.extremeboatsmag.com casey@extremeboatsmag.com

Thanks !


 * Answer

Good point. Feel free to post the code here to the talk page for takeover. Note that in LocalSettings.php you can configure the set of pages which non-logged-in users can see. If something like this is added, that setting should be tolerated.

height/width as variable
Hi, i use your extension to embed pdf documents... but the documents differs a lot in their height/ width... is it possible to send a variable with ?--: 212.184.19.70 14:29, 6 March 2008 (UTC)
 * Ok i found a solution to my question...
 * You can add a document like 250 /path/to/document.pdf and then you have to explode the $input in two parts $data = explode(" ", $input) before you look for allowed chars. then replace all $input with $data[1] and ...height=" . $data[0] . "px... --: 212.184.19.70 15:11, 6 March 2008 (UTC)
 * It is also solved with version 0.12 - I had the same impression, width and height should be changable! --DrTrigon 16:56, 12 July 2008 (UTC)


 * Answer

Yes, this was missing in the first quick'n'dirty shot. Now has been added already here by someone else, thanks.

Word file embedded doesn't work
Hi This extension work well for PDF file but not for other especially for the .doc files Is it a bug or a configuration or use problem ?

Thanks to reply CGT 04/06/08


 * Answer

This is a general problem. The extension simply puts the document to display into an  tag, and doing so with a *.doc file will only work with a browser that'll render that file inline, which is Internet Explorer plus installed WordViewer or Word. Other browsers will probably open the link in a separate instance. As this solution tries to keep the implementation investment at a minimum, because we're dealing with non-Wiki legacy documents here, no server-side conversion of existing *.doc files to something else is attempted.

Initial Problem
With MW 1.12 could not get this to work. Changed in embed_document.php

#if( str_replace($allowedchars, , $input) ==  ) { return " "; #};
 * 1) else {
 * 2)       return "Filenam: $input Error: invalid character sequence between    markers, allowed
 * 3) are onlya...zA...Z0...9_/.</li>-</li>:</li></ul> ";
 * 4)   }

Still Not working
Hi

I changed embed_document.php But still am not able to embed word files. is it a bug or something else should be configured?

Correction
Hi,

i had the same problem with 1.13. I have traced the problem back to the used Filepath funktion. It returns the needed file path with [] and because of those the php extension throws an error.

So if you extend the embed_document.php by

$input = str_replace(']', '', $input); $input = str_replace('[', '', $input); just before

if( str_replace......

This way it worked fine for me.

Regards Dirk

Solution Takeover
(has not yet happened, t.b.d.)

Excel
Hi - does this extension work with Excel (either as XLS or saved as HTM)? Or is there another extension / way of working that does this? We really want to be able to see the contents of an Excel table in MediaWiki without a manual action. --Robinson Weijman 13:50, 7 April 2009 (UTC)


 * Answer

This will only work in browsers that render the Excel document inline, probably using ActiveX. This will probably be only Internet Explorer, or a Firefox installation with added general ActiveX support. I already tried this, too, but the nasty thing about this is that changes in the Excel file cannot be easily loaded up back into the Wiki. Users get frequently confused by this. A better solution for this usecase would probably be to use Excel as an external editor; but this requires some more handfuls of nuts and bolts to work smooth. Post ideas here if you have any.

Hyperlinks within embedded pdf file
I have hyper linked certain sections of the same page where the pdf document is embedded. Now these links open fine, but within the window of the embedded document and not on the original page (Do I explain myself?). This is confusing. Is there a way to avoid this?? Thanks, --Horst Salzwedel 16:51, 17 October 2009 (UTC)


 * Answer

I fear this cannot be changed. You may be wanting to search for an option in the PDF renderer to open hyperlinks in a new, separate Window. However, I fear that this will lead to the effect that you'll get a second Window or tab...

Embeding a hyperlinked document
Embeding a hyperlinked document would be nice. For example if there is a document http://some.web.org/intro.pdf I would like to see it embeded (rendered) in my wiki page. Is that possible?

Embeding files only shows in Preview
I installed the extension and added the <embed_document width="50%" height="300">test.htm</embed_document>.

If I click "Show Preview" I see my page and the spreadsheet as I want it to be. However, when I click on "Save Page" it saves the page but the spreadsheet no longer renders in-line. Instead I get my normal Wiki page and in the window where the spreadsheet was in the preview is another wiki page with the name space of my test.htm file.

Not sure if this was clear enough. Basically after a save I get a wiki inside a wiki. It appears that my wiki is showing up in the instead of my spreadsheet. Pretty weird. Would love to get this working.

I have tried this with the latest versions of Chrome, FireFox and Internet Explorer

Please advise if possible.

Same Problem here -DJSigmund