diff --git a/dspace/CHANGES b/dspace/CHANGES index 74b6355a7b..7f7197b040 100644 --- a/dspace/CHANGES +++ b/dspace/CHANGES @@ -38,6 +38,7 @@ - SF patch #1561292 for SF bug #1554064 - SF patch #1563523 for SF bug #1548865 Browse errors on withdrawn item - SF patch #1556207 for SF bug #1554056 Community/collection handle URL with / redirects to homepage +- SF patch #1571494 for SF bug #1571490 - UTF-8 encoded characters in licence (Mark Diggory) - SF patch #1523824 robots.txt to limit bots navigating author and date pages diff --git a/dspace/config/language-packs/Messages.properties b/dspace/config/language-packs/Messages.properties index 3cd3d7d3be..155fd01115 100644 --- a/dspace/config/language-packs/Messages.properties +++ b/dspace/config/language-packs/Messages.properties @@ -302,6 +302,12 @@ jsp.dspace-admin.item-select.id = Internal ID: jsp.dspace-admin.item-select.text = The ID you entered isn't a valid item ID. If you're trying to edit a community or collection, you need to use the communities/collections admin page. jsp.dspace-admin.item-select.title = Select Item +jsp.dspace-admin.license-edit.title = Edit Default License +jsp.dspace-admin.license-edit.heading = Default License Editor +jsp.dspace-admin.license-edit.description = Edit the default license by using the text box below. The license cannot be empty.
Please ensure the license meets the legal conditions of your country.
Changing this license will not affect those items already published and collections with their own licenses. +jsp.dspace-admin.license-edit.edited = The Default License has been updated +jsp.dspace-admin.license-edit.empty = You must enter a license! + jsp.dspace-admin.list-metadata-fields.schemas = Schemas jsp.dspace-admin.list-metadata-fields.schema = Schema jsp.dspace-admin.list-metadata-fields.element = Element @@ -553,6 +559,7 @@ jsp.layout.navbar-admin.metadataregistry = Metadata
Registry jsp.layout.navbar-admin.formatregistry = Bitstream Format
Registry jsp.layout.navbar-admin.workflow = Workflow jsp.layout.navbar-admin.authorization = Authorization +jsp.layout.navbar-admin.editlicense = Edit Default
License jsp.layout.navbar-admin.editnews = Edit News jsp.layout.navbar-admin.supervisors = Supervisors jsp.layout.navbar-admin.statistics = Statistics diff --git a/dspace/docs/configure.html b/dspace/docs/configure.html index 510f28f5b2..1f175a1bd9 100644 --- a/dspace/docs/configure.html +++ b/dspace/docs/configure.html @@ -209,7 +209,34 @@ property2.name = ${dspace.dir}/rest/of/path
  • License
  • - + +

    The Default Submission License

    +

    For each submitted item, a license must be granted. The license will be stored along with the item in the bundle LICENSE in order to keep the information under which terms an items has been published.

    +

    You may define a license for each collection seperately, when creating/editing a collection. If no collection specific license is defined, the default license is used.

    +

    The default license can be found in [dspace]/config/default.license and can be edited via the dspace-admin interface.

    +

    DSpace comes with a demo license, which you must adopt to your institutional needs and the legal regulations of your country.

    +

    If in doubt, contact the law department of your institution.

    +

    Possible Points in a License

    + Note, that this is no legal advice, just some starting thoughts for creating you own license. + +

    Activating Additional OAI-PMH Crosswalks

    DSpace comes with an unqualified DC Crosswalk used in the default OAI-PMH data provider. There are also other Crosswalks bundled with the DSpace distribution which can be activated by editing one or more configuration files. How to do this for each available Crosswalk is described below.

    diff --git a/dspace/docs/index.html b/dspace/docs/index.html index d0c4c12576..4f7b4b1e66 100644 --- a/dspace/docs/index.html +++ b/dspace/docs/index.html @@ -72,6 +72,7 @@
  • Wording of E-mail Messages
  • Local DSpace Administrator Contact Information
  • The Dublin Core and Bitstream Format Registries
  • +
  • The Default Submission License
  • Activating Additional OAI-PMH Crosswalks
  • Configuration Files for Other Applications
  • Customizing the Web User Interface
  • diff --git a/dspace/etc/dspace-web.xml b/dspace/etc/dspace-web.xml index b4339bfc8c..4e13301bdd 100644 --- a/dspace/etc/dspace-web.xml +++ b/dspace/etc/dspace-web.xml @@ -225,6 +225,11 @@ org.dspace.app.webui.servlet.admin.NewsEditServlet + + edit-license + org.dspace.app.webui.servlet.admin.LicenseEditServlet + + eperson-list org.dspace.app.webui.servlet.admin.EPersonListServlet @@ -467,6 +472,11 @@ /dspace-admin/news-edit + + edit-license + /dspace-admin/license-edit + + eperson-list /tools/eperson-list diff --git a/dspace/jsp/dspace-admin/license-edit.jsp b/dspace/jsp/dspace-admin/license-edit.jsp new file mode 100644 index 0000000000..ed89d484b4 --- /dev/null +++ b/dspace/jsp/dspace-admin/license-edit.jsp @@ -0,0 +1,110 @@ +<%-- license-edit.jsp + - + - Copyright (c) 2002, Hewlett-Packard Company and Massachusetts + - Institute of Technology. All rights reserved. + - + - Redistribution and use in source and binary forms, with or without + - modification, are permitted provided that the following conditions are + - met: + - + - - Redistributions of source code must retain the above copyright + - notice, this list of conditions and the following disclaimer. + - + - - Redistributions in binary form must reproduce the above copyright + - notice, this list of conditions and the following disclaimer in the + - documentation and/or other materials provided with the distribution. + - + - - Neither the name of the Hewlett-Packard Company nor the name of the + - Massachusetts Institute of Technology nor the names of their + - contributors may be used to endorse or promote products derived from + - this software without specific prior written permission. + - + - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + - HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + - DAMAGE. + --%> + +<%-- + - License Edit Form JSP + - + - Attributes: + - license - The license to edit + --%> + +<%@ page contentType="text/html;charset=UTF-8" %> + +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> + +<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> + +<% + // Get the existing license + String license = (String)request.getAttribute("license"); + if (license == null) + { + license = ""; + } + + // Are there any messages to show? + String message = (String)request.getAttribute("edited"); + boolean edited = false; + if ((message != null) && (message.equals("true"))) + { + edited = true; + } + message = (String)request.getAttribute("empty"); + boolean empty = false; + if ((message != null) && (message.equals("true"))) + { + empty = true; + } + +%> + + + +

    + +
    + + <% + if (edited) + { + %> +

    + +

    + <% + } + %> + <% + if (empty) + { + %> +

    + +

    + <% + } + %> + +

    +


    + " /> + " /> +

    +
    +
    diff --git a/dspace/jsp/help/site-admin.html b/dspace/jsp/help/site-admin.html index 9ef6a9e732..a8a79f7ffb 100644 --- a/dspace/jsp/help/site-admin.html +++ b/dspace/jsp/help/site-admin.html @@ -32,6 +32,7 @@
  • Workflow
  • Authorization
  • Edit News
  • +
  • Edit Default License
  • General Information

    @@ -413,6 +414,11 @@ or modified by typing directly in the box. You can use HTML tags to format the text, but note that the html won't be validated here.

     

    + +

    Edit Default License

    +

    You can use this tool to edit the default license of DSpace

    +

    The default license is used when no collection specific license is defined.

    +

    Note that changing the default license has no effect on allready published items.

    diff --git a/dspace/jsp/layout/navbar-admin.jsp b/dspace/jsp/layout/navbar-admin.jsp index 6535f08e0f..07d17588f5 100644 --- a/dspace/jsp/layout/navbar-admin.jsp +++ b/dspace/jsp/layout/navbar-admin.jsp @@ -146,6 +146,15 @@ + + + .gif" width="16" height="16"/> + + + + + + .gif" width="16" height="16"/> diff --git a/dspace/src/org/dspace/app/webui/servlet/admin/LicenseEditServlet.java b/dspace/src/org/dspace/app/webui/servlet/admin/LicenseEditServlet.java new file mode 100644 index 0000000000..8b954d9b07 --- /dev/null +++ b/dspace/src/org/dspace/app/webui/servlet/admin/LicenseEditServlet.java @@ -0,0 +1,141 @@ +/* + * LicenseEditServlet.java + * + * Version: $Revision$ + * + * Date: $Date$ + * + * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts + * Institute of Technology. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Hewlett-Packard Company nor the name of the + * Massachusetts Institute of Technology nor the names of their + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + */ +package org.dspace.app.webui.servlet.admin; + +import java.io.IOException; +import java.sql.SQLException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.dspace.app.webui.servlet.DSpaceServlet; +import org.dspace.app.webui.util.JSPManager; +import org.dspace.app.webui.util.UIUtil; +import org.dspace.authorize.AuthorizeException; +import org.dspace.core.ConfigurationManager; +import org.dspace.core.Context; + +/** + * Servlet for editing the default license + * + * @author Stuart Lewis + */ +public class LicenseEditServlet extends DSpaceServlet +{ + /** The logger */ + private static Logger log = Logger.getLogger(LicenseEditServlet.class); + + /** + * Handle GET requests. This does nothing but forwards + * the request on to the POST handler. + */ + protected void doDSGet(Context c, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException, + SQLException, AuthorizeException + { + // Forward on to the post handler + this.doDSPost(c, request, response); + } + + /** + * Handle the POST requests. + */ + protected void doDSPost(Context c, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException, + SQLException, AuthorizeException + { + //Get submit button + String button = UIUtil.getSubmitButton(request, "submit"); + + if (button.equals("submit_cancel")) + { + // Show main admin index + JSPManager.showJSP(request, response, "/dspace-admin/index.jsp"); + } + else if (!button.equals("submit_save")) + { + // Get the existing text from the ConfigurationManager + String license = ConfigurationManager.getDefaultSubmissionLicense(); + + // Pass the existing license back to the JSP + request.setAttribute("license", license); + + // Show edit page + JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); + } + else + { + // Get text string from form + String license = (String)request.getParameter("license"); + + // Is the license empty? + if (license.trim().equals("")) + { + // Get the existing text from the ConfigurationManager + license = ConfigurationManager.getDefaultSubmissionLicense(); + + // Pass the existing license back to the JSP + request.setAttribute("license", license); + + // Pass the 'empty' message back + request.setAttribute("empty", "true"); + + // Show edit page + JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); + } + else + { + // Write the string out to file + ConfigurationManager.writeLicenseFile(license); + + // Pass the existing license back to the JSP + request.setAttribute("license", license); + + // Pass the 'edited' message back + request.setAttribute("edited", "true"); + + // Show edit page + JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); + } + } + } +} diff --git a/dspace/src/org/dspace/core/ConfigurationManager.java b/dspace/src/org/dspace/core/ConfigurationManager.java index ab2cd4be9c..d423b35516 100644 --- a/dspace/src/org/dspace/core/ConfigurationManager.java +++ b/dspace/src/org/dspace/core/ConfigurationManager.java @@ -389,8 +389,6 @@ public class ConfigurationManager // write the news out to the appropriate file FileOutputStream fos = new FileOutputStream(fileName); OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF-8"); - - // BufferedWriter bw = new BufferedWriter( osr ); PrintWriter out = new PrintWriter(osr); out.print(news); out.close(); @@ -403,6 +401,34 @@ public class ConfigurationManager return news; } + /** + * Writes license to a text file. + * + * @param news + * the text to be written to the file. + */ + public static void writeLicenseFile(String newLicense) + { + String licenseFile = getProperty("dspace.dir") + File.separator + + "config" + File.separator + "default.license"; + + try + { + // write the news out to the appropriate file + FileOutputStream fos = new FileOutputStream(licenseFile); + OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF-8"); + PrintWriter out = new PrintWriter(osr); + out.print(newLicense); + out.close(); + } + catch (IOException e) + { + warn("license_write: " + e.getLocalizedMessage()); + } + + license = newLicense; + } + private static File loadedFile = null; /** @@ -485,8 +511,10 @@ public class ConfigurationManager // Load in default license String licenseFile = getProperty("dspace.dir") + File.separator + "config" + File.separator + "default.license"; - - BufferedReader br = new BufferedReader(new FileReader(licenseFile)); + + FileInputStream fir = new FileInputStream(licenseFile); + InputStreamReader ir = new InputStreamReader(fir, "UTF-8"); + BufferedReader br = new BufferedReader(ir); String lineIn; license = "";