<%@ page import="java.io.File" %> <%@ page import="java.io.FileReader" %> <%@ page import="java.io.FileWriter" %> <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.List" %> <%@ page import="java.util.StringTokenizer" %> <%@ include file="../shared/colorList.jsp" %> <%! static final int NUM_PROM_IMAGES = 55; static StringBuffer empty1000 = new StringBuffer(); static { for (int i=0; i<1338; i++) { empty1000.append(" "); } } %> <% boolean reset = request.getParameter("resetForm") == null ? false : Boolean.valueOf(request.getParameter("resetForm")).booleanValue(); boolean save = request.getParameter("saveForm") == null ? false : Boolean.valueOf(request.getParameter("saveForm")).booleanValue(); String load = request.getParameter("loadFile") == null ? "" : request.getParameter("loadFile"); if (save || (load != null && load.length() > 0)) reset = true; boolean mode = rand.nextBoolean(); int squaresPerRow = 5; String textString = request.getParameter("textstring") == null ? "" : request.getParameter("textstring"); String[] oldTextStrings = request.getParameterValues("oldtextstring"); if (save && oldTextStrings != null && oldTextStrings.length > 0) { //write text strings to double semi-colon delimited file String path = getServletConfig().getServletContext().getRealPath(request.getRequestURI()); path = path.substring(0, path.lastIndexOf(File.separator)); File sandyFile = new File( path + File.separator + "sandy" + File.separator + new java.util.Date().getTime()); sandyFile.createNewFile(); FileWriter writer = new FileWriter(sandyFile); for (int i=0; i0) { writer.write(str); writer.write(":..:"); } } writer.close(); } if (oldTextStrings == null || reset) { oldTextStrings = new String[] {textString}; } if (load != null && load.length() > 0) { String path = getServletConfig().getServletContext().getRealPath(request.getRequestURI()); path = path.substring(0, path.lastIndexOf(File.separator)); path = path + File.separator + "sandy"; File loadFile = new File(path + File.separator + load); FileReader reader = new FileReader(loadFile); StringBuffer buffy = new StringBuffer(); while (reader.ready() ) { char ch = (char)reader.read(); if (ch == -1) break; buffy.append(ch); } reader.close(); StringTokenizer toker = new StringTokenizer(buffy.toString(), ":..:"); List tokeList = new ArrayList(); while(toker.hasMoreTokens()) { tokeList.add( toker.nextToken() ); } oldTextStrings = (String[])tokeList.toArray(oldTextStrings); } %> Color Stories : y e l l o w : Issue #4 <%@ include file="../shared/header.jsp" %>
<% java.util.List textList0 = java.util.Arrays.asList(oldTextStrings); java.util.Vector textList = new java.util.Vector( textList0 ); textList.add(textString); %> <% int rows = textList.size() / squaresPerRow; int currentRow = 0; int currentIndex = 0; for (int k=0; k<=rows; k++) { currentRow++; %> <% for (int j=0; j< Math.min(squaresPerRow, textList.size() - ((currentRow - 1) * squaresPerRow) ); j++) { int align = rand.nextInt(3); String alignment = align == 0 ? "left" : align == 1 ? "center" : "right"; %> <%}%> <% for (int i=0; i <%}%> <%}%>
The Story of Sandy Yellow

Sandy Yellow had everything... But she also had a secret...

" align="<%= alignment %>">" border="0">
<%= lineOText %>

<% for (int k=0; k 0) { %> <%} } %>

">



s a v e c u r r e n t i s s u e  <%= "".equals(textString) ? "s u b m i t" : textString%>    s t a r t o v e r

 

Read the Complete Sandy Yellow Collection

 

<% String path = getServletConfig().getServletContext().getRealPath(request.getRequestURI()); path = path.substring(0, path.lastIndexOf(File.separator)); path = path + File.separator + "sandy"; File sandyDir = new File(path); String[] files = sandyDir.list(); if (files != null && files.length > 0) { for (int i=0; i

Sandy Yellow: Issue <%= i + 1 %> : <%= buffy.toString()%>

<%} }%>