Support forums : File Manager

Embedded FM in Write Form

This forum is for anything and everything that helps us get a handle on what is wrong with and where we want to go with "file manager".

Moderator: Dracones

Embedded FM in Write Form

Postby Kimberly » Thu Mar 01, 2012 6:28 pm

I have never like the FM in a pop-up because it is a new window and when you switch focus, it goes behind the main window. I often upload files at the time I write posts and use the insert code that is presented. If I forget the files window is already open and click on files, it opens the window anew, losing the insert code that was available.

Note: a simple solution to this would be to set a flag when we open the FM in a pop-up and clear the flag when we close it. If FM is already open, the flag is set, then clicking on files would simply change the focus to the FM pop-up window instead of reopening it. Not sure how much would be involved to allow this behaviour.

I have been playing with the idea of embedding the file manager into the write form itself. The FM could be viewed or hidden the same as we do now with the advance properties section or the renderers section and so forth. The embedded FM would ignore the settings for the main FM view; for example, we don't need to show the actions for files or file sizes since it would be rarely used when writing a post This would conserve space and the embedded FM would not require a lot of space.

How does the team feel about going from a FM in a pop-up to an embedded FM for writing posts? Modal windows would not be that useful in this case, a true model windows does not allow one to switch back and forth since the focus is locked on the model window until you close it. I did look at an idea of using a floating box that was not a true model window which stayed on top of the write window and allowed one to go back and forth at will. However, a floating window would probably tend to be in the way most of the time. The embedded file manager would sit below the textarea and never be in the way and could be easily collapsed as we do with the other sections.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Fri Mar 02, 2012 4:35 pm

Setting the flag would not work if someone closes the pop-up window in some manner outside of our control, such as the x or the OS.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Sat Mar 03, 2012 4:01 am

What I have done is to simply embed the file manager inside the write form using an inline frame, iframe. I pass the parameters to the source part of the iframe just as we do with the FM in a pop-up. This checks to see if the user has permissions for the file manager or if the file manager is enabled, all the things we do with the pop-up except it loads it into an inframe.

Code: Select all
echo '<iframe width="805" src="'.url_add_param( $Blog->get_filemanager_link(), $fm_url_params ).'"></iframe>';

It is a little ugly of course. It needs to be presented as we do other elements on the write form with the ability to hide and unhide as needed; that will come later as I work on it.

Then it is simply a matter of changing the code in the _files_list.inc.php to go from two separate windows to a parent-child window arrangement.

current code:
Code: Select all
window.opener.focus();
textarea_wrap_selection( window.opener.document.getElementById("itemform_post_content"), snippet, '', 1, window.opener.document );
self.close();


revised code:
Code: Select all
textarea_wrap_selection( parent.document.getElementById("itemform_post_content"), snippet, '', 1, parent.document );


Quick test I was able to select an image and insert it into the write form, add some paragraphs, position the cursor and then insert another image at the cursor position. No work was done to the upload control script which is used if one uploads a file using the fm in a pop-up yet. That will need to be done as well.

I am not a programmer, so feedback is needed by those who know. Of course a lot more is to be done and I am just hacking at stuff. What would be nice would be able for the user to decided how they would like the file manager to work in the write form, embedded, or a pop-up. I was looking over at dynamic scripts at changing the pop-up to pseudo modal window but I am favouring an embedded file manager.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Sat Mar 03, 2012 4:10 am

Here is something I need to think about. I did not clear the selections and ended up adding an image again when adding a new one. Might be best to clear the selection after we insert images. Mmmm.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Sun Mar 04, 2012 10:44 pm

I expanded the view of the file manager a bit and put it in our fieldset so that it can be viewed and hidden at will. Edited the upload control to allow inserting into the post after you upload a file using my modified "Add Image Code".
Attachments
embedded_fm.jpg
embedded_fm.jpg (145.63 KiB) Viewed 12818 times
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Tue Mar 06, 2012 8:18 pm

Kimberly wrote:Setting the flag would not work if someone closes the pop-up window in some manner outside of our control, such as the x or the OS.


Revisiting this idea. Is it possible to have an onclose() function so that if someone closes the window it will clear the flag? Or, if the flag is set and the window is close and we try to switch focus to the non-existent window, can we simply reopen the window? I might look into this as we do need to think about how the pop-up can function better when focus is switched from the pop-up to the write form but not closed. On Vista and Windows 7 machines, all browser windows are grouped together into a single icon so it is possible for a user to forget the pop-up is opened behind the write form. While I still favour an embedded file manager in the write form, we may actually want to offer both methods.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Fri Mar 09, 2012 4:38 am

Another aspect of either the pop-up FM or the embedded FM is what columns to display. In the full file manager we have the room to display all the columns. However, in the pop-up or embedded version we have limited space (unless of course we expand out the width ). The point is, in our pop-up or embedded view we often don't need all the columns we might want to display in the full view FM. We have a user preferences for what columns to show in the FM. What would be nice is to have another set of user preferences for what columns should be shown in the pop-up or embedded FM. For my embedded FM I just hard-coded what columns to not show if I was in the upload mode of the FM. That works fine for me but there is no flexibility for other's preferences, thus, the need for an extra set of FM preferences.

I was hoping this post would generate some discussion but so far that has not been the case.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby Kimberly » Sun Mar 11, 2012 5:58 am

I have encountered another small problem, adding images from the embedded file manager when TinyMCE is running. As I examined the code for inserting into the textarea, from the functions.js file, it is coded for open windows, not a child window embedded on the same page. So there is more learning for me.

I guess no one else is interested in this embedded file manager.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: Embedded FM in Write Form

Postby leeturner » Sun Mar 11, 2012 11:36 am

Hi Kimberly

Sorry I haven't replied sooner. Haven't had the chance to get on the forums for a little while due to work commitments.

If I am honest I don't seem to have any issue around the way the file manager works so I must work in a slightly different way to you when writing my posts. As a result I don't have a major opinion either way around embedding the FM in the write screen. I guess my preference would be for it not to impact the write screen in any way especially performance. For example, if I have 500 files in my blog directory, I don't want to click on the 'write' button on the menu only for the write screen to hang while it loads the files into the file manager.

If you are going down this road then performance should be a major consideration.

I don't know if there is any way to embed the file manager via a plugin so people can make the choice as to whether they want it embedded or not but that might be something to explore?

Overall it will be interesting to see where you go with this.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: Embedded FM in Write Form

Postby Kimberly » Mon Mar 12, 2012 1:14 am

Yes, performance should be a consideration. I see no significant hit with the embedded file manager, The write form loads completely in short time while the file manager loads in the thumbnails in the background. I could start typing as soon as the form was up, which on my connection is within a second. I did notice that as I typed while the file manager was loading there was some slight jerkiness but not in anyway inhibiting and the file manager loads fairly quickly; just as quick as it would load in a pop-up. Most of my delay is due to the fact that most of my files are in the main root of my blog media folder and it is the loading of the thumbnails that is the major roadblock; and even then as I said, it is of no significance. Most of the time I don't jump into typing as soon as the write form is up, this was mainly as a test to see if the textarea was affected. For information purposes, I have 8 directories, 751 files, 251 MB in the media folder.

Lee, I would not see this as a plug-in. What I would envision would be both methods sitting side by side and using a switch in the user's preferences to determine which to load, the embedded file manager, or the pop-up file manager for the write form. A simple check on the user's preferences will determine if the embedded file manager is loaded or not. I actually had both available when I was playing with this. There are other files that need to be changed so that either or even both really; one user may use the embedded file manager, the other the pop-up file manager. The file scripts at the moment have only the pop-up file manager code so some work would be needed so that either one could be supported. For example, while I was able to insert the image code into the regular textarea, when enabling TinyMCE, it stopped functioning. An examination of the functions.js file shows that the call back for TinyMCE is hard coded for an open widow only. We would need to make changes that would allow both the embedded child window, and the pop-up window to both handle the TinyMCE call back. So at this point, my embedded file manager is not functioning with TinyMCE and I need to try and see if I can understand how the TinyMCE callback works and so far I am not sure. Any help with understanding this part would be appreciated.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Next

Return to File Manager

Who is online

Users browsing this forum: No registered users and 1 guest

cron