AnsweredAssumed Answered

Edit-metadata within document-details

Question asked by dsmith on Mar 31, 2015
Latest reply on Apr 2, 2015 by rjohnson
Alfresco version: 5.0.c Community

I have some custom content types that need to be indexed by hand via metadata.  The documents are handwritten so the users need to be able to see the document while they edit the metadata.

When I was first getting my head around Alfresco, I accomplished this by directly editing document-details.xml and document-details.ftl, see <a href="https://forums.alfresco.com/forum/installation-upgrades-configuration-integration/configuration/edit-properties-inline-document">here</a>.

But I want to do this the right way (or "a" right way, if there are multiple approaches), so that upgrades don't blow away my customizations.

So currently, I've been following the gist of blog post <a href="http://blogs.alfresco.com/wp/ewinlof/2011/11/09/add-remove-or-replace-components-on-shares-document-details-page/">here</a>, and have created a maven share tier project with the file my-share-project-document-details.xml in my-share-project/src/main/amp/config/alfresco/web-extension/site-data/extensions with the following code:


<extension>
    <modules>
        <module>
            <id>MCRD - Document Details Page</id>
            <evaluator type="default.extensibility.evaluator"/>
            <components>
                    <component>
                            <scope>template</scope>
                            <region-id>document-actions</region-id>
                            <source-id>document-details</source-id>
                            <sub-components>
                                    <sub-component id="edit-metadata-mgr" index="2">
                                            <evaluations>
                                                    <evaluation id="mcrd-edit-metadata-mgr">
                                                            <url>/components/edit-metadata/edit-metadata-mgr</url>
                                                    </evaluation>
                                            </evaluations>
                                    </sub-component>
                                    <sub-component id="edit-metadata" index="3">
                                            <evaluations>
                                                    <evaluation id="mcrd-edit-metadata">
                                                            <url>/components/form</url>
                                                            <properties>
                                                                <itemKind>node</itemKind>
                                                                <itemId>{nodeRef}</itemId>
                                                                <mode>edit</mode>
                                                                <submitType>json</submitType>
                                                                <showCaption>true</showCaption>
                                                                <showCancelButton>true</showCancelButton>
                                                            </properties>
                                                    </evaluation>
                                            </evaluations>
                                    </sub-component>
                            </sub-components>
                    </component>
            </components>
        </module>
    </modules>
</extension>


After activating the module in Share, everything works as expected - the edit properties region shows up alongside the document preview and can be edited and saved.

But I feel like I've accomplished this without knowing exactly what I'm doing or how I'm doing it.  Can anyone confirm that this is a correct way to go about accomplishing my goal or suggest a better way if it's not?

Also, I'm curious what I'd do if I wanted to get a little deeper into customizing the document details.  What if I wanted to adjust the column spacing or create a region for the edit-metadata component, rather than making it a sub-component of document-actions?  I know could directly edit document-details.ftl in the running instance, but how would I accomplish this in the SDK?  I'm working my way through the documentation, but I'm a little overwhelmed by how many ways there are to go about it and wondering if anyone can recommend some reading material more geared toward one approach.

Outcomes