NIHVIVO-2612 Remove portal-relative url-building methods from UrlBuilder. As a consequence, all methods can become static, so add a private constructor so the class cannot be instantiated.
This commit is contained in:
parent
b3d4a305c6
commit
d09a6640d9
7 changed files with 46 additions and 92 deletions
|
@ -245,25 +245,25 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
// Define the URLs that are accessible to the templates. Note that we do not create menus here,
|
// Define the URLs that are accessible to the templates. Note that we do not create menus here,
|
||||||
// because we want the templates to be free to define the link text and where the links are displayed.
|
// because we want the templates to be free to define the link text and where the links are displayed.
|
||||||
private final Map<String, String> getUrls(String themeDir, UrlBuilder urlBuilder, VitroRequest vreq) {
|
private final Map<String, String> getUrls(String themeDir, VitroRequest vreq) {
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
|
|
||||||
urls.put("home", urlBuilder.getHomeUrl());
|
urls.put("home", UrlBuilder.getHomeUrl());
|
||||||
|
|
||||||
// Templates use this to construct urls.
|
// Templates use this to construct urls.
|
||||||
urls.put("base", UrlBuilder.contextPath);
|
urls.put("base", UrlBuilder.contextPath);
|
||||||
|
|
||||||
urls.put("about", urlBuilder.getPortalUrl(Route.ABOUT));
|
urls.put("about", UrlBuilder.getUrl(Route.ABOUT));
|
||||||
if (FreemarkerEmailFactory.isConfigured(vreq)) {
|
if (FreemarkerEmailFactory.isConfigured(vreq)) {
|
||||||
urls.put("contact", urlBuilder.getPortalUrl(Route.CONTACT));
|
urls.put("contact", UrlBuilder.getUrl(Route.CONTACT));
|
||||||
}
|
}
|
||||||
urls.put("search", urlBuilder.getPortalUrl(Route.SEARCH));
|
urls.put("search", UrlBuilder.getUrl(Route.SEARCH));
|
||||||
urls.put("termsOfUse", urlBuilder.getPortalUrl(Route.TERMS_OF_USE));
|
urls.put("termsOfUse", UrlBuilder.getUrl(Route.TERMS_OF_USE));
|
||||||
urls.put("login", urlBuilder.getLoginUrl());
|
urls.put("login", UrlBuilder.getLoginUrl());
|
||||||
urls.put("logout", urlBuilder.getLogoutUrl());
|
urls.put("logout", UrlBuilder.getLogoutUrl());
|
||||||
urls.put("myAccount", UrlBuilder.getUrl("/accounts/myAccount"));
|
urls.put("myAccount", UrlBuilder.getUrl("/accounts/myAccount"));
|
||||||
urls.put("siteAdmin", urlBuilder.getPortalUrl(Route.SITE_ADMIN));
|
urls.put("siteAdmin", UrlBuilder.getUrl(Route.SITE_ADMIN));
|
||||||
urls.put("themeImages", urlBuilder.getPortalUrl(themeDir + "/images"));
|
urls.put("themeImages", UrlBuilder.getUrl(themeDir + "/images"));
|
||||||
urls.put("images", UrlBuilder.getUrl("/images"));
|
urls.put("images", UrlBuilder.getUrl("/images"));
|
||||||
urls.put("theme", UrlBuilder.getUrl(themeDir));
|
urls.put("theme", UrlBuilder.getUrl(themeDir));
|
||||||
urls.put("index", UrlBuilder.getUrl("/browse"));
|
urls.put("index", UrlBuilder.getUrl("/browse"));
|
||||||
|
@ -351,9 +351,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
map.put("title", getTitle(siteName, vreq));
|
map.put("title", getTitle(siteName, vreq));
|
||||||
|
|
||||||
String themeDir = getThemeDir(appBean);
|
String themeDir = getThemeDir(appBean);
|
||||||
UrlBuilder urlBuilder = new UrlBuilder(appBean);
|
|
||||||
|
|
||||||
map.put("urls", getUrls(themeDir, urlBuilder, vreq));
|
map.put("urls", getUrls(themeDir, vreq));
|
||||||
|
|
||||||
map.put("themeDir", themeDir);
|
map.put("themeDir", themeDir);
|
||||||
map.put("currentTheme", themeDir.substring(themeDir.lastIndexOf('/')+1));
|
map.put("currentTheme", themeDir.substring(themeDir.lastIndexOf('/')+1));
|
||||||
|
@ -368,7 +367,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
map.put("user", new User(vreq));
|
map.put("user", new User(vreq));
|
||||||
|
|
||||||
map.put("version", getRevisionInfo(urlBuilder));
|
map.put("version", getRevisionInfo());
|
||||||
|
|
||||||
map.put("copyright", getCopyrightInfo(appBean));
|
map.put("copyright", getCopyrightInfo(appBean));
|
||||||
map.put("siteTagline", appBean.getShortHand());
|
map.put("siteTagline", appBean.getShortHand());
|
||||||
|
@ -418,11 +417,11 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
return copyright;
|
return copyright;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Map<String, Object> getRevisionInfo(UrlBuilder urlBuilder) {
|
private final Map<String, Object> getRevisionInfo() {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("label", RevisionInfoBean.getBean(getServletContext())
|
map.put("label", RevisionInfoBean.getBean(getServletContext())
|
||||||
.getReleaseLabel());
|
.getReleaseLabel());
|
||||||
map.put("moreInfoUrl", urlBuilder.getPortalUrl("/revisionInfo"));
|
map.put("moreInfoUrl", UrlBuilder.getUrl("/revisionInfo"));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjPro
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
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.ParamMap;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ForwardResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ForwardResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
@ -519,7 +520,7 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
*/
|
*/
|
||||||
private String formAction(String entityUri, String action,
|
private String formAction(String entityUri, String action,
|
||||||
String placeholderUrl) {
|
String placeholderUrl) {
|
||||||
UrlBuilder.ParamMap params = new UrlBuilder.ParamMap(
|
ParamMap params = new ParamMap(
|
||||||
PARAMETER_ENTITY_URI, entityUri, PARAMETER_ACTION, action,
|
PARAMETER_ENTITY_URI, entityUri, PARAMETER_ACTION, action,
|
||||||
PARAMETER_PLACEHOLDER_URL, placeholderUrl);
|
PARAMETER_PLACEHOLDER_URL, placeholderUrl);
|
||||||
return UrlBuilder.getPath(URL_HERE, params);
|
return UrlBuilder.getPath(URL_HERE, params);
|
||||||
|
|
|
@ -53,23 +53,21 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||||
Map<String, Object> body = new HashMap<String, Object>();
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
|
|
||||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getAppBean());
|
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditIndividuals())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new EditIndividuals())) {
|
||||||
body.put("dataInput", getDataInputData(vreq));
|
body.put("dataInput", getDataInputData(vreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
body.put("siteConfig", getSiteConfigurationData(vreq, urlBuilder));
|
body.put("siteConfig", getSiteConfigurationData(vreq));
|
||||||
|
|
||||||
// rjy7 There is a risk that the login levels required to show the links will get out
|
// rjy7 There is a risk that the login levels required to show the links will get out
|
||||||
// of step with the levels required by the pages themselves. We should implement a
|
// of step with the levels required by the pages themselves. We should implement a
|
||||||
// mechanism similar to what's used on the front end to display links to Site Admin
|
// mechanism similar to what's used on the front end to display links to Site Admin
|
||||||
// and Revision Info iff the user has access to those pages.
|
// and Revision Info iff the user has access to those pages.
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
||||||
body.put("ontologyEditor", getOntologyEditorData(vreq, urlBuilder));
|
body.put("ontologyEditor", getOntologyEditorData(vreq));
|
||||||
}
|
}
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
||||||
body.put("dataTools", getDataToolsData(vreq, urlBuilder));
|
body.put("dataTools", getDataToolsData(vreq));
|
||||||
|
|
||||||
// Only for DataStar. Should handle without needing a DataStar-specific version of this controller.
|
// Only for DataStar. Should handle without needing a DataStar-specific version of this controller.
|
||||||
//body.put("customReports", getCustomReportsData(vreq));
|
//body.put("customReports", getCustomReportsData(vreq));
|
||||||
|
@ -114,22 +112,22 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getSiteConfigurationData(VitroRequest vreq, UrlBuilder urlBuilder) {
|
private Map<String, Object> getSiteConfigurationData(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageUserAccounts())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageUserAccounts())) {
|
||||||
urls.put("userList", urlBuilder.getPortalUrl("/accountsAdmin"));
|
urls.put("userList", UrlBuilder.getUrl("/accountsAdmin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditSiteInformation())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new EditSiteInformation())) {
|
||||||
urls.put("siteInfo", urlBuilder.getPortalUrl("/editForm", new ParamMap("controller", "ApplicationBean")));
|
urls.put("siteInfo", UrlBuilder.getUrl("/editForm", new ParamMap("controller", "ApplicationBean")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO this goes away when Menu Management is complete - jblake
|
// TODO this goes away when Menu Management is complete - jblake
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, MenuN3EditController.REQUIRED_ACTIONS)) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, MenuN3EditController.REQUIRED_ACTIONS)) {
|
||||||
urls.put("menuN3Editor", urlBuilder.getPortalUrl("/menuN3Editor"));
|
urls.put("menuN3Editor", UrlBuilder.getUrl("/menuN3Editor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageMenus())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageMenus())) {
|
||||||
|
@ -143,7 +141,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getOntologyEditorData(VitroRequest vreq, UrlBuilder urlBuilder) {
|
private Map<String, Object> getOntologyEditorData(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
@ -171,25 +169,25 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
|
|
||||||
urls.put("ontologies", urlBuilder.getPortalUrl("/listOntologies"));
|
urls.put("ontologies", UrlBuilder.getUrl("/listOntologies"));
|
||||||
urls.put("classHierarchy", urlBuilder.getPortalUrl("/showClassHierarchy"));
|
urls.put("classHierarchy", UrlBuilder.getUrl("/showClassHierarchy"));
|
||||||
urls.put("classGroups", urlBuilder.getPortalUrl("/listGroups"));
|
urls.put("classGroups", UrlBuilder.getUrl("/listGroups"));
|
||||||
urls.put("dataPropertyHierarchy", urlBuilder.getPortalUrl("/showDataPropertyHierarchy"));
|
urls.put("dataPropertyHierarchy", UrlBuilder.getUrl("/showDataPropertyHierarchy"));
|
||||||
urls.put("propertyGroups", urlBuilder.getPortalUrl("/listPropertyGroups"));
|
urls.put("propertyGroups", UrlBuilder.getUrl("/listPropertyGroups"));
|
||||||
urls.put("objectPropertyHierarchy", urlBuilder.getPortalUrl("/showObjectPropertyHierarchy", new ParamMap("iffRoot", "true")));
|
urls.put("objectPropertyHierarchy", UrlBuilder.getUrl("/showObjectPropertyHierarchy", new ParamMap("iffRoot", "true")));
|
||||||
map.put("urls", urls);
|
map.put("urls", urls);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getDataToolsData(VitroRequest vreq, UrlBuilder urlBuilder) {
|
private Map<String, Object> getDataToolsData(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
urls.put("ingest", UrlBuilder.getUrl("/ingest"));
|
urls.put("ingest", UrlBuilder.getUrl("/ingest"));
|
||||||
urls.put("rdfData", urlBuilder.getPortalUrl("/uploadRDFForm"));
|
urls.put("rdfData", UrlBuilder.getUrl("/uploadRDFForm"));
|
||||||
urls.put("rdfExport", urlBuilder.getPortalUrl("/export"));
|
urls.put("rdfExport", UrlBuilder.getUrl("/export"));
|
||||||
urls.put("sparqlQuery", UrlBuilder.getUrl("/admin/sparqlquery"));
|
urls.put("sparqlQuery", UrlBuilder.getUrl("/admin/sparqlquery"));
|
||||||
urls.put("sparqlQueryBuilder", UrlBuilder.getUrl("/admin/sparqlquerybuilder"));
|
urls.put("sparqlQueryBuilder", UrlBuilder.getUrl("/admin/sparqlquerybuilder"));
|
||||||
map.put("urls", urls);
|
map.put("urls", urls);
|
||||||
|
|
|
@ -9,13 +9,11 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.openrdf.model.URI;
|
import org.openrdf.model.URI;
|
||||||
import org.openrdf.model.impl.URIImpl;
|
import org.openrdf.model.impl.URIImpl;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
@ -28,8 +26,6 @@ public class UrlBuilder {
|
||||||
|
|
||||||
protected static String contextPath = null;
|
protected static String contextPath = null;
|
||||||
|
|
||||||
private ApplicationBean application;
|
|
||||||
|
|
||||||
public enum Route {
|
public enum Route {
|
||||||
ABOUT("/about"),
|
ABOUT("/about"),
|
||||||
AUTHENTICATE("/authenticate"),
|
AUTHENTICATE("/authenticate"),
|
||||||
|
@ -113,53 +109,23 @@ public class UrlBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UrlBuilder(ApplicationBean application) {
|
private UrlBuilder() { }
|
||||||
this.application = application;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHomeUrl() {
|
public static String getHomeUrl() {
|
||||||
//String rootBreadCrumbUrl = application.getRootBreadCrumbURL();
|
|
||||||
//String path = StringUtils.isEmpty(rootBreadCrumbUrl) ? "" : rootBreadCrumbUrl;
|
|
||||||
//return getUrl(path);
|
|
||||||
return getUrl("");
|
return getUrl("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by templates to build urls.
|
// Used by templates to build urls.
|
||||||
public String getBaseUrl() {
|
public static String getBaseUrl() {
|
||||||
return contextPath;
|
return contextPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginUrl() {
|
public static String getLoginUrl() {
|
||||||
return getPortalUrl(Route.AUTHENTICATE, "return", "true");
|
return getUrl(Route.AUTHENTICATE, "return", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLogoutUrl() {
|
public static String getLogoutUrl() {
|
||||||
return getPortalUrl(Route.LOGOUT);
|
return getUrl(Route.LOGOUT);
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(String path) {
|
|
||||||
return getUrl(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(String path, ParamMap params) {
|
|
||||||
return getUrl(path, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(String path, String...params) {
|
|
||||||
ParamMap urlParams = new ParamMap(params);
|
|
||||||
return getPortalUrl(path, urlParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(Route route) {
|
|
||||||
return getPortalUrl(route.path());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(Route route, ParamMap params) {
|
|
||||||
return getPortalUrl(route.path(), params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortalUrl(Route route, String...params) {
|
|
||||||
return getPortalUrl(route.path(), params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ParamMap extends HashMap<String, String> {
|
public static class ParamMap extends HashMap<String, String> {
|
||||||
|
@ -202,8 +168,6 @@ public class UrlBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** Static utility methods **********/
|
|
||||||
|
|
||||||
public static String getUrl(String path) {
|
public static String getUrl(String path) {
|
||||||
|
|
||||||
if ( !path.isEmpty() && !path.startsWith("/") ) {
|
if ( !path.isEmpty() && !path.startsWith("/") ) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -10,10 +9,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -28,12 +24,11 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
|
|
||||||
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.Route;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.AdditionsAndRetractions;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.AdditionsAndRetractions;
|
||||||
|
@ -197,7 +192,7 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
|
||||||
}
|
}
|
||||||
|
|
||||||
if( resourceToRedirectTo != null ){
|
if( resourceToRedirectTo != null ){
|
||||||
UrlBuilder.ParamMap paramMap= new UrlBuilder.ParamMap();
|
ParamMap paramMap = new ParamMap();
|
||||||
paramMap.put("uri", resourceToRedirectTo);
|
paramMap.put("uri", resourceToRedirectTo);
|
||||||
paramMap.put("extra","true"); //for ie6
|
paramMap.put("extra","true"); //for ie6
|
||||||
return new RedirectResponseValues( UrlBuilder.getUrl(urlPattern,paramMap) + predicateAnchor );
|
return new RedirectResponseValues( UrlBuilder.getUrl(urlPattern,paramMap) + predicateAnchor );
|
||||||
|
|
|
@ -32,7 +32,6 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
|
||||||
private static final Log log = LogFactory.getLog(BaseIndividualTemplateModel.class);
|
private static final Log log = LogFactory.getLog(BaseIndividualTemplateModel.class);
|
||||||
|
|
||||||
protected Individual individual;
|
protected Individual individual;
|
||||||
protected UrlBuilder urlBuilder;
|
|
||||||
protected GroupedPropertyList propertyList;
|
protected GroupedPropertyList propertyList;
|
||||||
protected LoginStatusBean loginStatusBean;
|
protected LoginStatusBean loginStatusBean;
|
||||||
private EditingPolicyHelper policyHelper;
|
private EditingPolicyHelper policyHelper;
|
||||||
|
@ -42,7 +41,6 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
|
||||||
this.individual = individual;
|
this.individual = individual;
|
||||||
this.loginStatusBean = LoginStatusBean.getBean(vreq);
|
this.loginStatusBean = LoginStatusBean.getBean(vreq);
|
||||||
// Needed for getting portal-sensitive urls. Remove if multi-portal support is removed.
|
// Needed for getting portal-sensitive urls. Remove if multi-portal support is removed.
|
||||||
this.urlBuilder = new UrlBuilder(vreq.getAppBean());
|
|
||||||
|
|
||||||
// If editing, create a helper object to check requested actions against policies
|
// If editing, create a helper object to check requested actions against policies
|
||||||
if (isEditable()) {
|
if (isEditable()) {
|
||||||
|
@ -100,7 +98,7 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEditUrl() {
|
public String getEditUrl() {
|
||||||
return urlBuilder.getPortalUrl(Route.INDIVIDUAL_EDIT, "uri", getUri());
|
return UrlBuilder.getUrl(Route.INDIVIDUAL_EDIT, "uri", getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupedPropertyList getPropertyList() {
|
public GroupedPropertyList getPropertyList() {
|
||||||
|
|
|
@ -77,8 +77,7 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
verboseDisplay.put("localName", property.getLocalNameWithPrefix());
|
verboseDisplay.put("localName", property.getLocalNameWithPrefix());
|
||||||
verboseDisplay.put("displayRank", getPropertyDisplayTier(property));
|
verboseDisplay.put("displayRank", getPropertyDisplayTier(property));
|
||||||
|
|
||||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getAppBean());
|
String editUrl = UrlBuilder.getUrl(getPropertyEditRoute(), "uri", property.getURI());
|
||||||
String editUrl = urlBuilder.getPortalUrl(getPropertyEditRoute(), "uri", property.getURI());
|
|
||||||
verboseDisplay.put("propertyEditUrl", editUrl);
|
verboseDisplay.put("propertyEditUrl", editUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue