Copied to clipboard

Flag this post as spam?

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


  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jul 30, 2010 @ 17:32
    Stefan Kip
    0

    Problem with Umbraco 4.5

    Hi there.

    First of all, nice package!
    But I got a problem using it with Umbraco 4.5:

    I'm using the following config:

    Snippet
    <?xml version="1.0" encoding="utf-8" ?>
    <settings>
    <folderProviders>
    <folderProvider alias="DateFolderProvider_Simple"
          assembly="/bin/AutoFolders"
          type="AutoFolders.Providers.DateFolderProvider">
    <property alias="MonthFormat">MM</property>
    <property alias="YearFormat">yyyy</property>
    <property alias="DateField">startDate</property>
    </folderProvider>
    </folderProviders>

    <autoFolders>
    <autoFolder docType="sg_Evenement"
    folderProviderAlias="DateFolderProvider_Simple"
    rootFolders="//sg_Evenementen"
    folderDocType="sg_DateFolder"
    />
    </autoFolders>

    </settings>

    The problem is with "rootFolders"... //node[@level=2] won't work anymore, and that's fine.

    So I'm using the following xpath: "//sg_Evenementen", which I tested and is right (with the umbraco.config).

    When I leave the rootFolders property out, it works, but I get the duplicate folders problem when I change the date from like 2010-7-30 to 2010-8-29:

    - Events
        - 2010
            - 7
                - 2010
                    - 8
                        - The event document

    Please help ;-)

  • trfletch 598 posts 604 karma points
    Aug 10, 2010 @ 10:38
    trfletch
    0

    Did you manage to get this resolved because I have a website that I want to upgrade to 4.5 that uses Autofolders but I am not willing to do so until I know that it works properly.

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 10, 2010 @ 11:01
    Stefan Kip
    0

    Nope, I wrote my own DateFolders class..

  • trfletch 598 posts 604 karma points
    Aug 10, 2010 @ 11:04
    trfletch
    0

    Looks like I will have to hold off on upgrading then until a fix for this is available or an alternative package is released.

  • trfletch 598 posts 604 karma points
    Aug 17, 2010 @ 17:12
    trfletch
    0

    Is there likely to be any update with this soon because I have a website that I need to upgrade to Umbraco 4.5 because I want to implement a search using Umbraco Examine but the website uses Autofolders therefore if I upgrade it is going to stop it working correctly.

    Kipusoep, what exactly do you mean when you say you wrote your own DateFolders class? Sorry I am not a developer but I do know people who are so if there is something I could ask them to do to get this to work then maybe that would be the best solution.

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 17, 2010 @ 19:10
    Stefan Kip
    0

    @trfletch

    I mean I wrote my own implementation to get DateFolders :-) Works fine!

  • trfletch 598 posts 604 karma points
    Aug 17, 2010 @ 19:20
    trfletch
    0

    Was it an implementation based on the Autofolders package or you wrote something completely from scratch to do the same job? Don't suppose you fancy releasing the source code ;-)

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 17, 2010 @ 19:23
    Stefan Kip
    0

    I wrote something from scratch. Ofcourse I can share the code :-) I will create a package for it in a few, ok? :-)

    Only one thing: don't know how stable it is (not heavily tested), but I'll do some extra testing this evening.

  • trfletch 598 posts 604 karma points
    Aug 17, 2010 @ 19:25
    trfletch
    0

    Excellent sounds great, I look forward to hearing from you, I'm sure there will be many other people out there that will appreciate a version of Autofolders that works with Umbraco 4.5

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 17, 2010 @ 21:25
    Stefan Kip
    0

    Here you go: http://our.umbraco.org/projects/developer-tools/datefolders

    If you like it, please vote ;-)
    Note: it's still beta! So please use the project's forum to report bugs :-)

  • trfletch 598 posts 604 karma points
    Aug 20, 2010 @ 13:41
    trfletch
    0

    Excellent, thanks for that, I haven't had chance to install it yet but I'll let you know if I have any issues and vote for it as well

  • trfletch 598 posts 604 karma points
    Sep 03, 2010 @ 16:23
    trfletch
    0

    Hi kipusoep,

    I have just installed your package and it seems to work as you suggested although I had my previous Autofolders package setup to organise the documents in Year, then Month (with the Month name), then day so my structure looked like the following, would it be possible for you to release an update for the package that can do this or at least let me have the source code so I can have a go myself (or more likely ask someone I know that does asp.net coding!). This is how my folder structure used to work with Autofolders:

    News
       - 2010
            - July
                - 23
                    - News article 1
                    - News article 2
                    - News article 3
                - 16
                    - News article 4
                    - News article 5
                - 09
                    - News article 6
            - June
                - 19
                    - News article 7
                    - News article 8
                - 15
                    - News article 9

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Sep 03, 2010 @ 16:34
    Stefan Kip
    0

    Don't post this here :-) Post it @ the datefolders forum...

  • trfletch 598 posts 604 karma points
    Sep 03, 2010 @ 16:41
    trfletch
    0

    Ok will do, I was going to post it at both but I didn't want to get told off for cross posting :-)

  • Chad Rosenthal 272 posts 474 karma points
    Dec 03, 2010 @ 15:42
    Chad Rosenthal
    0

    Is there an ETA for a version that is compatible with version 4.5?

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Dec 13, 2010 @ 16:32
    Tim
    3

    Right, hope I'm not treading on the project owners toes here, but I've managed to update AutoFolders to work with 4.5.2. I'm not going to put the DLL up for download as that's a bit cheeky as its not my project, and its not open for collaboration. I will however post instructions so that if you want to, you too can create your very own working version of Autofolders (its dead easy, 10 minute job!).

    :)

    The reason it doesn't work is that it uses some XSLT with //node in it, which doesn't work with the new schema. It's a pretty simple process to modify the source to account for the new schema, here's how to do it (NOTE: You need a copy of Visual Studio to do this also, this assumes you are using the NEW schema, not the old one)!

    1. Download the source code project from here: http://autofolders.codeplex.com/SourceControl/list/changesets (click the download link on the right under "latest version")
    2. Unzip the zip file and open the Visual Studio Project in VS.Net
    3. Delete all of the umbraco references (umbraco, businesslogic, interfaces and cms) as they're pointing to 4.0.x versions of the DLLs
    4. Re-add the references, but point them at the DLLs for a 4.5.2 installation. You will also need to add a reference to "umbraco.DataLayer"
    5. Open "NotFoundHandler.cs", change line 34 to: prefixXPath = string.Format("//* [@isDoc and @id = '{0}']", Domain.GetRootFromDomain(currentDomain)); (note the new schema syntax)
    6. In the same file, chnage line 56 to be: XmlNode redir = content.Instance.XmlContent.SelectSingleNode("//* [@isDoc and @id='" + parentNode.Attributes.GetNamedItem("id").Value + "']//* [@isDoc and @urlName = '" + pageUrl.Replace(".aspx", string.Empty).ToLower() + "']"); (again, note new schema)
    7. Open "ApplicationBase.cs", just after line 61 (the one where it calls the updateDocumentCache method), add the following code to make sure that the tree is re-synced correctly: BasePage.Current.ClientTools.ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", documentObject.Id));
    8. Round about line 75/76 you should see some code that says: if(rootFolderXPath.StartsWith etc, replace that, up to and icluding the line that starts with: XPathNodeIterator safeRootNodes, with the following code: if(rootFolderXPath.StartsWith("//*"))
                      rootFolderXPath = rootFolderXPath.Substring(3);
                  if(rootFolderXPath.StartsWith("/*"))
                      rootFolderXPath = rootFolderXPath.Substring(2);
                  XPathNodeIterator parentNode = umbraco.library.GetXmlNodeById(documentObject.Parent.Id.ToString());
                  XPathNodeIterator safeRootNodes = parentNode.Current.Select("ancestor-or-self::*" + rootFolderXPath); 
    9. Build the project (remembering to set it to "Release" mode in VS.Net) and the Releases folder for your project should contain the new DLL, drop that into your 4.5.2 site, overwriting the old one
    10. If you have root nodes defined in your autofolders.config folder, you'll need to update their XPath to use the new schema, e.g. rootFolders="//node[@level=3] would become: rootFolders="//* [@isDoc and @level=3]

    DISCLAIMER: I haven't tested this hugely thoroughly, just on a site that had AutoFolders that I wanted to update to 4.5.2, and it seems to work ok for that OK, you'll want to test this thoroughly on your site before you use it!

    Hope this helps those of you who've been stuck without being able to update!

    :)

    Cheers,

    Tim

  • Chad Rosenthal 272 posts 474 karma points
    Dec 13, 2010 @ 19:25
    Chad Rosenthal
    0

    That's awesome. So far it is working for me.

  • Dano 3 posts 52 karma points
    Dec 20, 2010 @ 15:14
    Dano
    0

    Thanks very much Tim - works perfectly for me - just have to keep remembering to touch the web.config to ensure I see changes made to the autofolders config.

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Dec 20, 2010 @ 15:53
    Tim
    0

    One thing I've just discovered! You need to wrap the call to the BasePage to update the tree in the following if statement:

    if (BasePage.Current != null)
    {
     BasePage.Current.ClientTools.ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", documentObject.Id));
    }

    If you don't, and you try and call something that might call AutoFolders OUTSIDE of he umbraco UI, for example if you have a script that imports content from an XML feed running as a scheduled task, then you'll get a big old Null Reference exception. If you're only using the UI, you can leave it as is.

    :)

  • bob baty-barr 1180 posts 1294 karma points MVP
    Jan 27, 2011 @ 18:23
    bob baty-barr
    0

    @tim... thanks for posting the directions... i think i got them all straight... had to update a {using} statement for basePage... but it was pretty straight forward...

    the only odd behavior i see with some brief testing is that if i CHANGE the date field trigger date... it does not clean up very well... basically i created a newsItem and set the initilal newsDate property to January 2011... folders made fine per the config file... i then updated teh news date to december 2010 and re-published... it create the new folders, but nested under the 2011||January foldrer... so my new tree refreshed as 2011||January||2010||December

     

    any thoughts?

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Jan 31, 2011 @ 10:12
    Tim
    0

    Hi Bob,

    I had that problem too, I think it's something in the original code. To get round it, I had to make sure I'd defined valid root folders in the autofolders config, once I'd done that, it stopped nesting the folders incorrectly! I've found a few more minor issues with autofolders that I've sorted as well, rather than post them here, I'm going to try and get a blog post up in the next couple of weeks when I've got a spare minute, covering all of this in more detail!

  • Daniel Lindstrom 454 posts 271 karma points
    Mar 11, 2011 @ 11:49
    Daniel Lindstrom
    0

    As Chris doesn't seem to have the time to update this great package, would anyone care to share a compiled dll with the changes for 4.5+ made?

    Or maybe Chris could open up the project for collaboration? Or should someone else rather upload a new Autofolders for 4.5+ project with the changes made? As I understand it that would be ok according to the MIT license?

    This is a very very useful package that really should be available also for 4.7.

     

  • Chad Rosenthal 272 posts 474 karma points
    Mar 11, 2011 @ 13:50
    Chad Rosenthal
    0

    i could upload the source code I have to either codeplex or not. Just feel uncomfortable about doing it without Chris's permission. If you send me your email address, I can zip up my .dll and send it to you.

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Mar 14, 2011 @ 10:29
    Tim
    0

    I feel the same as @Chad, I have a fixed version, but don't feel right posting it up without Chris's permission! Quite happy to email the DLL to anyone that wants it though!

    One other issue that we spotted at the beginning of the year was that when the year rolled over, the first article of the year was put in the wrong place, and there was also an issue with changing the dates and stuff updating the database, but not the XML (so articles were showing up in the correct folder in the CMS, but were still in the old folder in the XML). To get round this, I just added:

    //added due to wierd moving bug that resulted in out of sync xml

     

    umbraco.library.RefreshContent();

    underneath the call to umbraco.library.UpdateDocumentCache().

    This forces a rebuild of the XML cache, and the page moves to the right place in the XML again. I tried to find a way of doing this without rebuilding the XML, but couldn't find anything that was 100% reliable.

Please Sign in or register to post replies

Write your reply to:

Draft