AnsweredAssumed Answered

Edit properties inline on document details page

Question asked by dsmith on Mar 10, 2015
I'm testing out 5.0.c Community with Records Management and hoping to have users be able to edit document properties while still viewing the document itself (the information they're entering is on the document itself, for example the name of an estate on a will).

I found the following post related to 4.0 with an identical question (tl;dr it didn't work, read if you want, skip to EDIT/UPDATE if not):

https://forums.alfresco.com/forum/end-user-discussions/alfresco-share/edit-properties-alfresco-40-05242012-1845

I'm having a little trouble implementing it, as I'm not well versed in java or xml.

And also not sure if those directions still apply to 5.0.c.

As I read the response, I should be copying this block from \tomcat\webapps\share\WEB-INF\classes\alfresco\share-documentlibrary-config.xml:


872          <!– Edit properties pop-up –>
873          <action id="document-edit-properties" type="javascript" label="actions.document.edit-metadata">
874             <param name="function">onActionDetails</param>
875             <permissions>
876                <permission allow="true">Write</permission>
877             </permissions>
878             <evaluator negate="true">evaluator.doclib.action.checkedOutAspect</evaluator>
879          </action>


to \tomcat\webapps\share\WEB-INF\classes\alfresco\share-form-config.xml

But I'm not sure where in share-form-config.xml to put it.  I've tried a few locations that looked like they relate with no success.

I know I'm probably butchering this edit terribly, so any help would be appreciated.

<strong>EDIT/UPDATE</strong>

I did some more searching and came up with the thread here, which is a old also but addresses the same issue.

https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/showing-edit-metada-and-document-preview

Tried the first suggestion, adding as follows (with code updated to match the syntax in the 5.0.c files).

Added to tomcat/webapps/share/WEB-INF/classes/alfresco/templates/org/alfresco/document-details.ftl:

<@region id="edit-metadata" scope="template"/>


Added to tomcat/webapps/share/WEB-INF/classes/alfresco/site-data/template-instances/document-details.xml (copied directly from edit-metadata.xml):

       <!– Edit Metadata Form –>
       <component>
          <region-id>edit-metadata</region-id>
          <url>/components/form</url>
          <properties>
             <itemKind>node</itemKind>
             <itemId>{nodeRef}</itemId>
             <mode>edit</mode>
             <submitType>json</submitType>
             <showCaption>true</showCaption>
             <showCancelButton>true</showCancelButton>
          </properties>
       </component>


This appears to work, and gives an edit-metadata region to the document details screen, but when clicking 'submit', the user gets the below message.  The info does save correctly though.


{
  
    "persistedObject": "workspace://SpacesStore/4d4a272d-60d5-4810-8164-4a1e595d92f2",
    "message": "Successfully persisted form for item [node]workspace/SpacesStore/4d4a272d-60d5-4810-8164-4a1e595d92f2"
   }


Finally, I tried the suggestion by ekimnosneb, which was to add a document preview to the edit-metadata page, instead of adding edit-metadata to document preview.  I thought this might be a simpler solution (adding an image to a page instead of a whole editable/submittable section).

I copied the WebPreview section from document-details.xml to edit-metadata.xml, and referenced it in document-details.ftl, but just got an error message when loading the edit metadata page, so that's been a dead end so far.

<strong>EDIT/UPDATE #2</strong>

I think I've mostly got it:

I added the edit-metadata-mgr section from edit-metadata.xml to tomcat/webapps/share/WEB-INF/classes/alfresco/site-data/template-instances/document-details.xml in addition to the edit-metadata section I had already put in place.  And then added <@region id="edit-metadata" scope="template"/> to tomcat/webapps/share/WEB-INF/classes/alfresco/templates/org/alfresco/document-details.ftl.

Now when I edit the document properties and click save, I'm brought back to the Site dashboard without error and everything is saved properly.  I've been doing this in a regular site instead of Records Management, but I'm hoping it will work the same there.

I'd appreciate any advice if I'm doing something dangerous if this were in production.

Outcomes