FileStorage produce duplicated result

Last post 11-08-2005, 5:01 PM by rchen. 4 replies.
Sort Posts: Previous Next
  •  10-18-2005, 10:53 AM 11801

    FileStorage produce duplicated result

    Hi,
     
       I am trying to use the Gallery Library from the MCSM for inserting images.  To do that I downloaded the SQLFileStorage source code as the starting point and setup to run in my environment.  It works and displays the images from MCSM for me to choose.  However, for every image in the gallery it shows up 4 times.  For example, if there is only one image, it'll show that there are 4 images (all the same one).  I printed out the steps that the methods are called and noticed that everytime I click a directory, it calls GetDirectoryitems twice and GetFileItems 4 times.  I am not sure how the cuteEditor is calling those methods.  I am wondering if there is setting that I missed or anything that I might have done wrong.
     
        I also use the original code that I downloaded for SQLFileStorage to setup a SQL environment for testing.  I also got the same result.
     
        Can someone give me a hint on why this might be happening or where I can get more information about how CuteEditor is making calls to these methods?  Thanks so much for the help.
  •  10-18-2005, 1:43 PM 11811 in reply to 11801

    Re: FileStorage produce duplicated result

    It would be really helpful if you could post your code which demonstrates the exact problem with more information.
     
    Right now I have no idea.
     
     

    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

  •  10-18-2005, 2:46 PM 11813 in reply to 11811

    Re: FileStorage produce duplicated result

    Hi,

    CMSFileStorage(HttpContext context):base(context)

    {

        apc = new CmsApplicationContext();

         apc.AuthenticateAsCurrentUser();

        c=context;

        setting=CuteEditor.EditorSetting.GetFromContext(c,true);

        //set the downloadfile RUL  

        downfile=setting["DownFile"];

    }

    public override CuteEditor.Impl.DirectoryItem[] GetDirectoryItems(string dirpath,bool getcount)

    {

        dirpath=CalcPath(VirtualRoot,dirpath);

        ArrayList arr=new ArrayList();

        if(dirpath == null || dirpath.Equals("") || dirpath == String.Empty)

        {

            dirpath = "/Resources";

        }

        ResourceGallery gallery = GetResourceGallery(dirpath); 

        foreach (ResourceGallery rg in gallery.ResourceGalleries)

        {

            CuteEditor.Impl.DirectoryItem item=new CuteEditor.Impl.DirectoryItem();

            item.Path=rg.Path;

            item.Name=rg.Name;

           if(getcount)

            {   

                item.ChildCount = rg.Resources.Count;

            }

            arr.Add(item);

        }

        return (CuteEditor.Impl.DirectoryItem[])arr.ToArray(typeof(CuteEditor.Impl.DirectoryItem));

    }

     

    public override CuteEditor.Impl.FileItem[] GetFileItems(string dirpath, string searchpattern)

    {

        dirpath=CalcPath(VirtualRoot,dirpath);

        ArrayList arr=new ArrayList();

        if(dirpath == null || dirpath.Equals("") || dirpath == String.Empty)

        {

            dirpath = "/Resources";

        }

        ResourceGallery gallery = ((ResourceGallery) apc.Searches.GetByPath(dirpath)); 

        foreach (Resource resource in gallery.Resources)

        {

            CuteEditor.Impl.FileItem item=new CuteEditor.Impl.FileItem();

            item.Path=resource.Path;

            item.Name=resource.Name;

            item.Length=resource.Size;

            item.CreationTime=item.LastWriteTime=resource.CreatedDate;

            item.Url=resource.Url;

            arr.Add(item);

        }

       return (CuteEditor.Impl.FileItem[])arr.ToArray(typeof(CuteEditor.Impl.FileItem));

    }

    private ResourceGallery GetResourceGallery(string dirpath)

    {

        return (ResourceGallery) apc.Searches.GetByPath(dirpath);

    }

    private Resource GetResource(string dirpath)

    {

        return (Resource) apc.Searches.GetByPath(dirpath);

    }

    GetDirectoryText(string dirpath)

    {

        dirpath=CalcPath(VirtualRoot,dirpath);

        if (dirpath == null || dirpath == "")

            return "/Resources";

        return dirpath;
    }  
    }
     

    public override string GetParentDirectory(string dirpath)

    {

        dirpath=CalcPath(VirtualRoot,dirpath);

        if(dirpath=="/" || dirpath=="/Resources")

            return null;


        try 
        {

            return GetResourceGallery(dirpath).Parent.Path;

        }

        catch 
        {

            throw(new Exception(dirpath));

        }

    }

    public override string GetFileName(string filepath)

    {

        filepath=CalcPath(VirtualRoot,filepath);

        return Path.GetFileName(filepath);

    }

     

    public override byte[] GetFileData(string filepath)

    {

        filepath=CalcPath(VirtualRoot,filepath);

        Resource resource = GetResource(filepath);

        object stream = resource.OpenReadStream();

        byte[] fileData = ((byte[]) stream);

        return fileData;

    }

    This is all the method that I have changed from the code that I downloaded for SQLFileStorage.  Let me know if there is anything that you would like to see. Thanks,

  •  11-08-2005, 4:24 PM 12406 in reply to 11801

    Re: FileStorage produce duplicated result

    I just notice something today. When I set Type from the drop-down list to anything other than All, I got the right amount of the total images. The filtering is not working and I am not sure what I need to do to make it work.

    Also, to prove it was the image type filter that was causing the problem, I added one more <item> entry in <security> element in default.config (in CuteSoft_client\cuteEditor\Configuration\Security) as below.

    <security name="ImageFilters">

        <item>.jpg</item>

        <item>.jpeg</item>

        <item>.gif</item>

        <item>.png</item>

        <item>.bmp</item>

    </security>

    Now all my images are showing up 5 times. Please somebody let me know what I need to do to fix this problem and get the image filter working too. Thank you very much,

  •  11-08-2005, 5:01 PM 12408 in reply to 12406

    Re: FileStorage produce duplicated result

    I got it working now.  I found the InsertImage.aspx and figured out how the searchpattern is passed in.  Thanks for the help.
View as RSS news feed in XML