Meridium.FolderBrowserProperty example under MVC

Vote:
 

Hi,

 

I'm looking for an example of using the Meridium.FolderBrowserProperty NuGet package to implement a folder selection property in an EPiServer 7 MVC site. I've got it installed, but can't get the editing UI to display the popup folder selector. I suspect I'm not registering a UIHint or similar problem.

Can anyone provide an example please?

 

thanks,
Andy

#66211
Feb 25, 2013 0:38
Vote:
 

Sure, try with this code:

[UIHint("Folder browser ")]
[BackingType(typeof(PropertyFolderBrowser))]
public virtual string Folder{ get; set; }

    

Cheers

Frederik

#66214
Feb 25, 2013 7:57
Vote:
 

Hi,

Thanks, that does register correctly, but there are still a few problems.

1) On the editing screen the control displays a disabled textbox with text "Click the button to edit" and button with text "...", rather than showing the existing value like in the screenshots from epicode. This would be rather annoying for users as they could not see the existing value. Is there some other attribute I should have?

2) When I click the button to get the folder selector popup, and the subsequent button to browse for a folder, this popup is missing all it's styling. This is because the dialog gets 404s for a couple of CSS files. I'd say this missing CSS is causing the dialog save button not to work (using Chrome).

Looking at the code for FolderBrowserDialog.aspx, it's using a path from a variable named ShellPath, which comes from a VPP named EPiServerShell. This VPP did not exist in my config. I've tried to create the VPP as follows, but these CSS resources still result in 404s. Does the config look correct or am I missing something obvious:

    <add virtualPath="~/EPiServerShell" physicalPath="C:\Program Files (x86)\EPiServer\Framework\7.0.859.1\Application\UI"
      name="EPiServerShell" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework" />

I'm wondering if there is some special permissions that blocks files from this location by default?

Thanks,

Andy   

#66397
Edited, Feb 28, 2013 2:56
Vote:
 

Andy have you setup a corresponding location element in web.config?

 

http://world.episerver.com/Blogs/Robert-Dougan/Dates/2010/12/Setting-Up-a-New-VPP/

 

#66398
Feb 28, 2013 8:22
Vote:
 

Hi,

No, I'd forgotten to do that. I've now configured the web.config:

  <location path="EPiServerShell">
    <system.webServer>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer.Framework" />
      </handlers>
    </system.webServer>
  </location>

 

and VPP in episerverframework.config:

    <add name="EPiServerShell" virtualPath="~/EPiServerShell/" physicalPath="C:\Program Files (x86)\EPiServer\Framework\7.0.859.1\Application\UI" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework" />

also changed the paths in FolderBrowserDialog.aspx so that I don't get 404s any more:

    <link href="<%= ShellPath %>ClientResources/EPi/themes/legacy/Shell.css" type="text/css" rel="stylesheet" />
    <link href="<%= ShellPath %>ClientResources/EPi/themes/legacy/ShellLightTheme.css" type="text/css" rel="stylesheet" />

However the problems still remain. The folder does not show on the main editing screen, and the styling is mostly missing in the select folder dialog.

I also noticed that there are a few JavaScript errors being reported in the select folder tree:

  1. Could not expand path at 3 dojo.js:15
  1. Could not expand path at 3 dojo.js:15
  1. Uncaught TypeError: Object #<HTMLInputElement> has no method 'fireEvent' EditProperty.aspx:104

 

These will be what is stopping Chrome from processing the Save button. I don't get any JavaScript errors on the main editing screen so not sure why the selected folder doesn't display.z

I think I'll have to stick with a plain text property for now unfortunately as it doesn't look like the folder browser works quite right under v7.

Thanks for your help though!

Andy

 

#66468
Mar 01, 2013 0:05
Vote:
 

Hi Andy!

The problem is that fireEvent is only compatible with IE. (See: http://help.dottoro.com/ljvtddtm.php). You can use jQuery's trigger to fire the onchange event instead, so you need to change 3 lines of code in ScriptHelper.cs:

Change the lines: 

statusTextboxCtrl.fireEvent('onchange');

to:

$(statusTextboxCtrl).trigger('onchange');

and of course import jQuery in the beginning of scriptString. :)

It fixes the problem for Chrome and Firefox!

/Masoud




#71722
May 27, 2013 14:38
Vote:
 

Any chance the version on NuGet could be fixed?

I'd fix myself if I had access to the source code.

Thx, Mike

#73216
Jul 10, 2013 16:25
Vote:
 

Hi Mike

The source code is up on EPiCode, just register and apply for membership there and you'll have access to it.

Frederik

#73217
Jul 10, 2013 16:29
Vote:
 

Hi  Andy ,  have you resolved your problem?

#73414
Jul 19, 2013 9:37
Vote:
 

Hello

I have a problem with the Folder Browser Dialog on WebForms.

I can't get the OnSelectedNodeChanged event to fire at all.

Seems to be some problem with the datasource?

 

#80387
Jan 22, 2014 10:26
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.