Re: DNN Provider 4.0 - Customize Toolbar by Role?

  •  11-01-2006, 11:51 PM

    Re: DNN Provider 4.0 - Customize Toolbar by Role?

    Hi Adam,

    The problem with your "Programatically specify the ... gallery path" sections is that "~" represents the root of the DNN system - on our install, it's "e:\inetpub\wwwroot\website".  So "~images/" would mean "e:\inetpub\wwwroot\website\images".  However, we want the "~" to be portal specific so that "~images/" would mean "e:\inetpub\wwwroot\website\Portals\2\images".

    I have added code to the Provider code "getSettingByRole()" that does this for me...  Here is the code (I am certain you could write more elegant code, but it's late and I needed to get this done, but hopefully it illustrates what we are trying to accomplish):

                        If Not Directory.Exists(HttpContext.Current.Server.MapPath(Templatefolder)) Then
                            Directory.CreateDirectory(HttpContext.Current.Server.MapPath(Templatefolder))
                        End If


                        ' New code to allow customizations of the Gallery directories using the
                        ' _SecurityPolicyFile
                        Dim sImageGalleryPath As String = tempfolder
                        Dim sFilesGalleryPath As String = tempfolder
                        Dim sMediaGalleryPath As String = tempfolder
                        Dim sFlashGalleryPath As String = tempfolder
                        Dim sTemplateGalleryPath As String = Templatefolder
                        If (_SecurityPolicyFile <> "") Then     ' If a SecurityPolicyFile has been defined
                            Dim oXML As XmlTextReader
                            Dim sPath As String
                            Dim bFound As Boolean
                            oXML = New XmlTextReader(HttpContext.Current.Server.MapPath(cntlCE.FilesPath) _
    & "\Configuration\Security\" & _SecurityPolicyFile)
                            oXML.WhitespaceHandling = WhitespaceHandling.None
                            oXML.Read()
                            While (Not oXML.EOF)
                                bFound = False
                                If (oXML.Name = "security") Then

                                    If (Not bFound And (oXML.GetAttribute("name") = "ImageGalleryPath")) Then
                                        sPath = oXML.ReadElementContentAsString()
                                        sImageGalleryPath = Replace(sPath, "~", tempfolder)
                                        bFound = True
                                    End If
                                    If (Not bFound And (oXML.GetAttribute("name") = "FilesGalleryPath")) Then
                                        sPath = oXML.ReadElementContentAsString()
                                        sFilesGalleryPath = Replace(sPath, "~", tempfolder)
                                        bFound = True
                                    End If
                                    If (Not bFound And (oXML.GetAttribute("name") = "MediaGalleryPath")) Then
                                        sPath = oXML.ReadElementContentAsString()
                                        sMediaGalleryPath = Replace(sPath, "~", tempfolder)
                                        bFound = True
                                    End If
                                    If (Not bFound And (oXML.GetAttribute("name") = "FlashGalleryPath")) Then
                                        sPath = oXML.ReadElementContentAsString()
                                        sFlashGalleryPath = Replace(sPath, "~", tempfolder)
                                        bFound = True
                                    End If
                                    If (Not bFound And (oXML.GetAttribute("name") = "TemplateGalleryPath")) Then
                                        sPath = oXML.ReadElementContentAsString()
                                        sTemplateGalleryPath = Replace(sPath, "~", tempfolder)
                                        bFound = True
                                    End If
                                End If

                                If (Not bFound) Then
                                    oXML.Read()
                                End If
                            End While
                        End If

                        cntlCE.SetSecurityImageGalleryPath(sImageGalleryPath)
                        cntlCE.SetSecurityFilesGalleryPath(sFilesGalleryPath)
                        cntlCE.SetSecurityMediaGalleryPath(sMediaGalleryPath)
                        cntlCE.SetSecurityFlashGalleryPath(sFlashGalleryPath)
                        cntlCE.SetSecurityTemplateGalleryPath(sTemplateGalleryPath)


View Complete Thread