NIHVIVO-1332 Moved getImageUploadUrl from UrlBuilder to ObjectPropertyTemplateModel. Temporarily removed hard-coded co-author display from foaf:Person page.
This commit is contained in:
parent
35933a9ae6
commit
7373e6ce67
3 changed files with 13 additions and 14 deletions
|
@ -36,7 +36,6 @@ public class UrlBuilder {
|
|||
AUTHENTICATE("/authenticate"),
|
||||
BROWSE("/browse"),
|
||||
CONTACT("/contact"),
|
||||
IMAGE_UPLOAD("/uploadImages"),
|
||||
INDIVIDUAL("/individual"),
|
||||
INDIVIDUAL_EDIT("/entityEdit"),
|
||||
INDIVIDUAL_LIST("/individuallist"),
|
||||
|
@ -281,13 +280,6 @@ public class UrlBuilder {
|
|||
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) {
|
||||
String encoding = "ISO-8859-1";
|
||||
String encodedUrl = null;
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
|||
String editUrl = "";
|
||||
if (isEditable()) {
|
||||
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
|
||||
return UrlBuilder.getImageUploadUrl(subjectUri, "edit");
|
||||
return ObjectPropertyTemplateModel.getImageUploadUrl(subjectUri, "edit");
|
||||
}
|
||||
ParamMap params = new ParamMap(
|
||||
"subjectUri", subjectUri,
|
||||
|
@ -94,7 +94,6 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
|||
params.put("deleteProhibited", "prohibited");
|
||||
}
|
||||
editUrl = UrlBuilder.getUrl(EDIT_PATH, params);
|
||||
|
||||
}
|
||||
|
||||
return editUrl;
|
||||
|
@ -104,7 +103,7 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
|||
String deleteUrl = "";
|
||||
if (isDeletable()) {
|
||||
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
|
||||
return UrlBuilder.getImageUploadUrl(subjectUri, "delete");
|
||||
return ObjectPropertyTemplateModel.getImageUploadUrl(subjectUri, "delete");
|
||||
}
|
||||
ParamMap params = new ParamMap(
|
||||
"subjectUri", subjectUri,
|
||||
|
|
|
@ -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.freemarker.UrlBuilder;
|
||||
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.VitroVocabulary;
|
||||
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 String TYPE = "object";
|
||||
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
|
||||
* actually defines its own post-processor, whereas the default post-processor is used for custom views
|
||||
|
@ -95,7 +97,6 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected String getQueryString() {
|
||||
return config.queryString;
|
||||
}
|
||||
|
@ -104,6 +105,13 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
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.
|
||||
* The primary object is the X in the assertion "?subject ?property ?X".
|
||||
*/
|
||||
|
@ -355,7 +363,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
String addUrl = "";
|
||||
if (addAccess) {
|
||||
if (propertyUri.equals(VitroVocabulary.IND_MAIN_IMAGE)) {
|
||||
return UrlBuilder.getImageUploadUrl(subjectUri, "add");
|
||||
return getImageUploadUrl(subjectUri, "add");
|
||||
}
|
||||
ParamMap params = new ParamMap(
|
||||
"subjectUri", subjectUri,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue