%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Page" %>
<%@ page import="javax.validation.constraints.NotNull" %>
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%@ page import="org.crosswire.webtools.annotation.*" %>
<%@ page import="org.crosswire.webtools.*" %>
<%!
@Description(value = "Delete index information about the content of a manuscript page.", name = "biblicalcontent/delete")
public static class MyParameters extends Parameters {
@NotNull
@Description(value = "manuscript id to modify", example = "10046")
public Integer docID = null;
@NotNull
@Description(value = "page id to modify", example = "10")
public Integer pageID = null;
protected Page mssPage = null;
@Override
protected void customValidation() {
if (docID != null && pageID != null) {
mssPage = Page.getPage(docID, pageID);
if (mssPage == null) {
addError(-5, "docID: " + docID + "; pageID: " + pageID + " not found.");
return;
}
if (getUser() == null) {
addError(-6, "No permission. User not logged in.");
return;
}
boolean permission = getUser().hasRole("VMR Administrator") || getUser().hasRole("Index Manager");
if (!permission && mssPage.getIndexerID() != null && !mssPage.getIndexerID().equals(getUser().getUserName())) {
addError(-7, "User not an Index Manager. To request change to existing data, consider discussing this page on the forum.");
return;
}
}
else format = "html";
}
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.getErrors().size() == 0) {
// let's remove the biblical content for the page
params.mssPage.deleteBiblicalContent();
Serializer.output(response, out, params, XMLBlock.createXMLBlock(""));
return;
}
Serializer.reportErrors(request, response, out, params, true);
%>