Want to use SqlFileStorage Class

Last post 02-10-2008, 7:23 PM by bellwa. 4 replies.
Sort Posts: Previous Next
  •  04-13-2007, 10:44 AM 28252

    Want to use SqlFileStorage Class

    Hi,
     
    I'm trying to use the directory tree create by Cute Editor 5.3 in my database. But When I create the object SqlFileStorage with HttpContext.Current an exception is raise saying : EditorSetting not found
     
    There is my code :
    CustomFileProvider.SqlSample.SqlFileStorage sqlFile = new CustomFileProvider.SqlSample.SqlFileStorage(System.Web.HttpContext.Current);
    sqlFile.CreateDirectory("/", Convert.ToString(uid));
     
    Maybe I'm not using the good HttpContext... There is an other?
     
    Thanks a lot,
    Fred
  •  04-13-2007, 12:19 PM 28259 in reply to 28252

    Re: Want to use SqlFileStorage Class

    Fred,
     
    You have to download the CustomFileProvider again and use the latest 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

  •  04-16-2007, 2:24 PM 28435 in reply to 28259

    Re: Want to use SqlFileStorage Class

    Thanks Adam, this problem is solve now.
     
    With that update, I also upgrade to 6.0 and I got a problem with file gallery dialog.
     
    I'm using a dynamic path that is not the root for each cuteeditor based on a page id  (example "/42") with this line :

    Editor1.SetSecurityGalleryPath("/" + pid);

    I create a new directory in this one using file gallery dialog, something like "/w", so I can go to "/42/w"
    but if I came back to the main directory (in this case "/42"), the path is set to "/42/42" instead of "/42"
     
    after a debug, it look like that happen in the class SqlFileStorage in the function CalcPath(...)
     
    I haven't this trouble with image gallery dialog
     
    thanks again,
    Fred
     
     
  •  02-10-2008, 5:26 PM 36931 in reply to 28435

    Re: Want to use SqlFileStorage Class

    I am having this same problem with the SQLFileStorage. If I don't use the default root "/" directory you can't navigate up from lower directories. For example. If I set the root to "Editor1.SetSecurityGalleryPath("/test")" and then navigate to a directory below this in the InsertImage Dialog, such as "/test/myimages"/ it works fine. However when I click ".." to go back to the root "/test" what I get is "/test/test" as the diectory. Has anyone solved this? I know its a simple bug in the SQLFileStorage class but I can't for the life of me figure it out. I converted this class to VB if anyone is interested but I get the same problem in the C# class provided by Cutesoft. We are on the verge of buying a license if I could figure this out.
     
    Thanks
     
  •  02-10-2008, 7:23 PM 36932 in reply to 36931

    Re: Want to use SqlFileStorage Class

    Ok I think I solved it. I have the SQLFileStorage class in vb. Below is the CalcPath function and my changes in red. It seems to have solved the problem when you use a root other than "/"
     

    Private Function CalcPath(ByVal path As String, ByVal relpath As String) As String

    path = path.Replace("\\", "/")

    If Not (path.StartsWith("/")) Then

    path = CalcPath(VirtualRoot, path)

    End If

    If String.IsNullOrEmpty(relpath) Then

    Return path

    End If

    If (relpath.StartsWith("/")) Then

    If (relpath.IndexOf("..") <> -1) Then

    Throw (New Exception("Absolute path can't contain '..'"))

    End If

    If (relpath = "/") Then

    Return relpath

    End If

    Return relpath.TrimEnd("/")

    End If

    Dim str As String

    For Each str In relpath.Split("/\".ToCharArray())

    If (str = "") Then

    Continue For

    End If

    If (str = "..") Then

    Dim pos As Integer = -1

    If Not String.IsNullOrEmpty(path) Then

    pos = path.LastIndexOf("/", path.Length - 2)

    End If

    If (pos = -1) Then

    path = Nothing

    Else

    path = path.Substring(0, pos)

    End If

    Else

    If Not ("/" & str = path) Then

    path += "/" & str

    End If

    End If

    Next

    If (path = "") Then

    Return "/"

    End If

    Return path.Replace("//", "/")

    End Function

View as RSS news feed in XML