Reimplementing main site admin page in Freemarker: ontology editor panel
This commit is contained in:
parent
510321a192
commit
a79d4067a6
14 changed files with 232 additions and 120 deletions
|
@ -17,16 +17,18 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
|||
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.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
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.login.LoginTemplateHelper;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
||||
import freemarker.template.Configuration;
|
||||
|
||||
public class FreemarkerSiteAdminController extends FreemarkerHttpServlet {
|
||||
|
||||
private static final Log log = LogFactory.getLog(FreemarkerSiteAdminController.class);
|
||||
|
||||
public static final String VERBOSE = "verbosePropertyListing";
|
||||
|
||||
|
||||
public String getTitle(String siteName) {
|
||||
return siteName + " Site Administration";
|
||||
|
@ -44,82 +46,31 @@ public class FreemarkerSiteAdminController extends FreemarkerHttpServlet {
|
|||
// NOT LOGGED IN: just show login form
|
||||
if (loginHandler == null || !"authenticated".equals(loginStatus)) {
|
||||
body.put("loginPanel", new LoginTemplateHelper(vreq).showLoginPage(vreq, body, config));
|
||||
return mergeBodyToTemplate("siteAdmin-main.ftl", body, config);
|
||||
}
|
||||
|
||||
|
||||
// LOGGED IN: show editing options based on user role
|
||||
int securityLevel = Integer.parseInt( loginHandler.getLoginRole() );
|
||||
} else {
|
||||
|
||||
WebappDaoFactory wadf = vreq.getFullWebappDaoFactory();
|
||||
|
||||
// DATA INPUT
|
||||
if (securityLevel >= LoginFormBean.EDITOR) {
|
||||
Map<String, Object> dataInputData = new HashMap<String, Object>();
|
||||
dataInputData.put("formAction", UrlBuilder.getUrl("/edit/editRequestDispatch.jsp"));
|
||||
int securityLevel = Integer.parseInt( loginHandler.getLoginRole() );
|
||||
|
||||
// Create map for data input entry form options list
|
||||
List classGroups = wadf.getVClassGroupDao().getPublicGroupsWithVClasses(true,true,false); // order by displayRank, include uninstantiated classes, don't get the counts of individuals
|
||||
Iterator classGroupIt = classGroups.iterator();
|
||||
LinkedHashMap<String, List> orderedClassGroups = new LinkedHashMap<String, List>(classGroups.size());
|
||||
while (classGroupIt.hasNext()) {
|
||||
VClassGroup group = (VClassGroup)classGroupIt.next();
|
||||
List classes = group.getVitroClassList();
|
||||
orderedClassGroups.put(group.getPublicName(),FormUtils.makeOptionListFromBeans(classes,"URI","PickListName",null,null,false));
|
||||
}
|
||||
dataInputData.put("classGroupOptions", orderedClassGroups);
|
||||
|
||||
body.put("dataInput", dataInputData);
|
||||
}
|
||||
if (securityLevel >= LoginFormBean.EDITOR) {
|
||||
|
||||
// SITE CONFIGURATION
|
||||
if (securityLevel >= loginHandler.CURATOR) {
|
||||
Map<String, Object> siteConfigData = new HashMap<String, Object>();
|
||||
|
||||
boolean singlePortal = new Boolean(vreq.getFullWebappDaoFactory().getPortalDao().isSinglePortal());
|
||||
body.put("singlePortal", singlePortal);
|
||||
|
||||
Params params = new Params();
|
||||
int portalId = vreq.getPortal().getPortalId();
|
||||
params.put("home", portalId);
|
||||
|
||||
siteConfigData.put("tabManagementUrl", UrlBuilder.getUrl("/listTabs", params));
|
||||
|
||||
if (securityLevel >= loginHandler.DBA) {
|
||||
siteConfigData.put("userManagementUrl", UrlBuilder.getUrl("/listUsers", params));
|
||||
}
|
||||
|
||||
if (!singlePortal) {
|
||||
siteConfigData.put("listPortalsUrl", UrlBuilder.getUrl("/listPortals", params));
|
||||
}
|
||||
|
||||
params.put("controller", "Portal");
|
||||
params.put("id", portalId);
|
||||
siteConfigData.put("siteInfoUrl", UrlBuilder.getUrl("/editForm", params));
|
||||
|
||||
body.put("siteConfig", siteConfigData);
|
||||
}
|
||||
|
||||
// ONTOLOGY EDITOR
|
||||
|
||||
if (securityLevel >= LoginFormBean.CURATOR) {
|
||||
String verbose = vreq.getParameter("verbose");
|
||||
if( "true".equals(verbose)) {
|
||||
vreq.getSession().setAttribute(VERBOSE, Boolean.TRUE);
|
||||
} else if( "false".equals(verbose)) {
|
||||
vreq.getSession().setAttribute(VERBOSE, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// ADVANCED DATA TOOLS
|
||||
|
||||
// CUSTOM REPORTS
|
||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getPortal());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
body.put("dataInput", getDataInputData(vreq));
|
||||
|
||||
|
||||
if (securityLevel >= LoginFormBean.CURATOR) {
|
||||
body.put("siteConfig", getSiteConfigurationData(vreq, securityLevel, urlBuilder));
|
||||
body.put("ontologyEditor", getOntologyEditorData(vreq, urlBuilder));
|
||||
|
||||
if (securityLevel >= LoginFormBean.DBA) {
|
||||
body.put("dataTools", getDataToolsData(vreq));
|
||||
|
||||
// Only for DataStar. Should handle without needing a DataStar-specific version of this controller.
|
||||
//body.put("customReports", getCustomReportsData(vreq));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not used
|
||||
// int languageProfile = wadf.getLanguageProfile();
|
||||
|
@ -131,11 +82,108 @@ public class FreemarkerSiteAdminController extends FreemarkerHttpServlet {
|
|||
// }
|
||||
// body.put("languageModeStr", languageMode);
|
||||
|
||||
|
||||
|
||||
|
||||
return mergeBodyToTemplate("siteAdmin-main.ftl", body, config);
|
||||
|
||||
}
|
||||
|
||||
private Map<String, Object> getDataInputData(VitroRequest vreq) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("formAction", UrlBuilder.getUrl("/edit/editRequestDispatch.jsp"));
|
||||
|
||||
WebappDaoFactory wadf = vreq.getFullWebappDaoFactory();
|
||||
|
||||
// Create map for data input entry form options list
|
||||
List classGroups = wadf.getVClassGroupDao().getPublicGroupsWithVClasses(true,true,false); // order by displayRank, include uninstantiated classes, don't get the counts of individuals
|
||||
Iterator classGroupIt = classGroups.iterator();
|
||||
LinkedHashMap<String, List> orderedClassGroups = new LinkedHashMap<String, List>(classGroups.size());
|
||||
while (classGroupIt.hasNext()) {
|
||||
VClassGroup group = (VClassGroup)classGroupIt.next();
|
||||
List classes = group.getVitroClassList();
|
||||
orderedClassGroups.put(group.getPublicName(),FormUtils.makeOptionListFromBeans(classes,"URI","PickListName",null,null,false));
|
||||
}
|
||||
|
||||
map.put("groupedClassOptions", orderedClassGroups);
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> getSiteConfigurationData(VitroRequest vreq, int securityLevel, UrlBuilder urlBuilder) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, String> urls = new HashMap<String, String>();
|
||||
|
||||
urls.put("tabs", urlBuilder.getPortalUrl("/listTabs"));
|
||||
|
||||
if (securityLevel >= LoginFormBean.DBA) {
|
||||
urls.put("users", urlBuilder.getPortalUrl("/listUsers"));
|
||||
}
|
||||
|
||||
if (!vreq.getFullWebappDaoFactory().getPortalDao().isSinglePortal()) {
|
||||
urls.put("portals", urlBuilder.getPortalUrl("/listPortals"));
|
||||
}
|
||||
|
||||
urls.put("siteInfo", urlBuilder.getPortalUrl("/editForm", new ParamMap("controller", "Portal", "id", String.valueOf(urlBuilder.getPortalId()))));
|
||||
|
||||
map.put("urls", urls);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> getOntologyEditorData(VitroRequest vreq, UrlBuilder urlBuilder) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
String pelletError = null;
|
||||
String pelletExplanation = null;
|
||||
Object plObj = getServletContext().getAttribute("pelletListener");
|
||||
if ( (plObj != null) && (plObj instanceof PelletListener) ) {
|
||||
PelletListener pelletListener = (PelletListener) plObj;
|
||||
if (!pelletListener.isConsistent()) {
|
||||
pelletError = "INCONSISTENT ONTOLOGY: reasoning halted.";
|
||||
pelletExplanation = pelletListener.getExplanation();
|
||||
} else if ( pelletListener.isInErrorState() ) {
|
||||
pelletError = "An error occurred during reasoning. Reasoning has been halted. See error log for details.";
|
||||
}
|
||||
}
|
||||
|
||||
if (pelletError != null) {
|
||||
Map<String, String> pellet = new HashMap<String, String>();
|
||||
pellet.put("error", pelletError);
|
||||
if (pelletExplanation != null) {
|
||||
pellet.put("explanation", pelletExplanation);
|
||||
}
|
||||
map.put("pellet", pellet);
|
||||
}
|
||||
|
||||
Map<String, String> urls = new HashMap<String, String>();
|
||||
|
||||
urls.put("ontologies", urlBuilder.getPortalUrl("/listOntologies"));
|
||||
urls.put("classHierarchy", urlBuilder.getPortalUrl("/showClassHierarchy"));
|
||||
urls.put("classGroups", urlBuilder.getPortalUrl("/listGroups"));
|
||||
urls.put("dataPropertyHierarchy", urlBuilder.getPortalUrl("/showDataPropertyHierarchy"));
|
||||
urls.put("propertyGroups", urlBuilder.getPortalUrl("/listPropertyGroups"));
|
||||
urls.put("objectPropertyHierarchy", urlBuilder.getPortalUrl("/showObjectPropertyHierarchy", new ParamMap("iffRoot", "true")));
|
||||
map.put("urls", urls);
|
||||
|
||||
// RY Make sure this works for true, false, and undefined values of the param
|
||||
String verbose = vreq.getParameter("verbose");
|
||||
boolean verbosePropertyValue = "true".equals(verbose) ? true : false;
|
||||
vreq.getSession().setAttribute("verbosePropertyListing", verbosePropertyValue);
|
||||
|
||||
Map<String, Object> verbosePropertyForm = new HashMap<String, Object>();
|
||||
verbosePropertyForm.put("verboseFieldValue", String.valueOf(!verbosePropertyValue)); // the form toggles the current value
|
||||
verbosePropertyForm.put("action", urlBuilder.getPortalUrl(Route.SITE_ADMIN));
|
||||
verbosePropertyForm.put("currentValue", verbosePropertyValue ? "on" : "off");
|
||||
verbosePropertyForm.put("newValue", verbosePropertyValue ? "off" : "on");
|
||||
map.put("verbosePropertyForm", verbosePropertyForm);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> getDataToolsData(VitroRequest vreq) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -537,7 +537,7 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
|||
* URI.
|
||||
*/
|
||||
private String formAction(String entityUri, String action) {
|
||||
UrlBuilder.Params params = new UrlBuilder.Params(PARAMETER_ENTITY_URI,
|
||||
UrlBuilder.ParamMap params = new UrlBuilder.ParamMap(PARAMETER_ENTITY_URI,
|
||||
entityUri, PARAMETER_ACTION, action);
|
||||
return UrlBuilder.getPath(URL_HERE, params);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class UrlBuilder {
|
|||
return getUrl(path);
|
||||
}
|
||||
|
||||
public String url(Params params) {
|
||||
public String url(ParamMap params) {
|
||||
return getUrl(path, params);
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,10 @@ public class UrlBuilder {
|
|||
this.portal = portal;
|
||||
}
|
||||
|
||||
public int getPortalId() {
|
||||
return portal.getPortalId();
|
||||
}
|
||||
|
||||
public String getHomeUrl() {
|
||||
String rootBreadCrumbUrl = portal.getRootBreadCrumbURL();
|
||||
String path = StringUtils.isEmpty(rootBreadCrumbUrl) ? "" : rootBreadCrumbUrl;
|
||||
|
@ -112,18 +116,18 @@ public class UrlBuilder {
|
|||
}
|
||||
|
||||
public String getLogoutUrl() {
|
||||
return getPortalUrl(Route.LOGOUT.path(), new Params("loginSubmitMode", "Log Out"));
|
||||
return getPortalUrl(Route.LOGOUT, new ParamMap("loginSubmitMode", "Log Out"));
|
||||
}
|
||||
|
||||
public Params getPortalParam() {
|
||||
return new Params("home", "" + portal.getPortalId());
|
||||
public ParamMap getPortalParam() {
|
||||
return new ParamMap("home", "" + portal.getPortalId());
|
||||
}
|
||||
|
||||
public String getPortalUrl(String path) {
|
||||
return addPortalParam ? getUrl(path, getPortalParam()) : getUrl(path);
|
||||
}
|
||||
|
||||
public String getPortalUrl(String path, Params params) {
|
||||
public String getPortalUrl(String path, ParamMap params) {
|
||||
if (addPortalParam) {
|
||||
params.putAll(getPortalParam());
|
||||
}
|
||||
|
@ -134,16 +138,16 @@ public class UrlBuilder {
|
|||
return getPortalUrl(route.path());
|
||||
}
|
||||
|
||||
public String getPortalUrl(Route route, Params params) {
|
||||
public String getPortalUrl(Route route, ParamMap params) {
|
||||
return getPortalUrl(route.path(), params);
|
||||
}
|
||||
|
||||
public static class Params extends HashMap<String, String> {
|
||||
public static class ParamMap extends HashMap<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Params() { }
|
||||
public ParamMap() { }
|
||||
|
||||
public Params(String...strings) {
|
||||
public ParamMap(String...strings) {
|
||||
int stringCount = strings.length;
|
||||
for (int i = 0; i < stringCount; i=i+2) {
|
||||
// Skip the last item if there's an odd number
|
||||
|
@ -154,13 +158,18 @@ public class UrlBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public Params(Map<String, String> map) {
|
||||
public ParamMap(Map<String, String> map) {
|
||||
putAll(map);
|
||||
}
|
||||
|
||||
public void put(String key, int value) {
|
||||
put(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void put(String key, boolean value) {
|
||||
put(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/********** Static utility methods **********/
|
||||
|
@ -174,17 +183,29 @@ public class UrlBuilder {
|
|||
return path.isEmpty() ? "/" : path;
|
||||
}
|
||||
|
||||
public static String getUrl(Route route) {
|
||||
return getUrl(route.path());
|
||||
}
|
||||
|
||||
public static String getUrl(String path, String...params) {
|
||||
Params urlParams = new Params(params);
|
||||
ParamMap urlParams = new ParamMap(params);
|
||||
return getUrl(path, urlParams);
|
||||
}
|
||||
|
||||
public static String getUrl(String path, Params params) {
|
||||
public static String getUrl(Route route, String...params) {
|
||||
return getUrl(route.path(), params);
|
||||
}
|
||||
|
||||
public static String getUrl(String path, ParamMap params) {
|
||||
path = getPath(path, params);
|
||||
return getUrl(path);
|
||||
}
|
||||
|
||||
public static String getUrl(Route route, ParamMap params) {
|
||||
return getUrl(route.path(), params);
|
||||
}
|
||||
|
||||
public static String getPath(String path, Params params) {
|
||||
public static String getPath(String path, ParamMap params) {
|
||||
String glue = "?";
|
||||
for (String key : params.keySet()) {
|
||||
path += glue + key + "=" + urlEncode(params.get(key));
|
||||
|
@ -192,6 +213,10 @@ public class UrlBuilder {
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public static String getPath(Route route, ParamMap params) {
|
||||
return getPath(route.path(), params);
|
||||
}
|
||||
|
||||
public static String urlEncode(String url) {
|
||||
String encoding = "ISO-8859-1";
|
||||
|
|
|
@ -50,7 +50,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
|||
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.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
||||
|
@ -214,7 +214,7 @@ public class FreemarkerPagedSearchController extends FreemarkerHttpServlet imple
|
|||
}
|
||||
}
|
||||
|
||||
Params pagingLinkParams = new Params();
|
||||
ParamMap pagingLinkParams = new ParamMap();
|
||||
pagingLinkParams.put("querytext", qtxt);
|
||||
pagingLinkParams.put("hitsPerPage", String.valueOf(hitsPerPage));
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class FreemarkerPagedSearchController extends FreemarkerHttpServlet imple
|
|||
}
|
||||
}
|
||||
|
||||
private List<PagingLink> getPagingLinks(int startIndex, int hitsPerPage, int hitsLength, int maxHitSize, String baseUrl, Params params) {
|
||||
private List<PagingLink> getPagingLinks(int startIndex, int hitsPerPage, int hitsLength, int maxHitSize, String baseUrl, ParamMap params) {
|
||||
|
||||
List<PagingLink> pagingLinks = new ArrayList<PagingLink>();
|
||||
|
||||
|
@ -412,13 +412,13 @@ public class FreemarkerPagedSearchController extends FreemarkerHttpServlet imple
|
|||
return pagingLinks;
|
||||
}
|
||||
|
||||
private String getPreviousPageLink(int startIndex, int hitsPerPage, String baseUrl, Params params) {
|
||||
private String getPreviousPageLink(int startIndex, int hitsPerPage, String baseUrl, ParamMap params) {
|
||||
params.put("startIndex", String.valueOf(startIndex-hitsPerPage));
|
||||
//return new PagingLink("Previous", baseUrl, params);
|
||||
return UrlBuilder.getUrl(baseUrl, params);
|
||||
}
|
||||
|
||||
private String getNextPageLink(int startIndex, int hitsPerPage, String baseUrl, Params params) {
|
||||
private String getNextPageLink(int startIndex, int hitsPerPage, String baseUrl, ParamMap params) {
|
||||
params.put("startIndex", String.valueOf(startIndex+hitsPerPage));
|
||||
//return new PagingLink("Next", baseUrl, params);
|
||||
return UrlBuilder.getUrl(baseUrl, params);
|
||||
|
@ -426,7 +426,7 @@ public class FreemarkerPagedSearchController extends FreemarkerHttpServlet imple
|
|||
|
||||
private class PagingLink extends LinkTemplateModel {
|
||||
|
||||
PagingLink(int pageNumber, String baseUrl, Params params) {
|
||||
PagingLink(int pageNumber, String baseUrl, ParamMap params) {
|
||||
super(String.valueOf(pageNumber), baseUrl, params);
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ public class FreemarkerPagedSearchController extends FreemarkerHttpServlet imple
|
|||
}
|
||||
|
||||
// Constructor for "more..." item
|
||||
PagingLink(String text, String baseUrl, Params params) {
|
||||
PagingLink(String text, String baseUrl, ParamMap params) {
|
||||
super(text, baseUrl, params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
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.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
|
||||
public abstract class BaseTemplateModel {
|
||||
|
||||
|
@ -27,7 +27,7 @@ public abstract class BaseTemplateModel {
|
|||
}
|
||||
|
||||
// Convenience method so subclasses can call getUrl(path, params)
|
||||
protected String getUrl(String path, Params params) {
|
||||
protected String getUrl(String path, ParamMap params) {
|
||||
return UrlBuilder.getUrl(path, params);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.openrdf.model.impl.URIImpl;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Link;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
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.web.ViewFinder;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder.ClassView;
|
||||
|
@ -52,7 +52,7 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
|||
if (defaultNamespace.equals(namespace)) {
|
||||
profileUrl = getUrl(PATH + "/" + individual.getLocalName());
|
||||
} else {
|
||||
Params params = new Params("uri", individualUri);
|
||||
ParamMap params = new ParamMap("uri", individualUri);
|
||||
profileUrl = getUrl("/individual", params);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels;
|
|||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
|
||||
public class LinkTemplateModel extends BaseTemplateModel {
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class LinkTemplateModel extends BaseTemplateModel {
|
|||
setUrl(path, params);
|
||||
}
|
||||
|
||||
public LinkTemplateModel(String text, String path, Params params) {
|
||||
public LinkTemplateModel(String text, String path, ParamMap params) {
|
||||
setText(text);
|
||||
setUrl(path, params);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class LinkTemplateModel extends BaseTemplateModel {
|
|||
url = UrlBuilder.getUrl(path, params);
|
||||
}
|
||||
|
||||
protected void setUrl(String path, Params params) {
|
||||
protected void setUrl(String path, ParamMap params) {
|
||||
url = UrlBuilder.getUrl(path, params);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||
|
||||
public class VClassTemplateModel extends BaseTemplateModel {
|
||||
|
@ -25,7 +25,7 @@ public class VClassTemplateModel extends BaseTemplateModel {
|
|||
}
|
||||
|
||||
public String getUrl() {
|
||||
return getUrl(PATH, new Params("vclassId", vclass.getURI()));
|
||||
return getUrl(PATH, new ParamMap("vclassId", vclass.getURI()));
|
||||
}
|
||||
|
||||
public int getIndividualCount() {
|
||||
|
|
|
@ -12,7 +12,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
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.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.TabWebUtil;
|
||||
|
||||
/** A main menu constructed from persisted tab data
|
||||
|
@ -55,7 +55,7 @@ public class TabMenu extends MainMenu {
|
|||
private void addItem(Tab tab) {
|
||||
boolean isActive = isActiveItem(tab);
|
||||
String text = tab.getTitle();
|
||||
String path = UrlBuilder.getPath(PATH, new Params(TAB_PARAM, "" + tab.getTabId()));
|
||||
String path = UrlBuilder.getPath(PATH, new ParamMap(TAB_PARAM, "" + tab.getTabId()));
|
||||
addItem(text, path, isActive);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import junit.framework.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Params;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
|
||||
public class UrlBuilderTest extends AbstractTestClass {
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class UrlBuilderTest extends AbstractTestClass {
|
|||
public void testGetUrlWithParams() {
|
||||
UrlBuilder.contextPath = "/vivo";
|
||||
String path = "/individual";
|
||||
Params params = new Params();
|
||||
ParamMap params = new ParamMap();
|
||||
int portalId = 1;
|
||||
params.put("home", "" + portalId);
|
||||
params.put("name", "Tom");
|
||||
|
@ -45,7 +45,7 @@ public class UrlBuilderTest extends AbstractTestClass {
|
|||
public void testEncodeUrl() {
|
||||
UrlBuilder.contextPath = "/vivo";
|
||||
String path = "/individuallist";
|
||||
Params params = new Params();
|
||||
ParamMap params = new ParamMap();
|
||||
String vClassUri = "http://vivoweb.org/ontology/core#FacultyMember";
|
||||
params.put("vclassId", vClassUri);
|
||||
Assert.assertEquals("/vivo/individuallist?vclassId=http%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23FacultyMember", UrlBuilder.getUrl(path, params));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<form action="${dataInput.formAction}" method="get">
|
||||
<select id="VClassURI" name="typeOfNew" class="form-item">
|
||||
<@form.optionGroups groups=dataInput.classGroupOptions />
|
||||
<@form.optionGroups groups=dataInput.groupedClassOptions />
|
||||
</select>
|
||||
<input type="hidden" name="editform" value="newIndividualForm.jsp"/>
|
||||
<input type="submit" class="add-action-button" value="Add individual of this class"/>
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- Template for Site Administration Ontology Editor -->
|
||||
<#-- Template for Site Administration Ontology Editor -->
|
||||
|
||||
<#if ontologyEditor??>
|
||||
<div class="pageBodyGroup">
|
||||
|
||||
<h3>Ontology Editor</h3>
|
||||
|
||||
<#if ontologyEditor.pellet??>
|
||||
<p>${ontologyEditor.pellet.error}</p>
|
||||
<#if ontologyEditor.pellet.explanation??>
|
||||
<p>${ontologyEditor.pellet.explanation}</p>
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
<ul>
|
||||
<li><a href="${ontologyEditor.urls.ontologies}">Ontology list</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Class Management</h4>
|
||||
<ul>
|
||||
<li><a href="${ontologyEditor.urls.classHierarchy}">Class hierarchy</a></li>
|
||||
<li><a href="${ontologyEditor.urls.classGroups}">Class groups</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Property Management</h4>
|
||||
<ul>
|
||||
<li><a href="${ontologyEditor.urls.objectPropertyHierarchy}">Object property hierarchy</a></li>
|
||||
<li><a href="${ontologyEditor.urls.dataPropertyHierarchy}">Data property hierarchy</a></li>
|
||||
<li><a href="${ontologyEditor.urls.propertyGroups}">Property groups</a></li>
|
||||
</ul>
|
||||
|
||||
<#assign formId = "verbosePropertyForm">
|
||||
<form id="${formId}" action="${ontologyEditor.verbosePropertyForm.action}#${formId}" method="get">
|
||||
<input type="hidden" name="verbose" value="${ontologyEditor.verbosePropertyForm.verboseFieldValue}" />
|
||||
<span>Verbose property display for this session is <b>${ontologyEditor.verbosePropertyForm.currentValue}</b>.</span>
|
||||
<input type="submit" value="Turn ${ontologyEditor.verbosePropertyForm.newValue}" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</#if>
|
|
@ -8,17 +8,17 @@
|
|||
<h3>Site Configuration</h3>
|
||||
|
||||
<ul>
|
||||
<#if siteConfig.listPortalsUrl??>
|
||||
<li><a href="${siteConfig.siteInfoUrl}">Current portal information</a></li>
|
||||
<li><a href="${siteConfig.listPortalsUrl}">List all portals</a></li>
|
||||
<#if siteConfig.urls.portals??>
|
||||
<li><a href="${siteConfig.urls.siteInfo}">Current portal information</a></li>
|
||||
<li><a href="${siteConfig.urls.portals}">List all portals</a></li>
|
||||
<#else>
|
||||
<li><a href="${siteConfig.siteInfoUrl}">Site information</a></li>
|
||||
<li><a href="${siteConfig.urls.siteInfo}">Site information</a></li>
|
||||
</#if>
|
||||
|
||||
<li><a href="${siteConfig.tabManagementUrl}">Tab management</a></li>
|
||||
<li><a href="${siteConfig.urls.tabs}">Tab management</a></li>
|
||||
|
||||
<#if siteConfig.userManagementUrl??>
|
||||
<li><a href="${siteConfig.userManagementUrl}">User accounts</a></li>
|
||||
<#if siteConfig.urls.users??>
|
||||
<li><a href="${siteConfig.urls.users}">User accounts</a></li>
|
||||
</#if>
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
Output a sequence of option groups with options.
|
||||
|
||||
Input is a map of option groups to a list of Option objects.
|
||||
Input is a map of option groups to lists of Option objects.
|
||||
|
||||
Usage: <@optionGroups groups=myOptionGroups />
|
||||
-->
|
||||
|
|
Loading…
Add table
Reference in a new issue