%@ page errorPage="errorPage.jsp" language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="com.codestudio.util.*" %>
<%@ page import="com.nph.web.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
System.out.println("Entering NCN/index.jsp...");
String sectionIdStr = request.getParameter("id");
int sectionId = (sectionIdStr != null) ? Integer.parseInt(sectionIdStr) : 0;
banner.display(out,conn,sectionId);
out.flush();
%>
<% String pageTitle = "- Home"; %>
<%!
String getSpacerImageHeightStr (String fName) {
String heightStr = "";
try {
ImageInfo ii = new ImageInfo();
java.io.File file = new File(fName);
FileInputStream fis= new FileInputStream(file);
InputStream ins = new BufferedInputStream(fis);
ii.setInput(ins);
int srcHeight = 0;
int spacerHeight = 0;
if (ii.check()) {
srcHeight = ii.getHeight();
} else {
srcHeight = 0;
}
// max height of box = 360
spacerHeight = (360 / 2) - (srcHeight / 2);
heightStr = (srcHeight > 0) ? spacerHeight + "" : "0";
} catch (Exception e) {
System.out.println("getSpacerImageHeightStr: " + e.toString());
}
return heightStr;
}
%>
<%!
void writeSectionArticleBlock(Connection conn, JspWriter out, Section cs, SectionUmedia u ) throws java.io.IOException {
try {
out.newLine();
out.write("
");
out.newLine();
out.write("
");
out.newLine();
} catch (Exception e) {
System.out.println("writeSectionArticleBlock: " + e.toString());
}
}
%>
<%
out.flush();
Catalog catalog = new Catalog(conn, "NCN");
catalog.setSections(conn, 10000003, "A"); // primary section
ArrayList topSections = catalog.getSections();
int halfway = topSections.size() / 2;
out.write("
");
out.newLine();
out.write("
");
out.newLine();
out.write("");
out.write("| ");
for (int i = 0; i < halfway; i++) {
Section currSec = new Section(conn, Integer.parseInt((String) topSections.get(i)), true, true);
ArrayList umediaList = currSec.getUmedias();
SectionUmedia sectionUmedia = (umediaList.get(0) != null) ? (SectionUmedia)umediaList.get(0) : new SectionUmedia();
writeSectionArticleBlock(conn, out, currSec, sectionUmedia);
out.flush();
}
out.write(" | ");
out.write("");
for (int i = halfway; i < topSections.size(); i++) {
Section currSec = new Section(conn, Integer.parseInt((String) topSections.get(i)), true, true);
ArrayList umediaList = currSec.getUmedias();
SectionUmedia sectionUmedia = (umediaList.get(0) != null) ? (SectionUmedia)umediaList.get(0) : new SectionUmedia();
writeSectionArticleBlock(conn, out, currSec, sectionUmedia);
}
out.write(" | ");
out.write("
");
out.write("
");
out.write("
");
%>