This is actually two small web scripts, which between them allow you to select an Alfresco web project and fix up the metadata on all form generated assets, including renditions. I wrote it to allow me to reassociate assets with their forms after using CIFS to do an export and import of some sites I’ve been working on.
At the moment the script iterates through the site directory structure looking for any XML item not associated with a web form. Then, if a form with a matching root tag is found associated with the web project then the appropriate aspects and properties are added to the node and any existing renditions.
Unlike with the Web Project Tools AMP existing form metadata cannot be removed or repaired, but I quite like the simpleness of this approach. Adding the ability to do this would perhaps be useful, but would complicate the UI and wasn’t required for my purposes. I might add this later, in addition to the ability to preview the changes.
Right now it’s recommended to ensure the current user’s sandbox is empty before executing the script, so that you can easily undo all changes should your data get munged. The script has been tested against a couple of web projects that I have access to but as it has not yet had widespread testing it should be used with caution!
Note, you need to have a sandbox for the web project you want to repair. If you do not then the site will not show up in the initial list.
To install the web script extract the contents of the ZIP file somewhere in your web script package hierarchy, either on the classpath or inside the Data Dictionary – org/alfresco/wcm works for me. Remember you’ll need to reload Alfresco or at least refresh the list of web scripts to get Alfresco to pick it up.
Update: Thanks to Nancy for pointing me at the Developer Tools area of the Content Community – the code is also now available there.