Hi all,
First and foremost thanks to FCK for an amazing tool!
I'm developing a CMS with PHP/MySQL and using FCKEditor.
I've built my own File Manager that also uses MySQL for metadata.
My problem is how to get the URL of an image from my own file browser to the "Image Properties" - window. So far I've tried to set the value of "txtURL" but to no avail, obviously.
I guess I should keep re-reading the ServerSideIntegration.html - file (and I will), but I thought if maybe someone has solved this problem already and would like to share?
Many TIA,
-filipp
First and foremost thanks to FCK for an amazing tool!
I'm developing a CMS with PHP/MySQL and using FCKEditor.
I've built my own File Manager that also uses MySQL for metadata.
My problem is how to get the URL of an image from my own file browser to the "Image Properties" - window. So far I've tried to set the value of "txtURL" but to no avail, obviously.
I guess I should keep re-reading the ServerSideIntegration.html - file (and I will), but I thought if maybe someone has solved this problem already and would like to share?
Many TIA,
-filipp
RE: Custom File Manager integration?
You might want to look at the PHP connector that someone has written already. There's a whole thread or two about it. You should be able to rip that pretty easy, as it's already working. It has added func. as well (delete, thumbnail, rename). Yay!
RE: Custom File Manager integration?
Denny: thanks for Your reply!
I regret to say I still don't get it. Does this mean that I still have to FCK's own file browser (filemanager/browser/default/browser.html) and then just return XML to it?
The problem is I have my own file *browser* (browse.php), so my ImageBrowserURL is "FCKConfig.ImageBrowserURL = "../../../../../browse.php?type=Pictures"; - so that's the window that's popped up when I click on the Image button in the editor.
I found a link [1] saying one should set "window.opener.setImage('" + sFileURL + "') ;" to the image URL, but it seems that only applies to FCK 1.x?
So should my browse.php script really return XML or is that only necessary when using the builtin browser?
Again, thanks for your time and sorry for the mess. I'll also keep on looking at the PHP connectors.
[1] http://www.alsmndalliance.org/mail/admi ... ialog.html
RE: Custom File Manager integration?
The really nifty thing about the browser 'default' is that you can use it with any type of connector, be it php, asp, java, etc. All it needs is valid XML (use sample responses(under _documentation) as examples).
So the line would look something like this in fckconfig.js
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/cfm/connector.cfm" ;
Only reploace cfm with php. And browse where connector is, but connector would be more to specs. And move your browse.php to filemanager/browser/default/connectors.
It's late, that's pro'lly not clear. The idea is that:
editor/filemanager/browser/default/browser.html
sends something like this to your connector:
connector.php?Command=GetFoldersAndFiles&Type=File&CurrentFolder=/Samples/Docs/
And your PHP resource browser connector would return the below, setting the right headers and such so it really comes across as XML.
<Connector command="GetFoldersAndFiles" resourceType="File">
<CurrentFolder path="/Samples/Docs/" url="/UserFiles/File/Samples/Docs/" />
<Folders>
<Folder name="Documents" />
<Folder name="Files" />
<Folder name="Other Files" />
<Folder name="Related" />
</Folders>
<Files>
<File name="XML Definition.doc" size="14" />
<File name="Samples.txt" size="5" />
<File name="Definition.txt" size="125" />
<File name="External Resources.drw" size="840" />
<File name="Todo.txt" size="2" />
</Files>
</Connector>
So long and short is that you use the default browser and make a custom connector. The browser.html sends request, gets response, and presents it to the user.
I'm stoked on the docs with this latest release, they are quite helpful. Yay Documentation!
I'll try to explain it better if this doesn't make sense yet. I'm not too adept at explaining sometimes. I'm more apt to confuse. =)
You don't HAVE to use the FCKedit filemanager, if that was all you were wondering... *nodding off* well, what a great project. Check out the demo php connector from Grant. It implements some nice stuff, and reverse engine-earing it might give you some clues...
Good luck, and I'll help if I can!
RE: Custom File Manager integration?
There is a brief explaination of the filemanager <-> connector concept along with complete developer documentation for writing a connector, for the standard
filemanager and also my extensions to it on my website. ( http://www.mcpuk.net/fbxp ) As xenden said looking through pre existing connectors is quite usefull for getting to grips with writing a connector, on the site you will find a Classic ASP and PHP version.
RE: Custom File Manager integration?
I agree that using the default browser would save a lot of time - in addition, the functionality it (and Grant's fantastic mod) provide are way beyond what my little browser can do.
But the fact is, I really don't need that much functionality. My browser must simply return files of either type "Pictures" or "Files" (anything besides pictures) and, what's most important (and the reason why I set out to code my own browser), a description of the file's contents (which is used in searching inside the site)
My browser fetches the info from a MySQL DB, which further complicates things (syncing the metadata with actual files), but I don't see any other simple way to store the description information.
So finally, I think something like window.opener.setImage('url') would be the best thing for me right now. In file "fck_image.js" I found a method called "SetUrl('url')" which looks promising but so far that triggers
the following JS error:
"document.getElementById("txtURL") has no properties" when calling "window.opener.SetUrl('/foo/bar.png');"for instance... so I'll keep on digging...
RE: Custom File Manager integration?
What you need is the command to just paste into the editor window then. This stuff:
"document.getElementById("txtURL") has no properties"
is for using the window that comes up by default, with width, hight, and a preview and the 'browse server' button. As you have replaced this (I assume as well as the default browser) you don't have a text box named "txtURL", which is what that function is trying to set to the URL of the text.
Seems like what you are tring to do is have the "<img src='/blah/blah.gif'>" inserted into the browser window. If I was a little more with it, I'd paste the insert-HTML code, but you can find this in various places throughout the JavaScript. Like I said, take a look at the javascript that is in the "dialog" windows (like the smiley dialog, which has some javascript that pastes any contents in a <TD></TD> into the textarea.
Also, mcukstorm, I love the addtions you've made, but there was one weird thing that was happening, and that was with the thumbnail function. I was trying to make a crappy little thumbnail thing in ColdFusion but besides the trouble I'm having presenting the images (don't know why... If I send the connector the commands it sends me a picture, theoretically with the right image/whatnot content header... but nothing comes up in the filemanager) it seems it is encoding the & as html (&) insead of passing it the way it should. It meaning the js that sends the connector the filename, type, etc.. Probably just a oversight on my end, and I kludged it to re-encode for my stuff, but just wanted you to know.
At any rate, filippl, you may consider storing the files in a database (that's what *I* like, mostly cuz it's fun to try to get it going, but partly to controll things like descriptions, who edited what & when, etc.) as you can do what I just said in parens. And you get away from maintaining dual systems. (file and db).
Eh. Prolly not much more clear-er. But you were so polite I thought I'd try.
May the Force be Wit'Cha, and this project!
RE: Custom File Manager integration?
RE: Custom File Manager integration?
You can use the function: GetE('txtURL') = url;
I'll take a look at the source... yeah, that's under editor/dialog/js/fck_image.js.
To use some of the nifty js functions you need to include where they are defined, as in <script language='javascript' src='fileWithFunctionDef.js'></script>. That might be what is really causing you problems, if you are using the image dialog.
Have you tried it in IE?
If all else fails, you can use standard js and do something like window.opener.txtURL.value = 'yourImageURL'; and that should populate the txtURL textbox with your URL. Just be sure the case matches and everything. That eliminates the need to include js files... I think.
Yay, Monday!
RE: Custom File Manager integration?
I'm developing this on a Mac atm, so I haven't had a chance to
tried it with IE yet (IE/Mac doesn't work, naturally)
BUT!
I did manage to crack it! So, to anyone out there using their own file manager and trying to get the image URL to the "Image Properties" - window - here's is how it could be done:
<drum roll...>
window.opener.document.getElementById('txtURL').value = '/blah/bleh.png';
Once again, thanks to Denny and Grant for being so patient.
Now, if only I could figure out how to get the popup dialogs to not go behind all other windows...
RE: Custom File Manager integration?
Yeah, I spent 4 hours re-installing cf on a server just because I was trying to go to CFIDE and not cfide. Go figure, neh? Guess I shoulda posted that somewhere appropriate in case someone was a stupid as me and had bookmarks or some such, neh? Bah.
Glad you got it going. Are you gonna post the connector or am I gonna have to mode my crap for the filesystem lusers? ;]
And are you useing xmlElemNew and such or are you going the cheap way out like I did? I'm telling you... objects rock...
But I'm preat-chin to tha chior here, neh?
GOod Job Filip(or is that F Illippl or maybe L Fillipp?;)!
RE: Custom File Manager integration?
RE: Custom File Manager integration?
Thanks for posting the code!