NIHVIVO-646 Tweaks to autocomplete on add authors to pub form

This commit is contained in:
rjy7 2010-06-28 14:37:05 +00:00
parent 31a4df9228
commit 7d323d8cbd
3 changed files with 10 additions and 3 deletions

View file

@ -395,16 +395,17 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
}
protected String mergeBodyToTemplate(String templateName, Map<String, Object> map, Configuration config) {
templateName = "body/" + templateName;
templateName = "body/" + templateName; // Remove once we flatten template directory
String body = mergeToTemplate(templateName, map, config).toString();
return body;
}
protected void writePage(Map<String, Object> root, Configuration config, HttpServletResponse response) {
String templateName = "page/" + getPageTemplateName();
String templateName = "page/" + getPageTemplateName(); // Remove the directory once we flatten template directory
writeTemplate(templateName, root, config, response);
}
// Remove this method once we flatten template directory
protected void ajaxWrite(String templateName, Map<String, Object> map, Configuration config, HttpServletResponse response) {
templateName = "ajax/" + templateName;
writeTemplate(templateName, map, config, response);

View file

@ -359,6 +359,8 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea
}
private void doSearchError(String templateName, Map<String, Object> map, Configuration config, HttpServletResponse response) {
// For now, we are not sending an error message back to the client because with the default autocomplete configuration it
// chokes.
ajaxWrite(templateName, map, config, response);
}

View file

@ -7,10 +7,14 @@
<@json.array results />
-->
<#if errorMsg??>${errorMsg}
<#else>
[
<#if results??>
<#list results as result>
{ "label": "${result.label}", "uri": "${result.uri}" }<#if result_has_next>,</#if>
</#list>
</#if>
]
]
</#if>