21
April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC Module Programming 101 Scott Wilkinson @DotNetNuclear

Module Programming 101

  • Upload
    kara

  • View
    89

  • Download
    0

Embed Size (px)

DESCRIPTION

Scott Wilkinson @DotNetNuclear. Module Programming 101. Outline. IIS Setup and DNN install Install Christoc’s DNN7, DAL2 Template using vsix install Create RestaurantMenu project Build project in Release mode (fix missing /package folder issue if applicable) - PowerPoint PPT Presentation

Citation preview

Page 1: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

Module Programming 101

Scott Wilkinson @DotNetNuclear

Page 2: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• IIS Setup and DNN install• Install Christoc’s DNN7, DAL2 Template using vsix install• Create RestaurantMenu project• Build project in Release mode (fix missing /package folder issue if applicable)• Find RestaurantMenu Source package and install in DNN• Demonstrate the default Item Module functionality and discuss the basics view

controls of the template: view, edit, settings (DotNetNuke.Entities.Modules.PortalModuleBase)

• Build Database scripts• Build DAL2 model: RestaurantMenuItem.cs• Build DAL2 controller: RestaurantMenuItemRepository.cs• Comment out broken code in the edit control and build project in Debug• Discuss debugging• Build ‘edit’ view [Breakout: student do 30 minutes of coding on their own]• Discuss: Use ClientResourceManagement to register scripts and css• Discuss: UI guidelines to follow: http://uxguide.dotnetnuke.com/ • Build ‘view’ view [Breakout: student do 30 minutes of coding on their own]• Build ‘settings’ view together and discuss PortalSettingsBase• Error handling: DotNetNuke.Services.Exceptions• Discuss build process and dnn manifest: versions, scripts, moduledefinitions,

license/releasenotes• Test package with evs.dotnetnuke.com

Outline

Page 3: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Unzip DNN Install package to folder on harddrive (give full permissions to folder to yourself and Network Service)

• Create empty database• Create IIS application and pool. Add

host header: dnndev.me, port 80• Browse site, should redirect to

/Install.aspx• Follow installation instructions

IIS Setup and DNN Installation

Page 4: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Download from christoctemplate.codeplex.com

• DNN7 DAL2 vsix• Double click the vsix installer to

install in VS2012• Older versions, copy zip file to My

Documents\Visual Studio 20XX\Templates\ProjectTemplates\Visual C#\

Install Module Development Template

Page 5: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Open VS2012, click New Project• Name it RestaurantMenu• Browse to [DNN7 Install Root]\

DesktopModules\• Select DotNetNuke 7 C#(or VB)

DAL2 Compiled Module• Uncheck ‘Create directory for

solution’

Create Module Project

Page 6: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Should compile and initiate Build Scripts

• References: • DotNetNuke.dll (core)• DotNetNuke.Web.Client

(ClientResourceManager)• DotNetNuke.Web.Utility (ClientAPI,

BrowserCaps)

Build in Release mode

Page 7: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• /install should have 2 packages: RestaurantMenu_01.00.00_Source and RestaurantMenu_01.00.00_Install

• Browse to DNN and install Source package

Register Module In DNN Using Package

Page 8: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Module controls: view, edit, settings• PortalModuleBase,

ModuleSettingsBase• IActionable• DNN Controller: ISearchable,

IUpgradeable, IPortable

The Components of a Module

Page 9: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• 00.00.01.SqlDataProvider, Uninstall.SqlDataProvider

• What is this? {databaseOwner}{objectQualifier}

Database scripts

Page 10: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• DotNetNuke.ComponentModel.DataAnnotations

• Use [ColumnName("Desc")] to enable different column name than model attribute

• Use [IgnoreColumn] to have computed attributes in Model that don’t save to database

DAL2 Model

Page 11: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• I like to use the name *Repository• Using DotNetNuke.Data• Create, Delete, Update, Get

DAL2 Controller (Model Repository)

Page 12: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Build in debug mode• Attach to w3wp process for IIS• Attach to iisexpress process for

IISExpress

Debugging our Module

Page 13: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Allows admin users to add or update the menu items

• Uses DnnFilePicker to upload a picture

• Uses dnn Label control and dnnFormItem class for consistent form UI

The ‘Edit’ View

Page 14: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• RegisterStyleSheet(), RegisterScript()

ClientResourceManager API

Page 15: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• http://uxguide.dotnetnuke.com/• Helps merge your module’s UI into

the DNN UI to make it consistent• Tabs, Tooltips, Alerts, Confirms, etc

UI Guidelines

Page 16: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• View type control that users without edit permissions can use

• Use ClientResourceManager to register css or scripts

• Implement IActionable to add the Edit to the context menu

The ‘View’ view

Page 17: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Implements ModuleSettingsBase• LoadSettings() to recall settings• UpdateSettings() to save settings

changes• Settings[“name”] associative array

of settings for the current module.

The ‘Settings’ view

Page 18: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• Use DotNetNuke.Services.Exceptions• Exceptions.ProcessModuleLoadExcep

tion() in Module events• Exceptions.LogException(ex) to log

generic exception in your components

Error Handling

Page 19: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

• dependency type="CoreVersion” is the minimum version DNN your module is build from

• component type="ResourceFile“ contains all module files besides the assembly and SQL files

• Module definition: 2 control types: view, edit (settings is considered a special edit type)

Packaging (DNN Manifest)

Page 20: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

http://evs.dotnetnuke.com/

Test Install Package

Page 21: Module Programming 101

April 13, 2013 Southern Fried Day of DotNetNuke Charlotte, NC

Thanks to all our Generous Sponsor!