NIHVIVO-1332 Moved getImageUploadUrl from UrlBuilder to ObjectPropertyTemplateModel. Temporarily removed hard-coded co-author display from foaf:Person page.

This commit is contained in:
rjy7 2011-01-14 19:34:18 +00:00
parent 35933a9ae6
commit 7373e6ce67
3 changed files with 13 additions and 14 deletions

View file

@ -36,7 +36,6 @@ public class UrlBuilder {
AUTHENTICATE("/authenticate"), AUTHENTICATE("/authenticate"),
BROWSE("/browse"), BROWSE("/browse"),
CONTACT("/contact"), CONTACT("/contact"),
IMAGE_UPLOAD("/uploadImages"),
INDIVIDUAL("/individual"), INDIVIDUAL("/individual"),
INDIVIDUAL_EDIT("/entityEdit"), INDIVIDUAL_EDIT("/entityEdit"),
INDIVIDUAL_LIST("/individuallist"), INDIVIDUAL_LIST("/individuallist"),
@ -281,13 +280,6 @@ public class UrlBuilder {
return profileUrl; return profileUrl;
} }
public static String getImageUploadUrl(String subjectUri, String action) {
ParamMap params = new ParamMap(
"entityUri", subjectUri,
"action", action);
return UrlBuilder.getUrl(Route.IMAGE_UPLOAD, params);
}
public static String urlEncode(String url) { public static String urlEncode(String url) {
String encoding = "ISO-8859-1"; String encoding = "ISO-8859-1";
String encodedUrl = null; String encodedUrl = null;

View file

@ -84,7 +84,7 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
String editUrl = ""; String editUrl = "";
if (isEditable()) { if (isEditable()) {
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) { if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
return UrlBuilder.getImageUploadUrl(subjectUri, "edit"); return ObjectPropertyTemplateModel.getImageUploadUrl(subjectUri, "edit");
} }
ParamMap params = new ParamMap( ParamMap params = new ParamMap(
"subjectUri", subjectUri, "subjectUri", subjectUri,
@ -94,7 +94,6 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
params.put("deleteProhibited", "prohibited"); params.put("deleteProhibited", "prohibited");
} }
editUrl = UrlBuilder.getUrl(EDIT_PATH, params); editUrl = UrlBuilder.getUrl(EDIT_PATH, params);
} }
return editUrl; return editUrl;
@ -104,7 +103,7 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
String deleteUrl = ""; String deleteUrl = "";
if (isDeletable()) { if (isDeletable()) {
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) { if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
return UrlBuilder.getImageUploadUrl(subjectUri, "delete"); return ObjectPropertyTemplateModel.getImageUploadUrl(subjectUri, "delete");
} }
ParamMap params = new ParamMap( ParamMap params = new ParamMap(
"subjectUri", subjectUri, "subjectUri", subjectUri,

View file

@ -32,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
@ -43,6 +44,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
private static final Log log = LogFactory.getLog(ObjectPropertyTemplateModel.class); private static final Log log = LogFactory.getLog(ObjectPropertyTemplateModel.class);
private static final String TYPE = "object"; private static final String TYPE = "object";
private static final String EDIT_PATH = "edit/editRequestDispatch.jsp"; private static final String EDIT_PATH = "edit/editRequestDispatch.jsp";
private static final String IMAGE_UPLOAD_PATH = "/uploadImages";
/* NB The default post-processor is not the same as the post-processor for the default view. The latter /* NB The default post-processor is not the same as the post-processor for the default view. The latter
* actually defines its own post-processor, whereas the default post-processor is used for custom views * actually defines its own post-processor, whereas the default post-processor is used for custom views
@ -94,8 +96,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
} }
} }
} }
protected String getQueryString() { protected String getQueryString() {
return config.queryString; return config.queryString;
} }
@ -103,6 +104,13 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
protected boolean hasDefaultListView() { protected boolean hasDefaultListView() {
return config.isDefaultConfig; return config.isDefaultConfig;
} }
public static String getImageUploadUrl(String subjectUri, String action) {
ParamMap params = new ParamMap(
"entityUri", subjectUri,
"action", action);
return UrlBuilder.getUrl(IMAGE_UPLOAD_PATH, params);
}
/** Return the name of the primary object variable of the query by inspecting the query string. /** Return the name of the primary object variable of the query by inspecting the query string.
* The primary object is the X in the assertion "?subject ?property ?X". * The primary object is the X in the assertion "?subject ?property ?X".
@ -355,7 +363,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
String addUrl = ""; String addUrl = "";
if (addAccess) { if (addAccess) {
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) { if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
return UrlBuilder.getImageUploadUrl(subjectUri, "add"); return getImageUploadUrl(subjectUri, "add");
} }
ParamMap params = new ParamMap( ParamMap params = new ParamMap(
"subjectUri", subjectUri, "subjectUri", subjectUri,