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) { 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(); String body = mergeToTemplate(templateName, map, config).toString();
return body; return body;
} }
protected void writePage(Map<String, Object> root, Configuration config, HttpServletResponse response) { 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); 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) { protected void ajaxWrite(String templateName, Map<String, Object> map, Configuration config, HttpServletResponse response) {
templateName = "ajax/" + templateName; templateName = "ajax/" + templateName;
writeTemplate(templateName, map, config, response); 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) { 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); ajaxWrite(templateName, map, config, response);
} }

View file

@ -7,6 +7,9 @@
<@json.array results /> <@json.array results />
--> -->
<#if errorMsg??>${errorMsg}
<#else>
[ [
<#if results??> <#if results??>
<#list results as result> <#list results as result>
@ -14,3 +17,4 @@
</#list> </#list>
</#if> </#if>
] ]
</#if>