source: other-projects/the-macronizer/trunk/web/jsp/en/main.jsp@ 29855

Last change on this file since 29855 was 29855, checked in by davidb, 9 years ago

John's code after refactoring by Tom over the summer of 2014/2015

File size: 11.1 KB
RevLine 
[29855]1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<%
3 String inputOptionsDisplay;
4 String inputOptionsVisibility;
5 String hiddenInputOptions;
6 if (request.getAttribute("options") != null && request.getAttribute("options").equals("true")) {
7 inputOptionsDisplay = "block";
8 inputOptionsVisibility = "visible";
9 hiddenInputOptions = "true";
10 } else {
11 inputOptionsDisplay = "none";
12 inputOptionsVisibility = "hidden";
13 hiddenInputOptions = "false";
14 }
15 String checkPreserveMacrons;
16 if (request.getAttribute("preserveMacrons") != null && !request.getAttribute("preserveMacrons").equals("true")) {
17 checkPreserveMacrons = "";
18 } else {
19 checkPreserveMacrons = "checked";
20 }
21%>
22
23<html>
24 <head>
25 <%@page contentType="text/html" pageEncoding="UTF-8"%>
26 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
27 <title>The Māori Macron Restoration Service</title>
28 <link href="../../css/css.css" rel="stylesheet" type="text/css" />
29 <script src="../../js/js.js" type="text/javascript"></script>
30
31 <style type="text/css">
32 <% if (request.getAttribute("file") != null) {%>
33 fieldset#download-file, li#download-tab {
34 display: block;
35 visibility: visible;
36 }
37 fieldset#restore-by-input, fieldset#restore-by-upload {
38 display: none;
39 visibility: hidden;
40 }
41 <% } else {%>
42 fieldset#restore-by-input {
43 display: block;
44 visibility: visible;
45 }
46 fieldset#restore-by-upload, fieldset#download-file, li#download-tab {
47 display: none;
48 visibility: hidden;
49 }
50 <% }%>
51
52
53
54
55 </style>
56
57 </head>
58
59 <body>
60 <jsp:include page="header.jsp" />
61
62 <div id="content">
63 <ul id="tabset_tabs">
64 <%
65 String inputTabClass, uploadTabClass, downloadTabClass;
66 inputTabClass = uploadTabClass = downloadTabClass = "";
67 if (request.getAttribute("file") != null) {
68 downloadTabClass = "selected";
69 } else {
70 inputTabClass = "selected";
71 }
72 %>
73 <li id="input-tab" class="<%=inputTabClass%>"> <a href="javascript:toggleTabs('restore-by-input');"> <span>Add Macrons by</span> Direct Input </a> </li>
74 <li id="upload-tab" class="<%=uploadTabClass%>"> <a href="javascript:toggleTabs('restore-by-upload');"> <span>Add Macrons by</span> File Upload </a> </li>
75 <li id="download-tab" class="<%=downloadTabClass%>"> <a href="javascript:void()"> <span>Macronised File</span> Download</a> </li>
76 </ul>
77
78 <div id="fields">
79 <fieldset id="restore-by-input">
80 <legend class="tabset_label">Add Macrons by Direct Input</legend>
81 <form action="../servlet/DirectInput" method="post" >
82 <p class="instructions">Enter the Text</p>
83 <textarea name="fragment" cols="60" rows="18" id="fragment"><%= request.getAttribute("old") != null ? request.getAttribute("old") : ""%></textarea>
84 <!--<textarea name="fragment2" cols="80" rows="18" id="fragment2"><%= request.getAttribute("fragment2") != null ? request.getAttribute("fragment2") : ""%></textarea>
85 --><%= request.getAttribute("fragment2") != null ? request.getAttribute("fragment2") : ""%>
86 <fieldset>
87 <legend class="more-options">
88 <a href="javascript:toggleOptions();">
89 <img id="input-more-options-icon" src="../../images/arrow-closed.png" alt="Advanced Options Icon"></img>
90 Advanced Options
91 </a>
92 </legend>
93 <div id="input-options" class="options" style="display: <%=inputOptionsDisplay%>; visibility: <%=inputOptionsVisibility%>;">
94 <table>
95 <tr>
96 <td>
97 <input name="preserveExistingMacrons" type="checkbox" value="true" <%=checkPreserveMacrons%>></input>
98 <label>Preserve existing macrons</label>
99 </td>
100 </tr>
101 </table>
102 </div>
103 </fieldset>
104 <input type="hidden" name="lang" value="en" />
105 <input id="hidden-input-options" type="hidden" name="options" value="<%= hiddenInputOptions%>" />
106 <p class="submit_button">
107 <input title="Submit to add macrons" type="submit" value="Add Macrons" />
108 </p>
109 </form>
110 </fieldset>
111
112 <fieldset id="restore-by-upload">
113 <legend class="tabset_label">Add Macrons by File Upload</legend>
114 <form action="../servlet/FileUpload" method="post" enctype="multipart/form-data">
115 <p class="instructions">Choose an existing document to upload</p>
116 <p>
117 <label>File:</label>
118 <input type="file" id="uploaded_file" name="file" />
119 </p>
120 <fieldset>
121 <legend class="more-options">
122 <a href="javascript:toggleOptions();">
123 <img id="upload-more-options-icon" src="../../images/arrow-closed.png" alt="Advanced Options Icon"></img>
124 Advanced Options
125 </a>
126 </legend>
127 <div id="upload-options" class="options" style="display: <%=inputOptionsDisplay%>; visibility: <%=inputOptionsVisibility%>;">
128 <table>
129 <tr>
130 <th><label>Character Encoding:</label></th>
131 <td><select id="upload-charset" name="charsetEncoding">
132 <option value="(detect automatically)" selected="selected">(detect automatically)</option>
133 <option value="utf-8">utf-8 (Unicode)</option>
134 <option value="utf-16">utf-16 (Unicode)</option>
135 </select></td>
136 </tr>
137 <tr>
138 <th><label>Document Type:</label></th>
139 <td><select id="upload-doctype" name="fileType">
140 <option value="(detect automatically)" selected="selected">(detect automatically)</option>
141 <option value=".docx">Microsoft Office Word 2007 (.docx)</option>
142 <option value=".odt">Open Office Word (.odt)</option>
143 <option value=".txt">Text (.txt)</option>
144 </select></td>
145 </tr>
146 <tr>
147 <td>
148 <input name="preserveExistingMacrons" type="checkbox" value="true" <%=checkPreserveMacrons%>></input>
149 <label>Preserve existing macrons</label>
150 </td>
151 </tr>
152 </table>
153 </div>
154 </fieldset>
155 <input type="hidden" name="lang" value="en" />
156 <input id="hidden-upload-options" type="hidden" name="options" value="<%= hiddenInputOptions%>" />
157 <p class="submit_button">
158 <input title="Submit to add macrons" type="submit" value="Upload File" />
159 </p>
160 <p class="notes">Note: Supports Microsoft Word 2007 documents, Open Office Text documents and text files.</p>
161 </form>
162 </fieldset>
163
164 <fieldset id="download-file">
165 <legend class="tabset_label">Restored by File Upload</legend>
166 <form action="../servlet/Download" method="post" >
167 <p class="instructions">Output:</p>
168 <div id="options" class="options">
169 <table>
170 <tr>
171 <th><label>File:</label></th>
172 <td><label><%= request.getAttribute("filename")%></label></td>
173 </tr>
174 <tr>
175 <th><label>Character Encoding:</label></th>
176 <td><label><%= request.getAttribute("charsetEncoding")%></label></td>
177 </tr>
178 <tr>
179 <th><label>Document Type:</label></th>
180 <td><label><%= request.getAttribute("fileType")%></label></td>
181 </tr>
182 </table>
183 </div>
184 <%
185 String downloadFilePath = request.getAttribute("file") != null ? ((java.io.File) request.getAttribute("file")).getAbsolutePath() : null;
186 %>
187 <input type="hidden" id="filepath" name="filepath" value="<%=downloadFilePath%>" />
188 <input type="hidden" id="filename" name="filename" value="<%= request.getAttribute("filename")%>" />
189 <p class="submit_button">
190 <input title="Download File" type="submit" value="Download File" />
191 </p>
192 </form>
193 </fieldset>
194 </div>
195 </div>
196
197 <jsp:include page="footer.jsp" />
198 </body>
199</html>
Note: See TracBrowser for help on using the repository browser.