London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

EPiServer.Web.WebControls.InputDate

Vote:
 

I have tried to put an InputDate webcontrol on a page. But I got a javascript error. The onclick event on the InputDate is "EPi.CreateDateBrowserDialog". This javascript method is in "UI/javascript/system.js". But in web config the UI folder only allow roles WebAdmins and WebEditors.

Am I missing something? My idea is that I should be able to use this webcontrol even for anonymous users.

Regards Hans

#20779
Jun 12, 2008 6:57
Vote:
 

I have solved it but I'm not certain if it is meant to be solved like this

To say before I start: The "SecureUI" folder I write about is the EPiServer UI folder, I named it "SecureUI" at installation.

I had help from the following:
http://labs.episerver.com/en/Blogs/Mari-Jorgensen/Dates/111987/112010/Lessons-learned-Module-Conversion/

where I found that I have to register the following:
<script type="text/javascript" src="<%= EPiServer.UriSupport.ResolveUrlFromUtilBySettings("javascript/episerverscriptmanager.js") %>"></script>
<script type="text/javascript" src="<%= EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.js") %>"></script>
<script type="text/javascript" src="<%= EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.aspx") %>"></script>

I do this in my masterpage.

But if I'm not logged in as admin or editor I get an javascript exception because I dont have access to "SecureUI/javascript/system.aspx".

I have read this before, about Virtual Path Providers and UrlMappings
http://epicms.blogspot.com/2007/03/no-alternate-files-and-it-really-makes.html

So I added the following urlmappings in web.config:
<virtualPathMappings>
    <add url="~/Util/javascript/system.js" mappedUrl="~/SecureUI/javascript/system.js" />
    <add url="~/Util/javascript/system.aspx" mappedUrl="~/SecureUI/javascript/system.aspx" />
</virtualPathMappings>

And I also changed the following lines in my masterpage, ResolveUrlFromUtilBySettings instead of ResolveUrlFromUIBySettings:
<script type="text/javascript" src="<%= EPiServer.UriSupport.ResolveUrlFromUtilBySettings("javascript/system.js") %>"></script>
<script type="text/javascript" src="<%= EPiServer.UriSupport.ResolveUrlFromUtilBySettings("javascript/system.aspx") %>"></script>

Now it works! But is it meant to be done like this?

Regards Hans

#20782
Jun 12, 2008 8:24
Vote:
 
That should be fine as far as I know. I did some tests using the InputDate control some time ago, but I just added a new location node to my web.config and grantedfor everyone access to the javascript folder.
#20806
Jun 13, 2008 9:47
Vote:
 

Thanks Greger!

/Hans

#20857
Jun 16, 2008 11:20
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.