I did takes a view Day’s to get my Albums to Run.
Albums at http://www.Poorthuis.de
The Module did have several Bugs that have to be Fixed to get the Module to Run.
- Fixes about no User logged in. Don’t make a request on PortalSecurity.HasNecessaryPermission if one of the requested Parameters is Nothing
Class Authorization about Row 100 and also about Row 119
Public Function HasEditPermission() As Boolean
If GalleryConfig.IsPrivate Then
If HasAdminPermission() OrElse IsGalleryOwner() Then
Return True
End If
Else
'Return PortalSecurity.HasEditPermissions(ModuleID)
'HP Changed to:If Not IsNothing(mLoggedOnUserName) Then
If Not IsNothing(mLoggedOnUserName) And Not IsNothing(mPortalSettings) And Not IsNothing(mModuleSettings) Then
Return PortalSecurity.HasNecessaryPermission(SecurityAccessLevel.Edit, mPortalSettings, mModuleSettings, mLoggedOnUserName)
End If
End If
Return False
End Function
Public Function HasItemEditPermission(ByVal DataItem As Object) As Boolean
If GalleryConfig.IsPrivate Then
If HasAdminPermission() OrElse IsGalleryOwner() OrElse IsItemOwner(DataItem) Then
Return True
End If
Else
'Return PortalSecurity.HasEditPermissions(ModuleID)
'HP Changed to:If Not IsNothing(mLoggedOnUserName) Then
If Not IsNothing(mLoggedOnUserName) And Not IsNothing (mPortalSettings) And Not IsNothing(mModuleSettings) Then
Return PortalSecurity.HasNecessaryPermission(SecurityAccessLevel.Edit, mPortalSettings, mModuleSettings, mLoggedOnUserName)
End If
End If
Return False
End Function
- Errors in the XML Class will have also the Result that the Module not will be loaded. Here to fix 3 Problems
Because of localisation the Date format can be written in US Format, but on Reading with a German localisation then CDate Function is not able to read a date like 10-28-2005 . Solution is to write the Dateformats with the “u” Format
About Row 435 in the XML Class.
subNode = xml.CreateElement("approveddate")
subNode.InnerText = Format(ApprovedDate, "u")
newNode.AppendChild(subNode)
subNode = xml.CreateElement("createddate")
subNode.InnerText = Format(CreatedDate, "u")
newNode.AppendChild(subNode)
[Minor] To be sure that online a logged in User Changed the metadata File insert next in SaveMetadata:
If UserController.GetCurrentUserInfo.UserID <= 0 Then
Exit Sub
End If
Some Other Problem: The ID generated by Random. The Server from my Provider seems to be so fast that sometimes 3 Pictures get the same ID (FTP Upload). Result the Picture will not being showed, Java Errors on the Page. I did write the ID Request new, and put it in the Utilities Class
Public Shared Function CreateNewID() As Int32
Dim T As String, ID As Int32
Dim rd As New Random
T = Format(Now, "mmss") + rd.Next(1, 99999).ToString
' Wait to allow the timer to advance.
System.Threading.Thread.Sleep(1)
Try
ID = CType(T, Int32)
Catch ex As Exception
ID = rd.Next(1, Int32.MaxValue)
End Try
Return ID
End Function
So everywhere where the Random is Used I Changed the Code (actuality a Thread.sleep(1) after the Rd.Next will help also.
- In the Config Class I changed the Sub New , but I’m not sure if this is really necessary.
Shared Sub New()
'Change HP
Dim p As New PortalController
Dim _portalSettings As PortalSettings = p.GetCurrentPortalSettings
'mPortalCssURL = _portalSettings.UploadDirectory & "portal.css"
End Sub
Beware that the _metadata.resources File will be Cached, so use the Trick with changing one row in the web.config so the Application will start New after the changes.
The Module is Great, Yes its Beta, I wonder that I takes 4 Month to find this Problems
Greetings Hans