index.jsp 3.8 KB
Newer Older
1
<%@ page info="index" contentType="text/html; charset=utf-8" pageEncoding="utf-8" session="false" %>
Maxime Sinclair's avatar
Maxime Sinclair committed
2
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
3

4
<c:set var="cfg" value="${applicationScope['cfg']}" />
5
6
<c:set var="contextroot" value="${pageContext.request.contextPath}" />
<c:set var="hostpath" value="http://${pageContext.request.serverName}:${pageContext.request.serverPort}${contextroot}" />
7
8
9
<c:if test="${pageContext.request.serverPort == 80 }">
    <c:set var="hostpath" value="http://${pageContext.request.serverName}${contextroot}" />
</c:if>
10
<c:if test="${!empty encoded}">
11
    <c:set var="imgurl" value="${hostpath}/png/${encoded}" />
12
13
14
15
16
17
    <c:set var="svgurl" value="${hostpath}/svg/${encoded}" />
    <c:set var="txturl" value="${hostpath}/txt/${encoded}" />
    <c:if test="${!empty mapneeded}">
        <c:set var="mapurl" value="${hostpath}/map/${encoded}" />
    </c:if>
</c:if>
18
19
20
21
22
23
24
25

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache, must-revalidate" />
26
27
    <link rel="icon" href="${contextroot}/favicon.ico" type="image/x-icon"/> 
    <link rel="shortcut icon" href="${contextroot}/favicon.ico" type="image/x-icon"/>
28
29
30
    <link rel="stylesheet" href="${contextroot}/plantuml.css" />
    <link rel="stylesheet" href="webjars/codemirror/3.21/lib/codemirror.css" />
    <script src="webjars/codemirror/3.21/lib/codemirror.js"></script>
31
32
33
34
35
36
37
38
39
    <script src="mode/plantuml.js"></script>
    <script>
        window.onload = function() {
            var myCodeMirror = CodeMirror.fromTextArea(
                document.getElementById("text"), 
                {lineNumbers: true}
            );
        };
    </script>
40
41
42
43
44
    <title>PlantUMLServer</title>
</head>
<body>
<div id="header">
    <%-- PAGE TITLE --%>
45
    <h1>PlantUML Server</h1>
46
47
    <c:if test="${cfg['SHOW_SOCIAL_BUTTONS'] eq 'on' }">
        <%@ include file="resource/socialbuttons1.html" %>
48
    </c:if>
49
    <p>This application provides a servlet which serves images created by <a href="http://plantuml.sourceforge.net">PlantUML</a>.</p>
50
51
52
</div>
<div id="content">
    <%-- CONTENT --%>
53
    <form method="post" accept-charset="UTF-8"  action="${contextroot}/form">
54
        <p>
55
            <textarea id="text" name="text" cols="120" rows="10"><c:out value="${decoded}"/></textarea>
56
57
58
59
            <input type="submit" />
        </p>
    </form>
    <hr/>
60
    <p>You can enter here a previously generated URL:</p>
61
    <form method="post" action="${contextroot}/form">
62
        <p>
63
            <input name="url" type="text" size="150" value="${imgurl}" />
64
65
66
67
            <br/>
            <input type="submit"/>
        </p>
    </form>
68
69
70
71
72
73
74
    <c:if test="${!empty imgurl}">
        <hr/>
        <a href="${svgurl}">View as SVG</a>&nbsp;
        <a href="${txturl}">View as ASCII Art</a>&nbsp;
        <c:if test="${!empty mapurl}">
            <a href="${mapurl}">View Map Data</a>
        </c:if>
75
76
77
        <c:if test="${cfg['SHOW_SOCIAL_BUTTONS'] == 'on' }">
            <%@ include file="resource/socialbuttons2.jspf" %>
        </c:if>
78
79
80
81
82
83
84
85
86
87
88
89
90
91
        <p id="diagram">
            <c:choose>
            <c:when test="${!empty mapurl}">
                <img src="${imgurl}" alt="PlantUML diagram" usemap="#umlmap" />
                <map name="umlmap">
                    <c:import url="${mapurl}" />
                </map>
            </c:when>
            <c:otherwise>
                <img src="${imgurl}" alt="PlantUML diagram" />
            </c:otherwise>
            </c:choose>
        </p>
    </c:if>
92
</div>
93
94
<%-- FOOTER --%>
<%@ include file="footer.jspf" %> 
95
96
</body>
</html>