changeset 158:92c4c9f7312a public_by_author

Merge from HEAD 2522985f44af601a0fb3af90eb9660f2280e1032
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Fri, 20 Oct 2017 16:59:48 +0200
parents 3c83f42a8a39 (current diff) 2522985f44af (diff)
children d5ae699a4152
files
diffstat 7 files changed, 45 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/diva/rest/DivaProxy.java	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/java/de/mpiwg/itgroup/diva/rest/DivaProxy.java	Fri Oct 20 16:59:48 2017 +0200
@@ -1,28 +1,23 @@
 package de.mpiwg.itgroup.diva.rest;
 
-import java.io.PrintWriter;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import de.mpiwg.itgroup.diva.utils.JSONParam;
 import de.mpiwg.itgroup.ismi.utils.HTTPUtils;
 import de.mpiwg.itgroup.ismi.utils.HTTPUtils.HttpResponse;
 import de.mpiwg.itgroup.ismi.utils.HTTPUtils.HttpStringResponse;
 
 @Path("/diva/proxy")
 public class DivaProxy {
-	
-	private static String IMG_SERVER = "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi?FIF=/data7/srv/images/";
+    // FIXME: is this still used?
+
+    // was https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi?FIF=/data7/srv/images/
+    private static String IMG_SERVER = "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi?FIF=/";
 	
 	@GET
 	@Path("/image")
@@ -54,7 +49,8 @@
 		json(
 			 @PathParam("file") String file) throws Exception{
 	
-		HttpStringResponse resp = HTTPUtils.getHttpSSLStringResponse("https://images.rasi.mcgill.ca/data/" + file + ".json");
+	    // was HTTPUtils.getHttpSSLStringResponse(https://images.rasi.mcgill.ca/data/
+		HttpStringResponse resp = HTTPUtils.getHttpStringResponse("https://images.rasi.mcgill.ca/data/" + file + ".json");
 		if(resp.code == 200){
 			return Response.ok(resp.content).build();	
 		}
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java	Fri Oct 20 16:59:48 2017 +0200
@@ -1,6 +1,9 @@
 package de.mpiwg.itgroup.ismi.entry.beans;
 
 import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -9,11 +12,11 @@
 import javax.faces.model.SelectItem;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.mpi.openmind.cache.WrapperService;
 import org.mpi.openmind.configuration.ConfigurationService;
-import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.repository.bo.Entity;
 import org.mpi.openmind.repository.services.ServiceRegistry;
 import org.mpi.openmind.search.SearchService;
@@ -106,6 +109,29 @@
 		return sb.toString();
 	}
 	
+	/**
+	 * Returns a URL to the configured QueryBrowser webapp with the query set to the given id.
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public String generateQueryBrowserUrlForId(Long id) {
+	    String baseUrl = this.getConfService().getQueryBrowserUrl();
+	    // generate id_is query for id
+	    String query = String.format("[[\"id_is\",{\"value\":%d}]]", id);
+	    try {
+	        // encode URL and base64
+            String encquery = URLEncoder.encode(query, StandardCharsets.UTF_8.toString());
+            String b64query = Base64.encodeBase64String(encquery.getBytes());
+            String url = baseUrl + "#" + b64query;
+            return url;
+        } catch (UnsupportedEncodingException e) {
+            // this shouldn't happen
+            logger.error(e);
+        }
+	    return null;
+	}
+	
 	public static String CURRENT_WITNESS = "CurrentWitness";
 	public static String CURRENT_CODEX = "CurrentCodex";
 	public static String CURRENT_TEXT = "CurrentText";
--- a/src/main/resources/openmind.properties.template	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/resources/openmind.properties.template	Fri Oct 20 16:59:48 2017 +0200
@@ -1,4 +1,5 @@
 scheduling-path=/tmp/
 #scheduling-path=/home/jurzua/ismi/automatic-backup
 scheduling-enable=false
-debug-modus=false
\ No newline at end of file
+debug-modus=false
+query-browser-url=https://ismi.mpiwg-berlin.mpg.de/static-ismi/ng2-query-ismi/
--- a/src/main/webapp/browse/entityDetails.xhtml	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/webapp/browse/entityDetails.xhtml	Fri Oct 20 16:59:48 2017 +0200
@@ -50,17 +50,16 @@
 								rendered="#{Session.canEdit}"
 								action="#{Session.entDetailsForm.actionEdit}"
 								style="margin-right: 20px;" />
-							<h:commandButton value="Get previous versions"
-								title="Get previous versions" rendered="#{Session.canEdit}"
-								image="#{ApplicationBean1.imgVersions32}"
-								actionListener="#{Session.entDetailsForm.listenerGetPreviousVersions}"
-								style="margin-right: 20px;" />
 							<h:commandButton value="Remove" title="Remove this entity"
 								rendered="#{Session.canDelete}"
 								image="#{ApplicationBean1.imgRemove32}"
 								onclick="if(!confirm('Do you really want to remove this entity?')){ return; };"
 								action="#{Session.entDetailsForm.listenerDeleteEntity}"
 								style="margin-right: 20px;" />
+	                        <h:commandButton value="Query Builder"
+	                             onclick="window.open('#{ApplicationBean1.generateQueryBrowserUrlForId(Session.entDetailsForm.entity.id)}')"
+	                             title="Start Query Builder with this id"
+	                             type="button"/>
 						</h:panelGroup>
 						<h:outputText
 							value="Modified by: #{Session.entDetailsForm.entity.user} - Last modification: #{Session.entDetailsForm.entity.timeStamp}"
--- a/src/main/webapp/imageServer/displayDigi.jsp	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/webapp/imageServer/displayDigi.jsp	Fri Oct 20 16:59:48 2017 +0200
@@ -191,7 +191,7 @@
 	        iipServerURL: divaGlobal.iipServerURL,
 	        digiId: "<%=digiBean.getDigiId()%>",
 	        objectData: divaGlobal.rest_url + "/rest/diva/proxy/json/<%=digiBean.getDigiLabel()%>",
-	        imageDir: "/data7/srv/images/<%=digiBean.getDigiLabel()%>",
+	        imageDir: "/<%=digiBean.getDigiLabel()%>",
 			onSetCurrentPage : handlePageSwitch,
 			onDocumentLoaded : handleDocumentLoaded,
 			zoomLevel: 1,
--- a/src/main/webapp/imageServer/resources/js/diva4ismi.js	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/webapp/imageServer/resources/js/diva4ismi.js	Fri Oct 20 16:59:48 2017 +0200
@@ -1,11 +1,9 @@
 var divaGlobal = {
-		rest_url : "http://localhost:18080/ismi-richfaces",
 		debugModus : false,
-		//rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi",
-		//rest_url : "http://ismi-dev.mpiwg-berlin.mpg.de:8080/ismi-richfaces",
+		rest_url : "https://ismi.mpiwg-berlin.mpg.de/om4-ismi",
 		iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi",
-		drupal_url: "https://ismi-dev.mpiwg-berlin.mpg.de/drupal-ismi",
-		entity_url: "https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/browse/entityDetails.xhtml?eid="
+		drupal_url: "https://ismi.mpiwg-berlin.mpg.de/drupal-ismi",
+		entity_url: "https://ismi.mpiwg-berlin.mpg.de/om4-ismi/browse/entityDetails.xhtml?eid="
 }
 
 function showTitleDetailsBig(titleId){
--- a/src/main/webapp/search/displayTitle.xhtml	Fri Aug 18 14:58:11 2017 -0400
+++ b/src/main/webapp/search/displayTitle.xhtml	Fri Oct 20 16:59:48 2017 +0200
@@ -42,7 +42,7 @@
 
 					<h:outputText value="Title ID" />
                     <h:outputLink
-                        value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{Session.displayAuthor.selectedTitleId}" 
+                        value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{Session.displayTitle.selectedTitleId}" 
                         title="Metadata of the entity">
 					   <h:outputText value="#{Session.displayTitle.selectedTitleId}" />
 				   </h:outputLink>
@@ -228,7 +228,7 @@
 
 						<h:outputText value="Witness ID" />
                         <h:outputLink
-                             value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{Session.displayAuthor.selectedWitnessId}" 
+                             value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{Session.displayTitle.selectedWitnessId}" 
                              title="Metadata of the entity">
 						    <h:outputText value="#{Session.displayTitle.selectedWitnessId}" />
 					    </h:outputLink>