<%@page contentType="text/html; charset=UTF-8" %> <%@ page import="org.crosswire.sword.mgr.SWMgr" %> <%@ page import="com.objectspace.jgl.HashMapIterator" %> <%@ page import="com.objectspace.jgl.Map" %> <%@ page import="java.util.TreeMap" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Enumeration" %> <%@ page import="gnu.regexp.RE" %> <%@ page import="java.io.File" %> <% try { response.setCharacterEncoding("UTF-8"); String modName = "NKJV"; try {modName = request.getParameterValues("modName")[0];} catch (Exception e) {} String sections[] = new String[] { "attic", "avattic", "av", "beta", "experimental", "exp", "wycliffe" }; String spsection = ""; for (String s : sections) { String sparam = request.getParameter(s); if (sparam != null && !sparam.equals("")) { spsection = s; break; } } if ("exp".equals(spsection)) spsection = "experimental"; // handle old "exp" param for backward compat boolean tester = false; try {tester = (request.getParameterValues("tester")[0] != null);} catch (Exception e) {} SWMgr conf = null; String swordhome = "/home/ftp/pub/sword/"+spsection+"raw/"; conf = SWMgr.getInstance(swordhome); Map module = (Map)conf.config.sections.get(modName); if (module == null) { out.print("No module found: " + modName); return; } String modNotes = ""; String langName = (String)module.get("Lang"); String description = (String)module.get("Description"); String about = (String)module.get("About"); String distLic = (String)module.get("DistributionLicense"); String promo = (String)module.get("ShortPromo"); boolean locked = ((String)module.get("CipherKey") != null); if (tester) locked = false; if (promo != null) about += "
" + promo; //locked downloads are possible now locked = false; String rawdl = locked ? "[locked]" : "[download]"; String windl = locked ? "[locked]" : "[download]"; String macdl = locked ? "[locked]" : "[download]"; String version = (String)module.get("Version"); if (version == null) version = "1.0"; String date = (String)module.get("SwordVersionDate"); if (date != null) version = version + " (" + date + ")"; String minimumversion = (String)module.get("MinimumVersion"); if (minimumversion == null) minimumversion = "1.5.1a"; String category = (String)module.get("Category"); if (category != null && category.startsWith("Cult")) { modNotes = category; category = null; } if (category == null) category = (String)module.get("ModDrv");; if (category != null) { // continue if we don't have a module we wish to display if ((category.equals("RawText")) || (category.equals("zText"))) category = "Bible"; else if ((category.equals("RawCom")) || (category.equals("HREFCom")) || (category.equals("RawFiles")) || (category.equals("zCom"))) category = "Commentary"; else if ((category.equals("RawLD")) || (category.equals("RawLD4"))) category = "Dictionary"; } for (Enumeration en = module.values("GlobalOptionFilter"); en.hasMoreElements();) { String val = (String)en.nextElement(); if (val.endsWith("Strongs")) { if (!modNotes.equals("")) modNotes += "
"; modNotes += "Includes Strong's Numbers"; } if (val.endsWith("Morph")) { if (!modNotes.equals("")) modNotes += "
"; modNotes += "Includes Morphology Codes"; } if (val.endsWith("Footnotes")) { if (!modNotes.equals("")) modNotes += "
"; modNotes += "Includes Footnotes"; } if (val.endsWith("SectionHeadings")) { if (!modNotes.equals("")) modNotes += "
"; modNotes += "Includes Section Headings"; } } if (!modNotes.equals("")) modNotes = "Notes" + modNotes + ""; if (about != null) { RE pardRegex = new RE("\\\\pard"); about = pardRegex.substituteAll(about, ""); RE parRegex = new RE("\\\\par"); about = parRegex.substituteAll(about, "
"); RE rtfRegex = new RE("\\\\\\w+"); about = rtfRegex.substituteAll(about, ""); } String path = swordhome + (String)module.get("DataPath"); if (category.equals("Dictionary") || category.equals("Daily Devotional")) { path = path.substring(0, path.lastIndexOf("/")); } File moddir = new File(path); File[] modfiles = moddir.listFiles(); long sizeTotal = 0; if (modfiles != null) { for (int i = 0; i < modfiles.length; i++) { sizeTotal += modfiles[i].length(); } } String sizeInstall = " b"; sizeTotal *= 100; if (sizeTotal > 102400) { sizeInstall = " kb"; sizeTotal /= 1024; if (sizeTotal > 102400) { sizeInstall = " MB"; sizeTotal /= 1024; if (sizeTotal > 102400) { sizeInstall = " GB"; sizeTotal /= 1024; } } } float fSizeTotal = (float)sizeTotal / 100; sizeInstall = String.valueOf(fSizeTotal) + sizeInstall; path = "/home/pubmods/packages/rawzip/" + modName + ".zip"; String sizeDownload = "?.?? b"; moddir = new File(path); if (moddir.exists()) { sizeDownload = " b"; sizeTotal = (long)moddir.length() * 100; if (sizeTotal > 102400) { sizeDownload = " kb"; sizeTotal /= 1024; if (sizeTotal > 102400) { sizeDownload = " MB"; sizeTotal /= 1024; if (sizeTotal > 102400) { sizeDownload = " GB"; sizeTotal /= 1024; } } } fSizeTotal = (float)sizeTotal / 100; sizeDownload = String.valueOf(fSizeTotal) + sizeDownload; } %> The SWORD Project <% if (!"".equals(spsection)) { %> <% } %> <%@ include file="/include/sword_header.jsp" %> <%= modNotes %> <%----%>
Module Name<%= modName %>
Book Name<%= description %>
Module Type<%= category %>
Language<%= langName %>
Module Version<%= version %>
Minimum SWORD Version<%= minimumversion %>
Download Size<%= sizeDownload %>
Install Size<%= sizeInstall %>
About<%= about %>
Distribution License<%= distLic %>
Download<%= rawdl %>
Download: Windows<%= windl %>
Download: MacOSX<%= macdl %>
<% } catch (Exception e) { e.printStackTrace(); } %> Source code for ModInfo.jsp <%@ include file="/include/sword_footer.jsp" %>