1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| package org.apache.xindice.webadmin.viewer; |
21 |
| |
22 |
| import java.io.IOException; |
23 |
| import java.io.OutputStreamWriter; |
24 |
| import java.io.Writer; |
25 |
| import java.util.HashMap; |
26 |
| import java.util.Map; |
27 |
| |
28 |
| import javax.servlet.ServletException; |
29 |
| import javax.servlet.http.HttpServletResponse; |
30 |
| |
31 |
| import org.apache.xindice.server.Xindice; |
32 |
| import org.apache.xindice.webadmin.WebAdminManager; |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| public abstract class HtmlViewerComponent { |
41 |
| |
42 |
| static final Object[][] entitiesArray = |
43 |
| {{"quot", new Integer(34)}, |
44 |
| {"amp", new Integer(38)}, |
45 |
| {"lt", new Integer(60)}, |
46 |
| {"gt", new Integer(62)}, |
47 |
| {"nbsp", new Integer(160)}, |
48 |
| {"copy", new Integer(169)}, |
49 |
| {"reg", new Integer(174)}, |
50 |
| {"Agrave", new Integer(192)}, |
51 |
| {"Aacute", new Integer(193)}, |
52 |
| {"Acirc", new Integer(194)}, |
53 |
| {"Atilde", new Integer(195)}, |
54 |
| {"Auml", new Integer(196)}, |
55 |
| {"Aring", new Integer(197)}, |
56 |
| {"AElig", new Integer(198)}, |
57 |
| {"Ccedil", new Integer(199)}, |
58 |
| {"Egrave", new Integer(200)}, |
59 |
| {"Eacute", new Integer(201)}, |
60 |
| {"Ecirc", new Integer(202)}, |
61 |
| {"Euml", new Integer(203)}, |
62 |
| {"Igrave", new Integer(204)}, |
63 |
| {"Iacute", new Integer(205)}, |
64 |
| {"Icirc", new Integer(206)}, |
65 |
| {"Iuml", new Integer(207)}, |
66 |
| {"ETH", new Integer(208)}, |
67 |
| {"Ntilde", new Integer(209)}, |
68 |
| {"Ograve", new Integer(210)}, |
69 |
| {"Oacute", new Integer(211)}, |
70 |
| {"Ocirc", new Integer(212)}, |
71 |
| {"Otilde", new Integer(213)}, |
72 |
| {"Ouml", new Integer(214)}, |
73 |
| {"Oslash", new Integer(216)}, |
74 |
| {"Ugrave", new Integer(217)}, |
75 |
| {"Uacute", new Integer(218)}, |
76 |
| {"Ucirc", new Integer(219)}, |
77 |
| {"Uuml", new Integer(220)}, |
78 |
| {"Yacute", new Integer(221)}, |
79 |
| {"THORN", new Integer(222)}, |
80 |
| {"szlig", new Integer(223)}, |
81 |
| {"agrave", new Integer(224)}, |
82 |
| {"aacute", new Integer(225)}, |
83 |
| {"acirc", new Integer(226)}, |
84 |
| {"atilde", new Integer(227)}, |
85 |
| {"auml", new Integer(228)}, |
86 |
| {"aring", new Integer(229)}, |
87 |
| {"aelig", new Integer(230)}, |
88 |
| {"ccedil", new Integer(231)}, |
89 |
| {"egrave", new Integer(232)}, |
90 |
| {"eacute", new Integer(233)}, |
91 |
| {"ecirc", new Integer(234)}, |
92 |
| {"euml", new Integer(235)}, |
93 |
| {"igrave", new Integer(236)}, |
94 |
| {"iacute", new Integer(237)}, |
95 |
| {"icirc", new Integer(238)}, |
96 |
| {"iuml", new Integer(239)}, |
97 |
| {"igrave", new Integer(236)}, |
98 |
| {"iacute", new Integer(237)}, |
99 |
| {"icirc", new Integer(238)}, |
100 |
| {"iuml", new Integer(239)}, |
101 |
| {"eth", new Integer(240)}, |
102 |
| {"ntilde", new Integer(241)}, |
103 |
| {"ograve", new Integer(242)}, |
104 |
| {"oacute", new Integer(243)}, |
105 |
| {"ocirc", new Integer(244)}, |
106 |
| {"otilde", new Integer(245)}, |
107 |
| {"ouml", new Integer(246)}, |
108 |
| {"oslash", new Integer(248)}, |
109 |
| {"ugrave", new Integer(249)}, |
110 |
| {"uacute", new Integer(250)}, |
111 |
| {"ucirc", new Integer(251)}, |
112 |
| {"uuml", new Integer(252)}, |
113 |
| {"yacute", new Integer(253)}, |
114 |
| {"thorn", new Integer(254)}, |
115 |
| {"yuml", new Integer(255)}, |
116 |
| {"euro", new Integer(8364)}, |
117 |
| }; |
118 |
| static Map entities = new HashMap(); |
119 |
| |
120 |
| static { |
121 |
1
| for (int i = 0; i < entitiesArray.length; ++i) {
|
122 |
74
| entities.put(entitiesArray[i][1], entitiesArray[i][0]);
|
123 |
| } |
124 |
| } |
125 |
| |
126 |
| |
127 |
| |
128 |
| |
129 |
| |
130 |
| |
131 |
| |
132 |
0
| public static String htmlescape(String unescaped) {
|
133 |
0
| return htmlescape(unescaped, false);
|
134 |
| } |
135 |
| |
136 |
| |
137 |
| |
138 |
| |
139 |
| |
140 |
| |
141 |
| |
142 |
| |
143 |
0
| public static String htmlescape(String unescaped, boolean brake) {
|
144 |
0
| StringBuffer buf = new StringBuffer();
|
145 |
0
| for (int i = 0; i < unescaped.length(); ++i) {
|
146 |
0
| char ch = unescaped.charAt(i);
|
147 |
0
| String entity = (String) entities.get(new Integer((int) ch));
|
148 |
0
| if (entity == null) {
|
149 |
0
| if (((int) ch) > 128) {
|
150 |
0
| buf.append("&#").append ((int) ch).append(";");
|
151 |
| } else { |
152 |
0
| buf.append(ch);
|
153 |
| } |
154 |
| } else { |
155 |
0
| buf.append("&").append(entity).append(";");
|
156 |
| } |
157 |
0
| if (brake && ch == '>') {
|
158 |
0
| buf.append("\n");
|
159 |
| } |
160 |
| } |
161 |
0
| return buf.toString();
|
162 |
| } |
163 |
| |
164 |
| protected abstract String getName(); |
165 |
| |
166 |
0
| protected Writer startViewer(String title, String path, HttpServletResponse res)
|
167 |
| throws ServletException, IOException { |
168 |
| |
169 |
0
| res.setContentType("text/html; charset=utf-8");
|
170 |
0
| Writer output = new OutputStreamWriter(res.getOutputStream(), "utf-8");
|
171 |
0
| printHeader(output, title);
|
172 |
0
| printTabs(output, path);
|
173 |
0
| return output;
|
174 |
| } |
175 |
| |
176 |
0
| protected void finishViewer(Writer output) throws IOException {
|
177 |
0
| output.write(FOOTER);
|
178 |
0
| output.write(HTML_TAIL_SECTION);
|
179 |
0
| output.flush();
|
180 |
| } |
181 |
| |
182 |
0
| protected void printHeader(Writer output, String title) throws IOException {
|
183 |
0
| output.write(HTML_HEADER_SECTION);
|
184 |
0
| output.write(title);
|
185 |
0
| output.write(END_HTML_HEADER_SECTION);
|
186 |
0
| output.write(LOGO_SECTION);
|
187 |
| } |
188 |
| |
189 |
0
| protected void printTabs(Writer output, String path) throws IOException {
|
190 |
| |
191 |
0
| output.write(START_TABS_SECTION);
|
192 |
| |
193 |
0
| String[] viewers = new String[]{};
|
194 |
0
| if (this instanceof HtmlCollectionViewer) {
|
195 |
0
| viewers = WebAdminManager.getCollectionViewers();
|
196 |
0
| } else if (this instanceof HtmlResourceViewer) {
|
197 |
0
| viewers = WebAdminManager.getResourceViewers();
|
198 |
0
| } else if (this instanceof HtmlDatabaseViewer) {
|
199 |
0
| viewers = WebAdminManager.getDatabaseViewers();
|
200 |
| } |
201 |
| |
202 |
0
| for (int i = 0; i < viewers.length; i++) {
|
203 |
0
| if (viewers[i].equals(getName())) {
|
204 |
0
| if (i > 0) {
|
205 |
0
| output.write(TAB_SPACE_SELECTED);
|
206 |
| } |
207 |
0
| output.write(START_TAB_SELECTED);
|
208 |
0
| output.write(getName());
|
209 |
0
| output.write(END_TAB);
|
210 |
| } else { |
211 |
0
| if (i > 0) {
|
212 |
0
| output.write(TAB_SPACE);
|
213 |
| } |
214 |
0
| output.write(START_TAB);
|
215 |
0
| if (viewers[i].length() > 0) {
|
216 |
0
| output.write("<a href=\"?viewer=");
|
217 |
0
| output.write(viewers[i]);
|
218 |
0
| output.write("\" class=\"unselected\">");
|
219 |
0
| output.write(viewers[i]);
|
220 |
0
| output.write("</a>");
|
221 |
| } else { |
222 |
0
| output.write(" ");
|
223 |
| } |
224 |
0
| output.write(END_TAB);
|
225 |
| } |
226 |
| } |
227 |
0
| output.write(END_TABS_SECTION);
|
228 |
| |
229 |
| |
230 |
0
| output.write(LEFT_PATH_SECTION);
|
231 |
0
| if (path != null && path.length() > 1) {
|
232 |
0
| output.write(path);
|
233 |
| } else { |
234 |
0
| output.write("/");
|
235 |
| } |
236 |
0
| output.write(RIGHT_PATH_SECTION);
|
237 |
0
| output.write(" ");
|
238 |
0
| output.write(END_PATH_SECTION);
|
239 |
| } |
240 |
| |
241 |
0
| protected void printStartTable(String title, Writer output) throws IOException {
|
242 |
0
| String[] titles = {title};
|
243 |
0
| printStartTable(titles, output);
|
244 |
| } |
245 |
| |
246 |
0
| protected void printStartTable(String[] titles, Writer output) throws IOException {
|
247 |
0
| output.write(START_TABLE);
|
248 |
0
| output.write(START_TABLE_ROW);
|
249 |
| |
250 |
0
| for (int i = 0; i < titles.length; i++) {
|
251 |
0
| output.write(START_TABLE_BOX_TITLE);
|
252 |
0
| if (titles[i].length() > 0) {
|
253 |
0
| output.write(titles[i]);
|
254 |
| } else { |
255 |
0
| output.write(" ");
|
256 |
| } |
257 |
0
| output.write(END_TABLE_BOX);
|
258 |
| } |
259 |
| |
260 |
0
| output.write(END_TABLE_ROW);
|
261 |
| } |
262 |
| |
263 |
0
| protected void printEndTable(Writer output) throws IOException {
|
264 |
0
| output.write(END_TABLE);
|
265 |
| } |
266 |
| |
267 |
0
| protected void printTableRow(String content, Writer output) throws IOException {
|
268 |
0
| String[] contents = {content};
|
269 |
0
| printTableRow(contents, output);
|
270 |
| } |
271 |
| |
272 |
0
| protected void printTableRow(String[] contents, Writer output) throws IOException {
|
273 |
0
| output.write(START_TABLE_ROW);
|
274 |
| |
275 |
0
| for (int i = 0; i < contents.length; i++) {
|
276 |
0
| output.write(START_TABLE_BOX);
|
277 |
0
| if (contents[i] != null && contents[i].length() > 0) {
|
278 |
0
| output.write(contents[i]);
|
279 |
| } else { |
280 |
0
| output.write(" ");
|
281 |
| } |
282 |
0
| output.write(END_TABLE_BOX);
|
283 |
| } |
284 |
| |
285 |
0
| output.write(END_TABLE_ROW);
|
286 |
| } |
287 |
| |
288 |
0
| protected void printStartSingleTableBox(Writer output) throws IOException {
|
289 |
0
| output.write(START_TABLE_ROW);
|
290 |
0
| output.write(START_TABLE_BOX);
|
291 |
| } |
292 |
| |
293 |
0
| protected void printEndSingleTableBox(Writer output) throws IOException {
|
294 |
0
| output.write(END_TABLE_BOX);
|
295 |
0
| output.write(END_TABLE_ROW);
|
296 |
| } |
297 |
| |
298 |
0
| protected void printSearchFromRow(String viewer, String query, String[] ns, Writer output)
|
299 |
| throws IOException { |
300 |
| |
301 |
0
| query = query.replaceAll("\"", """);
|
302 |
| |
303 |
0
| output.write(START_TABLE_ROW);
|
304 |
0
| output.write(START_TABLE_BOX);
|
305 |
0
| output.write(START_SEARCH_FORM);
|
306 |
0
| output.write(SEARCH_FROM_START_HIDDEN_VIEWER);
|
307 |
0
| output.write(viewer);
|
308 |
0
| output.write(SEARCH_FROM_END_HIDDEN_VIEWER);
|
309 |
0
| output.write(SEARCH_FROM_START_QUERY);
|
310 |
0
| output.write(query);
|
311 |
0
| output.write(SEARCH_FROM_END_QUERY);
|
312 |
0
| output.write(SEARCH_FROM_START_NS_HEADER);
|
313 |
| |
314 |
0
| int nsSize = ns.length / 2;
|
315 |
0
| for (int i = 1; i < 10; i++) {
|
316 |
0
| if (i == nsSize) {
|
317 |
0
| output.write(SEARCH_FROM_START_NS_HEADER_OPT_SEL);
|
318 |
| } else { |
319 |
0
| output.write(SEARCH_FROM_START_NS_HEADER_OPT);
|
320 |
| } |
321 |
0
| output.write(i);
|
322 |
0
| output.write(SEARCH_FROM_END_NS_HEADER_OPT);
|
323 |
| } |
324 |
| |
325 |
0
| output.write(SEARCH_FROM_END_NS_HEADER);
|
326 |
| |
327 |
0
| int thisNs = 1;
|
328 |
0
| for (int i = 0; i < ns.length; i++) {
|
329 |
0
| output.write(SEARCH_FROM_START_NS);
|
330 |
0
| output.write(thisNs);
|
331 |
0
| output.write(SEARCH_FROM_START_NS_PREFIX);
|
332 |
0
| output.write(thisNs);
|
333 |
0
| output.write(SEARCH_FROM_END_NS_PREFIX);
|
334 |
0
| output.write(ns[i]);
|
335 |
0
| i++;
|
336 |
0
| output.write(SEARCH_FROM_START_NS_URI);
|
337 |
0
| output.write(thisNs);
|
338 |
0
| output.write(SEARCH_FROM_MIDDLE_NS_URI);
|
339 |
0
| output.write(ns[i]);
|
340 |
0
| output.write(SEARCH_FROM_END_NS_URI);
|
341 |
0
| thisNs++;
|
342 |
| } |
343 |
0
| output.write(END_SEARCH_FORM);
|
344 |
0
| output.write(END_TABLE_BOX);
|
345 |
0
| output.write(END_TABLE_ROW);
|
346 |
| } |
347 |
| |
348 |
| |
349 |
| |
350 |
| protected static final String HTML_HEADER_SECTION = |
351 |
| "<html> \n" |
352 |
| + "<head> \n" |
353 |
| + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" |
354 |
| + "<style type=\"text/css\"><!-- \n" |
355 |
| + "small { \n" |
356 |
| + " font-family: verdana,sans-serif; \n" |
357 |
| + " font-size: 8px; \n" |
358 |
| + "} \n" |
359 |
| + ".logo { \n" |
360 |
| + " font-family: verdana,sans-serif; \n" |
361 |
| + " text-align: center; \n" |
362 |
| + " font-weight: bold; \n" |
363 |
| + " font-size: 50px; \n" |
364 |
| + " color: #294563; \n" |
365 |
| + " margin-right: 5px; \n" |
366 |
| + "} \n" |
367 |
| + ".smallLogo { \n" |
368 |
| + " font-family: verdana,sans-serif; \n" |
369 |
| + " text-align: center; \n" |
370 |
| + " font-weight: normal; \n" |
371 |
| + " font-size: 12px; \n" |
372 |
| + " color: #294563; \n" |
373 |
| + " margin-top: -7px; \n" |
374 |
| + "} \n" |
375 |
| + ".tabs { \n" |
376 |
| + " background: #f0f0ff; \n" |
377 |
| + " color: #294563; \n" |
378 |
| + " border-width: 0px; \n" |
379 |
| + " padding: 0px 0px 0px 0px; \n" |
380 |
| + " margin: 0px 0px 0px 0px; \n" |
381 |
| + "} \n" |
382 |
| + ".unselected { \n" |
383 |
| + " width: 70px; \n" |
384 |
| + " background: #f0f0ff; \n" |
385 |
| + " color: #294563; \n" |
386 |
| + " font-family: verdana,sans-serif; \n" |
387 |
| + " text-align: center; \n" |
388 |
| + " font-size: 12px; \n" |
389 |
| + "} \n" |
390 |
| + ".selected { \n" |
391 |
| + " width: 70px; \n" |
392 |
| + " background: #294563; \n" |
393 |
| + " color: #f0f0ff; \n" |
394 |
| + " font-family: verdana,sans-serif; \n" |
395 |
| + " font-weight: bold; \n" |
396 |
| + " text-align: center; \n" |
397 |
| + " font-size: 12px; \n" |
398 |
| + "} \n" |
399 |
| + ".misc { \n" |
400 |
| + " background: #294563; \n" |
401 |
| + " color: #f0f0ff; \n" |
402 |
| + " font-family: verdana,sans-serif; \n" |
403 |
| + " font-weight: bold; \n" |
404 |
| + " text-align: left; \n" |
405 |
| + " font-size: 12px; \n" |
406 |
| + "} \n" |
407 |
| + ".misc-right { \n" |
408 |
| + " background: #294563; \n" |
409 |
| + " color: #f0f0ff; \n" |
410 |
| + " font-family: verdana,sans-serif; \n" |
411 |
| + " font-weight: bold; \n" |
412 |
| + " text-align: right; \n" |
413 |
| + " font-size: 12px; \n" |
414 |
| + "} \n" |
415 |
| + ".contents { \n" |
416 |
| + " width: 100%; \n" |
417 |
| + " border-width: 1px; \n" |
418 |
| + " border-style: solid; \n" |
419 |
| + " border-color: #294563; \n" |
420 |
| + "} \n" |
421 |
| + ".contents td { \n" |
422 |
| + " border-width: 1px; \n" |
423 |
| + " border-style: solid; \n" |
424 |
| + " border-color: #294563; \n" |
425 |
| + " font-family: verdana,sans-serif; \n" |
426 |
| + " text-align: left; \n" |
427 |
| + " font-size: 12px; \n" |
428 |
| + "} \n" |
429 |
| + ".title { \n" |
430 |
| + " background: #4C6C8F; \n" |
431 |
| + " color: #f0f0ff; \n" |
432 |
| + " font-family: verdana,sans-serif; \n" |
433 |
| + " font-weight: bold; \n" |
434 |
| + " text-align: left; \n" |
435 |
| + " font-size: 12px; \n" |
436 |
| + "} \n" |
437 |
| + |
438 |
| |
439 |
| ".xml-misc, .xml-element-name, .xml-attribute-name, .xml-attribute-content, " |
440 |
| + ".xml-element-content, .xml-comment, .xml-processing, .xml-cdata { \n" |
441 |
| + " font-family: verdana,sans-serif; \n" |
442 |
| + " font-size: 12px; \n" |
443 |
| + "} \n" |
444 |
| + ".xml-misc { \n" |
445 |
| + " color: #000000; \n" |
446 |
| + "} \n" |
447 |
| + ".xml-element-name { \n" |
448 |
| + " color: #cc0000; \n" |
449 |
| + "} \n" |
450 |
| + ".xml-attribute-name { \n" |
451 |
| + " color: #660099; \n" |
452 |
| + "} \n" |
453 |
| + ".xml-attribute-content { \n" |
454 |
| + " color: #000099; \n" |
455 |
| + "} \n" |
456 |
| + ".xml-element-content { \n" |
457 |
| + " color: #000000; \n" |
458 |
| + "} \n" |
459 |
| + ".xml-comment { \n" |
460 |
| + " color: #006600; \n" |
461 |
| + "} \n" |
462 |
| + ".xml-processing { \n" |
463 |
| + " color: #cc0000; \n" |
464 |
| + "} \n" |
465 |
| + ".xml-cdata { \n" |
466 |
| + " color: #006600; \n" |
467 |
| + "} \n" |
468 |
| + |
469 |
| |
470 |
| ".search-form, .create-form, .upload-form input { \n" |
471 |
| + " color: #294563; \n" |
472 |
| + " font-family: verdana,sans-serif; \n" |
473 |
| + " font-weight: bold; \n" |
474 |
| + " text-align: left; \n" |
475 |
| + " font-size: 12px; \n" |
476 |
| + " border: 0px none #ffffff; \n" |
477 |
| + "} \n" |
478 |
| + ".search-form td[colspan=3] { \n" |
479 |
| + " width: 480px; \n" |
480 |
| + "} \n" |
481 |
| + ".search-form input { \n" |
482 |
| + " border: 2px solid #294563; \n" |
483 |
| + " background-color: #f0f0ff; \n" |
484 |
| + " width: 200px; \n" |
485 |
| + "} \n" |
486 |
| + ".search-form input[name=query] { \n" |
487 |
| + " border: 2px solid #294563; \n" |
488 |
| + " background-color: #f0f0ff; \n" |
489 |
| + " width: 400px; \n" |
490 |
| + "} \n" |
491 |
| + ".search-form td, .create-form td, .upload-form td { \n" |
492 |
| + " border: 0px none #ffffff; \n" |
493 |
| + "} \n" |
494 |
| + ".search-form select { \n" |
495 |
| + " font-size: 10px; \n" |
496 |
| + " background-color: #f0f0ff; \n" |
497 |
| + "} \n" |
498 |
| + ".create-form td[colspan=2] { \n" |
499 |
| + " width: 450px; \n" |
500 |
| + "} \n" |
501 |
| + ".create-form input { \n" |
502 |
| + " border: 2px solid #294563; \n" |
503 |
| + " background-color: #f0f0ff; \n" |
504 |
| + " width: 300px; \n" |
505 |
| + "} \n" |
506 |
| + "select { \n" |
507 |
| + " font-size: 10px; \n" |
508 |
| + " background-color: #f0f0ff; \n" |
509 |
| + "} \n" |
510 |
| + ".upload-form input { \n" |
511 |
| + " border: 2px solid #294563; \n" |
512 |
| + " background-color: #f0f0ff; \n" |
513 |
| + "} \n" |
514 |
| + "--></style> \n" |
515 |
| + "<title>"; |
516 |
| |
517 |
| protected static final String END_HTML_HEADER_SECTION = |
518 |
| "</title> \n" + "<body> \n\n"; |
519 |
| |
520 |
| protected static final String LOGO_SECTION = |
521 |
| "<table width=\"100%\"><tr> \n" |
522 |
| + "<td width=\"100%\"> </td> \n" |
523 |
| + "<td align=\"right\" width=\"1px\"> \n" |
524 |
| + "<div class=\"logo\"> xindice <div class=\"smallLogo\">(zeen-de-chay)</div> </div> \n" |
525 |
| + "</td></tr></table> \n"; |
526 |
| |
527 |
| protected static final String START_TABS_SECTION = |
528 |
| "<table class=\"tabs\" cellspacing=\"0\" cellpadding=\"0\"> \n" |
529 |
| + " <tr> \n"; |
530 |
| |
531 |
| protected static final String END_TABS_SECTION = |
532 |
| " <td width=\"1\" bgcolor=\"#808080\"><img width=\"1\" height=\"\" alt=\"\"></td> \n" |
533 |
| + " </tr> \n" |
534 |
| + "</table> \n"; |
535 |
| |
536 |
| protected static final String START_TAB = |
537 |
| " <td class=\"unselected\"> "; |
538 |
| |
539 |
| protected static final String START_TAB_SELECTED = |
540 |
| " <td class=\"selected\"> "; |
541 |
| |
542 |
| protected static final String TAB_SPACE = |
543 |
| " <td width=\"1\" bgcolor=\"#808080\"><img width=\"1\" height=\"\" alt=\"\"></td> \n" |
544 |
| + " <td width=\"1\" bgcolor=\"#ffffff\"><img width=\"1\" height=\"1\" alt=\"\"></td> \n"; |
545 |
| |
546 |
| protected static final String TAB_SPACE_SELECTED = |
547 |
| " <td width=\"1\" bgcolor=\"#808080\"><img width=\"1\" height=\"\" alt=\"\"></td> \n"; |
548 |
| |
549 |
| protected static final String END_TAB = " </td> \n"; |
550 |
| |
551 |
| protected static final String LEFT_PATH_SECTION = |
552 |
| "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\"> \n" |
553 |
| + " <tr> \n" |
554 |
| + " <td class=\"misc\"> "; |
555 |
| |
556 |
| protected static final String RIGHT_PATH_SECTION = |
557 |
| "</td> \n" + " <td class=\"misc-right\">"; |
558 |
| |
559 |
| protected static final String END_PATH_SECTION = |
560 |
| "</td> \n" + " </tr> \n" + "</table> \n" + "<br /> \n"; |
561 |
| |
562 |
| protected static final String START_TABLE = |
563 |
| "<table cellspacing=\"0\" cellpadding=\"3\" class=\"contents\"> \n"; |
564 |
| |
565 |
| protected static final String END_TABLE = "</table> \n"; |
566 |
| |
567 |
| protected static final String START_TABLE_ROW = "<tr> \n"; |
568 |
| |
569 |
| protected static final String END_TABLE_ROW = "</tr> \n"; |
570 |
| |
571 |
| protected static final String START_TABLE_BOX = "<td> \n"; |
572 |
| |
573 |
| protected static final String END_TABLE_BOX = "</td> \n"; |
574 |
| |
575 |
| protected static final String START_TABLE_BOX_TITLE = |
576 |
| "<td class=\"title\"> \n"; |
577 |
| |
578 |
| protected static final String FOOTER = |
579 |
| "\n<br /> \n" |
580 |
| + "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\"> \n" |
581 |
| + " <tr> \n" |
582 |
| + " <td class=\"misc\"> " |
583 |
| + Xindice.Title |
584 |
| + " " |
585 |
| + Xindice.Version |
586 |
| + "</td> \n" |
587 |
| + " <td class=\"misc-right\"> </td> \n" |
588 |
| + " </tr> \n" |
589 |
| + "</table> \n"; |
590 |
| |
591 |
| protected static final String HTML_TAIL_SECTION = "</body> \n" + "</html>"; |
592 |
| |
593 |
| |
594 |
| |
595 |
| protected static final String START_SEARCH_FORM = |
596 |
| "<form action=\"\" method=\"get\"> \n" |
597 |
| + "<table class=\"search-form\"> \n"; |
598 |
| |
599 |
| protected static final String SEARCH_FROM_START_HIDDEN_VIEWER = |
600 |
| "<input name=\"viewer\" value=\""; |
601 |
| |
602 |
| protected static final String SEARCH_FROM_END_HIDDEN_VIEWER = |
603 |
| "\" type=\"hidden\" /> \n"; |
604 |
| |
605 |
| protected static final String SEARCH_FROM_START_QUERY = |
606 |
| "<tr><td colspan=\"3\"> \n" |
607 |
| + " query: \n" |
608 |
| + " <input name=\"query\" type=\"text\" value=\""; |
609 |
| |
610 |
| protected static final String SEARCH_FROM_END_QUERY = |
611 |
| "\" /><br /><div style=\"text-align:right;\">" |
612 |
| + "<input type=\"submit\" name=\"submit\" value=\"search\" " |
613 |
| + " style=\"margin-top:10px; width:auto;\"/> \n" |
614 |
| + "</div><br /> \n" |
615 |
| + "</td></tr> \n"; |
616 |
| |
617 |
| protected static final String SEARCH_FROM_START_NS_HEADER = |
618 |
| "<tr><td colspan=\"2\">optional namespaces:</td> \n" |
619 |
| + "<td>number of ns: <select name=\"nssize\" size=\"1\"> \n"; |
620 |
| |
621 |
| protected static final String SEARCH_FROM_START_NS_HEADER_OPT = "<option>"; |
622 |
| |
623 |
| protected static final String SEARCH_FROM_START_NS_HEADER_OPT_SEL = |
624 |
| "<option selected=\"selected\">"; |
625 |
| |
626 |
| protected static final String SEARCH_FROM_END_NS_HEADER_OPT = "</option>"; |
627 |
| |
628 |
| protected static final String SEARCH_FROM_END_NS_HEADER = |
629 |
| "</select></td></tr>" |
630 |
| + "<tr><td> </td><td>prefix</td><td>uri</td></tr> \n" |
631 |
| + "<tr> \n"; |
632 |
| |
633 |
| protected static final String SEARCH_FROM_START_NS = "<td>ns"; |
634 |
| |
635 |
| protected static final String SEARCH_FROM_START_NS_PREFIX = |
636 |
| ":</td> \n" + "<td><input name=\"prefix"; |
637 |
| |
638 |
| protected static final String SEARCH_FROM_END_NS_PREFIX = |
639 |
| "\" type=\"text\" value=\""; |
640 |
| |
641 |
| protected static final String SEARCH_FROM_START_NS_URI = |
642 |
| "\"/></td> \n" + "<td><input name=\"uri"; |
643 |
| |
644 |
| protected static final String SEARCH_FROM_MIDDLE_NS_URI = |
645 |
| "\" type=\"text\" value=\""; |
646 |
| |
647 |
| protected static final String SEARCH_FROM_END_NS_URI = |
648 |
| "\" /></td> \n" + "</tr> \n"; |
649 |
| |
650 |
| protected static final String END_SEARCH_FORM = |
651 |
| "</table> \n" + "</form> \n"; |
652 |
| |
653 |
| protected static final String START_CONFIG_FORM = |
654 |
| "<form action=\"?viewer=config\" method=\"post\"><textarea " + |
655 |
| "name=\"config\" style=\"width:100%;\" rows=\"8\">"; |
656 |
| |
657 |
| protected static final String END_CONFIG_FORM = |
658 |
| "</textarea><br /><input type=\"submit\" name=\"submit\" value=\"update\"></form>"; |
659 |
| |
660 |
| protected static final String CREATE_FORM_START = |
661 |
| "<form action=\"\" method=\"get\"> \n" |
662 |
| + "<input name=\"viewer\" value=\"create\" type=\"hidden\" /> \n" |
663 |
| + "<table class=\"create-form\"> \n" |
664 |
| + "<tr><td colspan=\"2\"> \n" |
665 |
| + " new collection name: \n" |
666 |
| + " <input name=\"name\" type=\"text\" /><br /> \n" |
667 |
| + " <div style=\"text-align:right;\">" |
668 |
| + " <input type=\"submit\" name=\"submit\" value=\"create\" " |
669 |
| + " style=\"margin-top:10px; width:auto;\"/> \n" |
670 |
| + " </div><br />" |
671 |
| + " </td></tr> \n" |
672 |
| + " <tr><td colspan=\"2\">additional parameters:</td></tr> \n" |
673 |
| + " <tr> \n" |
674 |
| + "<td>enable Inline Metadata: </td> \n" |
675 |
| + "<td> \n" |
676 |
| + " <select name=\"meta\" size=\"1\"> \n" |
677 |
| + " <option selected=\"selected\">"; |
678 |
| |
679 |
| protected static final String CREATE_FORM_META_DEFAULT = |
680 |
| "</option> \n" + " <option>"; |
681 |
| |
682 |
| protected static final String CREATE_FORM_META_END = |
683 |
| "</option> \n" |
684 |
| + " </select> \n" |
685 |
| + "</td> \n" |
686 |
| + " </tr> \n" |
687 |
| + " <tr> \n" |
688 |
| + "<td>compressed: </td> \n" |
689 |
| + "<td> \n" |
690 |
| + " <select name=\"compressed\" size=\"1\"> \n" |
691 |
| + " <option selected=\"selected\">"; |
692 |
| |
693 |
| protected static final String CREATE_FORM_COMPRESSED_DEFAULT = |
694 |
| "</option> \n" + " <option>"; |
695 |
| |
696 |
| protected static final String CREATE_FORM_COMPRESSED_END = |
697 |
| "</option> \n" |
698 |
| + " </select> \n" |
699 |
| + "</td> \n" |
700 |
| + " </tr> \n" |
701 |
| + " <tr> \n" |
702 |
| + "<td>filer:</td> \n" |
703 |
| + "<td><input name=\"filer\" type=\"text\" value=\""; |
704 |
| |
705 |
| protected static final String CREATE_FORM_FILER = |
706 |
| "\"/></td> \n" + " </tr> \n" + " </table> \n" + " </form> \n"; |
707 |
| |
708 |
| protected static final String UPLOAD_FORM = |
709 |
| "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\"> \n" |
710 |
| + "<table class=\"upload-form\"> \n" |
711 |
| + "<tr> \n" |
712 |
| + "<td>upload file: </td> \n" |
713 |
| + "<td><input name=\"file\" type=\"file\" /></td> \n" |
714 |
| + "</td></tr> \n" |
715 |
| + "<tr> \n" |
716 |
| + "<td>name: </td> \n" |
717 |
| + "<td><input name=\"name\" type=\"text\" /></td> \n" |
718 |
| + "</td></tr> \n" |
719 |
| + "<tr> \n" |
720 |
| + "<td>type: </td>\n" |
721 |
| + "<td><select name=\"type\" size=\"1\"> \n" |
722 |
| + " <option>xml</option> \n" |
723 |
| + " <option selected=\"selected\">detect</option> \n" |
724 |
| + " <option>binary</option> \n" |
725 |
| + "</select> \n" |
726 |
| + "</td></tr> \n" |
727 |
| + "<tr> \n" |
728 |
| + "<td>overwrite: </td>\n" |
729 |
| + "<td>no<input type=\"radio\" name=\"overwrite\" value=\"false\" checked=\"checked\" /> \n" |
730 |
| + "yes<input type=\"radio\" name=\"overwrite\" value=\"true\" /> \n" |
731 |
| + "</td></tr> \n" |
732 |
| + "<tr><td> \n" |
733 |
| + "<input type=\"submit\" name=\"submit\" value=\"upload\" /> \n" |
734 |
| + "</td><td> " |
735 |
| + " " |
736 |
| + "</td></tr> \n" |
737 |
| + "<tr><td colspan=\"2\"> \n" |
738 |
| + "</td></tr> \n" |
739 |
| + "</table> \n" |
740 |
| + "</form> \n"; |
741 |
| } |