diff --git a/geoportal_1/README.md b/geoportal_1/README.md new file mode 100644 index 0000000..5236a2f --- /dev/null +++ b/geoportal_1/README.md @@ -0,0 +1,2 @@ +UC Berkeley Opengeoportal Fork +================================== diff --git a/geoportal_1/pom.xml b/geoportal_1/pom.xml index 22b5c78..deec34b 100644 --- a/geoportal_1/pom.xml +++ b/geoportal_1/pom.xml @@ -7,274 +7,300 @@ 1.2.RELEASE opengeoportal webapp http://opengeoportal.org - - - - maven2-repository.dev.java.net - Java.net repository - http://download.java.net/maven/2 - - - osgeo - Open Source Geospatial Foundation Repository - http://download.osgeo.org/webdav/geotools/ - - - - - 3.1.4.RELEASE - 3.1.4.RELEASE - 1.9.12 - UTF-8 - UTF-8 - - - - - org.springframework - spring-core - ${org.springframework.version} - + + - - + + 3.1.4.RELEASE + + 3.2.0.CI-SNAPSHOT + + 1.9.12 + UTF-8 + UTF-8 + + + + + + - - - org.springframework - spring-beans - ${org.springframework.version} - + + + org.springframework + spring-beans + ${org.springframework.version} + - - + - + - - - - + - - - - + - - - org.springframework - spring-oxm - ${org.springframework.version} - + + + org.springframework + spring-oxm + ${org.springframework.version} + - + - - org.springframework - spring-web - ${org.springframework.version} - + + org.springframework + spring-web + ${org.springframework.version} + - - org.springframework - spring-context - ${org.springframework.version} - + + org.springframework + spring-context + ${org.springframework.version} + - + - - org.springframework - spring-webmvc - ${org.springframework.version} - + + org.springframework + spring-webmvc + ${org.springframework.version} + - - + - - - org.springframework - spring-test - ${org.springframework.version} - test - + + org.springframework + spring-test + ${org.springframework.version} + test + - - - - org.apache.httpcomponents - httpcore - 4.2.1 - + + org.apache.httpcomponents + httpcore + 4.2.1 + - - org.apache.httpcomponents - httpclient - 4.2.1 - + + org.apache.httpcomponents + httpclient + 4.2.1 + - - junit - junit - 4.8.1 - test - + + junit + junit + 4.8.1 + test + - - org.seleniumhq.selenium - selenium-java - 2.20.0 - runtime - + + org.seleniumhq.selenium + selenium-java + 2.20.0 + runtime + - - - org.slf4j - jcl-over-slf4j - 1.6.6 - - - org.slf4j - slf4j-api - 1.6.6 - - - org.slf4j - slf4j-log4j12 - 1.6.6 - - - log4j - log4j - 1.2.14 - + + org.slf4j + jcl-over-slf4j + 1.6.6 + + + org.slf4j + slf4j-api + 1.6.6 + + + org.slf4j + slf4j-log4j12 + 1.6.6 + + + log4j + log4j + 1.2.14 + - - org.apache.solr - solr-solrj - 4.0.0 - - - org.springframework.security - spring-security-core - ${org.springframework.security.version} - - - org.springframework.security - spring-security-config - ${org.springframework.security.version} - - - org.springframework.security - spring-security-web - ${org.springframework.security.version} - - - org.springframework.security - spring-security-ldap - ${org.springframework.security.version} - - - org.codehaus.jackson - jackson-core-lgpl - ${jackson.version} - - - org.codehaus.jackson - jackson-mapper-lgpl - ${jackson.version} - - + + org.apache.solr + solr-solrj + 4.0.0 + + + + org.springframework.security + spring-security-core + ${org.springframework.security.version} + + + + org.springframework.security + spring-security-cas + ${org.springframework.security.version} + + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + + + org.springframework.security + spring-security-ldap + ${org.springframework.security.version} + + + org.codehaus.jackson + jackson-core-lgpl + ${jackson.version} + + + org.codehaus.jackson + jackson-mapper-lgpl + ${jackson.version} + + org.apache.commons commons-compress 1.4.1 - - - org.apache.httpcomponents - httpmime - 4.2.1 - - - javax.servlet - servlet-api - 2.5 - provided - - - com.thetransactioncompany - cors-filter - 1.6 - + + + org.apache.httpcomponents + httpmime + 4.2.1 + + + javax.servlet + servlet-api + 2.5 + provided + + + com.thetransactioncompany + cors-filter + 1.6 + opengeoportal - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.12 - - - - integration-test - verify - - - - + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.12 + + + + integration-test + verify + + + + - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + 1.6 1.6 - - - + + + diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Download/Methods/WfsDownloadMethod.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Download/Methods/WfsDownloadMethod.java index 9db1152..5a0995b 100644 --- a/geoportal_1/src/main/java/org/OpenGeoPortal/Download/Methods/WfsDownloadMethod.java +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Download/Methods/WfsDownloadMethod.java @@ -43,6 +43,8 @@ public String createDownloadRequest() throws Exception { //info needed: geometry column, bbox coords, epsg code, workspace & layername //all client bboxes should be passed as lat-lon coords. we will need to get the appropriate epsg code for the layer //in order to return the file in original projection to the user (will also need to transform the bbox) + + logger.info("Layer name in WfsDownloadMethod: " + this.currentLayer.getLayerNameNS()); String layerName = this.currentLayer.getLayerNameNS(); SolrRecord layerInfo = this.currentLayer.getLayerInfo(); BoundingBox nativeBounds = new BoundingBox(layerInfo.getMinX(), layerInfo.getMinY(), layerInfo.getMaxX(), layerInfo.getMaxY()); diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java index cc43290..422a968 100644 --- a/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java @@ -1,8 +1,16 @@ package org.OpenGeoPortal.Ogc.Wfs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.OpenGeoPortal.Download.Types.BoundingBox; public class WfsGetFeature { + + final static Logger logger = LoggerFactory.getLogger(WfsGetFeature.class); + + + public static String createWfsGetFeatureRequest(String layerName, String workSpace, String nameSpace, String outputFormat, String filter) throws Exception { return createWfsGetFeatureRequest(layerName, workSpace, nameSpace, -1, "", outputFormat, filter); @@ -26,9 +34,23 @@ private static String getAttributeString(String attrName, String value){ public static String createWfsGetFeatureRequest(String layerName, String workSpace, String nameSpace, int maxFeatures, String epsgCode, String outputFormat, String filter) throws Exception { - //--generate POST message - //info needed: geometry column, bbox coords, epsg code, workspace & layername + + logger.info("In createWfsGetFeatureRequest passed in, layerName: " + layerName + ", workSpace: " + workSpace); + + + //--generate POST message + //info needed: geometry column, bbox coords, epsg code, workspace & layername + if (!workSpace.trim().isEmpty()){ + if (layerName.contains(":")){ + layerName = layerName.substring(layerName.indexOf(":") + 1); + } + layerName = workSpace + ":" + layerName; + } else { + } + + + /* old code if (!workSpace.trim().isEmpty()){ layerName = workSpace + ":" + layerName; } else { @@ -36,11 +58,14 @@ public static String createWfsGetFeatureRequest(String layerName, String workSpa layerName = layerName.substring(layerName.indexOf(":")); } } + */ + logger.info("In createWfsGetFeatureRequest converted, layerName: " + layerName); + String getFeatureRequest = "" + ""; + logger.info("Feature Request: " + getFeatureRequest); + + return getFeatureRequest; } diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java~ b/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java~ new file mode 100644 index 0000000..422a968 --- /dev/null +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Ogc/Wfs/WfsGetFeature.java~ @@ -0,0 +1,112 @@ +package org.OpenGeoPortal.Ogc.Wfs; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.OpenGeoPortal.Download.Types.BoundingBox; + +public class WfsGetFeature { + + final static Logger logger = LoggerFactory.getLogger(WfsGetFeature.class); + + + + public static String createWfsGetFeatureRequest(String layerName, String workSpace, String nameSpace, String outputFormat, String filter) throws Exception { + return createWfsGetFeatureRequest(layerName, workSpace, nameSpace, -1, "", outputFormat, filter); + + } + + private static String getAttributeString(String attrName, int value){ + String attrString = ""; + if(value > 0){ + attrString = " " + attrName + "=\"" + Integer.toString(value) + "\""; + } + return attrString; + } + + private static String getAttributeString(String attrName, String value){ + String attrString = ""; + if(!value.trim().isEmpty()){ + attrString = " " + attrName + "=\"" + value.trim() + "\""; + } + return attrString; + } + + public static String createWfsGetFeatureRequest(String layerName, String workSpace, String nameSpace, int maxFeatures, String epsgCode, String outputFormat, String filter) throws Exception { + + + logger.info("In createWfsGetFeatureRequest passed in, layerName: " + layerName + ", workSpace: " + workSpace); + + + //--generate POST message + //info needed: geometry column, bbox coords, epsg code, workspace & layername + + if (!workSpace.trim().isEmpty()){ + if (layerName.contains(":")){ + layerName = layerName.substring(layerName.indexOf(":") + 1); + } + layerName = workSpace + ":" + layerName; + } else { + } + + + /* old code + if (!workSpace.trim().isEmpty()){ + layerName = workSpace + ":" + layerName; + } else { + if (layerName.contains(":")){ + layerName = layerName.substring(layerName.indexOf(":")); + } + } + */ + logger.info("In createWfsGetFeatureRequest converted, layerName: " + layerName); + + String getFeatureRequest = "" + + "" + + filter + + "" + + ""; + + logger.info("Feature Request: " + getFeatureRequest); + + + return getFeatureRequest; + } + + public static String getMethod(){ + return "POST"; + } + + private static String getNameSpaceString(String workSpace, String nameSpace){ + //if either is missing, skip the whole thing + String nsString = ""; + if (!workSpace.trim().isEmpty() && !nameSpace.trim().isEmpty()){ + nsString = " xmlns:" + workSpace + "=\"" + nameSpace + "\""; + } + return nsString; + } + + public static String getBboxFilter(BoundingBox bounds, String geometryColumn, int epsgCode){ + + String bboxFilter = "" + + "" + + "" + geometryColumn + "" + + bounds.generateGMLBox(epsgCode) + + "" + + ""; + + return bboxFilter; + } + + +} diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Security/IframeLoginController.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Security/IframeLoginController.java new file mode 100644 index 0000000..271b844 --- /dev/null +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Security/IframeLoginController.java @@ -0,0 +1,52 @@ +package org.OpenGeoPortal.Security; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import java.io.*; + +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.ObjectWriter; +//import com.fasterxml.jackson.core.JsonProcessingException; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import com.fasterxml.jackson.databind.ObjectWriter; + +@Controller +public class IframeLoginController { + @Autowired + @Qualifier("formLoginService") + LoginService loginService; + + private @Value("${ogp.domain}") String localDomain; + + final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @RequestMapping(value="restricted/weblogin", method=RequestMethod.GET) + @ResponseBody public ModelAndView getStatus() throws IOException { + logger.debug("Login status checked"); + + String sendingPage = localDomain; + //create the model to return + ModelAndView mav = new ModelAndView("iframeLogin"); + LoginStatus status = loginService.getStatus(); + + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String json = ow.writeValueAsString(status); + + //test + //json = json.replace("false", "true"); + mav.addObject("authStatus", json); + mav.addObject("sendingPage", sendingPage); + + return mav; + } + +} diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Security/SimpleCasUserService.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Security/SimpleCasUserService.java new file mode 100755 index 0000000..915d898 --- /dev/null +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Security/SimpleCasUserService.java @@ -0,0 +1,96 @@ +package org.OpenGeoPortal.Security; +/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.cas.userdetails.AbstractCasAssertionUserDetailsService; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.util.Assert; +import org.apache.commons.lang.ArrayUtils; +import org.jasig.cas.client.validation.Assertion; + +import java.util.List; +import java.util.ArrayList; + +/** +* Populates the {@link org.springframework.security.core.GrantedAuthority}s for a user by reading a list of attributes that were returned as +* part of the CAS response. Each attribute is read and each value of the attribute is turned into a GrantedAuthority. If the attribute has no +* value then its not added. +* +* --modified: if the user has been authenticated via CAS, they are granted the role "ROLE_USER". If the user is found in the admins list, they +* are also granted the role "ROLE_ADMIN". Note that at this point the admin user has no special privileges in the application. the addition is +* for future functionality and parity with the LDAP authorization as it stands. +* +* @author Scott Battaglia, modified Chris Barnett +* @since 3.0 +*/ +public final class SimpleCasUserService implements UserDetailsService { + + protected String admins; + protected String[] adminList; + final Logger logger = LoggerFactory.getLogger(this.getClass()); + + private static final String NON_EXISTENT_PASSWORD_VALUE = "NO_PASSWORD"; + + private String[] attributes = null; + + private boolean convertToUpperCase = true; + + public void setAdmins(String admins){ + admins = admins.replace(" ", ""); + adminList = admins.split(","); + } + + protected Boolean isAdmin(String username){ + return ArrayUtils.contains(adminList, username); + } + + + public SimpleCasUserService() {} + + public SimpleCasUserService(final String[] attributes) { + Assert.notNull(attributes, "attributes cannot be null.");//should null attributes be allowed, since we are not using CAS attributes for our roles? + // Assert.isTrue(attributes.length > 0, "At least one attribute is required to retrieve roles from."); + this.attributes = attributes; + } + + /** +* Converts the returned attribute values to uppercase values. +* +* @param convertToUpperCase true if it should convert, false otherwise. +*/ + public void setConvertToUpperCase(final boolean convertToUpperCase) { + this.convertToUpperCase = convertToUpperCase; + } + + public UserDetails loadUserByUsername(String userName) { + + final List grantedAuthorities = new ArrayList(); + if(userName == null || userName.equals("")) { + } else if(userName.equals("175219")) { + grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_ADMIN")); + } + + if(userName != null && !userName.equals("")) { + grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_USER")); + } + return new User(userName, NON_EXISTENT_PASSWORD_VALUE, true, true, true, true, grantedAuthorities); + } +} \ No newline at end of file diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/Http/HttpComponentsHttpRequester.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/Http/HttpComponentsHttpRequester.java index 2ebc143..079197a 100644 --- a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/Http/HttpComponentsHttpRequester.java +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/Http/HttpComponentsHttpRequester.java @@ -112,18 +112,19 @@ public InputStream sendRequest(String serviceURL, String requestString, return sendRequest(serviceURL, requestString, requestMethod, "text/xml"); } - protected InputStream sendPostRequest(String serviceURL, - String requestBody, String contentType) { + protected InputStream sendPostRequest(String serviceURL, String requestBody, String contentType) { HttpClient httpclient = ogpHttpClient.getHttpClient(); InputStream replyStream = null; + try { HttpPost httppost = new HttpPost(serviceURL); - logger.debug(requestBody); + logger.info("Request body in sendPostRequest: " + requestBody); StringEntity postEntity = new StringEntity(requestBody, ContentType.create(contentType, "UTF-8")); httppost.setEntity(postEntity); logger.info("executing POST request to " + httppost.getURI()); HttpResponse response = httpclient.execute(httppost); this.setStatus(response.getStatusLine().getStatusCode()); + logger.info("response in sendPostRequest: " + response.getStatusLine()); this.setHeaders(response.getAllHeaders()); HttpEntity entity = response.getEntity(); diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/JsonpCallbackFilter.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/JsonpCallbackFilter.java index 9bc0a61..bbc7845 100644 --- a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/JsonpCallbackFilter.java +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/JsonpCallbackFilter.java @@ -11,6 +11,8 @@ import java.io.OutputStream; import java.util.Map; +import java.util.Set; +import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -21,38 +23,60 @@ public class JsonpCallbackFilter implements Filter { - final Logger logger = LoggerFactory.getLogger(this.getClass()); + final Logger logger = LoggerFactory.getLogger(this.getClass()); - public void init(FilterConfig fConfig) throws ServletException {} + public void init(FilterConfig fConfig) throws ServletException {} - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest httpRequest = (HttpServletRequest) request; - HttpServletResponse httpResponse = (HttpServletResponse) response; + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - @SuppressWarnings("unchecked") - Map parms = httpRequest.getParameterMap(); - if(parms.containsKey("callback")) { - if(logger.isDebugEnabled()) - logger.debug("Wrapping response with JSONP callback '" + parms.get("callback")[0] + "'"); + System.out.println("In JsonpCallbackFilter"); - OutputStream out = httpResponse.getOutputStream(); + HttpServletRequest httpRequest = (HttpServletRequest) request; + HttpServletResponse httpResponse = (HttpServletResponse) response; - GenericResponseWrapper wrapper = new GenericResponseWrapper(httpResponse); + @SuppressWarnings("unchecked") + Map parms = httpRequest.getParameterMap(); - chain.doFilter(request, wrapper); + System.out.println("In JsonpCallbackFilter, the size of pmap is: " + parms.size()); - out.write(new String(parms.get("callback")[0] + "(").getBytes()); - out.write(wrapper.getData()); - out.write(new String(");").getBytes()); + Set keys = parms.keySet(); - wrapper.setContentType("text/javascript;charset=UTF-8"); + Iterator it = keys.iterator(); - out.close(); - } else { - chain.doFilter(request, response); - } - } + while(it.hasNext()) { + String key = (String)it.next(); - public void destroy() {} + System.out.println("Params in JsonpCallbackFilter:\n"); + System.out.println("\tKey: " + key); + String[] vals = parms.get(key); + for(int i = 0;i < vals.length;i++) { + System.out.println("\t\tValue: " + vals[i] + "\n"); + } + } + + if(parms.containsKey("callback")) { + // if(logger.isDebugEnabled()) + // logger.debug("Wrapping response with JSONP callback '" + parms.get("callback")[0] + "'"); + System.out.println("Wrapping response with JSONP callback '" + parms.get("callback")[0] + "'"); + + OutputStream out = httpResponse.getOutputStream(); + + GenericResponseWrapper wrapper = new GenericResponseWrapper(httpResponse); + + chain.doFilter(request, wrapper); + + out.write(new String(parms.get("callback")[0] + "(").getBytes()); + out.write(wrapper.getData()); + out.write(new String(");").getBytes()); + + wrapper.setContentType("text/javascript;charset=UTF-8"); + + out.close(); + } else { + chain.doFilter(request, response); } + } + + public void destroy() {} +} diff --git a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/ParseJSONSolrLocationField.java b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/ParseJSONSolrLocationField.java index e04c793..15a98b8 100644 --- a/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/ParseJSONSolrLocationField.java +++ b/geoportal_1/src/main/java/org/OpenGeoPortal/Utilities/ParseJSONSolrLocationField.java @@ -18,16 +18,21 @@ public final class ParseJSONSolrLocationField { final static Logger logger = LoggerFactory.getLogger(ParseJSONSolrLocationField.class.getName()); public static String getWmsUrl(String locationField) throws JsonParseException{ + logger.info("Returning WmsUrl: " + parseLocationFromPath(locationField, "wms").get(0)); return parseLocationFromPath(locationField, "wms").get(0); } public static String getTilecacheUrl(String locationField) throws JsonParseException{ + return parseLocationFromPath(locationField, "tilecache").get(0); } public static String getWfsUrl(String locationField) throws JsonParseException{ + + logger.info("Returning WfsUrl: " + parseLocationFromPath(locationField, "wfs").get(0)); + return parseLocationFromPath(locationField, "wfs").get(0); } diff --git a/geoportal_1/src/main/webapp/WEB-INF/appServlet-servlet.xml b/geoportal_1/src/main/webapp/WEB-INF/appServlet-servlet.xml index 1b28fa1..ebdb540 100644 --- a/geoportal_1/src/main/webapp/WEB-INF/appServlet-servlet.xml +++ b/geoportal_1/src/main/webapp/WEB-INF/appServlet-servlet.xml @@ -14,6 +14,17 @@ + + + + + + + + + + + diff --git a/geoportal_1/src/main/webapp/WEB-INF/download.xml b/geoportal_1/src/main/webapp/WEB-INF/download.xml new file mode 100644 index 0000000..90cbae8 --- /dev/null +++ b/geoportal_1/src/main/webapp/WEB-INF/download.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/geoportal_1/src/main/webapp/WEB-INF/ogp.properties b/geoportal_1/src/main/webapp/WEB-INF/ogp.properties index df12f92..a697365 100644 --- a/geoportal_1/src/main/webapp/WEB-INF/ogp.properties +++ b/geoportal_1/src/main/webapp/WEB-INF/ogp.properties @@ -1,7 +1,8 @@ -ogp.proxyToWMS=http://127.0.0.1:8580/wms -ogp.proxyToWFS=http://127.0.0.1:8580/wfs -ogp.proxyToWCS=http://127.0.0.1:8580/wcs - +ogp.domain=http://linuxdev.lib.berkeley.edu:8080 +ogp.relativePath=/opt/tomcat/webapps/opengeoportal +ogp.proxyToWMS=http://gis.lib.berkeley.edu:10080/wms +ogp.proxyToWFS=http://gis.lib.berkeley.edu:10080/wfs +ogp.proxyToWCS=http://gis.lib.berkeley.edu:10080/wcs ldap.url=ldapurl ldap.userSearchFilter=(uid={0}) -admins=admin \ No newline at end of file +admins=admin diff --git a/geoportal_1/src/main/webapp/WEB-INF/security-app-context.xml b/geoportal_1/src/main/webapp/WEB-INF/security-app-context.xml index 7a08955..640c3b2 100644 --- a/geoportal_1/src/main/webapp/WEB-INF/security-app-context.xml +++ b/geoportal_1/src/main/webapp/WEB-INF/security-app-context.xml @@ -6,24 +6,74 @@ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geoportal_1/src/main/webapp/jspf/about.jspf b/geoportal_1/src/main/webapp/jspf/about.jspf index df4c7f8..1d1ff4e 100644 --- a/geoportal_1/src/main/webapp/jspf/about.jspf +++ b/geoportal_1/src/main/webapp/jspf/about.jspf @@ -1,18 +1,18 @@

- GeoData@Tufts is developed and maintained by Tufts University Information Technology. + Geodata@Berkeley is derived from GeoData@Tufts which is developed and maintained by Tufts University Information Technology. Tufts is leading the development in collaboration with Harvard of this open source, federated web application to rapidly discover, preview, - and retrieve geospatial data from multiple repositories. GeoData@Tufts combines an intuitive, map-based search interface along with traditional + and retrieve geospatial data from multiple repositories. GeoData@Berkeley combines an intuitive, map-based search interface along with traditional text-based metadata search tools for rapid data discovery and for use in teaching, learning, and research.

- GeoData@Tufts is part of The Open Geoportal. The Open Geoportal is a consortium comprised of contributions + GeoData@Berkeley is part of The Open Geoportal. The Open Geoportal is a consortium comprised of contributions of several universities and organizations to help facilitate the discovery and acquisition of geospatial data across many organizations and platforms. - Current partners include: Harvard, MIT, MassGIS, Princeton, Columbia, Stanford, UC Berkeley, UCLA, Yale, and UConn. Built on open source technology, + Current partners include: Tufts, Harvard, MIT, MassGIS, Princeton, Columbia, Stanford, UC Berkeley, UCLA, Yale, and UConn. Built on open source technology, The Open Geoportal provides organizations the opportunity to share thousands of geospatial data layers, maps, metadata, and development resources through a single common interface.

<%@include file="mailto.jspf"%>

-
\ No newline at end of file + diff --git a/geoportal_1/src/main/webapp/jspf/contact.jspf b/geoportal_1/src/main/webapp/jspf/contact.jspf index 2d75085..013b5e1 100644 --- a/geoportal_1/src/main/webapp/jspf/contact.jspf +++ b/geoportal_1/src/main/webapp/jspf/contact.jspf @@ -6,12 +6,12 @@

Project Management:

Patrick Florance, Manager of Geospatial Technology Services, UIT, Tufts University +

Berkeley Project Management:

+ Harrison Dekker, Head, Library Data Lab, University of California at Berkeley
- -
diff --git a/geoportal_1/src/main/webapp/jspf/footer.jspf b/geoportal_1/src/main/webapp/jspf/footer.jspf index ca7b701..1fa271d 100644 --- a/geoportal_1/src/main/webapp/jspf/footer.jspf +++ b/geoportal_1/src/main/webapp/jspf/footer.jspf @@ -5,13 +5,12 @@ Contact
- -
<%@include file="about.jspf"%> <%@include file="contact.jspf"%> <%@include file="highlights.jspf"%> - \ No newline at end of file + diff --git a/geoportal_1/src/main/webapp/jspf/highlights.jspf b/geoportal_1/src/main/webapp/jspf/highlights.jspf index 09f7dd3..9625774 100644 --- a/geoportal_1/src/main/webapp/jspf/highlights.jspf +++ b/geoportal_1/src/main/webapp/jspf/highlights.jspf @@ -1,7 +1,7 @@
-

Welcome to GeoData@Tufts! We are happy to announce that as of 11/4/2011 we are live. We will be making updates regularly. +

Welcome to GeoData@Berkeley! Happy mapping!

Please zoom in and pan around with the map and/or enter search terms to begin discovering our geospatial data holdings.

-
\ No newline at end of file + diff --git a/geoportal_1/src/main/webapp/jspf/includes.jspf b/geoportal_1/src/main/webapp/jspf/includes.jspf index ae1fc5e..4671905 100644 --- a/geoportal_1/src/main/webapp/jspf/includes.jspf +++ b/geoportal_1/src/main/webapp/jspf/includes.jspf @@ -12,6 +12,7 @@ + @@ -19,6 +20,7 @@ + diff --git a/geoportal_1/src/main/webapp/jspf/institutionWelcome.jspf b/geoportal_1/src/main/webapp/jspf/institutionWelcome.jspf index 2897fb4..6b6e5bc 100644 --- a/geoportal_1/src/main/webapp/jspf/institutionWelcome.jspf +++ b/geoportal_1/src/main/webapp/jspf/institutionWelcome.jspf @@ -1,3 +1,3 @@ -Welcome to the Tufts Geospatial Data Repository +Welcome to the U.C. Berkeley Geospatial Data Repository diff --git a/geoportal_1/src/main/webapp/jspf/mailto.jspf b/geoportal_1/src/main/webapp/jspf/mailto.jspf index bf08bed..39e586f 100644 --- a/geoportal_1/src/main/webapp/jspf/mailto.jspf +++ b/geoportal_1/src/main/webapp/jspf/mailto.jspf @@ -1 +1 @@ -For questions, comments, or to report problems, please contact: geodata@elist.tufts.edu \ No newline at end of file +For questions, comments, or to report problems, please contact: gmills@library.berkeley.edu diff --git a/geoportal_1/src/main/webapp/ogpWFS.jsp b/geoportal_1/src/main/webapp/ogpWFS.jsp index 9dd7355..b97a429 100644 --- a/geoportal_1/src/main/webapp/ogpWFS.jsp +++ b/geoportal_1/src/main/webapp/ogpWFS.jsp @@ -37,7 +37,7 @@ String institution = solrRecords.get(0).getInstitution(); //String serverName = ParseJSONSolrLocationField.getWfsUrl(layerInfoMap.get(layerIds[0]).get("Location")); - String serverName = "http://geoserver01.uit.tufts.edu"; + String serverName = "http://gs-gis.lib.berkeley.edu:8080/geoserver"; String servicePoint = serverName + "/wfs"; String featureTypeInfo = ""; @@ -407,4 +407,4 @@ - \ No newline at end of file + diff --git a/geoportal_1/src/main/webapp/ogpWMS.jsp b/geoportal_1/src/main/webapp/ogpWMS.jsp index 39880b2..55efbe4 100644 --- a/geoportal_1/src/main/webapp/ogpWMS.jsp +++ b/geoportal_1/src/main/webapp/ogpWMS.jsp @@ -41,7 +41,7 @@ //String servicePoint = ParseJSONSolrLocationField.getWmsUrl(layerInfoMap.get(layerIds[0]).get("Location")); //String serverName = servicePoint.substring(0, servicePoint.indexOf("/wms")); - String serverName = "http://geoserver01.uit.tufts.edu"; + String serverName = "http://gs-gis.lib.berkeley.edu:8080/geoserver"; String servicePoint = serverName + "/wms"; String featureTypeInfo = ""; System.out.println(serverName); @@ -5001,4 +5001,4 @@ GEOGCS["WGS 84", <% out.write(featureTypeInfo); %> - \ No newline at end of file + diff --git a/geoportal_1/src/main/webapp/openGeoPortalHome.jsp b/geoportal_1/src/main/webapp/openGeoPortalHome.jsp index 91ad40e..7e3fe8c 100644 --- a/geoportal_1/src/main/webapp/openGeoPortalHome.jsp +++ b/geoportal_1/src/main/webapp/openGeoPortalHome.jsp @@ -2,7 +2,7 @@ -GeoData@Tufts +GeoData@Berkeley <%@include file="jspf/includes.jspf"%> diff --git a/geoportal_1/src/main/webapp/resources/css/institutionBerkeley.css b/geoportal_1/src/main/webapp/resources/css/institutionBerkeley.css new file mode 100644 index 0000000..3d48b8a --- /dev/null +++ b/geoportal_1/src/main/webapp/resources/css/institutionBerkeley.css @@ -0,0 +1,114 @@ +body { + background: #cccccc url(../media/bg_tile.gif) repeat; + font-family: arial, sans-serif; + /* altering font-size could cause formatting problems in places */ + font-size: 12px; +} + +/*main logo. The width will probably have to be changed to accomodate your specific logo */ +#logo { + width: 540px; + background-image: url(../media/gislogo_berkeley.gif); +} + +/* css for the Contact dialog */ +#contact { + padding: 10px; +} + +#contactLogos { + background: none repeat scroll 0 0 #CCCCCC; + bottom: 15px; + height: 30px; + left: 33px; + padding-top: 5px; + position: absolute; + width: 83%; +} + +#contactLogos > div { + cursor: pointer; + display: inline-block; + height: 25px; + padding: 5px; +} + +#contactLogos > div.gisLogo { + float: right; +} + +#contactLogos > div.itLogo { + float: left; + margin-left: 10px; +} + +/*logos in the footer and in contact dialog */ +.itLogo { + width: 34px; + background: url(../media/uit_logo.png) no-repeat transparent; + } + +.gisLogo { + width: 111px; + background: url(../media/gislogo_berkeley.gif) no-repeat transparent; + } + +h1 { + font-size: 14px; + color:#003366; +} + +h2 { + font-size: 13px; + color: #3366cc; + margin-bottom: 3px; +} + + h4 { + text-decoration:underline; + } + +#header { + background-color: #edf4fa; + border-right: #333 solid 1px; + border-left: #333 solid 1px; + border-bottom: #999999 solid 1px; +} + +#top_menu { + width: 252px; + background: url(../media/top_menu_bg.png) no-repeat transparent; + } + + #top_menu a { + color:#FFFFFF; +} + +#top_menu a:hover { + color:#FFFF66; +} + +#welcome { + color:#333333; +} + +#footer { + height: 30px; + background: #003366; + border-right: #333 solid 1px; + border-left: #333 solid 1px; + border-bottom: #333 solid 1px; +} + +#footer a{ + color:#FFFFFF; + text-decoration:none; +} + +#footer a:hover{ + color:#FFFF66; +} + +.highlight_row { + background-color: #edf4fa; +} diff --git a/geoportal_1/src/main/webapp/resources/frameContent.html b/geoportal_1/src/main/webapp/resources/frameContent.html new file mode 100644 index 0000000..a94bd60 --- /dev/null +++ b/geoportal_1/src/main/webapp/resources/frameContent.html @@ -0,0 +1,253 @@ + + + + + + UnGeoreferenced Image Preview + + + + + + + + + + + + + + + + + + + + + + +
You are previewing an ungeoreferenced image, which cannot be displayed on the map. +
+
+
+ + + + + diff --git a/geoportal_1/src/main/webapp/resources/javascript/layerSettings.js b/geoportal_1/src/main/webapp/resources/javascript/layerSettings.js index e6d7637..6da51f7 100644 --- a/geoportal_1/src/main/webapp/resources/javascript/layerSettings.js +++ b/geoportal_1/src/main/webapp/resources/javascript/layerSettings.js @@ -41,8 +41,12 @@ org.OpenGeoPortal.LayerSettings = function(){ }; this.addNewLayer = function(layerID, params){ + + //alert("addNewLayer called. layerId: " + layerID + ", dataType: " + params.dataType ); + var dataType = params.dataType; + if ((typeof dataType == 'undefined')||(dataType == '')){ throw new Error("dataType (Point, Line, Polygon, or Raster) must be specified to create a new layer."); } diff --git a/geoportal_1/src/main/webapp/resources/javascript/layerTable.js b/geoportal_1/src/main/webapp/resources/javascript/layerTable.js index e96df17..27ab9d7 100644 --- a/geoportal_1/src/main/webapp/resources/javascript/layerTable.js +++ b/geoportal_1/src/main/webapp/resources/javascript/layerTable.js @@ -1,2428 +1,2504 @@ -/** - * This javascript module includes functions for dealing with the search - * results table under the object LayerTable. LayerTable uses the excellent - * jQuery-based dataTables as the basis for the table. - * - * @author Chris Barnett - * - */ -if (typeof org == 'undefined'){ - org = {}; -} else if (typeof org != "object"){ - throw new Error("org already exists and is not an object"); -} - -// Repeat the creation and type-checking code for the next level -if (typeof org.OpenGeoPortal == 'undefined'){ - org.OpenGeoPortal = {}; -} else if (typeof org.OpenGeoPortal != "object"){ - throw new Error("org.OpenGeoPortal already exists and is not an object"); -} - -/** - * LayerTable constructor - * this object defines the behavior of the search results table, as well as the saved layers table - * - * @param userDiv the id of the div element to place the table in - * @param tableName the id of the actual table element - */ -org.OpenGeoPortal.LayerTable = function(userDiv, tableName){ - - var analytics = new org.OpenGeoPortal.Analytics(); - - //set default for the name of the table div...these defaults should not be in the generic layertable code - //but in the extensions of the object - if ((typeof userDiv == 'undefined')||(userDiv.length === 0)){ - userDiv = 'resultsTable'; - } - - if ((typeof tableName == 'undefined')||(tableName.length === 0)){ - tableName = 'searchResults'; - } - var that = this; - - this.getTableDiv = function(){ - return userDiv; - }; - //this.tableDiv = userDiv; - this.getTableID = function(){ - return tableName; - }; - - this.getTableObj = function(){ - return jQuery('#' + tableName).dataTable(); - }; - - this.tableHeadingsObj = new org.OpenGeoPortal.LayerTable.TableHeadings(this); - //temporary? - var tableHeadings = this.tableHeadingsObj.getTableHeadings(); - - this.tableLayerState = new org.OpenGeoPortal.LayerTable.TableLayerState(); - this.getImage = function(imageName){ - return org.OpenGeoPortal.Utility.getImage(imageName); - }; - /*private methods - * - */ - //maintains state for how the table is sorted - //*******Search Results only - this.tableOrganize = { - //set some defaults - settings: {"organizeBy": "score", "organizeType": "numeric", "organizeDirection": "desc"}, - //we only need organizetype if there is more than one possibility per column - //get the current sort state - getState: function(){ - return this.settings; - }, - - //set the state - setState: function(updateObj){//can't directly set organizeType; this will be looked up in tableHeading - //test to see if the state is changed; if so, fire new solr search - var innerThat = this; - compareState = function(key){ - if (updateObj[key] == innerThat.settings[key]){ - return true; - } else { - return false; - } - }; - setSortColumn = function(){ - //test for rank first - var newColumn = updateObj.organizeBy; - - analytics.track("Change Results Sort Order", newColumn); - - if (newColumn == 'score'){ - innerThat.settings.organizeBy = newColumn; - innerThat.settings.organizeType = "numeric"; - } else { - for (var columnName in tableHeadings){ - if (newColumn == columnName){ - var newOrganize = columnName.organize; - if (newOrganize){ - throw new Error("This column cannot be organized."); //you can't organize this column - } else { - innerThat.settings.organizeBy = newColumn; - innerThat.settings.organizeType = newOrganize; - return; - } - } - } - throw new Error("The specified column name does not exist."); //if it gets here, this means that there was no matching column name in tableHeadings - } - }; - - setSortDirection = function(){ - if (typeof updateObj.organizeDirection == 'undefined'){ - updateObj.organizeDirection = innerThat.settings.organizeDirection; - } - if ((updateObj.organizeDirection == 'asc')||(updateObj.organizeDirection == 'desc')){ - innerThat.settings.organizeDirection = updateObj.organizeDirection; - } else { - throw new Error("The specified sort direction is invalid for this column."); //invalid organize direction type - } - }; - - if (typeof updateObj.organizeBy == 'undefined'){ - if (typeof updateObj.organizeDirection == 'undefined'){ - //these values can't both be unspecified - throw new Error("Must specify a column and/or direction."); - } else { - //set organizeBy to current value, continue processing - updateObj.organizeBy = innerThat.settings.organizeBy; - setSortColumn(); - setSortDirection(); - that.searchRequest(0); - org.OpenGeoPortal.ui.updateSortMenu(); - } - } else if (compareState('organizeBy')){ - if (compareState('organizeDirection')){ - //don't do anything...the object hasn't changed exit function - return; - } else { - setSortDirection(); - that.searchRequest(0); - org.OpenGeoPortal.ui.updateSortMenu(); - } - } else { - setSortColumn(); - setSortDirection(); - that.searchRequest(0); - org.OpenGeoPortal.ui.updateSortMenu(); - } - } - }; - //wrap the content of each table cell in a div so we can control the size - this.wrapCells = function(){ - var tableName = that.getTableID(); - jQuery('#' + tableName + ' td').add('#' + tableName + ' th').each(function (iPosition, Element){ - //reference the column, so we can set the width of each div - var tableCell = jQuery(this); - if (!tableCell.children().first().is("div")){ - tableCell.wrapInner('
'); - } - }); - that.sizeCells(); - }; - //dynamically size the table depending on visible columns & the width of the container - this.sizeCells = function(){ - //determine which fields are showing, set widths from header object - //if they add up to the total width, we're done. otherwise we need to adjust - //we need to maintain minimum widths - var currentTab = org.OpenGeoPortal.Utility.whichTab(); - var tableID = this.getTableID(); - var adjustObj; - - if (!currentTab.tableObject){ - return; - } - if (currentTab.tableName != tableID){ - return; - } - var totalWidth = jQuery('#left_col').width(); - var arrColumns = this.getVisibleColumns(); - totalWidth = totalWidth - (arrColumns.length * 7) + 1;//account for cell padding plus right borders of cells, leftmost border - //var divWidth = totalWidth; - var arrSizable = new Array(); - var sizableWidth = 0; - var headingsObj = this.tableHeadingsObj; - for (var i in arrColumns){ - var currentColumn = arrColumns[i]; - var currentWidth = headingsObj.getWidth(currentColumn); - if (headingsObj.getValue(currentColumn, "resizable")){ - sizableWidth += currentWidth; - arrSizable.push(currentColumn); - } else { - var fixedColumnWidth = parseFloat(currentWidth); - totalWidth = totalWidth - fixedColumnWidth; - } - } - var numberSizable = arrSizable.length; - if (numberSizable == 0){ - return;//we're done. exit the function - } - //working here.... - if (numberSizable == 1){ - var currentClass = headingsObj.getValue(arrSizable[0], "sClass"); - var currentMinWidth = headingsObj.getValue(arrSizable[0], "minWidth"); - if (totalWidth >= currentMinWidth){ - jQuery('#' + tableID + ' .' + currentClass + ' > div').width(totalWidth); - } else { - //debugging - this.removeExtraColumn(); - //alert('remaining width is less than the minWidth for the column (sizable = 1)'); - //what can we do here? I think we have to remove columns to make things fit. - //this will fail to adjust columns properly if the visible resizable column is not - //removed by the above function - } - //should also update the currentWidth; - headingsObj.setWidth(arrSizable[0], totalWidth); - return;//we're done. exit the function - } - - //following is executed if numberSizable is > 1 - //determine if the total width currently set for the sizable columns is equal to the - //width available on the page. - var remainingWidth = totalWidth - sizableWidth; - if (remainingWidth == 0){ - //set columns to currentWidth values - for (var j in arrSizable){ - var currentSizable = arrSizable[j]; - //var currentMinWidth = headingsObj.getValue(currentSizable, "minWidth"); - var currentWidth = headingsObj.getValue(currentSizable, "currentWidth"); - var currentClass = headingsObj.getValue(currentSizable, "sClass"); - jQuery('#' + tableID + ' .' + currentClass + ' > div').width(currentWidth); - //since setWidth cannot set a 'currentWidth' smaller than 'minWidth', we - //should be ok not comparing with 'minWidth' here - headingsObj.setWidth(currentSizable, currentWidth); - }; - } else { - //split the difference between columns and add to each currentWidth, taking care not to go below minWidth - var remainder = remainingWidth % numberSizable; - // widthDifference * numberSizable will always be <= remainingWidth - var widthDifference = Math.floor(remainingWidth / numberSizable); - var propagate = 0;//we need this variable outside the loop. - var adjustArr = []; - for (var j in arrSizable){ - var currentSizable = arrSizable[j]; - var currentMinWidth = headingsObj.getValue(currentSizable, "minWidth"); - var currentWidth = headingsObj.getValue(currentSizable, "currentWidth") + widthDifference - propagate; - var currentClass = headingsObj.getValue(currentSizable, "sClass"); - //we only want to apply the remainder to the first field if possible - if (remainder > 0){ - currentWidth++; - remainder--; - } - if (currentWidth >= currentMinWidth){ - adjustObj = {}; - adjustObj.sClass = currentClass; - adjustObj.availableWidth = currentWidth - currentMinWidth; - adjustObj.currentWidth = currentWidth; - adjustObj.currentSizable = currentSizable; - adjustArr.push(adjustObj); - jQuery('#' + tableID + ' .' + currentClass + ' > div').width(currentWidth); - headingsObj.setWidth(currentSizable, currentWidth); - propagate = 0; - } else { - //if we set the column to the currentMinWidth, we have to propagate the difference to - //another column. - propagate = currentMinWidth - currentWidth; - jQuery('#' + tableID + ' .' + currentClass + ' > div').width(currentMinWidth); - headingsObj.setWidth(currentSizable, currentMinWidth); - } - }; - while (propagate > 0){ - //in this case, we need to start taking width from earlier columns - if (adjustArr.length > 0){ - for (var k in adjustArr){ - var currentAdjust = adjustArr[k]; - //compare the value of propagate with the value of currentAdjust.availableWidth - var adjustDelta = propagate - currentAdjust.availableWidth; - if (adjustDelta <= 0){ - jQuery('#' + tableID + ' .' + currentAdjust.sClass + ' > div').width(currentAdjust.currentWidth - propagate); - headingsObj.setWidth(adjustObj.currentSizable, currentAdjust.currentWidth - propagate); - return; //we're done - } else { - jQuery('#' + tableID + ' .' + currentAdjust.sClass + ' > div').width(currentAdjust.currentWidth - currentAdjust.availableWidth); - headingsObj.setWidth(adjustObj.currentSizable, currentAdjust.currentWidth - currentAdjust.availableWidth); - propagate = adjustDelta; - } - } - } else { - //if propagate is still > 0 when all columns are at minWidth, we have to remove a column from display - this.removeExtraColumn(); - return; //avoid possible infinite loop - } - } - } - //totalWidth must be shared between all visible columns - }; - - //html content/formatting for expanded row - this.formatDetails = function(rowNode){ - var tableID = this.getTableID(); - var tableObj = this.getTableObj(); - var rowData = tableObj.fnGetData(rowNode); - //layerIDs returned from the search are used as OpenLayers layer names - var layerID = rowData[this.tableHeadingsObj.getColumnIndex("LayerId")]; - var escapedLayerID = org.OpenGeoPortal.Utility.idEscape(layerID); - var dataType = rowData[this.tableHeadingsObj.getColumnIndex("DataType")]; - var displayName = org.OpenGeoPortal.Utility.escapeQuotes(rowData[this.tableHeadingsObj.getColumnIndex("LayerDisplayName")]); - var extent = []; - extent.push(rowData[this.tableHeadingsObj.getColumnIndex("MinX")]); - extent.push(rowData[this.tableHeadingsObj.getColumnIndex("MinY")]); - extent.push(rowData[this.tableHeadingsObj.getColumnIndex("MaxX")]); - extent.push(rowData[this.tableHeadingsObj.getColumnIndex("MaxY")]); - var sOut = '
'; - //read state - if (!org.OpenGeoPortal.layerState.layerStateDefined(layerID)){ - org.OpenGeoPortal.layerState.addNewLayer(layerID, {"dataType": dataType}); - } - - var opacityVal = org.OpenGeoPortal.layerState.getState(layerID, "opacity") + '%'; - - sOut += '
'; - sOut += '
opacity: '; - sOut += '
' + opacityVal + '
'; - sOut += ''; - sOut += '
'; - sOut += '
'; - sOut += '
'; - sOut += '
'; - if ((dataType == "Raster")||(dataType == "Paper Map")||(dataType == "LibraryRecord")){ - sOut += '
'; - sOut += '
'; - sOut += '
'; - sOut += '
'; - sOut += '
Zoom to geographic extent of layer
'; - sOut += '
'; - sOut += '
'; - } else { - var attributeToolImg; - if (org.OpenGeoPortal.layerState.getState(layerID, "getFeature")){ - attributeToolImg = this.getImage("preview_down.gif"); - } else { - attributeToolImg = this.getImage("preview.gif"); - } - var sizeVal = org.OpenGeoPortal.layerState.getState(layerID, "graphicWidth") + 'px'; - - sOut += '
'; - sOut += '
'; - switch (dataType){ - case "Polygon": - sOut += "border: "; - break; - case "Point": - sOut += "pt size: "; - break; - case "Line": - sOut += "ln width: "; - break; - } - sOut += '
' + sizeVal + '
'; - sOut += ''; - sOut += '
'; - sOut += '
'; - sOut += '
'; - //sOut += ''; - sOut += '
'; - sOut += '
'; - sOut += '
Zoom to geographic extent of layer
'; - sOut += '
'; - sOut += 'Show Attributes
'; - } - - sOut += '
'; - - return sOut; - }; - - this.selectPreviewedRow = function(){ - var tableName = this.getTableID(); - jQuery(document).on("click", '#' + tableName + ' td.colPreview > div > input:checkbox', function(event) { - var rowObj = jQuery(event.target).closest("tr"); - if (jQuery(event.target).is(":checked")){ - rowObj.addClass('previewedLayer'); - if (rowObj.next().children('td').hasClass('resultsControls')){ - rowObj.next().addClass('previewedLayer'); - } - } else { - rowObj.removeClass('previewedLayer'); - if (rowObj.next().children('td').hasClass('resultsControls')){ - rowObj.next().removeClass('previewedLayer'); - } - } - - }); - }; - - //adds class to row for highlighting current row - this.highlightRow = function(){ - var tableName = this.getTableID(); - jQuery(document).on("mouseout", '#' + tableName + ' > tbody', function(event) { - var currentNode = jQuery(event.target).parentsUntil('#' + tableName).last(); - jQuery(currentNode).children().removeClass('row_selected'); - org.OpenGeoPortal.map.hideLayerBBox(); - }); - - var tableObj = this.getTableObj(); - var tableHeadingsObj = this.tableHeadingsObj; - jQuery(document).on("mouseover", '#' + tableName + ' > tbody', function(event) { - var rowObj = jQuery(event.target).parentsUntil('#' + tableName + ' > tbody').last(); - rowObj.addClass('row_selected'); - if (rowObj.children('td').hasClass('resultsControls')){ - rowObj.prev().addClass('row_selected'); - } - if (rowObj.next().children('td').hasClass('resultsControls')){ - rowObj.next().addClass('row_selected'); - } - //if next sibling is details row, then add class 'row_selected' to it as well - //set first tr ancestor to class row_selected - var aData = tableObj.fnGetData(rowObj[0]); - //console.log(aData); - if (aData == null){ - rowObj = rowObj.prev(); - aData = tableObj.fnGetData(rowObj[0]); - } - var bbox = {}; - bbox.south = aData[tableHeadingsObj.getColumnIndex("MinY")]; - bbox.north = aData[tableHeadingsObj.getColumnIndex("MaxY")]; - bbox.west = aData[tableHeadingsObj.getColumnIndex("MinX")]; - bbox.east = aData[tableHeadingsObj.getColumnIndex("MaxX")]; - org.OpenGeoPortal.map.showLayerBBox(bbox); - }); - }; - - this.downloadActionSelectRow = function(rowPosition, isSelected){ - var selectionClass; - if (isSelected){ - selectionClass = 'downloadSelection'; - } else { - selectionClass = 'downloadUnselection'; - } - var tableObj = this.getTableObj(); - //var tableHeadingsObj = this.tableHeadingsObj; - var rowObj = jQuery(tableObj.fnGetNodes(rowPosition)); - rowObj.addClass(selectionClass); - - if (rowObj.next().children('td').hasClass('resultsControls')){ - rowObj.next().addClass(selectionClass); - } - //if next sibling is details row, then add class 'row_selected' to it as well - //set first tr ancestor to class row_selected - /*var aData = tableObj.fnGetData(rowObj[0]); - //console.log(aData); - if (aData == null){ - rowObj = rowObj.prev(); - aData = tableObj.fnGetData(rowObj[0]); - } - var bbox = {}; - bbox.south = aData[tableHeadingsObj.getColumnIndex("MinY")]; - bbox.north = aData[tableHeadingsObj.getColumnIndex("MaxY")]; - bbox.west = aData[tableHeadingsObj.getColumnIndex("MinX")]; - bbox.east = aData[tableHeadingsObj.getColumnIndex("MaxX")]; - org.OpenGeoPortal.map.showLayerBBox(bbox); - */ - }; - - this.getLayerIdFromRow = function(rowObj){ - return rowObj.aData[that.tableHeadingsObj.getColumnIndex('LayerId')]; - }; - - this.toolBarState = function(rowNode){ - if (rowNode.next().children('td').hasClass('resultsControls')){ - return true; - } else { - return false; - } - }; - //click-handler to expand row, expose preview controls - this.expandableRow = function(thisObj){ - //debug - try{ - //set the previewCount variable, so we know that a layer has been expanded before - if (typeof org.OpenGeoPortal.layerState.previewCount == "undefined"){ - org.OpenGeoPortal.layerState.previewCount = true; - } - var rowNode = jQuery(thisObj).closest('tr'); - - //test here to see if the next row is a tools row....then we can deal - //with this properly - - var isOpen = this.toolBarState(rowNode); - var detailsOpen = this.getImage("arrow_down.png"); - var detailsClosed = this.getImage("arrow_right.png"); - //this should do the right thing if the layerState for 'expanded' and the row icon - //don't match - var graphicsState = jQuery(thisObj).attr('src'); - if (graphicsState == detailsClosed){ - /* Open this row */ - this.openRow(rowNode[0]); - } else if (graphicsState == detailsOpen){ - //if layerExpanded is true and tools are open - if (isOpen){ - /* This row is already open - close it */ - this.closeToolBar(rowNode[0]); - } else { - /* Open this row */ - this.openRow(rowNode[0]); - } - - } - //debug - } catch(err){alert(err + " expandableRow");}; - }; - - this.closeToolBar = function(rowNode){ - try{ - var detailsClosed = this.getImage("arrow_right.png"); - jQuery(rowNode).find(".colExpand img").attr('src', detailsClosed); - var tableObj = this.getTableObj(); - var tableID = this.getTableID(); - tableObj.fnClose(rowNode); - var layerID = tableObj.fnGetData(rowNode)[this.tableHeadingsObj.getColumnIndex("LayerId")]; - - if (this.tableLayerState.getState(layerID, "expanded")){ - this.tableLayerState.setState(layerID, {"expanded": false}); - } - - if (tableID != 'savedLayers'){ - this.setTableLength(); - } - jQuery(".previewedLayer").removeClass('previewSeparator'); - jQuery(".previewedLayer").last().addClass('previewSeparator'); - tableObj.fnDraw(false); - } catch(err){alert(err + " closeToolBar");}; - }; - - this.openRow = function(rowNode){ - - /* Open this row */ - var detailsOpen = this.getImage("arrow_down.png"); - jQuery(rowNode).find(".colExpand img").attr('src', detailsOpen); - - var tableObj = this.getTableObj(); - var tableID = this.getTableID(); - var layerID = tableObj.fnGetData(rowNode)[this.tableHeadingsObj.getColumnIndex("LayerId")]; - var escapedLayerID = org.OpenGeoPortal.Utility.idEscape(layerID); - - tableObj.fnOpen(rowNode, this.formatDetails(rowNode), 'resultsControls'); - - var dataType = tableObj.fnGetData(rowNode)[this.tableHeadingsObj.getColumnIndex("DataType")]; - //console.log(dataType); - if (!org.OpenGeoPortal.layerState.layerStateDefined(layerID)){ - org.OpenGeoPortal.layerState.addNewLayer(layerID, {"dataType": dataType}); - } - - if (!this.tableLayerState.getState(layerID, "expanded")){ - this.tableLayerState.setState(layerID, {"expanded": true}); - } - - if (tableID != 'savedLayers'){ - this.setTableLength(); - } - try{ - if ((dataType == "Raster")||(dataType =="Paper Map")||(dataType == "LibraryRecord")){ - //return; - } else { - var minSize = 1; - var maxSize = 6; - if (dataType == "Polygon"){ - minSize = 0; - maxSize = 5; - } - - //trigger an event? - if (jQuery(".colorPalette").length == 0){ - setTimeout("org.OpenGeoPortal.ui.setPaletteColor(" + layerID + ")",250); - } - org.OpenGeoPortal.ui.setPaletteColor(layerID); - - var sizeControl = jQuery("div.sizeControl"); - sizeControl.each(function(){ - jQuery(this).parent().hover(function(){org.OpenGeoPortal.ui.openControl(this);}, function(){org.OpenGeoPortal.ui.closeControl(this);}); - }); - - var widthVal = org.OpenGeoPortal.layerState.getState(layerID, "graphicWidth"); - jQuery("#size" + tableID + escapedLayerID).slider({ - min: minSize, - max: maxSize, - step: 1, - value: widthVal, //get value from Layer State object - slide: function(event, ui) { - jQuery('#sizeText' + tableID + escapedLayerID).text(ui.value + 'px'); - }, - stop: function(event, ui){ - org.OpenGeoPortal.layerState.setState(layerID, {"graphicWidth": ui.value}); - for (var i in org.OpenGeoPortal.map.getLayersByName(layerID)){ - org.OpenGeoPortal.map.changeStyle(layerID, dataType); - } - } - }); - } - - var opacityControl = jQuery("div.opacityControl"); - opacityControl.each(function(){ - jQuery(this).parent().hover(function(){org.OpenGeoPortal.ui.openControl(this);}, function(){org.OpenGeoPortal.ui.closeControl(this);}); - }); - //retrieve opacity if it has been defined - //opacity control ID must also reference the tablename - var opacityVal = org.OpenGeoPortal.layerState.getState(layerID, "opacity"); - - jQuery("#opacity" + tableID + escapedLayerID).slider({ - min: 0, - max: 100, - step: 5, - value: opacityVal, //get value from Layer State object - slide: function(event, ui) { - jQuery('#opacityText' + tableID + escapedLayerID).text(ui.value + '%'); - //console.log(layerID); - for (var i in org.OpenGeoPortal.map.getLayersByName(layerID)){ - org.OpenGeoPortal.map.getLayersByName(layerID)[0].setOpacity(ui.value * .01); - //console.log(org.OpenGeoPortal.map.getLayersByName(layerID)[0]); - }}, - stop: function(event, ui){ - org.OpenGeoPortal.layerState.setState(layerID, {"opacity": ui.value}); - } - }); - if (jQuery(rowNode).hasClass("previewedLayer")){ - jQuery(rowNode).next().addClass("previewedLayer"); - } - if (jQuery(rowNode).hasClass("row_selected")){ - jQuery(rowNode).next().addClass("row_selected"); - } - - jQuery(".previewedLayer").removeClass('previewSeparator'); - jQuery(".previewedLayer").last().addClass('previewSeparator'); - tableObj.fnDraw(false); - - } catch(err){alert(err + " openRow");}; - }; - - - // handles jsonp response from request for metadata call - this.showMetadataJsonpSuccess = function(data) - { - var solrResponse = data["response"]; - var totalResults = solrResponse["numFound"]; - if (totalResults != 1) - { - throw new Error("Request for Metadata returned " + totalResults +". Exactly 1 was expected."); - return; - } - var doc = solrResponse["docs"][0]; // get the first layer object - var metadataRawText = doc["FgdcText"]; - var layerId = doc["LayerId"];//[0]; - var metadataDocument = jQuery.parseXML(metadataRawText); - - var xsl = null; - var xslUrl = null; - - if (metadataDocument.firstChild.localName == "MD_Metadata"){ - xslUrl = "isoBasic.xsl"; - } else { - xslUrl = "FGDC_V2_a.xsl"; - } - xslUrl = "resources/xml/" + xslUrl; - var params = { - url: xslUrl, - async: false, - dataType: 'xml', - success: function(data){xsl = data;} - }; - jQuery.ajax(params); - var resultDocument = ""; - if (xsl != null){ - if (jQuery.browser.msie){ - resultDocument = metadataDocument.transformNode(xsl); - } else { - var xsltProcessor = new XSLTProcessor(); - xsltProcessor.importStylesheet(xsl); - resultDocument = xsltProcessor.transformToFragment(metadataDocument, window.document); - } - } - if (typeof jQuery('#metadataDialog')[0] == 'undefined'){ - var dialogDiv = '
\n'; - dialogDiv += '
\n'; - jQuery('body').append(dialogDiv); - } - var dialogHeight = 400; - var metadataTemplate = '
' + layerId + '
'; - var metadataDialog = jQuery("#metadataDialog"); - metadataDialog.html(metadataTemplate) - jQuery("#metadataContent").html(resultDocument); - - metadataDialog.dialog({ zIndex: 9999, width: 630, height: dialogHeight, title: "
METADATA
" }); - if (jQuery("#metadataDownloadButton").length == 0){ - var downloadButton = 'Download Metadata (XML)'; - metadataDialog.parent().find(".ui-dialog-titlebar").first().prepend(downloadButton); - } - var metadataContent = jQuery("#metadataContent"); - metadataContent[0].scrollTop = 0; - metadataDialog.dialog("open"); - metadataContent.find("a").click(function(event){ - var toID = jQuery(this).attr("href"); - if (toID.indexOf("#") == 0){ - event.preventDefault(); - //parse the hrefs for the anchors in this DOM element into toID - //current xsl uses names instead of ids; yuck - toID = toID.substring(1); - metadataContent.scrollTo(jQuery('[name="' + toID + '"]')); - } - }); - jQuery("#metadataDownloadButton").unbind(); - var iframeSource = "getMetadata/download?id=" + layerId; - var downloadFunction = function(){ - if (typeof jQuery('#metadataDownloadIframe')[0] == 'undefined'){ - var downloadIframe = '