Quick Links
This module was created with XMod
We're happy to show our support for the DotNetNuke platform and community by contributing back to the project at the highest "Platinum" level.
|
DNNDev.com Forums
| Author |
Messages |
|
neilx
 XMod Varsity Posts: 49

 |
| 7/19/2008 5:09 AM |
|
I am happy to convert this module to use the new XMod Manager system if someone is able to give me a clue on what the new code should look like. I have found the statement: xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId) which is the problem in that I think it uses old XMod code that is unaware of the Managers. All I need - I am guessing - is the replacement code from XMod 5.1 to get data and display it in the template. Are you able to help? |
|
|
|
|
neilx
 XMod Varsity Posts: 49

 |
| 7/20/2008 12:43 PM |
|
OK. I have hacked DetailView.ascx.vb to use a custom XMod Manager if the form says so. This is my first attempt but it appears to work very well in that I can swap between default and custom managers on a form and the DetailsView module gets the data from the right place. I can use this as it is in current projects, but I am sure someone with intimate knowledge (or more than mine) of the XMod and XMod Manager source code could suggest some good refactorings. Please do. Here is the source code to patch into the CreateDetailsView() method for those of you who would like to try it. It replaces the xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId) line, wrapping it in an if then else: If objFormInf.ManagerId < 1 Then xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId) Else Dim objSqlDataProvider As New SqlDataProvider Dim objManager = objSqlDataProvider.GetManager(Me.PortalId, objFormInf.ManagerId) Dim objDisplayManagerProvider As _ New DisplayManagerProvider(objManager.Tables(0).Rows(0)("Assembly"), _ objManager.Tables(0).Rows(0)("DisplayManager")) Dim objXModManager = objDisplayManagerProvider.DisplayManager Dim ds As New DataSet Dim dt As DataTable Dim dr As DataRow objXModManager.Module = Me ds = objXModManager.GetItem(_XModId) dt = ds.Tables(0) dr = dt.Rows(0) xmi = objXModManager.GetXModInfo(dr) End If If xmi Is Nothing Then ' Unable to find record with _XModId lblNoItemsFoundMessage.Visible = True lblNoItemsFoundMessage.Text = _NoItemsFoundMsg Else Dim objInstData As New XMod.InstanceData(xmi.InstanceData, _XModId) With objInstData .AddUser = xmi.AddUser .Approved = xmi.Approved .DateAdded = xmi.DateAdded .DateModified = xmi.DateModified .DisplayDate = xmi.DisplayDate .ExpiryDate = xmi.ExpiryDate .UpdateUser = xmi.UpdateUser .XModId = xmi.XModId End With If you can spot any fatal flaws, *please* let me know. |
|
|
|
|
neilx
 XMod Varsity Posts: 49

 |
| 7/20/2008 12:45 PM |
|
Too many statements pasted. You just need to the end if: If objFormInf.ManagerId < 1 Then xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId) Else Dim objSqlDataProvider As New SqlDataProvider Dim objManager = objSqlDataProvider.GetManager(Me.PortalId, objFormInf.ManagerId) Dim objDisplayManagerProvider As _ New DisplayManagerProvider(objManager.Tables(0).Rows(0)("Assembly"), _ objManager.Tables(0).Rows(0)("DisplayManager")) Dim objXModManager = objDisplayManagerProvider.DisplayManager Dim ds As New DataSet Dim dt As DataTable Dim dr As DataRow objXModManager.Module = Me ds = objXModManager.GetItem(_XModId) dt = ds.Tables(0) dr = dt.Rows(0) xmi = objXModManager.GetXModInfo(dr) End If |
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|
|