[sword-cvs] swordweb init.jsp,1.5,1.6 preferences.jsp,1.8,1.9

sword@www.crosswire.org sword@www.crosswire.org
Mon, 10 Nov 2003 14:12:49 -0700


Update of /usr/local/cvsroot/swordweb
In directory www:/tmp/cvs-serv22485

Modified Files:
	init.jsp preferences.jsp 
Log Message:
Added dynamic stylesheet / user pref options


Index: init.jsp
===================================================================
RCS file: /usr/local/cvsroot/swordweb/init.jsp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- init.jsp	21 Aug 2003 20:31:24 -0000	1.5
+++ init.jsp	10 Nov 2003 21:12:46 -0000	1.6
@@ -51,14 +51,37 @@
 	Vector prefBibles = (Vector)session.getAttribute("PrefBibles");
 	Vector prefCommentaries = (Vector)session.getAttribute("PrefCommentaries");
 	Vector parDispModules = (Vector)session.getAttribute("ParDispModules");
+	String prefStyle = (String)session.getAttribute("PrefStyle");
+	static Vector styleNames = null;
+	static Vector styleFiles = null;
+	static Vector styleDescriptions = null;
+
+	synchronized(this) {
+		if (styleNames == null) {
+
+			styleNames = new Vector();
+			styleFiles = new Vector();
+			styleDescriptions = new Vector();
+
+			styleNames.add("Washed Out");
+			styleFiles.add("wash.css");
+
+			styleNames.add("Sandy Creek");
+			styleFiles.add("sandy.css");
+		}
+	}
 
 	Cookie[] cookies = request.getCookies();
 	if ((prefBibles == null) && (cookies != null)) {
+
 		for (int i = 0; i < cookies.length; i++) {
 			int start, end;
 			String field;
 			String line;
-			if (cookies[i].getName().equals("PrefBibles")) {
+			if (cookies[i].getName().equals("PrefStyle")) {
+				prefStyle = cookies[i].getValue();
+			}
+			else if (cookies[i].getName().equals("PrefBibles")) {
 				prefBibles = new Vector();
 				start = 0;
 				end = 1;
@@ -106,6 +129,9 @@
 		prefCommentaries = new Vector();
 	if (parDispModules == null)
 		parDispModules = new Vector();
+
+	if ((prefStyle == null) || (styleNames.indexOf(prefStyle) < 0))
+		prefStyle = (String)styleNames.get(0);
 
 	session.setAttribute("PrefBibles", prefBibles);
 	session.setAttribute("PrefCommentaries", prefCommentaries);

Index: preferences.jsp
===================================================================
RCS file: /usr/local/cvsroot/swordweb/preferences.jsp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- preferences.jsp	28 Oct 2003 14:32:24 -0000	1.8
+++ preferences.jsp	10 Nov 2003 21:12:46 -0000	1.9
@@ -132,6 +132,13 @@
 			}
 		%>
 		</ul>
+		<h2>Preferred Style</h2>
+		<ul>
+<% for (int i = 0; i < styleNames.size(); i++) { %>
+			<li><a href="preferences.jsp?setStyle=<%= URLEncoder.encode((String)styleNames.get(i)) %>" title="<%= (String) styleNames.get(i) %>"><%= (String) styleNames.get(i) %></a></li>
+<% } %>
+		</ul>
+
 </div>
 	</tiles:put>
 </tiles:insert>