Changeset 4902
- Timestamp:
- 04/04/14 15:35:41 (11 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.html
r4900 r4902 61 61 </li> 62 62 <li wicket:id="contentSearch"> 63 <form id="contentSearchForm" wicket:id="fcsForm" method="post" name="fcsForm" target="_blank" action="[Aggregator endpoint]"> 64 <fieldset style="border:0px;"> 65 <input type="hidden" name="query" id="query" value="" /> 66 <input wicket:id="aggregationContent" type="hidden" name="x-aggregation-context" value='[Endpoint/ID JSON]' /> 67 <input type="hidden" name="operation" value="searchRetrieve" /> 68 <input type="hidden" name="version" value="1.2" /> 69 </fieldset> 70 </form> 71 <a href="#" onclick="document.fcsForm.submit();">Plain text search via Federated Content Search</a> 63 <wicket:container wicket:id="fcsForm">[FCS form]</wicket:container> 72 64 </li> 73 65 </ul> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java
r4900 r4902 18 18 19 19 import eu.clarin.cmdi.vlo.FacetConstants; 20 import eu.clarin.cmdi.vlo.config.VloConfig;21 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 22 21 import eu.clarin.cmdi.vlo.pojo.SearchContext; … … 33 32 import eu.clarin.cmdi.vlo.wicket.panels.BreadCrumbPanel; 34 33 import eu.clarin.cmdi.vlo.wicket.panels.PermaLinkPanel; 34 import eu.clarin.cmdi.vlo.wicket.panels.record.ContentSearchFormPanel; 35 35 import eu.clarin.cmdi.vlo.wicket.panels.record.FieldsTablePanel; 36 36 import eu.clarin.cmdi.vlo.wicket.panels.record.RecordNavigationPanel; … … 38 38 import eu.clarin.cmdi.vlo.wicket.provider.DocumentFieldsProvider; 39 39 import org.apache.solr.common.SolrDocument; 40 import org.apache.wicket.AttributeModifier;41 40 import org.apache.wicket.Component; 42 41 import org.apache.wicket.RestartResponseException; 43 42 import org.apache.wicket.Session; 44 43 import org.apache.wicket.ajax.AjaxRequestTarget; 45 import org.apache.wicket.ajax.json.JSONArray;46 import org.apache.wicket.ajax.json.JSONException;47 import org.apache.wicket.ajax.json.JSONObject;48 44 import org.apache.wicket.markup.html.WebMarkupContainer; 49 45 import org.apache.wicket.markup.html.basic.Label; … … 65 61 66 62 @SpringBean 67 private VloConfig vloConfig;68 @SpringBean69 63 private PageParametersConverter<QueryFacetsSelection> selectionParametersConverter; 70 64 @SpringBean(name = "basicPropertiesFilter") … … 209 203 @Override 210 204 protected void populateItem(ListItem<String> item) { 211 try { 212 item.add(createContentSearchForm("fcsForm", item.getModel())); 213 } catch (JSONException ex) { 214 //TODO: handle gracefully? 215 throw new RuntimeException(ex); 216 } 217 } 218 219 private WebMarkupContainer createContentSearchForm(String id, IModel<String> endpointModel) throws JSONException { 220 // Prepare a JSON object that holds the CQL endpoint and the document ID 221 final JSONObject json = new JSONObject(); 222 final String endPoint = endpointModel.getObject(); 223 final Object docId = RecordPage.this.getModel().getObject().getFirstValue(FacetConstants.FIELD_ID); 224 json.put(endPoint, new JSONArray(new Object[]{docId})); 225 226 // Populate attributes in submit form... 227 final WebMarkupContainer fcsForm = new WebMarkupContainer(id); 228 // The action of the form should be the aggregator endpoint 229 fcsForm.add(new AttributeModifier("action", vloConfig.getFederatedContentSearchUrl())); 230 231 final WebMarkupContainer aggregationContext = new WebMarkupContainer("aggregationContent"); 232 // The value of the aggregation context hidden form field should be the JSON object 233 aggregationContext.add(new AttributeModifier("value", json.toString(2))); 234 fcsForm.add(aggregationContext); 235 236 return fcsForm; 205 item.add(new ContentSearchFormPanel("fcsForm", RecordPage.this.getModel(), item.getModel())); 237 206 } 238 207 });
Note: See TracChangeset
for help on using the changeset viewer.