Hi, When I create a new "newsItem" under "News" Folder the autoFolders create correctly an "Year" and a "Month" Folder. But if I create a new "newsItem" under a "Month" Folder, the autoFolders create an "Year" and a "Month" Folder "UNDER THIS FOLDER".
This is a problem!
I would have the Year and the Month folders only under the "News" Root Folder.
The solution could be solved with one of these methods: 1 ) - Create an addictional property in the "FolderProvider" like this: <Property alias="RootFolderType">News</Property> 2 ) - Create an addictional parameter in the DocTypes like this: <DocTypes> <DocType alias="RootFolderType" name="News" /> <DocType alias="NewsItem" folderProvider="DateFolder" /> </DocTypes> 3 ) - Create a new parameter like this: <RootFolderTypes> <RootFolderType alias="News" /> </RootFolderTypes>
In all these cases, The RootFolderType can be used to: 1 ) - Discover the Parent Node with this NodeTypeAlias; 2 ) - Check if Year Folder exist and If No, create the new Year and the Month Folders and move the new newsItem; 3 ) - If Yes, check if Month Folder exist and if yes move only the new newsItem into this folder, otherwise create only the new month folder and move the new newsItem;
In this case we can find the first parent node that have thew docTypeAlias specified in the RootFolder parameter and start the normal check/insert/move actions.
I think the RootFolder parameter must be optional.
Without it the autoFolders must run like now.
Do you think you will quickly publish the new feature?
I've tested your package, but it wasn't working the way I needed. Since it was easier to change your code than trying to explain better what I needed, I modified it so that the rootFolder xPath property is meant to directly return the node under which to search for year, month (and day) folders.
With this approach I can use rootFolder="//node[@id='1181']" to directly specify a given root node or use a more general expression like rootFolder="$currentParent/ancestor::node[@nodeTypeAlias='news'][1]" to specify the first ancestor of type 'news'.
This allows me to have several 'news' folders in my content tree and, at the same time, helps my content editors to keep clean the news folders structure.
If you want I can send you my code for evaluation.
OK... so it took almost a month... but the new version now supports this feature.
I liked your solution, and I've included your changes in the latest release (v2.0), but renamed RootFolder to rootParents to support mutliple parent structures.
Possible New feature
Hi,
When I create a new "newsItem" under "News" Folder the autoFolders create correctly an "Year" and a "Month" Folder.
But if I create a new "newsItem" under a "Month" Folder, the autoFolders create an "Year" and a "Month" Folder "UNDER THIS FOLDER".
This is a problem!
I would have the Year and the Month folders only under the "News" Root Folder.
The solution could be solved with one of these methods:
1 ) - Create an addictional property in the "FolderProvider" like this:
<Property alias="RootFolderType">News</Property>
2 ) - Create an addictional parameter in the DocTypes like this:
<DocTypes>
<DocType alias="RootFolderType" name="News" />
<DocType alias="NewsItem" folderProvider="DateFolder" />
</DocTypes>
3 ) - Create a new parameter like this:
<RootFolderTypes>
<RootFolderType alias="News" />
</RootFolderTypes>
In all these cases, The RootFolderType can be used to:
1 ) - Discover the Parent Node with this NodeTypeAlias;
2 ) - Check if Year Folder exist and If No, create the new Year and the Month Folders and move the new newsItem;
3 ) - If Yes, check if Month Folder exist and if yes move only the new newsItem into this folder, otherwise create only the new month folder and move the new newsItem;
What do you think?
Bye
Adriano
A general solution could be the use of an XPath expression to identify the RootFolder, instead of relying only on the type of the RootFolder.
Hi,
Thanks for the input and suggestions... keep em coming.
Are we thinking something like
??
Hi Chris,
I think it is perfect the second line:
<DocType alias="BlogItem" folderProvider="BlogProvider" RootFolder="//node[@docTypeAlais='Blogs']" />
In this case we can find the first parent node that have thew docTypeAlias specified in the RootFolder parameter and start the normal check/insert/move actions.
I think the RootFolder parameter must be optional.
Without it the autoFolders must run like now.
Do you think you will quickly publish the new feature?
Bye
Adriano
@Chris: it would be fantastic!
It's a plan!
Not tonight (it is Friday night after all), but it'll be in place for Monday morning
Chris
@Chris: Perfect...I'm ready to test it.
Thank you
Hi,
Version 1.3 has now been released with this new feature. You can now specifiy a 'rootFolder' against the FolderProvider.
I know the attribute is in a different place that we discussed, it's part of a bigger discussion I've started at http://our.umbraco.org/projects/autofolders/general/4441-Settings--Configuration-Improvements
Please let me know how you get on with 1.3.
Chris
Oh... and remember to vote up the package (and this thread) if you're happy with it.
@Chris: Wonderful, I'm downloading and I'll try in the afternoon.
Thank you
Adriano
Hi Chris,
I've tested your package, but it wasn't working the way I needed. Since it was easier to change your code than trying to explain better what I needed, I modified it so that the rootFolder xPath property is meant to directly return the node under which to search for year, month (and day) folders.
With this approach I can use rootFolder="//node[@id='1181']" to directly specify a given root node or use a more general expression like rootFolder="$currentParent/ancestor::node[@nodeTypeAlias='news'][1]" to specify the first ancestor of type 'news'.
This allows me to have several 'news' folders in my content tree and, at the same time, helps my content editors to keep clean the news folders structure.
If you want I can send you my code for evaluation.
Yes please do.
Send it too chriskoiak {_at} gmail.
I'll report back to this thread once i've seen what you've done.
Chris
Hi Chris,
I just sent the email with the updated project.
You can test it and report me your opinion about it.
By
Adriano
Chris,
Did you receive my email?
Can you tell me about my solution?
Thanks
Adriano
OK... so it took almost a month... but the new version now supports this feature.
I liked your solution, and I've included your changes in the latest release (v2.0), but renamed RootFolder to rootParents to support mutliple parent structures.
Cheers,
Chris
Hi Chris,
sorry for delay I saw now the new version.
Now I think it is perfect.
Thanks and have a good day.
Adriano
is working on a reply...