<%@ 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.Institution" %> <% String userName = Sessions.getSessionStringValue(request, "userName"); int paramCount = 0; int instID = -2; try {instID = Integer.parseInt(request.getParameter("instID")); ++paramCount; } catch (Exception e){} String name = request.getParameter("name"); if (name != null) {name = new String(name.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String addr1 = request.getParameter("addr1"); if (addr1 != null) { addr1 = new String(addr1.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String addr2 = request.getParameter("addr2"); if (addr2 != null) { addr2 = new String(addr2.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String place = request.getParameter("place"); if (place != null) { place = new String(place.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String country = request.getParameter("country"); if (country != null) { country = new String(country.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String postCode = request.getParameter("postCode"); if (postCode != null) { postCode = new String(postCode.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String logoURL = request.getParameter("logoURL"); if (logoURL != null) { logoURL = new String(logoURL.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String instURL = request.getParameter("instURL"); if (instURL != null) { instURL = new String(instURL.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String contactName = request.getParameter("contactName"); if (contactName != null) { contactName = new String(contactName.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String contactEmail = request.getParameter("contactEmail"); if (contactEmail != null) { contactEmail = new String(contactEmail.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String contactPhone = request.getParameter("contactPhone"); if (contactPhone != null) { contactPhone = new String(contactPhone.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } String contactFax = request.getParameter("contactFax"); if (contactFax != null) { contactFax = new String(contactFax.getBytes("iso8859-1"), "UTF-8"); ++paramCount; } if (paramCount > 0) { 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); // --------------------------------------------- // assert we have permission if (userName == null || userName.length() == 0) { out.print(""); return; } if (!permission) { out.print(""); return; } Institution orig = null; Institution inst = null; if (instID == -2) { inst = new Institution(); if (name == null) { %> <% return; } } else { orig = Institution.getInstitution(instID); if (orig == null) { %> <% return; } inst = (Institution)orig.clone(); } if (name != null) inst.setInstitutionName(name); if (addr1 != null) inst.setAddress1(addr1); if (addr2 != null) inst.setAddress2(addr2); if (place != null) inst.setPlace(place); System.out.println("place: " + place); if (country != null) inst.setCountry(country); if (postCode != null) inst.setPostCode(postCode); if (logoURL != null) inst.setLogoURL(logoURL); if (instURL != null) inst.setInstitutionURL(instURL); if (contactName != null) inst.setContactName(contactName); if (contactEmail != null) inst.setContactEmail(contactEmail); if (contactPhone != null) inst.setContactPhone(contactPhone); if (contactFax != null) inst.setContactFax(contactFax); if (orig != null) { System.out.println("place: " + orig.getPlace() + " : " + inst.getPlace()); inst.save(orig); } else { inst = inst.saveNew(); } out.print(""); return; } %>

institute/put

Create a new or update an existing institution record.

Parameters

instIDInstitution ID, supply to edit an existing institution; otherwise, do not include when adding a new institution
nameInstitution name
addr1Address line 1
addr2Address line 2
placeLocal region (city, ST), e.g., Münster
countryCountry
postCodePostal code
logoURLURL to institution logo
instURLURL to institution's homepage
contactNameContact Name
contactEmailContact Email
contactPhoneContact Phone
contactFaxContact Fax