Bookmark and Share
Showing posts with label DotNetNuke. Show all posts
Showing posts with label DotNetNuke. Show all posts

Friday, February 15, 2013

Hot to change the DotNetNuke skin “on the fly”

Here is how to change dynamically the DNN skin based on the user credentials, in my case I needed to show the standard DNN skin for the “host” user.
The code has been injected in the DNN default.vb file, but you can use the code inside a custom module.

VB.NET:

If Not DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo.Username Is Nothing Then
If DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo.Username.ToString() = "host" Then
TabController.CurrentPage.ContainerPath = "/Portals/_default/Containers/imagicle1/"
TabController.CurrentPage.ContainerSrc = "/Portals/_default/Containers/imagicle1/Article.ascx"
TabController.CurrentPage.SkinDoctype = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"
TabController.CurrentPage.SkinPath = "/Portals/_default/Skins/MinimalExtropy/"
TabController.CurrentPage.SkinSrc = "/Portals/_default/Skins/MinimalExtropy/index 1280.ascx"
End If
End If


C#


if ((DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo.Username != null)) {
if (DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo.Username.ToString() == "host") {
TabController.CurrentPage.ContainerPath = "/Portals/_default/Containers/imagicle1/";
TabController.CurrentPage.ContainerSrc = "/Portals/_default/Containers/imagicle1/Article.ascx";
TabController.CurrentPage.SkinDoctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
TabController.CurrentPage.SkinPath = "/Portals/_default/Skins/MinimalExtropy/";
TabController.CurrentPage.SkinSrc = "/Portals/_default/Skins/MinimalExtropy/index 1280.ascx";
}
}


Thursday, July 29, 2010

How To center “Coding Staff Popup” DNN module

If you need to show a simple popup message on your Dot Net Nuke site you can download and install the good “Coding Staff Popup”, here is the demo page.

Here is the nice modal popup created with this module:image

I found useful to override some behaviors like width, height, hide the title bar and reposition the popup, here is what to do:

1) Hide the title bar
Go to the module “Advanced Settings” and add to the Header section the code:

<style type="text/css">
.popup-window-header
{
display:none!important;
}
</style>


Image:
image

2) Resize the popup:
In the same section add the CSS style:
.jqmWindow
{
position:absolute!important;
width:1030px!important;
height:380px!important;
top:160px!important;
margin-left:0px!important;
}


3) Center the popup:
With JQuery you can easily reposition the popup using the exact window size, add to the “Advanced Settings” “Footer” the code:

<script language="javascript">
$('div[id*="popupDialog"]').css('left',($(window).width()/2)-($('.jqmWindow').width()/2));
</script>

Note that popupDialog and jqmWindow' are HTML elements created by the Popup module.

Here is the Picture of the module section:image

Here is the page before the patch :
image

And here is the result, popup aligned exactly to the center, title hidden with custom popup size.

image

Tuesday, November 10, 2009

DNN: how to reset the host password

Here is a way to reset the password of the DNN host user, it's usefull if you forget the password or if you need to install a copy of a DNN installation without knowing the host password:

Declare @UserName NVarChar(255)
Declare @NewPassword NVarChar(255)
Declare @PasswordSalt NVarChar(128)
Declare @Application NVarChar(255)

Set @UserName = 'host' -- This default DNN host user
Set @NewPassword = 'newpassword' --New password

Set @Application = (SELECT [ApplicationID] FROM aspnet_Users WHERE UserName=@UserName)
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))

Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5


Hope it helps,

Tuesday, April 21, 2009

DOTNETNUKE e JQuery

Se volete utilizzare JQuery all'interno di DotNetNuke (DNN) potete includere la libreria tra gli script di DNN che vengono caricati da ogni pagina.

Il problema è che DNN utilizza già una funzione javascript chiamata $.

Per poter utilizzare JQuery si deve chiamare la funzione "noConflict" che rimappa la funzione $ su un altro nome.

Ecco un esempio:

<script>
var $$ = jQuery.noConflict();
// jQuery ora è accessibile tramite la funzione $$
alert($$(document));
</script>