-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneratecloud.jsp
147 lines (122 loc) · 4.69 KB
/
generatecloud.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<%@ page import="java.util.*"%>
<jsp:useBean id="PubCloudGenerator"
class="org.icapture.tag.PubMed.PubMedCloudGeneratorBean"
scope="session" />
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
</HEAD>
<TITLE>PubCloud</TITLE>
<BODY>
<!-- -------------------------------- Title --------------------------------- -->
<TABLE cellpadding="5" border="0" width="500">
<TR>
<TD>
<H1>PubCloud</H1>
</TD>
<TD><SPAN class="fine_print">Publication (<A
HREF="http://www.cs.bell-labs.com/cm/cs/who/pfps/temp/web/www2007.org/posters/poster1046.pdf"
TARGET="BLANK">PDF</A>) (<A
HREF="http://www2007.org/htmlposters/poster1046/" TARGET="BLANK">HTML</A>)</SPAN></TD>
<TD><SPAN class="fine_print"><A HREF="legend.html"
TARGET="_blank"
ONCLICK="window.open('legend.html', 'PubCloud Legend', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, width=258,height=200'); return false">Legend</A></SPAN></TD>
<TD><SPAN class="fine_print"><A
HREF="javascript:window.print();">Print</A></SPAN></TD>
<TD><SPAN class="fine_print"><A
HREF="javascript:window.close();">Close</A></SPAN></TD>
</TR>
</TABLE>
<!-- ------------------------------------------------------------------------ -->
<%
String query = request.getParameter("query");
String startYear = request.getParameter("startYear");
String endYear = request.getParameter("endYear");
String type = request.getParameter("type");
String option = request.getParameter("option");
String percent = request.getParameter("percent");
String recent = request.getParameter("recent");
int percentValue = 10;
int recentValue = 100;
try {
percentValue = Integer.parseInt(percent);
recentValue = Integer.parseInt(recent);
}
catch (Exception e) {
}
if (query == null) {
//out.println("Await keyword search!");
}
else if (query == "") {
out.println("<FONT COLOR=\"red\"><B>ERROR:</B> You have not entered a PubMed query</FONT><BR>");
}
else if ( (option.equals("random")) && ((percentValue <= 0) || (percentValue > 100)) ) {
out.println("<FONT COLOR=\"red\"><B>ERROR:</B> You have specified an invalid % value</FONT><BR>");
out.println(percentValue + "% selected");
}
else if ( (option.equals("most_recent")) && (recentValue <= 0) ) {
out.println("<FONT COLOR=\"red\"><B>ERROR:</B> You have specified an invalid number of articles</FONT><BR>");
out.println(recentValue + " articles selected");
}
else {
String prevQuery = "";
String newQuery = prevQuery + " " + query;
/************ Session Code ***************/
/*
HttpSession tsession = request.getSession();
String pQuery = tsession.getAttribute("pQuery");
String nQuery = pQuery + " " + query;
tsession.setAttribute("pQuery", nQuery);
*/
/*****************************************/
if (startYear.equals("")) {
startYear = "--";
}
if (endYear.equals("")) {
endYear = "--";
}
int optionValue = 10;
if (option.equals("random")) {
if (! percent.equals("")) {
optionValue = Integer.parseInt(percent);
}
else {
optionValue = 10;
}
out.println("Cloud Option: <SPAN class=\"key\">Randomly choose " + optionValue + "% of all articles</SPAN><BR>");
}
else if (option.equals("most_recent")) {
if (! recent.equals("")) {
optionValue = Integer.parseInt(recent);
}
else {
optionValue = 100;
}
out.println("Cloud Option: <SPAN class=\"key\">Most recent " + optionValue + " articles</SPAN><BR>");
}
boolean checkCloud = false;
checkCloud = PubCloudGenerator.mainBuildCloud(newQuery, startYear, endYear, type, option, optionValue);
// make a split search string for later use
String keywordSplitSearchString = newQuery.replace(" ", "+");
out.println("<TABLE border=\"0\"><TR><TD><BR><CENTER>");
String cloudHTML = "";
if (checkCloud == true) {
cloudHTML = PubCloudGenerator.generateHtmlCloud();
}
out.println("<SPAN class=\"option_text\">");
out.println("PubMed Query: <SPAN class=\"key\">" + query + "</SPAN><br>");
out.println("Cloud Type: <SPAN class=\"key\">" + type + "</SPAN><BR>");
out.println("Date range from <SPAN class=\"key\">" + startYear + "</SPAN> to <SPAN class=\"key\">" + endYear + "</SPAN><BR>");
out.println("PubMed Articles: <SPAN class=\"key\">" + idListHtml + "</SPAN>");
out.println("</SPAN>");
out.println(cloudHTML);
out.println("</CENTER></TD></TR></TABLE>");
}
%>
<BR>
<SPAN class="fine_print">Comments or questions, please contact: <I><A
HREF="mailto:[email protected]">Byron Kuo</A></I>. Copyright (c) 2006</SPAN>
</BODY>
</HTML>