DNN Alert not working on DNN 7 - jquery-ui

I am using the 07.02.01 DNN Version
If I'm logged in with 'Super User Account', it works well. But if I'm not logged in or logged in with others accounts, it don't work.
I try adding the following 3 lines of code at the start of the Page_Load method.
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.jQuery);
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.DnnPlugins);
DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
but DotNetNuke.Framework does not have a JavaScript library class and DotNetNuke.UI.Utilities does not have a ClientAPI class.
I added these 2 lines but still not working:
jQuery.RequestRegistration();
jQuery.RegisterScript(this.Page);

Be sure jQuery is loaded. When you logged in with a super user account jQuery is automatically loaded.

I had a very similar problem, and hopefully the solution I found will also help you.
My problem was, we have an in-house developed "Contact Us" button available on every page, which opens a popup with a Contact Us form, using dnnModal.show.
The problem stems from dnn.js not being loaded, which is needed for popups, and I think alerts, too.
Our solution was to add this to the Page_Load event:
ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);
Remember to add your using/Import statement to import the DotNetNuke.UI.Utilities namespace. You also have to add DotNetNuke.WebUtility as a project reference.

Related

Where is the default 'Login' view and corresponding controller in the template MVC Core application in VS2019

Odd one this, I must be missing something obvious but with a brand new MVC web application, with Authentication, it builds the DB migrations for the asp user tables and puts the _LoginPartial in _Layout etc. and login works fine, I can login and register etc but I can't find the view or code to alter it.
I navigate to localhost:blah/Identity/Account/Login and can login, but there's no view in the project that corresponds, there's an /Areas/Identity folder but it only has /Pages under it, no /Account and there's no Login.cshtml or anything called Account anywhere in the project.
Very odd, I keep thinking I'm just being dim and will look again tomorrow but have done that a few times. I've tried searching for it but only find false matches.
I've created a brand new application from the template a few times now thinking I somehow messed up the choices in the dialogues but it seems so basic - the view is obviously somewhere as it loads up and works fine, but where's MVC getting it view from, and where is the controller it's calling ??
Similarly, I search the project for some text on the page, eg. 'Use a local account to log in', both in VS and using grep on the entire source folder but it's not anywhere.
To fill out the answer to the question behind my question - i.e. how can I customise the login page. To generate the views and code in-project, right click on the Areas/Identity folder in the project, select 'Add' and 'New Scaffolded item...', select Identity and go from there.
Trying that generated an error for me, with a Core 2.2 project; but I retried in a virgin Core 2.1 solution and it worked OK, I then transferred the added folders and files to my 2.2 solution, changed the namespaces to match and I can now alter the login form and log in with it OK.
The account management function to change the phone number also works, so seems like it's all hooked up OK, I've not tried any of the other identify functionality as yet.
Thanks again to Nkosi for the answer.

Make custom changes in admin generator

I develop a symfony 1.4 project,my issue with admin panel in backend,so I use the administration generator to do it.
I have a list of members generated automatically in backend,now Im hopping to add some custom action when a memeber edit her profile in backend,then I wish to add in edit page radio dial buttons give simple “Yes” or “No” Options. By default, the radial dial button is set to “No.” However, if the admin selects “Yes” then a popup window will come with the following text: “Are you sure you want to sell a new membership" and If the admin selects “Yes” and then saves the profile, a pop Window will need to display that reads: “New Membership sold"...
the problem is I can't change code because the form of edition page is generated using a plugin (sfguarduser) so It's deficult to make any changes?
Any Idea?
As the plugin documentation says, you can override the plugin module by creating a module with the same name in the application you want and by adding a require_once in the action.
As for your confirm and other javascript, you can override the generated partials by adding partials with the same name in your module, just as described here.

What happened to the popup dialog in asp.net mvc4

I am fairly new to mvc and I tried mvc4 when it was still in beta. I remember that when I started a new internet project, I got a popup dialog for log in and registration by default. I don't see that when I start a new project anymore, is that gone from the internet project?
I believe the popup dialog you're referring to was just the jQuery UI Dialog that the sample project used to use:
The project was built to support both a straight request to /Login and one via the jQuery UI dialog which was slimmed down to look like it was only a popup. It did this by making the Login action return a different View based on it being requested through the frame or not as detected by a value in the query string.
You can of course have this again, you'll just need to do it manually (or dig out one of the older templates) as it's no longer in the default templates.
To help you out, here's a couple of somewhat related questions that contain the sample code (ContextDependentView is one thing I remember from this template) and probably some hints on how to recreate it:
Generating a modal jQuery partial view with MVC4 does not work
ASP.NET MVC 4 and ContextDependentView
MVC4 - ContextDependentView - What does it mean?
It was removed from the Internet project templates in the final releases of MVC 4. The popup was pretty slick but I imagine there were issues/complexities they decided to eliminate by just keeping the view/page for logon and registration. In the older versions that had the pop-up they still had the view/page for logon because of how forms based authentication works. If the user is not authenticated/authorized for a web site/page MVC does a redirect to the logon page. This will not work with a JQuery popup dialog on the same page. The popup only worked if you clicked on the Logon link for the page. I am guessing that they decided since they need the view/page logon anyway to simplify things and keep it consistent by eliminating the popup dialog.
I have implemented an MVC Single Page Application (SPA) that only uses a JQuery dialog for a popping up a dialog for logon, and eliminates the need for logon page. But it required a fair amount of customization to authentication/authorization process on the server and used basic authentication on the client.

Prototype.js Interferring with Jquery UI

So I am currently working with an e-commerce cms that implements Lightbox to display large product pics.
In the sidebar I have implemented my own tab group powered by jquery-ui.
The sidebar works perfectly on every page except the product pages. i soon found out the problem was the call to prototype.js used by Lightbox...When i comment out the call to the prototype script the tab group starts working again.
I have tried various things like trying to change the scope of my code and reordering when the scripts are called, but this hasn't worked...any ideas on what i could do to remedy the situation?
NOTE: I didn't include any code because i thought we could just throw around soem theory : )...if you think anything would help i can add it
thanks for any help,
~skev
The problem was i needed to use $.noConflict();
before #MichealKoper suggested this i had no idea it existed
Thanks!

Getting nested iframes with Facebooker in iframe app

Has anyone encountered nested iframes in their Rails/Facebooker application?
Basically, every time I click an action or link, the entire facebook page reloads inside my existing iframe, causing two (and more on each subsequent click) facebook borders to appear.
I've gone over the instructions three times and changed every setting imaginable, but the app still opens up in new facebook page inside the iframe. Any ideas anyone?
itonly appears when I use the
ensure_application_is_installed_by_facebook_user
filter, but if the user already has the application installed and I use the
ensure_authenticated_to_facebook
filter, it works fine...very strange (to me at least)
Turns out ensure_application_is_installed_by_facebook_user is deprecated because of a change in Facebook's API.
I plan to update the Facebooker documentation with this information soon.
I experienced the same thing with nested iframes, so I used "ensure_authenticated_to_facebook" instead. The only gotcha was that after the user installed the app, it would redirect them to my domain and not the facebook iframe page. After doing some tweaking in facebooker, I decided to hard code :canvas=>"true" in this method which is in lib/facebooker/rails/controller.rb line 189
def create_new_facebook_session_and_redirect!
session[:facebook_session] = new_facebook_session
next_url = after_facebook_login_url || default_after_facebook_login_url
#top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>params[:fb_sig_in_canvas]}) unless #installation_required
top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>"true"}) unless #installation_required
false
end
I wrote a tutorial on this fix in my blog - http://railsrant.com/2009/10/14/creating-a-facebook-iframe-app-using-ruby-on-rails-facebooker/

Resources