Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt Taylor 813 posts 1903 karma points
    Mar 15, 2013 @ 19:44
    Matt Taylor
    0

    Not quite working in v6.0.2

    I thought I'd try to use this package to help replicate a Members section in the content tree.

    I've a 'Members' doctype I'm using at the root.

    I've a 'Member' doctype to represent each member.

    I've an 'AlphabetFolder' doctype to use as the folders.

    The 'Members' doctype is configure to allow both a 'Member' or 'AlphabetFolder' doctype as a child in the structure.
    The 'AlphabetFolder 'doctype is configure to allow just a 'Member' doctype as a child in the structure.

    Here's my entries in the web.config:

    <add key="alphabetfolders:ItemDocType" value="Member" />
    <add key="alphabetfolders:FolderDocType" value="AlphabetFolder" />

    When I click my 'Members' node and create a new 'Member' node under it the create window just sits there whilst the system is chugging away.

    After about 1 minute the Visual Studio Just In Time Debugger dialog appears.

    I then click 'Cancel' in the create window and reload the nodes.

    As you can see, after appearing to do nothing it has created two new nodes.

  • Matt Taylor 813 posts 1903 karma points
    Mar 16, 2013 @ 16:42
    Matt Taylor
    0

    The problem is that the CreateAlphabeticFolder method calls doc.Save() which fires off the Document_BeforeSave event.

    The Document_BeforeSave event then calls the CreateAlphabeticFolder method and infinate recursion ocurrs.

  • Stefan Kip 1578 posts 4013 karma points c-trib
    Mar 18, 2013 @ 10:02
    Stefan Kip
    0

    Weird thing is; I've built several projects which include DateFolders and for me the issue doesn't occur (though none of the is v6.0.2).

    Hopefully I've got some time on my hands in a few months so I can do some thorough testing. Though if you would have some time to help that would be awesome! By testing/debugging the source and fix the issue.

  • Matt Taylor 813 posts 1903 karma points
    Mar 18, 2013 @ 11:43
    Matt Taylor
    0

    Hello,

    I've put a fix in that is working for my purposes at the moment.

    I've just created a module level variable:

    private bool _creatingAlphabeticFolder;

    added some checks for the variable to these two events

    void Document_New(Document doc, NewEventArgs e)
    {
       if (!_creatingAlphabeticFolder) CreateAlphabeticFolder(doc);
    }

    void Document_BeforeSave(Document doc, SaveEventArgs e)
    {
       if (!_creatingAlphabeticFolder) CreateAlphabeticFolder(doc);
    }

    and then in void CreateAlphabeticFolder(Document doc) I'm just setting the variable to true at the beginning and false at the end.

    Regards,

    Matt

  • Stefan Kip 1578 posts 4013 karma points c-trib
    Aug 22, 2014 @ 16:52
    Stefan Kip
    100

    FYI; I've created a new version for umbraco 6.1, 6.2 and 7.1.

  • Matt Taylor 813 posts 1903 karma points
    Aug 22, 2014 @ 17:56
    Matt Taylor
    0

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft