<%@ 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.Document" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Page" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Surrogate.SurrogateImage" %> <% String userName = Sessions.getSessionStringValue(request, "userName"); 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 imageURI = request.getParameter("uri"); String surrID = request.getParameter("surrID"); String attribution = request.getParameter("attribution"); if (attribution != null) attribution = new String(attribution.getBytes("iso8859-1"), "UTF-8"); int distLicID = -1; try {distLicID = Integer.parseInt(request.getParameter("distLicID"));} catch (Exception e){} int protectLevel = -1; try {protectLevel = Integer.parseInt(request.getParameter("protectLevel"));} catch (Exception e){} if (docID > -1 && pageID > -1) { response.setContentType("text/xml"); String role = "VMR Administrator"; // let's check to see if we're a privileged user boolean permission = RightsAndRoles.hasRole(request, response, role); if (!permission) { Document doc = Document.getDocument(docID); permission = userName != null && userName.equals(doc.getUserID()); } // --------------------------------------------- if (permission) { Page p = Page.getPage(docID, pageID); if (p != null) { SurrogateImage surrogateImage = null; // if we've been given a surrID, then we'll see if we can find an existing object to modify if (surrID != null) { for (SurrogateImage si : p.getSurrogateImages()) { if (surrID.equals(si.getSurrogateID())) { surrogateImage = si; } } } if (surrogateImage != null) { if (imageURI != null) surrogateImage.setURL(imageURI); if (distLicID > -1) surrogateImage.setDistributionLicenseID(distLicID); if (protectLevel > -1) surrogateImage.setProtectLevel(protectLevel); if (attribution != null) surrogateImage.setAttribution(attribution); p.removeSurrogateImage(surrogateImage.getSurrogateID()); } else { surrogateImage = new SurrogateImage(p, imageURI, imageURI, (distLicID != -1 ? distLicID : 0), (protectLevel != -1 ? protectLevel : 0), attribution, userName); } p.addSurrogateImage(surrogateImage); %> <% } else { %> <% } } else { %> <% } return; } %>

image/put

Submit a new image URL for a manuscript page

Parameters

docIDmanuscript id for the image, e.g., 10046
pageIDpage id for the image, e.g., 10
surrIDoptional, surrogate id for the image. If not given, one will be assigned. e.g., 10
uriimage uri
distLicIDdistribution license id. [0 - public, 1 - expert access]
protectLevellevel of protect for image. Higher levels make it harder to grab image from viewer, but also make loading slower and sometimes disable caching. Default: 0
attributioncredit attribution which should be associated with image, e.g., "Image courtesy of <a href="http://XYZlib.com">XYX Library<a>