 |
 |
<%
String sql = "select * from (SELECT d.path, d.htmlpath, d.title, d.dynamic, d.dcrpath, d.domain, to_char(m.active, 'MM/DD/YYYY') active,m.dns, m.contenttypeid,m.accesslevelid,m.ranking,m.topic,m.keyword,s.summary,a.headline from METADATA m, DCRMAP d, SUMMARY s,ARTICLE a where (m.active between sysdate-90 AND sysdate) AND (upper(d.title) like '%STAFFING%' OR upper(d.title) like '%NURSE SHORTAGE%' OR upper(d.title) like '%STAFF SHORTAGE%' OR upper(d.title) like '%WORK%' OR upper(d.title) like '%MORE THAN A JOB%' OR upper(a.headline) like '%STAFFING%' OR upper(a.headline) like '%NURSE SHORTAGE%' OR upper(a.headline) like '%STAFF SHORTAGE%' OR upper(a.headline) like '%WORK%' OR upper(a.headline) like '%MORE THAN A JOB%' OR upper(a.headline) like '%COVERAGE%' OR upper(m.keyword) like '%STAFFING%' OR upper(m.keyword) like '%NURSE SHORTAGE%' OR upper(m.keyword) like '%STAFF SHORTAGE%' OR upper(m.keyword) like '%WORK%' OR upper(m.keyword) like '%MORE THAN A JOB%' OR upper(m.keyword) like '%COVERAGE%' OR upper(m.topic) like '%STAFFING%' OR upper(m.topic) like '%NURSE SHORTAGE%' OR upper(m.topic) like '%STAFF SHORTAGE%' OR upper(m.topic) like '%WORK%' OR upper(m.topic) like '%MORE THAN A JOB%' OR upper(m.topic) like '%COVERAGE%' OR upper(s.summary) like '%STAFFING%' OR upper(s.summary) like '%NURSE SHORTAGE%' OR upper(s.summary) like '%STAFF SHORTAGE%' OR upper(s.summary) like '%WORK%' OR upper(s.summary) like '%MORE THAN A JOB%' OR upper(s.summary) like '%COVERAGE%') AND m.contenttypeid = 9 AND m.accesslevelid <> 2 AND a.dcrpath = d.dcrpath and a.domain = d.domain AND m.dcrpath = d.dcrpath and m.domain = d.domain and s.dcrpath = d.dcrpath and s.domain = d.domain ORDER BY m.ACTIVE desc, m.RANKING desc, m.MODDATE desc) where HTMLPATH is not NULL or dynamic='y' AND rownum <45";
Connection con = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
boolean hasvalue = false;
try
{
con = PoolManager.getInstance().getConnection("hospitalconnect");
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
%>
<%
if(rs.getFetchSize() > 0)
{
String memberFlag = "3";
String displaypage = null;
String dns = null;
String dynamic = null;
String title = null;
String domain = null;
String content = null;
String accessLevel = null;
String displaydate = null;
String summary = null;
String dcrpath = null;
boolean memberOnly = false;
int index = 0;
int colspan = 1;
int ResultCount = 0;
// below "while" loop is implemented just to skip first five rows of result set
int rows = 0;
while(rs.next())
{
rows++;
if(rows > 4)
{
break;
}
}
while(rs.next())
{
ResultCount++;
if(ResultCount > 40)
{
break;
}
displaypage = rs.getString("PATH");
dynamic = rs.getString("DYNAMIC");
dns = rs.getString("DNS");
title = rs.getString("TITLE");
domain = rs.getString("DOMAIN");
content = rs.getString("CONTENTTYPEID");
accessLevel = rs.getString("ACCESSLEVELID");
displaydate = rs.getString("ACTIVE");
dcrpath = rs.getString("DCRPATH");
//reset variables
colspan = 2;
if( accessLevel != null && !"".equals(accessLevel))
{
memberOnly = (accessLevel.equals(memberFlag)?true:false);
if(memberOnly)
{
colspan = 1;
}
}
else
{
memberOnly = false;
}
if(title != null)
{
title = DataConverter.removeHTMLTags(title);
}
else
{
title = rs.getString("TITLE");
if(title != null)
{
title = DataConverter.removeHTMLTags(title);
}
else
{
title = displaypage;
}
}
if(dynamic != null && dynamic.equalsIgnoreCase("y"))
{
dcrpath = rs.getString("DCRPATH");
dns = com.aha.sso.SsoUtil.getSsoDomain(domain).getHome();
//displaypage = "http://www.hospitalconnect.com"+ displaypage + "?dcrpath=" + dcrpath + "&domain=" + (domain==null?"":domain);
displaypage = dns+ displaypage + "?dcrpath=" + dcrpath + "&domain=" + (domain==null?"":domain);
}
else
{
if(displaypage != null)
{
String docRoot = "public_html";
int docrootIndex = displaypage.indexOf(docRoot);
if(docrootIndex > 0)
{
displaypage = displaypage.substring(docrootIndex + docRoot.length());
}
}
displaypage = "http://www.hospitalconnect.com" + displaypage;
} // displaydate = (String)results.get("ACTIVEDATE");
if(!memberOnly)
{
//trim summary to first 1400 chars ending on a word
summary = rs.getString("SUMMARY");
if(summary != null)
{
index = (255 < summary.length()?255:summary.length());
summary = summary.substring(0, index);
index = summary.lastIndexOf(" ");
if(index > 0)
{
summary = summary.substring(0, index);
}
summary = DataConverter.removeHTMLTags(summary + "....");
}
}
if(displaydate != null)
{
int spaceIndex = displaydate.indexOf(" ");
if(spaceIndex > 0)
{
displaydate = displaydate.substring(0,spaceIndex);
}
}
else
{
displaydate = "";
}
if (title != null) {
if (title.indexOf("Feature^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Features^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("AHA TODAY^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("MORE THAN A JOB^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Cover Story^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Deparatment^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Department^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Architecture & Design^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("SCANS^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Best Practices^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("Environmental Services^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("COVER STORY^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("InBox^") == 0) {
title = title.substring(title.indexOf('^')+1);
}
if (title.indexOf("AHA:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("AHA News:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("AHA News Now:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("Trustee:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("FSI:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("HHN:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
if (title.indexOf("HFM:") == 0) {
title = title.substring(title.indexOf(':')+1);
}
}
%>
<%=title%>, <%=displaydate%>
<%
if(!memberOnly && summary != null)
{
%>
<%=summary%>
<%
}
%>
|
<%
if(memberOnly) {
%>
 |
 |
<%
}
else {
%>
 |
|
|
<%
}
}
// end of while loop
}
else {
%>
| No matches |
|
|
<%
}
rs.close();
} // End of try block
catch(Exception outer) {
%>
| Documents could not be retrieved.
<%
//out.println("exception message is " + outer.getMessage());
%>
|
|
|
<%
}
%>
|
|
 |
|
|
 |
|
|
 |
 |
<%!
private String modifyTitle(String title){
if(title.indexOf("Calendar of Events:") >= 0){
title = title.substring(19);
} else if(title.indexOf("Calendar:") >= 0){
title = title.substring(title.indexOf(":")+1);
}
return title;
}
%>
<%
// comment start new code1
Connection connect = null;
try
{
String org = "AHA"; // Uncomment when events appear
String action = request.getParameter("action");
Calendar cal = Calendar.getInstance();
String startDay = "01";
String month = new String(""+(cal.get(cal.MONTH)+1));
startDay = new String(""+cal.get(cal.DAY_OF_MONTH));
if(month.length()==1){
month = "0"+month;
}
if(startDay.length()==1){
startDay = "0"+startDay;
}
String year = request.getParameter("year");
int endYear = cal.get(cal.YEAR);
String startDate = month+"/"+startDay+"/"+endYear;
String endDate = "12/31/"+endYear;
connect = PoolManager.getInstance().getConnection("hospitalconnect");
String sql1 = "SELECT * from eventcalendar where domain = '"+org+"' and startdate >= to_date('"+startDate+"','MM/DD/YYYY') and stopdate <= to_date('"+endDate+"','MM/DD/YYYY')";
int ResultCount = 0;
Statement stmt = null;
ResultSet rsSum10 = null;
stmt = connect.createStatement();
rsSum10 = stmt.executeQuery(sql1);
if(rsSum10.getFetchSize() > 0)
{
String path = null;
String title = null;
String hosts = null;
String city = null;
String shortdesc = null;
while(rsSum10.next())
{
ResultCount++;
if(ResultCount > 5)
{
break;
}
path = rsSum10.getString("PATH");
if(path == null || path.endsWith("null"))
{
continue;
}
java.sql.Date datevalue = rsSum10.getDate("STARTDATE");
String sdate = "";
if(datevalue != null)
{
sdate = datevalue.toString();
}
title =rsSum10.getString("TITLE");
hosts = rsSum10.getString("HOSTS");
city = rsSum10.getString("CITY");
shortdesc = rsSum10.getString("SHORTDESC");
// comment end new code1
%>
| <%=sdate%> |
|
<%=modifyTitle(title)%>, |
|
<% if (city != null)
{ %>
<%=city%>,
<% } %>
|
| <%=hosts%>, <%=shortdesc%>... |
 |
<% }
%>
<% }
else
{
%>
| There are no events.... |
 |
<% }
//comment end connection
rsSum10.close();
}
catch(Exception outer) {
%>
| Documents could not be retrieved.
<%
//outer.printStackTrace(new java.io.PrintWriter(response.getWriter()));
%>
|
|
|
<%
}
%>
|
|
 |
|
 |
|