DNN 9 SPA Module QuickSettings - dotnetnuke

I am very sorry to have to do a post like this, but I have been looking everywhere and I have not found a good example of how to use/reference quick settings on a SPA module for DNN 9. IS there anyway that someone could point me to some sample code or give an example of how you can save/reference a modules quick settings.

My Restaurant Menu example module has a SPA version that with a full, working implementation of the Quick Settings.
Edit:
In my above example, I just access the setting in the controller webAPI method for the view. If you would like to spit out the setting as a SPA token in your view html, you use [ModuleContext:{SettingName}].
In my above example, I am setting the module setting in with the following code:
ModuleController.Instance.UpdateModuleSetting(ActiveModule.ModuleID, "RestaurantMenu_CurrencyCulture", settings.CurrencyCulture);
The second parameter is the setting's dictionary key name. Therefore, to get this setting value in the View.html, I would use the following SPA token: `
[ModuleContext:RestaurantMenu_CurrencyCulture]

Related

How can I use DNNSharp MyTokens in 2SXC Razor templates?

I have a content type and C# Razor template for a simple page hero built using 2SXC. I also have a DNNSharp MyTokens with a simple token that looks like this: [DBQ:EligibleForExam]
Using the regular DNN HTML module, I can put my token in the source and it renders the value of the token.
I want to display the value of this DNNSharp MyToken inside of the C# Razor template but it doesn't show the value. Furthermore, I want to perform an if else statement on this value.
Here's what I want to do:
#if [DBQ:EligibleForExam] = 1 {
<p>You are eligible for the exam</p>
}
How can I use DNNSharp MyTokens in 2SXC?
In this case you can choose between going all the way 2sxc or all the way DNNSharp :
- scenario 2sxc: translate the DNNSharp token to 2SXC. I don't know what's behind that code but I guess it is some kind of SQL select and/or filters. In 2SXC you can create content types with SQL as a source. In the query designer, you can filter these results.
- scenario DDNSharp: in MyTokens you create a razorscript or HTML and make a token out of that. I don't think you hit any barriers soon following this path.
The core problem is that tokens are not well architected in DNN, there is no officialy "global" token system which knows about the DNN Sharp tokens.
I believe it should be easy to do though: I'm pretty sure there will be some documentation on DNN Sharp how to use their tokens in any c# or MVC page. Probably just 2-3 lines of code. So best check their docs.
2SXC does not render DNNSharp tokens like html module or EasyDNNSolutions do.
It would be an awesome thing as MyTokens and 2SXC are both very powerfull.
But maybe we can fix your problem within 2SXC itself or within DNN Sharp/HTML
What are you trying to accomplish? You can share the case / code here. Or if you feel this is beyond the Q&A setup that Stackoverflow is, you can send me an email.
Cheers
Tycho

Angular templates and cache invalidation

I am working on a project that uses Angular1, we hit the problem where when we change an html template the users will not see the change until a hard refresh is performed. Ideal would be to have the cache service to check a timestamp and invalidate the cached file. As an example now I edited a template used by the $stateProvider.
My questions is what solutions or best practices are used to solve the problem?
P.S since our JS files are combined in 1 file we fixed the problem there by appending a timestamp in the script tag from our PHP backend
Interesting question! We've had the same issue in a project that uses Angular1.x. We solved it using angular-cache-buster.
It basically helps you put a httpInterceptor. All you need is have ngCacheBuster in module dependency injection, and inject httpRequestInterceptorCacheBusterProvider in the .config of your app to set the match list.
For example,
httpRequestInterceptorCacheBusterProvider.setMatchlist([/.*api.*/], true);
this tells it to cache everything except REST api requests. You can learn more about the configuration here.

Having conflict with Django URL and Angular Route

I am currently working on a project using Django and Angular. I am trying to implement Django's Password-Reset app, which seems pretty easy to set up. I followed the instructions and I ran into a peculiar issue that is caused by Angular's routing. I am trying to link to a FormView using
Forgot password?
But it seems that Angular's routing keeps picking up the literal translation of the link
http://127.0.0.1:8000/%7B%%20url%20'password_reset_recover'%20%%7D
This of course causes a routing error to pop up.
Is there anyway I can link to this view without Angular interfering?
Looks like the problem is that Django is not parsing your URL tag in the template. Might want to look into that rather than into Angular
Could you check the a tag in your Developer tools and see what it says? Chances are that it says exactly what the URL is pointing to.i.e. /%7B%%20url%20'password_reset_recover'%20%%7D
Have you added password_reset_recover in your root urls.py?

Shall I use SPA or traditional approach with AngularJS

I'm new to AngularJS, I have following scenario that I need to implement:
Assume index.html page only has an input field for enter a unique ID, when click submit button, the unique ID will be passed to backend for retrieving all information needed(for example, User object with current status, last name, first name etc ). Based on User.currentStatus, it should show different page with the same header and footer. There is no top menu bar on any of the page. Basically, all the pages are displaying different information about a user based on his status.
Honestly, it depends on your backend architecture, but if you're new to Angular I'd recommend a SPA, since most resources are geared towards building a SPA.
Angular can be used either "traditionally" or in a SPA environment. Given that Angular does specifically target use in SPA's, that's the path I suggest.
Here's is a reference to $route in the AngularJS documentation, which you'll need in order to build a SPA: $route
You'll also need to read up on ngView, which is referenced near the top of that page.
For a SPA, structuring the project well can make things a whole lot easier, so here's a reference to a good style guide for Angular as well.

ASP.NET 3.5 webforms URL Routing question

I'm attempting to configure URL routing in my ASP.NET 3.5 WebForms app. Setting up routes has always been confusing to me, so I was hoping I could get some direction.
My requirement is fairly simple. I'm setting up different "brands" of my application, and I'd like the brand to be specified in the URL. For example, http://www.mysite.com/brand1/Default.aspx would bring up one brand (code behind would look up brand1 in the db and load specific text, images, themes, etc) and http://www.mysite.com/brand2/Default.aspx would bring up another brand, etc.
I'm fairly flexible with how the URLs are displayed, with the exception of keeping the http://www.mysite.com/brand1 prefix. That cannot be changed.
Thanks for any help!
I do this by using http://www.UrlRewriter.net, as explained here by Scott Gu:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
The trick is to use URL rewriting rules (Regular Expressions) in your web.conifg to get a request for /brand1/default.aspx to actually execute /Processor/Default.aspx?brand=brand1, for example.
NB: The Form.browser trick worked a treat for me when doing postbacks.
Another possible answer from me...
If you're using IIS 7 there is a handy built in module for URL Rewiring, all controlled through a GUI if that's your preference:
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

Resources