Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsHow I Converted Events 03.03.08 Source Code to work with VS2005How I Converted Events 03.03.08 Source Code to work with VS2005
Previous
 
Next
New Post
7/18/2007 5:03 PM
 

How I Converted Events 03.03.08 Source Code to work with VS2005. I hope this will be useful to others.

On my development machine I installed DNN 3.x and DNN 4.x. The source version of Events was then installed onto the DNN3 site.

Using the Dotnetnuke Module Upgrade Wizard the Events source files were transferred to the DNN4 site.

Before the converted code would run error free I made the following changes

I deleted the source files/directories for the Scheduler and Web controls. I didn't plan on modifying the controls and ASP.Net doesn't like the fact that the web control was written in C#. So that DNN could still reference the controls, I placed the original DotNetNuke.Events.WebControls.dll and DotNetNuke.Events.ScheduleControl.dll in the DNN4 bin folder. (I have included the source files for the controls in past conversions but it requires a little more work.)

Using VS2005 I tried to Build the DNN4 site, encountering hundreds of errors. I opened all the .ascx.vb files and deleted the "Protected WithEvents" control references. This eliminated most of the errors.

In EventController.vb I marked the EventSignupsController Class as Public.

In EventController.vb I changed the ProcessRequest Sub. Here is the replacement subroutine. 

 

 

 

 

 

 


In EventController.vb I changed a line in SetDefaultModuleSettings to prevent a warning.

            ' Dslage - Modified the next line to correct warning.
            Dim PortalSettings As DotNetNuke.Entities.Portals.PortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings


In DataProver.vb I removed a reference to the original assembly dll in the CreateProvider Sub. This doesn't create a build error but will cause the application to crash when you add an event.

            'DSlage - removed assembly name from third parameter
            objProvider = CType(Framework.Reflection.CreateObject("data", "DotNetNuke.Modules.Events.Data", ""), DataProvider)


Whenever convenient I would also comment out lines creating unused variable warnings.

At this point my DNN4 builds without errors but I couldn't use the module because the upgrade wizard does not actually install the upgraded modules into DNN. You could manually configure the Events module pages and manually run the SQL files. But I choose to create a modified install zip file that installs the Events module without transferring any files or dlls.

I haven't tested everything but so far so good.

Questions and comments welcome.

 

        'DSlage - I added the Dim oRequest and oResponse  - The old code using oContext.current.request created errors

        Public Sub ProcessRequest(ByVal oContext As HttpContext) Implements IHttpHandler.ProcessRequest
            Dim oRequest As HttpRequest = oContext.Request
            Dim oResponse As HttpResponse = oContext.Response

            If (iItemID = 0) And (oRequest.QueryString("itemID") = "") Then
                Exit Sub
            End If
            ' Need to Switch Thread Culture in order to Obtain Correct Date Format in Querystring
            System.Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo(oRequest.QueryString("culture"))

            If oRequest.QueryString("selecteddate") = Nothing Or Not IsDate(oRequest.QueryString("selecteddate")) Then
                Exit Sub
            End If

            Dim selecteddate As Date = Convert.ToDateTime(oRequest.QueryString("selecteddate"))
            Dim oEvent As New EventInfo
            Dim oCntrl As New EventController
            If Not oRequest.QueryString("itemID") = "" Then
                iItemID = CType(oRequest.QueryString("itemID"), Long)
            End If
            oEvent = oCntrl.EventsGet(CInt(iItemID))

            Dim vEvent As StringBuilder = GetOutlookEvent(CInt(iItemID), oContext, selecteddate)
            If vEvent Is Nothing Then
                Exit Sub
            End If

            ' Stream The vCalendar
            Dim oStream As HttpResponse
            oStream = oResponse
            oStream.ContentEncoding = System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)
            oStream.ContentType = "text/x-vCalendar"
            oStream.AppendHeader("Content-Disposition", "filename=" & HttpUtility.UrlEncode(oEvent.EventName) & ".vcs")
            oStream.Write(vEvent.ToString)

            oStream = Nothing
            vEvent = Nothing
            oEvent = Nothing
        End Sub

 

 
 
New Post
7/19/2007 7:59 AM
 

Sounds Great.  Does your converted code use WAP or WSP?  I have planned to upgrade using the WAP (compiled module).  

I would like to hear something from others on if they still need support for DNN 3.x?  If most want to move on to .NET 2.0 we can move forward...  If you'll zip your source code/changes, I'll look at putting out a 4.x version of the module as soon as we hear from others...

 
New Post
7/19/2007 12:18 PM
 

The converted code uses WSP and subsequently can be used by Visual Studio 2005 Express Edition.

The only real problem with the update wizard's conversion is the Events.WebControls control. WebControls is written is C# but the update wizard included it with the rest of the VB code. ASP.Net doesn't like that. My solution for previous conversions was to move this code to its own folder then tell web.config about the new folder.

   <codeSubDirectories>
       <add directoryName="EventWebControls"/>
   </codeSubDirectories>


For those of you out there that are planning on including the source code for the controls, don't forget to search the .aspx files and remove the Assembly="DotNetNuke.Events.WebControls" parameters from the "@ Register" commands. If you leave the "Assembly" parameters the code will always use the original dlls and not see your control code changes.

Alan I will email you the simplest converted code as described in the original post (Controls source removed).

Obviously my vote for Events is to use the new WSP format.

Questions and comments welcome.

 
New Post
7/19/2007 12:24 PM
 

The only problem with this approach to the C# controls is the DNN source deployment...most will not know to add the XML tags to the Web.Config and we will get a lot of questions.  This is why it would be easier to deploy as a .dll.

 
New Post
7/19/2007 1:10 PM
 

I agree, deploy as a DLL or perhaps someone out there would be willing to convert the Event.WebControls code to VB.

I confess that I don't know how difficult (or easy) that C# to VB conversion would be. Perhaps this automated converter would work.

http://authors.aspalliance.com/aldotnet/examples/translate.aspx

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsHow I Converted Events 03.03.08 Source Code to work with VS2005How I Converted Events 03.03.08 Source Code to work with VS2005


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out