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.
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.
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 ;-)
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
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:
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)!
Unzip the zip file and open the Visual Studio Project in VS.Net
Delete all of the umbraco references (umbraco, businesslogic, interfaces and cms) as they're pointing to 4.0.x versions of the DLLs
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"
Open "NotFoundHandler.cs", change line 34 to: prefixXPath = string.Format("//* [@isDoc and @id = '{0}']", Domain.GetRootFromDomain(currentDomain)); (note the new schema syntax)
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)
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));
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);
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
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!
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.
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.
@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
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!
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.
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.
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.
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:
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 ;-)
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.
Nope, I wrote my own DateFolders class..
Looks like I will have to hold off on upgrading then until a fix for this is available or an alternative package is released.
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.
@trfletch
I mean I wrote my own implementation to get DateFolders :-) Works fine!
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 ;-)
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.
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
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 :-)
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
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
Don't post this here :-) Post it @ the datefolders forum...
Ok will do, I was going to post it at both but I didn't want to get told off for cross posting :-)
Is there an ETA for a version that is compatible with version 4.5?
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)!
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);
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
That's awesome. So far it is working for me.
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.
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.
:)
@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?
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!
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.
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.
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.
is working on a reply...