NIHVIVO-1956 Distinguish person and non-person placeholder images on image upload page.

This commit is contained in:
rjy7 2011-01-28 19:44:48 +00:00
parent dd839ebd18
commit 2e06b3d796

View file

@ -53,7 +53,8 @@ public class ImageUploadController extends FreemarkerHttpServlet {
private static final String DEFAULT_NAMESPACE = ConfigurationProperties private static final String DEFAULT_NAMESPACE = ConfigurationProperties
.getProperty("Vitro.defaultNamespace"); .getProperty("Vitro.defaultNamespace");
public static final String DUMMY_THUMBNAIL_URL = "/images/placeholders/person.thumbnail.jpg"; public static final String DUMMY_THUMBNAIL_PERSON_URL = "/images/placeholders/person.thumbnail.jpg";
public static final String DUMMY_THUMBNAIL_NON_PERSON_URL = "/images/placeholders/non.person.thumbnail.jpg";
/** Limit file size to 6 megabytes. */ /** Limit file size to 6 megabytes. */
public static final int MAXIMUM_FILE_SIZE = 6 * 1024 * 1024; public static final int MAXIMUM_FILE_SIZE = 6 * 1024 * 1024;
@ -389,7 +390,14 @@ public class ImageUploadController extends FreemarkerHttpServlet {
entity.getURI()); entity.getURI());
TemplateResponseValues rv = new TemplateResponseValues(TEMPLATE_NEW); TemplateResponseValues rv = new TemplateResponseValues(TEMPLATE_NEW);
rv.put(BODY_THUMBNAIL_URL, UrlBuilder.getUrl(DUMMY_THUMBNAIL_URL));
// rjy7 We should not be referencing particular ontology values here, and ideally
// the template would add the placeholder url to the edit link, since it already
// knows which placeholder it's using. However, this requires a significantly more
// complex implementation, so keeping it simple for now.
String dummyThumbnailUrl = entity.isVClass("http://xmlns.com/foaf/0.1/Person") ?
DUMMY_THUMBNAIL_PERSON_URL : DUMMY_THUMBNAIL_NON_PERSON_URL;
rv.put(BODY_THUMBNAIL_URL, UrlBuilder.getUrl(dummyThumbnailUrl));
rv.put(BODY_FORM_ACTION, formAction); rv.put(BODY_FORM_ACTION, formAction);
rv.put(BODY_CANCEL_URL, cancelUrl); rv.put(BODY_CANCEL_URL, cancelUrl);
rv.put(BODY_TITLE, "Upload image" + forName(entity)); rv.put(BODY_TITLE, "Upload image" + forName(entity));