dynamically assign user gallery path in dotnetnuke

Last post 06-13-2008, 12:12 PM by ShadsTrains. 5 replies.
Sort Posts: Previous Next
  •  01-03-2008, 1:49 PM 36140

    dynamically assign user gallery path in dotnetnuke

    Is there a way to dynamically assign each dotnetnuke user to a path on the server?  For example,  If my DNN username is joe, and all the galleries for all my users are located at:
     
    http://www.mysite.com/users
     
    Can I map the cute editor gallery button in my forums to look at joe's gallery folder at:
     
    http://www.mysite.com/users/joe
     
     I was reviewing the article at:
    http://cutesoft.net/example/implementSecuritypolicy.asp
     
    It looks like it can be done, but does there have to be a config file for each user?
  •  01-03-2008, 2:16 PM 36142 in reply to 36140

    Re: dynamically assign user gallery path in dotnetnuke

    ShadsTrains,
     
    Yes, it can be done.
     
    By default the provider of DNN sets different path based on the user's role.
     
    If you want to change it to username based, you need to modify the DNN provider.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  01-03-2008, 2:59 PM 36148 in reply to 36142

    Re: dynamically assign user gallery path in dotnetnuke

    How difficult would that be for someone who is relatively new to asp.net development?  Could this be done on a per module basis?
  •  01-03-2008, 3:24 PM 36152 in reply to 36148

    Re: dynamically assign user gallery path in dotnetnuke

    >>How difficult would that be for someone who is relatively new to asp.net development? 
     
    It should be easy. You need to know how to recompile the provider project first.
     
    Step 1: Open Providers\HtmlEditorProviders\CEHtmlEditorProvider\CEHtmlEditorProvider.vb
     
    Step 2: Change the following code:
     
    From:
                  

                If _usednnrootimagedirectory = True Then
                    If _UseDNNRoleASFileNamePrefix Then
                        Dim trim(1) As Char
                        trim(0) = "/"c

                        Dim tempfolder As String = ""
                        Dim Templatefolder As String = ""

                        tempfolder = RootImageDirectory
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"
                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)

                        Dim tempsecurity As String = ""
                        If role = "Admin" Then
                            tempsecurity = ""
                        ElseIf role = "Registered" Then
                            cntlCE.SetSecurityFileNamePrefix("Member_")
                        ElseIf role <> String.Empty Then
                            cntlCE.SetSecurityFileNamePrefix(role & "_")
                        End If
                    Else
                        Dim trim(1) As Char
                        trim(0) = "/"c

                        Dim tempfolder As String = "Guest"
                        Dim Templatefolder As String = ""

                        If role = "Admin" Then
                            tempfolder = ""
                        ElseIf role = "Registered" Then
                            tempfolder = "Member"
                        ElseIf role <> String.Empty Then
                            tempfolder = role
                        End If

                        tempfolder = RootImageDirectory.TrimEnd(trim) & "/" & tempfolder
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"

                        Dim phyfolder As String

                        phyfolder = HttpContext.Current.Server.MapPath(tempfolder)

                        If role = "Administrators" Then
                            phyfolder = HttpContext.Current.Server.MapPath(RootImageDirectory.TrimEnd(trim) & "/Admin")
                        End If

                        If Not Directory.Exists(phyfolder) Then
                            Directory.CreateDirectory(phyfolder)
                        End If

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

                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)
                    End If

     
     
    to:
     

                      Dim username As String = HttpContext.Current.User.Identity.Name
                      Dim tempfolder As String = ""
                         tempfolder="/uploads/" & username
                         If Not Directory.Exists(HttpContext.Current.Server.MapPath(tempfolder)) Then
                            Directory.CreateDirectory(HttpContext.Current.Server.MapPath(tempfolder))
                        End If

                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(tempfolder)

     
     
    >>Could this be done on a per module basis?
     
    yes, just add more logics to the above code.
     
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  05-27-2008, 1:55 PM 40821 in reply to 36152

    Re: dynamically assign user gallery path in dotnetnuke

    I'm finally getting around to working on this.  I've set up a development environment and installed the provider.  So far, I'm just using the demo version from your site here.  I like how it works so far.  I've made the changes to the CEHtmlEdi
    torProvider.vb file you suggested.  I rebuilt the website, but the changes aren't taking effect.  Is there anything else I need to do to get the changes to work?    I've done some searching on recompiling the provider and haven't found anything that is of any help.
     
    Thanks for any input you can give.
  •  06-13-2008, 12:12 PM 41403 in reply to 40821

    Re: dynamically assign user gallery path in dotnetnuke

    Bump..   Anyone have any ideas here as to why the changes I make to the provider don't take effect?  What I am doing wrong?
View as RSS news feed in XML