<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="org.crosswire.utils.Sessions" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.xml.XMLDataElement" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Feature" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Document" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Page" %> <%@ page import="org.crosswire.sword.keys.VerseKey" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.HashMap" %> <% //String displayURL="/manuscript-workspace"; String displayURL="/web/paratexbib/manuscript-workspace"; String userName = Sessions.getSessionStringValue(request, "userName"); long featureID = -1; try {featureID = Long.parseLong(request.getParameter("featureID"));} catch (Exception e){} int diktyonNumber = -1; try {diktyonNumber = Integer.parseInt(request.getParameter("diktyonNumber"));} catch (Exception e){} if (featureID > -1 || diktyonNumber > -1) { int docID = -1; int pageID = -1; Feature feature = null; if (diktyonNumber > -1) { Document.SearchFilter sf = new Document.SearchFilter(); Document.SearchFilter.FeatureCriteria fc = new Document.SearchFilter.FeatureCriteria("DiktyonNumber", Feature.AuxDataField.INTVAL1, Document.SearchFilter.FeatureCriteria.OPERATOR_EQUALS, new Integer(diktyonNumber)); sf.addFeatureCriteria(fc); Document docs[] = Document.searchDocuments(true, sf); if (docs != null && docs.length > 0) { for (Feature f : Feature.getFeatures(docs[0].getDocumentID())) { if (fc.matches(f)) { feature = f; break; } } if (featureID < -1) { response.setContentType("text/xml"); %> <% return; } } } else { if (featureID > 970000000000L && featureID < 979999999999L) { docID = (int)(featureID - 970000000000L) / 10000; pageID = 0; Document.SearchFilter searchFilter = new Document.SearchFilter(); searchFilter.docID = docID; VerseKey vk = new VerseKey(); vk.setTestament((int)(featureID % 10000) / 1000); vk.setBook((int)(featureID % 1000) / 10); searchFilter.biblicalContent = vk.getBookName(); Document docs[] = Document.searchDocuments(true, searchFilter); if (docs.length > 0 && docs[0].getPages().length > 0) { pageID = docs[0].getPages()[(featureID%2 == 0) ? 0 : docs[0].getPages().length-1].getPageID(); } %> "> <% return; } feature = Feature.getFeature(featureID); if (feature == null) { response.setContentType("text/xml"); %> <% return; } } if (feature != null) { %> "> <% } return; } %>

paratext/display

Redirect to display a manuscript, based on Diktyon Number or ParatexBib FeatureID

Parameters

featureIDfeatureID of a specific ParatexBib tag
diktyonNumberDiktyon Number of the manuscript
<%! /** * take Feature xml and format it to ParatexBib XML */ static String formatParatexBibXML(String featureXML, Integer diktyonNumber) { XMLBlock xml = XMLBlock.createXMLBlock(featureXML); if (diktyonNumber != null) { xml.setAttribute("diktyonNumber", diktyonNumber.toString()); } XMLDataElement v = xml.getElement("intVal1"); if (v != null) { String val = "1".equals(v.getText()) ? "open" : "2".equals(v.getText()) ? "close" : "single"; xml.createValue("auxData", val).setAttribute("fieldName", "type"); xml.removeChild(v); } v = xml.getElement("stringVal1"); if (v != null) { xml.createValue("auxData", v.getText()).setAttribute("fieldName", "locationOnPage"); xml.removeChild(v); } v = xml.getElement("stringVal2"); if (v != null) { xml.createValue("auxData", v.getText()).setAttribute("fieldName", "folio"); xml.removeChild(v); } v = xml.getElement("intVal2"); if (v != null) { xml.createValue("auxData", v.getText()).setAttribute("fieldName", "paratexBibFeatureID"); xml.removeChild(v); } return xml.toString(); } %>