AnsweredAssumed Answered

Advanced search form in popup invoked from EDIT METADATA

Question asked by chini on Mar 9, 2012
Latest reply on Mar 26, 2012 by chini
Hi,

despite being working with Alfresco for quite some time now, this is my first post in this forum.
So please, be patient with me if this first post does not comply with best practices about how to request help over here.

I am trying to achieve the following things:
1. provide a link/button inside or next to the default EDIT METADATA form.
2. When clicked a large popup (or if not possible full size MDI window) should open containing the out-of-the-box advanced-search form (with type filter options slightly different from the default search options);
inside that windows all out-of-the-box search and result processing functionality must be available, with one exception:
3. When clicking on a result record (of a custom folder type in my case) I want a specific meta property related to that record returned to the main/base EDIT METADATA window and pasted into one of the form fields automatically.

I am aware that the search form itself is provided by a client-side javascript, while the actual repository search actions are being delegated via a proxy filter.

What I accomplished so far is to build more or less duplicate versions of the advanced-search resources, by cloning and slightly modifying advsearch.js, advsearch.xml, advsearch.get.desc.xml, .get.head.ftl, .get.html.ftl, .get.js and .get.properties as well as modifying web-client-config-custom.xml, adding custom label resources, and adding the new .js files to the classpath inside actions-common.get.head.ftl.
In fact I tested succesfully, it is now possible to link to the custom search screen from anywhere inside Share, via the component reference [advsearch2]. And onces loaded that screen behaves exactly like the original advanced-search component. All fine so far.

My main problem now is to figure out how to link that functionality to the EDIT METADATA screen as described above.
Certainly I need to do some modifications to the edit-metadata.* resources.
I tried to include [advsearch.js] inside a field validation freemarker template, since the way the fileupload or datepicker field template work seems similar to what I am trying to achieve:
- popup
- select a value
- return the value to the connected field
That approach did not work for me, I guess because the script constructor cannot be invoked the same way here as via a href. Then again there is no server-side actions involved with those sample templates.

So I have got a few questions someone can hopefully help me with:
1. What's the best place to place a button or link (e.g. inside or outside the main form) in order to invoke the new search popup?
2. Is it possible to show search filter and search results on the same screen so it is possible to search repeatedly without having to deal with plenty of separate windows?
3. How can I return a reference to a node or a specific meta property of a node to the calling EDIT METADATA form?


Thanks for your help in advance,
Stephan

Outcomes