Project

General

Profile

« Previous | Next » 

Revision 3454

Added by barteau over 17 years ago

Moved location of file from skin to common, since it is independant of a single skin. Modified most of the internal code to allow redirecting request to an appropriate destination.

View differences:

lib/style/common/ClientViewHelper.jspx
1
<?xml version="1.0" encoding="UTF-8"?>
2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
3
    
4
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
5
    <jsp:directive.page import="com.oreilly.servlet.multipart.MultipartParser"/>
6
    <jsp:directive.page import="edu.ucsb.nceas.metacat.MetaCatUtil"/>
7
    <jsp:directive.page import="java.io.*"/>
8
    <jsp:directive.page import="javax.servlet.*"/>
9
    <jsp:directive.page import="javax.servlet.http.*"/>
10
    <jsp:directive.page import="edu.ucsb.nceas.metacat.clientview.ClientViewHelper"/>
11
    
12
    <jsp:declaration>
13
        String                                              message, newUrl;
14
        String                                              contentType, posted_ldapUserName;
15
        
16
        private ClientViewHelper                            clientHelper;
17
        private MultipartParser                             multipartParser;
18
        private int                                         sizeLimit;
19
        private String                                      contenType;
20
    </jsp:declaration>
21
    
22
    <jsp:scriptlet>
23
        sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
24
        clientHelper = ClientViewHelper.clientViewHelperInstance(request);
25
        
26
        contentType = request.getContentType();
27
        message = "";
28
        if (clientHelper.isLoggedIn()) {
29
            if (contentType != null &amp;&amp; contentType.contains("multipart/form-data")) {
30
                //*** Process request here if a file update.
31
                //*** Init the MultipartParser.
32
                multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
33
                message = clientHelper.handleFileUpdate(multipartParser);
34
            } else {
35
                //*** Process request here if a delete.
36
                message = clientHelper.clientRequest(request, response);
37
            }
38
        } else {
39
            message = "You need to be logged in.";
40
        }
41
        response.setContentType("text/html;charset=UTF-8");
42
        newUrl = clientHelper.makeRedirectUrl();
43
        response.sendRedirect("../../" + newUrl);
44
    </jsp:scriptlet>
45
</jsp:root>
0 46

  

Also available in: Unified diff