cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced search form in popup invoked from EDIT METADATA

chini
Champ in-the-making
Champ in-the-making
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
3 REPLIES 3

chini
Champ in-the-making
Champ in-the-making
Nobody?

wabson
Star Contributor
Star Contributor
Hi Chini,

If I understand correctly, you want to fill in the value of a metadata property, based on the user selecting a matched item from a search that they perform. Is that correct?

If so, there is the concept of a 'picker' that is used for selecting tags, categories and other nodes (e.g. for associations) for an item, and these pickers are implemented using a custom form control. The pickers are displayed using a modal dialog (similar to a traditional pop-up but using HTML overlays that can be shown and hidden dynamically) and implemented using client-side JavaScript.

You can find a number of examples of implementing custom form controls such as this in the Forms Development Kit (FDK). Have you had a look at that?

Cheers,
Will

chini
Champ in-the-making
Champ in-the-making
Thanks a lot for your responses.
Both comments are very helpful - I will let you know if I need more help on this.