Removed Portal class and almost everything related to portals and flags for NIHVIVO-2248
This commit is contained in:
parent
de5c5ff7de
commit
eb00f1cd43
189 changed files with 928 additions and 6859 deletions
|
@ -235,15 +235,6 @@
|
|||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter>
|
||||
<filter-name>Portal Picker Filter</filter-name>
|
||||
<filter-class>edu.cornell.mannlib.vitro.webapp.filters.PortalPickerFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>Portal Picker Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter>
|
||||
<filter-name>VitroRequestPrep</filter-name>
|
||||
<filter-class>edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep</filter-class>
|
||||
|
@ -695,15 +686,6 @@
|
|||
<url-pattern>/propertyEdit</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>PortalEditController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.PortalEditController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>PortalEditController</servlet-name>
|
||||
<url-pattern>/portalEdit</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>EntityRetryController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.EntityRetryController</servlet-class>
|
||||
|
@ -794,15 +776,6 @@
|
|||
<url-pattern>/addRestriction</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>PortalsListingController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.listing.PortalsListingController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>PortalsListingController</servlet-name>
|
||||
<url-pattern>/listPortals</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>UsersListingController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.listing.UsersListingController</servlet-class>
|
||||
|
|
|
@ -1,194 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vedit.beans;
|
||||
|
||||
/**
|
||||
* User Session information
|
||||
* @author John Fereira
|
||||
* @since 29.06.2004
|
||||
*/
|
||||
public class UserSession {
|
||||
private int currentEntityId;
|
||||
private int currentPortalId;
|
||||
private int currentTabId;
|
||||
private String lastSearchURL;
|
||||
private boolean isPatronAuthenticated;
|
||||
private boolean isAdminAuthenticated;
|
||||
private String referer;
|
||||
private String lastSearchTerm;
|
||||
|
||||
private String flag1Pref;
|
||||
public void setFlag1Pref(String s) { flag1Pref=s; }
|
||||
public String getFlag1Pref() { return flag1Pref; }
|
||||
|
||||
private String flag2Pref;
|
||||
public void setFlag2Pref(String s) { flag2Pref=s; }
|
||||
public String getFlag2Pref() { return flag2Pref; }
|
||||
|
||||
private String flag3Pref;
|
||||
public void setFlag3Pref(String s) { flag3Pref=s; }
|
||||
public String getFlag3Pref() { return flag3Pref; }
|
||||
|
||||
//search wrapper was part of the mysql full text search, no longer in use.
|
||||
// private SearchWrapper searchWrapper;
|
||||
// public void setSearchWrapper(SearchWrapper sw) { searchWrapper=sw; }
|
||||
// public SearchWrapper getSearchWrapper() { return searchWrapper; }
|
||||
// public void disposeOf(SearchWrapper sw) {
|
||||
// if (sw!=null){
|
||||
// sw.dispose();
|
||||
// }
|
||||
// this.searchWrapper=null;
|
||||
// }
|
||||
|
||||
/** constructor */
|
||||
public UserSession() {
|
||||
this.isPatronAuthenticated = false;
|
||||
this.isAdminAuthenticated = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* set current entity id
|
||||
* @param currentEntityId : unique id
|
||||
*/
|
||||
public void setCurrentEntityId(int currentEntityId) {
|
||||
this.currentEntityId = currentEntityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Current entity Id
|
||||
* @return : the entity Id
|
||||
*/
|
||||
public int getCurrentEntityId() {
|
||||
return currentEntityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* set current portal id
|
||||
* @param currentPortalId : unique id
|
||||
*/
|
||||
public void setCurrentPortalId(int currentPortalId) {
|
||||
this.currentPortalId = currentPortalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Current portal Id
|
||||
* @return : the portal Id
|
||||
*/
|
||||
public int getCurrentPortalId() {
|
||||
return currentPortalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* set current tab id
|
||||
* @param currentTabId : unique id
|
||||
*/
|
||||
public void setCurrentTabId(int currentTabId) {
|
||||
this.currentTabId = currentTabId;
|
||||
}
|
||||
|
||||
/**
|
||||
* get current tab id
|
||||
* @return : the tab Id
|
||||
*/
|
||||
public int getCurrentTabId() {
|
||||
return currentTabId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set last SearchURL in session
|
||||
* @param lastSearchURL : a url string
|
||||
*/
|
||||
public void setLastSearchURL(String lastSearchURL) {
|
||||
this.lastSearchURL = lastSearchURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* get last Search URL
|
||||
* @return : last search url string
|
||||
*/
|
||||
public String getLastSearchURL() {
|
||||
return lastSearchURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set boolen flag to indicated if patron has authenticated
|
||||
* @param isPatronAuthenticated : true or false
|
||||
*/
|
||||
public void setIsPatronAuthenticated(boolean isPatronAuthenticated) {
|
||||
this.isPatronAuthenticated = isPatronAuthenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean flag indicating whethor or not patron has authenticated
|
||||
* @return : true or false
|
||||
*/
|
||||
public boolean getIsPatronAuthenticated() {
|
||||
return isPatronAuthenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* set boolean flag indicating whether or not an Administrator has
|
||||
* authenticated
|
||||
* @param isAdminAuthenticated : true or false
|
||||
*/
|
||||
public void setIsAdminAuthenticated(boolean isAdminAuthenticated) {
|
||||
this.isAdminAuthenticated = isAdminAuthenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean flag indicating whether or not an Administrator has
|
||||
* authenticated
|
||||
* @return : true or false
|
||||
*/
|
||||
public boolean getIsAdminAuthenticated() {
|
||||
return isAdminAuthenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* set referer url in session
|
||||
* @param referer : a referer url string
|
||||
*/
|
||||
public void setReferer(String referer) {
|
||||
this.referer = referer;
|
||||
}
|
||||
|
||||
/**
|
||||
* get referer url in session
|
||||
* @return : a referer url string
|
||||
*/
|
||||
public String getReferer() {
|
||||
return referer;
|
||||
}
|
||||
|
||||
/**
|
||||
* set lastSearchTerm in session
|
||||
* @param lastSearchTerm : a lastSearchTerm string
|
||||
*/
|
||||
public void setLastSearchTerm(String lastSearchTerm) {
|
||||
this.lastSearchTerm = lastSearchTerm;
|
||||
}
|
||||
|
||||
/**
|
||||
* get lastSearchTerm in session
|
||||
* @return : a lastSearchTerm string
|
||||
*/
|
||||
public String getLastSearchTerm() {
|
||||
return lastSearchTerm;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param isAdminAuthenticated The isAdminAuthenticated to set.
|
||||
*/
|
||||
public void setAdminAuthenticated(boolean isAdminAuthenticated) {
|
||||
this.isAdminAuthenticated = isAdminAuthenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isPatronAuthenticated The isPatronAuthenticated to set.
|
||||
*/
|
||||
public void setPatronAuthenticated(boolean isPatronAuthenticated) {
|
||||
this.isPatronAuthenticated = isPatronAuthenticated;
|
||||
}
|
||||
}
|
|
@ -22,9 +22,9 @@ import com.hp.hpl.jena.ontology.OntModel;
|
|||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||
|
||||
public class BaseEditController extends VitroHttpServlet {
|
||||
|
@ -108,12 +108,11 @@ public class BaseEditController extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
protected void setRequestAttributes(HttpServletRequest request, EditProcessObject epo){
|
||||
Portal portal = (Portal)request.getAttribute("portalBean");
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("epo",epo);
|
||||
request.setAttribute("globalErrorMsg",epo.getAttribute("globalErrorMsg"));
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
}
|
||||
|
||||
protected void populateBeanFromParams(Object bean, HttpServletRequest request) {
|
||||
|
|
|
@ -16,18 +16,12 @@ package edu.cornell.mannlib.vitro.webapp.beans;
|
|||
*
|
||||
*/
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.StringTokenizer;
|
||||
import java.io.File;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* This object is intended to represent the single row of data in the table application.
|
||||
|
@ -36,64 +30,39 @@ import org.springframework.jdbc.core.RowMapper;
|
|||
*
|
||||
*/
|
||||
public class ApplicationBean {
|
||||
public final static int FILTER_SECURITY_LEVEL = 4;
|
||||
public final static int CALS_SEARCHBOX_SIZE = 25;
|
||||
public final static int VIVO_SEARCHBOX_SIZE = 20;
|
||||
|
||||
private static ApplicationBean singleAppBean = null;
|
||||
private static final Log log = LogFactory.getLog(ApplicationBean.class);
|
||||
|
||||
public final static int CALS_SEARCHBOX_SIZE = 25;
|
||||
public final static int VIVO_SEARCHBOX_SIZE = 20;
|
||||
|
||||
private final static String DEFAULT_APPLICATION_NAME = "Vitro";
|
||||
private final static String DEFAULT_FLAG1_NAME = "portal";
|
||||
private final static int DEFAULT_MAX_PORTAL_ID = 15;
|
||||
private final static int ALL_PORTAL_FOR_MAX_OF_15 = 65535;
|
||||
private final static int DEFAULT_MIN_SHARED_PORTAL = 2;
|
||||
private final static int DEFAULT_MAX_SHARED_PORTAL = 5;
|
||||
private final static String DEFAULT_ROOT_LOGOTYPE_IMAGE = "";
|
||||
private final static String DEFAULT_ROOT_LOGOTYPE_IMAGE = "";
|
||||
private final static int DEFAULT_ROOT_LOGOTYPE_WIDTH = 0;
|
||||
private final static int DEFAULT_ROOT_LOGOTYPE_HEIGHT = 0;
|
||||
private final static String DEFAULT_ROOT_LOGOTYPE_TITLE = "";
|
||||
private final static String DEFAULT_SEARCH_DOMAIN = "";
|
||||
// private final static String DEFAULT_ROOT_LOGOTYPE_IMAGE = "CornellSeal.69x65.transparent.clipped.gif";
|
||||
// private final static int DEFAULT_ROOT_LOGOTYPE_WIDTH = 65;
|
||||
// private final static int DEFAULT_ROOT_LOGOTYPE_HEIGHT = 65;
|
||||
//private final static int DEFAULT_HEADER_IMAGE_WIDTH = 69;
|
||||
//private final static int DEFAULT_HEADER_IMAGE_HEIGHT = 65;
|
||||
//private final static String DEFAULT_ROOT_LOGOTYPE_TITLE = "Cornell University";
|
||||
//private final static String DEFAULT_SEARCH_DOMAIN = "http://www.cornell.edu";
|
||||
private final static boolean DEFAULT_ONLY_CURRENT = true;
|
||||
private final static boolean DEFAULT_ONLY_PUBLIC = true;
|
||||
|
||||
// Value gets set in default theme setup context listener at application startup
|
||||
public static String DEFAULT_THEME_DIR_FROM_CONTEXT = null;
|
||||
|
||||
// Default initializations, which may be overwritten in the AppBeanMapper
|
||||
// but are otherwise not changed there
|
||||
private boolean initialized = false;
|
||||
private String sessionIdStr = null;
|
||||
private String applicationName = DEFAULT_APPLICATION_NAME;
|
||||
private String flag1Name = DEFAULT_FLAG1_NAME;
|
||||
private String flag2Name = null;
|
||||
private String flag3Name = null;
|
||||
private ArrayList flag1List = null;
|
||||
private ArrayList flag2List = null;
|
||||
private ArrayList flag3List = null;
|
||||
private int maxPortalId = DEFAULT_MAX_PORTAL_ID;
|
||||
private int allPortalFlagNumeric = ALL_PORTAL_FOR_MAX_OF_15; // this is calculated dynamically and becomes the way to search the entire database (all portals)
|
||||
private int minSharedPortalId = DEFAULT_MIN_SHARED_PORTAL;
|
||||
private int maxSharedPortalId = DEFAULT_MAX_SHARED_PORTAL;
|
||||
private int sharedPortalFlagNumeric = 60; // was 0; this is calculated dynamically and becomes the id of the ALL CALS RESEARCH portal
|
||||
private String keywordHeading = null;
|
||||
|
||||
private String rootLogotypeImage = DEFAULT_ROOT_LOGOTYPE_IMAGE;
|
||||
private int rootLogotypeWidth = DEFAULT_ROOT_LOGOTYPE_WIDTH;
|
||||
private int rootLogotypeHeight = DEFAULT_ROOT_LOGOTYPE_HEIGHT;
|
||||
private String rootLogotypeTitle = DEFAULT_ROOT_LOGOTYPE_TITLE;
|
||||
private boolean onlyCurrent = DEFAULT_ONLY_CURRENT;
|
||||
private boolean onlyPublic = DEFAULT_ONLY_PUBLIC;
|
||||
|
||||
/** for internal use only */
|
||||
private int minUsedToCalcualteShared = -1;
|
||||
/** for internal use only */
|
||||
private int maxUsedToCalculateShared = -1;
|
||||
/** for internal use only */
|
||||
private int maxPortalUsedToCalculateAllPortal = DEFAULT_MAX_PORTAL_ID;
|
||||
private String aboutText;
|
||||
private String acknowledgeText;
|
||||
private String contactMail;
|
||||
private String correctionMail;
|
||||
private String copyrightURL;
|
||||
private String copyrightAnchor;
|
||||
private String themeDir;
|
||||
|
||||
public static ApplicationBean getAppBean(ServletContext sc){
|
||||
if( sc != null ){
|
||||
|
@ -104,63 +73,20 @@ public class ApplicationBean {
|
|||
return new ApplicationBean();
|
||||
}
|
||||
|
||||
public static int calculateAllPortalFlagNumeric(int max_portal_id) {
|
||||
int returnVal=0;
|
||||
if (max_portal_id>0) {
|
||||
for (int i=0; i<max_portal_id; i++) {
|
||||
returnVal+=(int)Math.pow(2.0,i);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public static int calculateSharedPortalFlagNumeric(int min_shared_portal_id,int max_shared_portal_id) {
|
||||
int returnVal=0;
|
||||
if (max_shared_portal_id>min_shared_portal_id) {
|
||||
for (int i=min_shared_portal_id; i<=max_shared_portal_id; i++) {
|
||||
returnVal+=(int)Math.pow(2.0,i);
|
||||
}
|
||||
} else if (min_shared_portal_id==max_shared_portal_id) {
|
||||
returnVal=(int)Math.pow(2.0,min_shared_portal_id);
|
||||
} else {
|
||||
returnVal=(int)Math.pow(2.0,(min_shared_portal_id+1)); //max in this case
|
||||
for (int i=min_shared_portal_id; i>=max_shared_portal_id; i--) {
|
||||
returnVal-=(int)Math.pow(2.0,i);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
String output = "Application Bean Contents:\n";
|
||||
output += " initialized from DB: [" + initialized + "]\n";
|
||||
output += " session id: [" + sessionIdStr + "]\n";
|
||||
output += " application name: [" + applicationName + "]\n";
|
||||
output += " flag1 name: [" + flag1Name + "]\n";
|
||||
output += " flag2 name: [" + flag2Name + "]\n";
|
||||
output += " flag3 name: [" + flag3Name + "]\n";
|
||||
output += " max portal id: [" + maxPortalId + "]\n";
|
||||
output += " allPortalFlagNumeric [" + allPortalFlagNumeric + "]\n";
|
||||
output += " min shared portal: [" + minSharedPortalId + "]\n";
|
||||
output += " max shared portal: [" + maxSharedPortalId + "]\n";
|
||||
output += " sharedPortalFlagNumeric [" + sharedPortalFlagNumeric + "]\n";
|
||||
output += " keyword table: [" + keywordHeading + "]\n";
|
||||
output += " root logotype image: [" + rootLogotypeImage + "]\n";
|
||||
output += " root logotype width: [" + rootLogotypeWidth + "]\n";
|
||||
output += " root logotype height: [" + rootLogotypeHeight + "]\n";
|
||||
output += " root logotype title: [" + rootLogotypeTitle + "]\n";
|
||||
output += " only current entities: [" + onlyCurrent + "]\n";
|
||||
output += " only public entities: [" + onlyPublic + "]\n";
|
||||
return output;
|
||||
}
|
||||
|
||||
/*************************** SET functions ****************************/
|
||||
|
||||
public void setInitialized( boolean boolean_val) {
|
||||
initialized=boolean_val;
|
||||
}
|
||||
|
||||
public void setSessionIdStr( String string_val ) {
|
||||
sessionIdStr = string_val;
|
||||
}
|
||||
|
@ -169,42 +95,6 @@ public class ApplicationBean {
|
|||
applicationName = string_val;
|
||||
}
|
||||
|
||||
public void setFlag1Name( String string_val ) {
|
||||
flag1Name = string_val;
|
||||
}
|
||||
|
||||
public void setFlag2Name( String string_val ) {
|
||||
flag2Name = string_val;
|
||||
}
|
||||
|
||||
public void setFlag3Name( String string_val ) {
|
||||
flag3Name = string_val;
|
||||
}
|
||||
|
||||
public void setMaxPortalId( int int_val ) {
|
||||
maxPortalId = int_val;
|
||||
}
|
||||
|
||||
// public void setAllPortalFlagNumeric( int int_val ) {
|
||||
// allPortalFlagNumeric=int_val;
|
||||
// }
|
||||
|
||||
public void setMinSharedPortalId( int int_val ) {
|
||||
minSharedPortalId = int_val;
|
||||
}
|
||||
|
||||
public void setMaxSharedPortalId( int int_val ) {
|
||||
maxSharedPortalId = int_val;
|
||||
}
|
||||
|
||||
// public void setSharedPortalFlagNumeric( int int_val ) {
|
||||
// sharedPortalFlagNumeric=int_val;
|
||||
// }
|
||||
|
||||
public void setKeywordHeading(String string_val) {
|
||||
keywordHeading=string_val;
|
||||
}
|
||||
|
||||
public void setRootLogotypeImage(String string_val) {
|
||||
rootLogotypeImage=string_val;
|
||||
}
|
||||
|
@ -221,35 +111,44 @@ public class ApplicationBean {
|
|||
rootLogotypeTitle=string_val;
|
||||
}
|
||||
|
||||
|
||||
public void setOnlyCurrent(boolean boolean_val) {
|
||||
onlyCurrent=boolean_val;
|
||||
public void setAboutText(String string_val) {
|
||||
aboutText = string_val;
|
||||
}
|
||||
|
||||
public void setOnlyPublic(boolean boolean_val) {
|
||||
onlyPublic=boolean_val;
|
||||
public void setAcknowledgeText(String string_val) {
|
||||
acknowledgeText = string_val;
|
||||
}
|
||||
|
||||
public void setFlag1List(ArrayList h) {
|
||||
flag1List=h;
|
||||
public void setContactMail(String string_val) {
|
||||
contactMail = string_val;
|
||||
}
|
||||
|
||||
public void setFlag2List(ArrayList h) {
|
||||
flag2List=h;
|
||||
public void setCorrectionMail(String string_val) {
|
||||
correctionMail = string_val;
|
||||
}
|
||||
|
||||
public void setFlag3List(ArrayList h) {
|
||||
flag3List=h;
|
||||
public void setCopyrightURL(String string_val) {
|
||||
copyrightURL = string_val;
|
||||
}
|
||||
|
||||
public void setCopyrightAnchor(String string_val) {
|
||||
copyrightAnchor = string_val;
|
||||
}
|
||||
|
||||
public void setThemeDir(String string_val) {
|
||||
if( string_val == null || string_val.length() == 0
|
||||
|| "default".equalsIgnoreCase(string_val)
|
||||
|| "portal".equalsIgnoreCase(string_val)
|
||||
|| "null".equalsIgnoreCase(string_val)
|
||||
|| " ".equalsIgnoreCase(string_val) )
|
||||
themeDir = DEFAULT_THEME_DIR_FROM_CONTEXT;
|
||||
else
|
||||
themeDir = string_val;
|
||||
}
|
||||
|
||||
|
||||
/*************************** GET functions ****************************/
|
||||
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public String getSessionIdStr() {
|
||||
return sessionIdStr;
|
||||
}
|
||||
|
@ -258,65 +157,6 @@ public class ApplicationBean {
|
|||
return applicationName;
|
||||
}
|
||||
|
||||
public String getFlag1Name() {
|
||||
return flag1Name;
|
||||
}
|
||||
|
||||
public boolean isFlag1Active() {
|
||||
return (maxPortalId>1);
|
||||
}
|
||||
|
||||
public String getFlag2Name() {
|
||||
return flag2Name;
|
||||
}
|
||||
|
||||
public boolean isFlag2Active() {
|
||||
return (flag2Name!=null && !flag2Name.equals(""));
|
||||
}
|
||||
|
||||
public String getFlag3Name() {
|
||||
return flag3Name;
|
||||
}
|
||||
|
||||
public boolean isFlag3Active() {
|
||||
return (flag3Name!=null && !flag3Name.equals(""));
|
||||
}
|
||||
|
||||
public int getMaxPortalId() {
|
||||
return maxPortalId;
|
||||
}
|
||||
|
||||
public int getAllPortalFlagNumeric() {
|
||||
if( this.maxPortalId != this.maxPortalUsedToCalculateAllPortal ){
|
||||
this.allPortalFlagNumeric = calculateAllPortalFlagNumeric( this.maxPortalId );
|
||||
this.maxPortalUsedToCalculateAllPortal = this.maxPortalId;
|
||||
}
|
||||
return this.allPortalFlagNumeric;
|
||||
}
|
||||
|
||||
public int getMinSharedPortalId() {
|
||||
return minSharedPortalId;
|
||||
}
|
||||
|
||||
public int getMaxSharedPortalId() {
|
||||
return maxSharedPortalId;
|
||||
}
|
||||
|
||||
public int getSharedPortalFlagNumeric() {
|
||||
if( minSharedPortalId != minUsedToCalcualteShared ||
|
||||
maxSharedPortalId != maxUsedToCalculateShared ){
|
||||
this.sharedPortalFlagNumeric
|
||||
= calculateSharedPortalFlagNumeric(minSharedPortalId, maxSharedPortalId);
|
||||
minUsedToCalcualteShared = minSharedPortalId;
|
||||
maxUsedToCalculateShared = maxSharedPortalId;
|
||||
}
|
||||
return sharedPortalFlagNumeric;
|
||||
}
|
||||
|
||||
public String getKeywordHeading() {
|
||||
return keywordHeading;
|
||||
}
|
||||
|
||||
public String getRootLogotypeImage() {
|
||||
return rootLogotypeImage;
|
||||
}
|
||||
|
@ -333,87 +173,83 @@ public class ApplicationBean {
|
|||
return rootLogotypeTitle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isOnlyCurrent() {
|
||||
return onlyCurrent;
|
||||
public String getAboutText() {
|
||||
return aboutText;
|
||||
}
|
||||
|
||||
public boolean isOnlyPublic() {
|
||||
return onlyPublic;
|
||||
public String getAcknowledgeText() {
|
||||
return acknowledgeText;
|
||||
}
|
||||
|
||||
public ArrayList getFlag1List() {
|
||||
return flag1List;
|
||||
public String getContactMail() {
|
||||
return contactMail;
|
||||
}
|
||||
|
||||
/* public int getFlag1NumericFromString(String flagSet) {
|
||||
return getFlagNumericValue(flag1List,flagSet);
|
||||
} */
|
||||
|
||||
public ArrayList getFlag2List() {
|
||||
return flag2List;
|
||||
public String getCorrectionMail() {
|
||||
return correctionMail;
|
||||
}
|
||||
|
||||
/* public int getFlag2NumericFromString(String flagSet) {
|
||||
return getFlagNumericValue(flag2List,flagSet);
|
||||
} */
|
||||
|
||||
public ArrayList getFlag3List() {
|
||||
return flag3List;
|
||||
public String getCopyrightURL() {
|
||||
return copyrightURL;
|
||||
}
|
||||
|
||||
public String getCopyrightAnchor() {
|
||||
return copyrightAnchor;
|
||||
}
|
||||
|
||||
public int removeMarkedFlagListEntries(ArrayList flagList,String status) {
|
||||
int removeCount=0;
|
||||
if (flagList!=null && flagList.size()>0){
|
||||
Object[] removals = new Object[flagList.size()];
|
||||
for(int i=0; i<flagList.size(); i++) {
|
||||
Flagpole thisEntry = (Flagpole)flagList.get(i);
|
||||
if (thisEntry!=null) {
|
||||
if (thisEntry.getStatus().equalsIgnoreCase(status)) {
|
||||
removals[removeCount]=flagList.get(i);
|
||||
++removeCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
public String getRootBreadCrumbURL() {
|
||||
return "";
|
||||
//TODO implement me
|
||||
}
|
||||
|
||||
for(int j=0; j < /*removeCount*/ removals.length; j++) {
|
||||
flagList.remove(removals[j]);
|
||||
}
|
||||
public String getRootBreadCrumbAnchor() {
|
||||
return "";
|
||||
//TODO implement me
|
||||
}
|
||||
|
||||
public String getShortHand() {
|
||||
return "implement ApplicationBean.getShortHand()";
|
||||
// TODO implement me
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory to find the images. Subdirectories include css, jsp and site_icons.
|
||||
* Example: "themes/enhanced/"
|
||||
* @return
|
||||
*/
|
||||
public String getThemeDir(){
|
||||
return (themeDir != null && themeDir.length()>0)
|
||||
? themeDir
|
||||
: DEFAULT_THEME_DIR_FROM_CONTEXT;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
public boolean themeDirExists(){
|
||||
String themeDir = this.getThemeDir();
|
||||
if( themeDir == null || themeDir.length() < 1 ){
|
||||
log.error("Application has no themeDir/stylesheet set in the db." );
|
||||
return false;
|
||||
}
|
||||
return removeCount;
|
||||
|
||||
File dir = new File(themeDir);
|
||||
if( !dir.exists() ){
|
||||
log.error("Application: the themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath()+ " does not exist.");
|
||||
return false;
|
||||
}
|
||||
if( !dir.isDirectory() ){
|
||||
log.error("Application: themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath() + " is not a directory.");
|
||||
return false;
|
||||
}
|
||||
if( !dir.canRead() ){
|
||||
log.error("Application: themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath() + " is not readable.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* public int getFlag3NumericFromString(String flagSet) {
|
||||
return getFlagNumericValue(flag3List,flagSet);
|
||||
} */
|
||||
|
||||
/* not needed as long as get retrieve flags numerically via flagSet+0
|
||||
in the ents_edit.jsp and then specify just flagSet in ents_retry for creating or updating
|
||||
|
||||
private int getFlagNumericValue(ArrayList flagList,String flagSet) {
|
||||
int numericValue=0;
|
||||
if (flagList!=null && flagList.size()>0) {
|
||||
if (flagSet!=null && !flagSet.equals("")) {
|
||||
StringTokenizer sTokens = new StringTokenizer(flagSet,",");
|
||||
int sCount = sTokens.countTokens();
|
||||
for (int s=0; s<sCount; s++ ) {
|
||||
String tokenStr=sTokens.nextToken().trim();
|
||||
if (tokenStr != null && !tokenStr.equals("")) {
|
||||
Iterator iter = flagList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Flagpole flagpole=(Flagpole)iter.next();
|
||||
if (tokenStr.equals(flagpole.getCheckboxLabel())) {
|
||||
numericValue+=flagpole.getNumeric();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return numericValue;
|
||||
} */
|
||||
}
|
||||
|
||||
|
|
|
@ -126,30 +126,6 @@ public interface Individual extends ResourceBean, VitroTimeWindowedResource, Com
|
|||
Link getPrimaryLink();
|
||||
void setPrimaryLink(Link link);
|
||||
|
||||
String getFlag1Set();
|
||||
void setFlag1Set(String in);
|
||||
int getFlag1Numeric();
|
||||
void setFlag1Numeric(int i);
|
||||
|
||||
/* Consider the flagBitMask as a mask to & with flags.
|
||||
if flagBitMask bit zero is set then return true if
|
||||
the individual is in portal 2,
|
||||
if flagBitMask bit 1 is set then return true if
|
||||
the individual is in portal 4
|
||||
etc.
|
||||
*/
|
||||
boolean doesFlag1Match(int flagBitMask);
|
||||
|
||||
String getFlag2Set();
|
||||
void setFlag2Set(String in);
|
||||
int getFlag2Numeric();
|
||||
void setFlag2Numeric(int i);
|
||||
|
||||
String getFlag3Set();
|
||||
void setFlag3Set(String in);
|
||||
int getFlag3Numeric();
|
||||
void setFlag3Numeric(int i);
|
||||
|
||||
List<String> getKeywords();
|
||||
void setKeywords(List<String> keywords);
|
||||
String getKeywordString();
|
||||
|
|
|
@ -334,51 +334,6 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
primaryLink = link;
|
||||
}
|
||||
|
||||
|
||||
/* look at PortalFlag.numeric2numerics if you want to know which
|
||||
* bits are set in a numeric flag.
|
||||
*
|
||||
* NOTICE:
|
||||
* Values set Entity.getFlagXNumeric() will NOT be saved to the model.
|
||||
*
|
||||
* Also, changes to an entity flag state using Entity.setFlagXNumeric()
|
||||
* are not reflected in Entity.getFlagXSet() and vice versa.
|
||||
*/
|
||||
protected String flag1Set = null;
|
||||
public String getFlag1Set(){return flag1Set;}
|
||||
public void setFlag1Set(String in){flag1Set=in;}
|
||||
|
||||
protected int flag1Numeric = -1;
|
||||
public int getFlag1Numeric(){return flag1Numeric;}
|
||||
public void setFlag1Numeric(int i){flag1Numeric=i;}
|
||||
|
||||
/* Consider the flagBitMask as a mask to & with flags.
|
||||
if flagBitMask bit zero is set then return true if
|
||||
the individual is in portal 2,
|
||||
if flagBitMask bit 1 is set then return true if
|
||||
the individua is in portal 4
|
||||
etc.
|
||||
*/
|
||||
public boolean doesFlag1Match(int flagBitMask) {
|
||||
return (flagBitMask & getFlag1Numeric()) != 0;
|
||||
}
|
||||
|
||||
protected String flag2Set = null;
|
||||
public String getFlag2Set(){return flag2Set;}
|
||||
public void setFlag2Set(String in){flag2Set=in;}
|
||||
|
||||
protected int flag2Numeric = -1;
|
||||
public int getFlag2Numeric(){return flag2Numeric;}
|
||||
public void setFlag2Numeric(int i){flag2Numeric=i;}
|
||||
|
||||
protected String flag3Set = null;
|
||||
public String getFlag3Set(){return flag3Set;}
|
||||
public void setFlag3Set(String in){flag3Set=in;}
|
||||
|
||||
protected int flag3Numeric = -1;
|
||||
public int getFlag3Numeric(){return flag3Numeric;}
|
||||
public void setFlag3Numeric(int i){flag3Numeric=i;}
|
||||
|
||||
public List<String> getKeywords() { return keywords; }
|
||||
public void setKeywords(List<String> keywords) {this.keywords = keywords;}
|
||||
public String getKeywordString(){
|
||||
|
|
|
@ -1,544 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
||||
/**
|
||||
* This class is intended to store the information from one row off the portals table.
|
||||
* It is not intended to store any sort of user or request state.
|
||||
*
|
||||
* @author bdc34
|
||||
*
|
||||
*/
|
||||
public class Portal implements Comparable {
|
||||
// defaults for empty constructor or if database values are missing in a newly created clone or new portal, so something appears on web pages
|
||||
public static int DEFAULT_PORTAL_ID = 1;
|
||||
// DEFAULT_PORTAL_ID is not final (at the moment) because we don't yet have an RDF configuration for this,
|
||||
// and certain clones might use a ServletContextListener to change the default at context startup.
|
||||
final public static int DEFAULT_ROOT_TAB_ID = 23;
|
||||
final public static String DEFAULT_APPNAME = "VITRO"; // signals bean is not being initialized correctly
|
||||
|
||||
//final public static String DEFAULT_STYLESHEET = "portal"; // has .css.jsp added to it when file is retrieved
|
||||
|
||||
final public static String DEFAULT_COPYRIGHT_URL = "http://www.library.cornell.edu";
|
||||
final public static String DEFAULT_COPYRIGHT_ANCHOR = "Cornell University Library";
|
||||
|
||||
final public static String DEFAULT_ROOT_BREADCRUMB_URL = "http://www.library.cornell.edu"; // may want to be null except for CALS portals, but used to provide URL behind logo
|
||||
final public static String DEFAULT_ROOT_BREADCRUMB_ANCHOR = "Cornell University Library"; // may want to be null except for CALS portals, but used to provide URL behind logo
|
||||
|
||||
final public static String DEFAULT_CONTACT_MAIL = "jc55@cornell.edu";
|
||||
|
||||
final public static int DEFAULT_IMAGE_THUMB_WIDTH = 150;
|
||||
|
||||
final public static String DEFAULT_BANNER_IMAGE = null; // "pamlogo.328x76.transparent.gif";
|
||||
final public static int DEFAULT_BANNER_WIDTH = 328;
|
||||
final public static int DEFAULT_BANNER_HEIGHT = 76;
|
||||
|
||||
final public static String DEFAULT_LOGOTYPE_IMAGE = "libraryOnly_2color.transparent.181x76.gif";
|
||||
final public static int DEFAULT_LOGOTYPE_WIDTH = 181;
|
||||
final public static int DEFAULT_LOGOTYPE_HEIGHT = 65;
|
||||
|
||||
// Value gets set in default theme setup context listener at application startup
|
||||
public static String DEFAULT_THEME_DIR_FROM_CONTEXT = null;
|
||||
|
||||
final static boolean NOISY = false;
|
||||
private final static boolean DEFAULT_FLAG1_FILTERING = true;
|
||||
|
||||
// NOT STATIC, applying to each instance of the class that is created
|
||||
//This is the start of fields that are from actual columns on the database
|
||||
private int portalId;
|
||||
private int rootTabId;
|
||||
private String appName;
|
||||
//stylesheet
|
||||
private String bannerImage;
|
||||
//oldname
|
||||
// private String flag1Values;
|
||||
// private String flag2Values;
|
||||
private String contactMail;
|
||||
private String correctionMail;
|
||||
private String shortHand;
|
||||
private String aboutText;
|
||||
private String acknowledgeText;
|
||||
private int bannerWidth;
|
||||
private int bannerHeight;
|
||||
// private String flag3Values;
|
||||
private int flag2Numeric;
|
||||
private int flag3Numeric;
|
||||
private String copyrightURL;
|
||||
private String copyrightAnchor;
|
||||
private String rootBreadCrumbURL;
|
||||
private String rootBreadCrumbAnchor;
|
||||
private String logotypeImage;
|
||||
private int logotypeWidth;
|
||||
private int logotypeHeight;
|
||||
private int imageThumbWidth;
|
||||
private int displayRank;
|
||||
private boolean flag1SearchFiltering;
|
||||
private boolean flag2SearchFiltering;
|
||||
private boolean flag3SearchFiltering;
|
||||
private String urlprefix;
|
||||
|
||||
/** If true, then this portal will be filtered by flag1 so that only individuals in the
|
||||
* owl class Flag1Value${portalId}Thing will be displayed */
|
||||
private boolean flag1Filtering = DEFAULT_FLAG1_FILTERING;
|
||||
|
||||
//END of fields that are from columns on database
|
||||
|
||||
|
||||
private boolean initialized;
|
||||
private String searchOptions;
|
||||
private String navigationChoices;
|
||||
private String themeDir;
|
||||
private WebappDaoFactory webappDaoFactory;
|
||||
|
||||
private static final Log log = LogFactory.getLog(Portal.class.getName());
|
||||
|
||||
/************************** Default Constructor ********************************/
|
||||
|
||||
/*
|
||||
public Portal() {
|
||||
initialized = false;
|
||||
portalId = DEFAULT_PORTAL_ID;
|
||||
displayRank = portalId;
|
||||
rootTabId = DEFAULT_ROOT_TAB_ID;
|
||||
appName = DEFAULT_APPNAME;
|
||||
shortHand = DEFAULT_APPNAME;
|
||||
imageThumbWidth = DEFAULT_IMAGE_THUMB_WIDTH;
|
||||
bannerImage = DEFAULT_BANNER_IMAGE;
|
||||
bannerWidth = DEFAULT_BANNER_WIDTH;
|
||||
bannerHeight = DEFAULT_BANNER_HEIGHT;
|
||||
logotypeImage = DEFAULT_LOGOTYPE_IMAGE;
|
||||
logotypeWidth = DEFAULT_LOGOTYPE_WIDTH;
|
||||
logotypeHeight = DEFAULT_LOGOTYPE_HEIGHT;
|
||||
flag2Numeric = 0;
|
||||
flag3Numeric = 0;
|
||||
flag1SearchFiltering = true;
|
||||
flag2SearchFiltering = true;
|
||||
flag3SearchFiltering = true;
|
||||
aboutText = null;
|
||||
acknowledgeText = null;
|
||||
contactMail = DEFAULT_CONTACT_MAIL;
|
||||
copyrightURL = DEFAULT_COPYRIGHT_URL;
|
||||
copyrightAnchor = DEFAULT_COPYRIGHT_ANCHOR;
|
||||
rootBreadCrumbURL = null; // don't always want to display a root breadcrumb URL from outside the site
|
||||
rootBreadCrumbAnchor = null;
|
||||
searchOptions = null;
|
||||
navigationChoices = null;
|
||||
themeDir = DEFAULT_THEME_DIR;
|
||||
urlprefix = null;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
public PortalBean(String session_id_str,int portal_id,int root_tab_id,String app_name,String short_hand,String style_sheet,
|
||||
int image_thumb_width,String banner_image,int banner_width,int banner_height,
|
||||
String logotype_image,int logotype_width,int logotype_height,String contact_mail,
|
||||
int flag2_numeric,int flag3_numeric,String copyright_url,String copyright_anchor,String root_breadcrumb_url,String root_breadcrumb_anchor) {
|
||||
initialized = true;
|
||||
sessionIdStr = session_id_str;
|
||||
portalId = portal_id;
|
||||
rootTabId = root_tab_id;
|
||||
appName = app_name;
|
||||
shortHand = short_hand;
|
||||
stylesheet = style_sheet;
|
||||
imageThumbWidth = image_thumb_width;
|
||||
bannerImage = banner_image;
|
||||
bannerWidth = banner_width;
|
||||
bannerHeight = banner_height;
|
||||
logotypeImage = logotype_image;
|
||||
logotypeWidth = logotype_width;
|
||||
logotypeHeight = logotype_height;
|
||||
flag2Numeric = flag2_numeric;
|
||||
flag3Numeric = flag3_numeric;
|
||||
contactMail = contact_mail;
|
||||
copyrightURL = copyright_url;
|
||||
copyrightAnchor = copyright_anchor;
|
||||
rootBreadCrumbURL = root_breadcrumb_url;
|
||||
rootBreadCrumbAnchor = root_breadcrumb_anchor;
|
||||
//displayRank = display_rank; // not set from JSP
|
||||
} */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String toHTML() {
|
||||
String output = "<p>Portal Info:<ul>";
|
||||
output += "<li>portal id: [" + portalId + "]</li>";
|
||||
output += "<li>root tab id: [" + rootTabId + "]</li>";
|
||||
output += "<li>portal app name: [" + appName + "]</li>";
|
||||
output += "<li>portal shortHand: [" + shortHand + "]</li>";
|
||||
output += "<li>contact email: [" + contactMail + "]</li>";
|
||||
output += "<li>correction email: [" + contactMail + "]</li>";
|
||||
output += "<li>portal theme directory: [" + themeDir + "]</li>";
|
||||
output += "<li>image thumb width [" + imageThumbWidth + "]</li>";
|
||||
output += "<li>banner image: [" + bannerImage + "]</li>";
|
||||
output += "<li>banner image width: [" + bannerWidth + "]</li>";
|
||||
output += "<li>banner image height: [" + bannerHeight + "]</li>";
|
||||
output += "<li>logotype image: [" + logotypeImage + "]</li>";
|
||||
output += "<li>logotype image width: [" + logotypeWidth + "]</li>";
|
||||
output += "<li>logotype image height:[" + logotypeHeight + "]</li>";
|
||||
// output += "<li>flag 1 values: [" + flag1Values + "]</li>";
|
||||
// output += "<li>flag 2 values: [" + flag2Values + "]</li>";
|
||||
output += "<li>flag 2 numeric [" + flag2Numeric + "]</li>";
|
||||
// output += "<li>flag 3 values: [" + flag3Values + "]</li>";
|
||||
output += "<li>flag 3 numeric [" + flag3Numeric + "]</li>";
|
||||
output += "<li>flag1 search filters [" + flag1SearchFiltering + "]</li>";
|
||||
output += "<li>flag2 search filters [" + flag2SearchFiltering + "]</li>";
|
||||
output += "<li>flag3 search filters [" + flag3SearchFiltering + "]</li>";
|
||||
output += "<li>About text [" + aboutText + "]</li>";
|
||||
output += "<li>Acknowledge text [" + acknowledgeText + "]</li>";
|
||||
output += "<li>copyright URL: [" + copyrightURL + "]</li>";
|
||||
output += "<li>copyright anchor: [" + copyrightAnchor + "]</li>";
|
||||
output += "<li>breadcrumb URL: [" + rootBreadCrumbURL + "]</li>";
|
||||
output += "<li>breadcrumb anchor: [" + rootBreadCrumbAnchor + "]</li>";
|
||||
output += "<li>display rank: [" + displayRank + "]</li>";
|
||||
output += "<li>search options [" + searchOptions + "]</li>";
|
||||
output += "<li>navigation choices [" + navigationChoices + "]</li>";
|
||||
output += "<li>urlprefix [" + urlprefix + "]</li>";
|
||||
output += "</ul></p>";
|
||||
return output;
|
||||
}
|
||||
|
||||
/*************************** SET functions ****************************/
|
||||
|
||||
public void setInitialized( boolean boolean_val ) {
|
||||
initialized=boolean_val;
|
||||
}
|
||||
|
||||
public void setPortalId(int int_val) {
|
||||
portalId=int_val;
|
||||
}
|
||||
|
||||
public void setRootTabId(int int_val) {
|
||||
rootTabId=int_val;
|
||||
}
|
||||
|
||||
public void setAppName(String string_val) {
|
||||
appName = string_val;
|
||||
}
|
||||
|
||||
public void setShortHand(String string_val) {
|
||||
shortHand = string_val;
|
||||
}
|
||||
|
||||
public void setContactMail(String string_val) {
|
||||
contactMail = string_val;
|
||||
}
|
||||
|
||||
public void setCorrectionMail(String string_val) {
|
||||
correctionMail = string_val;
|
||||
}
|
||||
|
||||
public void setImageThumbWidth(int int_val) {
|
||||
imageThumbWidth = int_val;
|
||||
}
|
||||
|
||||
public void setBannerImage(String string_val) {
|
||||
bannerImage = string_val;
|
||||
}
|
||||
|
||||
public void setBannerWidth(int int_val) {
|
||||
bannerWidth = int_val;
|
||||
}
|
||||
|
||||
public void setBannerHeight(int int_val) {
|
||||
bannerHeight = int_val;
|
||||
}
|
||||
|
||||
public void setLogotypeImage(String string_val) {
|
||||
logotypeImage = string_val;
|
||||
}
|
||||
|
||||
public void setLogotypeWidth(int int_val) {
|
||||
logotypeWidth = int_val;
|
||||
}
|
||||
|
||||
public void setLogotypeHeight(int int_val) {
|
||||
logotypeHeight = int_val;
|
||||
}
|
||||
|
||||
/* public void setFlag1Values(String string_val) {
|
||||
flag1Values = string_val;
|
||||
}
|
||||
|
||||
public void setFlag2Values(String string_val) {
|
||||
flag2Values = string_val;
|
||||
} */
|
||||
|
||||
public void setFlag2Numeric(int int_val) {
|
||||
flag2Numeric = int_val;
|
||||
}
|
||||
|
||||
/* public void setFlag3Values(String string_val) {
|
||||
flag3Values = string_val;
|
||||
} */
|
||||
|
||||
public void setFlag3Numeric(int int_val) {
|
||||
flag3Numeric = int_val;
|
||||
}
|
||||
|
||||
public void setFlag1SearchFilters(boolean b_val) {
|
||||
flag1SearchFiltering=b_val;
|
||||
}
|
||||
|
||||
public void setFlag2SearchFilters(boolean b_val) {
|
||||
flag2SearchFiltering=b_val;
|
||||
}
|
||||
|
||||
public void setFlag3SearchFilters(boolean b_val) {
|
||||
flag3SearchFiltering=b_val;
|
||||
}
|
||||
|
||||
public void setAboutText(String string_val) {
|
||||
aboutText = string_val;
|
||||
}
|
||||
|
||||
public void setAcknowledgeText(String string_val) {
|
||||
acknowledgeText = string_val;
|
||||
}
|
||||
|
||||
public void setCopyrightURL(String string_val) {
|
||||
copyrightURL = string_val;
|
||||
}
|
||||
|
||||
public void setCopyrightAnchor(String string_val) {
|
||||
copyrightAnchor = string_val;
|
||||
}
|
||||
|
||||
public void setRootBreadCrumbURL(String string_val) {
|
||||
rootBreadCrumbURL = string_val;
|
||||
}
|
||||
|
||||
public void setRootBreadCrumbAnchor(String string_val) {
|
||||
rootBreadCrumbAnchor = string_val;
|
||||
}
|
||||
|
||||
public void setDisplayRank(int int_val) {
|
||||
displayRank=int_val;
|
||||
}
|
||||
|
||||
public void setSearchOptions(String string_val) {
|
||||
searchOptions=string_val;
|
||||
}
|
||||
|
||||
public void setNavigationChoices(String string_val) {
|
||||
navigationChoices=string_val;
|
||||
}
|
||||
|
||||
public void setUrlprefix(String in){
|
||||
this.urlprefix = in;
|
||||
}
|
||||
public void setFlag1Filtering(String b){
|
||||
flag1Filtering = "true".equalsIgnoreCase(b);
|
||||
}
|
||||
|
||||
public void setWebappDaoFactory (WebappDaoFactory wdf) {
|
||||
this.webappDaoFactory = wdf;
|
||||
}
|
||||
|
||||
/*************************** GET functions ****************************/
|
||||
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public int getPortalId() {
|
||||
return portalId;
|
||||
}
|
||||
|
||||
public int getRootTabId() {
|
||||
return rootTabId;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public String getShortHand() {
|
||||
return shortHand;
|
||||
}
|
||||
|
||||
public String getContactMail() {
|
||||
return contactMail;
|
||||
}
|
||||
|
||||
public String getCorrectionMail() {
|
||||
return correctionMail;
|
||||
}
|
||||
|
||||
public int getImageThumbWidth() {
|
||||
return imageThumbWidth;
|
||||
}
|
||||
|
||||
public String getBannerImage() {
|
||||
return bannerImage;
|
||||
}
|
||||
|
||||
public int getBannerWidth() {
|
||||
return bannerWidth;
|
||||
}
|
||||
|
||||
public int getBannerHeight() {
|
||||
return bannerHeight;
|
||||
}
|
||||
|
||||
public String getLogotypeImage() {
|
||||
return logotypeImage;
|
||||
}
|
||||
|
||||
public int getLogotypeWidth() {
|
||||
return logotypeWidth;
|
||||
}
|
||||
|
||||
public int getLogotypeHeight() {
|
||||
return logotypeHeight;
|
||||
}
|
||||
|
||||
/* public String getFlag1Values() {
|
||||
return flag1Values;
|
||||
}
|
||||
|
||||
public String getFlag2Values() {
|
||||
return flag2Values;
|
||||
} */
|
||||
|
||||
public int getFlag2Numeric() {
|
||||
return flag2Numeric;
|
||||
}
|
||||
|
||||
/* public String getFlag3Values() {
|
||||
return flag3Values;
|
||||
} */
|
||||
|
||||
public int getFlag3Numeric() {
|
||||
return flag3Numeric;
|
||||
}
|
||||
|
||||
public boolean isFlag1SearchFiltering() {
|
||||
return flag1SearchFiltering;
|
||||
}
|
||||
|
||||
public boolean isFlag2SearchFiltering() {
|
||||
return flag2SearchFiltering;
|
||||
}
|
||||
|
||||
public boolean isFlag3SearchFiltering() {
|
||||
return flag3SearchFiltering;
|
||||
}
|
||||
|
||||
public String getAboutText() {
|
||||
return aboutText;
|
||||
}
|
||||
|
||||
public String getAcknowledgeText() {
|
||||
return acknowledgeText;
|
||||
}
|
||||
|
||||
public String getCopyrightURL() {
|
||||
return copyrightURL;
|
||||
}
|
||||
|
||||
public String getCopyrightAnchor() {
|
||||
return copyrightAnchor;
|
||||
|
||||
}
|
||||
public String getRootBreadCrumbURL() {
|
||||
return rootBreadCrumbURL;
|
||||
}
|
||||
|
||||
public String getRootBreadCrumbAnchor() {
|
||||
return rootBreadCrumbAnchor;
|
||||
}
|
||||
|
||||
public int getDisplayRank() {
|
||||
return displayRank;
|
||||
}
|
||||
|
||||
public String getSearchOptions() {
|
||||
return searchOptions;
|
||||
}
|
||||
|
||||
public String getNavigationChoices() {
|
||||
return navigationChoices;
|
||||
}
|
||||
|
||||
public String getUrlprefix(){
|
||||
return this.urlprefix;
|
||||
}
|
||||
|
||||
public boolean isFlag1Filtering(){
|
||||
return flag1Filtering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory to find the images. Subdirectories include css, jsp and site_icons.
|
||||
* Example: "themes/enhanced/"
|
||||
* @return
|
||||
*/
|
||||
public String getThemeDir(){
|
||||
return (themeDir != null && themeDir.length()>0) ? themeDir : DEFAULT_THEME_DIR_FROM_CONTEXT;
|
||||
}
|
||||
public void setThemeDir(String string_val) {
|
||||
if( string_val == null || string_val.length() == 0
|
||||
|| "default".equalsIgnoreCase(string_val)
|
||||
|| "portal".equalsIgnoreCase(string_val)
|
||||
|| "null".equalsIgnoreCase(string_val)
|
||||
|| " ".equalsIgnoreCase(string_val) )
|
||||
themeDir = DEFAULT_THEME_DIR_FROM_CONTEXT;
|
||||
else
|
||||
themeDir = string_val;
|
||||
}
|
||||
|
||||
public boolean themeDirExists(){
|
||||
String themeDir = this.getThemeDir();
|
||||
if( themeDir == null || themeDir.length() < 1 ){
|
||||
log.error("Portal id: " + this.getPortalId() + " has no themeDir/stylesheet set in the db." );
|
||||
return false;
|
||||
}
|
||||
|
||||
File dir = new File(themeDir);
|
||||
if( !dir.exists() ){
|
||||
log.error("Portal id: " + getPortalId() + ", the themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath()+ " does not exist.");
|
||||
return false;
|
||||
}
|
||||
if( !dir.isDirectory() ){
|
||||
log.error("Portal id: " + getPortalId() + ", themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath() + " is not a directory.");
|
||||
return false;
|
||||
}
|
||||
if( !dir.canRead() ){
|
||||
log.error("Portal id: " + getPortalId() + ", themeDir/stylesheet "
|
||||
+ dir.getAbsolutePath() + " is not readable.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int compareTo(Object o1) {
|
||||
return this.portalId - ((Portal)o1).getPortalId();
|
||||
}
|
||||
|
||||
// nac26: 20080618 - no longer used as we are not switching themes as part of self editing
|
||||
//public String getDefaultEditThemeDir() {
|
||||
// return "themes/editdefault/";
|
||||
//}
|
||||
|
||||
public WebappDaoFactory getWebappDaoFactory() {
|
||||
return this.webappDaoFactory;
|
||||
}
|
||||
|
||||
public String getTypeUri(){
|
||||
return VitroVocabulary.vitroURI + "Flag1Value"
|
||||
+ getPortalId() + "Thing";
|
||||
}
|
||||
}
|
|
@ -6,10 +6,7 @@ package edu.cornell.mannlib.vitro.webapp.beans;
|
|||
* @version 1 2005-08-27
|
||||
* @authors Jon Corson-Rikert, Brian Caruso
|
||||
*
|
||||
* A tab is a browsing facet within a single portal. While it might sometimes be
|
||||
* convenient to share tabs across portals, curators often prefer to be able to
|
||||
* tweak display controls on their own, as for example to adjust the dayLimit field
|
||||
* to control how many news releases show up in a given portal during busy or dry news spells
|
||||
* A tab is a browsing facet within the application.
|
||||
*
|
||||
* UPDATES
|
||||
* BDC 2005-12-02 : updated to work with refactored db
|
||||
|
@ -83,10 +80,6 @@ public class Tab implements java.io.Serializable, Comparable<Tab> { // class to
|
|||
public void setTabId(int val) {tabId=val;}
|
||||
public int getTabId() {return tabId;}
|
||||
|
||||
private int portalId=0; // each tab belongs to a different portal
|
||||
public void setPortalId(int val) {portalId=val;}
|
||||
public int getPortalId() {return portalId;}
|
||||
|
||||
private int tabtypeId=0;
|
||||
// 0 unspecified, 28 primary tab,26 primary tab content,24 secondary tab,22 collection,20 subcollection,18 subcollection category
|
||||
public void setTabtypeId(int val) {tabtypeId=val;}
|
||||
|
@ -272,7 +265,6 @@ public class Tab implements java.io.Serializable, Comparable<Tab> { // class to
|
|||
public Tab() {
|
||||
// identifiers
|
||||
tabId = -1; // primary key of tabs table is auto_increment so this could be 0;
|
||||
portalId = 0;
|
||||
tabtypeId = 0;
|
||||
userId = 0;
|
||||
statusId = 0;
|
||||
|
@ -316,7 +308,6 @@ public class Tab implements java.io.Serializable, Comparable<Tab> { // class to
|
|||
public String toHTML() {
|
||||
String output = "<p>Tab:<ul>";
|
||||
output += "<li>tab id: [" + tabId + "]</li>";
|
||||
output += "<li>portal id: [" + portalId + "]</li>";
|
||||
output += "<li>tabtype id: [" + tabtypeId + "]</li>";
|
||||
output += "<li>user id: [" + userId + "]</li>";
|
||||
output += "<li>day limit: [" + dayLimit + "]</li>";
|
||||
|
|
|
@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
|
||||
public class ContactMailServlet extends VitroHttpServlet {
|
||||
|
@ -64,13 +64,15 @@ public class ContactMailServlet extends VitroHttpServlet {
|
|||
throws ServletException, IOException {
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
String statusMsg = null; // holds the error status
|
||||
|
||||
if (smtpHost==null || smtpHost.equals("")){
|
||||
statusMsg = "This application has not yet been configured to send mail " +
|
||||
"-- smtp host has not been identified in the Configuration Properties file.";
|
||||
redirectToError(response, statusMsg, portal);
|
||||
redirectToError(response, statusMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,7 +83,7 @@ public class ContactMailServlet extends VitroHttpServlet {
|
|||
String validationMessage = validateInput(webusername, webuseremail,
|
||||
comments);
|
||||
if (validationMessage != null) {
|
||||
redirectToError(response, validationMessage, portal);
|
||||
redirectToError(response, validationMessage);
|
||||
return;
|
||||
}
|
||||
webusername = webusername.trim();
|
||||
|
@ -121,29 +123,29 @@ public class ContactMailServlet extends VitroHttpServlet {
|
|||
String deliveryfrom = null;
|
||||
|
||||
if ("comment".equals(formType)) {
|
||||
if (portal.getContactMail() == null || portal.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address defined in current portal "+portal.getPortalId());
|
||||
if (appBean.getContactMail() == null || appBean.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address defined in current application");
|
||||
throw new Error(
|
||||
"To establish the Contact Us mail capability the system administrators must "
|
||||
+ "specify an email address in the current portal.");
|
||||
} else {
|
||||
deliverToArray = portal.getContactMail().split(",");
|
||||
deliverToArray = appBean.getContactMail().split(",");
|
||||
}
|
||||
deliveryfrom = "Message from the "+portal.getAppName()+" Contact Form";
|
||||
deliveryfrom = "Message from the "+appBean.getApplicationName()+" Contact Form";
|
||||
} else if ("correction".equals(formType)) {
|
||||
if (portal.getCorrectionMail() == null || portal.getCorrectionMail().trim().length()==0) {
|
||||
log.error("Expecting one or more correction email addresses to be specified in current portal "+portal.getPortalId()+"; will attempt to use contact mail address");
|
||||
if (portal.getContactMail() == null || portal.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address or correction mail address defined in current portal "+portal.getPortalId());
|
||||
if (appBean.getCorrectionMail() == null || appBean.getCorrectionMail().trim().length()==0) {
|
||||
log.error("Expecting one or more correction email addresses to be specified in current application; will attempt to use contact mail address");
|
||||
if (appBean.getContactMail() == null || appBean.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address or correction mail address defined in current application");
|
||||
} else {
|
||||
deliverToArray = portal.getContactMail().split(",");
|
||||
deliverToArray = appBean.getContactMail().split(",");
|
||||
}
|
||||
} else {
|
||||
deliverToArray = portal.getCorrectionMail().split(",");
|
||||
deliverToArray = appBean.getCorrectionMail().split(",");
|
||||
}
|
||||
deliveryfrom = "Message from the "+portal.getAppName()+" Correction Form (ARMANN-nospam)";
|
||||
deliveryfrom = "Message from the "+appBean.getApplicationName()+" Correction Form (ARMANN-nospam)";
|
||||
} else {
|
||||
deliverToArray = portal.getContactMail().split(",");
|
||||
deliverToArray = appBean.getContactMail().split(",");
|
||||
statusMsg = SPAM_MESSAGE ;
|
||||
spamReason = "The form specifies no delivery type.";
|
||||
}
|
||||
|
@ -197,10 +199,10 @@ public class ContactMailServlet extends VitroHttpServlet {
|
|||
// Redirect to the appropriate confirmation page
|
||||
if (statusMsg == null && spamReason == null) {
|
||||
// message was sent successfully
|
||||
redirectToConfirmation(response, statusMsg, portal);
|
||||
redirectToConfirmation(response, statusMsg);
|
||||
} else {
|
||||
// exception occurred
|
||||
redirectToError( response, statusMsg, portal);
|
||||
redirectToError( response, statusMsg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -213,15 +215,13 @@ public class ContactMailServlet extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
private void redirectToConfirmation(HttpServletResponse response,
|
||||
String statusMsg, Portal portal) throws IOException {
|
||||
response.sendRedirect( "test?bodyJsp=" + CONFIRM_PAGE + "&home=" +
|
||||
portal.getPortalId() );
|
||||
String statusMsg) throws IOException {
|
||||
response.sendRedirect( "test?bodyJsp=" + CONFIRM_PAGE + "&home=" );
|
||||
}
|
||||
|
||||
private void redirectToError(HttpServletResponse response, String statusMsg,
|
||||
Portal portal) throws IOException {
|
||||
response.sendRedirect( "test?bodyJsp=" + ERR_PAGE + "&ERR=" + statusMsg
|
||||
+ "&home=" + portal.getPortalId() );
|
||||
private void redirectToError(HttpServletResponse response, String statusMsg)
|
||||
throws IOException {
|
||||
response.sendRedirect("test?bodyJsp=" + ERR_PAGE + "&ERR=" + statusMsg);
|
||||
}
|
||||
|
||||
/** Intended to mangle url so it can get through spam filtering
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -29,30 +21,13 @@ import org.apache.lucene.search.Sort;
|
|||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntClass;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.ontology.OntProperty;
|
||||
import com.hp.hpl.jena.ontology.OntResource;
|
||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||
import com.hp.hpl.jena.query.QueryFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Property;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.vocabulary.OWL;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.Classes2ClassesDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.json.JSONObject;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.SearchException;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames;
|
||||
|
@ -233,7 +232,6 @@ public class JSONReconcileServlet extends VitroHttpServlet {
|
|||
VitroRequest vreq) throws ServletException {
|
||||
JSONObject qJson = new JSONObject();
|
||||
try {
|
||||
PortalFlag portalFlag = vreq.getPortalFlag();
|
||||
Analyzer analyzer = getAnalyzer(getServletContext());
|
||||
IndexSearcher searcherForRequest = LuceneIndexFactory
|
||||
.getIndexSearcher(getServletContext());
|
||||
|
@ -275,7 +273,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
|
|||
|
||||
// begin search
|
||||
JSONArray resultJsonArr = new JSONArray();
|
||||
Query query = getReconcileQuery(vreq, portalFlag, analyzer,
|
||||
Query query = getReconcileQuery(vreq, analyzer,
|
||||
queryVal, searchType, propertiesList);
|
||||
|
||||
TopDocs topDocs = searcherForRequest.search(query, null, limit);
|
||||
|
@ -438,8 +436,8 @@ public class JSONReconcileServlet extends VitroHttpServlet {
|
|||
return qp;
|
||||
}
|
||||
|
||||
private Query getReconcileQuery(VitroRequest request, PortalFlag portalState,
|
||||
Analyzer analyzer, String querystr, String typeParam, ArrayList<String[]> propertiesList) throws SearchException{
|
||||
private Query getReconcileQuery(VitroRequest request, Analyzer analyzer,
|
||||
String querystr, String typeParam, ArrayList<String[]> propertiesList) throws SearchException{
|
||||
|
||||
Query query = null;
|
||||
try {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class JSONServlet extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||
VClassGroup vcg = vcgc.getGroup(vreq.getPortalId(), vcgUri);
|
||||
VClassGroup vcg = vcgc.getGroup(vcgUri);
|
||||
if( vcg == null ){
|
||||
log.debug("Could not find vclassgroup: " + vcgUri);
|
||||
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
|
@ -226,8 +226,6 @@ public class JSONServlet extends VitroHttpServlet {
|
|||
vclass.getURI(),
|
||||
page,
|
||||
alpha,
|
||||
vreq.getPortal(),
|
||||
vreq.getWebappDaoFactory().getPortalDao().isSinglePortal(),
|
||||
vreq.getWebappDaoFactory().getIndividualDao(),
|
||||
context);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
|
||||
|
@ -50,7 +49,6 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
public void doGet( HttpServletRequest request, HttpServletResponse response )
|
||||
throws ServletException, IOException {
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
String confirmpage = "/confirmUserMail.jsp";
|
||||
String errpage = "/contact_err.jsp";
|
||||
|
@ -59,7 +57,7 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
if (smtpHost==null || smtpHost.equals("")){
|
||||
status = "This application has not yet been configured to send mail " +
|
||||
"-- smtp host has not been identified in the Configuration Properties file.";
|
||||
response.sendRedirect( "test?bodyJsp=" + errpage + "&ERR=" + status + "&home=" + portal.getPortalId() );
|
||||
response.sendRedirect( "test?bodyJsp=" + errpage + "&ERR=" + status );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -219,10 +217,10 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
// Redirect to the appropriate confirmation page
|
||||
if (status == null && !probablySpam) {
|
||||
// message was sent successfully
|
||||
response.sendRedirect( "test?bodyJsp=" + confirmpage + "&home=" + portal.getPortalId() );
|
||||
response.sendRedirect( "test?bodyJsp=" + confirmpage );
|
||||
} else {
|
||||
// exception occurred
|
||||
response.sendRedirect( "test?bodyJsp=" + errpage + "&ERR=" + status + "&home=" + portal.getPortalId() );
|
||||
response.sendRedirect( "test?bodyJsp=" + errpage + "&ERR=" + status );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -11,7 +9,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
@ -19,28 +16,16 @@ import javax.servlet.http.HttpSession;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntClass;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.ontology.OntProperty;
|
||||
import com.hp.hpl.jena.ontology.OntResource;
|
||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||
import com.hp.hpl.jena.query.QueryFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Property;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.Classes2ClassesDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
||||
|
||||
public class OntologyController extends VitroHttpServlet{
|
||||
|
@ -238,80 +223,15 @@ public class OntologyController extends VitroHttpServlet{
|
|||
private void doNotFound(HttpServletRequest req, HttpServletResponse res)
|
||||
throws IOException, ServletException {
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
ApplicationBean appBean = ApplicationBean.getAppBean(getServletContext());
|
||||
int allPortalId = appBean.getAllPortalFlagNumeric();
|
||||
|
||||
//If an Individual is not found, there is possibility that it
|
||||
//was requested from a portal where it was not visible.
|
||||
//In this case redirect to the all portal.
|
||||
try{
|
||||
Portal allPortal =
|
||||
vreq.getWebappDaoFactory().getPortalDao().getPortal(allPortalId);
|
||||
// there must be a portal defined with the ID of the all portal
|
||||
// for this to work
|
||||
if( portal.getPortalId() != allPortalId && allPortal != null ) {
|
||||
|
||||
//bdc34:
|
||||
// this is hard coded to get the all portal
|
||||
// I didn't find a way to get the id of the all portal
|
||||
// it is likely that redirecting will not work in non VIVO clones
|
||||
String portalPrefix = null;
|
||||
String portalParam = null;
|
||||
if( allPortal != null && allPortal.getUrlprefix() != null )
|
||||
portalPrefix = allPortal.getUrlprefix();
|
||||
else
|
||||
portalParam = "home=" + allPortalId;
|
||||
|
||||
String queryStr = req.getQueryString();
|
||||
if( queryStr == null && portalParam != null && !"".equals(portalParam)){
|
||||
queryStr = portalParam;
|
||||
} else {
|
||||
if( portalParam != null && !"".equals(portalParam))
|
||||
queryStr = queryStr + "&" + portalParam;
|
||||
}
|
||||
if( queryStr != null && !queryStr.startsWith("?") )
|
||||
queryStr = "?" + queryStr;
|
||||
|
||||
StringBuilder url = new StringBuilder();
|
||||
url.append( req.getContextPath() );
|
||||
if( req.getContextPath() != null && !req.getContextPath().endsWith("/"))
|
||||
url.append('/');
|
||||
|
||||
if( portalPrefix != null && !"".equals(portalPrefix))
|
||||
url.append( portalPrefix ).append('/');
|
||||
|
||||
String servletPath = req.getServletPath();
|
||||
String spath = "";
|
||||
if( servletPath != null ){
|
||||
if( servletPath.startsWith("/") )
|
||||
spath = servletPath.substring(1);
|
||||
else
|
||||
spath = servletPath;
|
||||
}
|
||||
|
||||
if( spath != null && !"".equals(spath))
|
||||
url.append( spath );
|
||||
|
||||
if( req.getPathInfo() != null )
|
||||
url.append( req.getPathInfo() );
|
||||
|
||||
if( queryStr != null && !"".equals(queryStr ))
|
||||
url.append( queryStr );
|
||||
|
||||
res.sendRedirect(url.toString());
|
||||
return;
|
||||
}
|
||||
}catch(Throwable th){
|
||||
log.error("could not do a redirect", th);
|
||||
}
|
||||
|
||||
//set title before we do the highlighting so we don't get markup in it.
|
||||
req.setAttribute("title","not found");
|
||||
res.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
|
||||
String css = "<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\""
|
||||
+ portal.getThemeDir() + "css/entity.css\"/>"
|
||||
+ appBean.getThemeDir() + "css/entity.css\"/>"
|
||||
+ "<script language='JavaScript' type='text/javascript' src='js/toggle.js'></script>";
|
||||
req.setAttribute("css",css);
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ import com.hp.hpl.jena.sparql.resultset.ResultSetFormat;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
|
||||
|
||||
/**
|
||||
* This servlet works as a RequestDispatcher to direct to the sparl query builder page.
|
||||
|
@ -106,11 +104,9 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
|||
//res.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
/* Code change completed */
|
||||
|
||||
req.setAttribute("portalBean",portal);
|
||||
// nac26: 2009-09-25 - this was causing problems in safari on localhost installations because the href did not include the context. The edit.css is not being used here anyway (or anywhere else for that matter)
|
||||
// req.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
req.setAttribute("title","SPARQL Query Builder");
|
||||
|
|
|
@ -49,7 +49,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
|
||||
|
||||
|
@ -326,7 +325,6 @@ public class SparqlQueryServlet extends BaseEditController {
|
|||
|
||||
private void doHelp(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
OntologyDao daoObj = vreq.getFullWebappDaoFactory().getOntologyDao();
|
||||
List<Ontology> ontologiesObj = daoObj.getAllOntologies();
|
||||
|
@ -345,7 +343,6 @@ public class SparqlQueryServlet extends BaseEditController {
|
|||
|
||||
req.setAttribute("prefixList", prefixList);
|
||||
|
||||
req.setAttribute("portalBean",portal);
|
||||
// nac26: 2009-09-25 - this was causing problems in safari on localhost installations because the href did not include the context. The edit.css is not being used here anyway (or anywhere else for that matter)
|
||||
// req.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
req.setAttribute("title","SPARQL Query");
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.TabWebUtil;
|
||||
|
||||
|
@ -50,8 +49,7 @@ public class TabController extends VitroHttpServlet {
|
|||
Tab leadingTab = populateLeadingTab(request);
|
||||
request.setAttribute("leadingTab",leadingTab);
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
/*
|
||||
if (leadingTab.getTabId()==portal.getRootTabId()) {
|
||||
request.setAttribute("homePageRequested", "true");
|
||||
request.setAttribute("title", portal.getAppName());
|
||||
|
@ -59,9 +57,9 @@ public class TabController extends VitroHttpServlet {
|
|||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
else { */
|
||||
request.setAttribute("title",leadingTab.getTitle());
|
||||
}
|
||||
/* } */
|
||||
|
||||
String body = leadingTab.getBody();
|
||||
if( body != null && body.startsWith("JSPBody:") )
|
||||
|
|
|
@ -37,9 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexer;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.TabWebUtil;
|
||||
import freemarker.template.TemplateModel;
|
||||
|
||||
/**
|
||||
* Produces the entity lists for tabs.
|
||||
|
@ -213,14 +211,14 @@ public void doGet( HttpServletRequest req, HttpServletResponse response )
|
|||
|
||||
//try to get the URIs of the required individuals from the lucene index
|
||||
IndexSearcher index = LuceneIndexFactory.getIndexSearcher(getServletContext());
|
||||
boolean isSinglePortal = request.getWebappDaoFactory().getPortalDao().isSinglePortal();
|
||||
|
||||
BooleanQuery query = null;
|
||||
if( tab.isAutoLinked() ){
|
||||
query = getQuery(tab, autoLinkedUris, null, alpha, isSinglePortal);
|
||||
query = getQuery(tab, autoLinkedUris, null, alpha);
|
||||
}else if (tab.isManualLinked() ){
|
||||
query = getQuery(tab, null, manuallyLinkedUris, alpha, isSinglePortal);
|
||||
query = getQuery(tab, null, manuallyLinkedUris, alpha);
|
||||
}else if ( tab.isMixedLinked() ){
|
||||
query = getQuery(tab, autoLinkedUris, manuallyLinkedUris, alpha, isSinglePortal);
|
||||
query = getQuery(tab, autoLinkedUris, manuallyLinkedUris, alpha);
|
||||
}else{
|
||||
log.error("Tab " + tab.getTabId() + " is neither manually, auto nor mixed. ");
|
||||
}
|
||||
|
@ -390,7 +388,7 @@ public void doGet( HttpServletRequest req, HttpServletResponse response )
|
|||
* get their individuals using lucene, see doManual().
|
||||
*
|
||||
*/
|
||||
private BooleanQuery getQuery(Tab tab, List<String> vclassUris, List<String> manualUris, String alpha , boolean isSinglePortal){
|
||||
private BooleanQuery getQuery(Tab tab, List<String> vclassUris, List<String> manualUris, String alpha){
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
try{
|
||||
|
||||
|
@ -409,24 +407,6 @@ public void doGet( HttpServletRequest req, HttpServletResponse response )
|
|||
}
|
||||
typeQuery.add(queryForTypes, BooleanClause.Occur.MUST);
|
||||
|
||||
//check for portal filtering only on auto linked queries
|
||||
if( ! isSinglePortal ){
|
||||
int tabPortal = tab.getPortalId();
|
||||
if( tabPortal < 16 ){ //could be a normal portal
|
||||
typeQuery.add(
|
||||
new TermQuery( new Term(Entity2LuceneDoc.term.PORTAL, Integer.toString(1 << tab.getPortalId() ))),
|
||||
BooleanClause.Occur.MUST);
|
||||
}else{ //could be a combined portal
|
||||
BooleanQuery tabQueries = new BooleanQuery();
|
||||
Long[] ids= FlagMathUtils.numeric2numerics(tabPortal);
|
||||
for( Long id : ids){
|
||||
tabQueries.add(
|
||||
new TermQuery( new Term(Entity2LuceneDoc.term.PORTAL,id.toString()) ),
|
||||
BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
typeQuery.add(tabQueries,BooleanClause.Occur.MUST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//make query for manually linked individuals
|
||||
|
|
|
@ -10,8 +10,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||
|
||||
/**
|
||||
* Controller for comments ("contact us") page
|
||||
|
@ -41,24 +39,8 @@ public class UserMailController extends VitroHttpServlet{
|
|||
errd.forward(request, response);
|
||||
}
|
||||
ApplicationBean appBean=vreq.getAppBean();
|
||||
Portal portalBean=vreq.getPortal();
|
||||
|
||||
if ( (appBean.getMaxSharedPortalId()-appBean.getMinSharedPortalId()) > 1
|
||||
&& ( (portalBean.getPortalId() >= appBean.getMinSharedPortalId()
|
||||
&& portalBean.getPortalId() <= appBean.getMaxSharedPortalId() )
|
||||
|| portalBean.getPortalId() == appBean.getSharedPortalFlagNumeric() )
|
||||
) {
|
||||
request.setAttribute("portalType","CALSResearch");
|
||||
} else
|
||||
if (portalBean.getAppName().equalsIgnoreCase("CALS Impact")){
|
||||
request.setAttribute("portalType", "CALSImpact");
|
||||
} else if (portalBean.getAppName().equalsIgnoreCase("VIVO")) {
|
||||
request.setAttribute("portalType", "VIVO");
|
||||
} else {
|
||||
request.setAttribute("portalType", "clone");
|
||||
}
|
||||
|
||||
request.setAttribute("siteName",portalBean.getAppName());
|
||||
request.setAttribute("siteName", appBean.getApplicationName());
|
||||
request.setAttribute("scripts","/js/commentsForm.js");
|
||||
|
||||
if (request.getHeader("Referer") == null)
|
||||
|
@ -66,12 +48,8 @@ public class UserMailController extends VitroHttpServlet{
|
|||
else
|
||||
request.getSession().setAttribute("commentsFormReferer",request.getHeader("Referer"));
|
||||
|
||||
|
||||
request.setAttribute("portalId",Integer.valueOf(portalBean.getPortalId()));
|
||||
|
||||
request.setAttribute("title", portalBean.getAppName()+" Mail Users Form");
|
||||
request.setAttribute("title", appBean.getApplicationName()+" Mail Users Form");
|
||||
request.setAttribute("bodyJsp", "/templates/parts/emailUsers.jsp");// <<< this is where the body gets set
|
||||
request.setAttribute("portalBean",portalBean);
|
||||
|
||||
RequestDispatcher rd =
|
||||
request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
|
|
|
@ -22,11 +22,8 @@ import com.hp.hpl.jena.ontology.OntModel;
|
|||
import com.hp.hpl.jena.query.Dataset;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag;
|
||||
import edu.cornell.mannlib.vitro.webapp.flags.SunsetFlag;
|
||||
|
||||
public class VitroRequest implements HttpServletRequest {
|
||||
|
||||
|
@ -139,50 +136,9 @@ public class VitroRequest implements HttpServletRequest {
|
|||
return jenaOntModel;
|
||||
}
|
||||
|
||||
public Portal getPortal(){
|
||||
return(Portal) getAttribute("portalBean");
|
||||
}
|
||||
public void setPortal(Portal p){
|
||||
setAttribute("portalBean", p);
|
||||
setAttribute("portal", p);
|
||||
}
|
||||
|
||||
public int getPortalId(){
|
||||
String idstr = (String)getAttribute("home");
|
||||
|
||||
if( idstr == null ){
|
||||
WebappDaoFactory wdf = getWebappDaoFactory();
|
||||
Portal[] portals = wdf.getPortalDao().getAllPortals().toArray(new Portal[0]);
|
||||
return portals[0].getPortalId();
|
||||
}
|
||||
|
||||
try{
|
||||
return Integer.parseInt(idstr);
|
||||
}catch( Throwable th){
|
||||
throw new Error("home parameter was not set in request");
|
||||
}
|
||||
|
||||
}
|
||||
public void setPortalId(String in){
|
||||
setAttribute("home",in);
|
||||
}
|
||||
|
||||
public PortalFlag getPortalFlag(){
|
||||
return(PortalFlag) getAttribute("portalFlag");
|
||||
}
|
||||
public void setPortalFlag(PortalFlag pf){
|
||||
setAttribute("portalFlag", pf);
|
||||
}
|
||||
|
||||
public SunsetFlag getSunsetFlag(){
|
||||
return (SunsetFlag) getAttribute("sunsetFlag");
|
||||
}
|
||||
public void setSunsetFlag(SunsetFlag sf){
|
||||
setAttribute("sunsetFlag",sf);
|
||||
}
|
||||
|
||||
public ApplicationBean getAppBean(){
|
||||
return (ApplicationBean) getAttribute("appBean");
|
||||
//return (ApplicationBean) getAttribute("appBean");
|
||||
return getWebappDaoFactory().getApplicationDao().getApplicationBean();
|
||||
}
|
||||
public void setAppBean(ApplicationBean ab){
|
||||
setAttribute("appBean",ab);
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import edu.cornell.mannlib.vedit.beans.Option;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditSiteInformation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.ThemeUtils;
|
||||
|
||||
public class ApplicationBeanRetryController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ApplicationBeanRetryController.class.getName());
|
||||
|
||||
public void doPost (HttpServletRequest req, HttpServletResponse response) {
|
||||
|
||||
if (!isAuthorizedToDisplayPage(req, response, new Actions(new EditSiteInformation()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest request = new VitroRequest(req);
|
||||
|
||||
try {
|
||||
super.doGet(request,response);
|
||||
} catch (Exception e) {
|
||||
log.error("PortalRetryController encountered exception calling super.doGet()");
|
||||
}
|
||||
|
||||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
epo.setBeanClass(ApplicationBean.class);
|
||||
|
||||
String action = "update";
|
||||
|
||||
ApplicationDao aDao = request.getFullWebappDaoFactory().getApplicationDao();
|
||||
ApplicationBean applicationForEditing = aDao.getApplicationBean();
|
||||
epo.setDataAccessObject(aDao);
|
||||
|
||||
if (!epo.getUseRecycledBean()){
|
||||
action = "update";
|
||||
epo.setOriginalBean(applicationForEditing);
|
||||
} else {
|
||||
applicationForEditing = (ApplicationBean) epo.getNewBean();
|
||||
action = "update";
|
||||
log.debug("using newBean");
|
||||
}
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
epo.setGetMethod(aDao.getClass().getDeclaredMethod("getApplicationBean"));
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.error("could not find the getApplicationBean method in the facade");
|
||||
}
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
foo.setErrorMap(epo.getErrMsgMap());
|
||||
|
||||
HashMap optionMap = new HashMap();
|
||||
|
||||
List<Option> themeOptions = getThemeOptions(applicationForEditing);
|
||||
optionMap.put("ThemeDir", themeOptions);
|
||||
|
||||
foo.setOptionLists(optionMap);
|
||||
|
||||
epo.setFormObject(foo);
|
||||
FormUtils.htmlFormFromBean(applicationForEditing, epo.getAction(), foo);
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
request.setAttribute("formJsp","/templates/edit/specific/portal_retry.jsp");
|
||||
request.setAttribute("scripts","/templates/edit/formBasic.js");
|
||||
request.setAttribute("title","Site Information Editing Form");
|
||||
request.setAttribute("_action",action);
|
||||
request.setAttribute("unqualifiedClassName","ApplicationBean");
|
||||
setRequestAttributes(request,epo);
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Option objects for valid themes in the application, based on names of subdirectories
|
||||
* of the "/themes" directory.
|
||||
*
|
||||
* @return list of Options for valid themes
|
||||
*/
|
||||
private final List<Option> getThemeOptions(ApplicationBean application) {
|
||||
|
||||
// Get the available themes
|
||||
ServletContext sc = getServletContext();
|
||||
boolean doSort = true;
|
||||
ArrayList<String> themeNames = ThemeUtils.getThemes(sc, doSort);
|
||||
|
||||
// Create the list of theme Options
|
||||
String currentThemeDir = application.getThemeDir();
|
||||
Iterator<String> i = themeNames.iterator();
|
||||
List<Option> themeOptions = new ArrayList<Option>(themeNames.size());
|
||||
String themeName, themeDir;
|
||||
boolean selected;
|
||||
while (i.hasNext()) {
|
||||
themeName = i.next();
|
||||
themeDir = "themes/" + themeName + "/";
|
||||
selected = themeDir.equals(currentThemeDir);
|
||||
themeOptions.add(new Option(themeDir, themeName, selected));
|
||||
}
|
||||
|
||||
return themeOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -78,16 +77,10 @@ public class ClassgroupRetryController extends BaseEditController {
|
|||
vclassGroupForEditing = (VClassGroup) epo.getNewBean();
|
||||
}
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new VclassGroupInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new VclassGroupInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listGroups?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listGroups"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -129,14 +122,9 @@ public class ClassgroupRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
class VclassGroupInsertPageForwarder implements PageForwarder {
|
||||
private int portalId = 1;
|
||||
|
||||
public VclassGroupInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newVclassGroupUrl = "listGroups?home="+portalId;
|
||||
String newVclassGroupUrl = "listGroups";
|
||||
try {
|
||||
response.sendRedirect(newVclassGroupUrl);
|
||||
} catch (IOException ioe) {
|
||||
|
|
|
@ -37,7 +37,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
|||
* */
|
||||
public class CloneEntityServlet extends BaseEditController {
|
||||
private static final String NO_PROPERTY_RESTRICTION = null;
|
||||
private static final int DEFAULT_PORTAL_ID=1;
|
||||
private static final int MIN_EDIT_ROLE=4;
|
||||
private static final Log log = LogFactory.getLog(CloneEntityServlet.class.getName());
|
||||
|
||||
|
@ -48,29 +47,25 @@ public class CloneEntityServlet extends BaseEditController {
|
|||
|
||||
VitroRequest request = new VitroRequest(req);
|
||||
try {
|
||||
String portalIdStr = (portalIdStr = request.getParameter("home")) == null ? String
|
||||
.valueOf(DEFAULT_PORTAL_ID)
|
||||
: portalIdStr;
|
||||
|
||||
//attempt to clone a tab but if we don't find the parameter 'tabId' the clone a entity
|
||||
try{
|
||||
int id = doCloneTab(request, response);
|
||||
if( id >= 0){
|
||||
response.sendRedirect("tabEdit?home=" + portalIdStr
|
||||
+ "&id=" + id);
|
||||
response.sendRedirect("tabEdit?id=" + id);
|
||||
return;
|
||||
}
|
||||
}catch(Exception ex){
|
||||
log.error("Could not clone tab: " + ex);
|
||||
getServletConfig().getServletContext().getRequestDispatcher(
|
||||
"/index.jsp?home=" + portalIdStr).forward(request,
|
||||
"/index.jsp").forward(request,
|
||||
response);
|
||||
return;
|
||||
}
|
||||
|
||||
String individualURI=request.getParameter("uri");
|
||||
if (individualURI == null || individualURI.equals("")){
|
||||
getServletConfig().getServletContext().getRequestDispatcher("/index.jsp?home="+portalIdStr).forward( request, response );
|
||||
getServletConfig().getServletContext().getRequestDispatcher("/index.jsp").forward( request, response );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +118,7 @@ public class CloneEntityServlet extends BaseEditController {
|
|||
// addIndividualToLuceneIndex( context, cloneURI );
|
||||
|
||||
String encodedCloneURI = URLEncoder.encode(cloneURI, "UTF-8");
|
||||
response.sendRedirect("entityEdit?home="+portalIdStr+"&uri="+encodedCloneURI);
|
||||
response.sendRedirect("entityEdit?uri="+encodedCloneURI);
|
||||
//response.sendRedirect("entity?home="+portalIdStr+"&id="+newEntityId);
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -88,7 +87,6 @@ public class DataPropertyStatementRetryController extends BaseEditController {
|
|||
|
||||
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
|
|
|
@ -21,9 +21,9 @@ import edu.cornell.mannlib.vedit.beans.FormObject;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -66,8 +66,6 @@ public class DatapropEditController extends BaseEditController {
|
|||
results.add("custom entry form");
|
||||
results.add("URI");
|
||||
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
|
||||
results.add(dp.getLocalNameWithPrefix());
|
||||
|
@ -88,7 +86,7 @@ public class DatapropEditController extends BaseEditController {
|
|||
// TODO - need unionOf/intersectionOf-style domains for domain class
|
||||
String domainStr="";
|
||||
try {
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+dp.getDomainClassURI()+"</a>";
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"\">"+dp.getDomainClassURI()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -173,12 +171,13 @@ public class DatapropEditController extends BaseEditController {
|
|||
}
|
||||
request.setAttribute("equivalentProperties", eqProperties);
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("datatypeProperty", dp);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/dataprops_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Data Property Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+appBean.getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -25,11 +25,9 @@ import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vedit.validator.impl.IntValidator;
|
||||
import edu.cornell.mannlib.vedit.validator.impl.XMLNameValidator;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionListener;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup;
|
||||
|
@ -116,19 +114,14 @@ public class DatapropRetryController extends BaseEditController {
|
|||
log.error("DatapropRetryController could not find the getDataPropertyByURI method in the facade");
|
||||
}
|
||||
|
||||
Portal currPortal = vreq.getPortal();
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new DataPropertyInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new DataPropertyInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of properties
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listDatatypeProperties?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listDatatypeProperties"));
|
||||
|
||||
//set up any listeners
|
||||
List changeListenerList = new ArrayList();
|
||||
changeListenerList.add(new PropertyRestrictionListener(getServletContext()));
|
||||
//changeListenerList.add(new PropertyRestrictionListener(getServletContext()));
|
||||
epo.setChangeListenerList(changeListenerList);
|
||||
|
||||
|
||||
|
@ -198,14 +191,8 @@ public class DatapropRetryController extends BaseEditController {
|
|||
|
||||
class DataPropertyInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public DataPropertyInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newPropertyUrl = "datapropEdit?home="+portalId+"&uri=";
|
||||
String newPropertyUrl = "datapropEdit?uri=";
|
||||
DataProperty p = (DataProperty) epo.getNewBean();
|
||||
try {
|
||||
newPropertyUrl += URLEncoder.encode(p.getURI(),"UTF-8");
|
||||
|
|
|
@ -114,8 +114,7 @@ public class DatatypeRetryController extends BaseEditController {
|
|||
|
||||
class DatatypeInsertPageForwarder implements PageForwarder {
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
int portalId = (new VitroRequest(request)).getPortal().getPortalId();
|
||||
String newDtpUrl = "fetch?home="+portalId+"&queryspec=private_datatypev&postGenLimit=-1&linkwhere=datatypes.id=";
|
||||
String newDtpUrl = "fetch?queryspec=private_datatypev&postGenLimit=-1&linkwhere=datatypes.id=";
|
||||
Datatype dtp = (Datatype) epo.getNewBean();
|
||||
newDtpUrl += dtp.getId();
|
||||
try {
|
||||
|
@ -128,8 +127,7 @@ public class DatatypeRetryController extends BaseEditController {
|
|||
|
||||
class DatatypeDeletePageForwarder implements PageForwarder {
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
int portalId = (new VitroRequest(request)).getPortal().getPortalId();
|
||||
String newDtpUrl = "fetch?home="+portalId+"&queryspec=private_datatypes";
|
||||
String newDtpUrl = "fetch?queryspec=private_datatypes";
|
||||
Datatype dtp = (Datatype) epo.getNewBean();
|
||||
try {
|
||||
response.sendRedirect(newDtpUrl);
|
||||
|
|
|
@ -5,13 +5,10 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -22,7 +19,6 @@ import org.apache.commons.collections.map.ListOrderedMap;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.Checkbox;
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import edu.cornell.mannlib.vedit.beans.Option;
|
||||
|
@ -36,7 +32,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.KeywordIndividualRelation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
|
@ -44,17 +39,12 @@ import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.KeywordDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.KeywordIndividualRelationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PortalDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena;
|
||||
|
||||
public class EntityEditController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(EntityEditController.class.getName());
|
||||
|
||||
private final static int MIN_SHARED_PORTAL_ID = 16; // will this be available from the AppBean?
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new EditIndividuals()))) {
|
||||
return;
|
||||
|
@ -62,7 +52,6 @@ public class EntityEditController extends BaseEditController {
|
|||
|
||||
String entURI = request.getParameter("uri");
|
||||
VitroRequest vreq = (new VitroRequest(request));
|
||||
Portal portal = vreq.getPortal();
|
||||
ApplicationBean application = vreq.getAppBean();
|
||||
|
||||
Individual ent = vreq.getAssertionsWebappDaoFactory().getIndividualDao().getIndividualByURI(entURI);
|
||||
|
@ -70,9 +59,8 @@ public class EntityEditController extends BaseEditController {
|
|||
try {
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp","/jenaIngest/notfound.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Individual Not Found");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+application.getThemeDir()+"css/edit.css\"/>");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error("EntityEditController could not forward to view.");
|
||||
|
@ -88,7 +76,7 @@ public class EntityEditController extends BaseEditController {
|
|||
|
||||
request.setAttribute("entity",ent);
|
||||
|
||||
ArrayList results = new ArrayList();
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
int colCount = 6;
|
||||
results.add("Name");
|
||||
results.add("moniker");
|
||||
|
@ -96,16 +84,6 @@ public class EntityEditController extends BaseEditController {
|
|||
results.add("blurb");
|
||||
results.add("display level");
|
||||
results.add("edit level");
|
||||
if (application.isOnlyCurrent()) {
|
||||
results.add("sunrise");
|
||||
results.add("timekey");
|
||||
results.add("sunset");
|
||||
colCount = colCount + 3;
|
||||
}
|
||||
if (vreq.getFullWebappDaoFactory().getApplicationDao().isFlag2Active()) {
|
||||
results.add("Flag 2 values");
|
||||
colCount++;
|
||||
}
|
||||
results.add("last updated");
|
||||
colCount++;
|
||||
results.add("URI");
|
||||
|
@ -132,7 +110,9 @@ public class EntityEditController extends BaseEditController {
|
|||
VClass vc = classIt.next();
|
||||
String rClassName = "";
|
||||
try {
|
||||
rClassName = "<a href=\"vclassEdit?home="+portal.getPortalId()+"&uri="+URLEncoder.encode(vc.getURI(),"UTF-8")+"\">"+vc.getLocalNameWithPrefix()+"</a>";
|
||||
rClassName = "<a href=\"vclassEdit?uri=" +
|
||||
URLEncoder.encode(vc.getURI(),"UTF-8")+"\">" +
|
||||
vc.getLocalNameWithPrefix()+"</a>";
|
||||
} catch (Exception e) {
|
||||
rClassName = vc.getLocalNameWithPrefix();
|
||||
}
|
||||
|
@ -150,18 +130,6 @@ public class EntityEditController extends BaseEditController {
|
|||
results.add(ent.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified" : ent.getHiddenFromDisplayBelowRoleLevel().getLabel());
|
||||
results.add(ent.getProhibitedFromUpdateBelowRoleLevel() == null ? "unspecified" : ent.getProhibitedFromUpdateBelowRoleLevel().getLabel());
|
||||
|
||||
if (application.isOnlyCurrent()) {
|
||||
String rSunrise = (ent.getSunrise()==null) ? "" : publicDateFormat.format(ent.getSunrise());
|
||||
results.add(rSunrise);
|
||||
String rTimekey = (ent.getTimekey()==null) ? "" : publicDateFormat.format(ent.getTimekey());
|
||||
results.add(rTimekey);
|
||||
String rSunset = (ent.getSunset()==null) ? "" : publicDateFormat.format(ent.getSunset());
|
||||
results.add(rSunset);
|
||||
}
|
||||
if (vreq.getFullWebappDaoFactory().getApplicationDao().isFlag2Active()) {
|
||||
String rFlag2Set = (ent.getFlag2Set()==null) ? "" : ent.getFlag2Set();
|
||||
results.add(rFlag2Set);
|
||||
}
|
||||
String rModTime = (ent.getModTime()==null) ? "" : publicDateFormat.format(ent.getModTime());
|
||||
results.add(rModTime);
|
||||
results.add( (ent.getURI() == null) ? "[anonymous individual]" : ent.getURI() );
|
||||
|
@ -175,18 +143,10 @@ public class EntityEditController extends BaseEditController {
|
|||
FormObject foo = new FormObject();
|
||||
HashMap OptionMap = new HashMap();
|
||||
|
||||
Collection<DataPropertyStatement> curationNotes = vreq.getFullWebappDaoFactory().getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(ent, VitroVocabulary.CURATOR_NOTE);
|
||||
List curationNoteStrs = new LinkedList();
|
||||
Iterator<DataPropertyStatement> cnIt = curationNotes.iterator();
|
||||
while (cnIt.hasNext()) {
|
||||
curationNoteStrs.add(cnIt.next().getData());
|
||||
}
|
||||
request.setAttribute("curationNotes",curationNotes);
|
||||
|
||||
request.setAttribute("types",ent.getVClasses(false)); // we're displaying all assertions, including indirect types
|
||||
|
||||
try {
|
||||
List externalIdOptionList = new LinkedList();
|
||||
List<Option> externalIdOptionList = new LinkedList<Option>();
|
||||
if (ent.getExternalIds() != null) {
|
||||
Iterator<DataPropertyStatement> externalIdIt = ent.getExternalIds().iterator();
|
||||
while (externalIdIt.hasNext()) {
|
||||
|
@ -242,78 +202,6 @@ public class EntityEditController extends BaseEditController {
|
|||
|
||||
foo.setOptionLists(OptionMap);
|
||||
|
||||
// make the flag checkbox lists
|
||||
Boolean singlePortal = new Boolean(vreq.getFullWebappDaoFactory().getPortalDao().isSinglePortal());
|
||||
request.setAttribute("singlePortal", singlePortal);
|
||||
|
||||
EditProcessObject flagEpo = super.createEpo(request);
|
||||
flagEpo.setOriginalBean(ent);
|
||||
flagEpo.setDataAccessObject(vreq.getFullWebappDaoFactory().getIndividualDao());
|
||||
request.setAttribute("_flagEpoKey",flagEpo.getKey());
|
||||
|
||||
if (vreq.getFullWebappDaoFactory().getApplicationDao().isFlag1Active()) {
|
||||
request.setAttribute("isFlag1Active",true);
|
||||
PortalDao pDao = vreq.getFullWebappDaoFactory().getPortalDao();
|
||||
HashSet indPortalSet = new HashSet();
|
||||
if (ent.getFlag1Set() != null) {
|
||||
String[] indPortal = ent.getFlag1Set().split(",");
|
||||
for (int i=0; i<indPortal.length; i++) {
|
||||
try {
|
||||
int portalId = Integer.decode(indPortal[i]);
|
||||
indPortalSet.add(portalId);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
}
|
||||
List<Checkbox> portalCheckboxList = new ArrayList<Checkbox>();
|
||||
Collection<Portal> allPortals = pDao.getAllPortals();
|
||||
if (allPortals != null) {
|
||||
Iterator<Portal> portalIt = allPortals.iterator();
|
||||
while (portalIt.hasNext()) {
|
||||
Portal p = portalIt.next();
|
||||
if (p.getPortalId() < MIN_SHARED_PORTAL_ID) {
|
||||
Checkbox checkbox = new Checkbox();
|
||||
checkbox.setValue(Integer.toString(p.getPortalId()));
|
||||
checkbox.setBody(p.getAppName());
|
||||
checkbox.setChecked( (indPortalSet.contains(p.getPortalId())) ? true : false );
|
||||
portalCheckboxList.add(checkbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
foo.getCheckboxLists().put("portalFlag", portalCheckboxList);
|
||||
} else {
|
||||
request.setAttribute("isFlag1Active",false);
|
||||
}
|
||||
|
||||
if (vreq.getFullWebappDaoFactory().getApplicationDao().isFlag2Active()) {
|
||||
try {
|
||||
request.setAttribute("isFlag2Active",true);
|
||||
List<Checkbox> flag2CheckboxList = new ArrayList<Checkbox>();
|
||||
Set<String> flag2ValueSet = new HashSet<String>();
|
||||
String[] flag2Values = ent.getFlag2Set().split(",");
|
||||
for (int ii = 0; ii<flag2Values.length; ii++) {
|
||||
flag2ValueSet.add(flag2Values[ii]);
|
||||
}
|
||||
List<String> keyList = new ArrayList<String>();
|
||||
keyList.addAll(((WebappDaoFactoryJena) vreq.getFullWebappDaoFactory()).getFlag2ValueMap().keySet());
|
||||
Collections.sort(keyList);
|
||||
for (Iterator<String> i = keyList.iterator(); i.hasNext(); ) {
|
||||
String value = i.next();
|
||||
Checkbox cb = new Checkbox();
|
||||
cb.setValue(value);
|
||||
cb.setBody(value);
|
||||
if (flag2ValueSet.contains(value)) {
|
||||
cb.setChecked(true);
|
||||
}
|
||||
flag2CheckboxList.add(cb);
|
||||
}
|
||||
foo.getCheckboxLists().put("flag2", flag2CheckboxList);
|
||||
} catch (Exception e) {
|
||||
log.error("Unable to set up flag2 checkboxes");
|
||||
}
|
||||
} else {
|
||||
request.setAttribute("isFlag2Active", false);
|
||||
}
|
||||
|
||||
List<Option> existingKeywordRelations = new LinkedList();
|
||||
KeywordIndividualRelationDao kirDao = vreq.getFullWebappDaoFactory().getKeys2EntsDao();
|
||||
KeywordDao kDao = vreq.getFullWebappDaoFactory().getKeywordDao();
|
||||
|
@ -338,15 +226,12 @@ public class EntityEditController extends BaseEditController {
|
|||
|
||||
epo.setFormObject(foo);
|
||||
|
||||
request.setAttribute("curatorNoteURI",VitroVocabulary.CURATOR_NOTE);
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("entityWebapp", ent);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/ents_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Individual Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+application.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("scripts", "/templates/edit/specific/ents_edit_head.jsp");
|
||||
|
||||
try {
|
||||
|
|
|
@ -35,13 +35,13 @@ import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
|||
import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vedit.validator.impl.RequiredFieldValidator;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -91,12 +91,6 @@ public class EntityRetryController extends BaseEditController {
|
|||
VClassGroupDao cgDao = myWebappDaoFactory.getVClassGroupDao();
|
||||
DataPropertyDao dpDao = myWebappDaoFactory.getDataPropertyDao();
|
||||
|
||||
Portal currPortal = vreq.getPortal();
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
Individual individualForEditing = null;
|
||||
if (epo.getUseRecycledBean()) {
|
||||
individualForEditing = (Individual)epo.getNewBean();
|
||||
|
@ -112,10 +106,6 @@ public class EntityRetryController extends BaseEditController {
|
|||
}
|
||||
} else {
|
||||
individualForEditing = new IndividualImpl();
|
||||
//set portal flag to current portal if not editing in a combined portal
|
||||
if (currPortal.getPortalId() < vreq.getAppBean().getMaxPortalId()) {
|
||||
individualForEditing.setFlag1Set(Integer.valueOf(currPortal.getPortalId()).toString());
|
||||
}
|
||||
if (vreq.getParameter("VClassURI") != null) {
|
||||
individualForEditing.setVClassURI(vreq.getParameter("VClassURI"));
|
||||
}
|
||||
|
@ -138,8 +128,8 @@ public class EntityRetryController extends BaseEditController {
|
|||
epo.getValidatorMap().put("Name",lnList);
|
||||
|
||||
//make a postinsert pageforwarder that will send us to a new entity's fetch screen
|
||||
epo.setPostInsertPageForwarder(new EntityInsertPageForwarder(currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder(siteAdminUrl + "?home="+currPortalId));
|
||||
epo.setPostInsertPageForwarder(new EntityInsertPageForwarder());
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder(siteAdminUrl));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -312,15 +302,15 @@ public class EntityRetryController extends BaseEditController {
|
|||
epo.getAdditionalDaoMap().put("DataPropertyStatement",myWebappDaoFactory.getDataPropertyStatementDao()); // EntityDatapropProcessor will look for this
|
||||
epo.getAdditionalDaoMap().put("DataProperty",myWebappDaoFactory.getDataPropertyDao()); // EntityDatapropProcessor will look for this
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
request.setAttribute("formJsp","/templates/edit/specific/entity_retry.jsp");
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Individual Editing Form");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+appBean.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("scripts", "/js/edit/entityRetry.js");
|
||||
// NC Commenting this out for now. Going to pass on DWR for moniker and use jQuery instead
|
||||
// request.setAttribute("bodyAttr"," onLoad=\"monikerInit()\"");
|
||||
|
@ -362,14 +352,8 @@ public class EntityRetryController extends BaseEditController {
|
|||
|
||||
class EntityInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public EntityInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newEntityUrl = "entityEdit?home="+portalId+"&uri=";
|
||||
String newEntityUrl = "entityEdit?uri=";
|
||||
Individual ent = (Individual) epo.getNewBean();
|
||||
//log.error(ent.getName() + " : " + ent.getURI()+" ; "+ent.getNamespace()+" ; "+ent.getLocalName());
|
||||
if (ent != null && ent.getURI() != null) {
|
||||
|
@ -382,7 +366,7 @@ public class EntityRetryController extends BaseEditController {
|
|||
} else {
|
||||
try {
|
||||
String siteAdminUrl = request.getContextPath() + Controllers.SITE_ADMIN;
|
||||
response.sendRedirect(siteAdminUrl + "?home="+portalId);
|
||||
response.sendRedirect(siteAdminUrl);
|
||||
} catch (IOException e) {
|
||||
log.error("EntityInsertPageForwarder could not redirect to about page.");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndivi
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -74,13 +73,6 @@ public class ExternalIdRetryController extends BaseEditController {
|
|||
|
||||
//set up any listeners
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
HashMap OptionMap = new HashMap();
|
||||
List entityList = new LinkedList();
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
|
||||
public class FlagUpdateController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(FlagUpdateController.class.getName());
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new EditIndividuals()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
String defaultLandingPage = getDefaultLandingPage(request);
|
||||
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
|
||||
String flag1Set = makeCommaSeparatedList(vrequest.getParameterValues("Flag1Value"));
|
||||
String flag2Set = makeCommaSeparatedList(vrequest.getParameterValues("Flag2Value"));
|
||||
|
||||
Individual ind = ((Individual) epo.getOriginalBean());
|
||||
ind.setFlag1Set(flag1Set);
|
||||
ind.setFlag2Set(flag2Set);
|
||||
|
||||
((IndividualDao) epo.getDataAccessObject()).updateIndividual(ind);
|
||||
|
||||
//the referer stuff all will be changed so as not to rely on the HTTP header
|
||||
String referer = request.getHeader("REFERER");
|
||||
if (referer == null) {
|
||||
try {
|
||||
response.sendRedirect(defaultLandingPage);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
response.sendRedirect(referer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String makeCommaSeparatedList(String[] values) {
|
||||
String listStr = "";
|
||||
if (values != null) {
|
||||
boolean firstTime = true;
|
||||
for (int i=0; i<values.length; i++) {
|
||||
if (!firstTime) {
|
||||
listStr += ",";
|
||||
} else {
|
||||
firstTime = false;
|
||||
}
|
||||
listStr += values[i];
|
||||
}
|
||||
}
|
||||
return listStr;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
||||
|
@ -44,14 +43,12 @@ public class KeywordEditController extends BaseEditController {
|
|||
foo.setOptionLists(OptionMap);
|
||||
epo.setFormObject(foo);
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("keyword", k);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/keyterms_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Keyword Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.KeywordIndividualRelation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.KeywordDao;
|
||||
|
@ -103,13 +102,6 @@ public class KeywordRetryController extends BaseEditController {
|
|||
epo.setChangeListenerList(listenerList);
|
||||
}
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
Class[] args = new Class[1];
|
||||
|
|
|
@ -22,7 +22,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Link;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
|
@ -90,13 +89,6 @@ public class LinkRetryController extends BaseEditController {
|
|||
|
||||
//set up any listeners
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
Class[] args = new Class[1];
|
||||
|
|
|
@ -19,7 +19,6 @@ import edu.cornell.mannlib.vedit.util.FormUtils;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Namespace;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
|
||||
|
@ -80,14 +79,8 @@ public class NamespaceRetryController extends BaseEditController {
|
|||
|
||||
//set up any listeners
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new NamespaceInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new NamespaceInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
|
@ -134,14 +127,8 @@ public class NamespaceRetryController extends BaseEditController {
|
|||
|
||||
class NamespaceInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public NamespaceInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newNamespaceUrl = "fetch?home="+portalId+"&queryspec=private_namespacev&postGenLimit=-1&linkwhere=namespaces.id=";
|
||||
String newNamespaceUrl = "fetch?queryspec=private_namespacev&postGenLimit=-1&linkwhere=namespaces.id=";
|
||||
Namespace ns = (Namespace) epo.getNewBean();
|
||||
newNamespaceUrl += ns.getId();
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
|
@ -86,13 +85,11 @@ public class OntologyEditController extends BaseEditController {
|
|||
request.setAttribute("realURI", realURI);
|
||||
request.setAttribute("exportURL", request.getContextPath() + Controllers.EXPORT_RDF);
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/ontologies_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Ontology Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vedit.util.FormUtils;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
|
||||
|
@ -82,16 +81,10 @@ public class OntologyRetryController extends BaseEditController {
|
|||
|
||||
//set up any listeners
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new ontology's edit screen
|
||||
epo.setPostInsertPageForwarder(new OntologyInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new OntologyInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of ontologies
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listOntologies?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listOntologies"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -149,14 +142,8 @@ public class OntologyRetryController extends BaseEditController {
|
|||
|
||||
class OntologyInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public OntologyInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newOntologyUrl = "ontologyEdit?home="+portalId+"&uri=";
|
||||
String newOntologyUrl = "ontologyEdit?uri=";
|
||||
Ontology ont = (Ontology) epo.getNewBean();
|
||||
try {
|
||||
newOntologyUrl += URLEncoder.encode(ont.getURI(),"UTF-8");
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManagePortals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
||||
public class PortalEditController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(PortalEditController.class.getName());
|
||||
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new ManagePortals()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we need to extract the keyword id from a Fetch parameter
|
||||
String linkwhereId = request.getParameter("linkwhere");
|
||||
String thePortalId = linkwhereId.substring(12,linkwhereId.length()-1);
|
||||
int portalId = Integer.decode(thePortalId);
|
||||
|
||||
VitroRequest vreq = (new VitroRequest(request));
|
||||
Portal p = vreq.getFullWebappDaoFactory().getPortalDao().getPortal(portalId);
|
||||
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
FormObject foo = new FormObject();
|
||||
HashMap OptionMap = new HashMap();
|
||||
foo.setOptionLists(OptionMap);
|
||||
epo.setFormObject(foo);
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("thePortal", p);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/portals_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Portal Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error("PortalEditController could not forward to view.");
|
||||
log.error(e.getMessage());
|
||||
log.error(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request,response);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,279 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import edu.cornell.mannlib.vedit.beans.Option;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
||||
import edu.cornell.mannlib.vedit.listener.ChangeListener;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManagePortals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PortalDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.filters.PortalPickerFilter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.ThemeUtils;
|
||||
|
||||
public class PortalRetryController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(PortalRetryController.class.getName());
|
||||
|
||||
@Override
|
||||
public void doPost (HttpServletRequest req, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(req, response, new Actions(new ManagePortals()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest request = new VitroRequest(req);
|
||||
|
||||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
epo.setBeanClass(Portal.class);
|
||||
|
||||
String action = "insert";
|
||||
|
||||
PortalDao pDao = request.getFullWebappDaoFactory().getPortalDao();
|
||||
epo.setDataAccessObject(pDao);
|
||||
TabDao tDao = request.getFullWebappDaoFactory().getTabDao();
|
||||
|
||||
boolean creatingNewPortal = false;
|
||||
Portal portalForEditing = null;
|
||||
if (!epo.getUseRecycledBean()){
|
||||
if (request.getParameter("id") != null) {
|
||||
int id = Integer.parseInt(request.getParameter("id"));
|
||||
if (id >= 0) {
|
||||
try {
|
||||
portalForEditing = pDao.getPortal(id);
|
||||
action = "update";
|
||||
} catch (NullPointerException e) {
|
||||
log.error("Need to implement 'record not found' error message.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
portalForEditing = new Portal();
|
||||
creatingNewPortal = true;
|
||||
}
|
||||
epo.setOriginalBean(portalForEditing);
|
||||
} else {
|
||||
portalForEditing = (Portal) epo.getNewBean();
|
||||
action = "update";
|
||||
log.error("using newBean");
|
||||
}
|
||||
|
||||
|
||||
//make a simple mask for the class's id
|
||||
Object[] simpleMaskPair = new Object[2];
|
||||
simpleMaskPair[0]="Id";
|
||||
simpleMaskPair[1]=Integer.valueOf(portalForEditing.getPortalId());
|
||||
epo.getSimpleMask().add(simpleMaskPair);
|
||||
|
||||
|
||||
//set any validators
|
||||
|
||||
//set up any listeners
|
||||
List changeListenerList = new ArrayList();
|
||||
epo.setChangeListenerList(changeListenerList);
|
||||
changeListenerList.add(new PortalPrefixUpdater(getServletContext(),
|
||||
request.getFullWebappDaoFactory().getPortalDao()));
|
||||
|
||||
epo.setPostDeletePageForwarder(new PortalDeletionPageForwarder(getServletContext(),pDao));
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
Class[] args = new Class[1];
|
||||
args[0] = int.class;
|
||||
epo.setGetMethod(pDao.getClass().getDeclaredMethod("getPortal",args));
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.error("PortalRetryController could not find the getPortalById method in the facade");
|
||||
}
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
foo.setErrorMap(epo.getErrMsgMap());
|
||||
|
||||
HashMap optionMap = new HashMap();
|
||||
|
||||
List tabList = FormUtils.makeOptionListFromBeans(tDao.getPrimaryTabs(portalForEditing.getPortalId()),"TabId","Title",Integer.valueOf(portalForEditing.getRootTabId()).toString(),null,portalForEditing.getRootTabId()>0);
|
||||
tabList.add(0,new Option("0","No Tab Yet",false));
|
||||
optionMap.put("RootTabId", tabList);
|
||||
|
||||
List flag1filteringList = new ArrayList(2);
|
||||
flag1filteringList.add( new Option("true", "true", currPortal.isFlag1Filtering()));
|
||||
flag1filteringList.add( new Option("false", "false", !currPortal.isFlag1Filtering()));
|
||||
optionMap.put("Flag1Filtering",flag1filteringList);
|
||||
|
||||
List<Option> themeOptions = getThemeOptions(portalForEditing);
|
||||
optionMap.put("ThemeDir", themeOptions);
|
||||
|
||||
foo.setOptionLists(optionMap);
|
||||
|
||||
epo.setFormObject(foo);
|
||||
|
||||
String html = FormUtils.htmlFormFromBean(portalForEditing,action,foo,epo.getBadValueMap());
|
||||
|
||||
Boolean singlePortal = new Boolean(request.getFullWebappDaoFactory().getPortalDao().isSinglePortal());
|
||||
request.setAttribute("singlePortal", singlePortal);
|
||||
request.setAttribute("creatingNewPortal", new Boolean(creatingNewPortal));
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
request.setAttribute("formJsp","/templates/edit/specific/portal_retry.jsp");
|
||||
request.setAttribute("scripts","/templates/edit/formBasic.js");
|
||||
if( singlePortal && ! creatingNewPortal )
|
||||
request.setAttribute("title","Site Information Editing Form");
|
||||
else
|
||||
request.setAttribute("title","Portal Editing Form");
|
||||
request.setAttribute("_action",action);
|
||||
request.setAttribute("unqualifiedClassName","Portal");
|
||||
setRequestAttributes(request,epo);
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error("PortalRetryController could not forward to view.");
|
||||
log.error(e.getMessage());
|
||||
log.error(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
private class PortalPrefixUpdater implements ChangeListener {
|
||||
|
||||
private ServletContext context;
|
||||
private PortalDao portalDao;
|
||||
|
||||
public PortalPrefixUpdater(ServletContext servletContext, PortalDao portalDao) {
|
||||
this.context = servletContext;
|
||||
this.portalDao = portalDao;
|
||||
}
|
||||
|
||||
// TODO: setupPortalMappings is not thread safe.
|
||||
// Should make it so if we expect to be calling this a lot
|
||||
public void doDeleted(Object oldObj, EditProcessObject epo) {
|
||||
PortalPickerFilter.getPortalPickerFilter(context).setupPortalMappings(portalDao.getAllPortals());
|
||||
}
|
||||
|
||||
public void doInserted(Object newObj, EditProcessObject epo) {
|
||||
PortalPickerFilter.getPortalPickerFilter(context).setupPortalMappings(portalDao.getAllPortals());
|
||||
}
|
||||
|
||||
public void doUpdated(Object oldObj, Object newObj,
|
||||
EditProcessObject epo) {
|
||||
if ( (oldObj instanceof Portal) && (newObj instanceof Portal) ) {
|
||||
Portal oldPortal = (Portal) oldObj;
|
||||
Portal newPortal = (Portal) newObj;
|
||||
boolean urlPrefixChanged = false;
|
||||
if ( (oldPortal.getUrlprefix() == null) && (newPortal.getUrlprefix() != null) ) {
|
||||
urlPrefixChanged = true;
|
||||
} else if ( (oldPortal.getUrlprefix() != null) && (newPortal.getUrlprefix() == null) ) {
|
||||
urlPrefixChanged = true;
|
||||
} else if ( (oldPortal.getUrlprefix() != null) && (newPortal.getUrlprefix() == null) && (!(oldPortal.getUrlprefix().equals(newPortal.getUrlprefix()))) ) {
|
||||
urlPrefixChanged = true;
|
||||
}
|
||||
if (urlPrefixChanged) {
|
||||
PortalPickerFilter.getPortalPickerFilter(context).setupPortalMappings(portalDao.getAllPortals());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PortalDeletionPageForwarder implements PageForwarder {
|
||||
|
||||
private static final String REDIRECT_PAGE = "/listPortals";
|
||||
|
||||
private ServletContext context;
|
||||
private PortalDao portalDao;
|
||||
|
||||
public PortalDeletionPageForwarder(ServletContext servletContext, PortalDao portalDao) {
|
||||
this.context = servletContext;
|
||||
this.portalDao = portalDao;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request,
|
||||
HttpServletResponse response, EditProcessObject epo) {
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal redirectPortal = vreq.getPortal();
|
||||
if (epo.getOriginalBean() instanceof Portal) {
|
||||
Portal deletedPortal = (Portal) epo.getOriginalBean();
|
||||
if (vreq.getPortal().getPortalId() == deletedPortal.getPortalId()) {
|
||||
redirectPortal = portalDao.getPortal(Portal.DEFAULT_PORTAL_ID);
|
||||
}
|
||||
}
|
||||
StringBuffer redirectPath = (new StringBuffer()).append(request.getContextPath());
|
||||
if (redirectPortal.getUrlprefix() != null) {
|
||||
redirectPath.append("/").append(redirectPortal.getUrlprefix()).append(REDIRECT_PAGE);
|
||||
} else {
|
||||
redirectPath.append(REDIRECT_PAGE).append("?home=").append(redirectPortal.getPortalId());
|
||||
}
|
||||
try {
|
||||
response.sendRedirect(redirectPath.toString());
|
||||
} catch (IOException ioe) {
|
||||
log.error("Unable to redirect to "+redirectPath);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Option objects for valid themes in the application, based on names of subdirectories
|
||||
* of the "/themes" directory.
|
||||
*
|
||||
* @return list of Options for valid themes
|
||||
*/
|
||||
private final List<Option> getThemeOptions(Portal portal) {
|
||||
|
||||
// Get the available themes
|
||||
ServletContext sc = getServletContext();
|
||||
boolean doSort = true;
|
||||
ArrayList<String> themeNames = ThemeUtils.getThemes(sc, doSort);
|
||||
|
||||
// Create the list of theme Options
|
||||
String currentThemeDir = portal.getThemeDir(); // the current value for the portal
|
||||
Iterator<String> i = themeNames.iterator();
|
||||
List<Option> themeOptions = new ArrayList<Option>(themeNames.size());
|
||||
String themeName, themeDir;
|
||||
boolean selected;
|
||||
while (i.hasNext()) {
|
||||
themeName = i.next();
|
||||
themeDir = "themes/" + themeName + "/";
|
||||
selected = themeDir.equals(currentThemeDir);
|
||||
themeOptions.add(new Option(themeDir, themeName, selected));
|
||||
}
|
||||
|
||||
return themeOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -43,7 +42,6 @@ public class PropertyEditController extends BaseEditController {
|
|||
final int NUM_COLS=17;
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
ObjectPropertyDao propDao = vreq.getFullWebappDaoFactory().getObjectPropertyDao();
|
||||
VClassDao vcDao = vreq.getFullWebappDaoFactory().getVClassDao();
|
||||
|
@ -83,7 +81,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
ObjectProperty parent = propDao.getObjectPropertyByURI(p.getParentURI());
|
||||
if (parent != null && parent.getURI() != null) {
|
||||
try {
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+parent.getLocalNameWithPrefix()+"</a>";
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"\">"+parent.getLocalNameWithPrefix()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {e.printStackTrace();}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +95,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
if (domainClass.isAnonymous()) {
|
||||
domainStr = domainClass.getLocalNameWithPrefix();
|
||||
} else {
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+domainClass.getLocalNameWithPrefix()+"</a>";
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"\">"+domainClass.getLocalNameWithPrefix()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {e.printStackTrace();}
|
||||
}
|
||||
|
@ -112,7 +110,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
if (rangeClass.isAnonymous()) {
|
||||
rangeStr = rangeClass.getLocalNameWithPrefix();
|
||||
} else {
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+rangeClass.getLocalNameWithPrefix()+"</a>";
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"\">"+rangeClass.getLocalNameWithPrefix()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {e.printStackTrace();}
|
||||
}
|
||||
|
@ -209,9 +207,8 @@ public class PropertyEditController extends BaseEditController {
|
|||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("propertyWebapp", p);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/props_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Object Property Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -19,7 +19,6 @@ import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -77,16 +76,10 @@ public class PropertyGroupRetryController extends BaseEditController {
|
|||
propertyGroupForEditing = (PropertyGroup) epo.getNewBean();
|
||||
}
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new PropertyGroupInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new PropertyGroupInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listPropertyGroups?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listPropertyGroups"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -128,14 +121,9 @@ public class PropertyGroupRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
class PropertyGroupInsertPageForwarder implements PageForwarder {
|
||||
private int portalId = 1;
|
||||
|
||||
public PropertyGroupInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newPropertyGroupUrl = "listPropertyGroups?home="+portalId;
|
||||
String newPropertyGroupUrl = "listPropertyGroups";
|
||||
try {
|
||||
response.sendRedirect(newPropertyGroupUrl);
|
||||
} catch (IOException ioe) {
|
||||
|
|
|
@ -28,12 +28,10 @@ import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
|||
import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vedit.validator.impl.XMLNameValidator;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionListener;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -120,19 +118,13 @@ public class PropertyRetryController extends BaseEditController {
|
|||
//set up any listeners
|
||||
List changeListenerList = new ArrayList();
|
||||
//changeListenerList.add(new HiddenFromDisplayListener(getServletContext()));
|
||||
changeListenerList.add(new PropertyRestrictionListener(getServletContext()));
|
||||
//changeListenerList.add(new PropertyRestrictionListener(getServletContext()));
|
||||
epo.setChangeListenerList(changeListenerList);
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new PropertyInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new PropertyInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of properties
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listPropertyWebapps?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listPropertyWebapps"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -251,14 +243,8 @@ public class PropertyRetryController extends BaseEditController {
|
|||
|
||||
class PropertyInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public PropertyInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newPropertyUrl = "propertyEdit?home="+portalId+"&uri=";
|
||||
String newPropertyUrl = "propertyEdit?uri=";
|
||||
ObjectProperty p = (ObjectProperty) epo.getNewBean();
|
||||
try {
|
||||
newPropertyUrl += URLEncoder.encode(p.getURI(),"UTF-8");
|
||||
|
|
|
@ -43,7 +43,6 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||
|
@ -60,13 +59,11 @@ public class RefactorOperationController extends BaseEditController {
|
|||
log.error(this.getClass().getName()+" caught exception calling doGet()");
|
||||
}
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp", Controllers.CHECK_DATATYPE_PROPERTIES);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Check Datatype Properties");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
|
||||
ontModel.enterCriticalSection(Lock.WRITE);
|
||||
|
@ -267,14 +264,10 @@ public class RefactorOperationController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
if (controllerStr != null) {
|
||||
int portalId = -1;
|
||||
try {
|
||||
portalId = request.getPortalId();
|
||||
} catch (Throwable t) {}
|
||||
try {
|
||||
newURIStr = URLEncoder.encode(newURIStr, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {}
|
||||
redirectStr = controllerStr+"?home="+((portalId>-1) ? portalId : "" )+"&uri="+newURIStr;
|
||||
redirectStr = controllerStr+"?uri="+newURIStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import edu.cornell.mannlib.vedit.util.FormUtils;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageTabs;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.TabIndividualRelation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
@ -51,7 +50,6 @@ public class TabEditController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
// we need to extract the keyword id from a Fetch parameter
|
||||
String tabIdStr = request.getParameter("id");
|
||||
|
@ -133,7 +131,7 @@ public class TabEditController extends BaseEditController {
|
|||
Tab parent = parentIt.next();
|
||||
Checkbox cb = new Checkbox();
|
||||
//cb.setBody(parent.getTitle());
|
||||
cb.setBody("<a href=\"tabEdit?home="+portal.getPortalId()+"&id="+parent.getTabId()+"\">"+parent.getTitle()+"</a>");
|
||||
cb.setBody("<a href=\"tabEdit?id="+parent.getTabId()+"\">"+parent.getTitle()+"</a>");
|
||||
cb.setValue(Integer.toString(parent.getTabId()));
|
||||
cb.setChecked(false);
|
||||
parentList.add(cb);
|
||||
|
@ -148,7 +146,7 @@ public class TabEditController extends BaseEditController {
|
|||
Checkbox cb = new Checkbox();
|
||||
cb.setValue(Integer.toString(child.getTabId()));
|
||||
//cb.setBody(child.getTitle());
|
||||
cb.setBody("<a href=\"tabEdit?home="+portal.getPortalId()+"&id="+child.getTabId()+"\">"+child.getTitle()+"</a>");
|
||||
cb.setBody("<a href=\"tabEdit?id="+child.getTabId()+"\">"+child.getTitle()+"</a>");
|
||||
cb.setChecked(false);
|
||||
childList.add(cb);
|
||||
}
|
||||
|
@ -199,9 +197,8 @@ public class TabEditController extends BaseEditController {
|
|||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("tab", t);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/tabs_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Tab Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -23,7 +23,6 @@ import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageTabs;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -56,13 +55,6 @@ public class TabRetryController extends BaseEditController {
|
|||
TabDao tDao = request.getFullWebappDaoFactory().getTabDao();
|
||||
epo.setDataAccessObject(tDao);
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
Tab tabForEditing = null;
|
||||
if (!epo.getUseRecycledBean()){
|
||||
if (request.getParameter("id") != null) {
|
||||
|
@ -77,7 +69,6 @@ public class TabRetryController extends BaseEditController {
|
|||
}
|
||||
} else {
|
||||
tabForEditing = new Tab();
|
||||
tabForEditing.setPortalId(currPortalId);
|
||||
}
|
||||
epo.setOriginalBean(tabForEditing);
|
||||
} else {
|
||||
|
@ -86,24 +77,10 @@ public class TabRetryController extends BaseEditController {
|
|||
log.error("using newBean");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make a simple mask for the class's id
|
||||
Object[] simpleMaskPair = new Object[2];
|
||||
simpleMaskPair[0]="Id";
|
||||
simpleMaskPair[1]=Integer.valueOf(tabForEditing.getPortalId());
|
||||
epo.getSimpleMask().add(simpleMaskPair);
|
||||
|
||||
|
||||
//set any validators
|
||||
|
||||
//set up any listeners
|
||||
|
||||
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new TabInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new TabInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of properties
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listTabs?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listTabs"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -167,14 +144,8 @@ public class TabRetryController extends BaseEditController {
|
|||
|
||||
class TabInsertPageForwarder implements PageForwarder {
|
||||
|
||||
private int portalId = 1;
|
||||
|
||||
public TabInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newTabUrl = "tabEdit?home="+portalId+"&id=";
|
||||
String newTabUrl = "tabEdit?id=";
|
||||
Tab tab = (Tab) epo.getNewBean();
|
||||
newTabUrl += tab.getTabId();
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,6 @@ import edu.cornell.mannlib.vedit.util.FormUtils;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManagePortals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.TabIndividualRelation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
@ -46,13 +45,6 @@ public class Tabs2EntsRetryController extends BaseEditController {
|
|||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
String action = "insert";
|
||||
|
||||
TabIndividualRelationDao t2eDao = request.getFullWebappDaoFactory().getTabs2EntsDao();
|
||||
|
@ -107,7 +99,7 @@ public class Tabs2EntsRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
HashMap optionMap = new HashMap();
|
||||
List<Tab> tabList = tDao.getAllManuallyLinkableTabs(currPortalId);
|
||||
List<Tab> tabList = tDao.getAllManuallyLinkableTabs(1);
|
||||
Collections.sort(tabList);
|
||||
optionMap.put("TabId", FormUtils.makeOptionListFromBeans(tabList, "TabId", "Title", Integer.toString(objectForEditing.getTabId()), null));
|
||||
if (objectForEditing.getEntURI() != null) {
|
||||
|
@ -142,7 +134,6 @@ public class Tabs2EntsRetryController extends BaseEditController {
|
|||
|
||||
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
|
|
|
@ -20,7 +20,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageTabs;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -37,7 +36,6 @@ public class Tabs2TabsRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest request = new VitroRequest(req);
|
||||
Portal portal = request.getPortal();
|
||||
|
||||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
@ -68,12 +66,12 @@ public class Tabs2TabsRetryController extends BaseEditController {
|
|||
HashMap hash = new HashMap();
|
||||
foo.setOptionLists(hash);
|
||||
if (parent != null ) {
|
||||
hash.put("ChildId", FormUtils.makeOptionListFromBeans(tDao.getTabsForPortalByTabtypes(portal.getPortalId(),false, parent.getTabtypeId()),"TabId","Title",null,null));
|
||||
hash.put("ChildId", FormUtils.makeOptionListFromBeans(tDao.getTabsForPortalByTabtypes(1,false, parent.getTabtypeId()),"TabId","Title",null,null));
|
||||
List parentList = new LinkedList();
|
||||
parentList.add(new Option(Integer.toString(parent.getTabId()),parent.getTitle(),true));
|
||||
hash.put("ParentId", parentList);
|
||||
} else if (child != null){
|
||||
hash.put("ParentId", FormUtils.makeOptionListFromBeans(tDao.getTabsForPortalByTabtypes(portal.getPortalId(),true,child.getTabtypeId()),"TabId","Title",null,null));
|
||||
hash.put("ParentId", FormUtils.makeOptionListFromBeans(tDao.getTabsForPortalByTabtypes(1,true,child.getTabtypeId()),"TabId","Title",null,null));
|
||||
List childList = new LinkedList();
|
||||
childList.add(new Option(Integer.toString(child.getTabId()),child.getTitle(),true));
|
||||
hash.put("ChildId", childList);
|
||||
|
|
|
@ -21,7 +21,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManagePortals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.TabVClassRelation;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
|
@ -45,13 +44,6 @@ public class Tabs2TypesRetryController extends BaseEditController {
|
|||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
|
||||
String action = "insert";
|
||||
|
||||
TabVClassRelationDao t2tDao = request.getFullWebappDaoFactory().getTabs2TypesDao();
|
||||
|
@ -109,7 +101,7 @@ public class Tabs2TypesRetryController extends BaseEditController {
|
|||
// }
|
||||
|
||||
HashMap optionMap = new HashMap();
|
||||
List<Tab> tabList = tDao.getAllAutolinkableTabs(currPortalId);
|
||||
List<Tab> tabList = tDao.getAllAutolinkableTabs(1);
|
||||
Collections.sort(tabList);
|
||||
optionMap.put("TabId", FormUtils.makeOptionListFromBeans(tabList, "TabId", "Title", request.getParameter("TabId"), null));
|
||||
List classGroups = cgDao.getPublicGroupsWithVClasses(true); // order by displayRank
|
||||
|
@ -129,7 +121,6 @@ public class Tabs2TypesRetryController extends BaseEditController {
|
|||
|
||||
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
|
|
|
@ -21,7 +21,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -47,7 +46,6 @@ public class UserEditController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
UserDao uDao = vreq.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
|
@ -120,9 +118,8 @@ public class UserEditController extends BaseEditController {
|
|||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("user", u);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/user_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","User Account Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -30,7 +30,6 @@ import edu.cornell.mannlib.vedit.validator.Validator;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.policy.setup.SelfEditingPolicySetup;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -99,16 +98,10 @@ public class UserRetryController extends BaseEditController {
|
|||
//set up any listeners
|
||||
epo.setChangeListenerList(Collections.singletonList(new UserPasswordChangeListener()));
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new UserInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new UserInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listUsers?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listUsers"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -197,15 +190,10 @@ public class UserRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
class UserInsertPageForwarder implements PageForwarder {
|
||||
private int portalId = 1;
|
||||
|
||||
public UserInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newUserUrl = "userEdit?home="+portalId+"&uri=";
|
||||
String newUserUrl = "userEdit?uri=";
|
||||
User u = (User) epo.getNewBean();
|
||||
try {
|
||||
newUserUrl += URLEncoder.encode(u.getURI(),"UTF-8");
|
||||
|
|
|
@ -22,7 +22,6 @@ import edu.cornell.mannlib.vedit.beans.FormObject;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -212,15 +211,13 @@ public class VclassEditController extends BaseEditController {
|
|||
|
||||
boolean instantiable = (vcl.getURI().equals(OWL.Nothing.getURI())) ? false : true;
|
||||
|
||||
Portal portal = (new VitroRequest(request)).getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
request.setAttribute("vclassWebapp", vcl);
|
||||
request.setAttribute("instantiable", instantiable);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/classes_edit.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("title","Class Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -28,7 +28,6 @@ import edu.cornell.mannlib.vedit.validator.impl.XMLNameValidator;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Classes2Classes;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -117,16 +116,10 @@ public class VclassRetryController extends BaseEditController {
|
|||
}
|
||||
epo.setChangeListenerList(changeListenerList);
|
||||
|
||||
//set portal flag to current portal
|
||||
Portal currPortal = (Portal) request.getAttribute("portalBean");
|
||||
int currPortalId = 1;
|
||||
if (currPortal != null) {
|
||||
currPortalId = currPortal.getPortalId();
|
||||
}
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new VclassInsertPageForwarder(currPortalId));
|
||||
epo.setPostInsertPageForwarder(new VclassInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("showClassHierarchy?home="+currPortalId));
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("showClassHierarchy"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
|
@ -218,14 +211,9 @@ public class VclassRetryController extends BaseEditController {
|
|||
}
|
||||
|
||||
class VclassInsertPageForwarder implements PageForwarder {
|
||||
private int portalId = 1;
|
||||
|
||||
public VclassInsertPageForwarder(int currPortalId) {
|
||||
portalId = currPortalId;
|
||||
}
|
||||
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newVclassUrl = "vclassEdit?home="+portalId+"&uri=";
|
||||
String newVclassUrl = "vclassEdit?uri=";
|
||||
VClass vcl = (VClass) epo.getNewBean();
|
||||
try {
|
||||
newVclassUrl += URLEncoder.encode(vcl.getURI(),"UTF-8");
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.apache.commons.lang.StringUtils;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -34,13 +33,11 @@ public class AllClassGroupsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
//need to figure out how to structure the results object to put the classes underneath
|
||||
|
||||
VClassGroupDao dao = vreq.getFullWebappDaoFactory().getVClassGroupDao();
|
||||
|
||||
List<VClassGroup> groups = dao.getPublicGroupsWithVClasses(); // uses an unfiltered dao so will see all classes
|
||||
List<VClassGroup> groups = dao.getPublicGroupsWithVClasses();
|
||||
// uses an unfiltered dao so will see all classes
|
||||
|
||||
List<String> results = new ArrayList<String>();
|
||||
results.add("XX");
|
||||
|
@ -57,7 +54,7 @@ public class AllClassGroupsListingController extends BaseEditController {
|
|||
publicName = "(unnamed group)";
|
||||
}
|
||||
try {
|
||||
results.add("<a href=\"./editForm?uri="+URLEncoder.encode(vcg.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"&controller=Classgroup\">"+publicName+"</a>");
|
||||
results.add("<a href=\"./editForm?uri="+URLEncoder.encode(vcg.getURI(),"UTF-8")+"&controller=Classgroup\">"+publicName+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(publicName);
|
||||
}
|
||||
|
@ -100,12 +97,10 @@ public class AllClassGroupsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(5));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Class Groups");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new class group");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "Classgroup");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -15,7 +15,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageTabs;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -33,7 +32,6 @@ public class AllTabsForPortalListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
HashMap<Integer, String> types = new HashMap<Integer, String>();
|
||||
types.put(18,"subcollection category");
|
||||
|
@ -44,7 +42,7 @@ public class AllTabsForPortalListingController extends BaseEditController {
|
|||
types.put(28,"primary tab");
|
||||
|
||||
TabDao dao = vrequest.getFullWebappDaoFactory().getTabDao();
|
||||
List<Tab> tabs = dao.getTabsForPortal(portal.getPortalId());
|
||||
List<Tab> tabs = dao.getTabsForPortal(1);
|
||||
Collections.sort(tabs, new TabComparator());
|
||||
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
|
@ -66,7 +64,7 @@ public class AllTabsForPortalListingController extends BaseEditController {
|
|||
for (Tab tab : tabs) {
|
||||
results.add("XX");
|
||||
if (tab.getTitle() != null)
|
||||
results.add("<a href=\"./tabEdit?id="+tab.getTabId()+"&home="+portal.getPortalId()+"\">"+tab.getTitle()+"</a>");
|
||||
results.add("<a href=\"./tabEdit?id="+tab.getTabId()+"\">"+tab.getTitle()+"</a>");
|
||||
else
|
||||
results.add("");
|
||||
results.add(String.valueOf(tab.getTabId()));
|
||||
|
@ -87,12 +85,10 @@ public class AllTabsForPortalListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(NUM_COLS));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Tabs");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new tab");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "Tab");
|
||||
request.setAttribute("home",portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -26,7 +26,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -54,7 +53,6 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
try {
|
||||
boolean inferred = (vrequest.getParameter("inferred") != null);
|
||||
|
@ -140,13 +138,10 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",NUM_COLS);
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title", (inferred) ? "Inferred Class Hierarchy" : "Class Hierarchy");
|
||||
request.setAttribute("portalBean", portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newClassParams=new HashMap<String,String>();
|
||||
newClassParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
String temp;
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
newClassParams.put("ontologyUri",temp);
|
||||
|
@ -154,7 +149,6 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
ButtonForm newClassButton = new ButtonForm(Controllers.VCLASS_RETRY_URL,"buttonForm","Add new class",newClassParams);
|
||||
buttons.add(newClassButton);
|
||||
HashMap<String,String> allClassParams=new HashMap<String,String>();
|
||||
allClassParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
allClassParams.put("ontologyUri",temp);
|
||||
}
|
||||
|
@ -162,7 +156,6 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
buttons.add(allClassButton);
|
||||
if (!inferred) {
|
||||
HashMap<String,String> inferParams=new HashMap<String,String>();
|
||||
inferParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
inferParams.put("ontologyUri",temp);
|
||||
}
|
||||
|
@ -171,7 +164,6 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
buttons.add(inferButton);
|
||||
} else {
|
||||
HashMap<String,String> inferParams=new HashMap<String,String>();
|
||||
inferParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
inferParams.put("ontologyUri",temp);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -54,7 +53,6 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
try {
|
||||
|
||||
dpDao = vrequest.getAssertionsWebappDaoFactory().getDataPropertyDao();
|
||||
|
@ -113,19 +111,17 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",NUM_COLS);
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title", "Data Property Hierarchy");
|
||||
request.setAttribute("portalBean", portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newPropParams=new HashMap<String,String>();
|
||||
newPropParams.put("controller", "Dataprop");
|
||||
newPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
|
||||
ButtonForm newPropButton = new ButtonForm(Controllers.RETRY_URL,"buttonForm","Add new data property",newPropParams);
|
||||
buttons.add(newPropButton);
|
||||
HashMap<String,String> allPropParams=new HashMap<String,String>();
|
||||
allPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
|
||||
String temp;
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
allPropParams.put("ontologyUri",temp);
|
||||
|
@ -192,7 +188,7 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
|
||||
String nameStr = dp.getPublicName()==null ? dp.getName()==null ? dp.getURI()==null ? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName();
|
||||
try {
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")/*+"&home="+portal.getPortalId()*/+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getLocalNameWithPrefix()+"</span>",results,numCols); // column 2
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getLocalNameWithPrefix()+"</span>",results,numCols); // column 2
|
||||
} catch (Exception e) {
|
||||
numCols=addColToResults(nameStr + " <i>" + dp.getLocalNameWithPrefix() + "</i>",results,numCols); // column 2
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntolo
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -30,7 +29,6 @@ public class DataPropertyStatementListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
String noResultsMsgStr = "No data properties found";
|
||||
|
||||
|
@ -89,7 +87,7 @@ public class DataPropertyStatementListingController extends BaseEditController {
|
|||
DataPropertyStatement dps = i.next();
|
||||
Individual subj = iDao.getIndividualByURI(dps.getIndividualURI());
|
||||
results.add("XX");
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(subj, portal));
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(subj));
|
||||
results.add(dp.getPublicName());
|
||||
results.add(dps.getData());
|
||||
}
|
||||
|
@ -104,9 +102,7 @@ public class DataPropertyStatementListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(4));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Data Property Statements");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -20,7 +20,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -40,7 +39,6 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
String noResultsMsgStr = "No data properties found";
|
||||
|
||||
|
@ -114,7 +112,7 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
results.add("XX"); // column 1
|
||||
String nameStr = prop.getPublicName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
try {
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getLocalNameWithPrefix()+"</span>"); // column 2
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getLocalNameWithPrefix()+"</span>"); // column 2
|
||||
} catch (Exception e) {
|
||||
results.add(nameStr + " <span style='font-style:italic; color:\"grey\";'>" + prop.getLocalNameWithPrefix() + "</span>"); // column 2
|
||||
}
|
||||
|
@ -124,7 +122,7 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
vc = vcDao.getVClassByURI(prop.getDomainClassURI());
|
||||
if (vc != null) {
|
||||
try {
|
||||
domainStr="<a href=\"vclassEdit?uri="+URLEncoder.encode(prop.getDomainClassURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+vc.getName()+"</a>";
|
||||
domainStr="<a href=\"vclassEdit?uri="+URLEncoder.encode(prop.getDomainClassURI(),"UTF-8")+"\">"+vc.getName()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -153,12 +151,10 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(NUM_COLS));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Data Properties");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new data property");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "Dataprop");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -17,7 +17,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -35,7 +34,6 @@ public class IndividualsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
//need to figure out how to structure the results object to put the classes underneath
|
||||
|
||||
|
@ -75,7 +73,7 @@ public class IndividualsListingController extends BaseEditController {
|
|||
if (ind.getName() != null) {
|
||||
try {
|
||||
String individualName = (ind.getName()==null || ind.getName().length()==0) ? ind.getURI() : ind.getName();
|
||||
results.add("<a href=\"./entityEdit?uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+individualName+"</a>");
|
||||
results.add("<a href=\"./entityEdit?uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"\">"+individualName+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(ind.getName());
|
||||
}
|
||||
|
@ -87,7 +85,7 @@ public class IndividualsListingController extends BaseEditController {
|
|||
if (vc != null) {
|
||||
try {
|
||||
String vclassName = (vc.getName()==null || vc.getName().length()==0) ? vc.getURI() : vc.getName();
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(vc.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+vclassName+"</a>");
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(vc.getURI(),"UTF-8")+"\">"+vclassName+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(vc.getName());
|
||||
}
|
||||
|
@ -109,17 +107,14 @@ public class IndividualsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(4));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title", "Individuals in Class "+ ( (vc != null) ? vc.getName() : vclassURI ) );
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
// request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
// request.setAttribute("horizontalJspAddButtonText", "Add new individual");
|
||||
// request.setAttribute("horizontalJspAddButtonControllerParam", "Individual");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
|
||||
// new individual button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newIndividualParams=new HashMap<String,String>();
|
||||
newIndividualParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
newIndividualParams.put("VClassURI",vclassURI);
|
||||
newIndividualParams.put("controller","Entity");
|
||||
ButtonForm newIndividualButton = new ButtonForm(Controllers.RETRY_URL,"buttonForm","Add instance",newIndividualParams);
|
||||
|
|
|
@ -10,18 +10,17 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
||||
public class ListingControllerWebUtils {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ListingControllerWebUtils.class.getName());
|
||||
|
||||
public static synchronized String formatIndividualLink(Individual ind, Portal portal) {
|
||||
public static synchronized String formatIndividualLink(Individual ind) {
|
||||
try {
|
||||
System.out.println(ind.getURI());
|
||||
String nameStr = (ind.getName() != null) ? ind.getName() : ind.getURI();
|
||||
return "<a href=\"entityEdit?uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+nameStr+"</a>";
|
||||
return "<a href=\"entityEdit?uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"\">"+nameStr+"</a>";
|
||||
} catch (NullPointerException npe) {
|
||||
return "?";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
@ -29,7 +28,7 @@ public class ListingControllerWebUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static synchronized String formatVClassLinks(List<VClass> vList, Portal portal) {
|
||||
public static synchronized String formatVClassLinks(List<VClass> vList) {
|
||||
String linksStr="";
|
||||
if (vList!=null) {
|
||||
int count=0;
|
||||
|
@ -38,7 +37,7 @@ public class ListingControllerWebUtils {
|
|||
if (count>0) linksStr += " | ";
|
||||
VClass vclass = (VClass) obj;
|
||||
try {
|
||||
linksStr += "<a href=\"vclassEdit?uri="+URLEncoder.encode(vclass.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+vclass.getName()+"</a>";
|
||||
linksStr += "<a href=\"vclassEdit?uri="+URLEncoder.encode(vclass.getURI(),"UTF-8")+"\">"+vclass.getName()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
linksStr += vclass.getName();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -52,7 +51,6 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
try {
|
||||
|
||||
opDao = vrequest.getAssertionsWebappDaoFactory().getObjectPropertyDao();
|
||||
|
@ -109,19 +107,15 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
request.setAttribute("columncount",NUM_COLS);
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title", "Object Property Hierarchy");
|
||||
request.setAttribute("portalBean", portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newPropParams=new HashMap<String,String>();
|
||||
newPropParams.put("controller", "Property");
|
||||
newPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
ButtonForm newPropButton = new ButtonForm(Controllers.RETRY_URL,"buttonForm","Add new object property",newPropParams);
|
||||
buttons.add(newPropButton);
|
||||
HashMap<String,String> allPropParams=new HashMap<String,String>();
|
||||
allPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
String temp;
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
allPropParams.put("ontologyUri",temp);
|
||||
|
|
|
@ -18,7 +18,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntolo
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
|
@ -34,7 +33,6 @@ public class ObjectPropertyStatementListingController extends
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
boolean assertedStatementsOnly = false;
|
||||
|
||||
|
@ -122,19 +120,19 @@ public class ObjectPropertyStatementListingController extends
|
|||
Individual subj = iDao.getIndividualByURI(ops.getSubjectURI());
|
||||
Individual obj = iDao.getIndividualByURI(ops.getObjectURI());
|
||||
results.add("XX");
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(subj,portal));
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(subj));
|
||||
if (showVClasses) {
|
||||
try {
|
||||
results.add(ListingControllerWebUtils.formatVClassLinks(subj.getVClasses(true),portal));
|
||||
results.add(ListingControllerWebUtils.formatVClassLinks(subj.getVClasses(true)));
|
||||
} catch (Exception e) {
|
||||
results.add("?");
|
||||
}
|
||||
}
|
||||
results.add(op.getDomainPublic());
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(obj,portal));
|
||||
results.add(ListingControllerWebUtils.formatIndividualLink(obj));
|
||||
if (showVClasses) {
|
||||
try {
|
||||
results.add(ListingControllerWebUtils.formatVClassLinks(obj.getVClasses(true),portal));
|
||||
results.add(ListingControllerWebUtils.formatVClassLinks(obj.getVClasses(true)));
|
||||
} catch (Exception e) {
|
||||
results.add("?");
|
||||
}
|
||||
|
@ -159,19 +157,15 @@ public class ObjectPropertyStatementListingController extends
|
|||
}
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Object Property Statements");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newPropParams=new HashMap<String,String>();
|
||||
newPropParams.put("controller", "Property");
|
||||
newPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
ButtonForm newPropButton = new ButtonForm(Controllers.RETRY_URL,"buttonForm","Add new object property",newPropParams);
|
||||
buttons.add(newPropButton);
|
||||
HashMap<String,String> rootPropParams=new HashMap<String,String>();
|
||||
rootPropParams.put("iffRoot", "true");
|
||||
rootPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
ButtonForm rootPropButton = new ButtonForm("showObjectPropertyHierarchy","buttonForm","root properties",rootPropParams);
|
||||
buttons.add(rootPropButton);
|
||||
request.setAttribute("topButtons", buttons);
|
||||
|
|
|
@ -14,7 +14,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
|
@ -28,7 +27,6 @@ public class OntologiesListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
//need to figure out how to structure the results object to put the classes underneath
|
||||
|
||||
|
@ -50,7 +48,7 @@ public class OntologiesListingController extends BaseEditController {
|
|||
if (ont.getName() != null) {
|
||||
try {
|
||||
String ontologyName = (ont.getName()==null || ont.getName().length()==0) ? ont.getURI() : ont.getName();
|
||||
results.add("<a href=\"./ontologyEdit?uri="+URLEncoder.encode(ont.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+ontologyName+"</a>");
|
||||
results.add("<a href=\"./ontologyEdit?uri="+URLEncoder.encode(ont.getURI(),"UTF-8")+"\">"+ontologyName+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(ont.getName());
|
||||
}
|
||||
|
@ -69,12 +67,10 @@ public class OntologiesListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(4));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Ontologies");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new ontology");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "Ontology");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit.listing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManagePortals;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PortalDao;
|
||||
|
||||
public class PortalsListingController extends BaseEditController {
|
||||
public static final Actions REQUIRED_ACTIONS = new Actions(new ManagePortals());
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, REQUIRED_ACTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
PortalDao dao = vrequest.getFullWebappDaoFactory().getPortalDao();
|
||||
|
||||
Collection<Portal> portals = dao.getAllPortals();
|
||||
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
results.add("XX");
|
||||
results.add("ID number");
|
||||
results.add("Portal");
|
||||
results.add("");
|
||||
|
||||
|
||||
if (portals != null) {
|
||||
for (Portal p : portals) {
|
||||
results.add("XX");
|
||||
results.add(Integer.toString(p.getPortalId()));
|
||||
if (p.getAppName() != null)
|
||||
try {
|
||||
String pName = (p.getAppName()==null || p.getAppName().length()==0) ? Integer.toString(p.getPortalId()) : p.getAppName();
|
||||
results.add("<a href=\"./editForm?id="+p.getPortalId()+"&controller=Portal&home="+portal.getPortalId()+"\">"+pName+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(p.getAppName());
|
||||
}
|
||||
else
|
||||
results.add("");
|
||||
StringBuffer portalPath = (new StringBuffer()).append(request.getContextPath());
|
||||
if (p.getUrlprefix() != null) {
|
||||
portalPath.append("/"+p.getUrlprefix());
|
||||
} else {
|
||||
portalPath.append("/?home=").append(p.getPortalId());
|
||||
}
|
||||
results.add("<a href=\""+portalPath.toString()+"\">visit this portal</a>");
|
||||
}
|
||||
request.setAttribute("results",results);
|
||||
}
|
||||
|
||||
request.setAttribute("columncount",new Integer(4));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Portals");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new portal");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "Portal");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -34,7 +33,6 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
//need to figure out how to structure the results object to put the classes underneath
|
||||
|
||||
|
@ -57,7 +55,7 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
results.add("XX");
|
||||
if (pg.getName() != null) {
|
||||
try {
|
||||
results.add("<a href=\"./editForm?uri="+URLEncoder.encode(pg.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"&controller=PropertyGroup\">"+pg.getName()+"</a>");
|
||||
results.add("<a href=\"./editForm?uri="+URLEncoder.encode(pg.getURI(),"UTF-8")+"&controller=PropertyGroup\">"+pg.getName()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(pg.getName());
|
||||
}
|
||||
|
@ -121,12 +119,10 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(5));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Property Groups");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new property group");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "PropertyGroup");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller.edit.listing;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -27,8 +25,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
@ -51,7 +47,6 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
String noResultsMsgStr = "No object properties found";
|
||||
|
||||
|
@ -164,7 +159,7 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
|
||||
String propNameStr = ObjectPropertyHierarchyListingController.getDisplayLabel(prop);
|
||||
try {
|
||||
results.add("<a href=\"./propertyEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">" + propNameStr + "</a>"); // column 1
|
||||
results.add("<a href=\"./propertyEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">" + propNameStr + "</a>"); // column 1
|
||||
} catch (Exception e) {
|
||||
results.add(propNameStr); // column 2
|
||||
}
|
||||
|
@ -198,20 +193,16 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(NUM_COLS));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Object Properties");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newPropParams=new HashMap<String,String>();
|
||||
newPropParams.put("controller", "Property");
|
||||
newPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
ButtonForm newPropButton = new ButtonForm(Controllers.RETRY_URL,"buttonForm","Add new object property",newPropParams);
|
||||
buttons.add(newPropButton);
|
||||
HashMap<String,String> rootPropParams=new HashMap<String,String>();
|
||||
rootPropParams.put("iffRoot", "true");
|
||||
rootPropParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
String temp;
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
rootPropParams.put("ontologyUri",temp);
|
||||
|
|
|
@ -15,7 +15,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -40,7 +39,6 @@ public class UsersListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
UserDao dao = vrequest.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
|
@ -68,7 +66,7 @@ public class UsersListingController extends BaseEditController {
|
|||
results.add("XX");
|
||||
if (user.getUsername() != null) {
|
||||
try {
|
||||
results.add("<a href=\"./userEdit?uri="+URLEncoder.encode(user.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+user.getUsername()+"</a>");
|
||||
results.add("<a href=\"./userEdit?uri="+URLEncoder.encode(user.getURI(),"UTF-8")+"\">"+user.getUsername()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(user.getUsername());
|
||||
}
|
||||
|
@ -103,12 +101,10 @@ public class UsersListingController extends BaseEditController {
|
|||
request.setAttribute("columncount", width);
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","User Accounts");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new user account");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "User");
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -18,7 +18,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -35,7 +34,6 @@ public class VClassWebappWithInstancesListingController extends BaseEditControll
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
String uriStr = request.getParameter("uri");
|
||||
|
||||
|
@ -108,7 +106,6 @@ public class VClassWebappWithInstancesListingController extends BaseEditControll
|
|||
request.setAttribute("columncount",new Integer(NUM_COLS));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Class Groups");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
|
|
|
@ -18,7 +18,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
|
@ -39,7 +38,6 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
//need to figure out how to structure the results object to put the classes underneath
|
||||
|
||||
|
@ -82,7 +80,7 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
if (cls.getName() != null)
|
||||
try {
|
||||
//String className = (cls.getName()==null || cls.getName().length()==0) ? cls.getURI() : cls.getName();
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"&home="+portal.getPortalId()+"\">"+cls.getLocalNameWithPrefix()+"</a>");
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"\">"+cls.getLocalNameWithPrefix()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(cls.getLocalNameWithPrefix());
|
||||
}
|
||||
|
@ -134,12 +132,10 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(NUM_COLS));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Classes");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
// new way of adding more than one button
|
||||
List <ButtonForm> buttons = new ArrayList<ButtonForm>();
|
||||
HashMap<String,String> newClassParams=new HashMap<String,String>();
|
||||
newClassParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
String temp;
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
newClassParams.put("ontologyUri",temp);
|
||||
|
@ -147,7 +143,6 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
ButtonForm newClassButton = new ButtonForm(Controllers.VCLASS_RETRY_URL,"buttonForm","Add new class",newClassParams);
|
||||
buttons.add(newClassButton);
|
||||
HashMap<String,String> hierClassParams=new HashMap<String,String>();
|
||||
hierClassParams.put("home", String.valueOf(portal.getPortalId()));
|
||||
if ( (temp=vrequest.getParameter("ontologyUri")) != null) {
|
||||
hierClassParams.put("ontologyUri",temp);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
@ -34,7 +33,6 @@ public class NamespacesListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
OntModel ontModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
||||
|
||||
|
@ -91,9 +89,7 @@ public class NamespacesListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(3));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Recognized Namespaces");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -30,7 +30,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -50,7 +49,6 @@ public class RestrictionsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
epo = super.createEpo(request);
|
||||
|
||||
|
@ -109,9 +107,7 @@ public class RestrictionsListingController extends BaseEditController {
|
|||
request.setAttribute("columncount",new Integer(5));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Restrictions");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
|
|
|
@ -1,166 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit.listing.jena;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.query.Query;
|
||||
import com.hp.hpl.jena.query.QueryExecution;
|
||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||
import com.hp.hpl.jena.query.QueryFactory;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
||||
public class StatementChangeListingController extends BaseEditController {
|
||||
|
||||
private class ResultRow implements Comparable {
|
||||
String stmt = "";
|
||||
String action = "";
|
||||
String time = "";
|
||||
public int compareTo(Object o) {
|
||||
return ((ResultRow)o).time.compareTo(this.time);
|
||||
}
|
||||
}
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new EditOntology()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
Portal portal = vrequest.getPortal();
|
||||
|
||||
try {
|
||||
|
||||
LoginStatusBean loginBean = LoginStatusBean.getBean(vrequest);
|
||||
|
||||
// TODO: need to make this more restrictive
|
||||
String userURI = (request.getParameter("userURI") != null) ? request.getParameter("userURI") : loginBean.getUserURI();
|
||||
|
||||
OntModel ontModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
||||
Model auditModel = (Model) request.getSession().getServletContext().getAttribute("jenaAuditModel");
|
||||
|
||||
UserDao dao = vrequest.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
User user = dao.getUserByURI(userURI);
|
||||
|
||||
ArrayList results = new ArrayList();
|
||||
request.setAttribute("results",results);
|
||||
results.add("XX");
|
||||
results.add("individual");
|
||||
results.add("action");
|
||||
results.add("date/time");
|
||||
|
||||
String EMPTY = "";
|
||||
|
||||
List<ResultRow> resultRows = new LinkedList<ResultRow>();
|
||||
|
||||
/*
|
||||
String queryStr = "PREFIX vitro: <"+ VitroVocabulary.vitroURI+"> " +
|
||||
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
|
||||
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" +
|
||||
"SELECT ?subj ?pred ?obj ?time " +
|
||||
"WHERE { " +
|
||||
" ?x rdf:type rdf:Statement ." +
|
||||
" ?x rdf:subject ?subj ." +
|
||||
" ?x rdf:predicate ?pred ." +
|
||||
" ?x rdf:object ?obj ." +
|
||||
" ?x vitro:addDate ?time . " +
|
||||
"}" +
|
||||
" ORDER BY DESC( ?time ) LIMIT 32 " ;
|
||||
*/
|
||||
|
||||
String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
|
||||
" PREFIX vitro: <"+VitroVocabulary.vitroURI+"> " +
|
||||
" SELECT ?individual ?dateTime " +
|
||||
" WHERE " +
|
||||
" { " +
|
||||
" ?editEvent vitro:editEventAgent <"+userURI+"> ." +
|
||||
" ?editEvent rdf:type vitro:IndividualEditEvent . " +
|
||||
" ?editEvent vitro:editedIndividual ?individual . " +
|
||||
" ?editEvent vitro:editEventDateTime ?dateTime . " +
|
||||
" } " +
|
||||
" ORDER BY DESC( ?dateTime ) LIMIT 100 ";
|
||||
|
||||
Query query = QueryFactory.create(queryStr);
|
||||
QueryExecution qe = QueryExecutionFactory.create(query,auditModel);
|
||||
ResultSet resultSet = qe.execSelect();
|
||||
|
||||
while (resultSet.hasNext()) {
|
||||
QuerySolution qs = (QuerySolution) resultSet.next();
|
||||
Resource ind = (Resource) qs.get("?individual");
|
||||
Literal time = (Literal) qs.get("?dateTime");
|
||||
ResultRow resultRow = new ResultRow();
|
||||
String stmtStr = "";
|
||||
try {
|
||||
stmtStr = "<a href=\"entity?home="+vrequest.getPortal().getPortalId()+"&uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"\">"+ontModel.getIndividual(ind.getURI()).getLabel(null)+"</a>";
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
stmtStr = ind.getLocalName();
|
||||
}
|
||||
resultRow.stmt = stmtStr;
|
||||
resultRow.action = "";
|
||||
resultRow.time = time.getString();
|
||||
resultRows.add(resultRow);
|
||||
}
|
||||
|
||||
Collections.sort(resultRows);
|
||||
|
||||
for (Iterator<ResultRow> rrIt = resultRows.iterator(); rrIt.hasNext();) {
|
||||
ResultRow rr = rrIt.next();
|
||||
results.add("XX");
|
||||
results.add(rr.stmt);
|
||||
results.add(rr.action);
|
||||
results.add(rr.time);
|
||||
}
|
||||
|
||||
|
||||
request.setAttribute("columncount",new Integer(4));
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","Individuals edited recently by "+user.getFirstName()+" "+user.getLastName());
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("home", portal.getPortalId());
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) {
|
||||
doGet(request,response);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,11 +8,10 @@ import java.util.Map;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import freemarker.template.Configuration;
|
||||
|
||||
public class AboutController extends FreemarkerHttpServlet {
|
||||
|
||||
|
@ -22,11 +21,11 @@ public class AboutController extends FreemarkerHttpServlet {
|
|||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
Portal portal = vreq.getPortal();
|
||||
ApplicationBean application = vreq.getAppBean();
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
body.put("aboutText", portal.getAboutText());
|
||||
body.put("acknowledgeText", portal.getAcknowledgeText());
|
||||
body.put("aboutText", application.getAboutText());
|
||||
body.put("acknowledgeText", application.getAcknowledgeText());
|
||||
|
||||
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
|
||||
}
|
||||
|
|
|
@ -39,15 +39,13 @@ public class BrowseController extends FreemarkerHttpServlet {
|
|||
if ( vreq.getParameter("clearcache") != null ) //mainly for debugging
|
||||
clearGroupCache();
|
||||
|
||||
int portalId = vreq.getPortalId();
|
||||
|
||||
List<VClassGroup> groups = null;
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||
if ( vcgc == null ) {
|
||||
log.error("Could not get VClassGroupCache");
|
||||
message = "The system is not configured correctly. Please check your logs for error messages.";
|
||||
} else {
|
||||
groups =vcgc.getGroups( vreq.getPortalId());
|
||||
groups =vcgc.getGroups();
|
||||
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
|
||||
for (VClassGroup group : groups) {
|
||||
vcgroups.add(new VClassGroupTemplateModel(group));
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
|
@ -36,8 +35,9 @@ public class ContactFormController extends FreemarkerHttpServlet {
|
|||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
String templateName;
|
||||
Portal portal = vreq.getPortal();
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
if (!ContactMailServlet.isSmtpHostConfigured(vreq)) {
|
||||
|
@ -47,35 +47,16 @@ public class ContactFormController extends FreemarkerHttpServlet {
|
|||
templateName = TEMPLATE_ERROR;
|
||||
}
|
||||
|
||||
else if (StringUtils.isEmpty(portal.getContactMail())) {
|
||||
else if (StringUtils.isEmpty(appBean.getContactMail())) {
|
||||
body.put("errorMessage",
|
||||
"The feedback form is currently disabled. In order to activate the form, a site administrator must provide a contact email address in the <a href='editForm?home=1&controller=Portal&id=1'>Site Configuration</a>");
|
||||
"The feedback form is currently disabled. In order to activate the form, a site administrator must provide a contact email address in the <a href='editForm?home=1&controller=ApplicationBean&id=1'>Site Configuration</a>");
|
||||
|
||||
templateName = TEMPLATE_ERROR;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
String portalType = null;
|
||||
int portalId = portal.getPortalId();
|
||||
String appName = portal.getAppName();
|
||||
|
||||
if ( (appBean.getMaxSharedPortalId()-appBean.getMinSharedPortalId()) > 1
|
||||
&& ( (portalId >= appBean.getMinSharedPortalId()
|
||||
&& portalId <= appBean.getMaxSharedPortalId() )
|
||||
|| portalId == appBean.getSharedPortalFlagNumeric() ) ) {
|
||||
portalType = "CALSResearch";
|
||||
} else if (appName.equalsIgnoreCase("CALS Impact")) {
|
||||
portalType = "CALSImpact";
|
||||
} else if (appName.equalsIgnoreCase("VIVO")){
|
||||
portalType = "VIVO";
|
||||
} else {
|
||||
portalType = "clone";
|
||||
}
|
||||
body.put("portalType", portalType);
|
||||
|
||||
body.put("portalId", portalId);
|
||||
String appName = appBean.getApplicationName();
|
||||
body.put("formAction", "submitFeedback");
|
||||
|
||||
if (vreq.getHeader("Referer") == null) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -73,10 +73,11 @@ public class ContactMailController extends FreemarkerHttpServlet {
|
|||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
String templateName = null;
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
String statusMsg = null; // holds the error status
|
||||
|
||||
if (smtpHost.isEmpty()) {
|
||||
|
@ -139,17 +140,17 @@ public class ContactMailController extends FreemarkerHttpServlet {
|
|||
String deliveryfrom = null;
|
||||
|
||||
if ("contact".equals(formType)) {
|
||||
if (portal.getContactMail() == null || portal.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address defined in current portal "+portal.getPortalId());
|
||||
if (appBean.getContactMail() == null || appBean.getContactMail().trim().length()==0) {
|
||||
log.error("No contact mail address defined");
|
||||
throw new Error(
|
||||
"To establish the Contact Us mail capability the system administrators must "
|
||||
+ "specify an email address in the current portal.");
|
||||
+ "specify an email address.");
|
||||
} else {
|
||||
deliverToArray = portal.getContactMail().split(",");
|
||||
deliverToArray = appBean.getContactMail().split(",");
|
||||
}
|
||||
deliveryfrom = "Message from the "+portal.getAppName()+" Contact Form";
|
||||
deliveryfrom = "Message from the " + appBean.getApplicationName() + " Contact Form";
|
||||
} else {
|
||||
deliverToArray = portal.getContactMail().split(",");
|
||||
deliverToArray = appBean.getContactMail().split(",");
|
||||
statusMsg = SPAM_MESSAGE ;
|
||||
spamReason = "The form specifies no delivery type.";
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ public class ContactMailController extends FreemarkerHttpServlet {
|
|||
log.error("recipientCount is 0 when DeliveryType specified as \""+formType+"\"");
|
||||
throw new Error(
|
||||
"To establish the Contact Us mail capability the system administrators must "
|
||||
+ "specify at least one email address in the current portal.");
|
||||
+ "specify at least one email address.");
|
||||
}
|
||||
|
||||
Configuration config = (Configuration) vreq.getAttribute("freemarkerConfig");
|
||||
|
|
|
@ -37,7 +37,6 @@ public class DumpTestController extends FreemarkerHttpServlet {
|
|||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
//Portal portal = vreq.getPortal();
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import javax.servlet.ServletContext;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import freemarker.cache.ClassTemplateLoader;
|
||||
|
@ -55,12 +55,17 @@ public class FreemarkerConfigurationLoader {
|
|||
}
|
||||
|
||||
public Configuration getConfig(VitroRequest vreq) {
|
||||
String themeDir = getThemeDir(vreq.getPortal());
|
||||
String themeDir = getThemeDir(vreq.getAppBean());
|
||||
return getConfigForTheme(themeDir);
|
||||
}
|
||||
|
||||
protected String getThemeDir(Portal portal) {
|
||||
return portal.getThemeDir().replaceAll("/$", "");
|
||||
protected String getThemeDir(ApplicationBean appBean) {
|
||||
if (appBean == null) {
|
||||
log.error("Cannot get themeDir from null application bean");
|
||||
} else if (appBean.getThemeDir() == null) {
|
||||
log.error("themeDir is null");
|
||||
}
|
||||
return appBean.getThemeDir().replaceAll("/$", "");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.commons.logging.LogFactory;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.RevisionInfoBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
|
@ -35,7 +34,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Red
|
|||
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.web.BreadCrumbsUtil;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.PortalWebUtil;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.Tags;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.menu.MainMenu;
|
||||
|
@ -236,8 +234,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
doTemplate(vreq, response, trv);
|
||||
}
|
||||
|
||||
public String getThemeDir(Portal portal) {
|
||||
return portal.getThemeDir().replaceAll("/$", "");
|
||||
public String getThemeDir(ApplicationBean appBean) {
|
||||
return appBean.getThemeDir().replaceAll("/$", "");
|
||||
}
|
||||
|
||||
// Define the URLs that are accessible to the templates. Note that we do not create menus here,
|
||||
|
@ -332,19 +330,18 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
// Ideally, templates wouldn't need portal id. Currently used as a hidden input value
|
||||
// in the site search box, so needed for now.
|
||||
map.put("portalId", portal.getPortalId());
|
||||
|
||||
String siteName = portal.getAppName();
|
||||
String siteName = appBean.getApplicationName();
|
||||
map.put("siteName", siteName);
|
||||
|
||||
// This may be overridden by the body data model received from the subcontroller.
|
||||
map.put("title", getTitle(siteName, vreq));
|
||||
|
||||
String themeDir = getThemeDir(portal);
|
||||
UrlBuilder urlBuilder = new UrlBuilder(portal);
|
||||
String themeDir = getThemeDir(appBean);
|
||||
UrlBuilder urlBuilder = new UrlBuilder(appBean);
|
||||
|
||||
map.put("urls", getUrls(themeDir, urlBuilder, vreq));
|
||||
|
||||
|
@ -360,25 +357,21 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
map.put("tabMenu", getTabMenu(vreq));
|
||||
map.put("menu", getDisplayModelMenu(vreq));
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
PortalWebUtil.populateSearchOptions(portal, appBean, vreq.getWebappDaoFactory().getPortalDao());
|
||||
PortalWebUtil.populateNavigationChoices(portal, vreq, appBean, vreq.getWebappDaoFactory().getPortalDao());
|
||||
|
||||
map.put("user", new User(vreq));
|
||||
|
||||
map.put("version", getRevisionInfo(urlBuilder));
|
||||
|
||||
map.put("copyright", getCopyrightInfo(portal));
|
||||
map.put("siteTagline", portal.getShortHand());
|
||||
map.put("copyright", getCopyrightInfo(appBean));
|
||||
map.put("siteTagline", appBean.getShortHand());
|
||||
map.put("breadcrumbs", BreadCrumbsUtil.getBreadCrumbsDiv(vreq));
|
||||
|
||||
// This value is used only in stylesheets.ftl and already contains the context path.
|
||||
map.put("stylesheetPath", UrlBuilder.getUrl(themeDir + "/css"));
|
||||
|
||||
String bannerImage = portal.getBannerImage();
|
||||
if ( ! StringUtils.isEmpty(bannerImage)) {
|
||||
map.put("bannerImage", UrlBuilder.getUrl(themeDir + "site_icons/" + bannerImage));
|
||||
}
|
||||
// String bannerImage = portal.getBannerImage();
|
||||
// if ( ! StringUtils.isEmpty(bannerImage)) {
|
||||
// map.put("bannerImage", UrlBuilder.getUrl(themeDir + "site_icons/" + bannerImage));
|
||||
// }
|
||||
|
||||
String flashMessage = DisplayMessage.getMessageAndClear(vreq);
|
||||
if (! flashMessage.isEmpty()) {
|
||||
|
@ -402,8 +395,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
private TabMenu getTabMenu(VitroRequest vreq) {
|
||||
int portalId = vreq.getPortal().getPortalId();
|
||||
return new TabMenu(vreq, portalId);
|
||||
return new TabMenu(vreq, 1);
|
||||
}
|
||||
|
||||
protected MainMenu getDisplayModelMenu(VitroRequest vreq){
|
||||
|
@ -411,10 +403,10 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
return vreq.getWebappDaoFactory().getMenuDao().getMainMenu(url);
|
||||
}
|
||||
|
||||
private final Map<String, Object> getCopyrightInfo(Portal portal) {
|
||||
private final Map<String, Object> getCopyrightInfo(ApplicationBean appBean) {
|
||||
|
||||
Map<String, Object> copyright = null;
|
||||
String copyrightText = portal.getCopyrightAnchor();
|
||||
String copyrightText = appBean.getCopyrightAnchor();
|
||||
if ( ! StringUtils.isEmpty(copyrightText) ) {
|
||||
copyright = new HashMap<String, Object>();
|
||||
copyright.put("text", copyrightText);
|
||||
|
@ -422,7 +414,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
//String thisYear = ((Integer)Calendar.getInstance().get(Calendar.YEAR)).toString(); // use ${copyrightYear} in template
|
||||
//SimpleDate thisYear = new SimpleDate(Calendar.getInstance().getTime(), TemplateDateModel.DATE); // use ${copyrightYear?string("yyyy")} in template
|
||||
copyright.put("year", thisYear);
|
||||
copyright.put("url", portal.getCopyrightURL());
|
||||
copyright.put("url", appBean.getCopyrightURL());
|
||||
}
|
||||
return copyright;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,16 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
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.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
||||
|
||||
public class HomePageController extends FreemarkerHttpServlet {
|
||||
|
@ -55,9 +51,7 @@ public class HomePageController extends FreemarkerHttpServlet {
|
|||
|
||||
// Get the home tab content for themes that display deprecated tabs
|
||||
private String getHomeTabContent(VitroRequest vreq) {
|
||||
Portal portal = vreq.getPortal();
|
||||
int tabId = portal.getRootTabId();
|
||||
Tab tab = vreq.getWebappDaoFactory().getTabDao().getTab(tabId,0,vreq.getAppBean());
|
||||
Tab tab = vreq.getWebappDaoFactory().getTabDao().getTab(1,0,vreq.getAppBean());
|
||||
String body = tab.getBody();
|
||||
if (body == null) {
|
||||
body = "";
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -15,7 +14,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -32,12 +30,10 @@ import com.hp.hpl.jena.vocabulary.RDF;
|
|||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
|
@ -679,72 +675,6 @@ public class IndividualController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
private ResponseValues doNotFound(VitroRequest vreq) throws IOException, ServletException {
|
||||
Portal portal = vreq.getPortal();
|
||||
ApplicationBean appBean = ApplicationBean.getAppBean(getServletContext());
|
||||
int allPortalId = appBean.getAllPortalFlagNumeric();
|
||||
|
||||
//If an Individual is not found, there is possibility that it
|
||||
//was requested from a portal where it was not visible.
|
||||
//In this case redirect to the all portal.
|
||||
try{
|
||||
Portal allPortal =
|
||||
vreq.getWebappDaoFactory().getPortalDao().getPortal(allPortalId);
|
||||
// there must be a portal defined with the ID of the all portal
|
||||
// for this to work
|
||||
if( portal.getPortalId() != allPortalId && allPortal != null ) {
|
||||
|
||||
//bdc34:
|
||||
// this is hard coded to get the all portal
|
||||
// I didn't find a way to get the id of the all portal
|
||||
// it is likely that redirecting will not work in non VIVO clones
|
||||
String portalPrefix = null;
|
||||
String portalParam = null;
|
||||
if( allPortal != null && allPortal.getUrlprefix() != null )
|
||||
portalPrefix = allPortal.getUrlprefix();
|
||||
else
|
||||
portalParam = "home=" + allPortalId;
|
||||
|
||||
String queryStr = vreq.getQueryString();
|
||||
if( queryStr == null && portalParam != null && !"".equals(portalParam)){
|
||||
queryStr = portalParam;
|
||||
} else {
|
||||
if( portalParam != null && !"".equals(portalParam))
|
||||
queryStr = queryStr + "&" + portalParam;
|
||||
}
|
||||
if( queryStr != null && !queryStr.startsWith("?") )
|
||||
queryStr = "?" + queryStr;
|
||||
|
||||
StringBuilder url = new StringBuilder();
|
||||
// url.append( vreq.getContextPath() );
|
||||
// if( vreq.getContextPath() != null && !vreq.getContextPath().endsWith("/"))
|
||||
// url.append('/');
|
||||
|
||||
if( portalPrefix != null && !"".equals(portalPrefix))
|
||||
url.append( portalPrefix ).append('/');
|
||||
|
||||
String servletPath = vreq.getServletPath();
|
||||
String spath = "";
|
||||
if( servletPath != null ){
|
||||
if( servletPath.startsWith("/") )
|
||||
spath = servletPath.substring(1);
|
||||
else
|
||||
spath = servletPath;
|
||||
}
|
||||
|
||||
if( spath != null && !"".equals(spath))
|
||||
url.append( spath );
|
||||
|
||||
if( vreq.getPathInfo() != null )
|
||||
url.append( vreq.getPathInfo() );
|
||||
|
||||
if( queryStr != null && !"".equals(queryStr ))
|
||||
url.append( queryStr );
|
||||
|
||||
return new RedirectResponseValues(url.toString());
|
||||
}
|
||||
}catch(Throwable th){
|
||||
log.error("could not do a redirect", th);
|
||||
}
|
||||
|
||||
//set title before we do the highlighting so we don't get markup in it.
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.apache.lucene.search.TermQuery;
|
|||
import org.apache.lucene.search.TopDocs;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.TabEntitiesController;
|
||||
|
@ -41,7 +40,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel;
|
||||
import freemarker.ext.beans.BeansWrapper;
|
||||
import freemarker.template.TemplateModel;
|
||||
|
@ -100,8 +98,6 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
|||
vclass.getURI(),
|
||||
page,
|
||||
alpha,
|
||||
vreq.getPortal(),
|
||||
vreq.getWebappDaoFactory().getPortalDao().isSinglePortal(),
|
||||
vreq.getWebappDaoFactory().getIndividualDao(),
|
||||
getServletContext());
|
||||
body.putAll(map);
|
||||
|
@ -180,16 +176,12 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
|||
* This method is now called in a couple of places. It should be refactored
|
||||
* into a DAO or similar object.
|
||||
*/
|
||||
public static Map<String,Object> getResultsForVClass(String vclassURI, int page, String alpha, Portal portal, boolean isSinglePortal, IndividualDao indDao, ServletContext context)
|
||||
public static Map<String,Object> getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context)
|
||||
throws CorruptIndexException, IOException, ServletException{
|
||||
Map<String,Object> rvMap = new HashMap<String,Object>();
|
||||
|
||||
int portalId = 1;
|
||||
if( portal != null )
|
||||
portalId = portal.getPortalId();
|
||||
|
||||
//make lucene query for this rdf:type
|
||||
Query query = getQuery(vclassURI,alpha, isSinglePortal, portalId);
|
||||
Query query = getQuery(vclassURI, alpha);
|
||||
|
||||
//execute lucene query for individuals of the specified type
|
||||
IndexSearcher index = LuceneIndexFactory.getIndexSearcher(context);
|
||||
|
@ -255,7 +247,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
|||
return rvMap;
|
||||
}
|
||||
|
||||
private static BooleanQuery getQuery(String vclassUri, String alpha , boolean isSinglePortal, int portalId){
|
||||
private static BooleanQuery getQuery(String vclassUri, String alpha){
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
try{
|
||||
//query term for rdf:type
|
||||
|
@ -263,24 +255,6 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
|||
new TermQuery( new Term(Entity2LuceneDoc.term.RDFTYPE, vclassUri)),
|
||||
BooleanClause.Occur.MUST );
|
||||
|
||||
//check for portal filtering
|
||||
if( ! isSinglePortal ){
|
||||
if( portalId < 16 ){ //could be a normal portal
|
||||
query.add(
|
||||
new TermQuery( new Term(Entity2LuceneDoc.term.PORTAL, Integer.toString(1 << portalId ))),
|
||||
BooleanClause.Occur.MUST);
|
||||
}else{ //could be a combined portal
|
||||
BooleanQuery tabQueries = new BooleanQuery();
|
||||
Long[] ids= FlagMathUtils.numeric2numerics(portalId);
|
||||
for( Long id : ids){
|
||||
tabQueries.add(
|
||||
new TermQuery( new Term(Entity2LuceneDoc.term.PORTAL,id.toString()) ),
|
||||
BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
query.add(tabQueries,BooleanClause.Occur.MUST);
|
||||
}
|
||||
}
|
||||
|
||||
//Add alpha filter if it is needed
|
||||
Query alphaQuery = null;
|
||||
if( alpha != null && !"".equals(alpha) && alpha.length() == 1){
|
||||
|
@ -291,7 +265,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
|||
|
||||
log.debug("Query: " + query);
|
||||
return query;
|
||||
}catch (Exception ex){
|
||||
} catch (Exception ex){
|
||||
log.error(ex,ex);
|
||||
return new BooleanQuery();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -12,7 +10,6 @@ import java.util.Map;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
|
@ -31,7 +28,6 @@ public class SamplesController extends FreemarkerHttpServlet {
|
|||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
// Test of #list directive in template on undefined, null, and empty values.
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvance
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.listing.AllTabsForPortalListingController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.listing.PortalsListingController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.listing.UsersListingController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
|
@ -54,7 +53,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getPortal());
|
||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getAppBean());
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditIndividuals())) {
|
||||
body.put("dataInput", getDataInputData(vreq));
|
||||
|
@ -128,14 +127,8 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
urls.put("users", urlBuilder.getPortalUrl("/listUsers"));
|
||||
}
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, PortalsListingController.REQUIRED_ACTIONS)) {
|
||||
if ((!vreq.getFullWebappDaoFactory().getPortalDao().isSinglePortal())) {
|
||||
urls.put("portals", urlBuilder.getPortalUrl("/listPortals"));
|
||||
}
|
||||
}
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditSiteInformation())) {
|
||||
urls.put("siteInfo", urlBuilder.getPortalUrl("/editForm", new ParamMap("controller", "Portal", "id", String.valueOf(urlBuilder.getPortalId()))));
|
||||
urls.put("siteInfo", urlBuilder.getPortalUrl("/editForm", new ParamMap("controller", "ApplicationBean")));
|
||||
}
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, MenuN3EditController.REQUIRED_ACTIONS)) {
|
||||
|
|
|
@ -5,11 +5,10 @@ package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
|
@ -22,16 +21,15 @@ public class TermsOfUseController extends FreemarkerHttpServlet {
|
|||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
Portal portal = vreq.getPortal();
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, String> termsOfUse = new HashMap<String, String>();
|
||||
|
||||
String rootBreadCrumbAnchor = portal.getRootBreadCrumbAnchor();
|
||||
String siteName = StringUtils.isEmpty(rootBreadCrumbAnchor) ? portal.getAppName() : rootBreadCrumbAnchor;
|
||||
termsOfUse.put("siteName", siteName);
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
String siteHost = portal.getCopyrightAnchor();
|
||||
termsOfUse.put("siteName", appBean.getApplicationName());
|
||||
|
||||
String siteHost = appBean.getCopyrightAnchor();
|
||||
if (siteHost == null) {
|
||||
siteHost = "the hosting institution";
|
||||
}
|
||||
|
|
|
@ -15,21 +15,19 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.openrdf.model.URI;
|
||||
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.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.filters.PortalPickerFilter;
|
||||
|
||||
public class UrlBuilder {
|
||||
|
||||
private static final Log log = LogFactory.getLog(UrlBuilder.class.getName());
|
||||
|
||||
protected static String contextPath = null;
|
||||
private static boolean addPortalParam = PortalPickerFilter.isPortalPickingActive();
|
||||
|
||||
private Portal portal;
|
||||
private ApplicationBean application;
|
||||
|
||||
public enum Route {
|
||||
ABOUT("/about"),
|
||||
|
@ -114,18 +112,15 @@ public class UrlBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public UrlBuilder(Portal portal) {
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public int getPortalId() {
|
||||
return portal.getPortalId();
|
||||
public UrlBuilder(ApplicationBean application) {
|
||||
this.application = application;
|
||||
}
|
||||
|
||||
public String getHomeUrl() {
|
||||
String rootBreadCrumbUrl = portal.getRootBreadCrumbURL();
|
||||
String path = StringUtils.isEmpty(rootBreadCrumbUrl) ? "" : rootBreadCrumbUrl;
|
||||
return getUrl(path);
|
||||
//String rootBreadCrumbUrl = application.getRootBreadCrumbURL();
|
||||
//String path = StringUtils.isEmpty(rootBreadCrumbUrl) ? "" : rootBreadCrumbUrl;
|
||||
//return getUrl(path);
|
||||
return getUrl("");
|
||||
}
|
||||
|
||||
// Used by templates to build urls.
|
||||
|
@ -141,18 +136,11 @@ public class UrlBuilder {
|
|||
return getPortalUrl(Route.LOGOUT);
|
||||
}
|
||||
|
||||
public ParamMap getPortalParam() {
|
||||
return new ParamMap("home", "" + portal.getPortalId());
|
||||
}
|
||||
|
||||
public String getPortalUrl(String path) {
|
||||
return addPortalParam ? getUrl(path, getPortalParam()) : getUrl(path);
|
||||
return getUrl(path);
|
||||
}
|
||||
|
||||
public String getPortalUrl(String path, ParamMap params) {
|
||||
if (addPortalParam) {
|
||||
params.putAll(getPortalParam());
|
||||
}
|
||||
return getUrl(path, params);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.hp.hpl.jena.rdf.model.ModelMaker;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaSpecialModelMaker;
|
||||
|
@ -82,20 +81,17 @@ public class JenaCsv2RdfController extends BaseEditController{
|
|||
}
|
||||
}
|
||||
|
||||
Portal portal = request.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
System.out.println(this.getClass().getName()+" could not forward to view.");
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println(e.getStackTrace());
|
||||
}
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
System.out.println(this.getClass().getName()+" could not forward to view.");
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
|
@ -620,10 +619,8 @@ public class JenaIngestController extends BaseEditController {
|
|||
request.setAttribute("bodyJsp",INGEST_MENU_JSP);
|
||||
}
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -36,7 +36,6 @@ import com.hp.hpl.jena.shared.Lock;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaSpecialModelMaker;
|
||||
|
@ -140,10 +139,8 @@ public class JenaXMLFileUpload extends BaseEditController {
|
|||
|
||||
request.setAttribute("fileItems",request.getFiles());
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, resp);
|
||||
|
@ -169,10 +166,8 @@ public class JenaXMLFileUpload extends BaseEditController {
|
|||
|
||||
request.setAttribute("models", null);
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -4,8 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.controller.jena;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -32,7 +30,6 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
@ -74,8 +71,6 @@ public class RDFUploadController extends BaseEditController {
|
|||
return;
|
||||
}
|
||||
|
||||
Portal currentPortal = request.getPortal();
|
||||
|
||||
boolean remove = "remove".equals(request.getParameter("mode"));
|
||||
String verb = remove?"Removed":"Added";
|
||||
|
||||
|
@ -87,28 +82,6 @@ public class RDFUploadController extends BaseEditController {
|
|||
// a temporary in-memory model
|
||||
boolean directRead = ("directAddABox".equals(request.getParameter("mode")));
|
||||
|
||||
int[] portalArray = null;
|
||||
String individualCheckIn = request.getParameter("checkIndividualsIntoPortal");
|
||||
if (individualCheckIn != null) {
|
||||
if (individualCheckIn.equals("current")) {
|
||||
portalArray = new int[1];
|
||||
portalArray[0] = currentPortal.getPortalId();
|
||||
} else if (individualCheckIn.equals("all")) {
|
||||
try {
|
||||
Collection<Portal> portalCollection = request.getFullWebappDaoFactory().getPortalDao().getAllPortals();
|
||||
portalArray = new int[portalCollection.size()];
|
||||
int index = 0;
|
||||
for (Iterator<Portal> pit = portalCollection.iterator(); pit.hasNext(); ) {
|
||||
Portal p = pit.next();
|
||||
portalArray[index] = p.getPortalId();
|
||||
index++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String uploadDesc ="";
|
||||
|
||||
OntModel uploadModel = (directRead)
|
||||
|
@ -174,11 +147,22 @@ public class RDFUploadController extends BaseEditController {
|
|||
Model aboxChangeModel=null;
|
||||
if (tboxModel != null) {
|
||||
tboxChangeModel = xutil.extractTBox(uploadModel);
|
||||
tboxstmtCount = operateOnModel(request.getFullWebappDaoFactory(), tboxModel,tboxChangeModel,remove,makeClassgroups,portalArray,loginBean.getUserURI());
|
||||
tboxstmtCount = operateOnModel(
|
||||
request.getFullWebappDaoFactory(),
|
||||
tboxModel,tboxChangeModel,
|
||||
remove,
|
||||
makeClassgroups,
|
||||
loginBean.getUserURI());
|
||||
}
|
||||
if (aboxModel != null) {
|
||||
aboxChangeModel = uploadModel.remove(tboxChangeModel);
|
||||
aboxstmtCount = operateOnModel(request.getFullWebappDaoFactory(), aboxModel,aboxChangeModel,remove,makeClassgroups,portalArray,loginBean.getUserURI());
|
||||
aboxstmtCount = operateOnModel(
|
||||
request.getFullWebappDaoFactory(),
|
||||
aboxModel,
|
||||
aboxChangeModel,
|
||||
remove,
|
||||
makeClassgroups,
|
||||
loginBean.getUserURI());
|
||||
}
|
||||
request.setAttribute("uploadDesc", uploadDesc + ". " + verb + " " + (tboxstmtCount + aboxstmtCount) + " statements.");
|
||||
} else {
|
||||
|
@ -187,9 +171,8 @@ public class RDFUploadController extends BaseEditController {
|
|||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/upload_rdf_result.jsp");
|
||||
request.setAttribute("portalBean",currentPortal);
|
||||
request.setAttribute("title","Ingest RDF Data");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+currentPortal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
@ -218,10 +201,9 @@ public class RDFUploadController extends BaseEditController {
|
|||
request.setAttribute("title","Load RDF Data");
|
||||
request.setAttribute("bodyJsp",LOAD_RDF_DATA_JSP);
|
||||
}
|
||||
Portal portal = request.getPortal();
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
@ -233,21 +215,22 @@ public class RDFUploadController extends BaseEditController {
|
|||
|
||||
}
|
||||
|
||||
private long operateOnModel(WebappDaoFactory webappDaoFactory, OntModel mainModel, Model changesModel, boolean remove, boolean makeClassgroups, int[] portal, String userURI) {
|
||||
private long operateOnModel(WebappDaoFactory webappDaoFactory,
|
||||
OntModel mainModel,
|
||||
Model changesModel,
|
||||
boolean remove,
|
||||
boolean makeClassgroups,
|
||||
String userURI) {
|
||||
mainModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
mainModel.getBaseModel().notifyEvent(new EditEvent(userURI,true));
|
||||
try {
|
||||
if (makeClassgroups) {
|
||||
Model classgroupModel =
|
||||
JenaModelUtils.makeClassGroupsFromRootClasses(webappDaoFactory, changesModel, changesModel);
|
||||
JenaModelUtils.makeClassGroupsFromRootClasses(
|
||||
webappDaoFactory, changesModel, changesModel);
|
||||
mainModel.add(classgroupModel);
|
||||
}
|
||||
if (!remove && portal != null && portal.length>0) {
|
||||
for (int i=0; i<portal.length; i++) {
|
||||
JenaModelUtils.checkAllIndividualsInModelIntoPortal(changesModel, changesModel, portal[i]);
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
mainModel.remove(changesModel);
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.apache.commons.logging.LogFactory;
|
|||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
||||
|
@ -22,19 +21,17 @@ public class RDFUploadFormController extends BaseEditController {
|
|||
|
||||
@Override
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new UseAdvancedDataToolsPages()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
|
||||
Portal portal = vreq.getPortal();
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/upload_rdf.jsp");
|
||||
request.setAttribute("portalBean",portal);
|
||||
request.setAttribute("singlePortal", new Boolean(vreq.getWebappDaoFactory().getPortalDao().isSinglePortal() ));
|
||||
request.setAttribute("title","Ingest RDF Data");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
|
|
|
@ -4,11 +4,13 @@ package edu.cornell.mannlib.vitro.webapp.dao;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
|
||||
public interface ApplicationDao {
|
||||
|
||||
public boolean isFlag1Active();
|
||||
public ApplicationBean getApplicationBean();
|
||||
|
||||
public boolean isFlag2Active();
|
||||
public void updateApplicationBean(ApplicationBean appBean);
|
||||
|
||||
public List<String> getExternallyLinkedNamespaces();
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.dao;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: bdc34
|
||||
* Date: Apr 18, 2007
|
||||
* Time: 4:33:16 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface PortalDao {
|
||||
Portal getPortal(int id );
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Portal> getAllPortals();
|
||||
|
||||
void deletePortal(Portal portal);
|
||||
|
||||
void deletePortal(int portalId);
|
||||
|
||||
int insertPortal(Portal portal) throws InsertException;
|
||||
|
||||
void updatePortal(Portal portal);
|
||||
|
||||
public Portal getPortalByURI(String uri);
|
||||
|
||||
public boolean isSinglePortal();
|
||||
|
||||
}
|
|
@ -140,15 +140,8 @@ public class VitroVocabulary {
|
|||
// ================== Vitro Application vocabulary =====================
|
||||
|
||||
public static final String APPLICATION = vitroURI + "Application";
|
||||
public static final String APPLICATION_FLAG1NAME = vitroURI+"flag1Name";
|
||||
public static final String APPLICATION_FLAG2NAME = vitroURI+"flag2Name";
|
||||
public static final String APPLICATION_FLAG3NAME = vitroURI+"flag3Name";
|
||||
public static final String APPLICATION_MINSHAREDPORTALID = vitroURI+"minSharedPortalId";
|
||||
public static final String APPLICATION_MAXSHAREDPORTALID = vitroURI+"maxSharedPortalId";
|
||||
public static final String APPLICATION_KEYWORDHEADING = vitroURI+"keywordHeading";
|
||||
public static final String APPLICATION_ROOTLOGOTYPEIMAGE = vitroURI+"rootLogotypeImage";
|
||||
public static final String APPLICATION_ONLYCURRENT = vitroURI+"onlyCurrent";
|
||||
public static final String APPLICATION_MAXPORTALID = vitroURI+"maxPortalId";
|
||||
|
||||
// ================== Vitro Portal vocabulary ===========================
|
||||
|
||||
|
@ -156,8 +149,6 @@ public class VitroVocabulary {
|
|||
public static final String PORTAL_ROOTTAB = vitroURI+"rootTab";
|
||||
public static final String PORTAL_THEMEDIR = vitroURI+"themeDir";
|
||||
public static final String PORTAL_BANNERIMAGE = vitroURI+"bannerImage";
|
||||
public static final String PORTAL_FLAG2VALUES = vitroURI+"flag2Values";
|
||||
public static final String PORTAL_FLAG1VALUES = vitroURI+"flag1Values";
|
||||
public static final String PORTAL_CONTACTMAIL = vitroURI+"contactMail";
|
||||
public static final String PORTAL_CORRECTIONMAIL = vitroURI+"correctionMail";
|
||||
public static final String PORTAL_SHORTHAND = vitroURI+"shortHand";
|
||||
|
@ -165,9 +156,6 @@ public class VitroVocabulary {
|
|||
public static final String PORTAL_ACKNOWLEGETEXT = vitroURI+"acknowledgeText";
|
||||
public static final String PORTAL_BANNERWIDTH = vitroURI+"bannerWidth";
|
||||
public static final String PORTAL_BANNERHEIGHT = vitroURI+"bannerHeight";
|
||||
public static final String PORTAL_FLAG3VALUES = vitroURI+"flag3Values";
|
||||
public static final String PORTAL_FLAG2NUMERIC = vitroURI+"flag2Numeric";
|
||||
public static final String PORTAL_FLAG3NUMERIC = vitroURI+"flag3Numeric";
|
||||
public static final String PORTAL_COPYRIGHTURL = vitroURI+"copyrightURL";
|
||||
public static final String PORTAL_COPYRIGHTANCHOR = vitroURI+"copyrightAnchor";
|
||||
public static final String PORTAL_ROOTBREADCRUMBURL = vitroURI+"rootBreadCrumbURL";
|
||||
|
@ -177,11 +165,7 @@ public class VitroVocabulary {
|
|||
public static final String PORTAL_LOGOTYPEWIDTH = vitroURI+"logotypeWidth";
|
||||
public static final String PORTAL_IMAGETHUMBWIDTH = vitroURI+"imageThumbWidth";
|
||||
// reusing displayRank property above
|
||||
public static final String PORTAL_FLAG1SEARCHFILTERING = vitroURI+"flag1SearchFiltering";
|
||||
public static final String PORTAL_FLAG2SEARCHFILTERING = vitroURI+"flag2SearchFiltering";
|
||||
public static final String PORTAL_FLAG3SEARCHFILTERING = vitroURI+"flag3SearchFiltering";
|
||||
public static final String PORTAL_URLPREFIX = vitroURI + "urlPrefix";
|
||||
public static final String PORTAL_FLAG1FILTERING = vitroURI+"flag1Filtering";
|
||||
|
||||
// ================ Vitro Tab vocabulary ================================
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ public interface WebappDaoFactory {
|
|||
/* ======================== DAOs for other objects ======================== */
|
||||
|
||||
public ApplicationDao getApplicationDao();
|
||||
public PortalDao getPortalDao();
|
||||
|
||||
public TabDao getTabDao();
|
||||
public TabIndividualRelationDao getTabs2EntsDao();
|
||||
|
|
|
@ -235,36 +235,6 @@ public class IndividualFiltering implements Individual {
|
|||
return _innerIndividual.getField(fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlag1Numeric() {
|
||||
return _innerIndividual.getFlag1Numeric();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlag1Set() {
|
||||
return _innerIndividual.getFlag1Set();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlag2Numeric() {
|
||||
return _innerIndividual.getFlag2Numeric();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlag2Set() {
|
||||
return _innerIndividual.getFlag2Set();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlag3Numeric() {
|
||||
return _innerIndividual.getFlag3Numeric();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlag3Set() {
|
||||
return _innerIndividual.getFlag3Set();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMainImageUri() {
|
||||
return _innerIndividual.getMainImageUri();
|
||||
|
@ -423,36 +393,6 @@ public class IndividualFiltering implements Individual {
|
|||
_innerIndividual.setExternalIds(externalIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag1Numeric(int i) {
|
||||
_innerIndividual.setFlag1Numeric(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag1Set(String in) {
|
||||
_innerIndividual.setFlag1Set(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag2Numeric(int i) {
|
||||
_innerIndividual.setFlag2Numeric(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag2Set(String in) {
|
||||
_innerIndividual.setFlag2Set(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag3Numeric(int i) {
|
||||
_innerIndividual.setFlag3Numeric(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag3Set(String in) {
|
||||
_innerIndividual.setFlag3Set(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainImageUri(String mainImageUri) {
|
||||
_innerIndividual.setMainImageUri(mainImageUri);
|
||||
|
@ -562,11 +502,6 @@ public class IndividualFiltering implements Individual {
|
|||
_innerIndividual.sortForDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesFlag1Match(int flagBitMask) {
|
||||
return _innerIndividual.doesFlag1Match(flagBitMask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Keyword> getKeywordObjects() {
|
||||
return _innerIndividual.getKeywordObjects();
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Set;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PortalDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.FiltersForTabs;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilterUtils;
|
||||
|
@ -22,11 +21,9 @@ public class TabDaoFiltering extends BaseFiltering implements TabDao{
|
|||
|
||||
final TabDao innerDao;
|
||||
final VitroFilters filters;
|
||||
private PortalDao innerPortalDao;
|
||||
private ApplicationDao applicationDao;
|
||||
|
||||
public TabDaoFiltering(TabDao tabDao, PortalDao portalDao, ApplicationDao applicationDao, VitroFilters filters) {
|
||||
this.innerPortalDao = portalDao;
|
||||
public TabDaoFiltering(TabDao tabDao, ApplicationDao applicationDao, VitroFilters filters) {
|
||||
this.innerDao = tabDao;
|
||||
this.applicationDao = applicationDao;
|
||||
this.filters = filters;
|
||||
|
@ -198,7 +195,6 @@ public class TabDaoFiltering extends BaseFiltering implements TabDao{
|
|||
if( in.grabEntityFactory() == null )
|
||||
return in;
|
||||
else{
|
||||
boolean flag1Filtering = applicationDao.isFlag1Active(); //( !applicationDao.isFlag1Active() || innerPortalDao.getAllPortals().size() == 1 );
|
||||
|
||||
/* NOTICE: this does not use the individualFilter that was passed in the constructor
|
||||
it uses one based on the parameters of the tab. */
|
||||
|
@ -206,7 +202,7 @@ public class TabDaoFiltering extends BaseFiltering implements TabDao{
|
|||
TabEntityFactoryFiltering filteringFact =
|
||||
new TabEntityFactoryFiltering(
|
||||
in.grabEntityFactory(),
|
||||
FiltersForTabs.getFilterForTab( in, innerPortalDao.getPortal(in.getPortalId()), flag1Filtering ),
|
||||
FiltersForTabs.getFilterForTab( in, false ),
|
||||
new VitroFilterUtils.EntitySortTransform( in.getEntitySortField(),ascendingSort));
|
||||
in.placeEntityFactory(filteringFact);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PortalDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
||||
|
@ -134,7 +133,7 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
|
|||
public TabDao getTabDao() {
|
||||
if( filteringTabDao == null)
|
||||
filteringTabDao =
|
||||
new TabDaoFiltering(innerWebappDaoFactory.getTabDao(),innerWebappDaoFactory.getPortalDao(),innerWebappDaoFactory.getApplicationDao(),filters);
|
||||
new TabDaoFiltering(innerWebappDaoFactory.getTabDao(),innerWebappDaoFactory.getApplicationDao(),filters);
|
||||
return filteringTabDao;
|
||||
}
|
||||
|
||||
|
@ -213,10 +212,6 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
|
|||
return innerWebappDaoFactory.getApplicationDao();
|
||||
}
|
||||
|
||||
public PortalDao getPortalDao() {
|
||||
return innerWebappDaoFactory.getPortalDao();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
|
@ -12,17 +12,12 @@ import net.sf.jga.algorithms.Sort;
|
|||
import net.sf.jga.algorithms.Transform;
|
||||
import net.sf.jga.algorithms.Unique;
|
||||
import net.sf.jga.fn.UnaryFunctor;
|
||||
import net.sf.jga.fn.adaptor.AdaptorFunctors;
|
||||
import net.sf.jga.fn.logical.LogicalFunctors;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
|
||||
|
||||
/**
|
||||
* Static methods to help create commonly used filters.
|
||||
|
@ -33,7 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
|
|||
*/
|
||||
public class FiltersForTabs {
|
||||
public static final UnaryFunctor<Individual,String> firstLetterOfName = new FirstLetterOfEnt();
|
||||
public static UnaryFunctor<Individual,Boolean> getFilterForTab( final Tab tab, final Portal portalThatTabIsIn, final boolean isFlag1Filtering ){
|
||||
public static UnaryFunctor<Individual,Boolean> getFilterForTab( final Tab tab, final boolean isFlag1Filtering ){
|
||||
|
||||
DateTime now = new DateTime();
|
||||
UnaryFunctor<Individual,Boolean> entFilter = getTimeFilter(tab, now);
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hp.hpl.jena.ontology.Individual;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.listeners.StatementListener;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
|
@ -14,8 +15,9 @@ import com.hp.hpl.jena.rdf.model.Property;
|
|||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
||||
|
@ -35,30 +37,91 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao {
|
|||
getOntModelSelector().getDisplayModel().register(modelChangedListener);
|
||||
}
|
||||
|
||||
private String getApplicationResourceURI() {
|
||||
// TODO migrate to "application" in the resource URI
|
||||
return super.DEFAULT_NAMESPACE + "portal" + 1;
|
||||
}
|
||||
|
||||
public ApplicationBean getApplicationBean() {
|
||||
ApplicationBean application = new ApplicationBean();
|
||||
OntModel ontModel = getOntModelSelector().getApplicationMetadataModel();
|
||||
Individual appInd = ontModel.getIndividual(
|
||||
getApplicationResourceURI());
|
||||
if (appInd == null) {
|
||||
return application;
|
||||
}
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
|
||||
application.setApplicationName(appInd.getLabel(null));
|
||||
application.setAboutText(getPropertyStringValue(
|
||||
appInd, APPLICATION_ABOUTTEXT));
|
||||
application.setAcknowledgeText(getPropertyStringValue(
|
||||
appInd, APPLICATION_ACKNOWLEGETEXT));
|
||||
application.setContactMail(getPropertyStringValue(
|
||||
appInd, APPLICATION_CONTACTMAIL));
|
||||
application.setCorrectionMail(getPropertyStringValue(
|
||||
appInd, APPLICATION_CORRECTIONMAIL));
|
||||
application.setCopyrightAnchor(getPropertyStringValue(
|
||||
appInd, APPLICATION_COPYRIGHTANCHOR));
|
||||
application.setCopyrightURL(getPropertyStringValue(
|
||||
appInd, APPLICATION_COPYRIGHTURL));
|
||||
application.setThemeDir(getPropertyStringValue(
|
||||
appInd, APPLICATION_THEMEDIR));
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
} finally {
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
return application;
|
||||
}
|
||||
|
||||
public void updateApplicationBean(ApplicationBean application) {
|
||||
// TODO migrate to "application" in the resource URI
|
||||
OntModel ontModel = getOntModelSelector().getApplicationMetadataModel();
|
||||
Individual appInd = ontModel.getIndividual(
|
||||
getApplicationResourceURI());
|
||||
if (appInd == null) {
|
||||
appInd = getOntModel().createIndividual(
|
||||
getApplicationResourceURI(), PORTAL);
|
||||
}
|
||||
ontModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
appInd.setLabel(application.getApplicationName(), null);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_ABOUTTEXT, application.getAboutText(),
|
||||
ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_ACKNOWLEGETEXT,
|
||||
application.getAcknowledgeText(), ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_CONTACTMAIL,
|
||||
application.getContactMail(), ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_CORRECTIONMAIL,
|
||||
application.getCorrectionMail(), ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_COPYRIGHTANCHOR,
|
||||
application.getCopyrightAnchor(), ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_COPYRIGHTURL,
|
||||
application.getCopyrightURL(), ontModel);
|
||||
updatePropertyStringValue(
|
||||
appInd, APPLICATION_THEMEDIR,
|
||||
application.getThemeDir(), ontModel);
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
} finally {
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (modelChangedListener != null) {
|
||||
getOntModelSelector().getDisplayModel().unregister(modelChangedListener);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFlag1Active() {
|
||||
boolean somePortalIsFiltering=false;
|
||||
if (portalCount == null) {
|
||||
boolean active = false;
|
||||
for (Portal p : getWebappDaoFactory().getPortalDao().getAllPortals()) {
|
||||
if (p.isFlag1Filtering()) {
|
||||
somePortalIsFiltering = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return somePortalIsFiltering && getWebappDaoFactory().getPortalDao().getAllPortals().size() > 1;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFlag2Active() {
|
||||
return (getFlag2ValueMap().isEmpty()) ? false : true;
|
||||
}
|
||||
|
||||
private static final boolean CLEAR_CACHE = true;
|
||||
|
||||
public synchronized List<String> getExternallyLinkedNamespaces() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue