DotNetNuke

36
Introduction to DotNetNuke: The current version is 5.x It was written in Vb.net But the custom module can be written in any .Net supported language ie C# also. It has builtin support for SqlServer provider but has to extend custom provider for supporting other databases. DotNetNuke has good support for Server Operating systems. But can be installed in XP too. Different DotNetNuke Versions: DotNetNuke 3.x was built on .Net framework 1.1 and DotNetNuke 4.x was built on .Net framework 2.0 1. DotNetNuke 3.x – 4.2 supports .Net framework 1.1 2. DotNetNuke 4.6 – 4.4 supports .Net framework 2.0 3. DotNetNuke 4.09 – 5.1(current) supports .Net framework 3.5 DotNetNuke supports Silverlight Ajax Web 2.0 concepts From DotNetNuke market place we can buy third party modules for cheaper rates. Even so many free modules are available. DotNetNuke Feature list: 1. Adsense 2. Documents 3. Feedback 4. HTML 5. Map 6. NewsFeeds 7. Store 8. UsersOnline

Transcript of DotNetNuke

Page 1: DotNetNuke

Introduction to DotNetNuke:

The current version is 5.x

It was written in Vb.net

But the custom module can be written in any .Net supported language ie C# also.

It has builtin support for SqlServer provider but has to extend custom provider for supporting other databases.

DotNetNuke has good support for Server Operating systems. But can be installed in XP too.

Different DotNetNuke Versions:

DotNetNuke 3.x was built on .Net framework 1.1 and DotNetNuke 4.x was built on .Net framework 2.0

1. DotNetNuke 3.x – 4.2 supports .Net framework 1.12. DotNetNuke 4.6 – 4.4 supports .Net framework 2.03. DotNetNuke 4.09 – 5.1(current) supports .Net framework 3.5

DotNetNuke supports

Silverlight Ajax Web 2.0 concepts

From DotNetNuke market place we can buy third party modules for cheaper rates. Even so many free modules are available.

DotNetNuke Feature list:

1. Adsense2. Documents3. Feedback4. HTML5. Map6. NewsFeeds7. Store8. UsersOnline9. Announcements10. Events11. Forum12. IFrame13. MarketShare14. Reports

Page 2: DotNetNuke

15. Survey16. Wiki17. Blog18. FAQs19. Help20. Links21. Media22. Repository23. User Defined Table24. XML

Benefits:

It’s open source It was built on .Net framework. Large community support and good support from the DotNetNuke portal guys. Gets response within 1 business day for our queries in DotNetNuke forums. It is very active. Continual stable version releases. Including new features in all the releases. Large number of custom modules (both free and commercial) available in DotNetNuke Market

Place. At reasonable prices we can get best modules. Lets say www.bring2mind.net and from

http://www.marketplace.DotNetNuke.com we can get Tagging, Content & Publishing module, Document versioning.

Our expertise benefits we have more expertise on .Net. It will help us in using the existing resources effectively instead of learning a new language.

High Level Approach:

How to extend DotNetNuke?

1. Existing modules (out of the box custom installation02. Free modules available in internet3. Paid modules available in DotNetNuke Market Place4. Custom module development

DotNetNuke Control Panel enables us to perform the below actions

1. Page Functions like adding pages, import ,export functionalities ,2. Add New module , Add Existing module and 3. Common tasks like user, roles, files, site configuration tasks.

Page 3: DotNetNuke

4. Apart from that there is a setting for each module to perform some more tasks.

There are three types of users provided by DotNetNuke.

1. Host User for adding custom modules either a third party module or our own developed module.

2. Portal Admin user for performing tasks like Add new modules on the site and giving permissions to the relevant users.

3. General users who are registered on the site who have very less permissions.

From sourceforge.net we can download DotNetNuke.

http://sourceforge.net/project/showfiles.php?group_id=77052&package_id=77939

Installation & Configuration:

For installation we have to download install.zip file For upgrade download upgrade.zip file. For custom development download source.zip file and install starter kit. Install starter kit it

installs DotNetNuke templates in Visual Studio.

Here we are extracting install.zip file into a folder by name ‘dnn4install’.

Create empty database in SqlServer.

Right click on the folder ‘dnn4install’ and select properties. In Security tab add “Network” and “Network Service” and give full permissions to both for Windows Server 2003. For Windows Server 2000 select “AspNet” in security tab.

Open the web.config file and change the connectionstring and appsettings to point to the database.

Type inetmgr in RUN. Right click on Default WebSite and create New Virtual Directory say dnn4install’.

In browser open http://localhost/dnn4install/install/install.aspx

It shows typical and custom installation modes.

With Typical installation only some default modules like Links, HTML comes. LiveID, OpenID authentication providers comes.

Select custom installation mode so that wiki, blogs, forums etc in-built modules are seen in DotNetNuke.

With “Auto” installation mode: It bypasses the wizard completely.

Apart from LiveID, OpenID authentication providers Active Directory,CardSpace comes in Custom installation mode.

Page 4: DotNetNuke

Note: May face problem if Active Directory authentication mode was selected.

Configure host user and portal administration. Remember the portal administrator username and password.

Working with DotNetNuke:

Adding custom third party modules:

Login with Host credentials

Click on Host -> Module Definitions

In the screen click on “Install New Module” link

Page 5: DotNetNuke

In the next screen browse the zip file and click on “Install New Module” link.

Then all the files in the module are extracted and installed automatically.

“Installation Successful” message appears at the end.

Create a new tab:

See the “control panel”. Select “Edit” mode.

In “Page Functions” click on “Add”.

See the below picture.

Page 6: DotNetNuke

Give some name to Page Name, Page Title fields.

Select “None Specified” for “Parent Page” if there is no parent page for the newly added one or select a page from the dropdown list if it has parent page.

Check the checkbox “Include in Menu”

Give the required permissions for the users.

And click on “Update” link.

Page 7: DotNetNuke

Stay in your newly created page.

Now in the control panel which is at the top select “Add New Module” radio button.

Select the newly added module in the “Module” dropdown list.

Select “Pane”, “Insert” and “Align” as per your requirements and click on “Add” link.

The new module appears in the page.

Create Menu:

Click on Add link in Page Functions in Control Panel.

Give Menu12 for ‘Page Name’ and ‘Page Title’.

Select the page ‘Test’ in “Parent Page” dropdown. So Menu12 comes under ‘Test’ tab.And click on update link.

Page 8: DotNetNuke

Add SubMenu:

Click on Add link in Page Functions in Control Panel.

Give ‘Sub Menu1’ for ‘Page Name’ and ‘Page Title’.

Select the page ‘Menu12’ in “Parent Page” dropdown. So ‘Sub Menu1’ comes under ‘Menu12’ menu.

Don’t forget to check ‘Include in Menu’ checkbox.

Finally it looks like the below:

There is no limitation on the creation of submenus. But the user interface gets disturbed as shown in the screens below.

Page 9: DotNetNuke

Issue:

Limitation: If no .o f tabs increases then Admin, Host won’t appear and the newly added ones also. There is no restriction on the no. of tabs creation but one can display 8 tabs (including Host, Admin tabs).

Add Leftside , Right side links :

Select “Add New Module” from Control Panel.

Page 10: DotNetNuke

Select “Links” in Module dropdown.

Select “LeftPane” in Pane dropdown.

Click on Add link.

In the left side “Links” module appears. Click on “Add Link”.

Give Menu1 for Title.

Select”Page” in LinkType.

Select “Menu1” from the “Select A Web Page From Your Site” drop down.

Give description and click on update.

Again click on “Add link” and repeat the process.

And the final output looks like this:

Page 11: DotNetNuke

Repeat the same for right side pane too as per the requirement.

Creating New User:

Admin -> User Accounts

Adding New Skins:

Host-> Skins

How to hide a menu:

Click on the menu.

Admin -> Pages

It will display list of existing pages.

Click on Settings in Actions at the right side.

Then in the new screen check the checkbox “Include in Menu”

How to go to market place:

Common Tasks in Control Panel

Click on Solutions

Page 12: DotNetNuke

How to develop our own custom module:

Environment: Visual Studio 2005 vb.net

SqlServer 2005

IIS

DotNetNuke 4.09 version

Here we are extracting ‘DotNetNuke_04.09.00_Source.zip’ file into a folder by name ‘dnn4Source’. Note that ‘website’ folder present in ‘dnn4Source’’.

Create empty database ‘Dnn4Source_DB’ in SqlServer.

Right click on the folder ‘dnn4Source’and select properties.

In Security tab add “Network” and “Network Service” and give full permissions to both for Windows Server 2003. For Windows Server 2000 select “AspNet” in security tab.

Type inetmgr in RUN. Expand Web Sites. Right click on Default WebSite.

Select New -> Virtual Directory

Give Virtual Directory Alias name as ‘dnn4Source ‘and browse dnn4Source\website folder for path.

Note: create virtual directory for website in the above step.

Open DotNetNuke.sln file in notepad.

First two lines are like this:

Microsoft Visual Studio Solution File, Format Version 9.00

# Visual Studio 2005

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://localhost/DotNetNuke_Maintenance/", "http://localhost/DotNetNuke_Maintenance", "{79D3BA0F-F76F-4A84-AE7F-C6A01EC247F9}"

Just change the virtual directory name from “DotNetNuke_Maintenance” to “dnn4Source”.

Microsoft Visual Studio Solution File, Format Version 9.00

# Visual Studio 2005

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://localhost/ dnn4Source /", "http://localhost/ dnn4Source ", "{79D3BA0F-F76F-4A84-AE7F-C6A01EC247F9}"

Save it.

Page 13: DotNetNuke

Then double click ‘DotNetNuke.sln’ to open the visual studio solution.

It has this projects structure.

Locate the file release.config (under http://localhost/dnn4Source ) and rename to web.config.

Open the web.config file. Default web.config file looks like the below.

Change Connectionstring tag and appSettings tag to point to the new database settings.

Use SQL Server 2000/2005 in both Connection String and App Settings tags.

Page 14: DotNetNuke

In browser open http://localhost/dnn4Source/install/install.aspx

It shows typical and custom installation modes.

Page 15: DotNetNuke

With Typical installation only some default modules like Links, HTML comes. LiveID, OpenID authentication providers comes.

Select custom installation mode so that wiki,blogs,forums etc in-built modules are seen in DotNetNuke.

With “Auto” installation mode: It bypasses the wizard completely.

Select Next.

Select “Test Permission”. “Your site passed the permissions check” should appear.

Page 16: DotNetNuke

Click Next.

Select SqlServer 2000/2005. Give database name. Give credentials. Give dnn4(say) for Object Qualifier. It helps in identifying the custom tables and sps of DotNetNuke. Their names starts with this dnn4.

Click “Test Database Connection”.

“Connection Success” message should appear.

Page 17: DotNetNuke

Then click Next.

Page 18: DotNetNuke

Then Click Next. Configure host . Remember the host username and password.

Page 19: DotNetNuke

Click Next

Default modules are HTML and Links

Click Next

Apart from LiveID,OpenID authentication providers Active Directory, CardSpace comes in Custom installation mode.

But facing problem when selecting Active Directory authentication mode.

Page 20: DotNetNuke

Click Next

Click Next

Page 21: DotNetNuke

Click Next.

Configure portal administration . Remember the portal administrator username and password.

Page 22: DotNetNuke

Click Next

Page 23: DotNetNuke

Install DotNetNuke_04.09.00_StarterKit.vsi starter kit which creates the following templates in Visual Studio editor.

DotNetNuke Dynamic Module DotNetNuke Simple Dynamic Module DotNetNuke Skin.

Open ‘dnn4Source’ solution.

AssemblyInfo.vb and Global.asax.vb files present under “App_Code” in “http://localhost/dnn4Source/” folder.

Right click on http://localhost/dnn4Source/ in the solution explorer and Select “Add New Item”.

Select “DotNetNuke Dynamic Module” template and Visual Basic as the language. Give “SampleModule” for Name. Click Add. “SampleModule” is the module name for the DotNetNuke site.

Page 24: DotNetNuke

Observe the App_Code folder in “http://localhost/dnn4Source/” folder.

It has created ‘ModuleName’ folder having DataProvider.vb, SampleModuleController.vb,SampleModuleInfo.vb and SqlDataProvider.vb files. It means it has created business logic layer and database logic layer files.

DataProvider.vb and SqlDataProvider.vb files are for database logic layer.

SampleModuleController.vb and SampleModuleInfo.vb files are for business logic layer.

One more change is

Under ‘DeskTopModules’ folder it has created “ModuleName’ folder which contains App_LocalResources,Documentation, EditSampleModule.ascx, Settings.ascs,ViewSampleModule.ascx ,01.00.00.SqlDataProvider and SampleModule.dnn.It means presentation layer files are created automatically by the DotNetNuke portal engine.

01.00.00.SqlDataProvider file contains the queries to create tables and stored procedures.

SampleModule.dnn file is required to add this module into DotNetNuke.

Page 25: DotNetNuke

Read the help page given after adding the module.

It instructs to rename /App_Code/ModuleName to /App_Code/SampleModule, and rename /DesktopModules/ModuleName to /DesktopModules/ SampleModule.

Right click on ‘ModuleName’ of App_Code and DesktopModules in the Solutions Explorer and rename them to ‘SampleModule’.

Build the solution. It should build successfully.

Set http://localhost/dnn4Source/ as the start up project and default.aspx as startup page.

Run it. DotNetNuke website comes up. Login with host credentials.

Click on Host -> SQL

Page 26: DotNetNuke

Switch back to ‘dnn4Source’ Visual Studio solution. Open 01.00.00.SqlDataProvider file under DesktopModules/SampleModule under http://localhost/dnn4Source/ and copy the content of 01.00.00.SqlDataProvider file.

Switch back to the DotNetNuke website and paste the script into the window, check the "Run as Script" box and click EXECUTE.

if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}YourCompany_SampleModule]') and OBJECTPROPERTY(id, N'IsTable') = 1)

BEGIN

CREATE TABLE {databaseOwner}[{objectQualifier}YourCompany_SampleModule]

([ModuleID] [int] NOT NULL,[ItemID] [int] NOT NULL IDENTITY(1, 1),[Content] [ntext] NOT NULL,[CreatedByUser] [int] NOT NULL,[CreatedDate] [datetime] NOT NULL

)

ALTER TABLE {databaseOwner}[{objectQualifier}YourCompany_SampleModule] ADD CONSTRAINT [PK_{objectQualifier}YourCompany_SampleModule] PRIMARY KEY CLUSTERED ([ItemID])

CREATE NONCLUSTERED INDEX [IX_{objectQualifier}YourCompany_SampleModule] ON {databaseOwner}[{objectQualifier}YourCompany_SampleModule] ([ModuleID])

ALTER TABLE {databaseOwner}[{objectQualifier}YourCompany_SampleModule] WITH NOCHECK ADD CONSTRAINT [FK_{objectQualifier}YourCompany_SampleModule_{objectQualifier}Modules] FOREIGN KEY ([ModuleID]) REFERENCES {databaseOwner}[{objectQualifier}Modules] ([ModuleID]) ON DELETE CASCADE NOT FOR REPLICATION

ENDGO

/** Drop Existing Stored Procedures **/

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}YourCompany_GetSampleModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

drop procedure {databaseOwner}{objectQualifier}YourCompany_GetSampleModulesGO

Page 27: DotNetNuke

/** Create Stored Procedures **/

create procedure {databaseOwner}{objectQualifier}YourCompany_GetSampleModules

@ModuleId int

as

select ModuleId, ItemId, Content, CreatedByUser, CreatedDatefrom {objectQualifier}YourCompany_SampleModule with (nolock)left outer join {objectQualifier}Users on {objectQualifier}YourCompany_SampleModule.CreatedByUser = {objectQualifier}Users.UserIdwhere ModuleId = @ModuleIdGO

Observe the bold statements. They are meant for creating tables and stored procedures in the backend.

It creates tables and stored procedures in the backend.

Note: To manually execute this script you must *****/

/***** perform a search and replace operation *****/

Page 28: DotNetNuke

/***** for {databaseOwner} and {objectQualifier} *****/

databaseOwner is generally dbo

objectQualifier is Dnn4 which was created during installation of dnn4source

It follows this naming convention:

CREATE TABLE {databaseOwner}[{objectQualifier}YourCompany_SampleModule]

It creates Dnn4_YourCompany_SampleModule table in db.

5 Stored procedures like this pattern:

create procedure {databaseOwner}{objectQualifier}YourCompany_{operation_name}{Module_Name}

Page 29: DotNetNuke

Here

operation_name is Add,Delete,Get,Update (it creates for all CRUD operations)

Module_Name is SampleModule

In this case:

Dnn4_YourCompany_AddSampleModule

Dnn4_YourCompany_DeleteSampleModule

Dnn4_YourCompany_GetSampleModule

Dnn4_YourCompany_GetSampleModules

Dnn4_YourCompany_UpdateSampleModule

Now click on Host -> Module Definitions.

Down:

Click on “Import Module Definitions” link.

In the “Import Module Definition” screen select “SampleModule.dnn” in Manifest drop down.

Page 30: DotNetNuke

Then click on “Import Manifest” link.

Then it should appear in “Module” drop down in Control Panel.

Select “Add New Module” radio button and select the “SampleModule” from Module drop down and select a pane and click on Add to a page.

If any error is coming like this:

Then check the database whether the tables and stored procedures are created or not.

If there are no errors then click on “Add Content” link in the newly added module.

After adding the content in the module the final output appears as below:

Page 31: DotNetNuke

This completes the custom module development.

Check the table (Dnn4_YourCompany_SampleModule) structure in database

It has one column for adding the content.

Now append some more columns in the db and execute the generated script “01.00.00.SqlDataProvider” in SqlServer or DotNetNuke (Host->SQL) site.

Do the corresponding changes in business logic, domain logic and presentation layers files which are

DataProvider.vb and SqlDataProvider.vb files are for database logic layer.

SampleModuleController.vb and SampleModuleInfo.vb files are for business logic layer.

Under ‘DeskTopModules’ folder it has created “ModuleName’ folder which contains App_LocalResources,Documentation, EditSampleModule.ascx, Settings.ascx and ViewSampleModule.ascx files. It means presentation layer files.

Page 32: DotNetNuke

References:

1.DotNetNuke mirrors:

http://sourceforge.net/project/showfiles.php?group_id=77052&package_id=77939

2.Upgrade DotNetNuke 3x to 4x:

http://www.mitchelsellers.com/blogs/articletype/articleview/articleid/106/upgrading-dnn-3x-to-dnn-4x.aspx

3.Videos:

http://www.dnncreative.com/Tutorials/DNNTutorialsforCoreModules/BlogModule/tabid/308/Default.aspx

Todd Davis: Videos on module development

http://www.dotnetnuke.com/Default.aspx?tabid=810

4.Module programming:

http://dnnsecrets.wordpress.com/2008/01/19/create-a-helloworld-dotnetnuke-module-in-6-easy-steps/

http://www.dnncreative.com/Tutorials/DNNTutorialsforCoreModules/BlogModule/tabid/308/Default.aspx

http://www.dotnetnuke.com/tabid/795/Default.aspx

4.For sending new post to DotNetNuke Forums:

http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/108/scope/threads/Default.aspx

5.DotNetNuke module development for beginners:

http://www.codeproject.com/KB/custom-controls/Creating_A_DNNModule.aspx

6. Workflow:

http://www.codeplex.com/workflow

7.Other References:

http://www.dnncreative.com

http://dotnetnuke.com