<%@ 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.community.RightsAndRoles" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Feature" %> <%@ page import="java.util.Date" %> <%@ page import="java.awt.Rectangle" %> <% String userName = Sessions.getSessionStringValue(request, "userName"); int featureID = -1; try {featureID = Integer.parseInt(request.getParameter("featureID"));} catch (Exception e){} int docID = -1; try {docID = Integer.parseInt(request.getParameter("docID"));} catch (Exception e){} int pageID = -1; try {pageID = Integer.parseInt(request.getParameter("pageID"));} catch (Exception e){} String featureCode = request.getParameter("featureCode"); String prose = request.getParameter("prose"); if (prose != null) prose = new String(prose.getBytes("iso8859-1"), "UTF-8"); String regionBox = request.getParameter("regionBox"); boolean anonymous = userName == null || userName.length() == 0; if (docID > -1 || featureID > -1) { response.setContentType("text/xml"); String role = "VMR Administrator"; // let's check to see if we're a privileged user boolean manager = RightsAndRoles.hasRole(request, response, role); Feature orig = null; Feature feature = null; if (featureID > -1) { orig = Feature.getFeature(featureID); if (orig == null) { out.print(""); return; } feature = (Feature)orig.clone(); } else feature = new Feature(); if (!anonymous && (feature.getUserID() == null || feature.getUserID().length() == 0 || feature.getUserID().equals(userName) || manager)) { if (docID > -1) feature.setDocumentID(docID); if (pageID > -1) feature.setPageID(pageID); if (featureCode != null) feature.setFeatureCode(featureCode); if (prose != null) feature.setProse(prose); if (userName != null) feature.setUserID(userName); String p = request.getParameter("stringVal1"); if (p != null) feature.setStringVal1(new String(p.getBytes("iso8859-1"), "UTF-8")); p = request.getParameter("stringVal2"); if (p != null) feature.setStringVal2(new String(p.getBytes("iso8859-1"), "UTF-8")); p = request.getParameter("intVal1"); try { if (p != null) feature.setIntVal1(Integer.parseInt(p)); } catch (Exception e) {} p = request.getParameter("intVal2"); try { if (p != null) feature.setIntVal2(Integer.parseInt(p)); } catch (Exception e) {} p = request.getParameter("dateVal1"); try { if (p != null) feature.setDateVal1(new Date(p)); } catch (Exception e) {} p = request.getParameter("dateVal2"); try { if (p != null) feature.setDateVal2(new Date(p)); } catch (Exception e) {} if (regionBox != null) { boolean success = false; try { Rectangle r = new Rectangle(); int wordStart = 0; int offset = regionBox.indexOf("+"); if (offset > -1) { r.x = Integer.parseInt(regionBox.substring(wordStart,offset)); wordStart = offset + 1; offset = regionBox.indexOf("+", wordStart); if (offset > -1) { r.y = Integer.parseInt(regionBox.substring(wordStart,offset)); wordStart = offset + 1; offset = regionBox.indexOf("+", wordStart); if (offset > -1) { r.width = Integer.parseInt(regionBox.substring(wordStart,offset)) - r.x; r.height = Integer.parseInt(regionBox.substring(offset+1)) - r.y; feature.setRegionBox(r); success = true; } } } } catch (Exception e) {} if (!success) { feature.setRegionBox(null); } } if (orig != null) { feature.save(orig); } else { feature = feature.saveNew(); } out.print(""); } else { if (anonymous) { out.print(""); } else { out.print(""); } } return; } %>

feature/put

Submit a new or modified feature for a manuscript or manuscript page

Parameters

featureIDfeature id to modify. if not provided, a new feature will be created.
docIDmanuscript id of the feature, e.g., 10046
pageIDpage id of the feature, e.g., 10
featureCodetype of this feature
proseauthor's prose regarding this feature
regionBoxlocation on page for this feature. left+upper+right+lower, e.g., 0+0+20+20
stringVal1specialized field data relative to the specific feature code
stringVal2specialized field data relative to the specific feature code
intVal1specialized field data relative to the specific feature code
intVal2specialized field data relative to the specific feature code
dateVal1specialized field data relative to the specific feature code
dateVal2specialized field data relative to the specific feature code