Selecting a file in the edit interface of a Dynamic Content plugin

Vote:
 

We are in the process of upgrading from EPiServer 6R2 to 7.5, and I am struggling with one of our Dynamic Content plugins.

Our plugin has a property of type PropertyDocumentUrl, which should let the editor select a file. Now, PropertyDocumentUrl is not a type that EPiServer can generate an input field for (ref http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Dynamic-content/Creating-a-plug-in/), so we need to have have a custom edit interface. Our edit interface is a user control which inherits DynamicContentEditControl, and is displayed as expected when the editor tries to create the dynamic content.

My problem is this: How can provide the editor with an input field where they can select a file?

We have previously used the custom controls from http://etf.codeplex.com for the edit interfaces of our dynamic content plugins (the DocumentSelector in this case), but these don't work with EPiServer 7.5.

#81015
Feb 07, 2014 9:56
Vote:
 

For the label layout issue, you can set the label and editors on different rows by defining the RowLayout property for your property control:

public override EPiServer.Core.TableRowLayout RowLayout
{
get
{
return EPiServer.Core.TableRowLayout.Wide;
}
}

For the question regarding selecting a document there is currently no built in solution for this. I'm not sure if there is anyone that has built one yet and I hope we can replace the current UI with the same editing system as for regular content soon.

#81451
Feb 17, 2014 16:31
Vote:
 

1.
Thanks for the input on the TableRowLayout, but it really doesn't provide me with the control I want. I'd like to load a custom stylesheet, where I can override and adjust the necessary styles as I see fit. Is this not at all possible?

2.
My approach to being able to select a file so far, is to create a new control which inherits from PropertyStringControl. I then override the function "CreateEditControls()" and create a label, a textbox and a button with the text "...". All that remains is to hook up a javascript to the click-event of the button, that should display a popup that allows the editor to select a file.

Using Reflector, I see that the javascript function "EPi.CreatePageBrowserDialog()" is referred to in the method "GetPageBrowserDialogMethod()" in the class "EPiServer.Web.WebControls.InputPageReference". However, searching for the CreatePageBrowserDialog-function in my filesystem, I find it in "i C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Application\Util\javascript\dialog.js", which puzzles me a little. Are the files in the "7.0.586.1"-folder also available for the 7.5-installation?

With Reflector, I also see that the url-parameter to "EPi.CreatePageBrowserDialog()" is "edit/pagebrowser.aspx". A new search reveals that this file exists under "C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Application\UI\CMS\Edit\". Again the location of the file confuses me a little. If it is used by EPiServer 7.5, why doesn't it exist under one of the folders of the 7.5-installation? And I can confirm that the popup works fine. If I try to navigate to http://my.web.site/EPiServer/CMS/edit/PageBrowser.aspx, the tree for selecting an article is indeed displayed.

I thought that this was good news, because I believe the file responsible for displaying the file-selection-dialog is "FileManagerBrowser.aspx", which resides in the same folder as "PageBrowser.aspx". The strange thing, however, is that when I try to navigate to http://my.web.site/EPiServer/CMS/edit/FileManagerBrowser.aspx, I am getting a 404-error. What am I missing? Is there a mapping somewhere that I am not aware of?

I feel that I'm pretty close to the goal here, just a couple of steps short of a working solution. Or perhaps I am miles away, and that this was to be solved using dojo and dijit (I have looked at what is generated for a property with return type "Url" on a normal template, and the popoup that gets displayed when one wants to select an image, but it's not easy to understand how to wire up and reuse any of it).

If this is unsolvable using the "old way", when will EPiServer provide the necessary framework and directions for doing it the "new way"?

I need to get this working before we can migrate from 6R2 to 7.5...

#81479
Feb 18, 2014 11:05
Vote:
 

1. It is not possible to load a custom style sheet in this dialog (of course you can do this by inserting a link element to your custom property, but nothing mainstream and supported).

2. There is no built in web control or JavaScript method to select a file in EPiServer 7.5 for legacy editing. I think that you should be able to post the URL to the file with the built in property control you get when using the built in textbox PropertyDocumentURL. Of course, this is only a temporary solution. Another option might be using blocks instead since you can create a block with a file selector and drag and drop blocks unto the html editor. Might this be a solution to replace the usage of Dynamic Content?

#81522
Feb 18, 2014 16:26
Vote:
 

I know this is an old thread but maybe someone is still reading.

I am trying to make a custom property work in legacy mode in EPi 7.5. In my custom property I have a TinyMCE editor which is loading alright. The problem is when I want to insert an image. I cant get the browse for image window to load, 404 not found (Requested URL: /episerver/UI/CMS/edit/FileManagerBrowser.asp)

Is it even possible to get it to work, concidering the answer in the previous post?

#85362
Apr 23, 2014 17:15
Vote:
 

Hi Sara!

There is currently no web form control to select a media item which means that the legacy property system don't have a good solution for this. And considering that they are legacy, I doubt that we'll ever fix it. There is a chance that we'll create a web control to pick a media item since there are a few places in the administrative interface where we need this which is still built on web forms but I don't know that there is anyone planning this in the near future.

What are you doing in your legacy property? Are you having logic that is hard to implement in the new editing system? It seems to me that you have several fields so a block should be a good option for that.

#85374
Apr 24, 2014 7:49
Vote:
 

The legacy property concist of a question and an answer(editor) and a sortable list of the added items. I am not feeling too comfortable with dojo/dijit yet so if I was to build this property I would like something simular to look at. I tried to search the web, but no luck. 

The thought of blocks have crossed my mind, you would get a lot of the functionality "for free". But the bug(?) that makes it impossible to limit the available block types from the shortcut create block, made me look for other options.

#85383
Apr 24, 2014 9:00