Revision 28533
Added by Michele Artini over 10 years ago
modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/LightUiEntryPointController.java | ||
---|---|---|
23 | 23 |
final HttpServletResponse response) throws Exception { |
24 | 24 |
|
25 | 25 |
if (request.getParameterMap().containsKey("ui")) { |
26 |
final List<SearchField> searchFields = searchFieldGrouper.getAllFields(request.getParameter("ui")); |
|
26 |
final String uiId = request.getParameter("ui"); |
|
27 |
final List<SearchField> searchFields = searchFieldGrouper.getAllFields(uiId); |
|
27 | 28 |
map.addAttribute("fields", searchFields); |
28 | 29 |
map.addAttribute("fieldsJson", (new Gson()).toJson(searchFields)); |
30 |
map.addAttribute("uiId", uiId); |
|
29 | 31 |
} else { |
30 | 32 |
response.sendError(500, "Field 'ui' is missing"); |
31 | 33 |
} |
modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/LightUiInternalController.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
@javax.annotation.Resource |
33 | 33 |
private IndexClient indexClient; |
34 |
|
|
35 |
//TODO: eliminare costante |
|
36 |
private static final String lightuiId = "eagle"; |
|
37 | 34 |
|
38 | 35 |
@RequestMapping("/ui/lightui_browse") |
39 |
public @ResponseBody String browse(@RequestParam(value="query", required=true) final String query) throws Exception { |
|
36 |
public @ResponseBody String browse(@RequestParam(value="ui", required=true) final String lightuiId, @RequestParam(value="query", required=true) final String query) throws Exception {
|
|
40 | 37 |
final Node browseNode = getConfigurationNode(lightuiId, "//BROWSE"); |
41 | 38 |
final int max = NumberUtils.toInt(browseNode.valueOf("@max"), DEFAULT_MAX_BROWSE_VALUES); |
42 | 39 |
final Resource xslt = new ClassPathResource(browseNode.valueOf("./FORMATTER/@xslt")); |
... | ... | |
52 | 49 |
} |
53 | 50 |
|
54 | 51 |
@RequestMapping("/ui/lightui_browse_one") |
55 |
public @ResponseBody String browseOne(@RequestParam(value="query", required=true) final String query, @RequestParam(value="field", required=true) final String field, @RequestParam(value="label", required=true) final String label) throws Exception { |
|
52 |
public @ResponseBody String browseOne(@RequestParam(value="ui", required=true) final String lightuiId, @RequestParam(value="query", required=true) final String query, @RequestParam(value="field", required=true) final String field, @RequestParam(value="label", required=true) final String label) throws Exception {
|
|
56 | 53 |
final Node browseNode = getConfigurationNode(lightuiId, "//BROWSE_SINGLE_FIELD"); |
57 | 54 |
final int max = NumberUtils.toInt(browseNode.valueOf("@max"), DEFAULT_MAX_SINGLE_BROWSE_FIELD_VALUES); |
58 | 55 |
|
... | ... | |
65 | 62 |
|
66 | 63 |
@RequestMapping("/ui/lightui_search") |
67 | 64 |
public @ResponseBody SearchResult search( |
65 |
@RequestParam(value="ui", required=true) final String lightuiId, |
|
68 | 66 |
@RequestParam(value="query", required=true) final String query, |
69 | 67 |
@RequestParam(value="page", required=true) final int page) throws Exception { |
70 | 68 |
|
... | ... | |
76 | 74 |
} |
77 | 75 |
|
78 | 76 |
@RequestMapping("/ui/lightui_findone") |
79 |
public @ResponseBody String getDocument(@RequestParam(value="field", required=true) final String field, @RequestParam(value="id", required=true) final String id) throws Exception { |
|
77 |
public @ResponseBody String getDocument( |
|
78 |
@RequestParam(value="ui", required=true) final String lightuiId, |
|
79 |
@RequestParam(value="field", required=true) final String field, |
|
80 |
@RequestParam(value="id", required=true) final String id) throws Exception { |
|
80 | 81 |
final Node searchNode = getConfigurationNode(lightuiId, "//DOCUMENT"); |
81 | 82 |
final Resource xslt = new ClassPathResource(searchNode.valueOf("./FORMATTER/@xslt")); |
82 | 83 |
|
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/lightui.st | ||
---|---|---|
12 | 12 |
function getOperators() { |
13 | 13 |
return { $fields:{f|'$f.field$' : '$f.operator$'};separator=", "$ } |
14 | 14 |
} |
15 |
|
|
16 |
function getLightUiId() { |
|
17 |
return '$uiId$'; |
|
18 |
} |
|
15 | 19 |
</script> |
16 | 20 |
|
17 | 21 |
|
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_lightui_controllers.js | ||
---|---|---|
57 | 57 |
|
58 | 58 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; |
59 | 59 |
$http.post('lightui_browse', $.param({ |
60 |
'ui' : getLightUiId(), |
|
60 | 61 |
'query' : $scope.query, |
61 | 62 |
})).success(function(data) { |
62 | 63 |
$scope.hideSpinner(); |
... | ... | |
76 | 77 |
|
77 | 78 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; |
78 | 79 |
$http.post('lightui_browse_one', $.param({ |
80 |
'ui' : getLightUiId(), |
|
79 | 81 |
'query' : $scope.query, |
80 | 82 |
'field' : field, |
81 | 83 |
'label' : label |
... | ... | |
103 | 105 |
|
104 | 106 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; |
105 | 107 |
$http.post('lightui_search', $.param({ |
108 |
'ui' : getLightUiId(), |
|
106 | 109 |
'query' : $scope.query, |
107 | 110 |
'page' : $scope.page |
108 | 111 |
})).success(function(data) { |
... | ... | |
170 | 173 |
|
171 | 174 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; |
172 | 175 |
$http.post('lightui_findone', $.param({ |
176 |
'ui' : getLightUiId(), |
|
173 | 177 |
'field' : $routeParams.field, |
174 | 178 |
'id' : $routeParams.id |
175 | 179 |
})).success(function(data) { |
Also available in: Unified diff
removed constant eagle